feat: parse SMSG_RESPOND_INSPECT_ACHIEVEMENTS and request on inspect

When the player inspects another player on WotLK 3.3.5a, also send
CMSG_QUERY_INSPECT_ACHIEVEMENTS so the server responds with
SMSG_RESPOND_INSPECT_ACHIEVEMENTS.  The new handler parses the
achievement-id/date sentinel-terminated block (same layout as
SMSG_ALL_ACHIEVEMENT_DATA but prefixed with a packed guid) and stores
the earned achievement IDs keyed by GUID in
inspectedPlayerAchievements_.  The new public getter
getInspectedPlayerAchievements(guid) exposes this data for the inspect
UI.  The cache is cleared on world entry to prevent stale data.
QueryInspectAchievementsPacket::build() handles the CMSG wire format
(uint64 guid + uint8 unk=0).
This commit is contained in:
Kelsi 2026-03-12 23:23:02 -07:00
parent 0089b3a160
commit 1d9dc6dcae
4 changed files with 87 additions and 1 deletions

View file

@ -1611,6 +1611,12 @@ public:
auto it = achievementPointsCache_.find(id);
return (it != achievementPointsCache_.end()) ? it->second : 0u;
}
/// Returns the set of achievement IDs earned by an inspected player (via SMSG_RESPOND_INSPECT_ACHIEVEMENTS).
/// Returns nullptr if no inspect data is available for the given GUID.
const std::unordered_set<uint32_t>* getInspectedPlayerAchievements(uint64_t guid) const {
auto it = inspectedPlayerAchievements_.find(guid);
return (it != inspectedPlayerAchievements_.end()) ? &it->second : nullptr;
}
// Server-triggered music callback — fires when SMSG_PLAY_MUSIC is received.
// The soundId corresponds to a SoundEntries.dbc record. The receiver is
@ -2835,6 +2841,11 @@ private:
std::unordered_map<uint32_t, uint64_t> criteriaProgress_;
void handleAllAchievementData(network::Packet& packet);
// Per-player achievement data from SMSG_RESPOND_INSPECT_ACHIEVEMENTS
// Key: inspected player's GUID; value: set of earned achievement IDs
std::unordered_map<uint64_t, std::unordered_set<uint32_t>> inspectedPlayerAchievements_;
void handleRespondInspectAchievements(network::Packet& packet);
// Area name cache (lazy-loaded from WorldMapArea.dbc; maps AreaTable ID → display name)
std::unordered_map<uint32_t, std::string> areaNameCache_;
bool areaNameCacheLoaded_ = false;