mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 22:51:53 -05:00
- missed an event registration for UNIT_HAPPINESS in PetHealth; changed to UNIT_POWER for cataclysm
This commit is contained in:
@ -62,7 +62,11 @@ function PetHealth.prototype:Enable(core)
|
|||||||
self:RegisterEvent("UNIT_HEALTH", "Update")
|
self:RegisterEvent("UNIT_HEALTH", "Update")
|
||||||
self:RegisterEvent("UNIT_MAXHEALTH", "Update")
|
self:RegisterEvent("UNIT_MAXHEALTH", "Update")
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_HAPPINESS", "PetHappiness")
|
if IceHUD.WowVer >= 40000 then
|
||||||
|
self:RegisterEvent("UNIT_POWER", "PetHappiness")
|
||||||
|
else
|
||||||
|
self:RegisterEvent("UNIT_HAPPINESS", "PetHappiness")
|
||||||
|
end
|
||||||
|
|
||||||
self.frame:SetAttribute("unit", self.unit)
|
self.frame:SetAttribute("unit", self.unit)
|
||||||
RegisterUnitWatch(self.frame)
|
RegisterUnitWatch(self.frame)
|
||||||
@ -75,11 +79,15 @@ function PetHealth.prototype:Disable(core)
|
|||||||
UnregisterUnitWatch(self.frame)
|
UnregisterUnitWatch(self.frame)
|
||||||
end
|
end
|
||||||
|
|
||||||
function PetHealth.prototype:PetHappiness(unit)
|
function PetHealth.prototype:PetHappiness(unit, powertype)
|
||||||
if (unit and (unit ~= self.unit)) then
|
if (unit and (unit ~= self.unit)) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if IceHUD.WowVer >= 40000 and (powertype == nil or powertype ~= "HAPPINESS") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
self.happiness = GetPetHappiness()
|
self.happiness = GetPetHappiness()
|
||||||
self.happiness = self.happiness or 3 -- '3' means happy
|
self.happiness = self.happiness or 3 -- '3' means happy
|
||||||
self:Update(unit)
|
self:Update(unit)
|
||||||
@ -88,7 +96,7 @@ end
|
|||||||
|
|
||||||
function PetHealth.prototype:CheckPet()
|
function PetHealth.prototype:CheckPet()
|
||||||
if (UnitExists(self.unit)) then
|
if (UnitExists(self.unit)) then
|
||||||
self:PetHappiness(self.unit)
|
self:PetHappiness(self.unit, "HAPPINESS")
|
||||||
self:Update(self.unit)
|
self:Update(self.unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user