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.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 = {}, textSize = 10, textColor = {1, 1, 1, 1}, mine = false, stack = true, showText = true, showIcon = true, useDefaultIcon = true, iconSize = 10, iconColor = {1, 1, 1, 1}, }, }, } }; function OmaRF:OnInitialize() self.db = LibStub("AceDB-3.0"):New("OmaRFDB", defaults); self.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig"); self.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig"); self.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig"); end function OmaRF:OnEnable() self:RefreshConfig(); end function OmaRF:OnDisable() self.running = false; 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 SLASH_OMARF1 = "/omarf"; function SlashCmdList.OMARF(msg, editBox) local loaded, finished = IsAddOnLoaded("OmaRFConfig"); if not loaded then local loaded, reason = LoadAddOn("OmaRFConfig"); if not loaded then if reason == "DISABLED" then print("OmaRFConfig is disabled"); elseif reason == "MISSING" then print("OmaRFConfig is missing"); elseif reason == "CORRUPT" then print("OmaRFConfig is corrupt"); elseif reason == "INCOMPATIBLE" then print("OmaRFConfig is incompatible"); elseif reason == "INTERFACE_VERSION" then print("OmaRFConfig has wrong interface version"); end return; end elseif not finished then -- slash command sent again when loading process is in progress return; end 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);