diff --git a/.pkgmeta b/.pkgmeta index 4d110cf..a8692bc 100644 --- a/.pkgmeta +++ b/.pkgmeta @@ -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 diff --git a/IceCastBar.lua b/IceCastBar.lua index 39ef0e3..c2f340a 100644 --- a/IceCastBar.lua +++ b/IceCastBar.lua @@ -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) diff --git a/IceCore.lua b/IceCore.lua index 7031fdc..5596cc0 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -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 @@ -50,7 +43,7 @@ function IceCore.prototype:SetupDefaults() verticalPos = -110, horizontalPos = 0, scale = 0.9, - + alphaooc = 0.3, alphaic = 0.6, alphaTarget = 0.4, @@ -60,7 +53,7 @@ function IceCore.prototype:SetupDefaults() alphaicbg = 0.3, alphaTargetbg = 0.25, alphaNotFullbg = 0.25, - + backgroundToggle = false, backgroundColor = {r = 0.5, g = 0.5, b = 0.5}, barTexture = "Bar", @@ -85,14 +78,14 @@ function IceCore.prototype:SetupDefaults() for k, v in pairs(self.presets[defaultPreset]) do self.defaults.profile[k] = v end - + -- get default settings from the modules self.defaults.profile.modules = {} for i = 1, table.getn(self.elements) do local name = self.elements[i]:GetElementName() - self.defaults.profile.modules[name] = self.elements[i]:GetDefaultSettings() + self.defaults.profile.modules[name] = self.elements[i]:GetDefaultSettings() end - + if (table.getn(self.elements) > 0) then self.defaults.profile.colors = self.elements[1].defaultColors end @@ -284,7 +277,7 @@ function IceCore.prototype:Disable() self.elements[i]:Disable(true) end end - + self.IceHUDFrame:Hide() self:EmptyUpdates() self.enabled = false @@ -299,9 +292,9 @@ function IceCore.prototype:DrawFrame() self.IceHUDFrame:SetFrameStrata("BACKGROUND") self.IceHUDFrame:SetWidth(self.settings.gap) self.IceHUDFrame:SetHeight(20) - + self:SetScale(self.settings.scale) - + self.IceHUDFrame:SetPoint("CENTER", self.settings.horizontalPos, self.settings.verticalPos) self.IceHUDFrame:Show() end @@ -316,7 +309,7 @@ end function IceCore.prototype:GetModuleOptions() local options = {} - + options["aaaClickPlus"] = { type = 'description', fontSize = 'large', @@ -334,16 +327,16 @@ function IceCore.prototype:GetModuleOptions() args = opt } end - + return options end function IceCore.prototype:GetColorOptions() assert(table.getn(IceHUD.IceCore.elements) > 0, "Unable to get color options, no elements found!") - + local options = {} - + for k, v in pairs(self.elements[1]:GetColors()) do local kk, vv = k, v options[k] = { @@ -359,7 +352,7 @@ function IceCore.prototype:GetColorOptions() end } end - + return options end @@ -411,7 +404,7 @@ function IceCore.prototype:GetScale() end function IceCore.prototype:SetScale(value) self.settings.scale = value - + self.IceHUDFrame:SetScale(value) end @@ -572,7 +565,7 @@ end function IceCore.prototype:GetFontFamily() - return self.settings.fontFamily + return self.settings.fontFamily end function IceCore.prototype:SetFontFamily(value) self.settings.fontFamily = value @@ -598,7 +591,7 @@ function IceCore.prototype:SetColor(color, r, g, b) self.settings.colors[color].r = r self.settings.colors[color].g = g self.settings.colors[color].b = b - + self:Redraw() end @@ -713,7 +706,7 @@ function IceCore.prototype:LoadPresets() barBlendMode = "BLEND", barBgBlendMode = "BLEND", } - + self.presets["HiBar"] = { barTexture = "HiBar", barWidth = 63, @@ -723,7 +716,7 @@ function IceCore.prototype:LoadPresets() barBlendMode = "BLEND", barBgBlendMode = "BLEND", } - + self.presets["RoundBar"] = { barTexture = "RoundBar", barWidth = 155, diff --git a/IceElement.lua b/IceElement.lua index b2a1e85..f27daad 100644 --- a/IceElement.lua +++ b/IceElement.lua @@ -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 @@ -60,7 +63,7 @@ end function IceElement.prototype:Create(parent) assert(parent, "IceElement 'parent' can't be nil") - + self.parent = parent self:CreateFrame() self:Show(false) @@ -105,7 +108,7 @@ end -- inherting classes should override this and provide -- make sure they refresh any changes made to them function IceElement.prototype:Redraw() - + end @@ -167,12 +170,12 @@ function IceElement.prototype:GetOptions() self.moduleSettings.alwaysFullAlpha = value self:Update(self.unit) self:Redraw() - end, + end, disabled = function() return not self.moduleSettings.enabled end, order = 27.5 - } + } return opts end @@ -253,7 +256,7 @@ function IceElement.prototype:GetColor(color, alpha) if not (alpha) then alpha = self.alpha end - + if not (self.settings.colors[color]) then local r, g, b = self:GetClassColor(color) return r, g, b, alpha @@ -293,7 +296,7 @@ function IceElement.prototype:SetDefaultColor(color, red, green, blue) if (blue > 1) then blue = blue / 255 end - + self.defaultColors[color] = {r = red, g = green, b = blue} end @@ -331,20 +334,20 @@ function IceElement.prototype:FontFactory(size, frame, font, flags) if not (frame) then frame = self.frame end - + local fontString = nil if not (font) then fontString = frame:CreateFontString() else fontString = font end - + fontString:SetFont(SML:Fetch('font', self.settings.fontFamily), size, flags) if not (flags) then fontString:SetShadowColor(0, 0, 0, 1) fontString:SetShadowOffset(1, -1) end - + return fontString 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() diff --git a/IceHUD.lua b/IceHUD.lua index 905c94f..29bd69f 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -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 @@ -19,14 +22,14 @@ IceHUD.options = name = "IceHUD", desc = "IceHUD", icon = "Interface\\Icons\\Spell_Frost_Frost", - args = + args = { headerGeneral = { type = 'header', name = "General Settings", order = 10 }, - + faq = { type = 'group', name = 'FAQs', @@ -351,7 +354,7 @@ Expand Module Settings, expand PlayerInfo (or TargetInfo for targets), and set t set = function(info, value) IceHUD.IceCore:SetFontFamily(info.option.values[value]) end, - values = SML:List('font'), + values = SML:List('font'), }, barSettings = { @@ -470,7 +473,7 @@ Expand Module Settings, expand PlayerInfo (or TargetInfo for targets), and set t set = function(info, value) IceHUD.IceCore:SetBarBgBlendMode(value) end, - values = { BLEND = "Blend", ADD = "Additive" }, --"Disable", "Alphakey", "Mod" }, + values = { BLEND = "Blend", ADD = "Additive" }, --"Disable", "Alphakey", "Mod" }, order = 16 }, @@ -484,7 +487,7 @@ Expand Module Settings, expand PlayerInfo (or TargetInfo for targets), and set t set = function(info, value) IceHUD.IceCore:SetBarBlendMode(value) end, - values = { BLEND = "Blend", ADD = "Additive" }, --"Disable", "Alphakey", "Mod" }, + values = { BLEND = "Blend", ADD = "Additive" }, --"Disable", "Alphakey", "Mod" }, order = 17 }, } @@ -498,7 +501,7 @@ Expand Module Settings, expand PlayerInfo (or TargetInfo for targets), and set t args = {}, order = 41 }, - + colors = { type='group', desc = 'Module color configuration options', @@ -542,7 +545,7 @@ Expand Module Settings, expand PlayerInfo (or TargetInfo for targets), and set t end, order = 92 }, - + reset = { type = 'execute', name = '|cffff0000Reset|r', @@ -693,7 +696,7 @@ Expand Module Settings, expand PlayerInfo (or TargetInfo for targets), and set t } -StaticPopupDialogs["ICEHUD_RESET"] = +StaticPopupDialogs["ICEHUD_RESET"] = { text = "Are you sure you want to reset IceHUD settings?", button1 = OKAY, @@ -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") @@ -798,7 +804,7 @@ function IceHUD:NotifyNewDb() self.IceCore.accountSettings = self.db.global self.IceCore.settings = self.db.profile self.IceCore:SetModuleDatabases() - + self.IceCore:CheckDisplayUpdateMessage() end @@ -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 diff --git a/embeds.xml b/embeds.xml index 79b5248..5239539 100644 --- a/embeds.xml +++ b/embeds.xml @@ -8,7 +8,8 @@ -