Skip to content

feat: add get_campaign_remains#483

Merged
yltx merged 1 commit into
mainfrom
feat/get-campaign-remains
May 16, 2026
Merged

feat: add get_campaign_remains#483
yltx merged 1 commit into
mainfrom
feat/get-campaign-remains

Conversation

@yltx
Copy link
Copy Markdown
Contributor

@yltx yltx commented May 16, 2026

No description provided.

Copilot AI review requested due to automatic review settings May 16, 2026 15:13
@codecov
Copy link
Copy Markdown

codecov Bot commented May 16, 2026

Codecov Report

❌ Patch coverage is 18.18182% with 18 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
autowsgr/ui/map/panels/campaign.py 10.00% 18 Missing ⚠️

📢 Thoughts on this report? Let us know!

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 PR adds UI support for reading remaining campaign attempts via OCR on the campaign/battle panel, introducing a new crop region constant to locate the counter on screen.

Changes:

  • Added CampaignPanelMixin.get_campaign_remains() to OCR-detect (remains, total) from the campaign panel.
  • Added CAMPAIGN_REMAIN_CROP crop region constant to autowsgr.ui.map.data.

Reviewed changes

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

File Description
autowsgr/ui/map/panels/campaign.py Adds get_campaign_remains() which screenshots, crops, and OCR-parses the remaining campaign counter.
autowsgr/ui/map/data.py Defines CAMPAIGN_REMAIN_CROP to support the new OCR extraction.

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

Comment thread autowsgr/ui/map/panels/campaign.py Outdated
@@ -1,7 +1,8 @@
"""战役面板 Mixin — 难度选择与进入战役出征准备。"""
"""战役面板 Mixin — 难度选择与进入战役出征准备。"""
Comment on lines +61 to +66
results = ocr.recognize(img)
text = ''.join([r.text for r in results]).replace(' ', '')
m = re.search(r'(\d+)/(\d+)', text)
if m:
remains = int(m.group(1))
total = int(m.group(2))
@yltx yltx force-pushed the feat/get-campaign-remains branch from 44d369a to 24ebea7 Compare May 16, 2026 15:22
@yltx yltx merged commit a5f9933 into main May 16, 2026
2 of 3 checks passed
@yltx yltx deleted the feat/get-campaign-remains branch May 16, 2026 15:25
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