feat: 地图定位匹配&附加层显示高价值品位置&其他一些优化 - #1324
Conversation
There was a problem hiding this comment.
🎯 Core Changes
- Introduced
MapOverlayTaskfor real-time player positioning and high-value item overlays. - Added
PositionDetectorwhich utilizes OCR to parse coordinates from the game's coordinate UI. - Implemented
SiftEngineandSurfEnginefor feature-based map matching to identify player location when OCR is unavailable (e.g., Big Map view). - Added a SQLite-backed overlay system (
MapItemOverlay) to render nearby collectibles on the game's minimap.
- Manual NPY Serialization: The implementation of
_build_npy_bytesandsave_npzincommon.pymanually constructs the NumPy.npyfile format. This is brittle and over-complicated; using standardnumpy.savewith a buffer is safer. - OpenCV Contrib Dependency:
SurfEnginerelies oncv2.xfeatures2d, which is not available in standardopencv-pythonoropencv-python-headlesspackages. It requiresopencv-contrib-python. Using SURF might cause runtime crashes if the environment isn't strictly controlled.
Code review performed by GOOGLE - gemini-3-flash-preview.
There was a problem hiding this comment.
🎯 核心变更
- 角色逻辑优化:为 Chisa(千咲)增加了 DPS 模式支持,并优化了支援模式下切换角色后 buff 的保留逻辑。
- 日常任务流程增强:重构了
DailyTask,使其能够根据配置自动包含“梦魇巢穴”任务(用于完成每日声骸指标或全刷),并优化了菜单导航效率。 - 稳定性提升:在
AutoRogueTask中增加了对角色死亡复活的处理,避免流程中断。 - 配置与国际化:统一了按键配置项名称,并为 GUI 配置增加了图标显示。
- 实例方法篡改:在
DailyTask.py中使用了动态替换NightmareNestTask实例方法的做法(Monkey Patch)。虽然在finally中有恢复逻辑,但如果在执行梦魇期间发生掉线,被禁用的ensure_main会导致程序失去自我恢复能力。建议长期方案考虑在任务基类中通过参数控制 UI 退出行为。
Verdict: Approve
Code review performed by GOOGLE - gemini-3-flash-preview.
Note: Some line comments were omitted due to technical limitations.
There was a problem hiding this comment.
🎯 核心变更
- 重构特征缓存序列化:删除了手动实现
.npy文件头和struct打包的复杂逻辑,改用标准的numpy.savez_compressed和numpy.load,大幅提升了代码的简洁性和可靠性。 - 新增 CLI 工具支持:在
common.py中添加了extract(特征提取)和match(匹配测试)两个命令行子命令,方便进行离线数据预处理和算法验证。 - 兼容性保障:在
load_npz中实现了双重读取逻辑,优先尝试标准numpy.load,失败后回退至旧版手动打包格式的读取流程。
- 资源管理:使用
np.load读取.npz文件时未显式关闭,建议使用上下文管理器以避免潜在的文件句柄泄漏。 - CLI 输出干扰:
extract命令将进度日志打印到了stdout,这会导致最终输出的 JSON 结果无法被直接通过管道解析。
Code review performed by GOOGLE - gemini-3-flash-preview.
There was a problem hiding this comment.
🎯 核心变更
- 动态比例尺计算:通过单应性矩阵(Homography)计算局部 Jacobian 行列式,实现了大地图缩放时附加层的实时适配 (
map_scale)。 - 坐标平滑处理:引入加权滑动窗口平滑算法 (
_smooth_game_center),显著减少了大地图定位时的视觉抖动。 - 分层过滤逻辑:在数据库查询中增加了
state_id过滤,解决了“地下”与“地面”物品在大地图上同时显示的逻辑冲突。 - 匹配质量优化:在
_try_map_match中增加了对“慢速地图”的权重排序,并对匹配点数量增加了最小阈值限制 (match_count >= 10),提升了误匹配的过滤能力。
Verdict: Approve
Code review performed by GOOGLE - gemini-3-flash-preview.
# Conflicts: # i18n/es_ES/LC_MESSAGES/ok.mo # i18n/es_ES/LC_MESSAGES/ok.po # i18n/ja_JP/LC_MESSAGES/ok.mo # i18n/ja_JP/LC_MESSAGES/ok.po # i18n/ko_KR/LC_MESSAGES/ok.mo # i18n/ko_KR/LC_MESSAGES/ok.po # i18n/zh_CN/LC_MESSAGES/ok.mo # i18n/zh_CN/LC_MESSAGES/ok.po # i18n/zh_TW/LC_MESSAGES/ok.mo # i18n/zh_TW/LC_MESSAGES/ok.po
# Conflicts: # i18n/es_ES/LC_MESSAGES/ok.po # i18n/ja_JP/LC_MESSAGES/ok.po # i18n/ko_KR/LC_MESSAGES/ok.po # i18n/zh_CN/LC_MESSAGES/ok.po # i18n/zh_TW/LC_MESSAGES/ok.po
|
|
||
| @staticmethod | ||
| def load(json_path): | ||
| with open(json_path, 'r') as f: |
| from .params import ParamSet, SURF, SIFT, SIFTGZ, SurfParams, SiftParams, SiftGzParams | ||
|
|
||
| def _load_json(path): | ||
| with open(path, 'r', encoding='utf-8') as f: |
| return json.load(f) | ||
|
|
||
| def _save_json(path, data): | ||
| with open(path, 'w', encoding='utf-8') as f: |
| return len(sel_kps), h, w | ||
|
|
||
| def _cmd_extract(args): | ||
| os.makedirs(args.out, exist_ok=True) |
| print(json.dumps({"error": "--setting and --param-set cannot be used together"}), file=sys.stderr) | ||
| sys.exit(1) | ||
|
|
||
| png_files = _glob.glob(os.path.join(args.dir, "*.png")) |
|
# Conflicts: # config.py # i18n/es_ES/LC_MESSAGES/ok.mo # i18n/es_ES/LC_MESSAGES/ok.po # i18n/ja_JP/LC_MESSAGES/ok.mo # i18n/ja_JP/LC_MESSAGES/ok.po # i18n/ko_KR/LC_MESSAGES/ok.mo # i18n/ko_KR/LC_MESSAGES/ok.po # i18n/zh_CN/LC_MESSAGES/ok.mo # i18n/zh_CN/LC_MESSAGES/ok.po # i18n/zh_TW/LC_MESSAGES/ok.mo # i18n/zh_TW/LC_MESSAGES/ok.po




介绍
通过ocr及图像特征匹配,定位玩家所处位置。
通过玩家位置查询周围奇藏&高价值品,通过附加层实时显示在游戏ui上。
可以显示库洛大地图上的路线标点,并追踪路线标点,在小地图上显示追踪点方向
拼接地图脚本、特征提取脚本请参考此仓库:https://github.com/9268/wuwa-map
完整的资源下载(assets.zip):https://github.com/9268/wuwa-map/releases
请将该压缩包解压在项目 assets 目录
高价值物品模式:左键显示介绍,右键标记完成,已完成的在小地图不显示,在大地图透明化


路径模式:显示特定路径,左键显示位置名,双击追踪目标,右键取消追踪,追踪后可在小地图上显示目标方向


当前完成:
待完成: