Files
praxisandClaude Fable 5.2 c2194c59d4 Protocol core: packet translation between source and native
127 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:47 +02:00

78 lines
3.5 KiB
C++

#pragma once
#include "gateway/protocol.hpp"
#include <optional>
namespace gateway {
// Tortoise Protocol/Opcodes_1_12_1.h. These describe source wire messages,
// not Forever engine routes or an authorization to loot an object.
enum class TurtleLootOpcode : uint16_t {
autostore_item=0x108, open=0x15D, money=0x15E, release=0x15F,
response=0x160, release_response=0x161, removed=0x162,
money_notify=0x163, clear_money=0x165, item_push=0x166
};
// Source LootMgr.h values, deliberately separate from modern UI enums:
// the original Forever master/locked values are reversed.
enum class TurtleLootSlotUi : uint8_t {
allow=0, roll_ongoing=1, master=2, locked=3, owner=4
};
enum class TurtleLootError : uint8_t {
didnt_kill=0, too_far=4, bad_facing=5, locked=6, not_standing=8,
stunned=9, player_not_found=10, play_time_exceeded=11,
master_inventory_full=12, master_unique_item=13, master_other=14,
already_pickpocketed=15, not_while_shapeshifted=16
};
struct TurtleLootItem {
uint8_t slot=0;
uint32_t item=0,count=0,display=0,random_placeholder=0;
int32_t random_property=0;
TurtleLootSlotUi ui=TurtleLootSlotUi::allow;
};
struct TurtleLootResponse {
uint64_t owner=0;
uint8_t type=0; // Wire types1..4; zero selects the error form.
uint32_t money=0;
std::optional<TurtleLootError> error{};
std::vector<TurtleLootItem> items;
};
struct TurtleLootRelease { uint64_t owner=0;bool released=false; };
struct TurtleItemPush {
uint64_t player=0;
bool received=false,created=false,show_in_chat=false;
uint8_t bag=0;
uint32_t slot=0,item=0,suffix_factor=0,count=0;
int32_t random_property=0;
// slot==UINT32_MAX means merged stack; no item GUID or total inventory
// count exists in this source packet. Resolve those from real updates.
};
// Group.cpp roll packets precede the loot response and are sent to eligible
// group members even if their own loot window has never been opened. Preserve
// the source fields here; this is not itself a native roll or permission.
struct TurtleLootRoll {
uint64_t owner=0, player=0;
uint32_t slot=0, item=0, suffix=0;
int32_t random_property=0;
uint32_t countdown=0;
uint8_t number=0, type=0;
};
struct TurtleLootRollPresentation { int32_t roll=0;uint8_t vote=0; };
// Only translations supported by Group::CountRollVote/CountTheRoll and the
// corresponding Forever LootRollBroadcast writer are returned.
std::optional<TurtleLootRollPresentation> turtle_loot_roll_presentation(uint8_t number,uint8_t type);
TurtleLootRoll turtle_loot_roll_start(std::span<const uint8_t>);
TurtleLootRoll turtle_loot_roll_update(std::span<const uint8_t>);
TurtleLootRoll turtle_loot_roll_won(std::span<const uint8_t>);
TurtleLootRoll turtle_loot_roll_all_passed(std::span<const uint8_t>);
Bytes turtle_loot_roll_vote(uint64_t owner,uint32_t slot,uint8_t vote);
TurtleLootResponse turtle_loot_response(std::span<const uint8_t>);
TurtleLootRelease turtle_loot_release_response(std::span<const uint8_t>);
uint8_t turtle_loot_removed(std::span<const uint8_t>);
void turtle_loot_clear_money(std::span<const uint8_t>);
uint32_t turtle_loot_money_notify(std::span<const uint8_t>);
TurtleItemPush turtle_item_push(std::span<const uint8_t>);
// Source request bodies only. Session, owner type, visibility, slot membership,
// distance and permission checks belong to the caller and authoritative server.
Bytes turtle_loot_open(uint64_t owner);
Bytes turtle_loot_release(uint64_t owner);
Bytes turtle_loot_item(uint32_t slot);
Bytes turtle_loot_money();
}