Files
metin2-client/docs/AVA2-SWITCHBOT.md
T
shenleiandClaude Opus 5.5 fc98e6e2b4 Port the AVA2 switchbot window and switchbot module
PythonSwitchbot + PythonNetworkStreamPhaseGameSwitchbot from AVA2 (CG/GC 171,
SWITCHBOT window 7, SLOT_TYPE_SWITCHBOT), uiswitchbot.py verbatim in
SwitchbotScript.inc plus its ENABLE_SWITCHBOT glue (tooltip, mouse/inventory
drag-back, interface/game hooks, zh strings, server switchbot_* messages).
Entry is the minimap 洗练 button; F9 stays with auto-hunt. The client version
timestamp is now "mt20261016" so the server enables the switchbot.
50348/50349 no longer open the window. Adds docs/AVA2-PARITY-PLAN.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 20:26:06 +09:00

3.9 KiB
Raw Blame History

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_VERSION 的 timestamp 发 mt20261016(原为 __TIMESTAMP__) 服务端只给新客户端发 GC_SWITCHBOT

没有移植 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 和版本字符串。

未完成

  • 联机测试:channel5 或部署后的 CH1。203 正式环境还是 v1,服务端和客户端要一起部署。
  • Android 构建和真机测试。
  • 属性锁定界面(AVA2 拖 50348/50349,并在物品提示里显示锁定)。