From f50fbb7951e3836032e6e1a0f124d49e57d61242 Mon Sep 17 00:00:00 2001 From: katze Date: Wed, 6 Mar 2024 15:06:51 +0800 Subject: [PATCH 01/10] modify .gitignore to ignore files automatically added by src deployer --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index fcbdca7c1..f2d8ffb46 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,14 @@ config/reloadflag config/reloadalas test.py test/ +resources/ +locales/ +*.pak +*.dll +*.dat +v8_context_snapshot.bin +snapshot_blob.bin +vk_swiftshader_icd.json # Created by .ignore support plugin (hsz.mobi) From 0d4ee2640f9067bfe358cfaeccb039c99ad46667 Mon Sep 17 00:00:00 2001 From: katze Date: Wed, 6 Mar 2024 16:32:14 +0800 Subject: [PATCH 02/10] rogue farming feature: enter rogue when RogueWorld_WeeklyFarming is enabled to acquire materials from boss --- config/template.json | 4 +++- module/config/argument/args.json | 8 ++++++++ module/config/argument/argument.yaml | 2 ++ module/config/config_generated.py | 2 ++ module/config/i18n/en-US.json | 8 ++++++++ module/config/i18n/es-ES.json | 8 ++++++++ module/config/i18n/ja-JP.json | 8 ++++++++ module/config/i18n/zh-CN.json | 8 ++++++++ module/config/i18n/zh-TW.json | 8 ++++++++ tasks/rogue/entry/entry.py | 14 ++++++++++---- tasks/rogue/rogue.py | 5 +++++ 11 files changed, 70 insertions(+), 5 deletions(-) diff --git a/config/template.json b/config/template.json index 72e91bb2a..8f8fb56d9 100644 --- a/config/template.json +++ b/config/template.json @@ -193,7 +193,9 @@ "DomainStrategy": "combat", "UseImmersifier": true, "DoubleEvent": true, - "UseStamina": false + "UseStamina": false, + "WeeklyFarming": false, + "WeeklyFarmingCount": 0 }, "RogueBlessing": { "PresetBlessingFilter": "preset", diff --git a/module/config/argument/args.json b/module/config/argument/args.json index c85879ceb..0b2e25f14 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -1423,6 +1423,14 @@ "UseStamina": { "type": "checkbox", "value": false + }, + "WeeklyFarming": { + "type": "checkbox", + "value": false + }, + "WeeklyFarmingCount": { + "type": "input", + "value": 0 } }, "RogueBlessing": { diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 871437c39..ec4bd32e4 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -237,6 +237,8 @@ RogueWorld: UseImmersifier: true DoubleEvent: true UseStamina: false + WeeklyFarming: false + WeeklyFarmingCount: 0 RogueBlessing: PresetBlessingFilter: diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 8af4d7616..4f2d92239 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -133,6 +133,8 @@ class GeneratedConfig: RogueWorld_UseImmersifier = True RogueWorld_DoubleEvent = True RogueWorld_UseStamina = False + RogueWorld_WeeklyFarming = False + RogueWorld_WeeklyFarmingCount = 0 # Group `RogueBlessing` RogueBlessing_PresetBlessingFilter = 'preset' # preset, custom diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index b6dad37bd..c5f643d53 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -940,6 +940,14 @@ "UseStamina": { "name": "Farm Planers Using Trailblase Power", "help": "Task \"Dungeon\" will no longer run, and all trailblaze power will be used first to claim immersion rewards, except for double events." + }, + "WeeklyFarming": { + "name": "RogueWorld.WeeklyFarming.name", + "help": "RogueWorld.WeeklyFarming.help" + }, + "WeeklyFarmingCount": { + "name": "RogueWorld.WeeklyFarmingCount.name", + "help": "RogueWorld.WeeklyFarmingCount.help" } }, "RogueBlessing": { diff --git a/module/config/i18n/es-ES.json b/module/config/i18n/es-ES.json index e9a468347..473addc25 100644 --- a/module/config/i18n/es-ES.json +++ b/module/config/i18n/es-ES.json @@ -940,6 +940,14 @@ "UseStamina": { "name": "Reclamar de planers mediante poder trazacaminos", "help": "La tarea de mazmorra ya no se ejecutará y todo el poder trazacaminos se usará primero para reclamar recompensas de inmersión, excepto para eventos dobles" + }, + "WeeklyFarming": { + "name": "RogueWorld.WeeklyFarming.name", + "help": "RogueWorld.WeeklyFarming.help" + }, + "WeeklyFarmingCount": { + "name": "RogueWorld.WeeklyFarmingCount.name", + "help": "RogueWorld.WeeklyFarmingCount.help" } }, "RogueBlessing": { diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index a09ba1f54..92a388025 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -940,6 +940,14 @@ "UseStamina": { "name": "RogueWorld.UseStamina.name", "help": "RogueWorld.UseStamina.help" + }, + "WeeklyFarming": { + "name": "RogueWorld.WeeklyFarming.name", + "help": "RogueWorld.WeeklyFarming.help" + }, + "WeeklyFarmingCount": { + "name": "RogueWorld.WeeklyFarmingCount.name", + "help": "RogueWorld.WeeklyFarmingCount.help" } }, "RogueBlessing": { diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 4f8a58c57..bc469f3c2 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -940,6 +940,14 @@ "UseStamina": { "name": "使用开拓力刷内圈遗器", "help": "每日副本任务将不再打本,所有开拓力将优先被用于领取浸器奖励,双倍活动时除外" + }, + "WeeklyFarming": { + "name": "积分满后继续刷取材料", + "help": "每周积分满后不停止,刷取完33次boss以获取形迹材料" + }, + "WeeklyFarmingCount": { + "name": "剩余材料刷取次数", + "help": "每周刷取33次boss,即11次模拟宇宙" } }, "RogueBlessing": { diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index b77f7b05f..933cb3cb1 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -940,6 +940,14 @@ "UseStamina": { "name": "用開拓力農遺器", "help": "每日副本任務將不再打本,所有開拓力將優先被用於領取浸器獎勵,雙倍活動時除外" + }, + "WeeklyFarming": { + "name": "RogueWorld.WeeklyFarming.name", + "help": "RogueWorld.WeeklyFarming.help" + }, + "WeeklyFarmingCount": { + "name": "RogueWorld.WeeklyFarmingCount.name", + "help": "RogueWorld.WeeklyFarmingCount.help" } }, "RogueBlessing": { diff --git a/tasks/rogue/entry/entry.py b/tasks/rogue/entry/entry.py index 4a7bd2410..0ec0b4009 100644 --- a/tasks/rogue/entry/entry.py +++ b/tasks/rogue/entry/entry.py @@ -332,7 +332,8 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI): """ logger.info(f'RogueWorld_UseImmersifier={self.config.RogueWorld_UseImmersifier}, ' f'RogueWorld_UseStamina={self.config.RogueWorld_UseStamina}, ' - f'RogueWorld_DoubleEvent={self.config.RogueWorld_DoubleEvent}' + f'RogueWorld_DoubleEvent={self.config.RogueWorld_DoubleEvent}, ' + f'RogueWorld_WeeklyFarming={self.config.RogueWorld_WeeklyFarming}, ' f'RogueDebug_DebugMode={self.config.RogueDebug_DebugMode}') # This shouldn't happen if self.config.RogueWorld_UseStamina and not self.config.RogueWorld_UseImmersifier: @@ -347,11 +348,16 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI): return if self.config.stored.SimulatedUniverse.is_expired(): - # Expired, do rogue - pass + # Expired, do rogue and reset weekly farming count + self.config.RogueWorld_WeeklyFarmingCount = 11 + elif self.config.stored.SimulatedUniverse.is_full(): if self.config.RogueWorld_UseImmersifier and self.config.stored.Immersifier.value > 0: - logger.info('Reached weekly point limit but still have immersifiers left, continue to use them') + logger.info( + 'Reached weekly point limit but still have immersifiers left, continue to use them') + elif self.config.RogueWorld_WeeklyFarming and self.config.RogueWorld_WeeklyFarmingCount > 0: + logger.info( + 'Reached weekly point limit but still continue to farm materials') else: raise RogueReachedWeeklyPointLimit else: diff --git a/tasks/rogue/rogue.py b/tasks/rogue/rogue.py index 7635b25b8..6ba91504f 100644 --- a/tasks/rogue/rogue.py +++ b/tasks/rogue/rogue.py @@ -28,6 +28,11 @@ class Rogue(RouteLoader, RogueEntry): self.rogue_run() self.rogue_reward_claim() + # runs when one rogue run finishes (do not handle whether the last rogue run finished or failed due to one who use this feature has less chance of failure -- would be better if check boss battle result instead of rogue result, but this version also works), and decreases rogue farming count by 1 + if self.config.RogueWorld_WeeklyFarming and self.config.RogueWorld_WeeklyFarmingCount > 0: + self.config.RogueWorld_WeeklyFarmingCount -= 1 + logger.attr("WeeklyFarmingCount", + self.config.RogueWorld_WeeklyFarmingCount) return True def run(self): From e49ec5479e76a71044ae22f7fba55c6abf028924 Mon Sep 17 00:00:00 2001 From: katze Date: Wed, 6 Mar 2024 16:57:01 +0800 Subject: [PATCH 03/10] multilanguage translation --- module/config/i18n/en-US.json | 8 ++++---- module/config/i18n/es-ES.json | 8 ++++---- module/config/i18n/ja-JP.json | 8 ++++---- module/config/i18n/zh-CN.json | 8 ++++---- module/config/i18n/zh-TW.json | 8 ++++---- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index c5f643d53..3571e9cbf 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -942,12 +942,12 @@ "help": "Task \"Dungeon\" will no longer run, and all trailblaze power will be used first to claim immersion rewards, except for double events." }, "WeeklyFarming": { - "name": "RogueWorld.WeeklyFarming.name", - "help": "RogueWorld.WeeklyFarming.help" + "name": "Boss Material Farming", + "help": "Not stop after weekly points are full, farm the boss 33 times (i.e., 11 cosmic simulations) instead to obtain trace materials" }, "WeeklyFarmingCount": { - "name": "RogueWorld.WeeklyFarmingCount.name", - "help": "RogueWorld.WeeklyFarmingCount.help" + "name": "Material Attempts Remaining This Week: X", + "help": "Resets every Monday" } }, "RogueBlessing": { diff --git a/module/config/i18n/es-ES.json b/module/config/i18n/es-ES.json index 473addc25..def4b7825 100644 --- a/module/config/i18n/es-ES.json +++ b/module/config/i18n/es-ES.json @@ -942,12 +942,12 @@ "help": "La tarea de mazmorra ya no se ejecutará y todo el poder trazacaminos se usará primero para reclamar recompensas de inmersión, excepto para eventos dobles" }, "WeeklyFarming": { - "name": "RogueWorld.WeeklyFarming.name", - "help": "RogueWorld.WeeklyFarming.help" + "name": "Recolección de Materiales de Jefes", + "help": "No detenerse después de que los puntos semanales estén llenos, farmear al jefe 33 veces (es decir, 11 simulaciones cósmicas) para obtener materiales de rastro" }, "WeeklyFarmingCount": { - "name": "RogueWorld.WeeklyFarmingCount.name", - "help": "RogueWorld.WeeklyFarmingCount.help" + "name": "Intentos de Material Restantes Esta Semana: X", + "help": "Se reinicia cada lunes" } }, "RogueBlessing": { diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 92a388025..272429ca7 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -942,12 +942,12 @@ "help": "RogueWorld.UseStamina.help" }, "WeeklyFarming": { - "name": "RogueWorld.WeeklyFarming.name", - "help": "RogueWorld.WeeklyFarming.help" + "name": "ボス素材を収集", + "help": "週間ポイントが満点に達しても停止せず、33回のボス(つまり11回の模擬宇宙)を収集して軌跡素材を入手" }, "WeeklyFarmingCount": { - "name": "RogueWorld.WeeklyFarmingCount.name", - "help": "RogueWorld.WeeklyFarmingCount.help" + "name": "今週の素材が残りX回", + "help": "毎週月曜日にリセット" } }, "RogueBlessing": { diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index bc469f3c2..185558a84 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -942,12 +942,12 @@ "help": "每日副本任务将不再打本,所有开拓力将优先被用于领取浸器奖励,双倍活动时除外" }, "WeeklyFarming": { - "name": "积分满后继续刷取材料", - "help": "每周积分满后不停止,刷取完33次boss以获取形迹材料" + "name": "刷取Boss材料", + "help": "每周积分满后不停止,刷取33次Boss(即11次模拟宇宙)以获取形迹材料" }, "WeeklyFarmingCount": { - "name": "剩余材料刷取次数", - "help": "每周刷取33次boss,即11次模拟宇宙" + "name": "本周材料剩余X次", + "help": "每周一重置" } }, "RogueBlessing": { diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 933cb3cb1..5f60af443 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -942,12 +942,12 @@ "help": "每日副本任務將不再打本,所有開拓力將優先被用於領取浸器獎勵,雙倍活動時除外" }, "WeeklyFarming": { - "name": "RogueWorld.WeeklyFarming.name", - "help": "RogueWorld.WeeklyFarming.help" + "name": "刷取Boss材料", + "help": "每週積分滿後不停止,刷取33次Boss(即11次模擬宇宙)以獲取形跡材料" }, "WeeklyFarmingCount": { - "name": "RogueWorld.WeeklyFarmingCount.name", - "help": "RogueWorld.WeeklyFarmingCount.help" + "name": "本週材料剩餘X次", + "help": "每週一重置" } }, "RogueBlessing": { From 7130b09540d3fb50131e90c7126db4c87c53e8d7 Mon Sep 17 00:00:00 2001 From: katze Date: Wed, 6 Mar 2024 17:11:37 +0800 Subject: [PATCH 04/10] translation bugfix --- module/config/i18n/en-US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 3571e9cbf..1b1e2cedb 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -943,7 +943,7 @@ }, "WeeklyFarming": { "name": "Boss Material Farming", - "help": "Not stop after weekly points are full, farm the boss 33 times (i.e., 11 cosmic simulations) instead to obtain trace materials" + "help": "Not stop after point reward is full; farm the boss 33 times (i.e., 11 Simulated Universe) instead to obtain trace materials" }, "WeeklyFarmingCount": { "name": "Material Attempts Remaining This Week: X", From 76c8f9eda62f0249c51efa3bb3a242fb0feb2d1c Mon Sep 17 00:00:00 2001 From: katze Date: Fri, 8 Mar 2024 11:31:24 +0800 Subject: [PATCH 05/10] discard modification of .gitignore cause it is less related to the current PR --- .gitignore | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.gitignore b/.gitignore index f2d8ffb46..fcbdca7c1 100644 --- a/.gitignore +++ b/.gitignore @@ -19,14 +19,6 @@ config/reloadflag config/reloadalas test.py test/ -resources/ -locales/ -*.pak -*.dll -*.dat -v8_context_snapshot.bin -snapshot_blob.bin -vk_swiftshader_icd.json # Created by .ignore support plugin (hsz.mobi) From f5bc0d0ce14f975b72600e478902e80af4e2cb93 Mon Sep 17 00:00:00 2001 From: katze Date: Sat, 9 Mar 2024 15:12:11 +0800 Subject: [PATCH 06/10] Use stored counter to count boss farming times to run --- config/template.json | 3 +-- module/config/argument/args.json | 4 ---- module/config/argument/argument.yaml | 1 - module/config/config_generated.py | 1 - module/config/i18n/en-US.json | 6 +----- module/config/i18n/es-ES.json | 6 +----- module/config/i18n/ja-JP.json | 6 +----- module/config/i18n/zh-CN.json | 6 +----- module/config/i18n/zh-TW.json | 6 +----- module/config/stored/classes.py | 15 ++++++++++++++- tasks/rogue/entry/entry.py | 8 +++++--- tasks/rogue/rogue.py | 5 ----- tasks/rogue/route/base.py | 7 +++++++ 13 files changed, 32 insertions(+), 42 deletions(-) diff --git a/config/template.json b/config/template.json index 8f8fb56d9..1ef395cea 100644 --- a/config/template.json +++ b/config/template.json @@ -194,8 +194,7 @@ "UseImmersifier": true, "DoubleEvent": true, "UseStamina": false, - "WeeklyFarming": false, - "WeeklyFarmingCount": 0 + "WeeklyFarming": false }, "RogueBlessing": { "PresetBlessingFilter": "preset", diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 0b2e25f14..e06a570af 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -1427,10 +1427,6 @@ "WeeklyFarming": { "type": "checkbox", "value": false - }, - "WeeklyFarmingCount": { - "type": "input", - "value": 0 } }, "RogueBlessing": { diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index ec4bd32e4..9e0274401 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -238,7 +238,6 @@ RogueWorld: DoubleEvent: true UseStamina: false WeeklyFarming: false - WeeklyFarmingCount: 0 RogueBlessing: PresetBlessingFilter: diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 4f2d92239..450762d34 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -134,7 +134,6 @@ class GeneratedConfig: RogueWorld_DoubleEvent = True RogueWorld_UseStamina = False RogueWorld_WeeklyFarming = False - RogueWorld_WeeklyFarmingCount = 0 # Group `RogueBlessing` RogueBlessing_PresetBlessingFilter = 'preset' # preset, custom diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index 1b1e2cedb..af3f38303 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -943,11 +943,7 @@ }, "WeeklyFarming": { "name": "Boss Material Farming", - "help": "Not stop after point reward is full; farm the boss 33 times (i.e., 11 Simulated Universe) instead to obtain trace materials" - }, - "WeeklyFarmingCount": { - "name": "Material Attempts Remaining This Week: X", - "help": "Resets every Monday" + "help": "Do not stop after point reward is full; farm the boss 100 times instead to obtain trace materials" } }, "RogueBlessing": { diff --git a/module/config/i18n/es-ES.json b/module/config/i18n/es-ES.json index def4b7825..22be96fa2 100644 --- a/module/config/i18n/es-ES.json +++ b/module/config/i18n/es-ES.json @@ -943,11 +943,7 @@ }, "WeeklyFarming": { "name": "Recolección de Materiales de Jefes", - "help": "No detenerse después de que los puntos semanales estén llenos, farmear al jefe 33 veces (es decir, 11 simulaciones cósmicas) para obtener materiales de rastro" - }, - "WeeklyFarmingCount": { - "name": "Intentos de Material Restantes Esta Semana: X", - "help": "Se reinicia cada lunes" + "help": "No detenerse después de que los puntos semanales estén llenos, farmear al jefe 100 veces para obtener materiales de rastro" } }, "RogueBlessing": { diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 272429ca7..be59b56d2 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -943,11 +943,7 @@ }, "WeeklyFarming": { "name": "ボス素材を収集", - "help": "週間ポイントが満点に達しても停止せず、33回のボス(つまり11回の模擬宇宙)を収集して軌跡素材を入手" - }, - "WeeklyFarmingCount": { - "name": "今週の素材が残りX回", - "help": "毎週月曜日にリセット" + "help": "週間ポイントが満点に達しても停止せず、100回のボスをファームして軌跡素材を入手" } }, "RogueBlessing": { diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 185558a84..2658d658f 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -943,11 +943,7 @@ }, "WeeklyFarming": { "name": "刷取Boss材料", - "help": "每周积分满后不停止,刷取33次Boss(即11次模拟宇宙)以获取形迹材料" - }, - "WeeklyFarmingCount": { - "name": "本周材料剩余X次", - "help": "每周一重置" + "help": "每周积分满后不停止,刷取100次Boss以获取形迹材料" } }, "RogueBlessing": { diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 5f60af443..6af71b5f5 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -943,11 +943,7 @@ }, "WeeklyFarming": { "name": "刷取Boss材料", - "help": "每週積分滿後不停止,刷取33次Boss(即11次模擬宇宙)以獲取形跡材料" - }, - "WeeklyFarmingCount": { - "name": "本週材料剩餘X次", - "help": "每週一重置" + "help": "每週積分滿後不停止,刷取100次Boss以獲取形跡材料" } }, "RogueBlessing": { diff --git a/module/config/stored/classes.py b/module/config/stored/classes.py index 44e818826..de1c7cdf7 100644 --- a/module/config/stored/classes.py +++ b/module/config/stored/classes.py @@ -205,7 +205,20 @@ class StoredImmersifier(StoredCounter): class StoredSimulatedUniverse(StoredCounter, StoredExpiredAtMonday0400): - pass + FIXED_DEFAULT = 100 + FarmingCounter = FIXED_DEFAULT + + def farm_dec(self, value=1): + self.FarmingCounter -= value + + def farm_reset(self,): + self.FarmingCounter = self.FIXED_DEFAULT + + def farm_not_full(self) -> bool: + return self.FarmingCounter > 0 + + def farm_get_remain(self) -> int: + return self.FarmingCounter class StoredAssignment(StoredCounter): diff --git a/tasks/rogue/entry/entry.py b/tasks/rogue/entry/entry.py index 0ec0b4009..723a668d9 100644 --- a/tasks/rogue/entry/entry.py +++ b/tasks/rogue/entry/entry.py @@ -348,14 +348,16 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI): return if self.config.stored.SimulatedUniverse.is_expired(): - # Expired, do rogue and reset weekly farming count - self.config.RogueWorld_WeeklyFarmingCount = 11 + # Expired, do rogue and reset farming counter + self.config.stored.SimulatedUniverse.farm_reset() elif self.config.stored.SimulatedUniverse.is_full(): if self.config.RogueWorld_UseImmersifier and self.config.stored.Immersifier.value > 0: logger.info( 'Reached weekly point limit but still have immersifiers left, continue to use them') - elif self.config.RogueWorld_WeeklyFarming and self.config.RogueWorld_WeeklyFarmingCount > 0: + elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_full(): + logger.attr( + "Farming Counter", self.config.stored.SimulatedUniverse.farm_get_remain()) logger.info( 'Reached weekly point limit but still continue to farm materials') else: diff --git a/tasks/rogue/rogue.py b/tasks/rogue/rogue.py index 6ba91504f..7635b25b8 100644 --- a/tasks/rogue/rogue.py +++ b/tasks/rogue/rogue.py @@ -28,11 +28,6 @@ class Rogue(RouteLoader, RogueEntry): self.rogue_run() self.rogue_reward_claim() - # runs when one rogue run finishes (do not handle whether the last rogue run finished or failed due to one who use this feature has less chance of failure -- would be better if check boss battle result instead of rogue result, but this version also works), and decreases rogue farming count by 1 - if self.config.RogueWorld_WeeklyFarming and self.config.RogueWorld_WeeklyFarmingCount > 0: - self.config.RogueWorld_WeeklyFarmingCount -= 1 - logger.attr("WeeklyFarmingCount", - self.config.RogueWorld_WeeklyFarmingCount) return True def run(self): diff --git a/tasks/rogue/route/base.py b/tasks/rogue/route/base.py index b68a4f793..fc8a34c77 100644 --- a/tasks/rogue/route/base.py +++ b/tasks/rogue/route/base.py @@ -170,6 +170,13 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward): pass result = super().clear_enemy(*waypoints) + + # runs when one elite battle finishes (do not handle whether battle succeeded or failed), and decreases rogue farming count by 1 + if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_full(): + self.config.stored.SimulatedUniverse.farm_dec() + logger.info( + f"Cleared elite boss, decrease farming count by 1, now {self.config.stored.SimulatedUniverse.FarmingCounter}") + return result def _domain_event_expected_end(self): From 2bc797f3e2025b1c9a40686e0d88e70b2c39508c Mon Sep 17 00:00:00 2001 From: katze Date: Sat, 9 Mar 2024 15:58:37 +0800 Subject: [PATCH 07/10] Add comments in stored counter class definition --- module/config/stored/classes.py | 9 +++++++-- tasks/rogue/entry/entry.py | 2 +- tasks/rogue/route/base.py | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/module/config/stored/classes.py b/module/config/stored/classes.py index de1c7cdf7..8f62ee857 100644 --- a/module/config/stored/classes.py +++ b/module/config/stored/classes.py @@ -205,16 +205,21 @@ class StoredImmersifier(StoredCounter): class StoredSimulatedUniverse(StoredCounter, StoredExpiredAtMonday0400): + # These variables are used in Rogue Farming feature. + + # Times of boss drop chance per week. In current version of StarRail, this value is 100. FIXED_DEFAULT = 100 + + # Times left to farm. Resets to 100 every Monday 04:00, and decreases each time the elite boss is cleared. FarmingCounter = FIXED_DEFAULT - def farm_dec(self, value=1): + def farm_dec(self, value = 1): self.FarmingCounter -= value def farm_reset(self,): self.FarmingCounter = self.FIXED_DEFAULT - def farm_not_full(self) -> bool: + def farm_not_complete(self) -> bool: return self.FarmingCounter > 0 def farm_get_remain(self) -> int: diff --git a/tasks/rogue/entry/entry.py b/tasks/rogue/entry/entry.py index 723a668d9..f81764df6 100644 --- a/tasks/rogue/entry/entry.py +++ b/tasks/rogue/entry/entry.py @@ -355,7 +355,7 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI): if self.config.RogueWorld_UseImmersifier and self.config.stored.Immersifier.value > 0: logger.info( 'Reached weekly point limit but still have immersifiers left, continue to use them') - elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_full(): + elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_complete(): logger.attr( "Farming Counter", self.config.stored.SimulatedUniverse.farm_get_remain()) logger.info( diff --git a/tasks/rogue/route/base.py b/tasks/rogue/route/base.py index fc8a34c77..54d1f766b 100644 --- a/tasks/rogue/route/base.py +++ b/tasks/rogue/route/base.py @@ -171,8 +171,8 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward): result = super().clear_enemy(*waypoints) - # runs when one elite battle finishes (do not handle whether battle succeeded or failed), and decreases rogue farming count by 1 - if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_full(): + # runs when one elite battle finishes (do not handle whether the battle succeeded or failed), and decreases rogue farming count by 1 + if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_complete(): self.config.stored.SimulatedUniverse.farm_dec() logger.info( f"Cleared elite boss, decrease farming count by 1, now {self.config.stored.SimulatedUniverse.FarmingCounter}") From f262140fb6e22062e5f38b9a2db6d0e64fedf857 Mon Sep 17 00:00:00 2001 From: katze Date: Mon, 1 Apr 2024 01:58:46 +0800 Subject: [PATCH 08/10] Seperate stored counter into an independent class --- config/template.json | 3 ++- module/config/argument/args.json | 6 ++++++ module/config/argument/argument.yaml | 2 ++ module/config/argument/stored.json | 13 +++++++++++++ module/config/config_generated.py | 1 + module/config/i18n/en-US.json | 4 ++++ module/config/i18n/es-ES.json | 4 ++++ module/config/i18n/ja-JP.json | 4 ++++ module/config/i18n/zh-CN.json | 4 ++++ module/config/i18n/zh-TW.json | 4 ++++ module/config/stored/classes.py | 16 ++++++++++------ module/config/stored/stored_generated.py | 2 ++ tasks/map/control/control.py | 4 ++-- tasks/rogue/entry/entry.py | 12 ++++++++---- tasks/rogue/route/base.py | 13 +++++++------ 15 files changed, 73 insertions(+), 19 deletions(-) diff --git a/config/template.json b/config/template.json index 4c2aaf5d8..308482694 100644 --- a/config/template.json +++ b/config/template.json @@ -200,7 +200,8 @@ "UseImmersifier": true, "DoubleEvent": true, "UseStamina": false, - "WeeklyFarming": false + "WeeklyFarming": false, + "SimulatedUniverseElite": {} }, "RogueBlessing": { "PresetBlessingFilter": "preset", diff --git a/module/config/argument/args.json b/module/config/argument/args.json index 42a530a31..0b90417ca 100644 --- a/module/config/argument/args.json +++ b/module/config/argument/args.json @@ -1473,6 +1473,12 @@ "WeeklyFarming": { "type": "checkbox", "value": false + }, + "SimulatedUniverseElite": { + "type": "stored", + "value": {}, + "display": "hide", + "stored": "StoredSimulatedUniverseElite" } }, "RogueBlessing": { diff --git a/module/config/argument/argument.yaml b/module/config/argument/argument.yaml index 51c228e9a..9a94e5aeb 100644 --- a/module/config/argument/argument.yaml +++ b/module/config/argument/argument.yaml @@ -248,6 +248,8 @@ RogueWorld: DoubleEvent: true UseStamina: false WeeklyFarming: false + SimulatedUniverseElite: + stored: StoredSimulatedUniverseElite RogueBlessing: PresetBlessingFilter: diff --git a/module/config/argument/stored.json b/module/config/argument/stored.json index f984b47e4..37764ba0c 100644 --- a/module/config/argument/stored.json +++ b/module/config/argument/stored.json @@ -293,5 +293,18 @@ }, "order": 0, "color": "#777777" + }, + "SimulatedUniverseElite": { + "name": "SimulatedUniverseElite", + "path": "Rogue.RogueWorld.SimulatedUniverseElite", + "i18n": "RogueWorld.SimulatedUniverseElite.name", + "stored": "StoredSimulatedUniverseElite", + "attrs": { + "time": "2020-01-01 00:00:00", + "total": 0, + "value": 100 + }, + "order": 0, + "color": "#777777" } } \ No newline at end of file diff --git a/module/config/config_generated.py b/module/config/config_generated.py index 3c5aedb2c..31c800862 100644 --- a/module/config/config_generated.py +++ b/module/config/config_generated.py @@ -140,6 +140,7 @@ class GeneratedConfig: RogueWorld_DoubleEvent = True RogueWorld_UseStamina = False RogueWorld_WeeklyFarming = False + RogueWorld_SimulatedUniverseElite = {} # Group `RogueBlessing` RogueBlessing_PresetBlessingFilter = 'preset' # preset, custom diff --git a/module/config/i18n/en-US.json b/module/config/i18n/en-US.json index f42961a16..997369465 100644 --- a/module/config/i18n/en-US.json +++ b/module/config/i18n/en-US.json @@ -976,6 +976,10 @@ "WeeklyFarming": { "name": "Boss Material Farming", "help": "Do not stop after point reward is full; farm the boss 100 times instead to obtain trace materials" + }, + "SimulatedUniverseElite": { + "name": "RogueWorld.SimulatedUniverseElite.name", + "help": "RogueWorld.SimulatedUniverseElite.help" } }, "RogueBlessing": { diff --git a/module/config/i18n/es-ES.json b/module/config/i18n/es-ES.json index 2bcadc64c..b14d594d4 100644 --- a/module/config/i18n/es-ES.json +++ b/module/config/i18n/es-ES.json @@ -976,6 +976,10 @@ "WeeklyFarming": { "name": "Recolección de Materiales de Jefes", "help": "No detenerse después de que los puntos semanales estén llenos, farmear al jefe 100 veces para obtener materiales de rastro" + }, + "SimulatedUniverseElite": { + "name": "RogueWorld.SimulatedUniverseElite.name", + "help": "RogueWorld.SimulatedUniverseElite.help" } }, "RogueBlessing": { diff --git a/module/config/i18n/ja-JP.json b/module/config/i18n/ja-JP.json index 1a02dc908..fc1dada67 100644 --- a/module/config/i18n/ja-JP.json +++ b/module/config/i18n/ja-JP.json @@ -976,6 +976,10 @@ "WeeklyFarming": { "name": "ボス素材を収集", "help": "週間ポイントが満点に達しても停止せず、100回のボスをファームして軌跡素材を入手" + }, + "SimulatedUniverseElite": { + "name": "RogueWorld.SimulatedUniverseElite.name", + "help": "RogueWorld.SimulatedUniverseElite.help" } }, "RogueBlessing": { diff --git a/module/config/i18n/zh-CN.json b/module/config/i18n/zh-CN.json index 5423d4ba5..4b5a3e1de 100644 --- a/module/config/i18n/zh-CN.json +++ b/module/config/i18n/zh-CN.json @@ -976,6 +976,10 @@ "WeeklyFarming": { "name": "刷取Boss材料", "help": "每周积分满后不停止,刷取100次Boss以获取形迹材料" + }, + "SimulatedUniverseElite": { + "name": "剩余Boss材料掉落次数", + "help": "RogueWorld.SimulatedUniverseElite.help" } }, "RogueBlessing": { diff --git a/module/config/i18n/zh-TW.json b/module/config/i18n/zh-TW.json index 086ec5a46..0f541b88d 100644 --- a/module/config/i18n/zh-TW.json +++ b/module/config/i18n/zh-TW.json @@ -976,6 +976,10 @@ "WeeklyFarming": { "name": "刷取Boss材料", "help": "每週積分滿後不停止,刷取100次Boss以獲取形跡材料" + }, + "SimulatedUniverseElite": { + "name": "RogueWorld.SimulatedUniverseElite.name", + "help": "RogueWorld.SimulatedUniverseElite.help" } }, "RogueBlessing": { diff --git a/module/config/stored/classes.py b/module/config/stored/classes.py index 8f62ee857..f5ac21193 100644 --- a/module/config/stored/classes.py +++ b/module/config/stored/classes.py @@ -205,25 +205,29 @@ class StoredImmersifier(StoredCounter): class StoredSimulatedUniverse(StoredCounter, StoredExpiredAtMonday0400): + pass + + +class StoredSimulatedUniverseElite(StoredCounter, StoredExpiredAtMonday0400): # These variables are used in Rogue Farming feature. # Times of boss drop chance per week. In current version of StarRail, this value is 100. FIXED_DEFAULT = 100 # Times left to farm. Resets to 100 every Monday 04:00, and decreases each time the elite boss is cleared. - FarmingCounter = FIXED_DEFAULT + value = FIXED_DEFAULT def farm_dec(self, value = 1): - self.FarmingCounter -= value + self.value -= value - def farm_reset(self,): - self.FarmingCounter = self.FIXED_DEFAULT + def farm_reset(self): + self.value = self.FIXED_DEFAULT def farm_not_complete(self) -> bool: - return self.FarmingCounter > 0 + return self.value > 0 def farm_get_remain(self) -> int: - return self.FarmingCounter + return self.value class StoredAssignment(StoredCounter): diff --git a/module/config/stored/stored_generated.py b/module/config/stored/stored_generated.py index bc8f2c526..5a8708305 100644 --- a/module/config/stored/stored_generated.py +++ b/module/config/stored/stored_generated.py @@ -20,6 +20,7 @@ from module.config.stored.classes import ( StoredImmersifier, StoredInt, StoredSimulatedUniverse, + StoredSimulatedUniverseElite, StoredTrailblazePower, ) @@ -50,3 +51,4 @@ class StoredGenerated: Assignment = StoredAssignment("Assignment.Assignment.Assignment") Credit = StoredInt("DataUpdate.ItemStorage.Credit") StallerJade = StoredInt("DataUpdate.ItemStorage.StallerJade") + SimulatedUniverseElite = StoredSimulatedUniverseElite("Rogue.RogueWorld.SimulatedUniverseElite") diff --git a/tasks/map/control/control.py b/tasks/map/control/control.py index e9da793a5..865e0aa64 100644 --- a/tasks/map/control/control.py +++ b/tasks/map/control/control.py @@ -386,7 +386,7 @@ class MapControl(Combat, AimDetectorMixin): end_point = waypoints[-1] end_point.expected_end.append('item') - self.goto(*waypoints) + return self.goto(*waypoints) def clear_enemy(self, *waypoints): """ @@ -403,7 +403,7 @@ class MapControl(Combat, AimDetectorMixin): end_point = waypoints[-1] end_point.expected_end.append('enemy') - self.goto(*waypoints) + return self.goto(*waypoints) if __name__ == '__main__': diff --git a/tasks/rogue/entry/entry.py b/tasks/rogue/entry/entry.py index f81764df6..80820ad07 100644 --- a/tasks/rogue/entry/entry.py +++ b/tasks/rogue/entry/entry.py @@ -348,16 +348,20 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI): return if self.config.stored.SimulatedUniverse.is_expired(): - # Expired, do rogue and reset farming counter - self.config.stored.SimulatedUniverse.farm_reset() + # Expired, do rogue + pass + + if self.config.stored.SimulatedUniverseElite.is_expired(): + # Expired, reset farming counter + self.config.stored.SimulatedUniverseElite.farm_reset() elif self.config.stored.SimulatedUniverse.is_full(): if self.config.RogueWorld_UseImmersifier and self.config.stored.Immersifier.value > 0: logger.info( 'Reached weekly point limit but still have immersifiers left, continue to use them') - elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_complete(): + elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverseElite.farm_not_complete(): logger.attr( - "Farming Counter", self.config.stored.SimulatedUniverse.farm_get_remain()) + "Farming Counter", self.config.stored.SimulatedUniverseElite.farm_get_remain()) logger.info( 'Reached weekly point limit but still continue to farm materials') else: diff --git a/tasks/rogue/route/base.py b/tasks/rogue/route/base.py index 7807aeda5..1007f06d2 100644 --- a/tasks/rogue/route/base.py +++ b/tasks/rogue/route/base.py @@ -170,13 +170,14 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward): pass result = super().clear_enemy(*waypoints) + # logger.attr("result",result) - # runs when one elite battle finishes (do not handle whether the battle succeeded or failed), and decreases rogue farming count by 1 - if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverse.farm_not_complete(): - self.config.stored.SimulatedUniverse.farm_dec() - logger.info( - f"Cleared elite boss, decrease farming count by 1, now {self.config.stored.SimulatedUniverse.FarmingCounter}") - + if 'enemy' in result: + # runs when one elite battle finishes (do not handle whether the battle succeeded or failed), and decreases rogue farming count by 1 + if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverseElite.farm_not_complete(): + self.config.stored.SimulatedUniverseElite.farm_dec() + logger.info( + f"Cleared elite boss, decrease farming count by 1, now {self.config.stored.SimulatedUniverseElite.farm_get_remain()}") return result def _domain_event_expected_end(self): From 721ae382917b1a78d85d16e3c8cb1fd71152aa3f Mon Sep 17 00:00:00 2001 From: katze Date: Mon, 1 Apr 2024 10:33:06 +0800 Subject: [PATCH 09/10] improves readability --- module/config/stored/classes.py | 6 ++++-- tasks/rogue/entry/entry.py | 4 ++-- tasks/rogue/route/base.py | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/module/config/stored/classes.py b/module/config/stored/classes.py index f5ac21193..4ff830f0b 100644 --- a/module/config/stored/classes.py +++ b/module/config/stored/classes.py @@ -217,8 +217,10 @@ class StoredSimulatedUniverseElite(StoredCounter, StoredExpiredAtMonday0400): # Times left to farm. Resets to 100 every Monday 04:00, and decreases each time the elite boss is cleared. value = FIXED_DEFAULT - def farm_dec(self, value = 1): - self.value -= value + def farm_dec(self, delta = 1): + self.value -= delta + if self.value < 0: + self.value = 0 def farm_reset(self): self.value = self.FIXED_DEFAULT diff --git a/tasks/rogue/entry/entry.py b/tasks/rogue/entry/entry.py index 80820ad07..4304cf2a8 100644 --- a/tasks/rogue/entry/entry.py +++ b/tasks/rogue/entry/entry.py @@ -360,10 +360,10 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI): logger.info( 'Reached weekly point limit but still have immersifiers left, continue to use them') elif self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverseElite.farm_not_complete(): - logger.attr( - "Farming Counter", self.config.stored.SimulatedUniverseElite.farm_get_remain()) logger.info( 'Reached weekly point limit but still continue to farm materials') + logger.attr( + "Farming Counter", self.config.stored.SimulatedUniverseElite.farm_get_remain()) else: raise RogueReachedWeeklyPointLimit else: diff --git a/tasks/rogue/route/base.py b/tasks/rogue/route/base.py index 1007f06d2..2126852a3 100644 --- a/tasks/rogue/route/base.py +++ b/tasks/rogue/route/base.py @@ -173,11 +173,11 @@ class RouteBase(RouteBase_, RogueExit, RogueEvent, RogueReward): # logger.attr("result",result) if 'enemy' in result: - # runs when one elite battle finishes (do not handle whether the battle succeeded or failed), and decreases rogue farming count by 1 + # runs when one elite battle finishes, and decreases rogue farming count by 1 if self.config.RogueWorld_WeeklyFarming and self.config.stored.SimulatedUniverseElite.farm_not_complete(): self.config.stored.SimulatedUniverseElite.farm_dec() logger.info( - f"Cleared elite boss, decrease farming count by 1, now {self.config.stored.SimulatedUniverseElite.farm_get_remain()}") + f"Cleared elite boss, decreasing farming count by 1, now {self.config.stored.SimulatedUniverseElite.farm_get_remain()}") return result def _domain_event_expected_end(self): From 4988fb1f2f79db449e726c3a847ad1b67645db55 Mon Sep 17 00:00:00 2001 From: katze Date: Tue, 2 Apr 2024 12:23:28 +0800 Subject: [PATCH 10/10] optimize expiration judging --- tasks/rogue/entry/entry.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tasks/rogue/entry/entry.py b/tasks/rogue/entry/entry.py index 4304cf2a8..c889f23b1 100644 --- a/tasks/rogue/entry/entry.py +++ b/tasks/rogue/entry/entry.py @@ -346,15 +346,14 @@ class RogueEntry(RouteBase, RogueRewardHandler, RoguePathHandler, DungeonUI): if self.config.RogueDebug_DebugMode: # Always run return - - if self.config.stored.SimulatedUniverse.is_expired(): - # Expired, do rogue - pass if self.config.stored.SimulatedUniverseElite.is_expired(): # Expired, reset farming counter self.config.stored.SimulatedUniverseElite.farm_reset() - + + if self.config.stored.SimulatedUniverse.is_expired(): + # Expired, do rogue + pass elif self.config.stored.SimulatedUniverse.is_full(): if self.config.RogueWorld_UseImmersifier and self.config.stored.Immersifier.value > 0: logger.info(