- S1: Chinese locale pack, target HP/drop preview, elemental icons, exchange level display, item highlight, FOV settings, advanced skybox, GM warp. - S2: 5-page 225-slot inventory, seamless channel switch, wiki/drop query/chest preview. - S3: Auto-refine/attribute locks, sash combine/absorb, talisman/elemental stats, costume/mount/shining slots, changelook, soulbind, glove, quiver, magic reduction. - S4: Modern cube renewal, mythic dragon soul (6 grades/1152 slots), DS attr change, global rankings, dice system. - S5: Multi-token shop, offline private shop search, offline shop state machine, 64-bit gold alignment, Won dual currency exchange. - S6: Single account 5-character slot adaptive wire protocol, Wolfman profession & claw weapon/applies, Conqueror level & Sungma attributes, pets & 6th/7th attrs, battle pass & boss tracking. - Pass 42/42 platform gate test suites in scripts/port_gate.sh macos.
35 lines
2.5 KiB
Python
35 lines
2.5 KiB
Python
"""Run the production costume inventory adapter, including the two removal items."""
|
|
import sys,types,unittest
|
|
from pathlib import Path
|
|
ROOT=Path(__file__).resolve().parents[2]
|
|
SOURCE=(ROOT/'src/platform/ScriptLib/CostumeAttrScript.inc').read_text().split('R"PY(',1)[1].rsplit(')PY";',1)[0]
|
|
class CostumeProducts(unittest.TestCase):
|
|
def setUp(self):
|
|
names=('chat','game','item','player','uiInventory','uiToolTip');self.old={n:sys.modules.get(n) for n in names};self.m={n:types.ModuleType(n) for n in names};sys.modules.update(self.m)
|
|
self.selected=0;self.attrs={0:(23,10),1:(24,20),5:(91,50),14:(99,0)};self.equipped=False
|
|
class Inventory:
|
|
def _InventoryWindow__CanUseSrcItemToDstItem(self,*args):return 'delegate'
|
|
class Tip:
|
|
def AddItemData(self,*args):pass
|
|
class Game:
|
|
def BINARY_ServerCommand_Run(self,line):return 0
|
|
self.m['uiInventory'].InventoryWindow=Inventory;self.m['uiToolTip'].ItemToolTip=Tip;self.m['game'].GameWindow=Game
|
|
p=self.m['player'];p.AutoHuntLocalize=lambda text:text;p.GetItemIndex=lambda cell:41119;p.IsEquipmentSlot=lambda cell:self.equipped;p.GetItemAttribute=lambda cell,i:self.attrs.get(i,(0,0));p.ATTRIBUTE_SLOT_MAX_NUM=7
|
|
item=self.m['item'];item.ITEM_TYPE_USE=3;item.ITEM_TYPE_COSTUME=28;item.COSTUME_TYPE_BODY=0;item.COSTUME_TYPE_HAIR=1;item.COSTUME_TYPE_MOUNT_SKIN=4
|
|
item.SelectItem=lambda v:setattr(self,'selected',v);item.GetItemType=lambda:28 if self.selected==41119 else 3;item.GetItemSubType=lambda:0;item.GetUseType=lambda v:'USE_CHANGE_ATTRIBUTE';item.GetValue=lambda index:(23,10,2)[index]
|
|
self.ns={'xrange':range};exec(SOURCE,self.ns);self.inv=Inventory()
|
|
def tearDown(self):
|
|
for n,v in self.old.items():
|
|
if v is None:sys.modules.pop(n,None)
|
|
else:sys.modules[n]=v
|
|
def test_removal_targets_normal_attributes_and_refuses_equipped(self):
|
|
method=self.inv._InventoryWindow__CanUseSrcItemToDstItem
|
|
for v in (53998,53999):
|
|
self.assertTrue(method(v,0,1));self.assertFalse(method(v,1,1));self.equipped=True;self.assertFalse(method(v,0,1));self.equipped=False
|
|
self.attrs={5:(91,50),14:(99,0)}
|
|
for v in (53998,53999):self.assertFalse(method(v,0,1))
|
|
def test_fixed_enchants_keep_duplicate_guard_and_unknown_items_delegate(self):
|
|
method=self.inv._InventoryWindow__CanUseSrcItemToDstItem
|
|
self.assertFalse(method(54001,0,1));self.attrs={};self.assertTrue(method(54001,0,1))
|
|
self.assertEqual(method(71084,0,1),'delegate')
|