Skip to content

fix FindJade&SwitchAccount - #1706

Merged
runhey merged 9 commits into
runhey:devfrom
fknassOVO:master
Jul 29, 2026
Merged

fix FindJade&SwitchAccount#1706
runhey merged 9 commits into
runhey:devfrom
fknassOVO:master

Conversation

@fknassOVO

@fknassOVO fknassOVO commented Jul 28, 2026

Copy link
Copy Markdown

修复切换账号逻辑

直接测试是可以正常切换小号寻找勾协的

Summary by Sourcery

调整账号切换、OCR 处理以及 FindJade 配置,以更可靠地完成小号切换和活动交互。

Bug 修复:

  • 修正单号模式(SINGLE mode)下 OCR 点击坐标的选取逻辑,改为使用预期的 ROI 区域,避免在月常活动中触发挑战时发生误触。
  • 更新切换角色流程,通过识别文本来检测选服界面,并优化滑动行为,以正确滚动账号列表。
  • 重新调校角色/服务器选择界面以及活动体力计数的 OCR 区域,降低误识别并提升 UI 检测的稳定性。
  • 调整登录设备类型选择和选服指示的图像匹配 ROI 及资源路径,使其与当前 UI 保持一致。
  • 修改 FindJade 脚本配置,将其改为使用小号配置档替代原有配置。

增强功能:

  • 新增一条 OCR 规则,通过识别“已有角色”标签来检测选服界面的存在,以支持更稳健的账号切换流程。
Original summary in English

Summary by Sourcery

Adjust account switching, OCR handling, and FindJade configuration for more reliable small-account switching and activity interactions.

Bug Fixes:

  • Correct OCR click coordinate selection to use the intended ROI area in SINGLE mode, preventing misclicks when triggering challenges in monthly activities.
  • Update switch-character flow to detect the server-selection screen via text and refine swipe behavior to scroll the account list correctly.
  • Retune OCR regions for character/server selection and activity stamina counters to reduce misrecognition and improve stability of UI detection.
  • Adjust image-matching ROIs and asset paths for login device-type selection and server-selection indicators to match the current UI.
  • Change the FindJade script configuration to use the small-account profile instead of the previous one.

Enhancements:

  • Add an OCR rule for detecting the presence of the server-selection screen via the '已有角色' label to support more robust account switching.

runhey and others added 8 commits July 24, 2026 22:59
每月活动,点击挑战的时候,经常点到切换门票模式和体力模式。
20260725 缩小体力和活动体力的检测范围,范围太大,可能把0识别为10的情况.

	# 潜在风险1,超过1000的数字可能会只识别到最后的000,还有识别0的时候,score比较低,只有0.3,不知道怎么优化。
	# 潜在风险2,部分数字,遇到过300等,会识别为0,之前没截上图,待后面遇到再处理这种情况。
@fknassOVO fknassOVO changed the title fix FindJade 安定 fix FindJade&SwitchAccount Jul 28, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - 我发现了两个问题,并提供了一些整体性的反馈:

  • 新增的 OCR 规则 O_SA_CHECK_SELCET_SVR 在名字中似乎有拼写错误(SELCET vs SELECT),这会降低后续使用和搜索的便利性;建议统一更名。
  • 对于新添加或更新的 OCR 规则(例如 O_SA_SELECT_SVR_CHARACTER_LIST, O_SA_CHECK_SELCET_SVR),mode 字段现在使用了不同的大小写形式(Full, Single),而现有用法是大写(FULL, SINGLE);请根据 OCR 引擎的实际期望值统一大小写,以避免潜在的运行时问题。
  • Config('oas1') 改为 Config('翻小号') 会把一个与环境或用户绑定的配置名硬编码进 FindJade,这在其他环境中可能并不合适;建议通过配置方式注入,而不是在代码中写死具体的配置名。
面向 AI Agent 的提示词
Please address the comments from this code review:

## Overall Comments
- 新增的 OCR 规则 `O_SA_CHECK_SELCET_SVR` 在名字中似乎有拼写错误(`SELCET` vs `SELECT`),这会降低后续使用和搜索的便利性;建议统一更名。
- 对于新添加或更新的 OCR 规则(例如 `O_SA_SELECT_SVR_CHARACTER_LIST`, `O_SA_CHECK_SELCET_SVR`),`mode` 字段现在使用了不同的大小写形式(`Full`, `Single`),而现有用法是大写(`FULL`, `SINGLE`);请根据 OCR 引擎的实际期望值统一大小写,以避免潜在的运行时问题。
-`Config('oas1')` 改为 `Config('翻小号')` 会把一个与环境或用户绑定的配置名硬编码进 `FindJade`,这在其他环境中可能并不合适;建议通过配置方式注入,而不是在代码中写死具体的配置名。

## Individual Comments

### Comment 1
<location path="tasks/Component/SwitchAccount/assets.py" line_range="52" />
<code_context>
 	# 登录界面 用户中心(区别于游戏内用户中心) 账户名 
 	O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
+	# 判断是否在 选择服务器 界面的文本特质 
+	O_SA_CHECK_SELCET_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_selcet_svr")


</code_context>
<issue_to_address>
**suggestion (typo):** 常量名和内部 name 中的拼写错误(`SELCET`/`selcet`)会影响可读性和可搜索性。

`O_SA_CHECK_SELCET_SVR``name="sa_check_selcet_svr"` 都使用了 `SELCET/selcet` 而不是 `SELECT/select`。请重命名以保证一致性并便于搜索(例如改为 `O_SA_CHECK_SELECT_SVR`, `sa_check_select_svr`)。

Suggested implementation:

```python
	# 判断是否在 选择服务器 界面的文本特质 
	O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")

```

1. 在代码库中搜索 `O_SA_CHECK_SELCET_SVR`,将所有用法更新为 `O_SA_CHECK_SELECT_SVR`2. 搜索字符串 `"sa_check_selcet_svr"`,更新所有引用(例如日志、配置、测试)为 `"sa_check_select_svr"`。
</issue_to_address>

### Comment 2
<location path="tasks/Component/SwitchAccount/assets.py" line_range="44-52" />
<code_context>
	O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(418,131,641,481), area=(417,135,647,482), mode="Full", method="Default", keyword="", name="sa_select_svr_character_list")
</code_context>
<issue_to_address>
**issue (bug_risk):** `mode` 大小写不一致(`Full`/`Single` vs `FULL`/`SINGLE`)可能在 API 区分大小写时破坏分发逻辑。

其他规则使用的是大写 `mode` 值(例如 "FULL", "SINGLE"),但这一条使用的是 "Full"。如果 `RuleOcr` 或下游代码对 `mode` 的比较是区分大小写的,那么它可能无法匹配预期的模式。除非 `RuleOcr` 在内部做了大小写归一化,否则请将大小写与现有规则保持一致。
</issue_to_address>

Sourcery 对开源项目免费 —— 如果你觉得这次审查有帮助,欢迎分享 ✨
帮我变得更有用!请对每一条评论点选 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English

Hey - I've found 2 issues, and left some high level feedback:

  • The new OCR rule O_SA_CHECK_SELCET_SVR appears to have a typo in its name (SELCET vs SELECT), which could make future usage and searches harder; consider renaming it consistently.
  • For the new/updated OCR rules (e.g., O_SA_SELECT_SVR_CHARACTER_LIST, O_SA_CHECK_SELCET_SVR), the mode values now use different casing (Full, Single) compared to existing usages (FULL, SINGLE); please align the casing with whatever the OCR engine actually expects to avoid subtle runtime issues.
  • The change from Config('oas1') to Config('翻小号') hardcodes an environment-specific or user-specific config name into FindJade, which may not be appropriate for other environments; consider making this configurable rather than embedding a specific profile.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new OCR rule `O_SA_CHECK_SELCET_SVR` appears to have a typo in its name (`SELCET` vs `SELECT`), which could make future usage and searches harder; consider renaming it consistently.
- For the new/updated OCR rules (e.g., `O_SA_SELECT_SVR_CHARACTER_LIST`, `O_SA_CHECK_SELCET_SVR`), the `mode` values now use different casing (`Full`, `Single`) compared to existing usages (`FULL`, `SINGLE`); please align the casing with whatever the OCR engine actually expects to avoid subtle runtime issues.
- The change from `Config('oas1')` to `Config('翻小号')` hardcodes an environment-specific or user-specific config name into `FindJade`, which may not be appropriate for other environments; consider making this configurable rather than embedding a specific profile.

## Individual Comments

### Comment 1
<location path="tasks/Component/SwitchAccount/assets.py" line_range="52" />
<code_context>
 	# 登录界面 用户中心(区别于游戏内用户中心) 账户名 
 	O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
+	# 判断是否在 选择服务器 界面的文本特质 
+	O_SA_CHECK_SELCET_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_selcet_svr")


</code_context>
<issue_to_address>
**suggestion (typo):** Typo in constant and name (`SELCET`/`selcet`) may hurt readability and searchability.

Both `O_SA_CHECK_SELCET_SVR` and `name="sa_check_selcet_svr"` use `SELCET/selcet` instead of `SELECT/select`. Please rename them for consistency and easier searching (e.g. `O_SA_CHECK_SELECT_SVR`, `sa_check_select_svr`).

Suggested implementation:

```python
	# 判断是否在 选择服务器 界面的文本特质 
	O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")

```

1. Search the codebase for `O_SA_CHECK_SELCET_SVR` and update all usages to `O_SA_CHECK_SELECT_SVR`.
2. Search for the string `"sa_check_selcet_svr"` and update any references (e.g., logs, configs, tests) to `"sa_check_select_svr"`.
</issue_to_address>

### Comment 2
<location path="tasks/Component/SwitchAccount/assets.py" line_range="44-52" />
<code_context>
	O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(418,131,641,481), area=(417,135,647,482), mode="Full", method="Default", keyword="", name="sa_select_svr_character_list")
</code_context>
<issue_to_address>
**issue (bug_risk):** Inconsistent `mode` casing (`Full`/`Single` vs `FULL`/`SINGLE`) could break dispatch logic if the API is case-sensitive.

Other rules use uppercase `mode` values (e.g. "FULL", "SINGLE"), but this one uses "Full". If `RuleOcr` or downstream code compares `mode` case-sensitively, this may not match the expected mode. Please align the casing with existing rules unless `RuleOcr` normalizes it internally.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tasks/Component/SwitchAccount/assets.py Outdated
# 登录界面 用户中心(区别于游戏内用户中心) 账户名
O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
# 判断是否在 选择服务器 界面的文本特质
O_SA_CHECK_SELCET_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_selcet_svr")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion (typo): 常量名和内部 name 中的拼写错误(SELCET/selcet)会影响可读性和可搜索性。

O_SA_CHECK_SELCET_SVRname="sa_check_selcet_svr" 都使用了 SELCET/selcet 而不是 SELECT/select。请重命名以保证一致性并便于搜索(例如改为 O_SA_CHECK_SELECT_SVR, sa_check_select_svr)。

Suggested implementation:

	# 判断是否在 选择服务器 界面的文本特质 
	O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")
  1. 在代码库中搜索 O_SA_CHECK_SELCET_SVR,将所有用法更新为 O_SA_CHECK_SELECT_SVR
  2. 搜索字符串 "sa_check_selcet_svr",更新所有引用(例如日志、配置、测试)为 "sa_check_select_svr"
Original comment in English

suggestion (typo): Typo in constant and name (SELCET/selcet) may hurt readability and searchability.

Both O_SA_CHECK_SELCET_SVR and name="sa_check_selcet_svr" use SELCET/selcet instead of SELECT/select. Please rename them for consistency and easier searching (e.g. O_SA_CHECK_SELECT_SVR, sa_check_select_svr).

Suggested implementation:

	# 判断是否在 选择服务器 界面的文本特质 
	O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")
  1. Search the codebase for O_SA_CHECK_SELCET_SVR and update all usages to O_SA_CHECK_SELECT_SVR.
  2. Search for the string "sa_check_selcet_svr" and update any references (e.g., logs, configs, tests) to "sa_check_select_svr".

Comment thread tasks/Component/SwitchAccount/assets.py Outdated
Comment on lines +44 to +52
O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(418,131,641,481), area=(417,135,647,482), mode="Full", method="Default", keyword="", name="sa_select_svr_character_list")
# 选择账号界面 账号列表
O_SA_ACCOUNT_ACCOUNT_LIST = RuleOcr(roi=(460,280,440,330), area=(460,280,440,330), mode="FULL", method="Default", keyword="", name="sa_account_account_list")
# 选择账号界面 已选择的账号
O_SA_ACCOUNT_ACCOUNT_SELECTED = RuleOcr(roi=(460,280,370,50), area=(460,280,370,50), mode="SINGLE", method="Default", keyword="", name="sa_account_account_selected")
# 登录界面 用户中心(区别于游戏内用户中心) 账户名
O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
# 判断是否在 选择服务器 界面的文本特质
O_SA_CHECK_SELCET_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_selcet_svr")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): mode 大小写不一致(Full/Single vs FULL/SINGLE)可能在 API 区分大小写时破坏分发逻辑。

其他规则使用的是大写 mode 值(例如 "FULL", "SINGLE"),但这一条使用的是 "Full"。如果 RuleOcr 或下游代码对 mode 的比较是区分大小写的,那么它可能无法匹配预期的模式。除非 RuleOcr 在内部做了大小写归一化,否则请将大小写与现有规则保持一致。

Original comment in English

issue (bug_risk): Inconsistent mode casing (Full/Single vs FULL/SINGLE) could break dispatch logic if the API is case-sensitive.

Other rules use uppercase mode values (e.g. "FULL", "SINGLE"), but this one uses "Full". If RuleOcr or downstream code compares mode case-sensitively, this may not match the expected mode. Please align the casing with existing rules unless RuleOcr normalizes it internally.

@runhey
runhey merged commit 3067ef5 into runhey:dev Jul 29, 2026
1 check passed
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.

3 participants