/SpartanUI/tags
local addon, _ = LibStub("AceAddon-3.0"):NewAddon("SpartanUI"); |
local addon, _ = LibStub("AceAddon-3.0"):NewAddon("SpartanUI") |
---------------------------------------------------------------------------------------------------- |
addon.version = GetAddOnMetadata("SpartanUI", "version") |
addon.optionsMain = {name = "SpartanUI Main", type = "group", args = {}}; |
addon.optionsGeneral = {name = "SpartanUI General", type = "group", args = {}}; |
addon.optionsPlayerFrames = {name = "SpartanUI Player Frames", type = "group", args = {}}; |
addon.optionsPartyFrames = {name = "SpartanUI Party Frames", type = "group", args = {}}; |
addon.optionsRaidFrames = {name = "SpartanUI Raid Frames", type = "group", args = {}}; |
addon.optionsMain = {name = "SpartanUI Main", type = "group", args = {}} |
addon.optionsGeneral = {name = "SpartanUI General", type = "group", args = {}} |
addon.optionsPlayerFrames = {name = "SpartanUI Player Frames", type = "group", args = {}} |
addon.optionsPartyFrames = {name = "SpartanUI Party Frames", type = "group", args = {}} |
addon.optionsRaidFrames = {name = "SpartanUI Raid Frames", type = "group", args = {}} |
local fontdefault = {Size = 0, Face = "SpartanUI", Type = "outline"} |
local frameDefault1 = {moved=false;AuraDisplay=true,display=true,Debuffs="all",buffs="all",style="large",Auras={NumBuffs=5,NumDebuffs = 10,size = 20,spacing = 1,showType=true,onlyShowPlayer=false}} |
local frameDefault2 = {moved=false;AuraDisplay=true,display=true,Debuffs="all",buffs="all",style="medium",Auras={NumBuffs=0,NumDebuffs = 10,size = 15,spacing = 1,showType=true,onlyShowPlayer=false}} |
local fontdefault = {Size=0, Face="SpartanUI", Type="outline"} |
local frameDefault1 = {moved=false, AuraDisplay=true, display=true, Debuffs="all", buffs="all", style="large", Auras={NumBuffs=5, NumDebuffs = 10, size = 20, spacing = 1, showType=true, onlyShowPlayer=false}} |
local frameDefault2 = {moved=false, AuraDisplay=true, display=true, Debuffs="all", buffs="all", style="medium", Auras={NumBuffs=0, NumDebuffs = 10, size = 15, spacing = 1, showType=true, onlyShowPlayer=false}} |
local defaults = { |
Core = { |
local DBdefaults = {char = defaults, realm = defaults, class = defaults, profile = defaults} |
function addon:ResetConfig() |
addon.db:ResetProfile(false, true); |
ReloadUI(); |
addon.db:ResetProfile(false, true) |
ReloadUI() |
end |
function addon:OnInitialize() |
-- Profile setup. |
self.db = LibStub("AceDB-3.0"):New("SpartanUIDB", DBdefaults); |
self.db = LibStub("AceDB-3.0"):New("SpartanUIDB", DBdefaults) |
self.db.RegisterCallback(self, "OnNewProfile", "UpdateModuleConfigs") |
self.db.RegisterCallback(self, "OnProfileChanged", "UpdateModuleConfigs") |
self.db.RegisterCallback(self, "OnProfileCopied", "UpdateModuleConfigs") |
self.db.RegisterCallback(self, "OnProfileReset", "UpdateModuleConfigs") |
-- Create the options pane. |
self.Optionsprofile = LibStub("AceDBOptions-3.0"):GetOptionsTable(addon.db); |
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", |
self.Optionsprofile = LibStub("AceDBOptions-3.0"):GetOptionsTable(addon.db) |
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 |
}; |
} |
-- Add dual-spec support |
local LibDualSpec = LibStub('LibDualSpec-1.0') |
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", self.Optionsprofile); |
AceConfig:RegisterOptionsTable("Profiles", self.Optionsprofile) |
-- 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") |
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 "")) |