From aa5411b8b0c364c415a7b015c35c6258192ca58a Mon Sep 17 00:00:00 2001 From: Road-block Date: Sun, 2 Jun 2019 18:42:38 +0300 Subject: [PATCH] unitframes: add pet happeniness indicator as an icon --- api/unitframes.lua | 30 ++++++++++++++++++++++++++++++ img/happy.tga | Bin 0 -> 1042 bytes img/neutral.tga | Bin 0 -> 1042 bytes img/sad.tga | Bin 0 -> 1042 bytes 4 files changed, 30 insertions(+) create mode 100644 img/happy.tga create mode 100644 img/neutral.tga create mode 100644 img/sad.tga diff --git a/api/unitframes.lua b/api/unitframes.lua index eda850d0..22352b2c 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -453,6 +453,14 @@ function pfUI.uf:UpdateConfig() f.restIcon.texture:SetAllPoints(f.restIcon) f.restIcon:Hide() + f.happinessIcon:SetWidth(12) + f.happinessIcon:SetHeight(12) + f.happinessIcon:SetPoint("CENTER", f, "TOPLEFT", default_border, -default_border) + f.happinessIcon.texture:SetTexture("Interface\\AddOns\\pfUI\\img\\neutral") + f.happinessIcon.texture:SetAllPoints(f.happinessIcon) + f.happinessIcon.texture:SetVertexColor(1, 1, 0, 1) + f.happinessIcon:Hide() + if f.config.buffs == "off" then for i=1, 32 do if f.buffs and f.buffs[i] then @@ -857,6 +865,9 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick) f.restIcon = CreateFrame("Frame", nil, f.hp.bar) f.restIcon.texture = f.restIcon:CreateTexture(nil, "BACKGROUND") + f.happinessIcon = CreateFrame("Frame", nil, f.hp.bar) + f.happinessIcon.texture = f.happinessIcon:CreateTexture(nil, "BACKGROUND") + f.portrait = CreateFrame("Frame", "pfPortrait" .. f.label .. f.id, f) f.portrait.tex = f.portrait:CreateTexture("pfPortraitTexture" .. f.label .. f.id, "OVERLAY") f.portrait.model = CreateFrame("PlayerModel", "pfPortraitModel" .. f.label .. f.id, f.portrait) @@ -1031,6 +1042,25 @@ function pfUI.uf:RefreshIndicators(unit) end 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 + unit.happinessIcon:Hide() + end + end + if unit.raidIcon then -- Raid Icon local raidIcon = UnitName(unitstr) and GetRaidTargetIndex(unitstr) if unit.config.raidicon == "1" and raidIcon then diff --git a/img/happy.tga b/img/happy.tga new file mode 100644 index 0000000000000000000000000000000000000000..64c1ba6ccc046588eec6f34fc2e80c28e42d9df5 GIT binary patch literal 1042 zcma)*F-t;G6vv-tBDlOg!W68br7edBTiQYb5r;QO;G>|g(9+uX2pWW-F(l`)t+6(;vJ*|n|f>-p+Aoc_Wf*I%= zDPm<9L163G(3eX%v^_)ShoE<34J@x{=sR`w4;GZc5=jQ8e)gS6H-Pt2_(YlW&Jfruf#lQ6j#9rWtxb9p1 zF_2acwuP_to33V=C8rH~zq-qzUj1_ipU}jg>vipA`>4k{==grL4!&<|=p0>WK#_O} ytN!YN=G3Qow|CN#n+1J~?nC`J9nzp43kb~gezM+aa$FzkZL8Fkv2*`~@_zvA{6yja literal 0 HcmV?d00001 diff --git a/img/neutral.tga b/img/neutral.tga new file mode 100644 index 0000000000000000000000000000000000000000..8f504b6c8edd15473dda0d05b74d23b4c1249ac3 GIT binary patch literal 1042 zcma)*JxhXN6oy}|BwTc9iar!0Xlkp`=D-HQMM0@(=w}5@Zf;SFG=)%(4Yl_J3Znez zy5xQBp^SXt=A8SS`#jI_JjWkXbrn7@K>>^P&3O%vw*e= z`rr)=W4vN}prYoF+AR5YtiQt^gFUcM%^CI{c-|#^DLez7A>IM+_$~1LGh-pKMe?U= zfM-nmfH%M=XeuYSj(-t?Sk4?V&#;f9SnI4FK^M*BUi=;K@&hZe-ah;-J@hGT2@F8p z{5&6Z&cm7dE@j|XoTpX|b;hVL(KiT0`5kARv+F)&U@6f z;nV%`9C(hnXV}LLsDT3UBDM~?z#Z!l%O-b+mbiU*$1@nfC!aoW#~K7OVa+TbjWhLK OeA_a%g#GoOu=Wc88U82$ literal 0 HcmV?d00001 diff --git a/img/sad.tga b/img/sad.tga new file mode 100644 index 0000000000000000000000000000000000000000..4bbea4ad5fef35576915082fc39e926baa528ab6 GIT binary patch literal 1042 zcma)*PfG$p7>8FYF@xHBNGV3wI@QsR5*Z0(;Kg13QPm2e0TI`1(wfh;Nqov2s9r zBz<7F;2qjZN7i5y<_+qjW@6eyeeBEDS?G_@H~Iql6THE*LHYynJg5(S%K$xttiS{U z?Wcv`$3B2_IDGsnhpNsnOf+s2EwYb?EnS|Mv!+iE^EW15)}T%rGG#&qABk0JT-JEONjcbwdzJ?p!qrbC|I zuVG{OG(VT1*$C45&{@QEj&i!#$^2*^>?Qo#Lw#IB6H55Y$N>7F8SCLI*t1=UUw!Bd i&CdioUeZA`*20l