X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/6f9efe3aedbfb5f6be2277de730fa446d87bb4d7..8da63c020fd2f1367dbec400f8daf15fa8375b94:/OmaRF/Core.lua diff --git a/OmaRF/Core.lua b/OmaRF/Core.lua index 0b44b48..e0ecbd1 100644 --- a/OmaRF/Core.lua +++ b/OmaRF/Core.lua @@ -1,20 +1,26 @@ -OmaRF = LibStub("AceAddon-3.0"):NewAddon("OmaRF"); +local unpack, wipe, next, pairs, ipairs = unpack, wipe, next, pairs, ipairs; + +OmaRF = CreateFrame("Frame"); OmaRF.normalBarColor = CreateColor(0.3, 0.3, 0.3); OmaRF.dispelBarColor = CreateColor(1, 0.5, 0); OmaRF.normalBackColor = {0.7, 0.7, 0.7}; OmaRF.dispelBackColor = {0.5, 0.2, 0}; - -OmaRF.frames = {}; OmaRF.positions = { "TOPLEFT", "TOPRIGHT", "CENTER", "BOTTOMLEFT", "BOTTOMRIGHT" }; - OmaRF.running = false; +OmaRF.ooc_queue = {}; local defaults = { profile = { enabled = true, + majorAuras = { + auras = {"Aqua Bomb"}, + max = 3; + iconSize = 24, + textSize = 10, + }, indicators = { ['**'] = { auras = {}, @@ -45,11 +51,21 @@ end function OmaRF:OnDisable() self.running = false; - for _, frame in pairs(self.frames) do - for _, ind in pairs(frame) do - ind.text:SetText(""); - ind.icon:SetTexture(""); + self.frameBase:Hide(); +end + +local function onEvent(self, event, ...) + if event == "PLAYER_REGEN_ENABLED" then + for _, t in pairs(self.ooc_queue) do + t.func(unpack(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 @@ -80,3 +96,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);