20 lines
1.4 KiB
Python
20 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Regenerate include/gateway/transport_periods.hpp from a TransportAnimation dump.
|
|
usage: transport_periods.py <ta.txt> <turtle type-11 entries.txt> > include/gateway/transport_periods.hpp
|
|
entries = tw_world gameobject_template type=11 ids (one per line); only those are listed.
|
|
ta.txt = Db2Bake dump of the client's TransportAnimation.db2 (FDID 1140686), lines '...TimeIndex=N\tTransportID=E'."""
|
|
import re,sys,collections
|
|
per=collections.defaultdict(int)
|
|
for l in open(sys.argv[1]):
|
|
m=re.search(r'TimeIndex=(\d+)\tTransportID=(\d+)',l)
|
|
if m: per[int(m[2])]=max(per[int(m[2])],int(m[1]))
|
|
print('#pragma once\n#include <cstdint>\nnamespace gateway {')
|
|
print("// Elevator/tram loop period (ms) per GO entry = longest TimeIndex of its rows in the 70334 client's")
|
|
print('// TransportAnimation.db2 (FDID 1140686), the same TotalTime TrinityCore Classic uses for GetTransportPeriod.')
|
|
print('// Generated 2026-11-24 by ops/transport_periods.py; 0 = no client animation (never presented).')
|
|
print('inline constexpr struct {uint32_t entry,period;} TransportPeriods[]={')
|
|
t11={int(x) for x in open(sys.argv[2]) if x.strip()}
|
|
for e,p in sorted(per.items()):
|
|
if p and e in t11: print(f' {{{e},{p}}},')
|
|
print('};\nconstexpr uint32_t turtle_transport_period(uint32_t entry){for(auto row:TransportPeriods)if(row.entry==entry)return row.period;return 0;}\n}')
|