From 9a5762d8dbbeb8cbb893a6542a173ef220452a87 Mon Sep 17 00:00:00 2001 From: KT Date: Sun, 28 Jan 2024 11:55:22 +0800 Subject: [PATCH] Add tears of themis daily reward (#2) --- genshin/client/routes.py | 3 +++ genshin/models/hoyolab/record.py | 4 ++++ genshin/types.py | 6 ++++++ genshin/utility/uid.py | 4 ++++ 4 files changed, 17 insertions(+) diff --git a/genshin/client/routes.py b/genshin/client/routes.py index becf0e37..5a26f3fd 100644 --- a/genshin/client/routes.py +++ b/genshin/client/routes.py @@ -177,11 +177,14 @@ def get_url(self, region: types.Region, game: types.Game) -> yarl.URL: genshin="https://sg-hk4e-api.hoyolab.com/event/sol?act_id=e202102251931481", honkai3rd="https://sg-public-api.hoyolab.com/event/mani?act_id=e202110291205111", hkrpg="https://sg-public-api.hoyolab.com/event/luna/os?act_id=e202303301540311", + tot="https://sg-public-api.hoyolab.com/event/luna/os?act_id=e202202281857121", + tot_tw="https://sg-public-api.hoyolab.com/event/luna/os?act_id=e202308141137581", ), chinese=dict( genshin="https://api-takumi.mihoyo.com/event/bbs_sign_reward/?act_id=e202009291139501", honkai3rd="https://api-takumi.mihoyo.com/event/luna/?act_id=e202207181446311", hkrpg="https://api-takumi.mihoyo.com/event/luna/?act_id=e202304121516551", + tot="https://api-takumi.mihoyo.com/event/luna/?act_id=e202202251749321", ), ) diff --git a/genshin/models/hoyolab/record.py b/genshin/models/hoyolab/record.py index e47225d4..13608613 100644 --- a/genshin/models/hoyolab/record.py +++ b/genshin/models/hoyolab/record.py @@ -50,6 +50,10 @@ def game(self) -> types.Game: return types.Game.HONKAI elif "hkrpg" in self.game_biz: return types.Game.STARRAIL + elif "nxx" in self.game_biz: + if "tw" in self.game_biz: + return types.Game.THEMIS_TW + return types.Game.THEMIS try: return types.Game(self.game_biz) diff --git a/genshin/types.py b/genshin/types.py index 9b87fd9c..38023cc9 100644 --- a/genshin/types.py +++ b/genshin/types.py @@ -33,6 +33,12 @@ class Game(str, enum.Enum): STARRAIL = "hkrpg" """Honkai Star Rail""" + THEMIS = "tot" + """Tears of Themis""" + + THEMIS_TW = "tot_tw" + """Tears of Themis (Taiwan)""" + IDOr = typing.Union[int, UniqueT] """Allows partial objects.""" diff --git a/genshin/utility/uid.py b/genshin/utility/uid.py index e0fabcae..c074be42 100644 --- a/genshin/utility/uid.py +++ b/genshin/utility/uid.py @@ -64,6 +64,10 @@ def get_prod_game_biz(region: types.Region, game: types.Game) -> str: game_biz = "hk4e_" elif game == types.Game.STARRAIL: game_biz = "hkrpg_" + elif game == types.Game.THEMIS: + game_biz = "nxx_" + elif game == types.Game.THEMIS_TW: + return "nxx_tw" if region == types.Region.OVERSEAS: game_biz += "global"