103 lines
5.6 KiB
C++
103 lines
5.6 KiB
C++
#pragma once
|
|
#include <cstdint>
|
|
#include "gateway/mo_transport_timelines.hpp"
|
|
namespace gateway {
|
|
// Elevator/tram loop period (ms) per GO entry = longest TimeIndex of its rows in the 70334 client's
|
|
// TransportAnimation.db2 (FDID 1140686), the same TotalTime TrinityCore Classic uses for GetTransportPeriod.
|
|
// Generated 2026-11-24 by ops/transport_periods.py; 0 = no client animation (never presented).
|
|
inline constexpr struct {uint32_t entry,period;} TransportPeriods[]={
|
|
{4170,30033},
|
|
{4171,30000},
|
|
{11898,30000},
|
|
{11899,30000},
|
|
{20649,16667},
|
|
{20650,16667},
|
|
{20651,16667},
|
|
{20652,16667},
|
|
{20653,16667},
|
|
{20654,16667},
|
|
{20655,16667},
|
|
{20656,16667},
|
|
{20657,16667},
|
|
{47296,30000},
|
|
{47297,30033},
|
|
{80022,26667},
|
|
{80023,26667},
|
|
{85556,13333},
|
|
{149045,49933},
|
|
{149046,49933},
|
|
{152614,6667},
|
|
{176080,143333},
|
|
{176081,143333},
|
|
{176082,143333},
|
|
{176083,143333},
|
|
{176084,143333},
|
|
{176085,143333},
|
|
};
|
|
constexpr uint32_t turtle_transport_period(uint32_t entry){for(auto row:TransportPeriods)if(row.entry==entry)return row.period;return 0;}
|
|
// MO_TRANSPORT (type 15) ships/zeppelins: Turtle GO entry -> its TaxiPath (template data0) -> the 70334 client
|
|
// TaxiPathNode PathID with node-identical rows (index, map, XYZ to 0.01, flags, delay; checked 2026-11-24 against
|
|
// the server's TaxiPathNode.dbc). The client animates the ship along that path itself; a route without an
|
|
// identical client path is never presented (it would drift from the server and drop passengers).
|
|
inline constexpr struct {uint32_t entry,source_path,client_path;} MoTransportPaths[]={
|
|
{164871,121,302}, // Zeppelin Orgrimmar - Undercity
|
|
{175080,110,285}, // Zeppelin Grom'Gol - Orgrimmar
|
|
{176231,116,292}, // Proudmore's Treasure, Menethil - Theramore
|
|
{176495,120,301}, // Zeppelin Grom'Gol - Undercity
|
|
{177233,122,303}, // Feathermoon Ferry
|
|
// Turtle-only routes: client TaxiPath 12000+source baked into the client (content taxiroutes f5213778)
|
|
{20808,72,12072}, // Ratchet - Booty Bay
|
|
{176244,117,12117}, // Moonspray, Teldrassil - Auberdine
|
|
{181646,294,12294}, // Auberdine - Stormwind
|
|
{190549,295,12295}, // Zeppelin Orgrimmar - Thunder Bluff
|
|
{176310,295,12295}, // Serenity's Shore (same path)
|
|
{190550,296,12296}, // Sparkwater Port - Revantusk Village
|
|
{190552,297,12297}, // Zeppelin Orgrimmar - Kargath
|
|
{176250,323,12323}, // Windrunner, Alah'Thalas - Auberdine
|
|
{20809,348,12348}, // Shadowprey - Moonhoof
|
|
};
|
|
// Where a cross-continent MO transport lands on its new map: the server keyframe after the teleport frame
|
|
// (mo_transport_timelines.hpp). Turtle's SMSG_NEW_WORLD for a passenger carries only the deck offset; 70334 NewWorld
|
|
// needs a world position (TrinityCore: transport position + passenger offset), so the gateway adds this node.
|
|
constexpr const MoTransportArrival* turtle_mo_transport_arrival(uint32_t entry,uint32_t map){
|
|
for(const auto& row:MoTransportArrivals)if(row.entry==entry && row.map==map)return &row;
|
|
return nullptr;
|
|
}
|
|
// Turtle path progress -> 70334 client path time for the same place on the route, and the client's period (sent as
|
|
// GameObjectData.Level like TrinityCore). Piecewise linear between stop/teleport anchors; a create on `map` is kept
|
|
// inside a client leg on that map. Returns false when the live server period is not the generated one.
|
|
constexpr bool turtle_mo_client_progress(uint32_t entry,uint32_t map,uint32_t server_period,uint32_t progress,
|
|
uint32_t& client_progress,uint32_t& client_period){
|
|
for(const auto& t:MoTimelines){
|
|
if(t.entry!=entry)continue;
|
|
if(t.server_period!=server_period)return false;
|
|
progress%=server_period;
|
|
uint64_t c=0;
|
|
for(uint32_t i=1;i<t.anchor_count;++i){
|
|
const auto& a=t.anchors[i-1];const auto& b=t.anchors[i];
|
|
if(progress>=b.server && i+1<t.anchor_count)continue;
|
|
c=b.server==a.server?a.client:a.client+uint64_t(progress-a.server)*(b.client-a.client)/(b.server-a.server);
|
|
break;
|
|
}
|
|
bool inside=false;uint32_t next=UINT32_MAX,first=UINT32_MAX;
|
|
for(uint32_t i=0;i<t.leg_count;++i){
|
|
const auto& leg=t.legs[i];if(leg.map!=map)continue;
|
|
if(c>=leg.start+250 && c<leg.end)inside=true; // 250 ms margin: the model of the client's leg times is not ms-exact
|
|
if(leg.start+250>c && leg.start<next)next=leg.start;
|
|
if(leg.start<first)first=leg.start;
|
|
}
|
|
if(first==UINT32_MAX)return false; // route never visits this map
|
|
// Just short of a map switch the client would still place the ship on the old leg: start the new one.
|
|
if(!inside)c=(next!=UINT32_MAX?next:first)+250;
|
|
client_progress=uint32_t(c%t.client_period);client_period=t.client_period;return true;
|
|
}
|
|
return false;
|
|
}
|
|
// Octo live omits GAMEOBJECT_LEVEL (the loop period) in MO-transport creates (Mindvex 2026-11-25: Windrunner 176250,
|
|
// Stormwind-Auberdine 181646, 83-byte SMSG_UPDATE_OBJECT, session closed). The generated timeline carries the same
|
|
// server period, so it stands in; 0 = unknown route.
|
|
constexpr uint32_t turtle_mo_server_period(uint32_t entry){for(const auto& t:MoTimelines)if(t.entry==entry)return t.server_period;return 0;}
|
|
constexpr uint32_t turtle_mo_transport_client_path(uint32_t entry){for(auto row:MoTransportPaths)if(row.entry==entry)return row.client_path;return 0;}
|
|
constexpr uint32_t turtle_mo_transport_path_by_source(uint32_t source_path){for(auto row:MoTransportPaths)if(row.source_path==source_path)return row.client_path;return 0;}
|
|
}
|