Skip to content

Commit

Permalink
Feat: auto ornament
Browse files Browse the repository at this point in the history
  • Loading branch information
moesnow committed Dec 12, 2024
1 parent acb5913 commit b9edeac
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/setting_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ def __initCard(self):
)
self.universeBonusEnableCard = SwitchSettingCard1(
FIF.IOT,
self.tr('领取沉浸奖励'),
None,
self.tr('领取沉浸奖励/执行饰品提取'),
"类别为“模拟宇宙”时,自动领取沉浸奖励。类别为“差分宇宙”时,在领取积分奖励后自动执行饰品提取消耗沉浸器。",
"universe_bonus_enable"
)
self.universeFrequencyCard = ComboBoxSettingCard2(
Expand Down
2 changes: 1 addition & 1 deletion assets/config/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ universe_enable: false # 是否启用模拟宇宙功能。true 开启,false
universe_operation_mode: exe # 模拟宇宙运行方式,可选 "源码"(source)或 "集成"(exe)。
universe_category: divergent # 模拟宇宙类型,可选 "差分宇宙"(divergent)或 "模拟宇宙"(universe)。
universe_disable_gpu: false # 是否禁用GPU加速。true 开启,false 关闭。
universe_bonus_enable: false # 是否领取沉浸奖励。true 开启,false 关闭。
universe_bonus_enable: false # 类别为“模拟宇宙”时,自动领取沉浸奖励。类别为“差分宇宙”时,在领取积分奖励后自动执行饰品提取消耗沉浸器。true 开启,false 关闭。
universe_frequency: weekly # 模拟宇宙运行频率,可选 "每周"(weekly)或 "每天"(daily)。
universe_count: 34 # 模拟宇宙运行次数,设置每次启动时尝试运行的次数。
universe_path: .\3rdparty\Auto_Simulated_Universe # 模拟宇宙路径,指向模拟宇宙脚本或程序的位置。
Expand Down
1 change: 1 addition & 0 deletions assets/docs/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### 更新
- 支持 “触屏模式(云游戏移动端 UI)” 启动游戏(工具箱)
- “领取沉浸奖励” 选项更改为 “领取沉浸奖励/执行饰品提取”(领取积分奖励后将自动执行饰品提取)
- 修复更换新壁纸 “愿今夜无梦” 后无法进入邮箱
- 修复无法识别并跳过末日幻影快速挑战提示框 [#406](https://github.com/moesnow/March7thAssistant/issues/406)

Expand Down
3 changes: 1 addition & 2 deletions tasks/power/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ def process_ornament(instance_type, instance_name, power):
screen.change_to("guide3")

immersifier_crop = (1623.0 / 1920, 40.0 / 1080, 162.0 / 1920, 52.0 / 1080)
text = auto.get_single_line_text(crop=immersifier_crop, blacklist=[
'+', '米'], max_retries=3)
text = auto.get_single_line_text(crop=immersifier_crop, blacklist=['+', '米'], max_retries=3)
if "/8" not in text:
log.error("沉浸器数量识别失败")
return
Expand Down
19 changes: 18 additions & 1 deletion tasks/weekly/universe.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import sys
import os
from module.config import asu_config
from tasks.power.instance import Instance


class Universe:
Expand Down Expand Up @@ -201,9 +202,25 @@ def get_reward(category):
auto.click_element("./assets/images/zh_CN/base/click_close.png", "image", 0.8, max_retries=10)
time.sleep(1)
auto.press_key("esc")
return
if category == "divergent" and cfg.universe_bonus_enable:
Universe.process_ornament()
Base.send_notification_with_screenshot(cfg.notify_template['SimulatedUniverseCompleted'])

@staticmethod
def process_ornament():
screen.change_to("guide3")

immersifier_crop = (1623.0 / 1920, 40.0 / 1080, 162.0 / 1920, 52.0 / 1080)
text = auto.get_single_line_text(crop=immersifier_crop, blacklist=['+', '米'], max_retries=3)
if "/8" not in text:
log.error("沉浸器数量识别失败")
return

immersifier_count = int(text.split("/")[0])
log.info(f"🟣沉浸器: {immersifier_count}/8")
if immersifier_count > 0:
Instance.run("饰品提取", cfg.instance_names["饰品提取"], 40, immersifier_count)

@staticmethod
def gui():
if Universe.before_start():
Expand Down

0 comments on commit b9edeac

Please sign in to comment.