- missed an event registration for UNIT_HAPPINESS in PetHealth; changed to UNIT_POWER for cataclysm

This commit is contained in:
Parnic
2010-09-04 23:09:10 +00:00
parent 97d4a6898e
commit 0df55bb8bd

View File

@ -62,7 +62,11 @@ function PetHealth.prototype:Enable(core)
self:RegisterEvent("UNIT_HEALTH", "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)
RegisterUnitWatch(self.frame)
@ -75,11 +79,15 @@ function PetHealth.prototype:Disable(core)
UnregisterUnitWatch(self.frame)
end
function PetHealth.prototype:PetHappiness(unit)
function PetHealth.prototype:PetHappiness(unit, powertype)
if (unit and (unit ~= self.unit)) then
return
end
if IceHUD.WowVer >= 40000 and (powertype == nil or powertype ~= "HAPPINESS") then
return
end
self.happiness = GetPetHappiness()
self.happiness = self.happiness or 3 -- '3' means happy
self:Update(unit)
@ -88,7 +96,7 @@ end
function PetHealth.prototype:CheckPet()
if (UnitExists(self.unit)) then
self:PetHappiness(self.unit)
self:PetHappiness(self.unit, "HAPPINESS")
self:Update(self.unit)
end
end