- fixes for cataclysm: added UNIT_POWER/UNIT_MAXPOWER event registrations in place of all the old power types, fixed mirror bar, targetinfo, and targetoftarget SetScripts to pass 'this' and 'arg#' around where necessary

- still broken for cata: GlobalCoolDown module, LibDogTag (needs to be fixed by one of its maintainers or I need to port to LuaTexts...fixing dogtag would be vastly easier), and Waterfall (not sure what to do about this one just yet)
This commit is contained in:
Parnic
2010-09-04 22:49:39 +00:00
parent 9ef8a4db51
commit 97d4a6898e
8 changed files with 84 additions and 53 deletions

View File

@ -34,8 +34,13 @@ function DruidMana.prototype:Enable(core)
DruidMana.super.prototype.Enable(self, core) DruidMana.super.prototype.Enable(self, core)
self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", "Update") self:RegisterEvent("UPDATE_SHAPESHIFT_FORM", "Update")
self:RegisterEvent("UNIT_MAXMANA", "Update") if IceHUD.WowVer >= 40000 then
self:RegisterEvent("UNIT_MANA", "Update") self:RegisterEvent("UNIT_POWER", "Update")
self:RegisterEvent("UNIT_MAXPOWER", "Update")
else
self:RegisterEvent("UNIT_MAXMANA", "Update")
self:RegisterEvent("UNIT_MANA", "Update")
end
end end

View File

@ -32,14 +32,19 @@ end
function FocusMana.prototype:Enable(core) function FocusMana.prototype:Enable(core)
FocusMana.super.prototype.Enable(self, core) FocusMana.super.prototype.Enable(self, core)
self:RegisterEvent("UNIT_MANA", "Update") if IceHUD.WowVer >= 40000 then
self:RegisterEvent("UNIT_MAXMANA", "Update") self:RegisterEvent("UNIT_POWER", "Update")
self:RegisterEvent("UNIT_RAGE", "Update") self:RegisterEvent("UNIT_MAXPOWER", "Update")
self:RegisterEvent("UNIT_MAXRAGE", "Update") else
self:RegisterEvent("UNIT_ENERGY", "Update") self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_MAXENERGY", "Update") self:RegisterEvent("UNIT_MAXMANA", "Update")
self:RegisterEvent("UNIT_FOCUS", "Update") self:RegisterEvent("UNIT_RAGE", "Update")
self:RegisterEvent("UNIT_MAXFOCUS", "Update") self:RegisterEvent("UNIT_MAXRAGE", "Update")
self:RegisterEvent("UNIT_ENERGY", "Update")
self:RegisterEvent("UNIT_MAXENERGY", "Update")
self:RegisterEvent("UNIT_FOCUS", "Update")
self:RegisterEvent("UNIT_MAXFOCUS", "Update")
end
self:RegisterEvent("UNIT_AURA", "Update") self:RegisterEvent("UNIT_AURA", "Update")
self:RegisterEvent("UNIT_FLAGS", "Update") self:RegisterEvent("UNIT_FLAGS", "Update")
self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateFocus") self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateFocus")

View File

@ -114,7 +114,7 @@ function MirrorBar.prototype:MirrorStart(timer, value, maxValue, scale, paused,
self:Update() self:Update()
self:Show(true) self:Show(true)
self.frame:SetScript("OnUpdate", function() self:OnUpdate(arg1) end) self.frame:SetScript("OnUpdate", function(this, arg1, ...) self:OnUpdate(arg1) end)
end end

View File

@ -57,14 +57,19 @@ function PetMana.prototype:Enable(core)
self:RegisterEvent("UNIT_PET", "CheckPet"); self:RegisterEvent("UNIT_PET", "CheckPet");
self:RegisterEvent("UNIT_ENTERED_VEHICLE", "CheckPet") self:RegisterEvent("UNIT_ENTERED_VEHICLE", "CheckPet")
self:RegisterEvent("UNIT_MANA", "Update") if IceHUD.WowVer >= 40000 then
self:RegisterEvent("UNIT_MAXMANA", "Update") self:RegisterEvent("UNIT_POWER", "Update")
self:RegisterEvent("UNIT_RAGE", "Update") self:RegisterEvent("UNIT_MAXPOWER", "Update")
self:RegisterEvent("UNIT_MAXRAGE", "Update") else
self:RegisterEvent("UNIT_ENERGY", "Update") self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_MAXENERGY", "Update") self:RegisterEvent("UNIT_MAXMANA", "Update")
self:RegisterEvent("UNIT_FOCUS", "Update") self:RegisterEvent("UNIT_RAGE", "Update")
self:RegisterEvent("UNIT_MAXFOCUS", "Update") self:RegisterEvent("UNIT_MAXRAGE", "Update")
self:RegisterEvent("UNIT_ENERGY", "Update")
self:RegisterEvent("UNIT_MAXENERGY", "Update")
self:RegisterEvent("UNIT_FOCUS", "Update")
self:RegisterEvent("UNIT_MAXFOCUS", "Update")
end
self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType") self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType")

View File

@ -101,16 +101,21 @@ function PlayerMana.prototype:Enable(core)
self:CreateTickerFrame() self:CreateTickerFrame()
self:RegisterEvent("UNIT_MAXMANA", "Update") if IceHUD.WowVer >= 40000 then
self:RegisterEvent("UNIT_MAXRAGE", "Update") self:RegisterEvent("UNIT_POWER", "Update")
self:RegisterEvent("UNIT_MAXENERGY", "Update") self:RegisterEvent("UNIT_MAXPOWER", "Update")
self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update") else
self:RegisterEvent("UNIT_MAXMANA", "Update")
self:RegisterEvent("UNIT_MANA", "Update") self:RegisterEvent("UNIT_MAXRAGE", "Update")
self:RegisterEvent("UNIT_RAGE", "Update") self:RegisterEvent("UNIT_MAXENERGY", "Update")
self:RegisterEvent("UNIT_ENERGY", "UpdateEnergy") self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update")
self:RegisterEvent("UNIT_RUNIC_POWER", "Update")
self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_RAGE", "Update")
self:RegisterEvent("UNIT_ENERGY", "UpdateEnergy")
self:RegisterEvent("UNIT_RUNIC_POWER", "Update")
end
self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle")
self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle")
@ -211,11 +216,15 @@ function PlayerMana.prototype:ManaType(unit)
end end
function PlayerMana.prototype:Update(unit) function PlayerMana.prototype:Update(unit, powertype)
PlayerMana.super.prototype.Update(self) PlayerMana.super.prototype.Update(self)
if (unit and (unit ~= self.unit)) then if (unit and (unit ~= self.unit)) then
return return
end end
if powertype ~= nil and powertype == "ENERGY" then
self:UpdateEnergy(unit)
end
if self.unit == "vehicle" and ((not UnitExists(unit)) or (self.maxMana == 0)) then if self.unit == "vehicle" and ((not UnitExists(unit)) or (self.maxMana == 0)) then
self:Show(false) self:Show(false)
@ -305,7 +314,9 @@ function PlayerMana.prototype:UpdateEnergy(unit)
end end
self.previousEnergy = UnitPower(self.unit) self.previousEnergy = UnitPower(self.unit)
self:Update(unit) if IceHUD.WowVer < 40000 then
self:Update(unit)
end
if self:ShouldUseTicker() and if self:ShouldUseTicker() and
((not (self.previousEnergy) or (self.previousEnergy <= UnitPower(self.unit))) and ((not (self.previousEnergy) or (self.previousEnergy <= UnitPower(self.unit))) and

View File

@ -1022,18 +1022,18 @@ function IceTargetInfo.prototype:CreateIconFrames(parent, direction, buffs, type
buffs[i].icon.texture:ClearAllPoints() buffs[i].icon.texture:ClearAllPoints()
buffs[i].icon.texture:SetAllPoints(buffs[i].icon) buffs[i].icon.texture:SetAllPoints(buffs[i].icon)
end end
buffs[i].icon.stack = self:FontFactory(self.moduleSettings.stackFontSize, buffs[i].icon, buffs[i].icon.stack, buffs[i].icon.stack = self:FontFactory(self.moduleSettings.stackFontSize, buffs[i].icon, buffs[i].icon.stack,
"OUTLINE") "OUTLINE")
buffs[i].icon.stack:ClearAllPoints() buffs[i].icon.stack:ClearAllPoints()
buffs[i].icon.stack:SetPoint("BOTTOMRIGHT" , buffs[i].icon, "BOTTOMRIGHT", 3, -1) buffs[i].icon.stack:SetPoint("BOTTOMRIGHT" , buffs[i].icon, "BOTTOMRIGHT", 3, -1)
buffs[i].id = i buffs[i].id = i
if (self.moduleSettings.mouseBuff) then if (self.moduleSettings.mouseBuff) then
buffs[i]:EnableMouse(true) buffs[i]:EnableMouse(true)
buffs[i]:SetScript("OnEnter", function() self:BuffOnEnter(buffs[i].type or type) end) buffs[i]:SetScript("OnEnter", function(this, ...) self:BuffOnEnter(this, buffs[i].type or type) end)
buffs[i]:SetScript("OnLeave", function() GameTooltip:Hide() end) buffs[i]:SetScript("OnLeave", function() GameTooltip:Hide() end)
else else
buffs[i]:EnableMouse(false) buffs[i]:EnableMouse(false)
@ -1391,8 +1391,8 @@ function IceTargetInfo.prototype:OnLeave(frame)
end end
function IceTargetInfo.prototype:BuffOnEnter(type) function IceTargetInfo.prototype:BuffOnEnter(this, type)
if (not this:IsVisible()) then if (not self:IsVisible()) then
return return
end end

View File

@ -39,23 +39,28 @@ function IceTargetMana.prototype:Enable(core)
IceTargetMana.super.prototype.Enable(self, core) IceTargetMana.super.prototype.Enable(self, core)
if self.registerEvents then if self.registerEvents then
self:RegisterEvent("UNIT_MAXMANA", "Update") if IceHUD.WowVer >= 40000 then
self:RegisterEvent("UNIT_MAXRAGE", "Update") self:RegisterEvent("UNIT_POWER", "Update")
self:RegisterEvent("UNIT_MAXENERGY", "Update") self:RegisterEvent("UNIT_MAXPOWER", "Update")
self:RegisterEvent("UNIT_MAXFOCUS", "Update") else
self:RegisterEvent("UNIT_MAXMANA", "Update")
self:RegisterEvent("UNIT_MAXRAGE", "Update")
self:RegisterEvent("UNIT_MAXENERGY", "Update")
self:RegisterEvent("UNIT_MAXFOCUS", "Update")
self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_RAGE", "Update")
self:RegisterEvent("UNIT_ENERGY", "Update")
self:RegisterEvent("UNIT_FOCUS", "Update")
-- DK rune stuff
if IceHUD.WowVer >= 30000 then
self:RegisterEvent("UNIT_RUNIC_POWER", "Update")
self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update")
end
end
self:RegisterEvent("UNIT_AURA", "Update") self:RegisterEvent("UNIT_AURA", "Update")
self:RegisterEvent("UNIT_FLAGS", "Update") self:RegisterEvent("UNIT_FLAGS", "Update")
self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_RAGE", "Update")
self:RegisterEvent("UNIT_ENERGY", "Update")
self:RegisterEvent("UNIT_FOCUS", "Update")
-- DK rune stuff
if IceHUD.WowVer >= 30000 then
self:RegisterEvent("UNIT_RUNIC_POWER", "Update")
self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update")
end
end end
self:Update(self.unit) self:Update(self.unit)

View File

@ -391,7 +391,7 @@ function TargetOfTarget.prototype:CreateIconFrames(parent)
if (self.moduleSettings.mouse) then if (self.moduleSettings.mouse) then
buffs[i]:EnableMouse(true) buffs[i]:EnableMouse(true)
buffs[i]:SetScript("OnEnter", function() self:BuffOnEnter() end) buffs[i]:SetScript("OnEnter", function(this) self:BuffOnEnter(this) end)
buffs[i]:SetScript("OnLeave", function() GameTooltip:Hide() end) buffs[i]:SetScript("OnLeave", function() GameTooltip:Hide() end)
else else
buffs[i]:EnableMouse(false) buffs[i]:EnableMouse(false)
@ -505,7 +505,7 @@ function TargetOfTarget.prototype:OnLeave(frame)
end end
function TargetOfTarget.prototype:BuffOnEnter(type) function TargetOfTarget.prototype:BuffOnEnter(this)
if (not this:IsVisible()) then if (not this:IsVisible()) then
return return
end end