Quantcast

Added options for pvp icon text.

Darth Predator [02-09-17 - 20:41]
Added options for pvp icon text.
Also removed the text for target since it will show player's time anyway
Filename
ElvUI_SLE/defaults/profile.lua
ElvUI_SLE/modules/unitframes/pvpIcon.lua
ElvUI_SLE/options/unitframes_c.lua
diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua
index e783e49..6ba6339 100644
--- a/ElvUI_SLE/defaults/profile.lua
+++ b/ElvUI_SLE/defaults/profile.lua
@@ -755,6 +755,11 @@ P["sle"] = {
 					["texture"] = "DEFAULT",
 					["customTexture"] = "",
 				},
+				["pvpIconText"] = {
+					["enable"] = false,
+					["xoffset"] = 0,
+					["yoffset"] = 0,
+				},
 				["higherPortrait"] = false,
 				["portraitAlpha"] = 0.35,
 			},
diff --git a/ElvUI_SLE/modules/unitframes/pvpIcon.lua b/ElvUI_SLE/modules/unitframes/pvpIcon.lua
index a2cb671..41ba11b 100644
--- a/ElvUI_SLE/modules/unitframes/pvpIcon.lua
+++ b/ElvUI_SLE/modules/unitframes/pvpIcon.lua
@@ -1,17 +1,10 @@
 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)

@@ -24,20 +17,19 @@ end

 function SUF:Configure_PVPIcon(frame)
 	local PvP = frame.PvP
+	if not PvP.text then return end
 	local iconEnabled = frame:IsElementEnabled('PvP')

-	if iconEnabled then
+	if iconEnabled and E.db.sle.unitframes.unit.player.pvpIconText.enable then
 		PvP.text:Show()
+		PvP.text:Point("TOP", PvP, "BOTTOM", E.db.sle.unitframes.unit.player.pvpIconText.xoffset, -4 + E.db.sle.unitframes.unit.player.pvpIconText.yoffset)
 	else
 		PvP.text:Hide()
 	end
 end

 function SUF:UpgradePvPIcon()
-	for i = 1, #Frames do
-		local frame = _G[Frames[i]]
-		SUF:Create_PvpIconText(frame)
-	end
+	SUF:Create_PvpIconText(ElvUF_Player)

 	hooksecurefunc(UF, "Configure_PVPIcon", SUF.Configure_PVPIcon)
 end
\ No newline at end of file
diff --git a/ElvUI_SLE/options/unitframes_c.lua b/ElvUI_SLE/options/unitframes_c.lua
index a90824e..90da56d 100644
--- a/ElvUI_SLE/options/unitframes_c.lua
+++ b/ElvUI_SLE/options/unitframes_c.lua
@@ -169,6 +169,20 @@ local function configTable()
 							},
 						},
 					},
+					pvpIconText = {
+						order = 5,
+						type = "group",
+						name = L["PvP & Prestige Icon"],
+						guiInline = true,
+						get = function(info) return E.db.sle.unitframes.unit.player.pvpIconText[ info[#info] ] end,
+						set = function(info, value) E.db.sle.unitframes.unit.player.pvpIconText[ info[#info] ] = value; UF:Configure_PVPIcon(_G["ElvUF_Player"]) end,
+						args = {
+							enable = { order = 1, type = "toggle", name = L["Enable"], },
+							xoffset = { order = 2, type = "range", name = L["X-Offset"], min = -300, max = 300, step = 1 },
+							yoffset = { order = 3, type = "range", name = L["Y-Offset"], min = -150, max = 150, step = 1 },
+						},
+
+					},
 				},
 			},
 			target = {