- replaced AceEvent-2.0 with AceEvent-3.0/AceTimer-3.0

This commit is contained in:
Parnic
2010-09-10 06:30:56 +00:00
parent 33bb0ba3cb
commit e95db24dd0
38 changed files with 256 additions and 211 deletions

View File

@ -5,7 +5,12 @@ externals:
libs/CallbackHandler-1.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/CallbackHandler-1.0
tag: latest
libs/AceEvent-2.0: svn://svn.wowace.com/wow/ace2/mainline/trunk/AceEvent-2.0
libs/AceEvent-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceEvent-3.0
tag: latest
libs/AceTimer-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceTimer-3.0
tag: latest
libs/AceDB-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDB-3.0
tag: latest

View File

@ -415,13 +415,13 @@ end
-- NORMAL SPELLS --
-------------------------------------------------------------------------------
function IceCastBar.prototype:SpellCastSent(unit, spell, rank, target)
function IceCastBar.prototype:SpellCastSent(event, unit, spell, rank, target)
if (unit ~= self.unit) then return end
--IceHUD:Debug("SpellCastSent", unit, spell, rank, target)
end
function IceCastBar.prototype:SpellCastStart(unit, spell, rank)
function IceCastBar.prototype:SpellCastStart(event, unit, spell, rank)
if (unit ~= self.unit) then return end
IceHUD:Debug("SpellCastStart", unit, spell, rank)
--UnitCastingInfo(unit)
@ -430,7 +430,7 @@ function IceCastBar.prototype:SpellCastStart(unit, spell, rank)
self.current = spell
end
function IceCastBar.prototype:SpellCastStop(unit, spell, rank)
function IceCastBar.prototype:SpellCastStop(event, unit, spell, rank)
if (unit ~= self.unit) then return end
IceHUD:Debug("SpellCastStop", unit, spell, self.current)
@ -449,7 +449,7 @@ function IceCastBar.prototype:SpellCastStop(unit, spell, rank)
end
function IceCastBar.prototype:SpellCastFailed(unit, spell, rank)
function IceCastBar.prototype:SpellCastFailed(event, unit, spell, rank)
if (unit ~= self.unit) then return end
IceHUD:Debug("SpellCastFailed", unit, self.current)
@ -477,7 +477,7 @@ function IceCastBar.prototype:SpellCastFailed(unit, spell, rank)
self:StartBar(IceCastBar.Actions.Failure, "Failed")
end
function IceCastBar.prototype:CheckChatInterrupt(msg)
function IceCastBar.prototype:CheckChatInterrupt(event, msg)
local player, spell = deformat(msg, SPELLINTERRUPTOTHERSELF)
IceHUD:Debug("CheckChatInterrupt", msg, self.current)
@ -491,7 +491,7 @@ function IceCastBar.prototype:CheckChatInterrupt(msg)
end
end
function IceCastBar.prototype:SpellCastInterrupted(unit, spell, rank)
function IceCastBar.prototype:SpellCastInterrupted(event, unit, spell, rank)
if (unit ~= self.unit) then return end
IceHUD:Debug("SpellCastInterrupted", unit, self.current)
@ -505,7 +505,7 @@ function IceCastBar.prototype:SpellCastInterrupted(unit, spell, rank)
self:StartBar(IceCastBar.Actions.Failure, "Interrupted")
end
function IceCastBar.prototype:SpellCastDelayed(unit, delay)
function IceCastBar.prototype:SpellCastDelayed(event, unit, delay)
if (unit ~= self.unit) then return end
--IceHUD:Debug("SpellCastDelayed", unit, UnitCastingInfo(unit))
@ -518,7 +518,7 @@ function IceCastBar.prototype:SpellCastDelayed(unit, delay)
end
function IceCastBar.prototype:SpellCastSucceeded(unit, spell, rank)
function IceCastBar.prototype:SpellCastSucceeded(event, unit, spell, rank)
if (unit ~= self.unit) then return end
--IceHUD:Debug("SpellCastSucceeded", unit, spell, rank)
@ -556,14 +556,14 @@ end
-- CHANNELING SPELLS --
-------------------------------------------------------------------------------
function IceCastBar.prototype:SpellCastChannelStart(unit)
function IceCastBar.prototype:SpellCastChannelStart(event, unit)
if (unit ~= self.unit) then return end
--IceHUD:Debug("SpellCastChannelStart", unit)
self:StartBar(IceCastBar.Actions.Channel)
end
function IceCastBar.prototype:SpellCastChannelUpdate(unit)
function IceCastBar.prototype:SpellCastChannelUpdate(event, unit)
if (unit ~= self.unit or not self.actionStartTime) then return end
--IceHUD:Debug("SpellCastChannelUpdate", unit, UnitChannelInfo(unit))
@ -571,7 +571,7 @@ function IceCastBar.prototype:SpellCastChannelUpdate(unit)
self.actionDuration = endTime/1000 - self.actionStartTime
end
function IceCastBar.prototype:SpellCastChannelStop(unit)
function IceCastBar.prototype:SpellCastChannelStop(event, unit)
if (unit ~= self.unit) then return end
--IceHUD:Debug("SpellCastChannelStop", unit)

View File

@ -1,6 +1,6 @@
local AceOO = AceLibrary("AceOO-2.0")
IceCore = AceOO.Class("AceEvent-2.0")
IceCore = AceOO.Class()
IceCore.Side = { Left = "LEFT", Right = "RIGHT" }
@ -31,13 +31,6 @@ function IceCore.prototype:init()
IceHUD:Debug("IceCore.prototype:init()")
self.IceHUDFrame = CreateFrame("Frame","IceHUDFrame", UIParent)
-- We are ready to load modules
self:RegisterEvent(IceCore.RegisterModule, "Register")
self:TriggerEvent(IceCore.Loaded)
self:SetupDefaults()
end

View File

@ -1,7 +1,7 @@
local AceOO = AceLibrary("AceOO-2.0")
local SML = AceLibrary("LibSharedMedia-3.0")
IceElement = AceOO.Class("AceEvent-2.0")
IceElement = AceOO.Class()
IceElement.virtual = true
IceElement.TexturePath = IceHUD.Location .. "\\textures\\"
@ -42,7 +42,10 @@ function IceElement.prototype:init(name)
self:SetDefaultColor("Text", 1, 1, 1)
self:SetDefaultColor("undef", 0.7, 0.7, 0.7)
self:RegisterEvent(IceCore.Loaded, "OnCoreLoad")
LibStub("AceEvent-3.0"):Embed(self)
LibStub("AceTimer-3.0"):Embed(self)
IceHUD:Register(self)
end
@ -378,15 +381,6 @@ function IceElement.prototype:Show(bShouldShow)
end
-- Event Handlers -------------------------------------------------------------
-- Register ourself to the core
function IceElement.prototype:OnCoreLoad()
self:TriggerEvent(IceCore.RegisterModule, self)
end
-- Combat event handlers ------------------------------------------------------
function IceElement.prototype:InCombat()

View File

@ -5,6 +5,9 @@ local ACR = LibStub("AceConfigRegistry-3.0")
local ConfigDialog = LibStub("AceConfigDialog-3.0")
local icon = LibStub("LibDBIcon-1.0")
local pendingModuleLoads = {}
local bReadyToRegisterModules = false
IceHUD.CurrTagVersion = 3
IceHUD.debugging = false
@ -770,6 +773,9 @@ function IceHUD:OnInitialize()
self:Debug("IceHUD:OnInitialize()")
self.IceCore = IceCore:new()
self:RegisterPendingModules()
self.IceCore:SetupDefaults()
bReadyToRegisterModules = true
self.db = LibStub("AceDB-3.0"):New("IceCoreDB", self.IceCore.defaults, "Default")
self.db.RegisterCallback(self, "OnProfileShutdown", "PreProfileChanged")
@ -991,3 +997,19 @@ function IceHUD:GetSelectValue(info, val)
return 1
end
function IceHUD:Register(element)
assert(element, "Trying to register a nil module")
if not bReadyToRegisterModules then
pendingModuleLoads[#pendingModuleLoads+1] = element
else
self.IceCore:Register(element)
end
end
function IceHUD:RegisterPendingModules()
for i=1, #pendingModuleLoads do
self.IceCore:Register(pendingModuleLoads[i])
end
pendingModuleLoads = {}
end

View File

@ -8,7 +8,8 @@
<Include file="libs\AceDBOptions-3.0\AceDBOptions-3.0.xml"/>
<Include file="libs\AceGUI-3.0\AceGUI-3.0.xml"/>
<Include file="libs\AceConfig-3.0\AceConfig-3.0.xml"/>
<Script file="libs\AceEvent-2.0\AceEvent-2.0.lua"/>
<Include file="libs\AceEvent-3.0\AceEvent-3.0.xml"/>
<Include file="libs\AceTimer-3.0\AceTimer-3.0.xml"/>
<Include file="libs\AceConsole-3.0\AceConsole-3.0.xml"/>
<Include file="libs\AceAddon-3.0\AceAddon-3.0.xml"/>
<Include file="libs\LibDogTag-3.0\lib.xml"/>

View File

@ -327,7 +327,7 @@ function CastBar.prototype:Enable(core)
end
function CastBar.prototype:EnteringVehicle(unit, arg2)
function CastBar.prototype:EnteringVehicle(event, unit, arg2)
if (self.unit == "player" and IceHUD:ShouldSwapToVehicle(unit, arg2)) then
self.unit = "vehicle"
self:Update(self.unit)
@ -335,7 +335,7 @@ function CastBar.prototype:EnteringVehicle(unit, arg2)
end
function CastBar.prototype:ExitingVehicle(unit)
function CastBar.prototype:ExitingVehicle(event, unit)
if (unit == "player" and self.unit == "vehicle") then
self.unit = "player"
self:Update(self.unit)
@ -415,16 +415,16 @@ end
-- OVERRIDE
function CastBar.prototype:SpellCastSent(unit, spell, rank, target)
CastBar.super.prototype.SpellCastSent(self, unit, spell, rank, target)
function CastBar.prototype:SpellCastSent(event, unit, spell, rank, target)
CastBar.super.prototype.SpellCastSent(self, event, unit, spell, rank, target)
if (unit ~= self.unit) then return end
self.spellCastSent = GetTime()
end
-- OVERRIDE
function CastBar.prototype:SpellCastStart(unit, spell, rank)
CastBar.super.prototype.SpellCastStart(self, unit, spell, rank)
function CastBar.prototype:SpellCastStart(event, unit, spell, rank)
CastBar.super.prototype.SpellCastStart(self, event, unit, spell, rank)
if (unit ~= self.unit) then return end
if not self:IsVisible() or not self.actionDuration then
@ -471,8 +471,8 @@ end
-- OVERRIDE
function CastBar.prototype:SpellCastChannelStart(unit)
CastBar.super.prototype.SpellCastChannelStart(self, unit)
function CastBar.prototype:SpellCastChannelStart(event, unit)
CastBar.super.prototype.SpellCastChannelStart(self, event, unit)
if (unit ~= self.unit) then return end
if not self:IsVisible() or not self.actionDuration then

View File

@ -23,10 +23,10 @@ end
function IceCustomBar.prototype:Enable(core)
IceCustomBar.super.prototype.Enable(self, core)
self:RegisterEvent("UNIT_AURA", "UpdateCustomBar")
self:RegisterEvent("UNIT_PET", "UpdateCustomBar")
self:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomBar")
self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateCustomBar")
self:RegisterEvent("UNIT_AURA", "UpdateCustomBarEvent")
self:RegisterEvent("UNIT_PET", "UpdateCustomBarEvent")
self:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomBarEvent")
self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateCustomBarEvent")
if self.moduleSettings.auraIconScale == nil then
self.moduleSettings.auraIconScale = 1
@ -496,6 +496,10 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName)
return nil, nil, nil, nil
end
function IceCustomBar.prototype:UpdateCustomBarEvent(event, unit)
self:UpdateCustomBar(unit)
end
function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate)
if unit and unit ~= self.unit and not (self.unit == "main hand weapon" or self.unit == "off hand weapon") then
return

View File

@ -25,8 +25,8 @@ end
function IceCustomCDBar.prototype:Enable(core)
IceCustomCDBar.super.prototype.Enable(self, core)
self:RegisterEvent("SPELL_UPDATE_COOLDOWN", "UpdateCustomBar")
self:RegisterEvent("SPELL_UPDATE_USEABLE", "UpdateCustomBar")
self:RegisterEvent("SPELL_UPDATE_COOLDOWN", "UpdateCustomBarEvent")
self:RegisterEvent("SPELL_UPDATE_USEABLE", "UpdateCustomBarEvent")
self:Show(true)
@ -439,6 +439,10 @@ function IceCustomCDBar.prototype:UpdateIcon()
end
end
function IceCustomCDBar.prototype:UpdateCustomBarEvent()
self:UpdateCustomBar()
end
function IceCustomCDBar.prototype:UpdateCustomBar(fromUpdate)
local now = GetTime()
local remaining = nil

View File

@ -536,11 +536,7 @@ function IceCustomCount.prototype:GetGradientColor(curr)
end
function IceCustomCount.prototype:UpdateCustomCount(unit)
if unit and unit ~= self.unit and self.unit ~= "main hand weapon" and self.unit ~= "off hand weapon" then
return
end
function IceCustomCount.prototype:UpdateCustomCount()
local points
if IceHUD.IceCore:IsInConfigMode() then
points = tonumber(self.moduleSettings.maxCount)

View File

@ -103,7 +103,7 @@ function IceCustomHealth.prototype:Enable(core)
self:SetUnit(self.moduleSettings.unitToTrack)
self:CreateFrame()
self:ScheduleRepeatingEvent(self.elementName, self.Update, IceHUD.IceCore:UpdatePeriod(), self)
self:ScheduleRepeatingTimer(function() self:Update() end, IceHUD.IceCore:UpdatePeriod())
end
function IceCustomHealth.prototype:Disable(core)

View File

@ -104,7 +104,7 @@ function IceCustomMana.prototype:Enable(core)
self:CreateFrame()
self:ScheduleRepeatingEvent(self.elementName, self.Update, IceHUD.IceCore:UpdatePeriod(), self)
self:ScheduleRepeatingTimer(function() self:Update() end, IceHUD.IceCore:UpdatePeriod())
end
function IceCustomMana.prototype:Disable(core)

View File

@ -38,7 +38,7 @@ function FocusCast.prototype:Enable(core)
end
function FocusCast.prototype:FocusChanged(unit)
function FocusCast.prototype:FocusChanged(event, unit)
if not (UnitExists(self.unit)) then
self:StopBar()
return

View File

@ -252,10 +252,10 @@ end
function FocusHealth.prototype:Enable(core)
FocusHealth.super.prototype.Enable(self, core)
self:RegisterEvent("UNIT_HEALTH", "Update")
self:RegisterEvent("UNIT_MAXHEALTH", "Update")
self:RegisterEvent("UNIT_FLAGS", "Update")
self:RegisterEvent("UNIT_FACTION", "Update")
self:RegisterEvent("UNIT_HEALTH", "UpdateEvent")
self:RegisterEvent("UNIT_MAXHEALTH", "UpdateEvent")
self:RegisterEvent("UNIT_FLAGS", "UpdateEvent")
self:RegisterEvent("UNIT_FACTION", "UpdateEvent")
self:RegisterEvent("RAID_TARGET_UPDATE", "UpdateRaidFocusIcon")
self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateFocus")
@ -329,7 +329,9 @@ function FocusHealth.prototype:Disable(core)
FocusHealth.super.prototype.Disable(self, core)
end
function FocusHealth.prototype:UpdateEvent(event, unit)
self:Update(unit)
end
function FocusHealth.prototype:Update(unit)
FocusHealth.super.prototype.Update(self)

View File

@ -33,20 +33,20 @@ function FocusMana.prototype:Enable(core)
FocusMana.super.prototype.Enable(self, core)
if IceHUD.WowVer >= 40000 then
self:RegisterEvent("UNIT_POWER", "Update")
self:RegisterEvent("UNIT_MAXPOWER", "Update")
self:RegisterEvent("UNIT_POWER", "UpdateEvent")
self:RegisterEvent("UNIT_MAXPOWER", "UpdateEvent")
else
self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_MAXMANA", "Update")
self:RegisterEvent("UNIT_RAGE", "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")
self:RegisterEvent("UNIT_MANA", "UpdateEvent")
self:RegisterEvent("UNIT_MAXMANA", "UpdateEvent")
self:RegisterEvent("UNIT_RAGE", "UpdateEvent")
self:RegisterEvent("UNIT_MAXRAGE", "UpdateEvent")
self:RegisterEvent("UNIT_ENERGY", "UpdateEvent")
self:RegisterEvent("UNIT_MAXENERGY", "UpdateEvent")
self:RegisterEvent("UNIT_FOCUS", "UpdateEvent")
self:RegisterEvent("UNIT_MAXFOCUS", "UpdateEvent")
end
self:RegisterEvent("UNIT_AURA", "Update")
self:RegisterEvent("UNIT_FLAGS", "Update")
self:RegisterEvent("UNIT_AURA", "UpdateEvent")
self:RegisterEvent("UNIT_FLAGS", "UpdateEvent")
self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateFocus")
self:Update(self.unit)
@ -56,6 +56,10 @@ function FocusMana.prototype:UpdateFocus()
self:Update(self.unit)
end
function FocusMana.prototype:Update(event, unit)
self:Update(unit)
end
function FocusMana.prototype:Update(unit)
FocusMana.super.prototype.Update(self)
if (unit and (unit ~= self.unit)) then

View File

@ -26,7 +26,7 @@ function GlobalCoolDown.prototype:Enable(core)
self:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN", "CooldownStateChanged")
self:ScheduleRepeatingEvent(self.elementName, self.UpdateGlobalCoolDown, 0.05, self)
self:ScheduleRepeatingTimer(function() self:UpdateGlobalCoolDown() end, 0.05)
self:Show(false)
end

View File

@ -162,7 +162,7 @@ function HungerForBlood.prototype:GetBuffDuration(unitName, buffName)
return nil, nil, nil
end
function HungerForBlood.prototype:UpdateHungerForBlood(unit, fromUpdate)
function HungerForBlood.prototype:UpdateHungerForBlood(event, unit, fromUpdate)
if unit and unit ~= self.unit then
return
end
@ -183,7 +183,7 @@ function HungerForBlood.prototype:UpdateHungerForBlood(unit, fromUpdate)
if hfbEndTime and hfbEndTime >= now then
if not fromUpdate then
self.frame:SetScript("OnUpdate", function() self:UpdateHungerForBlood(self.unit, true) end)
self.frame:SetScript("OnUpdate", function() self:UpdateHungerForBlood(nil, self.unit, true) end)
end
-- self:Show(true)

View File

@ -256,7 +256,7 @@ function MaelstromCount.prototype:CreateMaelstromFrame(doTextureUpdate)
end
function MaelstromCount.prototype:UpdateMaelstromCount(unit)
function MaelstromCount.prototype:UpdateMaelstromCount(event, unit)
if unit and unit ~= "player" then
return
end

View File

@ -450,7 +450,7 @@ function MirrorBarHandler.prototype:Redraw()
end
function MirrorBarHandler.prototype:MirrorStart(timer, value, maxValue, scale, paused, label)
function MirrorBarHandler.prototype:MirrorStart(event, timer, value, maxValue, scale, paused, label)
local done = nil
-- check if we can find an already running timer to reverse it
@ -483,7 +483,7 @@ function MirrorBarHandler.prototype:MirrorStart(timer, value, maxValue, scale, p
end
function MirrorBarHandler.prototype:MirrorStop(timer)
function MirrorBarHandler.prototype:MirrorStop(event, timer)
for i = 1, table.getn(self.bars) do
if (self.bars[i].timer == timer) then
self.bars[i]:MirrorStop()
@ -492,7 +492,7 @@ function MirrorBarHandler.prototype:MirrorStop(timer)
end
function MirrorBarHandler.prototype:MirrorPause(paused)
function MirrorBarHandler.prototype:MirrorPause(event, paused)
for i = 1, table.getn(self.bars) do
if (self.bars[i].timer ~= nil) then
self.bars[i]:MirrorPause(paused > 0)

View File

@ -59,8 +59,8 @@ function PetHealth.prototype:Enable(core)
self:RegisterEvent("PET_BAR_CHANGED", "CheckPet");
self:RegisterEvent("UNIT_PET", "CheckPet");
self:RegisterEvent("UNIT_HEALTH", "Update")
self:RegisterEvent("UNIT_MAXHEALTH", "Update")
self:RegisterEvent("UNIT_HEALTH", "UpdateEvent")
self:RegisterEvent("UNIT_MAXHEALTH", "UpdateEvent")
if IceHUD.WowVer >= 40000 then
self:RegisterEvent("UNIT_POWER", "PetHappiness")
@ -79,7 +79,7 @@ function PetHealth.prototype:Disable(core)
UnregisterUnitWatch(self.frame)
end
function PetHealth.prototype:PetHappiness(unit, powertype)
function PetHealth.prototype:PetHappiness(event, unit, powertype)
if (unit and (unit ~= self.unit)) then
return
end
@ -96,12 +96,16 @@ end
function PetHealth.prototype:CheckPet()
if (UnitExists(self.unit)) then
self:PetHappiness(self.unit, "HAPPINESS")
self:PetHappiness(nil, self.unit, "HAPPINESS")
self:Update(self.unit)
end
end
function PetHealth.prototype:UpdateEvent(event, unit)
self:Update(unit)
end
function PetHealth.prototype:Update(unit)
PetHealth.super.prototype.Update(self)
if (unit and (unit ~= self.unit)) then

View File

@ -58,23 +58,23 @@ function PetMana.prototype:Enable(core)
self:RegisterEvent("UNIT_ENTERED_VEHICLE", "CheckPet")
if IceHUD.WowVer >= 40000 then
self:RegisterEvent("UNIT_POWER", "Update")
self:RegisterEvent("UNIT_MAXPOWER", "Update")
self:RegisterEvent("UNIT_POWER", "UpdateEvent")
self:RegisterEvent("UNIT_MAXPOWER", "UpdateEvent")
else
self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_MAXMANA", "Update")
self:RegisterEvent("UNIT_RAGE", "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")
self:RegisterEvent("UNIT_MANA", "UpdateEvent")
self:RegisterEvent("UNIT_MAXMANA", "UpdateEvent")
self:RegisterEvent("UNIT_RAGE", "UpdateEvent")
self:RegisterEvent("UNIT_MAXRAGE", "UpdateEvent")
self:RegisterEvent("UNIT_ENERGY", "UpdateEvent")
self:RegisterEvent("UNIT_MAXENERGY", "UpdateEvent")
self:RegisterEvent("UNIT_FOCUS", "UpdateEvent")
self:RegisterEvent("UNIT_MAXFOCUS", "UpdateEvent")
end
self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType")
self:CheckPet()
self:ManaType(self.unit)
self:ManaType(nil, self.unit)
end
@ -83,7 +83,7 @@ function PetMana.prototype:CheckPet()
if (UnitExists(self.unit)) then
self:Show(true)
self:ManaType(self.unit)
self:ManaType(nil, self.unit)
self:Update(self.unit)
else
self:Show(false)
@ -91,7 +91,7 @@ function PetMana.prototype:CheckPet()
end
function PetMana.prototype:ManaType(unit)
function PetMana.prototype:ManaType(event, unit)
if (unit ~= self.unit) then
return
end
@ -134,11 +134,15 @@ function PetMana.prototype:CheckForVehicle()
end
if self.unit ~= lastUnit then
self:ManaType(self.unit)
self:ManaType(nil, self.unit)
end
end
function PetMana.prototype:UpdateEvent(event, unit)
self:Update(unit)
end
function PetMana.prototype:Update(unit)
self:CheckForVehicle()

View File

@ -62,8 +62,8 @@ end
function PlayerHealth.prototype:Enable(core)
PlayerHealth.super.prototype.Enable(self, core)
self:RegisterEvent("UNIT_HEALTH", "Update")
self:RegisterEvent("UNIT_MAXHEALTH", "Update")
self:RegisterEvent("UNIT_HEALTH", "UpdateEvent")
self:RegisterEvent("UNIT_MAXHEALTH", "UpdateEvent")
self:RegisterEvent("PLAYER_ENTERING_WORLD", "EnteringWorld")
@ -785,7 +785,7 @@ function PlayerHealth.prototype:GetOptions()
end
function PlayerHealth.prototype:EnteringVehicle(unit, arg2)
function PlayerHealth.prototype:EnteringVehicle(event, unit, arg2)
if (self.unit == "player" and IceHUD:ShouldSwapToVehicle(unit, arg2)) then
self.unit = "vehicle"
self:RegisterFontStrings()
@ -794,7 +794,7 @@ function PlayerHealth.prototype:EnteringVehicle(unit, arg2)
end
function PlayerHealth.prototype:ExitingVehicle(unit)
function PlayerHealth.prototype:ExitingVehicle(event, unit)
if (unit == "player" and self.unit == "vehicle") then
self.unit = "player"
self:RegisterFontStrings()
@ -1155,6 +1155,10 @@ function PlayerHealth.prototype:CheckPvP()
end
function PlayerHealth.prototype:UpdateEvent(event, unit)
self:Update(unit)
end
function PlayerHealth.prototype:Update(unit)
PlayerHealth.super.prototype.Update(self)
if (unit and (unit ~= self.unit)) then

View File

@ -102,7 +102,7 @@ function PlayerInfo.prototype:Enable(core)
self:HideBlizz()
end
self:ScheduleRepeatingEvent(self.elementName, self.UpdateBuffs, 1, self, self.unit, true)
self:ScheduleRepeatingTimer(function() self:RepeatingUpdateBuffs() end, 1)
end
function PlayerInfo.prototype:ShowBlizz()
@ -120,6 +120,10 @@ function PlayerInfo.prototype:HideBlizz()
BuffFrame:UnregisterAllEvents()
end
function PlayerInfo.prototype:RepeatingUpdateBuffs()
self:UpdateBuffs(self.unit, true)
end
function PlayerInfo.prototype:UpdateBuffs(unit, fromRepeated)
if unit and unit ~= self.unit then
return

View File

@ -47,7 +47,7 @@ if self:ShouldUseTicker() then
end,
set = function(info, value)
self.moduleSettings.tickerEnabled = value
self:ManaType(self.unit)
self:ManaType(nil, self.unit)
end,
disabled = function()
return not self.moduleSettings.enabled
@ -103,18 +103,18 @@ function PlayerMana.prototype:Enable(core)
self:CreateTickerFrame()
if IceHUD.WowVer >= 40000 then
self:RegisterEvent("UNIT_POWER", "Update")
self:RegisterEvent("UNIT_MAXPOWER", "Update")
self:RegisterEvent("UNIT_POWER", "UpdateEvent")
self:RegisterEvent("UNIT_MAXPOWER", "UpdateEvent")
else
self:RegisterEvent("UNIT_MAXMANA", "Update")
self:RegisterEvent("UNIT_MAXRAGE", "Update")
self:RegisterEvent("UNIT_MAXENERGY", "Update")
self:RegisterEvent("UNIT_MAXRUNIC_POWER", "Update")
self:RegisterEvent("UNIT_MAXMANA", "UpdateEvent")
self:RegisterEvent("UNIT_MAXRAGE", "UpdateEvent")
self:RegisterEvent("UNIT_MAXENERGY", "UpdateEvent")
self:RegisterEvent("UNIT_MAXRUNIC_POWER", "UpdateEvent")
self:RegisterEvent("UNIT_MANA", "Update")
self:RegisterEvent("UNIT_RAGE", "Update")
self:RegisterEvent("UNIT_MANA", "UpdateEvent")
self:RegisterEvent("UNIT_RAGE", "UpdateEvent")
self:RegisterEvent("UNIT_ENERGY", "UpdateEnergy")
self:RegisterEvent("UNIT_RUNIC_POWER", "Update")
self:RegisterEvent("UNIT_RUNIC_POWER", "UpdateEvent")
end
self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle")
@ -127,7 +127,7 @@ function PlayerMana.prototype:Enable(core)
self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType")
self:ManaType(self.unit)
self:ManaType(nil, self.unit)
end
function PlayerMana.prototype:ShouldUseTicker()
@ -148,7 +148,7 @@ function PlayerMana.prototype:SetupOnUpdate(enable)
end
function PlayerMana.prototype:EnteringVehicle(unit, arg2)
function PlayerMana.prototype:EnteringVehicle(event, unit, arg2)
if (self.unit == "player" and IceHUD:ShouldSwapToVehicle(unit, arg2)) then
self.unit = "vehicle"
self:RegisterFontStrings()
@ -157,7 +157,7 @@ function PlayerMana.prototype:EnteringVehicle(unit, arg2)
end
function PlayerMana.prototype:ExitingVehicle(unit)
function PlayerMana.prototype:ExitingVehicle(event, unit)
if (unit == "player" and self.unit == "vehicle") then
self.unit = "player"
self:RegisterFontStrings()
@ -195,7 +195,7 @@ function PlayerMana.prototype:UseTargetAlpha(scale)
end
function PlayerMana.prototype:ManaType(unit)
function PlayerMana.prototype:ManaType(event, unit)
if (unit ~= self.unit) then
return
end
@ -217,6 +217,10 @@ function PlayerMana.prototype:ManaType(unit)
end
function PlayerMana.prototype:UpdateEvent(event, unit, powertype)
self:Update(unit, powertype)
end
function PlayerMana.prototype:Update(unit, powertype)
PlayerMana.super.prototype.Update(self)
if (unit and (unit ~= self.unit)) then
@ -224,7 +228,7 @@ function PlayerMana.prototype:Update(unit, powertype)
end
if powertype ~= nil and powertype == "ENERGY" then
self:UpdateEnergy(unit)
self:UpdateEnergy(nil, unit)
end
if self.unit == "vehicle" and ((not UnitExists(unit)) or (self.maxMana == 0)) then
@ -311,7 +315,7 @@ end
function PlayerMana.prototype:UpdateEnergy(unit)
function PlayerMana.prototype:UpdateEnergy(event, unit)
if (unit and (unit ~= self.unit)) then
return
end

View File

@ -23,7 +23,7 @@ function RangeCheck.prototype:Enable(core)
DogTag = AceLibrary("LibDogTag-3.0")
self:RegisterFontStrings()
else
self:ScheduleRepeatingEvent(self.elementName, self.UpdateRange, 0.1, self)
self:ScheduleRepeatingTimer(function() self:UpdateRange() end, 0.1)
end
end

View File

@ -204,12 +204,12 @@ end
function Runes.prototype:ResetRuneAvailability()
for i=1, self.numRunes do
self:UpdateRunePower(i, true)
self:UpdateRunePower(nil, i, true)
end
end
-- simply shows/hides the foreground rune when it becomes usable/unusable. this allows the background transparent rune to show only
function Runes.prototype:UpdateRunePower(rune, dontFlash)
function Runes.prototype:UpdateRunePower(event, rune, dontFlash)
if not rune or not self.frame.graphical or #self.frame.graphical < rune then
return
end
@ -255,7 +255,7 @@ function Runes.prototype:ShineFinished(rune)
UIFrameFadeOut(self.frame.graphical[rune].shine, 0.5);
end
function Runes.prototype:UpdateRuneType(rune)
function Runes.prototype:UpdateRuneType(event, rune)
-- DEFAULT_CHAT_FRAME:AddMessage("Runes.prototype:UpdateRuneType: rune="..rune.." GetRuneType(rune)="..GetRuneType(rune));
if not rune or tonumber(rune) ~= rune or rune < 1 or rune > self.numRunes then

View File

@ -41,18 +41,13 @@ function SliceAndDice.prototype:Enable(core)
SliceAndDice.super.prototype.Enable(self, core)
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
if IceHUD.WowVer >= 30000 then
self:RegisterEvent("UNIT_AURA", "UpdateSliceAndDice")
self:RegisterEvent("UNIT_COMBO_POINTS", "UpdateDurationBar")
else
self:RegisterEvent("PLAYER_AURAS_CHANGED", "UpdateSliceAndDice")
self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateDurationBar")
end
self:RegisterEvent("UNIT_AURA", "UpdateSliceAndDice")
self:RegisterEvent("UNIT_COMBO_POINTS", "UpdateDurationBar")
if not self.moduleSettings.alwaysFullAlpha then
self:Show(false)
else
self:UpdateSliceAndDice(self.unit)
self:UpdateSliceAndDice(nil, self.unit)
end
self:SetBottomText1("")
@ -204,7 +199,7 @@ function SliceAndDice.prototype:GetBuffDuration(unitName, buffName)
return nil, nil
end
function SliceAndDice.prototype:UpdateSliceAndDice(unit, fromUpdate)
function SliceAndDice.prototype:UpdateSliceAndDice(event, unit, fromUpdate)
if unit and unit ~= self.unit then
return
end
@ -224,7 +219,7 @@ function SliceAndDice.prototype:UpdateSliceAndDice(unit, fromUpdate)
if sndEndTime and sndEndTime >= now then
if not fromUpdate then
self.frame:SetScript("OnUpdate", function() self:UpdateSliceAndDice(self.unit, true) end)
self.frame:SetScript("OnUpdate", function() self:UpdateSliceAndDice(nil, self.unit, true) end)
end
self:Show(true)
@ -255,7 +250,7 @@ function SliceAndDice.prototype:UpdateSliceAndDice(unit, fromUpdate)
end
end
function SliceAndDice.prototype:UpdateDurationBar(unit)
function SliceAndDice.prototype:UpdateDurationBar(event, unit)
if unit and unit ~= self.unit then
return
end

View File

@ -236,7 +236,7 @@ function TargetCC.prototype:Enable(core)
self:RegisterEvent("UNIT_AURA", "UpdateTargetDebuffs")
self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateTargetDebuffs")
-- self:ScheduleRepeatingEvent(self.elementName, self.UpdateTargetDebuffs, 0.1, self)
-- self:ScheduleRepeatingTimer(function() self:UpdateTargetDebuffs() end, 0.1)
self:Show(false)
end
@ -337,10 +337,10 @@ function TargetCC.prototype:GetMaxDebuffDuration(unitName, debuffNames)
return unpack(result)
end
function TargetCC.prototype:UpdateTargetDebuffs(unit, isUpdate)
function TargetCC.prototype:UpdateTargetDebuffs(event, unit, isUpdate)
local name, duration, remaining
if not isUpdate then
self.frame:SetScript("OnUpdate", function() self:UpdateTargetDebuffs(self.unit, true) end)
self.frame:SetScript("OnUpdate", function() self:UpdateTargetDebuffs(nil, self.unit, true) end)
self.debuffName, self.debuffDuration, self.debuffRemaining = self:GetMaxDebuffDuration(self.unit, self.debuffList)
else
self.debuffRemaining = math.max(0, self.debuffRemaining - (1.0 / GetFramerate()))

View File

@ -523,10 +523,10 @@ function IceTargetHealth.prototype:Enable(core)
IceTargetHealth.super.prototype.Enable(self, core)
if self.registerEvents then
self:RegisterEvent("UNIT_HEALTH", "Update")
self:RegisterEvent("UNIT_MAXHEALTH", "Update")
self:RegisterEvent("UNIT_FLAGS", "Update")
self:RegisterEvent("UNIT_FACTION", "Update")
self:RegisterEvent("UNIT_HEALTH", "UpdateEvent")
self:RegisterEvent("UNIT_MAXHEALTH", "UpdateEvent")
self:RegisterEvent("UNIT_FLAGS", "UpdateEvent")
self:RegisterEvent("UNIT_FACTION", "UpdateEvent")
self:RegisterEvent("RAID_TARGET_UPDATE", "UpdateRaidTargetIcon")
self:RegisterEvent("UPDATE_FACTION", "CheckPvP")
self:RegisterEvent("PLAYER_FLAGS_CHANGED", "CheckPvP")
@ -621,6 +621,10 @@ function IceTargetHealth.prototype:EnableClickTargeting(bEnable)
end
function IceTargetHealth.prototype:UpdateEvent(event, unit)
self:Update(unit)
end
function IceTargetHealth.prototype:Update(unit)
IceTargetHealth.super.prototype.Update(self)

View File

@ -1189,7 +1189,7 @@ end
function IceTargetInfo.prototype:AuraChanged(unit)
function IceTargetInfo.prototype:AuraChanged(event, unit)
if (unit == self.unit) then
self:UpdateBuffs()
end
@ -1234,12 +1234,12 @@ function IceTargetInfo.prototype:TargetChanged()
-- pass "internal" as a paramater so event handler code doesn't execute
-- Update() unnecassarily
self:TargetName(internal)
self:TargetName(nil, internal)
self:TargetLevel(internal)
self:TargetReaction(internal)
self:TargetFaction(internal)
self:TargetFlags(internal)
self:TargetLevel(nil, internal)
self:TargetReaction(nil, internal)
self:TargetFaction(nil, internal)
self:TargetFlags(nil, internal)
self:UpdateBuffs()
self:UpdateRaidTargetIcon()
@ -1248,7 +1248,7 @@ function IceTargetInfo.prototype:TargetChanged()
end
function IceTargetInfo.prototype:TargetName(unit)
function IceTargetInfo.prototype:TargetName(event, unit)
if (unit == self.unit or unit == internal) then
self.name, self.realm = UnitName(self.unit)
self.classLocale, self.classEnglish = UnitClass(self.unit)
@ -1282,7 +1282,7 @@ function IceTargetInfo.prototype:TargetName(unit)
end
function IceTargetInfo.prototype:TargetLevel(unit)
function IceTargetInfo.prototype:TargetLevel(event, unit)
if (unit == self.unit or unit == internal) then
self.level = UnitLevel(self.unit)
@ -1319,7 +1319,7 @@ end
-- PVP status
function IceTargetInfo.prototype:TargetFaction(unit)
function IceTargetInfo.prototype:TargetFaction(event, unit)
if (unit == self.unit or unit == internal) then
if (self.isPlayer) then
if (UnitIsPVP(self.unit)) then
@ -1341,7 +1341,7 @@ function IceTargetInfo.prototype:TargetFaction(unit)
end
function IceTargetInfo.prototype:TargetFlags(unit)
function IceTargetInfo.prototype:TargetFlags(event, unit)
if (unit == self.unit or unit == internal) then
self.tapped = UnitIsTapped(self.unit) and (not UnitIsTappedByPlayer(self.unit))
self.targetCombat = UnitAffectingCombat(self.unit) and " |cffee4030Combat|r" or ""

View File

@ -88,7 +88,7 @@ function TargetInvuln.prototype:Enable(core)
self:RegisterEvent("UNIT_AURA", "UpdateTargetBuffs")
self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateTargetBuffs")
-- self:ScheduleRepeatingEvent(self.elementName, self.UpdateTargetBuffs, 0.1, self)
-- self:ScheduleRepeatingTimer(function() self:UpdateTargetBuffs() end, 0.1)
self:Show(false)
end
@ -180,10 +180,10 @@ function TargetInvuln.prototype:GetMaxbuffDuration(unitName, buffNames)
return unpack(result)
end
function TargetInvuln.prototype:UpdateTargetBuffs(unit, isUpdate)
function TargetInvuln.prototype:UpdateTargetBuffs(event, unit, isUpdate)
local name, duration, remaining
if not isUpdate then
self.frame:SetScript("OnUpdate", function() self:UpdateTargetBuffs(self.unit, true) end)
self.frame:SetScript("OnUpdate", function() self:UpdateTargetBuffs(nil, self.unit, true) end)
self.buffName, self.buffDuration, self.buffRemaining = self:GetMaxbuffDuration(self.unit, self.buffList)
else

View File

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

View File

@ -210,7 +210,7 @@ end
function TargetOfTarget.prototype:Enable(core)
TargetOfTarget.super.prototype.Enable(self, core)
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self)
self:ScheduleRepeatingTimer(function() self:Update() end, 0.2)
RegisterUnitWatch(self.frame)
self:Update()

View File

@ -37,7 +37,7 @@ end
function TargetTargetCast.prototype:Enable(core)
TargetTargetCast.super.prototype.Enable(self, core)
self:ScheduleRepeatingEvent(self.elementName, self.UpdateTargetTarget, 0.1, self)
self:ScheduleRepeatingTimer(function() self:UpdateTargetTarget() end, 0.1)
end

View File

@ -110,7 +110,7 @@ function TargetTargetHealth.prototype:Enable(core)
self.moduleSettings.useSelfColor = nil
end
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.1, self, "targettarget")
self:ScheduleRepeatingTimer(function() self:Update("targettarget") end, 0.1)
end
function TargetTargetHealth.prototype:Disable(core)

View File

@ -60,7 +60,7 @@ function TargetTargetMana.prototype:Enable(core)
self.determineColor = false
TargetTargetMana.super.prototype.Enable(self, core)
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.1, self, "targettarget")
self:ScheduleRepeatingTimer(function() self:Update("targettarget") end, 0.1)
end
function TargetTargetMana.prototype:Disable(core)

View File

@ -31,8 +31,6 @@ function IceThreat.prototype:init(name, unit)
self:SetDefaultColor("ThreatCustom", 255, 255, 0)
self:SetDefaultColor("ThreatPullAggro", 255, 0, 0)
self:SetDefaultColor("ThreatSecondPlace", 255, 255, 0)
self:OnCoreLoad()
end
-- default settings
@ -171,7 +169,7 @@ end
function IceThreat.prototype:Enable(core)
IceThreat.super.prototype.Enable(self, core)
self:ScheduleRepeatingEvent(self.elementName, self.Update, 0.2, self)
self:ScheduleRepeatingTimer(function() self:Update() end, 0.2)
self:Update(self.unit)
end

View File

@ -205,11 +205,11 @@ end
function Totems.prototype:ResetTotemAvailability()
for i=1, self.numTotems do
self:UpdateTotem(totem)
self:UpdateTotem(nil, totem)
end
end
function Totems.prototype:UpdateTotem(totem, ...)
function Totems.prototype:UpdateTotem(event, totem, ...)
if not totem or tonumber(totem) ~= totem or totem < 1 or totem > self.numTotems then
return
end