53 lines
2.0 KiB
Python
53 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""2026-11-25: CharStartKit rows for every race/class combination the server allows (tw_world.playercreateinfo).
|
|
|
|
The 70334 client asserts (ERROR #135 "CharStartKit entry is missing for race R and class C") when char create or char
|
|
select shows a character whose race/class has no CharStartKit row - every Turtle-only combo (High Elf, Goblin, Dwarf
|
|
mage/warlock, Gnome hunter, Night Elf priest, Undead hunter, ...) crashed the client. Each missing row copies the
|
|
native row of the same race (any class), else the same class (any race), with ChrRacesID/ChrClassesID set.
|
|
New IDs follow the client maximum.
|
|
|
|
usage: char_start_kits.py <CharStartKit dump tsv> <combos "race class ..."> <out.json>
|
|
"""
|
|
import json
|
|
import re
|
|
import sys
|
|
|
|
SKIP = {'ID', 'ChrRacesID', 'ChrClassesID'}
|
|
|
|
|
|
def main(dump, combos, out):
|
|
rows = []
|
|
for line in open(dump):
|
|
m = dict(re.findall(r'(\w+)=([^\t]*)', line))
|
|
if 'ChrRacesID' in m:
|
|
rows.append(m)
|
|
have = {(int(r['ChrRacesID']), int(r['ChrClassesID'])) for r in rows}
|
|
nums = [int(x) for x in combos.split()]
|
|
wanted = sorted({(nums[i], nums[i + 1]) for i in range(0, len(nums), 2)})
|
|
next_id = max(int(r['ID']) for r in rows) + 1
|
|
new = []
|
|
for race, cls in wanted:
|
|
if (race, cls) in have:
|
|
continue
|
|
donor = next((r for r in rows if int(r['ChrRacesID']) == race), None) or \
|
|
next(r for r in rows if int(r['ChrClassesID']) == cls)
|
|
row = dict(ID=next_id, ChrRacesID=race, ChrClassesID=cls)
|
|
for k, v in donor.items():
|
|
if k in SKIP:
|
|
continue
|
|
if ',' in v:
|
|
row[k] = [float(x) if '.' in x or 'e' in x.lower() else int(x) for x in v.split(',')]
|
|
elif k.endswith('_lang'):
|
|
row[k] = v
|
|
else:
|
|
row[k] = float(v) if '.' in v else int(v)
|
|
new.append(row)
|
|
next_id += 1
|
|
json.dump(new, open(out, 'w'))
|
|
print('added', [(r['ChrRacesID'], r['ChrClassesID']) for r in new])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main(*sys.argv[1:4])
|