AVA2 new_switchbot ported as port_switchbot.{h,cpp}: SWITCHBOT item window (7),
CG/GC 171 and GG 31 with AVA2 subheaders and field order, pack(1) structs pinned
by static_assert, 0.1 s roll, P2P hand-over on warp, boot ALTER of
player.item.window. Switchers come from the inventory; current checks and
ItemLog are kept. Clients sending "mt20261016" or newer as the version
timestamp get the switchbot; older clients are left alone.
The v1 /mt_switchbot chat command, its lock verb and query capability bit 64
are removed (cap mask 1023 -> 959).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
2.6 KiB
Python
Executable File
38 lines
2.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""AVA2 talisman (docs/FEATURE-AVA2-UNLOCK.md P7): ARMOR_PENDANT worn in WEAR_PENDANT, element enchant applies,
|
|
its own attribute pool changed only by 71301/71302/53996/53997; the switchbot rolls talismans with 71302 only."""
|
|
from pathlib import Path
|
|
ROOT=Path(__file__).resolve().parents[2]
|
|
SRC=ROOT/'src/server'
|
|
def source(name):return (SRC/name).read_bytes().decode('latin1')
|
|
|
|
il=source('common/item_length.h');assert il.index('ARMOR_EAR,')<il.index('ARMOR_PENDANT,')<il.index('ARMOR_NUM_TYPES')
|
|
length=source('common/length.h')
|
|
assert length.index('WEAR_COSTUME_MOUNT_SKIN,\t// 26')<length.index('WEAR_PENDANT,\t\t// 27')
|
|
reader=source('db/src/ProtoReader.cpp')
|
|
assert '"ARMOR_NECK", "ARMOR_EAR", "ARMOR_PENDANT", "ARMOR_NUM_TYPES"' in reader
|
|
item=source('game/src/item.cpp')
|
|
fec=item[item.index('int CItem::FindEquipCell('):]
|
|
assert fec.index('if (IsTalisman())\n\t\treturn WEAR_PENDANT;')<fec.index('0 == GetWearFlag()'),'talisman has no wear flag'
|
|
items=source('game/src/char_item.cpp')
|
|
case=items[items.index('case USE_CHANGE_ATTRIBUTE2 :'):]
|
|
assert case.index('return CostumeEnchantUse(item, item2);')<case.index('if (item->GetPendantScrollKind() || item2->IsTalisman())\n\t\t\t\t\t\t\t\treturn PendantScrollUse(item, item2);')<case.index('BuffOnAttr_RemoveBuffsFromItem(item2)')
|
|
sb=source('game/src/port_switchbot.cpp')
|
|
assert 'if (pkItem->IsTalisman())\n\t\t\treturn FindUsableSwitcher(ch, 71302);' in sb and 'GetPendantAttrMaxValue(' in sb
|
|
assert 'port_pendant.cpp' in source('game/src/Makefile')
|
|
port=source('game/src/port_pendant.cpp')
|
|
pool=port[port.index('s_aPendantAttr[] ='):];pool=pool[:pool.index('};')]
|
|
assert pool.count('{ APPLY_')==20 and 'APPLY_ATTBONUS' not in pool and 'APPLY_ENCHANT' not in pool
|
|
for text in ('PENDANT_MAX_ATTR = 5','{ 0, 10, 40, 35, 15 }','{ 40, 50, 10, 0, 0 }','case 71302:\n\t\tcase 53996:','case 71301:\n\t\tcase 53997:',
|
|
'if (item->HasAttr(r.bApply))','item->SetCount(item->GetCount() - 1);'):
|
|
assert text in port,text
|
|
codes=('target','equipped','empty','changed','full','added')
|
|
for code in codes:assert '"MTPENDANT %s"'%code in port,code
|
|
assert port.index('"MTPENDANT equipped"')<port.index('item2->ClearAttribute()')
|
|
assert port.index('"MTPENDANT full"')<port.index('PendantPutAttribute(item2, s_aiAddLevel)')
|
|
script=ROOT.parent/'metin2-client/src/platform/ScriptLib/PendantScript.inc'
|
|
if script.is_file():
|
|
s=script.read_text()
|
|
for code in codes:assert "'%s':"%code in s,code
|
|
print('PASS: talisman slot/equip, enchant switch routing before the switcher path, 20-row pool, max 5, switchbot 71302 only, MTPENDANT codes')
|