nameplates: option to replace totem plates by icon

This commit is contained in:
shagu
2020-10-17 12:33:54 +02:00
parent 9e0e1c5076
commit a6eb1a4bcc
3 changed files with 39 additions and 1 deletions
+1
View File
@@ -649,6 +649,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("nameplates", nil, "friendlyplayer", "0")
pfUI:UpdateConfig("nameplates", nil, "critters", "1")
pfUI:UpdateConfig("nameplates", nil, "totems", "1")
pfUI:UpdateConfig("nameplates", nil, "totemicons", "0")
pfUI:UpdateConfig("nameplates", nil, "showhp", "0")
pfUI:UpdateConfig("nameplates", nil, "alwaysperc", "0")
+1
View File
@@ -2120,6 +2120,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
CreateConfig(U["nameplates"], T["Right Click Auto Attack Threshold"], C.nameplates, "clickthreshold", nil, nil, nil, nil, nil, "vanilla")
CreateConfig(U["nameplates"], T["Use Unit Fonts"], C.nameplates, "use_unitfonts", "checkbox")
CreateConfig(U["nameplates"], T["Font Style"], C.nameplates.name, "fontstyle", "dropdown", pfUI.gui.dropdowns.fontstyle)
CreateConfig(U["nameplates"], T["Replace Totems With Icons"], C.nameplates, "totemicons", "checkbox")
CreateConfig(nil, T["Castbar"], nil, nil, "header")
CreateConfig(U["nameplates"], T["Enable Castbars"], C.nameplates, "showcastbar", "checkbox")
+37 -1
View File
@@ -54,6 +54,14 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
end
end
local function TotemPlate(name)
if C.nameplates.totemicons == "1" then
for totem, icon in pairs(L["totems"]) do
if string.find(name, totem) then return icon end
end
end
end
local function HidePlate(unittype, name, fullhp, target)
-- keep some plates always visible according to config
if C.nameplates.fullhealth == "1" and not fullhp then return nil end
@@ -251,6 +259,15 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
nameplate.raidicon:SetDrawLayer("OVERLAY")
nameplate.raidicon:SetTexture(pfUI.media["img:raidicons"])
nameplate.totem = CreateFrame("Frame", nil, nameplate)
nameplate.totem:SetPoint("CENTER", nameplate, "CENTER", 0, 0)
nameplate.totem:SetHeight(32)
nameplate.totem:SetWidth(32)
nameplate.totem.icon = nameplate.totem:CreateTexture(nil, "OVERLAY")
nameplate.totem.icon:SetTexCoord(.078, .92, .079, .937)
nameplate.totem.icon:SetAllPoints()
CreateBackdrop(nameplate.totem)
do -- debuffs
local debuffs = {}
for i=1, 16, 1 do
@@ -487,14 +504,33 @@ pfUI:RegisterModule("nameplates", "vanilla:tbc", function ()
end
-- hide frames according to the configuration
if HidePlate(unittype, name, (hpmax-hp == hpmin), target) then
local TotemIcon = TotemPlate(name)
if TotemIcon then
-- create totem icon
plate.totem.icon:SetTexture("Interface\\Icons\\" .. TotemIcon)
plate.glow:Hide()
plate.level:Hide()
plate.name:Hide()
plate.health:Hide()
plate.totem:Show()
elseif HidePlate(unittype, name, (hpmax-hp == hpmin), target) then
plate.level:SetPoint("RIGHT", plate.name, "LEFT", -3, 0)
plate.name:SetParent(plate)
plate.level:Show()
plate.name:Show()
plate.health:Hide()
plate.totem:Hide()
else
plate.level:SetPoint("RIGHT", plate.health, "LEFT", -3, 0)
plate.name:SetParent(plate.health)
plate.level:Show()
plate.name:Show()
plate.health:Show()
plate.totem:Hide()
end
plate.name:SetText(name)