Files
metin2-server/tools/material-stack/warehouse_fixture.py
T
shenlei bb0963210e feat: support Linux/ARM cross-platform build and AVA2 feature updates
- Port server core and libraries to Linux and 32-bit ARM (armhf):
  * Replace FreeBSD kqueue with Linux epoll in libthecore fdwatch
  * Fix unaligned float and 64-bit int memory stores in utils.h str_to_number to avoid ARM VFP alignment fault (SIGBUS)
  * Fix getopt loop variable type in main.cpp (char -> int) to eliminate infinite loop caused by default unsigned char on ARM
  * Add -fsigned-char and multi-architecture flags to Makefiles (x86_64 -m32, i386, and ARM armhf)
  * Update libsql for modern MariaDB client library (removed reconnect field) and C++20 concept/syntax compatibility
  * Replace Win32 xdirent with standard POSIX dirent on Unix/Linux
  * Include xmd5 in libthecore on non-FreeBSD platforms
- AVA2 unlock features and tools:
  * Material stacking up to 2000 count, refine material resolution and test suites
  * AVA2 ticket shop and point drop configuration updates
2026-11-11 00:59:49 -08:00

38 lines
2.7 KiB
Python

#!/usr/bin/env python3
"""Temporary CH5-only NPC click fixture for a named QA character; remove after acceptance."""
import argparse,json,pathlib,re,shutil,subprocess
BASE=pathlib.Path('/root/deploy-features/20261026-stack2000')
QUEST=pathlib.Path('/usr/metin2/server/sbtest/share/locale/newcibn/quest')
if __name__=='__main__':
p=argparse.ArgumentParser();p.add_argument('action',choices=['install','remove']);p.add_argument('--private-file',required=True);p.add_argument('--extended',action='store_true');p.add_argument('--scope',choices=['test','production'],default='test');a=p.parse_args()
if a.scope=='production':
if a.extended:raise RuntimeError('extended fixtures are isolated-only')
QUEST=pathlib.Path('/usr/metin2/server/share/locale/newcibn/quest')
manifest=BASE/('warehouse-fixture-files.json' if a.scope=='test' else 'warehouse-fixture-production-files.json')
if a.action=='remove':
if manifest.exists():
for name in json.loads(manifest.read_text()):
path=pathlib.Path(name)
if not path.is_relative_to(QUEST/'object'):raise RuntimeError('unexpected fixture path')
path.unlink(missing_ok=True)
manifest.unlink()
else:
s=json.loads(pathlib.Path(a.private_file).read_text());name=s['name']
if not re.fullmatch('[A-Za-z0-9]+',name):raise ValueError('name')
work=BASE/('warehouse-quest' if a.scope=='test' else 'warehouse-quest-production');work.mkdir(exist_ok=True)
shutil.copy2(QUEST/'quest_functions',work/'quest_functions')
source=work/'stack2000_acceptance.quest'
actions={'STACK2000_QA':'game.open_safebox()'}
if a.extended:actions.update(STACK2000_SHOP='npc.open_shop(65001)',STACK2000_MALL='game.open_mall()',STACK2000_GRANT='pc.give_item2(30007,4001)',STACK2000_CUBE='command("cube open")',STACK2000_CUBE_MATERIAL='pc.give_item2(30008,2000)',STACK2000_FULL='pc.give_item2(27003,2001)',STACK2000_REFINE='pc.give_item2(30053,2000) mob.spawn(20016,pc.get_local_x()+1,pc.get_local_y()+1,0,false,1)')
clauses=['when 9005.chat."'+label+'" with pc.get_name()=="'+name+'" begin\n setskin(NOWINDOW)\n '+action+'\n end' for label,action in actions.items()]
source.write_text('quest stack2000_acceptance begin\n state start begin\n'+'\n'.join(clauses)+'\n end\nend\n')
shutil.rmtree(work/'object',ignore_errors=True)
subprocess.run([str(QUEST/'qc'),str(source)],cwd=work,check=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
files=[]
for path in (work/'object').rglob('*'):
if not path.is_file():continue
target=QUEST/'object'/path.relative_to(work/'object')
if target.exists():raise RuntimeError('fixture path already exists')
target.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(path,target);files.append(str(target))
manifest.write_text(json.dumps(files));print('fixture files',len(files))