Files
shenleiandClaude Opus 5.5 fb066e7046 AVA2 unlock P5: mount costume and mount skin
COSTUME_MOUNT=2 / COSTUME_MOUNT_SKIN=4, WEAR_COSTUME_MOUNT 25 / _SKIN 26.
port_mount.cpp summons/unsummons the horse on equip, skin overrides the
mount vnum in GetMyHorseVnum; costume subtypes no longer map onto the
armor attribute sets. db ProtoReader learns COSTUME_MOUNT_SKIN.

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

47 lines
2.8 KiB
Python

#!/usr/bin/env python3
"""AVA2 mount costume + skin (docs/FEATURE-AVA2-UNLOCK.md P5): subtype/wear numbering shared with the client,
the horse race override and the equip/unequip/login hooks."""
from pathlib import Path
import re
ROOT=Path(__file__).resolve().parents[2]
SRC=ROOT/'src/server'
CLIENT=ROOT.parent/'metin2-client/src/port'
def source(name):return (SRC/name).read_bytes().decode('latin1')
def enum_after(text,start,end):
body=text[text.index(start):];body=body[:body.index(end)]
return re.findall(r'^\s*([A-Z_0-9]+)\s*[,=]',body,re.M)
item=source('common/item_length.h')
assert 'COSTUME_MOUNT = 2,' in item and 'COSTUME_MOUNT_SKIN = 4,' in item
reader=source('db/src/ProtoReader.cpp')
assert '"COSTUME_MOUNT", "COSTUME_SASH", "COSTUME_MOUNT_SKIN" };' in reader
wear=enum_after(source('common/length.h'),'WEAR_BODY','WEAR_MAX_NUM')
assert wear.index('WEAR_COSTUME_MOUNT')==25 and wear.index('WEAR_COSTUME_MOUNT_SKIN')==26,wear
if CLIENT.is_dir():
gametype=(CLIENT/'UserInterface/GameType.h').read_text()
assert 'c_Costume_Slot_Mount = c_Equipment_Start + 25;' in gametype and 'c_Costume_Slot_MountSkin = c_Equipment_Start + 26;' in gametype
itemdata=(CLIENT/'GameLib/ItemData.h').read_text()
assert 'COSTUME_MOUNT = 2,' in itemdata and 'COSTUME_MOUNT_SKIN = 4,' in itemdata
horse=source('game/src/char_horse.cpp')
body=horse[horse.index('DWORD CHARACTER::GetMyHorseVnum'):];body=body[:body.index('\n}\n')]
assert body.index('WEAR_COSTUME_MOUNT_SKIN')<body.index('GetWear(WEAR_COSTUME_MOUNT)')<body.index('c_aHorseStat'),body
assert 'return WEAR_COSTUME_MOUNT;' in source('game/src/item.cpp') and 'return WEAR_COSTUME_MOUNT_SKIN;' in source('game/src/item.cpp')
attr=source('game/src/item_attribute.cpp')
assert 'GetSubType() == COSTUME_MOUNT || GetSubType() == COSTUME_SASH || GetSubType() == COSTUME_MOUNT_SKIN))\n\t\treturn -1;' in attr
items=source('game/src/char_item.cpp')
for hook in ('MountCostumeCanEquip(item)','MountCostumeCanUnequip(item)','MountCostumeEquipped(item);',
'MountCostumeUnequipped(item, true);','MountCostumeUnequipped(item, false);'):
assert items.count(hook)==1,hook
assert 'ch->MountCostumeOnLogin();' in source('game/src/input_login.cpp')
assert 'ch->UnequipItem(pkCostumeMount);' in source('game/src/cmd_general.cpp')
assert 'port_mount.cpp' in source('game/src/Makefile')
mount=source('game/src/port_mount.cpp')
for code in ('riding','need_mount','has_skin','need_horse'):assert '"MTMOUNT %s"'%code in mount,code
script=ROOT.parent/'metin2-client/src/platform/ScriptLib/MountScript.inc'
if script.is_file():
s=script.read_text()
for code in ('riding','need_mount','has_skin','need_horse'):assert "'%s':"%code in s,code
print('PASS: mount subtypes 2/4, WEAR 25/26, horse race = skin > mount > horse level, hooks, MTMOUNT codes')