mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 00:03:50 +00:00
feat: add UI_ERROR_MESSAGE events and quest removal notifications
Fire UI_ERROR_MESSAGE from addUIError() so Lua addons can react to error messages like "Not enough mana" or "Target is too far away". Previously only the C++ overlay callback was notified. Also add addUIInfoMessage() helper for informational system messages. Fire QUEST_REMOVED and QUEST_LOG_UPDATE when quests are removed from the quest log — both via server-driven removal (SMSG_QUEST_UPDATE_FAILED etc.) and player-initiated abandon (CMSG_QUESTLOG_REMOVE_QUEST). Quest tracking addons like Questie register for these events to update their map markers and objective displays.
This commit is contained in:
parent
8fd735f4a3
commit
e4da47b0d7
2 changed files with 15 additions and 1 deletions
|
|
@ -1989,7 +1989,13 @@ public:
|
||||||
// UI error frame: prominent on-screen error messages (spell can't be cast, etc.)
|
// UI error frame: prominent on-screen error messages (spell can't be cast, etc.)
|
||||||
using UIErrorCallback = std::function<void(const std::string& msg)>;
|
using UIErrorCallback = std::function<void(const std::string& msg)>;
|
||||||
void setUIErrorCallback(UIErrorCallback cb) { uiErrorCallback_ = std::move(cb); }
|
void setUIErrorCallback(UIErrorCallback cb) { uiErrorCallback_ = std::move(cb); }
|
||||||
void addUIError(const std::string& msg) { if (uiErrorCallback_) uiErrorCallback_(msg); }
|
void addUIError(const std::string& msg) {
|
||||||
|
if (uiErrorCallback_) uiErrorCallback_(msg);
|
||||||
|
if (addonEventCallback_) addonEventCallback_("UI_ERROR_MESSAGE", {msg});
|
||||||
|
}
|
||||||
|
void addUIInfoMessage(const std::string& msg) {
|
||||||
|
if (addonEventCallback_) addonEventCallback_("UI_INFO_MESSAGE", {msg});
|
||||||
|
}
|
||||||
|
|
||||||
// Reputation change toast: factionName, delta, new standing
|
// Reputation change toast: factionName, delta, new standing
|
||||||
using RepChangeCallback = std::function<void(const std::string& factionName, int32_t delta, int32_t standing)>;
|
using RepChangeCallback = std::function<void(const std::string& factionName, int32_t delta, int32_t standing)>;
|
||||||
|
|
|
||||||
|
|
@ -5714,6 +5714,10 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
||||||
} else {
|
} else {
|
||||||
addSystemChatMessage("Quest removed (ID " + std::to_string(questId) + ").");
|
addSystemChatMessage("Quest removed (ID " + std::to_string(questId) + ").");
|
||||||
}
|
}
|
||||||
|
if (addonEventCallback_) {
|
||||||
|
addonEventCallback_("QUEST_LOG_UPDATE", {});
|
||||||
|
addonEventCallback_("QUEST_REMOVED", {std::to_string(questId)});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -21883,6 +21887,10 @@ void GameHandler::abandonQuest(uint32_t questId) {
|
||||||
|
|
||||||
if (localIndex >= 0) {
|
if (localIndex >= 0) {
|
||||||
questLog_.erase(questLog_.begin() + static_cast<ptrdiff_t>(localIndex));
|
questLog_.erase(questLog_.begin() + static_cast<ptrdiff_t>(localIndex));
|
||||||
|
if (addonEventCallback_) {
|
||||||
|
addonEventCallback_("QUEST_LOG_UPDATE", {});
|
||||||
|
addonEventCallback_("QUEST_REMOVED", {std::to_string(questId)});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove any quest POI minimap markers for this quest.
|
// Remove any quest POI minimap markers for this quest.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue