Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2652,9 +2652,6 @@
"CustomCheckPositions": null,
"DelayAfterFull": false
},
"OpsiSeaMiles": {
"Enable": false
},
"OpsiFleetAutoChange": {
"Enable": false,
"CooldownHours": 24,
Expand Down
10 changes: 0 additions & 10 deletions module/config/argument/args.json
Original file line number Diff line number Diff line change
Expand Up @@ -12971,16 +12971,6 @@
"value": false
}
},
"OpsiSeaMiles": {
"Enable": {
"type": "checkbox",
"value": false,
"option": [
true,
false
]
}
},
"OpsiFleetAutoChange": {
"Enable": {
"type": "checkbox",
Expand Down
5 changes: 0 additions & 5 deletions module/config/argument/argument.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1195,11 +1195,6 @@ OpsiCheckLeveling:
CustomCheckPositions:
value: ''
DelayAfterFull: false
OpsiSeaMiles:
Enable:
type: checkbox
value: false
option: [true, false]
OpsiFleetAutoChange:
Enable:
type: checkbox
Expand Down
1 change: 0 additions & 1 deletion module/config/argument/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ Opsi:
- OpsiSirenBug
- OpsiFleet
- OpsiCheckLeveling
- OpsiSeaMiles
- OpsiFleetAutoChange
OpsiScheduling:
- Scheduler
Expand Down
3 changes: 0 additions & 3 deletions module/config/config_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,6 @@ class GeneratedConfig:
OpsiCheckLeveling_CustomCheckPositions = None
OpsiCheckLeveling_DelayAfterFull = False

# Group `OpsiSeaMiles`
OpsiSeaMiles_Enable = False # True, False

# Group `OpsiFleetAutoChange`
OpsiFleetAutoChange_Enable = False # True, False
OpsiFleetAutoChange_CooldownHours = 24 # 12, 24, 48, 72
Expand Down
12 changes: 0 additions & 12 deletions module/config/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,18 +3661,6 @@
"help": "When full experience is detected, this task will be delayed for the specified duration."
}
},
"OpsiSeaMiles": {
"_info": {
"name": "OpsiSeaMiles._info.name",
"help": "OpsiSeaMiles._info.help"
},
"Enable": {
"name": "OpsiSeaMiles.Enable.name",
"help": "OpsiSeaMiles.Enable.help",
"True": "True",
"False": "False"
}
},
"OpsiFleetAutoChange": {
"_info": {
"name": "OpsiFleetAutoChange._info.name",
Expand Down
12 changes: 0 additions & 12 deletions module/config/i18n/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,18 +3661,6 @@
"help": "完全な経験が検出されると、このタスクは指定された時間延期されます。"
}
},
"OpsiSeaMiles": {
"_info": {
"name": "OpsiSeaMiles._info.name",
"help": "OpsiSeaMiles._info.help"
},
"Enable": {
"name": "OpsiSeaMiles.Enable.name",
"help": "OpsiSeaMiles.Enable.help",
"True": "True",
"False": "False"
}
},
"OpsiFleetAutoChange": {
"_info": {
"name": "OpsiFleetAutoChange._info.name",
Expand Down
12 changes: 0 additions & 12 deletions module/config/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,18 +3661,6 @@
"help": "当检测到满经验后,将本任务推迟指定的时间"
}
},
"OpsiSeaMiles": {
"_info": {
"name": "海里数检测",
"help": "在经验检测完成后检测并记录海里数\n海里数将显示在统计页面的体力变化曲线中"
},
"Enable": {
"name": "启用海里数检测",
"help": "开启后将在经验检测完成后检测并记录海里数",
"True": "已启用",
"False": "未启用"
}
},
"OpsiFleetAutoChange": {
"_info": {
"name": "侵蚀一舰队自动配队",
Expand Down
12 changes: 0 additions & 12 deletions module/config/i18n/zh-MIAO.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,18 +3661,6 @@
"help": "检测到满经验后将本任务推迟指定时间喵。"
}
},
"OpsiSeaMiles": {
"_info": {
"name": "OpsiSeaMiles._info.name",
"help": "OpsiSeaMiles._info.help"
},
"Enable": {
"name": "OpsiSeaMiles.Enable.name",
"help": "OpsiSeaMiles.Enable.help",
"True": "True",
"False": "False"
}
},
"OpsiFleetAutoChange": {
"_info": {
"name": "OpsiFleetAutoChange._info.name",
Expand Down
12 changes: 0 additions & 12 deletions module/config/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -3661,18 +3661,6 @@
"help": "當檢測到滿經驗後,將本任務推遲指定的時間"
}
},
"OpsiSeaMiles": {
"_info": {
"name": "OpsiSeaMiles._info.name",
"help": "OpsiSeaMiles._info.help"
},
"Enable": {
"name": "OpsiSeaMiles.Enable.name",
"help": "OpsiSeaMiles.Enable.help",
"True": "True",
"False": "False"
}
},
"OpsiFleetAutoChange": {
"_info": {
"name": "OpsiFleetAutoChange._info.name",
Expand Down
19 changes: 9 additions & 10 deletions module/os/tasks/hazard_leveling.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,15 @@ def os_check_leveling(self):
content=f"<{self.config.config_name}>\n\n{report}",
)

if hasattr(self.config, 'OpsiSeaMiles_Enable') and self.config.OpsiSeaMiles_Enable:
logger.info("启用海里数检测")
try:
sea_miles = self.detect_and_record_sea_miles()
if sea_miles is not None:
logger.info(f"海里数检测完成: {sea_miles}")
else:
logger.warning("海里数检测失败,但不影响后续流程")
except Exception as e:
logger.error(f"海里数检测异常: {e},但不影响后续流程")
logger.info("开始海里数检测")
try:
sea_miles = self.detect_and_record_sea_miles()
if sea_miles is not None:
logger.info(f"海里数检测完成: {sea_miles}")
else:
logger.warning("海里数检测失败,但不影响后续流程")
except Exception as e:
logger.error(f"海里数检测异常: {e},但不影响后续流程")
Comment on lines +517 to +518
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

捕获过于宽泛的 Exception 可能会隐藏一些意料之外的错误。为了更好地进行错误诊断,建议使用 logger.exception 来代替 logger.errorlogger.exception 会自动记录异常信息和堆栈跟踪,这在调试时非常有用。

虽然最佳实践是捕获更具体的异常,但如果这里的意图确实是捕获所有可能的错误以确保流程继续,那么记录完整的堆栈跟踪就显得尤为重要。

Suggested change
except Exception as e:
logger.error(f"海里数检测异常: {e},但不影响后续流程")
except Exception:
logger.exception(f"海里数检测异常,但不影响后续流程")


if enable_custom_check and custom_positions:
self._check_custom_positions_full_exp(
Expand Down
Loading