feat: fire UPDATE_FACTION, QUEST_ACCEPTED, and QUEST_LOG_UPDATE events

Fire UPDATE_FACTION when reputation standings change (SMSG_SET_FACTION_STANDING).
Fire QUEST_ACCEPTED with quest ID when a new quest is added to the log.
Fire QUEST_LOG_UPDATE on both quest acceptance and quest completion.
Enables reputation tracking and quest log addons.
This commit is contained in:
Kelsi 2026-03-20 17:28:28 -07:00
parent 14007c81df
commit c44e1bde0a

View file

@ -4156,6 +4156,8 @@ void GameHandler::handlePacket(network::Packet& packet) {
addSystemChatMessage(buf);
watchedFactionId_ = factionId;
if (repChangeCallback_) repChangeCallback_(name, delta, standing);
if (addonEventCallback_)
addonEventCallback_("UPDATE_FACTION", {});
}
LOG_DEBUG("SMSG_SET_FACTION_STANDING: faction=", factionId, " standing=", standing);
}
@ -5289,6 +5291,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
}
}
}
if (addonEventCallback_) addonEventCallback_("QUEST_LOG_UPDATE", {});
// Re-query all nearby quest giver NPCs so markers refresh
if (socket) {
for (const auto& [guid, entity] : entityManager.getEntities()) {
@ -21052,6 +21055,10 @@ void GameHandler::addQuestToLocalLogIfMissing(uint32_t questId, const std::strin
entry.title = title.empty() ? ("Quest #" + std::to_string(questId)) : title;
entry.objectives = objectives;
questLog_.push_back(std::move(entry));
if (addonEventCallback_) {
addonEventCallback_("QUEST_ACCEPTED", {std::to_string(questId)});
addonEventCallback_("QUEST_LOG_UPDATE", {});
}
}
bool GameHandler::resyncQuestLogFromServerSlots(bool forceQueryMetadata) {