mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-21 20:00:48 +00:00
buffwatch via C_UnitAuras
Player branch in GetBuffData now reads from C_UnitAuras.GetAuraDataByIndex directly, dropping the GetPlayerBuff chain plus the tooltip-scan for the buff name. Lazy bid resolution for CancelPlayerBuff. All four tooltip calls (SetPlayerBuff/SetUnitBuff/SetUnitDebuff x2) collapse to the unified GameTooltip:SetUnitAura. UnitDebuff dispel-color lookup at line 312 reads aura.dispelName instead. libdebuff path preserved for non-player units that still need caster correlation.
This commit is contained in:
+14
-21
@@ -1,6 +1,5 @@
|
|||||||
pfUI:RegisterModule("buffwatch", "vanilla:tbc", function ()
|
pfUI:RegisterModule("buffwatch", "vanilla:tbc", function ()
|
||||||
local rawborder, border = GetBorderSize("panels")
|
local rawborder, border = GetBorderSize("panels")
|
||||||
local scanner = libtipscan:GetScanner("buffwatch")
|
|
||||||
|
|
||||||
local fcache = {}
|
local fcache = {}
|
||||||
local function BuffIsVisible(config, name)
|
local function BuffIsVisible(config, name)
|
||||||
@@ -76,23 +75,15 @@ pfUI:RegisterModule("buffwatch", "vanilla:tbc", function ()
|
|||||||
|
|
||||||
local function GetBuffData(unit, id, type, selfdebuff)
|
local function GetBuffData(unit, id, type, selfdebuff)
|
||||||
if unit == "player" then
|
if unit == "player" then
|
||||||
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID+id, type)
|
local aura = C_UnitAuras.GetAuraDataByIndex("player", id, type)
|
||||||
local stacks = GetPlayerBuffApplications(bid)
|
if not aura then return end
|
||||||
local remaining = GetPlayerBuffTimeLeft(bid)
|
local remaining = aura.expirationTime > 0 and (aura.expirationTime - GetTime()) or 0
|
||||||
local texture = GetPlayerBuffTexture(bid)
|
return remaining, aura.icon, aura.name, aura.applications
|
||||||
local name
|
|
||||||
|
|
||||||
if texture then
|
|
||||||
scanner:SetPlayerBuff(bid)
|
|
||||||
name = scanner:Line(1)
|
|
||||||
end
|
|
||||||
|
|
||||||
return remaining, texture, name, stacks
|
|
||||||
elseif libdebuff and selfdebuff then
|
elseif libdebuff and selfdebuff then
|
||||||
local name, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitOwnDebuff(unit, id)
|
local name, _, texture, stacks, _, _, timeleft = libdebuff:UnitOwnDebuff(unit, id)
|
||||||
return timeleft, texture, name, stacks
|
return timeleft, texture, name, stacks
|
||||||
elseif libdebuff then
|
elseif libdebuff then
|
||||||
local name, rank, texture, stacks, dtype, duration, timeleft = libdebuff:UnitDebuff(unit, id)
|
local name, _, texture, stacks, _, _, timeleft = libdebuff:UnitDebuff(unit, id)
|
||||||
return timeleft, texture, name, stacks
|
return timeleft, texture, name, stacks
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -115,7 +106,8 @@ pfUI:RegisterModule("buffwatch", "vanilla:tbc", function ()
|
|||||||
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc" .. skill .. "|r" .. T["is now blacklisted."])
|
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc" .. skill .. "|r" .. T["is now blacklisted."])
|
||||||
end
|
end
|
||||||
elseif this.parent.unit == "player" then
|
elseif this.parent.unit == "player" then
|
||||||
CancelPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+this.id,this.type))
|
local bid = GetPlayerBuff(PLAYER_BUFF_START_ID + this.id, this.type)
|
||||||
|
if bid >= 0 then CancelPlayerBuff(bid) end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -123,7 +115,7 @@ pfUI:RegisterModule("buffwatch", "vanilla:tbc", function ()
|
|||||||
GameTooltip:SetOwner(this, "NONE")
|
GameTooltip:SetOwner(this, "NONE")
|
||||||
|
|
||||||
if this.unit == "player" then
|
if this.unit == "player" then
|
||||||
GameTooltip:SetPlayerBuff(GetPlayerBuff(PLAYER_BUFF_START_ID+this.id,this.type))
|
GameTooltip:SetUnitAura("player", this.id, this.type)
|
||||||
elseif this.type == "HARMFUL" then
|
elseif this.type == "HARMFUL" then
|
||||||
-- For "only own debuffs" mode: find the REAL slot by matching spell name AND caster
|
-- For "only own debuffs" mode: find the REAL slot by matching spell name AND caster
|
||||||
local config = this.parent and this.parent.config
|
local config = this.parent and this.parent.config
|
||||||
@@ -134,16 +126,16 @@ pfUI:RegisterModule("buffwatch", "vanilla:tbc", function ()
|
|||||||
for gameSlot = 1, 16 do
|
for gameSlot = 1, 16 do
|
||||||
local gameName, _, _, _, _, _, _, gameCaster = libdebuff:UnitDebuff(this.unit, gameSlot)
|
local gameName, _, _, _, _, _, _, gameCaster = libdebuff:UnitDebuff(this.unit, gameSlot)
|
||||||
if gameName == ownDebuffName and gameCaster == "player" then
|
if gameName == ownDebuffName and gameCaster == "player" then
|
||||||
GameTooltip:SetUnitDebuff(this.unit, gameSlot)
|
GameTooltip:SetUnitAura(this.unit, gameSlot, "HARMFUL")
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
GameTooltip:SetUnitDebuff(this.unit, this.id)
|
GameTooltip:SetUnitAura(this.unit, this.id, "HARMFUL")
|
||||||
end
|
end
|
||||||
elseif this.type == "HELPFUL" then
|
elseif this.type == "HELPFUL" then
|
||||||
GameTooltip:SetUnitBuff(this.unit, this.id)
|
GameTooltip:SetUnitAura(this.unit, this.id, "HELPFUL")
|
||||||
end
|
end
|
||||||
|
|
||||||
if IsShiftKeyDown() then
|
if IsShiftKeyDown() then
|
||||||
@@ -309,7 +301,8 @@ pfUI:RegisterModule("buffwatch", "vanilla:tbc", function ()
|
|||||||
local r, g, b
|
local r, g, b
|
||||||
if frame.type == "HARMFUL" then
|
if frame.type == "HARMFUL" then
|
||||||
r, g, b = 1, .2, .2
|
r, g, b = 1, .2, .2
|
||||||
local _, _, dtype = UnitDebuff(frame.unit, data[2])
|
local a = C_UnitAuras.GetDebuffDataByIndex(frame.unit, data[2])
|
||||||
|
local dtype = a and a.dispelName
|
||||||
if dtype and DebuffTypeColor[dtype] then
|
if dtype and DebuffTypeColor[dtype] then
|
||||||
r,g,b = DebuffTypeColor[dtype].r,DebuffTypeColor[dtype].g,DebuffTypeColor[dtype].b
|
r,g,b = DebuffTypeColor[dtype].r,DebuffTypeColor[dtype].g,DebuffTypeColor[dtype].b
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user