50 lines
2.6 KiB
Python
50 lines
2.6 KiB
Python
"""#105 (2026-11-26): profession specialisation ranks as native SkillLineAbility links.
|
|
|
|
Master smiths (Weaponsmith 9787 + Master Swordsmith/Hammersmith/Axesmith 17039-17041) carried 3 profession book
|
|
spells; the native camelot professions book has 2 spell buttons and asserts on more. Turtle's spell_chain links
|
|
those masters to Weaponsmith (prev_spell=9787), but the native SkillLineAbility rows have SupercedesSpell=0, so the
|
|
book never collapsed them the way it collapses Blacksmithing's own ranks (2018 -> 3100 -> 3538 -> 9785).
|
|
|
|
Rule, catalogue-wide over every Turtle spell_chain link on a profession or secondary skill line:
|
|
- the native row's SupercedesSpell differs from the server prev_spell, and
|
|
- the previous spell is NOT one of the profession's own rank spells (no native SupercedesSpell link in or out).
|
|
Linking a specialisation (Weaponsmith, Armorsmith, Gnomish Engineering, ...) onto the Artisan rank would hide
|
|
the profession itself, so those links stay as Blizzard shipped them.
|
|
Class spell ranks are not touched (Blizzard ships them unlinked; Classic shows ranks its own way).
|
|
|
|
Usage: sla_rank_links.py <sla.dump> <spell_chain.tsv> <rows.json>
|
|
sla.dump: `Db2Bake dump <dir> <defs> SkillLineAbility`; spell_chain.tsv: tw_world.spell_chain spell_id prev_spell ...
|
|
"""
|
|
import collections, json, sys
|
|
|
|
PROFESSION_LINES = {'164', '165', '171', '197', '202', '333', '393', '182', '186', '129', '185', '356', '755', '773', '142', '762'}
|
|
|
|
|
|
def main(dump, chain, out):
|
|
sla = {}
|
|
for line in open(dump):
|
|
p = line.rstrip('\n').split('\t')
|
|
if len(p) > 2: sla[int(p[0])] = dict(x.split('=', 1) for x in p[1:] if '=' in x)
|
|
by_spell = collections.defaultdict(list)
|
|
linked = set()
|
|
for i, d in sla.items():
|
|
by_spell[int(d['Spell'])].append(i)
|
|
if int(d['SupercedesSpell']): linked.update((int(d['Spell']), int(d['SupercedesSpell'])))
|
|
rows, kept = [], []
|
|
for line in open(chain):
|
|
spell, prev = (int(v) for v in line.split()[:2])
|
|
if not prev: continue
|
|
for i in by_spell.get(spell, []):
|
|
d = sla[i]
|
|
if d['SkillLine'] not in PROFESSION_LINES or int(d['SupercedesSpell']) == prev: continue
|
|
if prev in linked or not any(sla[j]['SkillLine'] == d['SkillLine'] for j in by_spell.get(prev, [])):
|
|
kept.append((i, spell, prev)); continue
|
|
rows.append(dict(ID=i, SupercedesSpell=prev))
|
|
json.dump(sorted(rows, key=lambda r: r['ID']), open(out, 'w'), indent=0)
|
|
print('links', len(rows), [(r['ID'], r['SupercedesSpell']) for r in rows])
|
|
print('kept native (prev is a profession rank spell)', kept)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main(*sys.argv[1:4])
|