- 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
31 lines
1.9 KiB
Python
31 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Export the active item-proto and recipe-derived 2000-stack coverage."""
|
|
import argparse,json,re,subprocess
|
|
from pathlib import Path
|
|
TYPES={'ITEM_USE','ITEM_AUTOUSE','ITEM_MATERIAL','ITEM_METIN','ITEM_RESOURCE','ITEM_BLEND','ITEM_EXTRACT'}
|
|
|
|
def catalogue(proto,cube,schema):
|
|
if not re.fullmatch('[A-Za-z0-9_]+',schema):raise ValueError('schema')
|
|
ingredients=set()
|
|
if cube.exists():
|
|
for line in cube.read_text(errors='replace').splitlines():
|
|
parts=line.split()
|
|
if len(parts)>=3 and parts[0]=='item' and parts[1].isdigit():ingredients.add(int(parts[1]))
|
|
query=' UNION '.join('SELECT vnum%d FROM `%s`.refine_proto WHERE vnum%d>0'%(i,schema,i) for i in range(5))
|
|
result=subprocess.run(['mysql','-N','-e',query],check=True,capture_output=True,text=True)
|
|
ingredients.update(int(n) for n in result.stdout.split())
|
|
records=[]
|
|
for line in proto.read_bytes().splitlines()[1:]:
|
|
f=[s.decode('latin1') for s in line.split(b'\t')]
|
|
if len(f)<7 or not re.fullmatch(r'\d+(?:~\d+)?',f[0]):continue
|
|
span=[int(n) for n in f[0].split('~')];lo=span[0];hi=span[-1]
|
|
stackable='ITEM_STACKABLE' in f[6] or 'STACKABLE' in f[6]
|
|
anti='ANTI_STACK' in f[5]
|
|
for vnum in range(lo,hi+1):
|
|
eligible=stackable and not anti and (f[2] in TYPES or vnum in ingredients)
|
|
if eligible:records.append(dict(vnum=vnum,type=f[2],old_limit=200,new_limit=2000,recipe_material=vnum in ingredients))
|
|
return dict(schema=schema,proto=str(proto),cube=str(cube),covered_items=len(records),items=records)
|
|
if __name__=='__main__':
|
|
p=argparse.ArgumentParser();p.add_argument('--proto',type=Path,required=True);p.add_argument('--cube',type=Path,required=True);p.add_argument('--schema',required=True);p.add_argument('--output',type=Path,required=True);a=p.parse_args()
|
|
report=catalogue(a.proto,a.cube,a.schema);a.output.write_text(json.dumps(report,indent=2));print(json.dumps({'covered_items':report['covered_items'],'output':str(a.output)}))
|