From 0ddc9dabd1543450a7c3f513f177882ed04425fd Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 29 Jul 2024 17:31:05 +0800 Subject: [PATCH] :bug: Fix genshin img theater buff desc --- simnet/client/components/chronicle/genshin.py | 3 +++ simnet/models/genshin/chronicle/img_theater.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/simnet/client/components/chronicle/genshin.py b/simnet/client/components/chronicle/genshin.py index dc55f9e..f8ae09a 100644 --- a/simnet/client/components/chronicle/genshin.py +++ b/simnet/client/components/chronicle/genshin.py @@ -167,6 +167,7 @@ async def get_genshin_imaginarium_theater( player_id: Optional[int] = None, need_detail: Optional[bool] = True, *, + previous: bool = False, lang: Optional[str] = None, ) -> ImgTheater: """Get genshin imaginarium theater runs. @@ -174,6 +175,7 @@ async def get_genshin_imaginarium_theater( Args: player_id (Optional[int], optional): The player ID. Defaults to None. need_detail (Optional[bool], optional): Whether to retrieve detailed data. Defaults to True. + previous (bool, optional): Whether to retrieve the data for the previous season of the Imaginarium Theater. lang (Optional[str], optional): The language of the data. Defaults to None. Returns: @@ -181,6 +183,7 @@ async def get_genshin_imaginarium_theater( """ payload = { "need_detail": need_detail, + "schedule_type": 2 if previous else 1, } data = await self._request_genshin_record("role_combat", player_id, lang=lang, payload=payload) diff --git a/simnet/models/genshin/chronicle/img_theater.py b/simnet/models/genshin/chronicle/img_theater.py index 74f27a8..7c4a066 100644 --- a/simnet/models/genshin/chronicle/img_theater.py +++ b/simnet/models/genshin/chronicle/img_theater.py @@ -7,6 +7,7 @@ from simnet.models.base import APIModel from simnet.models.genshin.character import BaseCharacter from simnet.models.starrail.chronicle.base import PartialTime +from simnet.models.zzz.calculator import desc_to_html class TheaterCharaType(enum.IntEnum): @@ -44,6 +45,10 @@ class TheaterBuff(APIModel): is_enhanced: bool id: int + @property + def desc_html(self) -> str: + return desc_to_html(self.desc) + class Act(APIModel): """One act in the theater."""