Skip to content

Commit

Permalink
Cleanup PvP status functions. May be deleted in the future.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wetxius committed May 17, 2020
1 parent 9c77757 commit be1f829
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 31 deletions.
38 changes: 11 additions & 27 deletions ShestakUI/Core/Functions.lua
Expand Up @@ -1102,34 +1102,18 @@ T.UpdateClassMana = function(self)
end
end

T.UpdatePvPStatus = function(self, elapsed)
if self.elapsed and self.elapsed > 0.2 then
local unit = self.unit
local time = GetPVPTimer()

local min = format("%01.f", floor((time / 1000) / 60))
local sec = format("%02.f", floor((time / 1000) - min * 60))
if self.Status then
local factionGroup = UnitFactionGroup(unit)
if UnitIsPVPFreeForAll(unit) then
if time ~= 301000 and time ~= -1 then
self.Status:SetText(PVP.." ".."["..min..":"..sec.."]")
else
self.Status:SetText(PVP)
end
elseif factionGroup and UnitIsPVP(unit) then
if time ~= 301000 and time ~= -1 then
self.Status:SetText(PVP.." ".."["..min..":"..sec.."]")
else
self.Status:SetText(PVP)
end
else
self.Status:SetText("")
end
T.UpdatePvPStatus = function(self)
local unit = self.unit

if self.Status then
local factionGroup = UnitFactionGroup(unit)
if UnitIsPVPFreeForAll(unit) then
self.Status:SetText(PVP)
elseif factionGroup and UnitIsPVP(unit) then
self.Status:SetText(PVP)
else
self.Status:SetText("")
end
self.elapsed = 0
else
self.elapsed = (self.elapsed or 0) + elapsed
end
end

Expand Down
5 changes: 1 addition & 4 deletions ShestakUI/Modules/UnitFrames/Layout.lua
Expand Up @@ -827,10 +827,7 @@ local function Shared(self, unit)
self.Status:Hide()
self.Status.Override = T.dummy

self.Status.Update = CreateFrame("Frame", nil, self)
self.Status.Update:SetScript("OnUpdate", function(self, elapsed) T.UpdatePvPStatus(self:GetParent(), elapsed) end)

self:SetScript("OnEnter", function(self) FlashInfo.ManaLevel:Hide() self.Status:Show() UnitFrame_OnEnter(self) end)
self:SetScript("OnEnter", function(self) FlashInfo.ManaLevel:Hide() T.UpdatePvPStatus(self) self.Status:Show() UnitFrame_OnEnter(self) end)
self:SetScript("OnLeave", function(self) FlashInfo.ManaLevel:Show() self.Status:Hide() UnitFrame_OnLeave(self) end)
end
end
Expand Down

0 comments on commit be1f829

Please sign in to comment.