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:
Kelsi 2026-03-21 01:26:37 -07:00
parent 22798d1c76
commit 32a51aa93d
3 changed files with 12 additions and 2 deletions

View file

@ -64,6 +64,7 @@ static uint64_t resolveUnitGuid(game::GameHandler* gh, const std::string& uid) {
if (uid == "player") return gh->getPlayerGuid();
if (uid == "target") return gh->getTargetGuid();
if (uid == "focus") return gh->getFocusGuid();
if (uid == "mouseover") return gh->getMouseoverGuid();
if (uid == "pet") return gh->getPetGuid();
// party1-party4, raid1-raid40
if (uid.rfind("party", 0) == 0 && uid.size() > 5) {
@ -91,7 +92,7 @@ static uint64_t resolveUnitGuid(game::GameHandler* gh, const std::string& uid) {
return 0;
}
// Helper: resolve "player", "target", "focus", "pet", "partyN", "raidN" unit IDs to entity
// Helper: resolve "player", "target", "focus", "mouseover", "pet", "partyN", "raidN" unit IDs to entity
static game::Unit* resolveUnit(lua_State* L, const char* unitId) {
auto* gh = getGameHandler(L);
if (!gh || !unitId) return nullptr;