AVA2 unlock P6: costume enchants (USE_CHANGE_ATTRIBUTE 54001-54267)
Enchant stones add one fixed attribute to an unequipped body / hair / mount-skin costume (max 3, no duplicates); gear and the switchbot refuse them. MTCATTR chat commands report the result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fb066e7046
commit
6199b2cbff
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
"""AVA2 costume enchants (docs/FEATURE-AVA2-UNLOCK.md P6): 54001-54267 add one fixed attribute to a
|
||||
body/hair/mount-skin costume, are routed before the 40250 switcher path and are no switchbot scroll."""
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parents[2]
|
||||
SRC=ROOT/'src/server/game/src'
|
||||
def source(name):return (SRC/name).read_bytes().decode('latin1')
|
||||
|
||||
items=source('char_item.cpp')
|
||||
case=items[items.index('case USE_CHANGE_ATTRIBUTE2 :'):]
|
||||
hook=case.index('if (item->IsCostumeEnchant())\n\t\t\t\t\t\t\t\treturn CostumeEnchantUse(item, item2);')
|
||||
assert hook<case.index('BuffOnAttr_RemoveBuffsFromItem(item2)')<case.index('ITEM_COSTUME == item2->GetType()'),'hook must run before the costume refusal'
|
||||
assert '!scroll->IsCostumeEnchant()' in source('port_switchbot.h')
|
||||
assert 'port_costume_attr.cpp' in source('Makefile')
|
||||
port=source('port_costume_attr.cpp')
|
||||
for text in ('COSTUME_ENCHANT_VNUM_MIN = 54001','COSTUME_ENCHANT_VNUM_MAX = 54267','COSTUME_ENCHANT_MAX_ATTR = 3',
|
||||
'case COSTUME_BODY:\n\t\t\treturn 1;','case COSTUME_HAIR:\n\t\t\treturn 2;','case COSTUME_MOUNT_SKIN:\n\t\t\treturn 4;',
|
||||
'GetValue(2) & (1 << flag)','item->SetCount(item->GetCount() - 1);'):
|
||||
assert text in port,text
|
||||
codes=('target','none','equipped','full','has','done')
|
||||
for code in codes:assert '"MTCATTR %s"'%code in port,code
|
||||
# the add must come after every refusal
|
||||
assert all(port.index('"MTCATTR %s"'%c)<port.index('item2->AddAttribute') for c in codes[:-1])
|
||||
script=ROOT.parent/'metin2-client/src/platform/ScriptLib/CostumeAttrScript.inc'
|
||||
if script.is_file():
|
||||
s=script.read_text()
|
||||
for code in codes:assert "'%s':"%code in s,code
|
||||
print('PASS: costume enchant hook before switcher path, body/hair/mount-skin masks, max 3, switchbot excluded, MTCATTR codes')
|
||||
@@ -45,6 +45,7 @@ class CHARACTER;
|
||||
class CItem {public:
|
||||
DWORD id,vnum;BYTE type,subtype;int set=0;unsigned cell;BYTE window=INVENTORY;bool equipped=false,exchanging=false;int count=1;
|
||||
CHARACTER* owner=nullptr;TItemTable proto{};TPlayerItemAttribute attrs[7];
|
||||
long value2=0;bool IsCostumeEnchant(){return vnum>=54001 && vnum<=54267 && value2;}
|
||||
DWORD GetID(){return id;}DWORD GetVnum(){return vnum;}BYTE GetType(){return type;}BYTE GetSubType(){return subtype;}
|
||||
int GetAttributeSetIndex(){return set;}const TItemTable* GetProto(){return &proto;}
|
||||
const TPlayerItemAttribute& GetAttribute(int i){return attrs[i];}BYTE GetAttributeType(int i){return attrs[i].bType;}
|
||||
@@ -131,6 +132,9 @@ int main(){
|
||||
cmd("1 start 10 71084 5 2 3 1 3 2");assert(last()=="MTSB1 error start target"); // duplicate
|
||||
cmd("1 start 10 71085 5 1 3 4");assert(last()=="MTSB1 error start scroll");
|
||||
cmd("1 start 10 50001 5 1 3 4");assert(last()=="MTSB1 error start scroll");
|
||||
// AVA2 costume enchants share USE_CHANGE_ATTRIBUTE but are no switchers (port_costume_attr.cpp).
|
||||
CItem enchant{2004,54001,ITEM_USE,USE_CHANGE_ATTRIBUTE,-1,23};enchant.owner=&ch;enchant.value2=2;ch.inventory.push_back(&enchant);
|
||||
cmd("1 start 10 54001 5 1 3 4");assert(last()=="MTSB1 error start scroll");
|
||||
cmd("1 start 30 71084 5 1 3 4");assert(last()=="MTSB1 error start no_attr");
|
||||
armor.equipped=true;cmd("1 start 10 71084 5 1 3 4");assert(last()=="MTSB1 error start equipped");armor.equipped=false;
|
||||
cmd("1 start 10 71084 5 1 3 2");assert(last()=="MTSB1 state 0 10 11209 0 5 71084 3 matched" && events.empty()); // already satisfied
|
||||
|
||||
Reference in New Issue
Block a user