unitframes: make pet happiness icon configurable

This commit is contained in:
Road-block
2019-06-03 01:17:32 +03:00
parent aa5411b8b0
commit 4a3cd312c4
3 changed files with 22 additions and 14 deletions
+1
View File
@@ -676,6 +676,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("unitframes", "pet", "raidicon", "1")
pfUI:UpdateConfig("unitframes", "pet", "leadericon", "1")
pfUI:UpdateConfig("unitframes", "pet", "looticon", "1")
pfUI:UpdateConfig("unitframes", "pet", "happinessicon", "0")
pfUI:UpdateConfig("unitframes", "pet", "raidiconsize", "24")
pfUI:UpdateConfig("unitframes", "pet", "portrait", "bar")
pfUI:UpdateConfig("unitframes", "pet", "bartexture", "Interface\\AddOns\\pfUI\\img\\bar")
+18 -14
View File
@@ -1043,21 +1043,25 @@ function pfUI.uf:RefreshIndicators(unit)
end
if unit.happinessIcon and unit:GetName() == "pfPet" then -- Happiness Icon
if UnitIsVisible("pet") then
local happiness = GetPetHappiness()
if happiness == 1 then
unit.happinessIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\sad")
unit.happinessIcon.texture:SetVertexColor(1, 0, 0, 1)
elseif happiness == 2 then
unit.happinessIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\neutral")
unit.happinessIcon.texture:SetVertexColor(1, 1, 0, 1)
else
unit.happinessIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\happy")
unit.happinessIcon.texture:SetVertexColor(0, 1, 0, 1)
end
unit.happinessIcon:Show()
else
if unit.config.happinessicon == "0" then
unit.happinessIcon:Hide()
else
if UnitIsVisible("pet") then
local happiness = GetPetHappiness()
if happiness == 1 then
unit.happinessIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\sad")
unit.happinessIcon.texture:SetVertexColor(1, 0, 0, 1)
elseif happiness == 2 then
unit.happinessIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\neutral")
unit.happinessIcon.texture:SetVertexColor(1, 1, 0, 1)
else
unit.happinessIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\happy")
unit.happinessIcon.texture:SetVertexColor(0, 1, 0, 1)
end
unit.happinessIcon:Show()
else
unit.happinessIcon:Hide()
end
end
end
+3
View File
@@ -1535,6 +1535,9 @@ pfUI:RegisterModule("gui", 20400, function ()
CreateConfig(U[c], T["Show PvP-Flag"], C.unitframes[c], "showPVP", "checkbox")
CreateConfig(U[c], T["Show Loot Icon"], C.unitframes[c], "looticon", "checkbox")
CreateConfig(U[c], T["Show Leader Icon"], C.unitframes[c], "leadericon", "checkbox")
if c == "pet" then
CreateConfig(U[c], T["Show Happiness Icon"], C.unitframes[c], "happinessicon", "checkbox")
end
CreateConfig(U[c], T["Show Raid Mark"], C.unitframes[c], "raidicon", "checkbox")
CreateConfig(U[c], T["Raid Mark Size"], C.unitframes[c], "raidiconsize")
CreateConfig(U[c], T["Show Class Buff Indicators"], C.unitframes[c], "buff_indicator", "checkbox")