37 lines
1.9 KiB
C++
37 lines
1.9 KiB
C++
#pragma once
|
|
#include "gateway/protocol.hpp"
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <span>
|
|
#include <string>
|
|
|
|
// Duel — FULLY DROPPED. Source half both directions, from tortoise DuelHandler.cpp /
|
|
// Object code. Guids FULL le(8). Small, self-contained.
|
|
namespace gateway {
|
|
|
|
enum : uint8_t { DUEL_INTERRUPTED=0, DUEL_WON=1, DUEL_FLED=2 }; // DuelCompleteType
|
|
|
|
// ---- inbound SMSG -> native ----
|
|
struct TurtleDuelRequested { uint64_t flagGuid=0, initiatorGuid=0; }; // 0x167
|
|
inline std::optional<TurtleDuelRequested> turtle_duel_requested(std::span<const uint8_t> b){
|
|
Reader r(b); TurtleDuelRequested d; d.flagGuid=r.le(8); d.initiatorGuid=r.le(8); r.end(); return d; }
|
|
|
|
struct TurtleDuelComplete { uint8_t notInterrupted=0; }; // 0x16A: 1 normal, 0 interrupted
|
|
inline std::optional<TurtleDuelComplete> turtle_duel_complete(std::span<const uint8_t> b){
|
|
Reader r(b); TurtleDuelComplete d; d.notInterrupted=uint8_t(r.le(1)); r.end(); return d; }
|
|
|
|
struct TurtleDuelWinner { uint8_t reason=0; std::string winner, loser; }; // 0x16B: 0 won, 1 fled
|
|
inline std::optional<TurtleDuelWinner> turtle_duel_winner(std::span<const uint8_t> b){
|
|
Reader r(b); TurtleDuelWinner d; d.reason=uint8_t(r.le(1)); d.winner=r.cstring(48); d.loser=r.cstring(48); r.end(); return d; }
|
|
|
|
struct TurtleDuelCountdown { uint32_t milliseconds=0; }; // 0x2B7
|
|
inline std::optional<TurtleDuelCountdown> turtle_duel_countdown(std::span<const uint8_t> b){
|
|
Reader r(b); TurtleDuelCountdown d; d.milliseconds=uint32_t(r.le(4)); r.end(); return d; }
|
|
// SMSG_DUEL_OUTOFBOUNDS 0x168 and SMSG_DUEL_INBOUNDS 0x169 are empty-body signals (no parser needed).
|
|
|
|
// ---- outbound native CMSG -> Source CMSG ----
|
|
// 0x16C CMSG_DUEL_ACCEPTED : u64 flagGuid 0x16D CMSG_DUEL_CANCELLED : u64 flagGuid
|
|
inline Bytes source_duel_flag(uint64_t flagGuid){ Bytes b; le(b,flagGuid,8); return b; }
|
|
|
|
} // namespace gateway
|