diff --git a/ElvUI_SLE/modules/unitframes/load_unitframes.xml b/ElvUI_SLE/modules/unitframes/load_unitframes.xml
index d163687..d1ebe09 100644
--- a/ElvUI_SLE/modules/unitframes/load_unitframes.xml
+++ b/ElvUI_SLE/modules/unitframes/load_unitframes.xml
@@ -4,4 +4,5 @@
<Script file='offline.lua'/>
<Script file='statusbars.lua'/>
<Script file='roleIcons.lua'/>
+ <Script file='pvpIcon.lua'/>
</Ui>
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/unitframes/pvpIcon.lua b/ElvUI_SLE/modules/unitframes/pvpIcon.lua
new file mode 100644
index 0000000..a2cb671
--- /dev/null
+++ b/ElvUI_SLE/modules/unitframes/pvpIcon.lua
@@ -0,0 +1,43 @@
+local SLE, T, E, L, V, P, G = unpack(select(2, ...))
+local SUF = SLE:GetModule("UnitFrames")
+local UF = E:GetModule('UnitFrames');
+local _G = _G
+
+local Frames = {
+ "ElvUF_Player",
+ "ElvUF_Target",
+}
+
+function SUF:Create_PvpIconText(frame)
+ local PvP = frame.PvP
+ PvP.text = CreateFrame("Frame", nil, frame)
+ PvP.text:Point("TOP", PvP, "BOTTOM", 0, -4)
+ PvP.text:Size(10,10)
+ PvP.text:SetFrameLevel(PvP:GetParent():GetFrameLevel() + 3)
+
+ PvP.text.value = PvP.text:CreateFontString(nil, 'OVERLAY')
+ UF:Configure_FontString(PvP.text.value)
+ PvP.text.value:Point("CENTER")
+
+ frame:Tag(PvP.text.value, "[sl:pvptimer]")
+end
+
+function SUF:Configure_PVPIcon(frame)
+ local PvP = frame.PvP
+ local iconEnabled = frame:IsElementEnabled('PvP')
+
+ if iconEnabled then
+ PvP.text:Show()
+ else
+ PvP.text:Hide()
+ end
+end
+
+function SUF:UpgradePvPIcon()
+ for i = 1, #Frames do
+ local frame = _G[Frames[i]]
+ SUF:Create_PvpIconText(frame)
+ end
+
+ hooksecurefunc(UF, "Configure_PVPIcon", SUF.Configure_PVPIcon)
+end
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/unitframes/unitframes.lua b/ElvUI_SLE/modules/unitframes/unitframes.lua
index fa3ee3f..465c24e 100644
--- a/ElvUI_SLE/modules/unitframes/unitframes.lua
+++ b/ElvUI_SLE/modules/unitframes/unitframes.lua
@@ -65,6 +65,22 @@ function SUF:NewTags()
return absorb
end
end
+
+ _G["ElvUF"].Tags.Methods['sl:pvptimer'] = function(unit)
+ if (UnitIsPVPFreeForAll(unit) or UnitIsPVP(unit)) then
+ local timer = GetPVPTimer()
+
+ if timer ~= 301000 and timer ~= -1 then
+ local mins = floor((timer / 1000) / 60)
+ local secs = floor((timer / 1000) - (mins * 60))
+ return ("%01.f:%02.f"):format(mins, secs)
+ else
+ return ""
+ end
+ else
+ return ""
+ end
+ end
end
function SUF:ConfiguePortrait(frame, dontHide)
@@ -155,7 +171,7 @@ function SUF:Initialize()
local _, class, classID = T.GetClassInfo(i)
SUF.specNameToRole[class] = {}
for j = 1, T.GetNumSpecializationsForClassID(classID) do
- local _, spec, _, _, _, role = T.GetSpecializationInfoForClassID(classID, j)
+ local _, spec, _, _, role = T.GetSpecializationInfoForClassID(classID, j)
SUF.specNameToRole[class][spec] = role
end
end
@@ -178,6 +194,9 @@ function SUF:Initialize()
hooksecurefunc(UF, "Configure_HealthBar", SUF.HealthPredictUpdate)
end
+ --Hook pvp icons
+ SUF:UpgradePvPIcon()
+
SUF:InitStatus()
function SUF:ForUpdateAll()