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>
This commit is contained in:
shenlei
2026-10-16 20:26:06 +09:00
co-authored by Claude Opus 5.5
parent e70a6abf7a
commit fc98e6e2b4
21 changed files with 2941 additions and 577 deletions
+3 -4
View File
@@ -24,12 +24,11 @@ class Action(Widget):
class ItemActionsTests(unittest.TestCase):
def setUp(self):
names=('game','grp','player','ui','wndMgr','mt_biolog','mt_preview','mt_chest','mt_wiki','uiInventory','mt_battlepass','mt_switchbot')
names=('game','grp','player','ui','wndMgr','mt_biolog','mt_preview','mt_chest','mt_wiki','uiInventory','mt_battlepass')
mods={name:types.ModuleType(name) for name in names};self.mods=mods;self.actions=[];self.bag={3:(50011,2),4:(19,1)}
mods['game'].GameWindow=type('GameWindow',(),dict(Open=lambda s:None,Close=lambda s:None))
mods['uiInventory'].InventoryWindow=type('InventoryWindow',(),dict(UseItemSlot=lambda owner,cell:self.actions.append(('use',cell)),_InventoryWindow__InventoryLocalSlotPosToGlobalSlotPos=lambda owner,cell:cell))
mods['mt_battlepass'].g_window=types.SimpleNamespace(OfferTicket=lambda c,v:self.actions.append(('ticket',c,v)))
mods['mt_switchbot'].g_window=types.SimpleNamespace(Open=lambda:self.actions.append(('lock',)))
mods['ui'].Window=Widget;mods['mt_biolog'].Action=Action
mods['player'].GetItemIndex=lambda cell:self.bag.get(cell,(0,0))[0]
mods['player'].GetItemCount=lambda cell:self.bag.get(cell,(0,0))[1]
@@ -57,11 +56,11 @@ class ItemActionsTests(unittest.TestCase):
self.ns['ShowInventory'](self.owner,4)
self.window.buttons[1].event();self.assertEqual(self.actions[-1],('preview',19))
def test_ticket_lock_and_original_use(self):
def test_ticket_and_original_use(self):
inventory=self.mods['uiInventory'].InventoryWindow()
for vnum in (25159,50348,50349,27001):
self.bag[5]=(vnum,1);inventory.UseItemSlot(5)
self.assertEqual(self.actions,[('ticket',5,25159),('lock',),('lock',),('use',5)])
self.assertEqual(self.actions,[('ticket',5,25159),('use',5),('use',5),('use',5)]) # 50348/50349 no longer open the switchbot window
def test_stale_actions_never_fire(self):
for change in ('page','vnum','count','closed'):