unitframes: make pet happiness icon configurable

This commit is contained in:
Road-block
2019-06-02 19:37:32 +03:00
parent aa5411b8b0
commit 4a3cd312c4
3 changed files with 22 additions and 14 deletions
+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