Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions TPerl/TPerl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4106,13 +4106,14 @@ local function AuraButtonOnShow(self)
cd.countdown:SetTextColor(1, 1, 0)
end

local duration, expirationTime, sourceUnit
local duration, expirationTime, sourceUnit, isFromPlayerOrPlayerPet
if not IsVanillaClassic and C_UnitAuras then
local auraData = TPerl_SafeGetAuraDataByIndex("player", self.xindex, self.xfilter)
if auraData then
duration = TPerl_SafeTableGet(auraData, "duration")
expirationTime = TPerl_SafeTableGet(auraData, "expirationTime")
sourceUnit = TPerl_SafeTableGet(auraData, "sourceUnit")
isFromPlayerOrPlayerPet = TPerl_SafeTableGet(auraData, "isFromPlayerOrPlayerPet")
end
else
local _
Expand All @@ -4121,7 +4122,16 @@ local function AuraButtonOnShow(self)

if duration and expirationTime then
local start = expirationTime - duration
TPerl_CooldownFrame_SetTimer(self.cooldown, start, duration, 1, sourceUnit == "player")
-- sourceUnit may be a secret (tainted) value in Midnight/Retail; compare safely.
local isPlayerSource
if isFromPlayerOrPlayerPet ~= nil and TPerl_CanAccess(isFromPlayerOrPlayerPet) then
isPlayerSource = isFromPlayerOrPlayerPet and true or false
elseif TPerl_CanAccess(sourceUnit) then
isPlayerSource = (sourceUnit == "player")
else
isPlayerSource = false
end
TPerl_CooldownFrame_SetTimer(self.cooldown, start, duration, 1, isPlayerSource)
end
end

Expand Down