Files

54 lines
3.2 KiB
C++

#pragma once
#include "entity_translation.hpp"
#include "gateway/group.hpp"
#include "gateway/loot.hpp"
#include "gateway/queries.hpp"
#include <map>
#include <chrono>
/* Pure source-session state. No sockets, engine pointers, item grants or DB
* access. LootObject IDs are destination presentation identities only; genuine
* source owners and slot IDs remain unchanged on Turtle's wire. */
struct NativeLootTranslation {
struct Binding {uint64_t source=0,generation=0;gateway::Guid128 modern{};uint8_t kind=3;uint16_t realm=0;uint32_t map=0;};
struct Window {Binding owner;gateway::Guid128 object{};gateway::TurtleLootResponse source;std::vector<uint64_t> master_candidates;};
struct PendingMaster {Binding owner;gateway::Bytes body;std::vector<uint64_t> candidates;};
struct Roll {
Binding owner;
gateway::TurtleLootRoll start;
std::chrono::steady_clock::time_point deadline;
gateway::Guid128 object{};
std::optional<gateway::TurtleLootItem> item;
std::vector<gateway::TurtleLootRoll> updates;
std::vector<gateway::TurtleLootRoll> results; // Numeric results await actual winner for recipient UIType.
uint32_t map=0;
uint8_t method=0;
bool published=false,voted=false;
bool quantity_known=false; // Only a matching genuine LOOT_RESPONSE supplies quantity.
};
std::optional<PendingMaster> pending_master;
std::optional<Binding> opening;
std::optional<std::chrono::steady_clock::time_point> opening_deadline; // Confirmed cast/use expiry; explicit loot requests have none.
bool fishing=false; // opening armed by a bobber use (#99): loot response presents as LOOT_FISHING.
std::optional<Window> window;
std::optional<gateway::TurtleGroupList> group;
std::vector<Roll> rolls;
std::deque<gateway::TurtleLootItem> received_award_intents;
bool group_transition=false;
uint64_t serial=0;
uint32_t deferred_content=0,deferred_money_notifications=0;
std::deque<gateway::LegacyPacket> requests;
// Terminal-qualified actual Source results; presentation only, never awards.
std::deque<std::string> roll_chat_notices;
// Retained cache reference; item stack limits do not prove a loot-row quantity.
const std::map<uint32_t,gateway::ItemTemplateReply>* templates=nullptr;
gateway::LegacyPacket gameplay(uint32_t,std::span<const uint8_t>,const NativeEntityTranslation&) const;
std::vector<gateway::LegacyPacket> items(std::span<const uint8_t>,const NativeEntityTranslation&) const;
std::vector<gateway::LegacyPacket> master_items(std::span<const uint8_t>,const NativeEntityTranslation&,uint64_t,uint16_t) const;
void sent(uint32_t,std::span<const uint8_t>,const NativeEntityTranslation&);
void confirmed_skinning_cast(uint64_t source,uint16_t realm,uint32_t map,const NativeEntityTranslation&);
void confirmed_chest_cast(uint64_t source,uint16_t realm,uint32_t map,const NativeEntityTranslation&);
void confirmed_fishing_use(uint64_t source,uint16_t realm,uint32_t map,const NativeEntityTranslation&);
std::vector<gateway::LegacyPacket> translate(const gateway::LegacyPacket&,const gateway::Character&,
uint16_t,uint32_t,const NativeEntityTranslation&,const NativeEntityTranslation::Codec&);
};