unitframes: add pvp flag icon to all frames

This commit is contained in:
shagu
2018-07-07 22:24:59 +02:00
parent 0c1f876c56
commit acd991cf8b
4 changed files with 45 additions and 37 deletions
+21 -11
View File
@@ -135,10 +135,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", nil, "clickcast_ctrl", "")
pfUI:UpdateConfig("unitframes", "player", "showPVPMinimap", "0")
pfUI:UpdateConfig("unitframes", "player", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "player", "energy", "1")
pfUI:UpdateConfig("unitframes", "player", "visible", "1")
pfUI:UpdateConfig("unitframes", "player", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "player", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "player", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "player", "width", "200")
@@ -178,7 +178,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "player", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "player", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "target", "visible", "1")
pfUI:UpdateConfig("unitframes", "target", "visible", "1")
pfUI:UpdateConfig("unitframes", "target", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "target", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "target", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "target", "width", "200")
@@ -219,9 +220,10 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "target", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "target", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "focus", "visible", "1")
pfUI:UpdateConfig("unitframes", "focus", "visible", "1")
pfUI:UpdateConfig("unitframes", "focus", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "focus", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "focus", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "focus", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "focus", "width", "120")
pfUI:UpdateConfig("unitframes", "focus", "height", "34")
pfUI:UpdateConfig("unitframes", "focus", "pheight", "4")
@@ -259,7 +261,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "focus", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "focus", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "group", "visible", "1")
pfUI:UpdateConfig("unitframes", "group", "visible", "1")
pfUI:UpdateConfig("unitframes", "group", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "group", "portrait", "off")
pfUI:UpdateConfig("unitframes", "group", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "group", "width", "164")
@@ -300,7 +303,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "group", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "group", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "grouptarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouptarget", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "grouptarget", "portrait", "off")
pfUI:UpdateConfig("unitframes", "grouptarget", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "grouptarget", "width", "120")
@@ -340,7 +344,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "grouptarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "grouppet", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "visible", "1")
pfUI:UpdateConfig("unitframes", "grouppet", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "grouppet", "portrait", "off")
pfUI:UpdateConfig("unitframes", "grouppet", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "grouppet", "width", "100")
@@ -380,7 +385,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "grouppet", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "raid", "visible", "1")
pfUI:UpdateConfig("unitframes", "raid", "visible", "1")
pfUI:UpdateConfig("unitframes", "raid", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "raid", "portrait", "off")
pfUI:UpdateConfig("unitframes", "raid", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "raid", "width", "50")
@@ -420,7 +426,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "raid", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "raid", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "ttarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "visible", "1")
pfUI:UpdateConfig("unitframes", "ttarget", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "ttarget", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "ttarget", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "ttarget", "width", "100")
@@ -460,7 +467,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "ttarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "pet", "visible", "1")
pfUI:UpdateConfig("unitframes", "pet", "visible", "1")
pfUI:UpdateConfig("unitframes", "pet", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "pet", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "pet", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "pet", "width", "100")
@@ -501,6 +509,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "pet", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "ptarget", "visible", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "ptarget", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "ptarget", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "ptarget", "width", "100")
@@ -540,7 +549,8 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "ptarget", "hitindicatorsize", "15")
pfUI:UpdateConfig("unitframes", "ptarget", "hitindicatorfont", "Interface\\AddOns\\pfUI\\fonts\\Continuum.ttf")
pfUI:UpdateConfig("unitframes", "fallback", "visible", "1")
pfUI:UpdateConfig("unitframes", "fallback", "visible", "1")
pfUI:UpdateConfig("unitframes", "fallback", "showPVP", "0")
pfUI:UpdateConfig("unitframes", "fallback", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "fallback", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
pfUI:UpdateConfig("unitframes", "fallback", "width", "200")
+23
View File
@@ -332,6 +332,14 @@ function pfUI.uf:UpdateConfig()
f.lootIcon.texture:SetAllPoints(f.lootIcon)
f.lootIcon:Hide()
f.pvpIcon:SetWidth(16)
f.pvpIcon:SetHeight(16)
f.pvpIcon:SetPoint("CENTER", 0, 0)
f.pvpIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\pvp")
f.pvpIcon.texture:SetAllPoints(f.pvpIcon)
f.pvpIcon.texture:SetVertexColor(1,1,1,.5)
f.pvpIcon:Hide()
f.raidIcon:SetWidth(24)
f.raidIcon:SetHeight(24)
f.raidIcon:SetPoint("TOP", f, "TOP", 0, 6)
@@ -545,6 +553,7 @@ function pfUI.uf:EnableScripts()
f:RegisterEvent("UNIT_FOCUS")
f:RegisterEvent("UNIT_PORTRAIT_UPDATE")
f:RegisterEvent("UNIT_MODEL_CHANGED")
f:RegisterEvent("UNIT_FACTION")
f:RegisterEvent("UNIT_AURA") -- frame=buff, frame=debuff
f:RegisterEvent("PLAYER_AURAS_CHANGED") -- label=player && frame=buff
f:RegisterEvent("UNIT_INVENTORY_CHANGED") -- label=player && frame=buff
@@ -593,6 +602,8 @@ function pfUI.uf:EnableScripts()
pfUI.uf:RefreshUnit(this, "portrait")
elseif event == "UNIT_AURA" then
pfUI.uf:RefreshUnit(this, "aura")
elseif event == "UNIT_FACTION" then
pfUI.uf:RefreshUnit(this, "pvp")
elseif event == "UNIT_COMBAT" then
CombatFeedback_OnCombatEvent(arg2, arg3, arg4, arg5)
else
@@ -748,6 +759,9 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick)
f.lootIcon = CreateFrame("Frame",nil, f.hp.bar)
f.lootIcon.texture = f.lootIcon:CreateTexture(nil,"BACKGROUND")
f.pvpIcon = CreateFrame("Frame", nil, f.hp.bar)
f.pvpIcon.texture = f.pvpIcon:CreateTexture(nil,"BACKGROUND")
f.raidIcon = CreateFrame("Frame", nil, f.hp.bar)
f.raidIcon.texture = f.raidIcon:CreateTexture(nil,"ARTWORK")
@@ -1007,6 +1021,15 @@ function pfUI.uf:RefreshUnit(unit, component)
end
end
-- PvP Icon
if unit.pvpIcon and ( component == "all" or component == "pvp" ) then
if unit.config.showPVP == "1" and UnitIsPVP(unitstr) then
unit.pvpIcon:Show()
else
unit.pvpIcon:Hide()
end
end
-- Buffs
if unit.buffs and ( component == "all" or component == "aura" ) then
for i=1, unit.config.bufflimit do
+1 -1
View File
@@ -783,7 +783,6 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, this, T["Range Check Interval"], C.unitframes, "rangechecki", "dropdown", pfUI.gui.dropdowns.uf_rangecheckinterval)
CreateConfig(nil, this, T["Combopoint Size"], C.unitframes, "combosize")
CreateConfig(nil, this, T["Abbreviate Numbers (4200 -> 4.2k)"], C.unitframes, "abbrevnum", "checkbox")
CreateConfig(nil, this, T["Show PvP Icon"], C.unitframes.player, "showPVP", "checkbox")
CreateConfig(nil, this, T["Enable Energy Ticks"], C.unitframes.player, "energy", "checkbox")
this.setup = true
end
@@ -859,6 +858,7 @@ pfUI:RegisterModule("gui", function ()
-- build config entries
CreateConfig(update[c], this, T["Display Frame"] .. ": " .. t, C.unitframes[c], "visible", "checkbox")
CreateConfig(update[c], this, T["Show PvP-Flag Indicator"], C.unitframes[c], "showPVP", "checkbox")
CreateConfig(update[c], this, T["Enable Mouseover Tooltip"], C.unitframes[c], "showtooltip", "checkbox")
CreateConfig(update[c], this, T["Enable Clickcast"], C.unitframes[c], "clickcast", "checkbox")
CreateConfig(update[c], this, T["Enable Range Fading"], C.unitframes[c], "faderange", "checkbox")
-25
View File
@@ -14,28 +14,6 @@ pfUI:RegisterModule("player", function ()
pfUI.uf.player = pfUI.uf:CreateUnitFrame("Player", nil, C.unitframes.player)
pfUI.uf.player.pvpicon = CreateFrame("Frame", nil, pfUI.uf.player)
pfUI.uf.player.pvpicon:Hide()
pfUI.uf.player.pvpicon:RegisterEvent("UPDATE_FACTION")
pfUI.uf.player.pvpicon:RegisterEvent("UNIT_FACTION")
pfUI.uf.player.pvpicon:SetFrameStrata("HIGH")
pfUI.uf.player.pvpicon:SetWidth(16)
pfUI.uf.player.pvpicon:SetHeight(16)
pfUI.uf.player.pvpicon:SetAlpha(.25)
pfUI.uf.player.pvpicon:SetParent(pfUI.uf.player.hp.bar)
pfUI.uf.player.pvpicon:SetPoint("TOP", pfUI.uf.player.hp.bar, "TOP", 0, -5)
pfUI.uf.player.pvpicon.texture = pfUI.uf.player.pvpicon:CreateTexture(nil,"DIALOG")
pfUI.uf.player.pvpicon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\pvp")
pfUI.uf.player.pvpicon.texture:SetAllPoints(pfUI.uf.player.pvpicon)
pfUI.uf.player.pvpicon:SetScript("OnEvent", function()
if C.unitframes.player.showPVP == "1" and UnitIsPVP("player") then
pfUI.uf.player.pvpicon:Show()
else
pfUI.uf.player.pvpicon:Hide()
end
end)
pfUI.uf.player:UpdateFrameSize()
pfUI.uf.player:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOM", -75, 125)
UpdateMovable(pfUI.uf.player)
@@ -51,9 +29,6 @@ pfUI:RegisterModule("player", function ()
end
end)
pfUI.uf.player:RegisterEvent("UPDATE_FACTION") -- pvp icon
pfUI.uf.player:RegisterEvent("UNIT_FACTION") -- pvp icon
if C.unitframes.player.energy == "1" then
pfUI.uf.player.power.tick = CreateFrame("Frame", nil, pfUI.uf.player.power.bar)
pfUI.uf.player.power.tick:RegisterEvent("PLAYER_ENTERING_WORLD")