Quantcast

use colored happiness instead of text

rawoil [10-08-21 - 08:32]
use colored happiness instead of text
Filename
oUF_Simple/core/functions.lua
oUF_Simple/core/style.lua
oUF_SimpleConfig/global.lua
oUF_SimpleConfig/pet.lua
oUF_SimpleConfig/tags.lua
diff --git a/oUF_Simple/core/functions.lua b/oUF_Simple/core/functions.lua
index 15e0ba3..12fbd8b 100644
--- a/oUF_Simple/core/functions.lua
+++ b/oUF_Simple/core/functions.lua
@@ -113,6 +113,13 @@ local function UpdateThreat(self,event,unit)
 end
 L.F.UpdateThreat = UpdateThreat

+--UpdateHappiness
+local function UpdateHappiness(self,event,unit)
+  if(not unit or self.unit ~= unit) then return end
+	self.Health:ForceUpdate()
+end
+L.F.UpdateHappiness = UpdateHappiness
+
 --CreateText
 local function CreateText(self,font,size,outline,align,noshadow)
   local text = self:CreateFontString(nil, "ARTWORK") --"BORDER", "OVERLAY"
@@ -302,6 +309,9 @@ local function CreateHealthBar(self)
   s.colorHealth = self.cfg.healthbar.colorHealth
   s.colorThreat = self.cfg.healthbar.colorThreat
   s.colorThreatInvers = self.cfg.healthbar.colorThreatInvers
+  if select(2, UnitClass("player")) == "HUNTER" and self.settings.template == "pet" then
+    s.colorHappiness = true
+  end
   s.bg.multiplier = L.C.colors.bgMultiplier
   --hooks
   s.PostUpdateColor = PostUpdateHealth
@@ -311,6 +321,9 @@ local function CreateHealthBar(self)
     self:RegisterEvent("UNIT_THREAT_SITUATION_UPDATE", L.F.UpdateThreat, false)
     self:RegisterEvent("UNIT_THREAT_LIST_UPDATE", L.F.UpdateThreat, false)
   end
+  if s.colorHappiness then
+    self:RegisterEvent("UNIT_HAPPINESS", L.F.UpdateHappiness, false)
+  end
   return s
 end
 L.F.CreateHealthBar = CreateHealthBar
diff --git a/oUF_Simple/core/style.lua b/oUF_Simple/core/style.lua
index 1b523eb..77c71ba 100644
--- a/oUF_Simple/core/style.lua
+++ b/oUF_Simple/core/style.lua
@@ -19,6 +19,11 @@ local function CreateStyle(self)
   if L.C.colors.power and L.C.colors.power.mana then
     self.colors.power["MANA"] = L.C.colors.power.mana
   end
+  --fix pet happiness
+  if L.C.colors.happiness then
+    self.colors.happiness = L.C.colors.happiness
+  end
+
   L.F.SetupFrame(self)
   L.F.SetupHeader(self)
   L.F.CreateDragFrame(self)
diff --git a/oUF_SimpleConfig/global.lua b/oUF_SimpleConfig/global.lua
index bcb8a6b..4e9a80a 100644
--- a/oUF_SimpleConfig/global.lua
+++ b/oUF_SimpleConfig/global.lua
@@ -73,6 +73,12 @@ L.C.colors.healthbar = {
 L.C.colors.power = {
   mana = {0.1, 0.2, 1}
 }
+--fix pet happiness color
+L.C.colors.happiness = {
+  [1] = {.69,.31,.31},  -- need.... | unhappy
+	[2] = {.65,.63,.35},  -- new..... | content
+	[3] = {.33,.59,.33},  -- colors.. | happy
+}
 --smooth
 L.C.smooth = true
 --fonts
diff --git a/oUF_SimpleConfig/pet.lua b/oUF_SimpleConfig/pet.lua
index cdf3171..f75e021 100644
--- a/oUF_SimpleConfig/pet.lua
+++ b/oUF_SimpleConfig/pet.lua
@@ -44,7 +44,7 @@ L.C.pet = {
       },
       size = 16,
       align = "CENTER",
-      tag = "[oUF_SimpleConfig:happiness][name]",
+      tag = "[name]",
     },
     health = {
       enabled = true,
diff --git a/oUF_SimpleConfig/tags.lua b/oUF_SimpleConfig/tags.lua
index 6c21909..04e16f5 100644
--- a/oUF_SimpleConfig/tags.lua
+++ b/oUF_SimpleConfig/tags.lua
@@ -57,6 +57,5 @@ end
 L.C.tagEvents["oUF_SimpleConfig:status"] = "PLAYER_REGEN_DISABLED PLAYER_REGEN_ENABLED PLAYER_UPDATE_RESTING"
 --tag event: oUF_Simple:status
 L.C.tagEvents["oUF_SimpleConfig:classification"] = "UNIT_CLASSIFICATION_CHANGED"
-
 --tag event: oUF_Simple:happiness
 L.C.tagEvents["oUF_SimpleConfig:happiness"] = "UNIT_HAPPINESS"
\ No newline at end of file