mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
feat: fire UNIT_THREAT_LIST_UPDATE event on threat changes
Fire UNIT_THREAT_LIST_UPDATE from SMSG_THREAT_UPDATE, SMSG_HIGHEST_THREAT_UPDATE, and SMSG_THREAT_CLEAR. Threat data is already parsed and stored in threatLists_ — this event notifies addon systems when the data changes. Used by Omen, ThreatPlates, and other threat meter addons to refresh their displays when threat values update.
This commit is contained in:
parent
f580fd7e6b
commit
ac9214c03f
1 changed files with 3 additions and 0 deletions
|
|
@ -2848,6 +2848,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
// All threat dropped on the local player (e.g. Vanish, Feign Death)
|
||||
threatLists_.clear();
|
||||
LOG_DEBUG("SMSG_THREAT_CLEAR: threat wiped");
|
||||
if (addonEventCallback_) addonEventCallback_("UNIT_THREAT_LIST_UPDATE", {});
|
||||
break;
|
||||
case Opcode::SMSG_THREAT_REMOVE: {
|
||||
// packed_guid (unit) + packed_guid (victim whose threat was removed)
|
||||
|
|
@ -2891,6 +2892,8 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
std::sort(list.begin(), list.end(),
|
||||
[](const ThreatEntry& a, const ThreatEntry& b){ return a.threat > b.threat; });
|
||||
threatLists_[unitGuid] = std::move(list);
|
||||
if (addonEventCallback_)
|
||||
addonEventCallback_("UNIT_THREAT_LIST_UPDATE", {});
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue