mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
feat: add mouseover unit ID support and fire UPDATE_MOUSEOVER_UNIT/PLAYER_FOCUS_CHANGED events
Add "mouseover" as a valid unit ID in resolveUnitGuid so Lua API functions
like UnitName("mouseover"), UnitHealth("mouseover") etc. work for addons.
Fire UPDATE_MOUSEOVER_UNIT event when the mouseover target changes, and
PLAYER_FOCUS_CHANGED event when focus is set or cleared.
This commit is contained in:
parent
22798d1c76
commit
32a51aa93d
3 changed files with 12 additions and 2 deletions
|
|
@ -13534,6 +13534,7 @@ std::shared_ptr<Entity> GameHandler::getTarget() const {
|
|||
|
||||
void GameHandler::setFocus(uint64_t guid) {
|
||||
focusGuid = guid;
|
||||
if (addonEventCallback_) addonEventCallback_("PLAYER_FOCUS_CHANGED", {});
|
||||
if (guid != 0) {
|
||||
auto entity = entityManager.getEntity(guid);
|
||||
if (entity) {
|
||||
|
|
@ -13559,6 +13560,14 @@ void GameHandler::clearFocus() {
|
|||
LOG_INFO("Focus cleared");
|
||||
}
|
||||
focusGuid = 0;
|
||||
if (addonEventCallback_) addonEventCallback_("PLAYER_FOCUS_CHANGED", {});
|
||||
}
|
||||
|
||||
void GameHandler::setMouseoverGuid(uint64_t guid) {
|
||||
if (mouseoverGuid_ != guid) {
|
||||
mouseoverGuid_ = guid;
|
||||
if (addonEventCallback_) addonEventCallback_("UPDATE_MOUSEOVER_UNIT", {});
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Entity> GameHandler::getFocus() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue