|
function addon:OnEnable() |
-- Register option frames. |
local AceConfig = LibStub("AceConfig-3.0"); |
local AceConfig = LibStub("AceConfig-3.0") |
AceConfig:RegisterOptionsTable("SpartanUI Main", self.optionsMain) |
AceConfig:RegisterOptionsTable("SpartanUI General", self.optionsGeneral) |
if self:GetModule("PlayerFrames", true) then AceConfig:RegisterOptionsTable("SpartanUI Player Frames", self.optionsPlayerFrames) end |
if self:GetModule("PartyFrames", true) then AceConfig:RegisterOptionsTable("SpartanUI Party Frames", self.optionsPartyFrames) end |
if self:GetModule("RaidFrames", true) then AceConfig:RegisterOptionsTable("SpartanUI Raid Frames", self.optionsRaidFrames) end |
AceConfig:RegisterOptionsTable("Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)); |
AceConfig:RegisterOptionsTable("Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)) |
|
-- Create option dialogs. |
local AceConfigDialog = LibStub("AceConfigDialog-3.0"); |
local AceConfigDialog = LibStub("AceConfigDialog-3.0") |
AceConfigDialog:AddToBlizOptions("SpartanUI Main", "SpartanUI", nil) |
AceConfigDialog:AddToBlizOptions("SpartanUI General", "General", "SpartanUI") |
if self:GetModule("PlayerFrames", true) then AceConfigDialog:AddToBlizOptions("SpartanUI Player Frames", "Player Frames", "SpartanUI") end |
if self:GetModule("PartyFrames", true) then AceConfigDialog:AddToBlizOptions("SpartanUI Party Frames", "Party Frames", "SpartanUI") end |
if self:GetModule("RaidFrames", true) then AceConfigDialog:AddToBlizOptions("SpartanUI Raid Frames", "Raid Frames", "SpartanUI") end |
AceConfigDialog:AddToBlizOptions("Profiles", "Profiles", "SpartanUI"); |
AceConfigDialog:AddToBlizOptions("Profiles", "Profiles", "SpartanUI") |
|
-- Create the options pane. |
self.optionsMain.args["version"] = {name="SpartanUI Version: " .. self.version, order=0, type="header"}; |
-- Configure the "Main" options pane. |
self.optionsMain.args["version"] = {name="SpartanUI Version: " .. self.version, order=0, type="header"} |
self.optionsMain.args["reset"] = {name="Reset Database", type="execute", order=100, width="full", |
desc = "Will Reset the ENTIRE Database. This should fix 99% of Settings related issues.", |
func = function() |
if (InCombatLockdown()) then |
self:Print(ERR_NOT_IN_COMBAT); |
self:Print(ERR_NOT_IN_COMBAT) |
else |
self.db:ResetDB(); |
ReloadUI(); |
self.db:ResetDB() |
ReloadUI() |
end |
end |
}; |
} |
end |
|
function addon:Round(num, idp) |
local mult = 10^(idp or 0) |
return math.floor(num * mult + 0.5) / mult |
end; |
end |
|
function addon:Print(sMsg) |
DEFAULT_CHAT_FRAME:AddMessage("|cff33ff99" .. tostring(self) .. "|r: " .. tostring(sMsg or "")) |