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

25 lines
1.5 KiB
C++

// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "gateway/protocol.hpp"
#include <optional>
#include <span>
#include <utility>
#include <vector>
namespace gateway {
// Tortoise BattleGroundMgr::BuildPvpLogDataPacket (MSG_PVP_LOG_DATA 0x2e0).
struct TurtlePvpRow {uint64_t guid=0;uint32_t rank=0,killing_blows=0,honorable_kills=0,deaths=0,bonus_honor=0;std::vector<uint32_t> fields;};
struct TurtlePvpLog {bool ended=false;uint8_t winner=0;std::vector<TurtlePvpRow> rows;};
TurtlePvpLog turtle_pvp_log(std::span<const uint8_t>);
// 70334 PVPStat.db2 rows for the Source per-BG field order of the verified
// battleground map; unmapped Source fields (AV lieutenants, secondary NPCs)
// are omitted. Returns nullopt when the field count does not match the map.
std::optional<std::vector<std::pair<int32_t,int32_t>>> native_pvp_stats(uint32_t map,const std::vector<uint32_t>&);
// One emitted row: genuine GUID, established match team (TeamId: 0 Alliance,
// 1 Horde) and identity; damage/healing have no Source field.
struct PvpStatisticsRow {Guid128 guid{};uint8_t team=0,race=0,sex=0,cls=0;uint32_t kills=0,honorable_kills=0,deaths=0,contribution=0;std::vector<std::pair<int32_t,int32_t>> stats;};
Bytes pvp_statistics_input(const std::vector<PvpStatisticsRow>&);
std::vector<PvpStatisticsRow> pvp_statistics_from_input(std::span<const uint8_t>);
// Codec side: original PVPMatchStatisticsMessage writer (src/pvp_statistics_serializer.cpp).
Bytes serialize_pvp_statistics(const Bytes&);
}