Skip to content

2.0.1#341

Merged
huan-yp merged 8 commits intomainfrom
2.0.1
Feb 26, 2026
Merged

2.0.1#341
huan-yp merged 8 commits intomainfrom
2.0.1

Conversation

@huan-yp
Copy link
Copy Markdown
Contributor

@huan-yp huan-yp commented Feb 26, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 26, 2026 12:38
@huan-yp huan-yp merged commit 42f3dbf into main Feb 26, 2026
1 of 2 checks passed
@huan-yp huan-yp deleted the 2.0.1 branch February 26, 2026 12:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This is a version 2.0.1 maintenance release that includes several improvements and bug fixes:

Changes:

  • Refactored imports in example files to use cleaner paths through autowsgr.ops module
  • Added support for external fleet specification in event and normal fight operations
  • Improved event page difficulty detection using pixel signatures instead of color matching
  • Removed debug image saving calls from production code paths
  • Updated log directory configuration from "log" to "logs"
  • Enhanced game startup logic to handle unknown page states
  • Removed deprecated user_settings.yaml configuration file

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
autowsgr/init.py Version bump from 2.0.0 to 2.0.1
examples/usersettings.full.yaml Changed log root directory from "log" to "logs"
examples/user_settings.yaml Removed deprecated configuration file (replaced by usersettings.yaml)
examples/normal_fight.py Updated import to use autowsgr.ops module directly
examples/exercise.py Updated import to use autowsgr.ops module directly
examples/event_fight.py Updated import, added fleet_id parameter example, updated times from 3 to 5
examples/decisive.py Updated import to use autowsgr.ops module directly
examples/campaign.py Updated import to use autowsgr.ops module directly
autowsgr/ui/event/event_page.py Improved difficulty detection with pixel signatures, added skip_check parameter, repositioned difficulty toggle button
autowsgr/ui/decisive/map_controller.py Removed debug save_image calls
autowsgr/ui/decisive/fleet_ocr.py Removed debug save_image calls and unused DecisiveConfig import
autowsgr/ops/startup.py Enhanced ensure_game_ready to restart when page is unrecognized
autowsgr/ops/normal_fight.py Added fleet_id and fleet parameters for external fleet specification, updated destroy_ships call signature
autowsgr/ops/event_fight.py Added fleet and fleet_id parameters, optimized repeated executions by skipping checks, removed unnecessary navigation
autowsgr/ops/decisive/handlers.py Removed debug save_image calls
autowsgr/infra/logger.py Changed default image directory from None to "logs/images"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

event_page = BaseEventPage(self._ctx)
entrance: Literal["alpha", "beta"] | None = self._entrance # type: ignore[assignment]
event_page.start_fight(self._map_code, entrance=entrance)
event_page.start_fight(self._map_code, entrance, self._skip_check)
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The third argument self._skip_check should be passed as a keyword argument skip_check=self._skip_check to match the function signature of start_fight which defines it as a keyword-only parameter.

Suggested change
event_page.start_fight(self._map_code, entrance, self._skip_check)
event_page.start_fight(self._map_code, entrance, skip_check=self._skip_check)

Copilot uses AI. Check for mistakes.
Comment on lines 67 to 74
_log.info(
"[OPS] 常规战: {}-{} ({})",
self._plan.chapter,
self._plan.map_id,
self._plan.name,
self._fleet_id,
self._fleet,
)
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The log statement has 5 format placeholders but only 3 arguments are provided after the format string. This will cause a runtime error. The fleet_id and fleet values should be included in the log message format or removed from the placeholder list.

Copilot uses AI. Check for mistakes.
for i in range(times):
_log.info("[OPS] 常规战第 {}/{} 次", i + 1, times)
result = self.run()
result = self.run(**kwargs)
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The run() method is called with **kwargs but it doesn't accept any keyword arguments in its signature. The run() method should either accept **kwargs in its signature if they need to be passed through, or this call should not pass **kwargs.

Copilot uses AI. Check for mistakes.
Comment thread autowsgr/ops/startup.py
if identify_current_page(ctx) is None:
_log.info("[Startup] 游戏已在运行但页面未知,正在重启…")
restart_game(ctrl, package, startup_timeout=startup_timeout)
_log.info("[Startup] 游戏已在运行")
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The log message "[Startup] 游戏已在运行" on line 285 will execute even when the game is restarted (when the page is unknown). This message should only be logged when the game is already running AND on a recognized page. Consider wrapping line 285 in an else block or restructuring the logic.

Suggested change
_log.info("[Startup] 游戏已在运行")
else:
_log.info("[Startup] 游戏已在运行")

Copilot uses AI. Check for mistakes.
Comment thread autowsgr/infra/logger.py
Comment on lines +385 to +388
target_dir = str(img_dir or _image_dir)
target_dir = Path(target_dir)
if target_dir is None:
return None
raise ValueError("未配置图片保存目录,请在 setup_logger 中设置 log_dir 并启用 save_images")
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

After converting img_dir or _image_dir to a string and then to a Path object, the condition if target_dir is None on line 387 can never be True. A Path object will never be None. This check should be performed before the conversion to Path, or the logic needs to be restructured to check if _image_dir is None before conversion.

Copilot uses AI. Check for mistakes.
Comment thread examples/event_fight.py
Comment on lines +13 to +14
# 2. 执行活动战 — 只需传策略名称, 支持外部指定舰队
results = run_event_fight_from_yaml(ctx, 'E5ADE夜战', times=5, fleet_id=2)
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The module docstring at line 3 states "执行 3 次活动战斗" (execute 3 times), but the code now executes 5 times (times=5). The docstring should be updated to match the code or changed to not specify a specific number.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants