Files
2026-11-23 03:28:32 +02:00

40 lines
1.6 KiB
C++

// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "gateway/legacy_stream.hpp"
#include "gateway/world.hpp"
#include <array>
#include <optional>
namespace gateway::remote_speeds {
// Exact original70334 getter140a48ab0, not the unnormalized reference5E000E.
inline constexpr uint32_t MovementOpcode = 0x60000e;
enum class Kind : uint8_t { walk, run, run_back, swim, swim_back, turn };
struct Route {
Kind kind;
uint16_t observer, spline;
uint32_t native_observer, native_spline;
};
inline constexpr std::array<Route, 6> Routes{{
{Kind::walk, 0xd1, 0x301, 0x600006, 0x60001d},
{Kind::run, 0xcd, 0x2fe, 0x600004, 0x600015},
{Kind::run_back, 0xcf, 0x2ff, 0x600005, 0x600016},
{Kind::swim, 0xd3, 0x300, 0x600007, 0x600017},
{Kind::swim_back, 0xd5, 0x302, 0x600008, 0x600018},
{Kind::turn, 0xd8, 0x303, 0x60000b, 0x60001e},
}};
struct Update {
uint64_t source_guid{};
Kind kind{};
float speed{};
// Observer packets own genuine source MovementInfo; spline packets do not.
std::optional<BasicMovement> movement;
};
void validate_binding(uint64_t source_guid,const Guid128& bound,uint16_t realm,uint32_t map);
const Route *route(uint32_t source_opcode);
std::optional<Update> turtle_packet(uint32_t source_opcode,
std::span<const uint8_t> body);
// Caller supplies a current, presented actor binding; equality to the named
// source category/realm/map is checked again before serializing any packet.
LegacyPacket forever_packet(const Update &, const Guid128 &bound,
uint16_t realm, uint32_t map);
} // namespace gateway::remote_speeds