24 lines
1.8 KiB
Python
24 lines
1.8 KiB
Python
"""#91 (owner 2026-11-26: 'thorns spell and dispelling spell exist'): Turtle SPELLDAMAGESHIELD / SPELLDISPELLOG /
|
|
DISPEL_FAILED omit the spell id the 70334 packets need. The gateway recovers it from its own state; this generates
|
|
the spell sets from the current Octo client Spell.dbc (1.12 layout: School col 1, Attributes 6, Effect 61-63, EffectAura 91-93).
|
|
Usage: python3 gen.py <Spell.dbc> > include/gateway/spell_log_sources.hpp"""
|
|
import struct, sys
|
|
b = open(sys.argv[1], 'rb').read(); _, n, nf, rs, _ = struct.unpack_from('<4s4I', b); assert nf == 173
|
|
shield, dispel, swing = [], [], []
|
|
for i in range(n):
|
|
r = struct.unpack_from('<%dI' % nf, b, 20 + i * rs)
|
|
if any(r[61 + k] == 6 and r[91 + k] == 15 for k in range(3)): shield.append((r[0], r[1]))
|
|
if any(r[61 + k] == 38 for k in range(3)): dispel.append(r[0])
|
|
if r[6] & 0x404: swing.append(r[0]) # Attributes: ON_NEXT_SWING (0x4) / ON_NEXT_SWING_2 (0x400)
|
|
print('// Generated by ops/spell-log-sources/gen.py from Octo client Spell.dbc; do not edit.')
|
|
print('#pragma once\n#include <array>\n#include <cstdint>\n#include <utility>\nnamespace gateway::spell_log_sources {')
|
|
print('// {spell, school index} of every SPELL_AURA_DAMAGE_SHIELD (15) aura, sorted by spell.')
|
|
print('inline constexpr std::array<std::pair<uint32_t,uint8_t>,%d> DamageShields{{' % len(shield))
|
|
print(','.join('{%d,%d}' % s for s in sorted(shield)) + '}};')
|
|
print('// Spells with SPELL_EFFECT_DISPEL (38), sorted.')
|
|
print('inline constexpr std::array<uint32_t,%d> Dispels{{' % len(dispel))
|
|
print(','.join(map(str, sorted(dispel))) + '}};')
|
|
print('// #136: next-melee-swing spells (Heroic Strike, Cleave, Raptor Strike, Maul...); their GO arrives at the swing, sorted.')
|
|
print('inline constexpr std::array<uint32_t,%d> NextSwing{{' % len(swing))
|
|
print(','.join(map(str, sorted(swing))) + '}};\n}')
|