Skip to content

Commit

Permalink
feat: support universe daily task
Browse files Browse the repository at this point in the history
  • Loading branch information
moesnow committed Oct 20, 2023
1 parent 31cd7c3 commit 7dadf3b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/setting_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def __init__(self, parent=None):
self.dailyTasksCard = PushSettingCardDictBool(
self.tr('修改'),
FIF.PALETTE,
self.tr("今日实训"),
self.tr("今日实训(False代表已完成)"),
"daily_tasks"
)
self.lastRunTimeCard = PushSettingCardDate(
Expand Down
2 changes: 1 addition & 1 deletion app/tasks_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __init__(self, parent=None):
| 累计击碎3个可破坏物 | ✅ | 姬子试用 |
| 完成1次「忘却之庭」 | ✅ | 回忆一 |
| 完成1次「历战余响」 | ✅ | |
| 通关「模拟宇宙」(任意世界)的1个区域 | | |
| 通关「模拟宇宙」(任意世界)的1个区域 | | |
| 使用支援角色并获得战斗胜利1次 | ✅ | 清体力 |
| 施放终结技造成制胜一击1次 | ✅ | 回忆一 |
| 将任意角色等级提升1次 | ❌ | |
Expand Down
2 changes: 1 addition & 1 deletion assets/config/screens.json
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@
]
},
{
"name": "暂离",
"name": "退出「模拟宇宙」",
"id": "leave_temporarily",
"image_path": "./assets/images/screen/universe/leave_temporarily.png",
"actions": [
Expand Down
15 changes: 4 additions & 11 deletions assets/docs/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
# Changelog

## v1.6.3.1
## v1.6.4

### 新功能
- 支持通过“姬子试用”完成部分每日实训(实验性)
- 支持通过“回忆一”完成部分每日实训(实验性)
- 支持“开拓者(穹)•毁灭”和“开拓者(穹)•存护”
- 支持完成“通关「模拟宇宙」(任意世界)的1个区域”
- 支持“开拓者(穹)•毁灭”和“开拓者(穹)•存护” [#26](https://github.com/moesnow/March7thAssistant/pull/26)
- 增加模拟宇宙完整性检测 [#27](https://github.com/moesnow/March7thAssistant/pull/27)
- Python 3.12.0 强力驱动
- 适配 Fhoe-Rail 的最新改动
### 修复
- 修复“游戏退出失败”的问题
- “超时时间”修改为小数会导致图形界面启动崩溃
- 无法领取巡光之礼和巡星之礼最后一天的奖励
### 其他
- 优化了现有功能的稳定性
- 修复“游戏退出失败”的问题(回退实验性改动)

## v1.6.3

Expand Down
1 change: 1 addition & 0 deletions tasks/daily/daily.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def start():
"累计消灭20个敌人": lambda: ForgottenHall.enemy_20(),
"利用弱点进入战斗并获胜3次": lambda: ForgottenHall.weakness_to_fight(),
"施放终结技造成制胜一击1次": lambda: ForgottenHall.ultimate(),
"通关「模拟宇宙」(任意世界)的1个区域": lambda: Universe.start(get_reward=False, nums=1, save=False),
}

logger.hr(_("今日实训"), 2)
Expand Down
3 changes: 2 additions & 1 deletion tasks/daily/fight.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ def start():
if status:
config.save_timestamp("fight_timestamp")
Base.send_notification_with_screenshot(_("🎉锄大地已完成🎉"))
return
return True

logger.error(_("锄大地失败"))
Base.send_notification_with_screenshot(_("⚠️锄大地未完成⚠️"))
return False

@staticmethod
def gui():
Expand Down
27 changes: 21 additions & 6 deletions tasks/weekly/universe.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ def check_path():
if not os.path.exists(config.universe_path):
logger.warning(_("模拟宇宙路径不存在: {path}").format(path=config.universe_path))
Universe.update()
elif not os.path.exists(os.path.join(config.universe_path,'gui.exe')):
logger.warning(_("模拟宇宙缺失核心文件"))
elif not os.path.exists(os.path.join(config.universe_path, 'gui.exe')):
logger.error(_("模拟宇宙缺失核心文件,请尝试更新"))
return False
# 日常任务需要能够自定义次数的模拟宇宙版本,检测是否存在 nums 参数
with open(os.path.join(config.universe_path, 'states.py'), 'r') as f:
if "nums" not in f.read():
logger.warning(_("模拟宇宙版本过低"))
Universe.update()
return True

@staticmethod
Expand All @@ -51,30 +56,40 @@ def before_start():
return check_result

@staticmethod
def start(get_reward=False):
def start(get_reward=False, nums=None, save=True):
logger.hr(_("准备模拟宇宙"), 2)

if Universe.before_start():

screen.change_to('main')

logger.info(_("开始校准"))
if subprocess_with_timeout([config.python_exe_path, "align_angle.py"], 60, config.universe_path, config.env):

screen.change_to('universe_main')

logger.info(_("开始模拟宇宙"))
command = [config.python_exe_path, "states.py"]
if config.universe_bonus_enable:
command.append("--bonus=1")
if nums:
command.append(f"--nums={nums}")
if subprocess_with_timeout(command, config.universe_timeout * 3600, config.universe_path, config.env):
config.save_timestamp("universe_timestamp")

screen.change_to('main')
if save:
config.save_timestamp("universe_timestamp")
if get_reward:
Universe.get_reward()
else:
Base.send_notification_with_screenshot(_("🎉模拟宇宙已完成🎉"))
return
return True

else:
logger.error(_("模拟宇宙失败"))
else:
logger.error(_("校准失败"))
Base.send_notification_with_screenshot(_("⚠️模拟宇宙未完成⚠️"))
return False

@staticmethod
def get_reward():
Expand Down

0 comments on commit 7dadf3b

Please sign in to comment.