ModifiedPowerAurasTBC
ModifiedPowerAurasTBC copied to clipboard
Test mode: Timers
Any chance for adding timers to test mode(s)?
I have changed those for now as workaround:
GUI.lua
function MPOWA:TestAll()
if ConfigButton1 then
if self.testAll then
self.testAll = false
for i=1, self.NumBuffs do
if not self.active[i] then
MPOWA:ApplyConfig(i)
_G("TextureFrame"..i):Hide()
_G("TextureFrame"..i.."_Timer"):Hide()
end
self.SAVE[i]["test"] = false
end
else
self.testAll = true
for i=1, self.NumBuffs do
MPOWA:ApplyConfig(i)
_G("TextureFrame"..i):Show()
if self.SAVE[i].timer then
_G("TextureFrame"..i.."_Timer"):SetText(self:FormatDuration(10, {minutes = false, hundredth = false}))
_G("TextureFrame"..i.."_Timer"):Show()
end
end
end
end
end
function MPOWA:Test()
if ConfigButton1 then
if self.SAVE[self.selected].test then
self.SAVE[self.selected].test = false
if not self.active[i] then
_G("TextureFrame"..self.selected):Hide()
_G("TextureFrame"..self.selected.."_Timer"):Hide()
end
else
self.SAVE[self.selected].test = true
_G("TextureFrame"..self.selected):Show()
if self.SAVE[self.selected].timer then
_G("TextureFrame"..self.selected.."_Timer"):SetText(self:FormatDuration(10, {minutes = false, hundredth = false}))
_G("TextureFrame"..self.selected.."_Timer"):Show()
end
end
MPOWA:ApplyConfig(self.selected)
end
end
Auras.lua
function MPOWA:OnUpdate(elapsed)
LastUpdate = LastUpdate + elapsed
if LastUpdate >= UpdateTime then
local p1, p2
for cat, val in pairs(self.NeedUpdate) do
if val then
local path = self.SAVE[cat]
if path["enemytarget"] and not UN("target") and not UnitIsFriend("player", "target") then return end
p1, p2 = self:TernaryReturn(cat, "inparty", self:InParty()), self:TernaryReturn(cat, "inraid", UnitInRaid("player"))
if not self.active[cat] and self:TernaryReturn(cat, "alive", self:Reverse(UnitIsDeadOrGhost("player")))
and self:TernaryReturn(cat, "mounted", self.mounted) and self:TernaryReturn(cat, "incombat", UnitAffectingCombat("player"))
and (((p1 or p2) and ((path["inparty"]==0 or path["inparty"]==true) and (path["inraid"]==0 or path["inraid"]==true))) or (p1 and p2))
and self:TernaryReturn(cat, "inbattleground", self.bg) and self:TernaryReturn(cat, "inraidinstance", self.instance) then
self.frames[cat][4]:Hide()
if path["cooldown"] then
local duration = self:GetCooldown(path["buffname"]) or 0
if path["cdclockanimout"] and duration<=path["animduration"]+0.4 and duration>=path["animduration"] and (not cdset[cat] or cdset[cat]+0.5<GT()) then
cdset[cat] = GT()
self.frames[cat][5]:SetCooldown(GT(), path["animduration"])
end
if path["timer"] then
if duration > 0 then
self.frames[cat][3]:SetText(self:FormatDuration(duration, path))
if path["inverse"] then
self:FHide(cat)
self.frames[cat][3]:Hide()
else
if path["secsleft"] then
if duration<=path["secsleftdur"] then
self:FShow(cat)
self.frames[cat][3]:Show()
else
self:FHide(cat)
self.frames[cat][3]:Hide()
end
else
self:FShow(cat)
self.frames[cat][3]:Show()
end
end
else
if path["inverse"] then
self:FShow(cat)
else
self:FHide(cat)
end
if not path["test"] then
self.frames[cat][3]:Hide()
end
end
else
if path["inverse"] then
if duration > 0 then
self:FHide(cat)
else
self:FShow(cat)
end
else
if path["secsleft"] then
if duration<=path["secsleftdur"] then
self:FShow(cat)
else
self:FHide(cat)
end
else
if duration > 0 then
self:FShow(cat)
else
self:FHide(cat)
end
end
end
end
else
self:FShow(cat)
end
else
if path["inverse"] or path["cooldown"] then
self:FHide(cat)
end
end
end
end
for cat, val in pairs(self.active) do
if val then
local path = self.SAVE[cat]
local text, count, timeLeft = "", 0, 0, 0
if val[3] then
_, _, text, count, _, _, timeLeft = UnitDebuff(val[1], val[2]);
else
_, _, text, count, _, timeLeft = UnitBuff(val[1], val[2]);
end
self:SetTexture(cat, text)
if self:IsStacks(count or 0, cat, "stacks") then
if (count or 0)>1 and not path["hidestacks"] then
self.frames[cat][4]:SetText(count)
self.frames[cat][4]:Show()
else
self.frames[cat][4]:Hide()
end
-- Duration
timeLeft = timeLeft or 0
if path["cdclockanimout"] and timeLeft<=path["animduration"]+0.4 and timeLeft>=path["animduration"] and (not cdset[cat] or cdset[cat]+0.5<GT()) then
cdset[cat] = GT()
self.frames[cat][5]:SetCooldown(GT(), path["animduration"])
end
if path["timer"] then
if timeLeft > 0 then
self.frames[cat][3]:SetText(self:FormatDuration(timeLeft, path))
else
self.frames[cat][3]:Hide()
end
end
self:Flash(elapsed, cat, timeLeft)
if (path["inverse"] and path["buffname"] ~= "unitpower") then
self:FHide(cat)
else
if path["secsleft"] then
if timeLeft<=path["secsleftdur"] then
self:FShow(cat)
else
self:FHide(cat)
end
else
self:FShow(cat)
end
end
else
self:FHide(cat)
end
else
if not self.NeedUpdate[cat] then
self:FHide(cat)
end
end
end
LastUpdate = 0
end
end