feat: add point currency and stage extended shop items

Rename shop currency and vouchers to points, synchronize the wiki catalogue, and display point rewards. Add wear40 item metadata transport and pet identity accessors; stage sixteen timed mounts and appearance items with AVA2 model registration.

Include build and sbtest acceptance evidence. Remaining shop systems are unfinished and are not enabled or deployed. Wear40 requires the matching server migration and mt20261022 client.
This commit is contained in:
shen
2026-10-19 18:30:19 -07:00
parent 7cba54f271
commit 6661b17084
25 changed files with 336 additions and 35 deletions
+12
View File
@@ -57,6 +57,18 @@ class PurchaseFlow(unittest.TestCase):
for now in [5,10,15,20,25]:self.now=now;self.ns['Tick']()
self.assertEqual(self.sent,['/ishop buy 1 2 '+'a'*32+' 148 71084']*3)
self.assertEqual(self.ns['pending'][4],4)
def test_point_reward_updates_balance_and_rejects_malformed_notifications(self):
messages=[];balances=[]
self.ns.update(long=int,_command=lambda self,line:42,
window=types.SimpleNamespace(SetDragonCoin=balances.append),
chat=types.SimpleNamespace(CHAT_TYPE_INFO=1,AppendChat=lambda kind,text:messages.append(text)))
self.functions('Command')
for line in ('MTPOINTS -1 100','MTPOINTS 1 -1','MTPOINTS bad 100','MTPOINTS 1 2 3'):
self.assertEqual(self.ns['Command'](None,line),1)
self.assertEqual(messages,[]);self.assertEqual(balances,[])
self.assertEqual(self.ns['Command'](None,'MTPOINTS 3 103'),1)
self.assertEqual(balances,[103]);self.assertEqual(messages,['获得 3 点券,当前余额 103。'])
self.assertEqual(self.ns['Command'](None,'other-command'),42)
def test_catalogue_refresh_is_queued_past_command_throttle(self):
self.functions('Request','Tick');self.ns['Request']();self.now=.5;self.ns['Request']()
self.assertEqual(len(self.sent),1);self.assertTrue(self.ns['_queued'])
+48
View File
@@ -0,0 +1,48 @@
"""Verify runtime race registration against the AVA2 definitions, for every sex/job."""
from pathlib import Path
import re
import sys
import types
import unittest
from unittest.mock import patch
ROOT = Path(__file__).resolve().parents[2]
REFERENCE = ROOT.parent/'AVA2/1. Client DEV/pack_maker/root'
@unittest.skipUnless(REFERENCE.is_dir(), 'requires original AVA2 race definitions')
class ShopAppearance(unittest.TestCase):
def test_models_and_skins_match_original_race_definitions(self):
calls = []
module = types.ModuleType('chrmgr')
module.LoadLocalRaceData = lambda name: calls.append(('load', name)) or True
for name in ('SetShapeModel', 'AppendShapeSkin', 'SetHairSkin'):
setattr(module, name, lambda *args, method=name: calls.append((method,)+args))
text = (ROOT/'src/platform/ScriptLib/ArmorShapesScript.inc').read_text()
script = text.split('R"PY(', 1)[1].split(')PY"', 1)[0]
with patch.dict(sys.modules, chrmgr=module):
exec(compile(script, '<appearance>', 'exec'), {})
for race in ('warrior', 'assassin', 'sura', 'shaman'):
for sex in ('m', 'w'):
with self.subTest(race=race, sex=sex):
calls.clear()
filename = race+'_'+sex+'.msm'
self.assertTrue(module.LoadLocalRaceData(filename))
self.assertEqual(calls[0], ('load', filename))
source = (REFERENCE/filename).read_text(errors='replace')
hair_data = source[source.index('Group HairData'):]
base = re.search(r'PathName\s+"([^"]+)"', hair_data).group(1).lower()
groups = re.findall(r'\{([^{}]+)\}', source)
for index, kind in ((40062, 'Shape'), (40063, 'Shape'), (161, 'Hair'), (191, 'Hair')):
group = next(g for g in groups if re.search(kind+r'Index\s+'+str(index)+r'\b', g))
model = re.search(r'Model\s+"([^"]+)"', group).group(1).lower()
skin = re.search(r'TargetSkin\s+"([^"]+)"', group).group(1).lower()
if kind == 'Shape':
self.assertIn(('SetShapeModel', index, base+model), calls)
self.assertIn(('AppendShapeSkin', index, 0, base+skin, base+skin), calls)
else:
self.assertIn(('SetHairSkin', index, 0, base+model, base+skin, base+skin), calls)
if __name__ == '__main__':
unittest.main()