Skip to content

feat: 适配新语明霄卷轴主题及共用阴阳寮入口掩码 - #1998

Merged
runhey merged 2 commits into
runhey:masterfrom
Ghostuel:feat/xinyu-mingxiao-scroll
Nov 2, 2026
Merged

runhey merged 2 commits into
runhey:masterfrom
Ghostuel:feat/xinyu-mingxiao-scroll

Conversation

@Ghostuel

@Ghostuel Ghostuel commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

修改内容

从 #1987 拆出的卷轴主题部分,不包含结界皮肤或悬赏封印改动。

  • 新增「新语明霄」卷轴选项,内部值为 costume_theme_xinyu_mingxiao。由于结界皮肤那边存在已有内部值分别为12345但实际未应用的选项,故两处皮肤改动都暂时用拼音命名,如需修改请告知。
  • 仅新增收起状态卷轴素材,其他入口复用原共用素材,不复制整套入口图片。
  • 阴阳寮共用入口使用 支持彼世逢魔 #1862 的掩码模板匹配,排除门上透背景的区域;原模板、0.7 阈值及搜索范围不变。
  • 原地更新共享规则,保持导航引用有效;切换时重置缓存并支持恢复默认。
  • 兼容此前本地编号配置,不新增 README。

验证

  • 在最新上游 master 的独立候选代码上完成 16 项离线测试,全部通过。
  • 阴阳寮已有截图 12 组检查通过:最低正例 0.919、最高反例 0.420。
  • 用户已手动验证当前新主题及阴阳寮入口可用;未宣称覆盖默认主题完整截图或所有动态状态。
  • 提交图片仅有卷轴局部、二值掩码和两张入口搜索区域测试裁图。

Sourcery 摘要

新增「星宇明霄」卷轴主题,并增强共享公会入口检测,使其能够稳健应对主题切换。

新功能:

  • 新增对「星宇明霄」庭院卷轴主题的支持,同时保留现有默认主题。

错误修复:

  • 使用共享的遮罩匹配配置,改进不同主题状态下对共享阴阳寮入口的检测。
  • 保持与早期本地编号主题选择的兼容性。

增强:

  • 切换主题时保留共享导航规则引用,并正确恢复默认规则。
  • 复用现有庭院入口素材,仅新增主题专属的折叠卷轴素材。

测试:

  • 新增离线回归测试,覆盖主题切换、缓存重置、旧版配置迁移、素材复用和阴阳寮入口匹配。
Original summary in English

Sourcery 总结

支持新语明霄庭院主题,并增强共享阴阳公会入口检测,使其能够适应主题切换。

新功能:

  • 支持新语明霄庭院卷轴主题,同时保留默认主题。

错误修复:

  • 使用掩码模板匹配,提升不同主题状态下共享阴阳公会入口检测的准确性。
  • 将旧版本地编号主题选项迁移为新的主题值。

改进:

  • 保留共享导航规则引用,并在切换主题时重置缓存的规则状态。
  • 复用现有庭院入口素材,仅新增主题专用的收起状态卷轴素材。

测试:

  • 添加离线回归测试,覆盖主题切换、缓存恢复、旧版配置迁移、素材复用和公会入口匹配。
Original summary in English

Summary by Sourcery

Support the 新语明霄 courtyard theme and make the shared Yin-Yang Guild entrance detection robust across theme changes.

New Features:

  • Add support for the 新语明霄 courtyard scroll theme while retaining the default theme.

Bug Fixes:

  • Improve shared Yin-Yang Guild entrance detection across theme states using masked template matching.
  • Migrate legacy local numbered theme selections to the new theme value.

Enhancements:

  • Preserve shared navigation rule references and reset cached rule state when switching themes.
  • Reuse existing courtyard entrance assets and add only the theme-specific collapsed scroll asset.

Tests:

  • Add offline regression coverage for theme switching, cache restoration, legacy configuration migration, asset reuse, and guild entrance matching.

Summary by CodeRabbit

  • 新功能
    • 新增“新语明霄”庭院主题及对应的收起状态卷轴识别支持。
    • 旧主题选项现会兼容映射至“新语明霄”主题。
  • 优化
    • 阴阳寮入口改用带掩码的模板匹配,减少背景差异对识别的影响。

@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.

嘿——我发现了 2 个问题

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tasks/Component/Costume/costume_base.py" line_range="121" />
<code_context>
 class ThemeType(str, Enum):
     COSTUME_THEME_DEFAULT = 'costume_theme_default'  # 伊始之卷
+    COSTUME_THEME_XINYU_MINGXIAO = 'costume_theme_xinyu_mingxiao'  # 新语明霄

 # 幕间,就是式神录这里
 class ShikigamiType(str, Enum):
</code_context>
<issue_to_address>
**Theme logs show raw key**

When the new theme is selected, `I18n.trans_zh_cn(theme_type)` looks up the new theme value in `module/config/i18n/zh-CN.json`, but this change adds its translation only to `assets/i18n/zh-CN.json`; selecting the theme therefore logs `costume_theme_xinyu_mingxiao` instead of `新语明霄`.

Add the new value to the translation source used by `I18n.trans_zh_cn`, or use the asset translation source for this log.
</issue_to_address>

### Comment 2
<location path="tests/tasks/Component/CostumeTheme/test_theme.py" line_range="77" />
<code_context>
+        rule = GameUiAssets.I_MAIN_GOTO_TEAM
+        original = deepcopy(rule.__dict__)
+        with self.assertRaises(KeyError):
+            apply_theme('not_a_theme')
+        self.assertEqual(rule.__dict__, original)
+
</code_context>
<issue_to_address>
**Partial theme mutation goes undetected**

When `apply_theme` partially mutates a different theme rule before rejecting an unknown theme, `test_invalid_theme_does_not_mutate_rules` compares only `I_MAIN_GOTO_TEAM` at `cy`; if `apply_theme` mutates `I_MAIN_SCROLL_CLOSE` before raising `KeyError`, this assertion still passes and the test misses the corrupted theme state.

Snapshot and compare every rule in `_THEME_NAMES` around the invalid-theme call.
</issue_to_address>

Sourcery 评估

等待批准。 请先处理 1 项发现。

阻塞性发现:tests/tasks/Component/CostumeTheme/test_theme.py:77


Sourcery 对开源项目免费——如果你喜欢我们的评审,欢迎分享 ✨
Original comment in English

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tasks/Component/Costume/costume_base.py" line_range="121" />
<code_context>
 class ThemeType(str, Enum):
     COSTUME_THEME_DEFAULT = 'costume_theme_default'  # 伊始之卷
+    COSTUME_THEME_XINYU_MINGXIAO = 'costume_theme_xinyu_mingxiao'  # 新语明霄

 # 幕间,就是式神录这里
 class ShikigamiType(str, Enum):
</code_context>
<issue_to_address>
**Theme logs show raw key**

When the new theme is selected, `I18n.trans_zh_cn(theme_type)` looks up the new theme value in `module/config/i18n/zh-CN.json`, but this change adds its translation only to `assets/i18n/zh-CN.json`; selecting the theme therefore logs `costume_theme_xinyu_mingxiao` instead of `新语明霄`.

Add the new value to the translation source used by `I18n.trans_zh_cn`, or use the asset translation source for this log.
</issue_to_address>

### Comment 2
<location path="tests/tasks/Component/CostumeTheme/test_theme.py" line_range="77" />
<code_context>
+        rule = GameUiAssets.I_MAIN_GOTO_TEAM
+        original = deepcopy(rule.__dict__)
+        with self.assertRaises(KeyError):
+            apply_theme('not_a_theme')
+        self.assertEqual(rule.__dict__, original)
+
</code_context>
<issue_to_address>
**Partial theme mutation goes undetected**

When `apply_theme` partially mutates a different theme rule before rejecting an unknown theme, `test_invalid_theme_does_not_mutate_rules` compares only `I_MAIN_GOTO_TEAM` at `cy`; if `apply_theme` mutates `I_MAIN_SCROLL_CLOSE` before raising `KeyError`, this assertion still passes and the test misses the corrupted theme state.

Snapshot and compare every rule in `_THEME_NAMES` around the invalid-theme call.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: tests/tasks/Component/CostumeTheme/test_theme.py:77


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tasks/Component/Costume/costume_base.py Resolved
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1a2f9e3a-5bf5-49c1-ab38-4de565170acc
Commits

Reviewing files that changed from the base of the PR and between b46be8a and 2d7b85d.

Files selected for processing: 2
  • tasks/Component/Costume/costume_base.py
  • tests/tasks/Component/CostumeTheme/test_theme.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

新增心语明霄服装主题、简体中文名称、主题资源和旧选项兼容映射。服装检查流程会应用配置的主题,并在非默认主题时记录日志。公会入口的图像匹配方式改为掩码模板匹配。新增离线测试,覆盖主题规则应用和公会入口匹配。

Merge Risk: Minimal · up to 2d7b8

未发现新主题或公会入口匹配的合并阻塞问题;合并前运行常规检查。

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

兔子捧来新主题,
卷轴规则添新意。
中文名称已写好,
旧值转换不烦恼。
公会入口掩码明,
测试跑过月色静。

@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.

Sourcery assessment

Approved.

@LGG686

LGG686 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

这个卷轴按理来说都是通用的都能识别,除了阴阳寮部分主题要用mask才能匹配,还有啥匹配不上的吗

@Ghostuel

Ghostuel commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

这个卷轴按理来说都是通用的都能识别,除了阴阳寮部分主题要用mask才能匹配,还有啥匹配不上的吗

应该没有了,之前试的时候就是阴阳寮的对不上,卷轴那个我不太确定所以一起做了

@runhey

runhey commented Nov 2, 2026

Copy link
Copy Markdown
Owner

test 不要放图片

@runhey
runhey merged commit d1881b8 into runhey:master Nov 2, 2026
2 checks 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