mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
feat: restore quest kill counts from update fields using parsed objectives
Parse kill/item objectives from SMSG_QUEST_QUERY_RESPONSE binary data: - extractQuestQueryObjectives() scans past the fixed integer header and variable-length strings to reach the 4 entity + 6 item objective entries (using known offsets: 40 fields for Classic/TBC, 55 for WotLK) - Objectives stored in QuestLogEntry.killObjectives / itemObjectives arrays - After storing, applyPackedKillCountsFromFields() reads 6-bit packed counts from update-field slots (stride+2 / stride+3) and populates killCounts using the parsed creature/GO entry IDs as keys This means on login, quests that were in progress show correct kill count progress (e.g. "2/5 Defias Bandits killed") without waiting for the first server SMSG_QUESTUPDATE_ADD_KILL notification.
This commit is contained in:
parent
7e55d21cdd
commit
73439a4457
2 changed files with 174 additions and 1 deletions
|
|
@ -1069,12 +1069,27 @@ public:
|
|||
std::string title;
|
||||
std::string objectives;
|
||||
bool complete = false;
|
||||
// Objective kill counts: objectiveIndex -> (current, required)
|
||||
// Objective kill counts: npcOrGoEntry -> (current, required)
|
||||
std::unordered_map<uint32_t, std::pair<uint32_t, uint32_t>> killCounts;
|
||||
// Quest item progress: itemId -> current count
|
||||
std::unordered_map<uint32_t, uint32_t> itemCounts;
|
||||
// Server-authoritative quest item requirements from REQUEST_ITEMS
|
||||
std::unordered_map<uint32_t, uint32_t> requiredItemCounts;
|
||||
// Structured kill objectives parsed from SMSG_QUEST_QUERY_RESPONSE.
|
||||
// Index 0-3 map to the server's objective slot order (packed into update fields).
|
||||
// npcOrGoId != 0 => entity objective (kill NPC or interact with GO).
|
||||
struct KillObjective {
|
||||
int32_t npcOrGoId = 0; // negative = game-object entry
|
||||
uint32_t required = 0;
|
||||
};
|
||||
std::array<KillObjective, 4> killObjectives{}; // zeroed by default
|
||||
// Required item objectives parsed from SMSG_QUEST_QUERY_RESPONSE.
|
||||
// itemId != 0 => collect items of that type.
|
||||
struct ItemObjective {
|
||||
uint32_t itemId = 0;
|
||||
uint32_t required = 0;
|
||||
};
|
||||
std::array<ItemObjective, 6> itemObjectives{}; // zeroed by default
|
||||
};
|
||||
const std::vector<QuestLogEntry>& getQuestLog() const { return questLog_; }
|
||||
void abandonQuest(uint32_t questId);
|
||||
|
|
@ -2363,6 +2378,9 @@ private:
|
|||
void extractSkillFields(const std::map<uint16_t, uint32_t>& fields);
|
||||
void extractExploredZoneFields(const std::map<uint16_t, uint32_t>& fields);
|
||||
void applyQuestStateFromFields(const std::map<uint16_t, uint32_t>& fields);
|
||||
// Apply packed kill counts from player update fields to a quest entry that has
|
||||
// already had its killObjectives populated from SMSG_QUEST_QUERY_RESPONSE.
|
||||
void applyPackedKillCountsFromFields(QuestLogEntry& quest);
|
||||
|
||||
NpcDeathCallback npcDeathCallback_;
|
||||
NpcAggroCallback npcAggroCallback_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue