mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-27 18:06:02 +00:00
buffs: cancel by spellID instead of GetPlayerBuff slot index
`GetPlayerBuff(PLAYER_BUFF_START_ID + this.id, filter)` assumes the visual index pfUI shows matches the engine's slot order. When that mismapping happens — most easily reproduced by stacking buffs that share a slot family — right-clicking one buff cancels another. `C_Spell.CancelSpellByID(spellID)` ships CMSG_CANCEL_AURA keyed to the spell, not a slot, so it's immune to whatever order the slot table is in. Cache `spellId` on the button at refresh time in buff.lua; in the unitframes/buffwatch handlers fetch the aura fresh via `C_UnitAuras.GetAuraDataByIndex` at click time. Fixes #10.
This commit is contained in:
+4
-4
@@ -73,8 +73,8 @@ end
|
||||
|
||||
local function BuffOnClick()
|
||||
if this:GetParent().label == "player" then
|
||||
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID + this.id, "HELPFUL")
|
||||
if bid >= 0 then CancelPlayerBuff(bid) end
|
||||
local aura = C_UnitAuras.GetAuraDataByIndex("player", this.id, "HELPFUL")
|
||||
if aura and aura.spellId then C_Spell.CancelSpellByID(aura.spellId) end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -114,8 +114,8 @@ end
|
||||
|
||||
local function DebuffOnClick()
|
||||
if this:GetParent().label == "player" then
|
||||
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID + this.id, "HARMFUL")
|
||||
if bid >= 0 then CancelPlayerBuff(bid) end
|
||||
local aura = C_UnitAuras.GetAuraDataByIndex("player", this.id, "HARMFUL")
|
||||
if aura and aura.spellId then C_Spell.CancelSpellByID(aura.spellId) end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user