- changed the pet health/mana bars to monitor the player whenever the player enters a vehicle since the player bars already change to display vehicle info in that situation

This commit is contained in:
Parnic
2010-10-21 02:49:59 +00:00
parent 78b825c79d
commit a51fe8e06f
2 changed files with 44 additions and 24 deletions

View File

@ -60,6 +60,9 @@ function PetHealth.prototype:Enable(core)
self:RegisterEvent("UNIT_HAPPINESS", "PetHappiness")
end
self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle")
self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle")
self.frame:SetAttribute("unit", self.unit)
RegisterUnitWatch(self.frame)
@ -223,5 +226,22 @@ function PetHealth.prototype:EnableClickTargeting(bEnable)
end
end
function PetHealth.prototype:EnteringVehicle(event, unit, arg2)
if (self.unit == "pet" and IceHUD:ShouldSwapToVehicle(unit, arg2)) then
self.unit = "player"
self:RegisterFontStrings()
self:Update(self.unit)
end
end
function PetHealth.prototype:ExitingVehicle(event, unit)
if (unit == "player" and self.unit == "player") then
self.unit = "pet"
self:RegisterFontStrings()
self:Update(self.unit)
end
end
-- Load us up
IceHUD.PetHealth = PetHealth:new()