mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
fix: return caster unit ID from UnitBuff/UnitDebuff/UnitAura
The caster field (8th return value) was always nil. Now returns the
caster's unit ID ("player", "target", "focus", "pet") or hex GUID
string for other units. Enables addons to identify who applied a
buff/debuff for filtering and tracking purposes.
This commit is contained in:
parent
ffe16f5cf2
commit
5adb9370d2
1 changed files with 18 additions and 1 deletions
|
|
@ -392,7 +392,24 @@ static int lua_UnitAura(lua_State* L, bool wantBuff) {
|
|||
}
|
||||
lua_pushnumber(L, aura.maxDurationMs > 0 ? aura.maxDurationMs / 1000.0 : 0); // duration
|
||||
lua_pushnumber(L, 0); // expirationTime (would need absolute time)
|
||||
lua_pushnil(L); // caster
|
||||
// caster: return unit ID string if caster is known
|
||||
if (aura.casterGuid != 0) {
|
||||
if (aura.casterGuid == gh->getPlayerGuid())
|
||||
lua_pushstring(L, "player");
|
||||
else if (aura.casterGuid == gh->getTargetGuid())
|
||||
lua_pushstring(L, "target");
|
||||
else if (aura.casterGuid == gh->getFocusGuid())
|
||||
lua_pushstring(L, "focus");
|
||||
else if (aura.casterGuid == gh->getPetGuid())
|
||||
lua_pushstring(L, "pet");
|
||||
else {
|
||||
char cBuf[32];
|
||||
snprintf(cBuf, sizeof(cBuf), "0x%016llX", (unsigned long long)aura.casterGuid);
|
||||
lua_pushstring(L, cBuf);
|
||||
}
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
lua_pushboolean(L, 0); // isStealable
|
||||
lua_pushboolean(L, 0); // shouldConsolidate
|
||||
lua_pushnumber(L, aura.spellId); // spellId
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue