feat: add gated CH5 quiver support and unified regression runner

This commit is contained in:
shen
2026-10-22 17:41:47 -07:00
parent 60ed66692e
commit 3784137b4f
39 changed files with 1617 additions and 23 deletions
+25 -1
View File
@@ -126,10 +126,33 @@ def names():
for month in range(1,13):result[25149+month]='%d月战令票'%month
return result
def convert(cols,E,imported):
QUIVER_DURATIONS={79502:604800,79503:1296000,79504:2592000}
def validate_quiver(cols,E):
"""Only the three unambiguous archived timed variants; never enable 79501."""
if len(cols)<33:raise ValueError('truncated quiver row')
c=[x.strip() for x in cols[:33]]
v=int(c[0])
if v not in QUIVER_DURATIONS or c[2:5]!=['ITEM_WEAPON','WEAPON_QUIVER','1']:
raise ValueError('unsupported quiver variant')
if c[14:18]!=['REAL_TIME',str(QUIVER_DURATIONS[v]),'LIMIT_NONE','0']:
raise ValueError('quiver duration differs from verified archive')
if c[7]!='WEAR_ARROW' or c[8]!='NONE' or c[9:14]!=['0']*5:
raise ValueError('quiver wear/price/refine contract differs')
if c[18:24]!=['APPLY_NONE','0']*3 or c[24:33]!=['17','4','0','25','0','0','0','0','0']:
raise ValueError('quiver applies/values differ')
expected={'ANTI_MUSA','ANTI_SURA','ANTI_MUDANG','ANTI_WOLFMAN'}
expected |= {'ANTI_DROP','ANTI_GIVE','ANTI_MYSHOP','ANTI_SAFEBOX'} if v==79502 else {'ANTI_PKDROP'}
if set(tokens(c[5]))!=expected or set(tokens(c[6]))!={'ITEM_STACKABLE','ITEM_SLOW_QUERY'}:
raise ValueError('quiver flags differ')
if E['sub'][E['type'].index('ITEM_WEAPON')].index('WEAPON_QUIVER')!=9:
raise ValueError('quiver runtime subtype must be 9')
def convert(cols,E,imported,enable_quiver=False):
"""AVA2 item_proto.txt row (str columns) -> (server row columns, client numeric fields, kept?)."""
c=[x.strip() for x in cols[:33]]
t,st=c[2],c[3]
if enable_quiver:validate_quiver(cols,E)
kept=t in KEEP_TYPES or (t,st) in KEEP_SUBTYPES or ((t,st)==('ITEM_USE','USE_CHANGE_ATTRIBUTE') and
any(lo<=int(c[0])<=hi for lo,hi in ENCHANT_KEEP)) or (
(t,st) in (('ITEM_USE','USE_CHANGE_ATTRIBUTE'),('ITEM_USE','USE_ADD_ATTRIBUTE')) and int(c[0]) in PENDANT_SCROLLS) or (
@@ -139,6 +162,7 @@ def convert(cols,E,imported):
int(c[0]) in (70002,39063,39064) and (t,st)==('ITEM_USE','USE_SPECIAL'))
if t=='ITEM_COSTUME' and st in ('COSTUME_BODY','COSTUME_HAIR') and int(c[0]) in (41119,41120,41121,41122,45005,45006,45057,45058):kept=True
if stone_lock_reason(c,E):kept=False
if enable_quiver:kept=True
anti=tokens(c[5]);flags=tokens(c[6])
if 'ITEM_STACKABLE' in anti:anti.remove('ITEM_STACKABLE');flags.append('ITEM_STACKABLE')
anti=[a for a in dict.fromkeys(anti) if a in E['anti']];flags=[f for f in dict.fromkeys(flags) if f in E['flag']]