From 3f405f99f9e29a8f98c5a018c014ff37b96aa37a Mon Sep 17 00:00:00 2001 From: Darth Predator Date: Thu, 9 Feb 2017 23:41:52 +0300 Subject: [PATCH] Added options for pvp icon text. Also removed the text for target since it will show player's time anyway --- ElvUI_SLE/defaults/profile.lua | 5 +++++ ElvUI_SLE/modules/unitframes/pvpIcon.lua | 16 ++++------------ ElvUI_SLE/options/unitframes_c.lua | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 12 deletions(-) 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 = { -- 1.7.9.5