OmaRF = LibStub("AceAddon-3.0"):NewAddon("OmaRF"); 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.majorFrames = {}; OmaRF.positions = { "TOPLEFT", "TOPRIGHT", "CENTER", "BOTTOMLEFT", "BOTTOMRIGHT" }; OmaRF.running = false; 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; for name, frame in pairs(self.frames) do for _, ind in pairs(frame) do ind.text:Hide(); ind.icon:Hide(); end for _, ind in ipairs(self.majorFrames[name]) do ind.icon:Hide(); ind.expire:Hide(); ind.stack:Hide(); end 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