X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/978ee00b8c408d36f1724683428f196c9e1e48f2..e410c5d67984d70758631f799bb8517f369d8fa1:/OmaRF/Core.lua?ds=sidebyside diff --git a/OmaRF/Core.lua b/OmaRF/Core.lua index 74f5aed..34b4657 100644 --- a/OmaRF/Core.lua +++ b/OmaRF/Core.lua @@ -1,4 +1,4 @@ -OmaRF = LibStub("AceAddon-3.0"):NewAddon("OmaRF"); +OmaRF = CreateFrame("Frame"); OmaRF.normalBarColor = CreateColor(0.3, 0.3, 0.3); OmaRF.dispelBarColor = CreateColor(1, 0.5, 0); @@ -13,6 +13,8 @@ OmaRF.positions = { OmaRF.running = false; +OmaRF.ooc_queue = {}; + local defaults = { profile = { enabled = true, @@ -65,6 +67,21 @@ function OmaRF:OnDisable() end end +local function onEvent(self, event, ...) + if event == "PLAYER_REGEN_ENABLED" then + for _, t in pairs(self.ooc_queue) do + t.func(t.args); + end + if next(self.ooc_queue) ~= nil then + wipe(self.ooc_queue); + end + elseif event == "PLAYER_LOGIN" then + self:OnEnable(); + elseif event == "ADDON_LOADED" then + self:OnInitialize(); + end +end + SLASH_OMARF1 = "/omarf"; function SlashCmdList.OMARF(msg, editBox) local loaded, finished = IsAddOnLoaded("OmaRFConfig"); @@ -92,3 +109,8 @@ function SlashCmdList.OMARF(msg, editBox) InterfaceOptionsFrame_OpenToCategory(OmaRF.optionsFrames.Profile); InterfaceOptionsFrame_OpenToCategory(OmaRF.optionsFrames.Indicators); end + +OmaRF:RegisterEvent("ADDON_LOADED"); +OmaRF:RegisterEvent("PLAYER_LOGIN"); +OmaRF:RegisterEvent("PLAYER_REGEN_ENABLED"); +OmaRF:SetScript("OnEvent", onEvent);