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

44 lines
2.0 KiB
C++

#pragma once
#include "gateway/group.hpp"
#include "gateway/legacy_stream.hpp"
#include "gateway/protocol.hpp"
#include <functional>
#include <map>
#include <set>
#include <array>
#include <span>
#include <string>
// Merged Source SMSG_PARTY_MEMBER_STATS(_FULL) state for one member. Source
// sends deltas by mask; the 70334 client only has PartyMemberFullState.
struct PartyMemberState {
uint8_t status=0,power_type=0,pet_power_type=0;
uint16_t health=0,max_health=0,power=0,max_power=0,level=0,zone=0,x=0,y=0;
std::array<uint16_t,48> auras{};
uint64_t pet=0;std::string pet_name;uint16_t pet_model=0,pet_health=0,pet_max_health=0;
std::array<uint16_t,48> pet_auras{};
};
// Applies one Source member-stats body; returns the member's Source GUID.
uint64_t apply_party_member_stats(std::map<uint64_t,PartyMemberState>&,std::span<const uint8_t>);
// GW_CODEC_GROUP_EVENT kind 9 input; pet omitted when its native GUID is unbound.
gateway::Bytes party_member_state_input(const PartyMemberState&,const gateway::Guid128& member,const gateway::Guid128* pet);
struct NativeReadyCheck { bool active=false;uint64_t initiator=0;std::set<uint64_t> answered; };
struct NativePartyTranslation {
std::map<uint64_t,PartyMemberState> members;
NativeReadyCheck ready_check;
// Only a presentation correlation key. Classic never transmits a GroupGUID.
// The source roster remains authoritative for membership and loot decisions.
uint64_t counter=0;
uint32_t sequence=0;
bool pending=false,shown=false;
std::set<uint64_t> queried;
uint64_t held=0;
void changed(){pending=true;}
std::optional<gateway::LegacyPacket> take(const gateway::TurtleGroupList&,
const gateway::Character&,const std::map<uint64_t,gateway::Character>&,
uint16_t,const std::function<gateway::Bytes(uint32_t,const gateway::Bytes&)>&);
};
// Original 70334 packet writers; reject contracts Source cannot represent.
gateway::Bytes source_party_invite_request(std::span<const uint8_t>,uint32_t);
bool source_party_invite_response(std::span<const uint8_t>);