Files
NewWPSBot/.tasks/2025-11-12_1_show_adventure_remaining_time.md

38 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 背景
文件名2025-11-12_1_show_adventure_remaining_time
创建于2025-11-12_15:54:56
创建者desktop-l305h65\admin
主分支main
任务分支:无
Yolo模式Off
# 任务描述
@WPSCombatSystem 当前冒险系统无法查看剩余时间, 我想要让 @combat_plugin_adventure.py (153-158) 中可以显示冒险时长
# 项目概览
WPSCombatSystem 冒险子系统
# 分析
当前冒险状态由 `combat_player_status.current_adventure_id` 标识,冒险启动时 `combat_service.start_adventure` 会写入 `combat_adventure_records`,其中 `expected_end_time` 记录预计结束时间。`combat_plugin_adventure._handle_continue_adventure` 在检测到 `current_adventure_id` 时直接返回固定提示,没有查询该记录,因此无法显示剩余时间。需要读取当前冒险记录并根据 `expected_end_time` 与当前时间的差值计算分钟数,用户要求倒计时采用向上取整。
# 提议的解决方案
1.`combat_service` 中新增 `get_adventure_by_id(adventure_id)`,查询 `combat_adventure_records` 并以字典返回,供插件层复用。
2. 修改 `combat_plugin_adventure._handle_continue_adventure`:检测到 `current_adventure_id` 时调用上述方法查询冒险记录,若状态为 `in_progress` 则读取 `expected_end_time`,与当前时间比较计算剩余秒数,向上取整为分钟数 `(remaining_seconds + 59) // 60`,并在提示中展示剩余分钟及预计完成时间;若记录缺失或状态异常,返回带有错误说明的原始提示。
3. 所有时间解析使用 `datetime.fromisoformat`,失败时捕获异常并退回默认提示。
# 当前执行步骤:"4. 更新任务进度记录"
# 任务进度
2025-11-12_16:32:57
- 已修改Plugins/WPSCombatSystem/combat_service.py Plugins/WPSCombatSystem/combat_plugin_adventure.py .tasks/2025-11-12_1_show_adventure_remaining_time.md
- 更改:新增服务层冒险查询方法,并在冒险插件中展示剩余时间信息,同时更新任务记录
- 原因:支持冒险系统显示进行中冒险的倒计时
- 阻碍因素:无
- 状态:未确认
# 最终审查
2025-11-12_16:45:19
- 结果:用户确认执行成功,冒险系统已支持显示剩余时间倒计时
- 备注:等待后续进一步测试或上线流程