Files
metin2-client/docs/AVA2-SWITCHBOT.md
T
shenleiandClaude Opus 5.5 657e49e52a Switchbot: sbtest isolated test cluster scripts + live test results
tools/server/sbtest/{setup,restart,rollback}.sh build and manage the isolated
203 test cluster (db :15040, auth :11040, channel5 on *_sb schemas with the
unlocked AVA2 protos). Docs record the channel5/sbtest switchbot results:
weapon, ring, talisman, relog (cache + MySQL), same-core warp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 23:03:07 +09:00

63 lines
5.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AVA2 自动洗练(按 AVA2 移植)
2026-10-16 起替换 v1(`/mt_switchbot` / `MTSB1`)。服务端规则和协议见 `metin2-server/docs/FEATURE-SWITCHBOT.md`,计划见 `docs/AVA2-PARITY-PLAN.md` 阶段 1。
## 和 AVA2 相同的部分
- **C++**
- `PythonSwitchbot.{h,cpp}`:`switchbot` 模块,接口和 AVA2 相同。
- `PythonNetworkStreamPhaseGameSwitchbot.cpp`:收发代码照搬 AVA2。
- `Packet.h`:CG/GC 171,subheader 和字段顺序同 AVA2。物品按本服结构:3 个孔、7 条属性。
- `GameType.h`:`SWITCHBOT = 7` 窗口、`SLOT_TYPE_SWITCHBOT`。
- `PythonPlayer`:`aSwitchbotItem`。
- `RecvItemSetPacket`:收到 SWITCHBOT 窗口的物品时刷新洗练窗口。
- 结构体都是 `pack(1)`,两端都用 `static_assert` 固定大小:220 / 15 / 9 / 40 / 7。
- **脚本**:`mt_switchbot`(`src/platform/ScriptLib/SwitchbotScript.inc`)。
- 主体是 AVA2 `root/uiswitchbot.py` 原文:SwitchbotItemTab、SwitchbotAttribute、SwitchbotWindow、SearchListWindow、ConfigurationWindow。方案用 pickle 存在 `switchbot.inf`。
- 再补上 AVA2 放在别的文件里、用 `ENABLE_SWITCHBOT` 包起来的部分:
- `ui.ThinBoardCircle`、`ListBoxEx.GetItems`;
- `uitooltip.SetSwitchBotItem`;
- mouseModule / uiinventory 的 `SLOT_TYPE_SWITCHBOT`(拖回背包时发 `SendItemMovePacket(SWITCHBOT → INVENTORY)`);
- interfacemodule 的 Toggle / Refresh / HideAllWindows / `__HideWindows`;
- game.py 的 `RefreshSwitchbotWindow` / `RefreshSwitchbotItem`。
- **图片**:`d:/ymir work/ui/switchbot/` 和 `ui/pattern/thinboardcircle/`。`tools/server/ava2-items/make_items.py` 的 `SWITCHBOT_UI` 把它们打进 ava2items 包。
## 和 AVA2 不同的地方
| 项目 | AVA2 | 本实现 | 原因 |
| --- | --- | --- | --- |
| 第 6 格(洗练道具格) | 显示,放 71084 | 隐藏(`attrTab.Hide()`) | 服务端从背包取道具,不用第 5 号格 |
| 入口 | 扩展任务栏按钮 + F9 | 小地图旁“洗练”按钮(y+148,原 v1 按钮的位置) | 40250 没有扩展任务栏;F9/F8 已给自动狩猎,触屏也要能点 |
| 结束 / 停止提示 | locale_string 864 / 865 | 服务端命令 `switchbot_end/stop/error`,脚本转成中文聊天提示 | 见服务端文档 |
| “Alternativen:” | 德文写死 | `localeInfo.SWITCHBOT_ALTERNATIVES`(备选方案:) | 原文没走 locale |
| 文字 | locale_game.txt | 脚本里补中文 `SWITCHBOT_*`(`player.AutoHuntLocalize` 转码) | 本服 locale 没有这些条目 |
| 版本 | — | `CG_CLIENT_VERSION2` 的 timestamp 由 `1215955205` 改为 `1215955205 mt20261016` | 服务端只给新客户端发 GC_SWITCHBOT;服务端(欧洲区)的版本检查用 `atoi`,仍读到 1215955205 |
没有移植 AVA2 的 `uiswitch.DopadorMenu/DopadorManual`(另一套手动洗练菜单)。
右键使用 50348/50349 不再打开洗练窗口。服务端仍支持把这两个道具用到物品上来锁定或解锁属性(槽位取道具的 socket 0),但 AVA2 选槽位的界面和物品提示还没做。
## 证据
- `tests/wiki/test_switchbot.py`(CTest `port.switchbot`),5 项:
- 窗口代码和 AVA2 原文逐字相同(只有上表两处替换);
- ThinBoardCircle、文字、`USERDATA_DIRECTORY`、5 个标签页的宽度;
- 服务端命令提示,其他命令照常传下去;
- 从洗练窗口拖回背包;
- interface / game 钩子。
- `tests/wiki/test_item_actions.py` 已更新:50348/50349 走原来的使用流程。
- 脚本能在 Python 2.7 下编译。macOS 构建(`build/switchbot-check`,关闭 MeshPort)通过,ctest 52 项全过(7 项跳过,和之前一样)。
- 服务端 `tests/features/test_switchbot.py` 同时检查客户端 `Packet.h`、`PythonSwitchbot.h` 和版本字符串。
- 联机测试(2026-10-16,Mac 客户端 + 203 的 channel5,脚本驱动):
- 武器(channel5 连线上 db):放入、拖回、开始和停止、洗到目标自动结束、洗练中拖出被拒绝、放入无效物品被拒绝;约 12 次/秒,ItemLog 记录数和消耗数一致。
- 戒指和护符(`tools/server/sbtest` 隔离环境,解锁后的 proto):戒指用戒指属性池(20 条),消耗 71084;护符用护符属性池,只消耗 71302。两边都能洗到目标。
- 重新登录:物品和属性保留(从 db 缓存读和重启后从 MySQL 读都测过,`window=SWITCHBOT`);洗练停止,目标清空,和 AVA2 一样(下线时 `UnregisterItem`)。
- 同核心换地图(1 → 21 → 1):传送后接着洗,目标保留,只在传送时暂停一下,和 AVA2 一样。
## 未完成
- 跨核心换线(P2P 转移)的联机测试:测试环境只有一个核心。
- 部署:203 正式环境还是 v1。戒指和护符要整个 feature/ava2-unlock(含解锁后的 proto)一起上线,服务端和客户端也要一起部署。
- Android 构建和真机测试。
- 属性锁定界面(AVA2 拖 50348/50349,并在物品提示里显示锁定)。