From 9877d1203d5249a1ee45c344d5b492c1b99823df Mon Sep 17 00:00:00 2001 From: Heng Yu Date: Mon, 16 Dec 2024 16:46:22 +0800 Subject: [PATCH] Add gui options --- config/template.json | 4 ++++ module/config/argument/args.json | 12 ++++++++++++ module/config/argument/argument.yaml | 5 +++++ module/config/argument/stored.json | 12 ++++++++++++ module/config/argument/task.yaml | 1 + module/config/config_generated.py | 4 ++++ module/config/i18n/en-US.json | 16 +++++++++++++++- module/config/i18n/es-ES.json | 14 ++++++++++++++ module/config/i18n/ja-JP.json | 14 ++++++++++++++ module/config/i18n/zh-CN.json | 16 +++++++++++++++- module/config/i18n/zh-TW.json | 14 ++++++++++++++ module/config/stored/stored_generated.py | 1 + tasks/freebies/freebies.py | 13 +++++++++++-- tasks/freebies/gift_of_odyssey.py | 4 +++- 14 files changed, 125 insertions(+), 5 deletions(-) diff --git a/config/template.json b/config/template.json index 72490a2fc..e96bad208 100644 --- a/config/template.json +++ b/config/template.json @@ -223,6 +223,10 @@ }, "SupportReward": { "Collect": true + }, + "GiftofOdyssey": { + "Collect": true, + "GiftofOdysseyClaimed": {} } }, "Weekly": { diff --git a/module/config/argument/args.json b/module/config/argument/args.json index bba6beea5..7322c46ef 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -1378,6 +1378,18 @@ "type": "checkbox", "value": true } + }, + "GiftofOdyssey": { + "Collect": { + "type": "checkbox", + "value": true + }, + "GiftofOdysseyClaimed": { + "type": "stored", + "value": {}, + "display": "display", + "stored": "StoredInt" + } } }, "Weekly": { diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 742bdcc41..e7dc82ef9 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -136,6 +136,11 @@ DungeonStorage: color: "#8fb5fe" SupportReward: Collect: true +GiftofOdyssey: + Collect: true + GiftofOdysseyClaimed: + stored: StoredInt + display: display Planner: PlannerOverall: stored: StoredPlannerOverall diff --git a/module/config/argument/stored.json b/module/config/argument/stored.json index 5d4fe94f4..1f18cf131 100644 --- a/module/config/argument/stored.json +++ b/module/config/argument/stored.json @@ -951,6 +951,18 @@ "order": 0, "color": "#777777" }, + "GiftofOdysseyClaimed": { + "name": "GiftofOdysseyClaimed", + "path": "Freebies.GiftofOdyssey.GiftofOdysseyClaimed", + "i18n": "GiftofOdyssey.GiftofOdysseyClaimed.name", + "stored": "StoredInt", + "attrs": { + "time": "2020-01-01 00:00:00", + "value": 0 + }, + "order": 0, + "color": "#777777" + }, "SimulatedUniverseFarm": { "name": "SimulatedUniverseFarm", "path": "Rogue.RogueWorld.SimulatedUniverseFarm", diff --git a/module/config/argument/task.yaml b/module/config/argument/task.yaml index 8e4e5195a..238ec2687 100644 --- a/module/config/argument/task.yaml +++ b/module/config/argument/task.yaml @@ -50,6 +50,7 @@ Daily: Freebies: - Scheduler - SupportReward + - GiftofOdyssey # ==================== Weekly ==================== diff --git a/module/config/config_generated.py b/module/config/config_generated.py index f6e3bb636..4665c863e 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -67,6 +67,10 @@ class GeneratedConfig: # Group `SupportReward` SupportReward_Collect = True + # Group `GiftofOdyssey` + GiftofOdyssey_Collect = True + GiftofOdyssey_GiftofOdysseyClaimed = {} + # Group `Planner` Planner_PlannerOverall = {} Planner_Item_Credit = {} diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 6955979f8..48f14a860 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -500,6 +500,20 @@ "help": "" } }, + "GiftofOdyssey": { + "_info": { + "name": "Gift of Odyssey", + "help": "" + }, + "Collect": { + "name": "Claim Gift of Odyssey", + "help": "" + }, + "GiftofOdysseyClaimed": { + "name": "Claimed X days of reward", + "help": "" + } + }, "Planner": { "_info": { "name": "Character Planner Progress", @@ -1256,4 +1270,4 @@ "Clear": "Clear" } } -} \ No newline at end of file +} diff --git a/module/config/i18n/es-ES.json b/module/config/i18n/es-ES.json index c0d57c3c9..2abf3edd0 100644 --- a/module/config/i18n/es-ES.json +++ b/module/config/i18n/es-ES.json @@ -500,6 +500,20 @@ "help": "" } }, + "GiftofOdyssey": { + "_info": { + "name": "GiftofOdyssey._info.name", + "help": "GiftofOdyssey._info.help" + }, + "Collect": { + "name": "GiftofOdyssey.Collect.name", + "help": "GiftofOdyssey.Collect.help" + }, + "GiftofOdysseyClaimed": { + "name": "GiftofOdyssey.GiftofOdysseyClaimed.name", + "help": "GiftofOdyssey.GiftofOdysseyClaimed.help" + } + }, "Planner": { "_info": { "name": "Progreso del planificador de personajes", diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 399426ece..da9bf2056 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -500,6 +500,20 @@ "help": "" } }, + "GiftofOdyssey": { + "_info": { + "name": "GiftofOdyssey._info.name", + "help": "GiftofOdyssey._info.help" + }, + "Collect": { + "name": "GiftofOdyssey.Collect.name", + "help": "GiftofOdyssey.Collect.help" + }, + "GiftofOdysseyClaimed": { + "name": "GiftofOdyssey.GiftofOdysseyClaimed.name", + "help": "GiftofOdyssey.GiftofOdysseyClaimed.help" + } + }, "Planner": { "_info": { "name": "Planner._info.name", diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index af6090138..671022742 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -500,6 +500,20 @@ "help": "" } }, + "GiftofOdyssey": { + "_info": { + "name": "巡星之礼(版本十连)", + "help": "" + }, + "Collect": { + "name": "领取巡星之礼", + "help": "" + }, + "GiftofOdysseyClaimed": { + "name": "已领取 X 天", + "help": "" + } + }, "Planner": { "_info": { "name": "养成规划进度", @@ -1256,4 +1270,4 @@ "Clear": "清除" } } -} \ No newline at end of file +} diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index ad4f671f1..c7d9fca4f 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -500,6 +500,20 @@ "help": "" } }, + "GiftofOdyssey": { + "_info": { + "name": "GiftofOdyssey._info.name", + "help": "GiftofOdyssey._info.help" + }, + "Collect": { + "name": "GiftofOdyssey.Collect.name", + "help": "GiftofOdyssey.Collect.help" + }, + "GiftofOdysseyClaimed": { + "name": "GiftofOdyssey.GiftofOdysseyClaimed.name", + "help": "GiftofOdyssey.GiftofOdysseyClaimed.help" + } + }, "Planner": { "_info": { "name": "養成規劃進度", diff --git a/module/config/stored/stored_generated.py b/module/config/stored/stored_generated.py index 00c87bb5a..29bdfbfea 100644 --- a/module/config/stored/stored_generated.py +++ b/module/config/stored/stored_generated.py @@ -114,4 +114,5 @@ class StoredGenerated: CloudRemainSeasonPass = StoredInt("DataUpdate.CloudStorage.CloudRemainSeasonPass") CloudRemainPaid = StoredInt("DataUpdate.CloudStorage.CloudRemainPaid") CloudRemainFree = StoredInt("DataUpdate.CloudStorage.CloudRemainFree") + GiftofOdysseyClaimed = StoredInt("Freebies.GiftofOdyssey.GiftofOdysseyClaimed") SimulatedUniverseFarm = StoredSimulatedUniverseElite("Rogue.RogueWorld.SimulatedUniverseFarm") diff --git a/tasks/freebies/freebies.py b/tasks/freebies/freebies.py index d8128c047..22cb083c6 100644 --- a/tasks/freebies/freebies.py +++ b/tasks/freebies/freebies.py @@ -1,6 +1,8 @@ from module.logger import logger from module.base.base import ModuleBase from tasks.freebies.support_reward import SupportReward +from tasks.freebies.gift_of_odyssey import GiftofOdyssey + class Freebies(ModuleBase): def run(self): @@ -10,5 +12,12 @@ class Freebies(ModuleBase): if self.config.SupportReward_Collect: logger.hr('Support Reward') SupportReward(config=self.config, device=self.device).run() - - self.config.task_delay(server_update=True) \ No newline at end of file + if self.config.GiftofOdyssey_Collect: + logger.hr('Gift of Odyssey') + if self.config.stored.GiftofOdysseyClaimed == 7: + logger.hr('All Claimed in this patch') + else: + GiftofOdyssey(config=self.config, device=self.device).run() + + self.config.task_delay(server_update=True) + diff --git a/tasks/freebies/gift_of_odyssey.py b/tasks/freebies/gift_of_odyssey.py index ae2cf942e..adf50249d 100644 --- a/tasks/freebies/gift_of_odyssey.py +++ b/tasks/freebies/gift_of_odyssey.py @@ -30,7 +30,8 @@ class GiftofOdyssey(UI): self.device.screenshot() results = ocr.matched_ocr(self.device.image, GiftOfOdysseyEvent) if len(results) == 0 and timer.reached(): - logger.info("Event not found") + logger.info("Event not found, probably already been claimed") + self.config.stored.GiftofOdysseyClaimed.value = 7 return False if len(results) == 1: break @@ -58,6 +59,7 @@ class GiftofOdyssey(UI): logger.info(f"Claim status (Claimed, Claim, Awaiting check in): {status}") if sum(status) != 7: logger.warning("Num of OCR results is not seven") + self.config.stored.GiftofOdysseyClaimed.value = status[0] return status def _get_reward(self):