diff --git a/Interface/AddOns/SVUI/SVUI.lua b/Interface/AddOns/SVUI/SVUI.lua index 671bc42..ea2bf14 100644 --- a/Interface/AddOns/SVUI/SVUI.lua +++ b/Interface/AddOns/SVUI/SVUI.lua @@ -38,19 +38,31 @@ local floor = math.floor local tsort, tconcat = table.sort, table.concat; --[[ ########################################################## +GET ADDON DATA +########################################################## +]]-- +local SVUINameSpace, SVUICore = ...; +--[[ +########################################################## CONSTANTS ########################################################## ]]-- -SVUI_LIB, SVUI_LOCALE = {}, {} BINDING_HEADER_SVUI = GetAddOnMetadata(..., "Title"); SLASH_RELOADUI1="/rl" SLASH_RELOADUI2="/reloadui" SlashCmdList.RELOADUI=ReloadUI --[[ ########################################################## -LOCAL VARIABLES +LOCALS ########################################################## ]]-- +local bld = select(2,GetBuildInfo()); +local toonClass = select(2,UnitClass("player")); +local rez = GetCVar("gxResolution"); +local gxHeight = tonumber(match(rez,"%d+x(%d+)")); +local gxWidth = tonumber(match(rez,"(%d+)x%d+")); +local NewHook = hooksecurefunc; +local version = GetAddOnMetadata(..., "Version"); local callbacks = {}; local numCallbacks = 0; --[[ @@ -73,6 +85,164 @@ end local assert = enforce; --[[ ########################################################## +LOCAL FUNCTIONS +########################################################## +]]-- +local function formatValueString(text) + if "string" == type(text) then + text = gsub(text,"\n","\\n") + if match(gsub(text,"[^'\"]",""),'^"+$') then + return "'"..text.."'"; + else + return '"'..gsub(text,'"','\\"')..'"'; + end + else + return tostring(text); + end +end +local function formatKeyString(text) + if "string"==type(text) and match(text,"^[_%a][_%a%d]*$") then + return text; + else + return "["..formatValueString(text).."]"; + end +end +local function RegisterCallback(self, m, h) + assert(type(m) == "string" or type(m) == "function", "Bad argument #1 to :RegisterCallback (string or function expected)") + if type(m) == "string" then + assert(type(h) == "table", "Bad argument #2 to :RegisterCallback (table expected)") + assert(type(h[m]) == "function", "Bad argument #1 to :RegisterCallback (m \"" .. m .. "\" not found)") + m = h[m] + end + callbacks[m] = h or true + numCallbacks = numCallbacks + 1 +end +local function UnregisterCallback(self, m, h) + assert(type(m) == "string" or type(m) == "function", "Bad argument #1 to :UnregisterCallback (string or function expected)") + if type(m) == "string" then + assert(type(h) == "table", "Bad argument #2 to :UnregisterCallback (table expected)") + assert(type(h[m]) == "function", "Bad argument #1 to :UnregisterCallback (m \"" .. m .. "\" not found)") + m = h[m] + end + callbacks[m] = nil + numCallbacks = numCallbacks + 1 +end +local function DispatchCallbacks() + if (numCallbacks < 1) then return end + for m, h in pairs(callbacks) do + local ok, err = pcall(m, h ~= true and h or nil) + if not ok then + print("ERROR:", err) + end + end +end +--[[ +########################################################## +BUILD CLASS COLOR GLOBAL +########################################################## +]]-- +SVUI_CLASS_COLORS = {}; +do + local classes = {}; + local supercolors = { + ["HUNTER"] = { r = 0.454, g = 0.698, b = 0 }, + ["WARLOCK"] = { r = 0.286, g = 0, b = 0.788 }, + ["PRIEST"] = { r = 0.976, g = 1, b = 0.839 }, + ["PALADIN"] = { r = 0.956, g = 0.207, b = 0.733 }, + ["MAGE"] = { r = 0, g = 0.796, b = 1 }, + ["ROGUE"] = { r = 1, g = 0.894, b = 0.117 }, + ["DRUID"] = { r = 1, g = 0.513, b = 0 }, + ["SHAMAN"] = { r = 0, g = 0.38, b = 1 }, + ["WARRIOR"] = { r = 0.698, g = 0.36, b = 0.152 }, + ["DEATHKNIGHT"] = { r = 0.847, g = 0.117, b = 0.074 }, + ["MONK"] = { r = 0.015, g = 0.886, b = 0.38 }, + }; + for class in pairs(RAID_CLASS_COLORS) do + tinsert(classes, class) + end + tsort(classes) + setmetatable(SVUI_CLASS_COLORS,{ + __index = function(t, k) + if k == "RegisterCallback" then return RegisterCallback end + if k == "UnregisterCallback" then return UnregisterCallback end + if k == "DispatchCallbacks" then return DispatchCallbacks end + end + }); + for i, class in ipairs(classes) do + local color = supercolors[class] + local r, g, b = color.r, color.g, color.b + local hex = format("ff%02x%02x%02x", r * 255, g * 255, b * 255) + if not SVUI_CLASS_COLORS[class] or not SVUI_CLASS_COLORS[class].r or not SVUI_CLASS_COLORS[class].g or not SVUI_CLASS_COLORS[class].b then + SVUI_CLASS_COLORS[class] = { + r = r, + g = g, + b = b, + colorStr = hex, + } + end + end + classes = nil +end +--[[ +########################################################## +APPENDED GLOBAL FUNCTIONS +########################################################## +]]-- +function math.parsefloat(value,decimal) + if decimal and decimal > 0 then + local calc1 = 10 ^ decimal; + local calc2 = (value * calc1) + 0.5; + return floor(calc2) / calc1 + end + return floor(value + 0.5) +end + +function table.dump(targetTable) + local dumpTable = {}; + local dumpCheck = {}; + for key,value in ipairs(targetTable) do + tinsert(dumpTable, formatValueString(value)); + dumpCheck[key] = true; + end + for key,value in pairs(targetTable) do + if not dumpCheck[key] then + tinsert(dumpTable, "\n "..formatKeyString(key).." = "..formatValueString(value)); + end + end + local output = tconcat(dumpTable, ", "); + return "{ "..output.." }"; +end + +function table.copy(targetTable,deepCopy,mergeTable) + mergeTable = mergeTable or {}; + if targetTable==nil then return nil end + if mergeTable[targetTable] then return mergeTable[targetTable] end + local replacementTable = {} + for key,value in pairs(targetTable)do + if deepCopy and type(value) == "table" then + replacementTable[key] = table.copy(value, deepCopy, mergeTable) + else + replacementTable[key] = value + end + end + setmetatable(replacementTable, table.copy(getmetatable(targetTable), deepCopy, mergeTable)) + mergeTable[targetTable] = replacementTable; + return replacementTable +end + +function string.trim(this) + return this:find'^%s*$' and '' or this:match'^%s*(.*%S)' +end + +function string.color(this,color) + return "|cff"..color..this.."|r"; +end + +function string.link(this,prefix,text,color) + return "|H"..prefix..":"..tostring(text).."|h"..tostring(this):color(color or"ffffff").."|h"; +end +--[[ +########################################################## OBJECT CONSTRUCTOR GLOBAL ########################################################## ]]-- @@ -158,9 +328,6 @@ local function SetPrototype(obj, name, parent) setmetatable( obj, addonmeta ) obj.__namekey = name obj.__owner = parent - if(parent.db[name]) then - obj.db = parent.db[name] - end obj.initialized = false obj.CombatLocked = false obj.ChangeDBVar = changeDBVar @@ -191,7 +358,7 @@ local Registry_NewPackage = function(self, obj, name, priority) self.Packages[#self.Packages+1] = name self.__owner[name] = SetPrototype(obj, name, self.__owner) - if(self.__owner.CoreEnabled) then + if(self.__owner.AddonLaunched) then if(self.__owner[name].Load) then self.__owner[name]:Load() end @@ -248,6 +415,9 @@ end local Registry_Update = function(self, name, dataOnly) local obj = self.__owner[name] if obj then + if self.__owner.db[name] then + obj.db = self.__owner.db[name] + end if obj.ReLoad and not dataOnly then obj:ReLoad() end @@ -258,13 +428,16 @@ local Registry_UpdateAll = function(self) local list = self.Packages for _,name in pairs(list) do local obj = self.__owner[name] + if self.__owner.db[name] then + obj.db = self.__owner.db[name] + end if obj and obj.ReLoad then obj:ReLoad() end end end -local Registry_Lights = function(self) +local Registry_PreLoad = function(self) if not PreLoadQueue then return end for i=1,#PreLoadQueue do local name = PreLoadQueue[i] @@ -283,7 +456,7 @@ local Registry_Lights = function(self) PreLoadQueue = nil end -local Registry_Camera = function(self) +local Registry_Load = function(self) if not InitQueue then return end for i=1,#InitQueue do local name = InitQueue[i] @@ -300,9 +473,7 @@ local Registry_Camera = function(self) end end InitQueue = nil -end -local Registry_Action = function(self) if not PostLoadQueue then return end for i=1, #PostLoadQueue do local fn = PostLoadQueue[i] @@ -334,17 +505,16 @@ local AppendRegistry = function(obj, major, minor) RunCallbacks = Registry_RunCallbacks, Update = Registry_Update, UpdateAll = Registry_UpdateAll, - Lights = Registry_Lights, - Camera = Registry_Camera, - Action = Registry_Action + PreLoadPackages = Registry_PreLoad, + LoadPackages = Registry_Load } local mt = {__tostring = rootstring} setmetatable(methods, mt) return methods end -function SVUI_LIB:SetObject(major, minor, registry) - local obj = {} +local function SetAddonObject(major, minor, obj) + obj = obj or {} obj.__namekey = major obj.version = minor local mt = {} @@ -354,14 +524,12 @@ function SVUI_LIB:SetObject(major, minor, registry) end mt.__tostring = rootstring setmetatable(obj, mt) - if(registry) then - obj.Registry = AppendRegistry(obj, major, minor) - end + obj.Registry = AppendRegistry(obj, major, minor) return obj end --[[ ########################################################## -LOCALIZATION GLOBAL +BUILD ADDON OBJECTS, CREATE GLOBAL NAMESPACE ########################################################## ]]-- local failsafe = function() assert(false) end @@ -373,199 +541,52 @@ local metaread = { end } -local activeLocale +local localized = setmetatable({}, metaread) -local defaultwrite = setmetatable({}, { - __newindex = function(self, key, value) - if not rawget(activeLocale, key) then - rawset(activeLocale, key, value == true and key or value) - end - end, - __index = failsafe -}) +local core = { + db = {}, + snaps = {}, + Media = {}, + DisplayAudit = {}, + DynamicOptions = {}, + Dispellable = {}, +} -local metawrite = setmetatable({}, { +core.fubar = function() return end +core.Options = { type = "group", name = "|cff339fffConfig-O-Matic|r", args = {} }; + +core.class = toonClass; +core.mult = 1; +core.ClassRole = ""; +core.name = UnitName("player"); +core.realm = GetRealmName(); +core.build = tonumber(bld); +core.guid = UnitGUID('player'); +core.ConfigurationMode = false; + +core.snaps[#core.snaps + 1] = core.UIParent; +core.UIParent = CreateFrame("Frame", "SVUIParent", UIParent); +core.UIParent:SetFrameLevel(UIParent:GetFrameLevel()); +core.UIParent:SetPoint("CENTER", UIParent, "CENTER"); +core.UIParent:SetSize(UIParent:GetSize()); +core.Cloaked = CreateFrame("Frame", nil, UIParent); +core.Cloaked:Hide(); + +SVUICore[1] = SetAddonObject(SVUINameSpace, version, core, true) + +SVUICore[2] = setmetatable({}, { __newindex = function(self, key, value) - rawset(activeLocale, key, value == true and key or value) + if not rawget(localized, key) then + rawset(localized, key, value == true and key or value) + end end, __index = failsafe }) -function SVUI_LOCALE:SetLocalStrings(locale, isDefault) - local gameLocale = GetLocale() - if gameLocale == "enGB" then gameLocale = "enUS" end - - if not SVUI_LOCALE["LANG"] then - SVUI_LOCALE["LANG"] = setmetatable({}, metaread) - end - - activeLocale = SVUI_LOCALE["LANG"] - - if isDefault then - return defaultwrite - elseif(locale == GAME_LOCALE or locale == gameLocale) then - return metawrite - end -end - -function SVUI_LOCALE:SetObject() - return SVUI_LOCALE["LANG"] -end ---[[ -########################################################## -LOCAL FUNCTIONS -########################################################## -]]-- -local function formatValueString(text) - if "string" == type(text) then - text = gsub(text,"\n","\\n") - if match(gsub(text,"[^'\"]",""),'^"+$') then - return "'"..text.."'"; - else - return '"'..gsub(text,'"','\\"')..'"'; - end - else - return tostring(text); - end -end -local function formatKeyString(text) - if "string"==type(text) and match(text,"^[_%a][_%a%d]*$") then - return text; - else - return "["..formatValueString(text).."]"; - end -end -local function RegisterCallback(self, m, h) - assert(type(m) == "string" or type(m) == "function", "Bad argument #1 to :RegisterCallback (string or function expected)") - if type(m) == "string" then - assert(type(h) == "table", "Bad argument #2 to :RegisterCallback (table expected)") - assert(type(h[m]) == "function", "Bad argument #1 to :RegisterCallback (m \"" .. m .. "\" not found)") - m = h[m] - end - callbacks[m] = h or true - numCallbacks = numCallbacks + 1 -end -local function UnregisterCallback(self, m, h) - assert(type(m) == "string" or type(m) == "function", "Bad argument #1 to :UnregisterCallback (string or function expected)") - if type(m) == "string" then - assert(type(h) == "table", "Bad argument #2 to :UnregisterCallback (table expected)") - assert(type(h[m]) == "function", "Bad argument #1 to :UnregisterCallback (m \"" .. m .. "\" not found)") - m = h[m] - end - callbacks[m] = nil - numCallbacks = numCallbacks + 1 -end -local function DispatchCallbacks() - if (numCallbacks < 1) then return end - for m, h in pairs(callbacks) do - local ok, err = pcall(m, h ~= true and h or nil) - if not ok then - print("ERROR:", err) - end - end -end ---[[ -########################################################## -BUILD CLASS COLOR GLOBAL -########################################################## -]]-- -SVUI_CLASS_COLORS = {}; -do - local classes = {}; - local supercolors = { - ["HUNTER"] = { r = 0.454, g = 0.698, b = 0 }, - ["WARLOCK"] = { r = 0.286, g = 0, b = 0.788 }, - ["PRIEST"] = { r = 0.976, g = 1, b = 0.839 }, - ["PALADIN"] = { r = 0.956, g = 0.207, b = 0.733 }, - ["MAGE"] = { r = 0, g = 0.796, b = 1 }, - ["ROGUE"] = { r = 1, g = 0.894, b = 0.117 }, - ["DRUID"] = { r = 1, g = 0.513, b = 0 }, - ["SHAMAN"] = { r = 0, g = 0.38, b = 1 }, - ["WARRIOR"] = { r = 0.698, g = 0.36, b = 0.152 }, - ["DEATHKNIGHT"] = { r = 0.847, g = 0.117, b = 0.074 }, - ["MONK"] = { r = 0.015, g = 0.886, b = 0.38 }, - }; - for class in pairs(RAID_CLASS_COLORS) do - tinsert(classes, class) - end - tsort(classes) - setmetatable(SVUI_CLASS_COLORS,{ - __index = function(t, k) - if k == "RegisterCallback" then return RegisterCallback end - if k == "UnregisterCallback" then return UnregisterCallback end - if k == "DispatchCallbacks" then return DispatchCallbacks end - end - }); - for i, class in ipairs(classes) do - local color = supercolors[class] - local r, g, b = color.r, color.g, color.b - local hex = format("ff%02x%02x%02x", r * 255, g * 255, b * 255) - if not SVUI_CLASS_COLORS[class] or not SVUI_CLASS_COLORS[class].r or not SVUI_CLASS_COLORS[class].g or not SVUI_CLASS_COLORS[class].b then - SVUI_CLASS_COLORS[class] = { - r = r, - g = g, - b = b, - colorStr = hex, - } - end - end - classes = nil -end ---[[ -########################################################## -APPENDED GLOBAL FUNCTIONS -########################################################## -]]-- -function math.parsefloat(value,decimal) - if decimal and decimal > 0 then - local calc1 = 10 ^ decimal; - local calc2 = (value * calc1) + 0.5; - return floor(calc2) / calc1 - end - return floor(value + 0.5) -end - -function table.dump(targetTable) - local dumpTable = {}; - local dumpCheck = {}; - for key,value in ipairs(targetTable) do - tinsert(dumpTable, formatValueString(value)); - dumpCheck[key] = true; - end - for key,value in pairs(targetTable) do - if not dumpCheck[key] then - tinsert(dumpTable, "\n "..formatKeyString(key).." = "..formatValueString(value)); - end - end - local output = tconcat(dumpTable, ", "); - return "{ "..output.." }"; -end - -function table.copy(targetTable,deepCopy,mergeTable) - mergeTable = mergeTable or {}; - if targetTable==nil then return nil end - if mergeTable[targetTable] then return mergeTable[targetTable] end - local replacementTable = {} - for key,value in pairs(targetTable)do - if deepCopy and type(value) == "table" then - replacementTable[key] = table.copy(value, deepCopy, mergeTable) - else - replacementTable[key] = value - end - end - setmetatable(replacementTable, table.copy(getmetatable(targetTable), deepCopy, mergeTable)) - mergeTable[targetTable] = replacementTable; - return replacementTable -end - -function string.trim(this) - return this:find'^%s*$' and '' or this:match'^%s*(.*%S)' -end - -function string.color(this,color) - return "|cff"..color..this.."|r"; -end +SVUICore[3] = { + Accountant = {}, + profiles = {}, + profileKeys = {}, +} -function string.link(this,prefix,text,color) - return "|H"..prefix..":"..tostring(text).."|h"..tostring(this):color(color or"ffffff").."|h"; -end \ No newline at end of file +_G[SVUINameSpace] = SVUICore; \ No newline at end of file diff --git a/Interface/AddOns/SVUI/SVUI.toc b/Interface/AddOns/SVUI/SVUI.toc index c677785..7407852 100644 --- a/Interface/AddOns/SVUI/SVUI.toc +++ b/Interface/AddOns/SVUI/SVUI.toc @@ -3,8 +3,8 @@ ## Version: 4.074 ## Title: |cffFF9900SVUI|r ## Notes: Supervillain UI [|cff9911FFCore Framework|r]. -## SavedVariables: SVUI_Global, SVUI_AuraFilters -## SavedVariablesPerCharacter: SVUI_Profile, SVUI_Cache, SVUI_AuraWatch +## SavedVariables: SVUI_Global +## SavedVariablesPerCharacter: SVUI_Profile, SVUI_Cache ## OptionalDeps: Blizzard_DebugTools, Blizzard_PetJournal, SharedMedia ## X-oUF: oUF_SuperVillain ## X-Notes: Special thanks to Elv and Tukz for their incredible work. diff --git a/Interface/AddOns/SVUI/language/chinese_ui.lua b/Interface/AddOns/SVUI/language/chinese_ui.lua index 161cf12..cab3c23 100644 --- a/Interface/AddOns/SVUI/language/chinese_ui.lua +++ b/Interface/AddOns/SVUI/language/chinese_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("zhCN"); -if not L then return end +if not GetLocale() == "zhCN" then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/language/english_ui.lua b/Interface/AddOns/SVUI/language/english_ui.lua index d738f02..3838fce 100644 --- a/Interface/AddOns/SVUI/language/english_ui.lua +++ b/Interface/AddOns/SVUI/language/english_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("enUS", true); -if not L then return; end +if not GetLocale() == "enUS" then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/language/french_ui.lua b/Interface/AddOns/SVUI/language/french_ui.lua index fa1e4da..e633d1c 100644 --- a/Interface/AddOns/SVUI/language/french_ui.lua +++ b/Interface/AddOns/SVUI/language/french_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("frFR"); -if not L then return; end +if not GetLocale() == "frFR" then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/language/german_ui.lua b/Interface/AddOns/SVUI/language/german_ui.lua index 9c50f3b..d05ffe8 100644 --- a/Interface/AddOns/SVUI/language/german_ui.lua +++ b/Interface/AddOns/SVUI/language/german_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("deDE"); -if not L then return end +if not GetLocale() == "deDE" then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/language/italian_ui.lua b/Interface/AddOns/SVUI/language/italian_ui.lua index e162c3a..5538c25 100644 --- a/Interface/AddOns/SVUI/language/italian_ui.lua +++ b/Interface/AddOns/SVUI/language/italian_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("itIT"); -if not L then return; end +if not GetLocale() == "itIT" then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/language/korean_ui.lua b/Interface/AddOns/SVUI/language/korean_ui.lua index 54da9cc..d408741 100644 --- a/Interface/AddOns/SVUI/language/korean_ui.lua +++ b/Interface/AddOns/SVUI/language/korean_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("koKR"); -if not L then return; end +if not GetLocale() == "koKR" then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/language/portuguese_ui.lua b/Interface/AddOns/SVUI/language/portuguese_ui.lua index b1ebfaf..d992e10 100644 --- a/Interface/AddOns/SVUI/language/portuguese_ui.lua +++ b/Interface/AddOns/SVUI/language/portuguese_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("ptBR"); -if not L then return; end +if not GetLocale() == "ptBR" then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/language/russian_ui.lua b/Interface/AddOns/SVUI/language/russian_ui.lua index 70eec70..6d4d69e 100644 --- a/Interface/AddOns/SVUI/language/russian_ui.lua +++ b/Interface/AddOns/SVUI/language/russian_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("ruRU"); -if not L then return; end +if not GetLocale() == "ruRU" then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/language/spanish_ui.lua b/Interface/AddOns/SVUI/language/spanish_ui.lua index a0dbf10..e23faeb 100644 --- a/Interface/AddOns/SVUI/language/spanish_ui.lua +++ b/Interface/AddOns/SVUI/language/spanish_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("esES") or SVUI_LOCALE:SetLocalStrings("esMX"); -if not L then return; end +if(not GetLocale() == "esES" and (not GetLocale() == "esMX")) then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/language/taiwanese_ui.lua b/Interface/AddOns/SVUI/language/taiwanese_ui.lua index 97d4adf..dedcb6e 100644 --- a/Interface/AddOns/SVUI/language/taiwanese_ui.lua +++ b/Interface/AddOns/SVUI/language/taiwanese_ui.lua @@ -1,5 +1,5 @@ -local L = SVUI_LOCALE:SetLocalStrings("zhTW"); -if not L then return; end +if not GetLocale() == "zhTW" then return; end +local SuperVillain, L, G = unpack(select(2, ...)); --[[REACTION TEXTS]]-- L[" is drinking."] = true; L["Leeeeeroy!"] = true; diff --git a/Interface/AddOns/SVUI/packages/plates/SVPlate.lua b/Interface/AddOns/SVUI/packages/plates/SVPlate.lua index 1d3a50e..b42792a 100644 --- a/Interface/AddOns/SVUI/packages/plates/SVPlate.lua +++ b/Interface/AddOns/SVUI/packages/plates/SVPlate.lua @@ -1523,7 +1523,7 @@ function MOD:UpdateDataLocals() AuraFOutline = db.auras.fontOutline; AuraMaxCount = db.auras.numAuras; AuraFilterName = db.auras.additionalFilter - AuraFilter = SuperVillain.Filters[AuraFilterName] + AuraFilter = SuperVillain.db.filter[AuraFilterName] if (db.comboPoints and (SuperVillain.class == 'ROGUE' or SuperVillain.class == 'DRUID')) then MOD.UseCombo = true diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua index aec377e..4a1a4f9 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua @@ -335,9 +335,9 @@ function MOD:RefreshUnitFrames() if raidDebuffs then raidDebuffs:ResetDebuffData() if groupType == "party" or groupType == "raid" then - raidDebuffs:RegisterDebuffs(SuperVillain.Filters["Raid"]) + raidDebuffs:RegisterDebuffs(SuperVillain.db.filter["Raid"]) else - raidDebuffs:RegisterDebuffs(SuperVillain.Filters["CC"]) + raidDebuffs:RegisterDebuffs(SuperVillain.db.filter["CC"]) end end for _,group in pairs(self.Headers) do @@ -1166,7 +1166,7 @@ local attrOverride = { } function MOD:UpdateGroupConfig(headerFrame, setForced) - if InCombatLockdown()then return end + if InCombatLockdown() then return end SetProxyEnv() local key = headerFrame.___groupkey @@ -1285,8 +1285,8 @@ function MOD:PLAYER_REGEN_DISABLED() end function MOD:PLAYER_REGEN_ENABLED() - self:RefreshUnitFrames() self:UnregisterEvent("PLAYER_REGEN_ENABLED"); + self:RefreshUnitFrames() end function MOD:ADDON_LOADED(event, addon) @@ -1326,7 +1326,7 @@ function MOD:Load() self:RegisterEvent("PLAYER_REGEN_DISABLED") if(self.db.disableBlizzard) then - self:KillBlizzardRaidFrames() + --self:KillBlizzardRaidFrames() NewHook("CompactUnitFrame_RegisterEvents", CompactUnitFrame_UnregisterEvents) NewHook("UnitFrameThreatIndicator_Initialize", UnitFrameThreatIndicator_Hook) diff --git a/Interface/AddOns/SVUI/packages/unit/elements/auras.lua b/Interface/AddOns/SVUI/packages/unit/elements/auras.lua index 98f0227..3cb606c 100644 --- a/Interface/AddOns/SVUI/packages/unit/elements/auras.lua +++ b/Interface/AddOns/SVUI/packages/unit/elements/auras.lua @@ -84,7 +84,7 @@ local AuraRemover_OnClick = function(self) local name = self.name; if name then SuperVillain:AddonMessage((L["The spell '%s' has been added to the Blocked unitframe aura filter."]):format(name)) - SuperVillain.Filters["Blocked"][name] = {["enable"] = true, ["priority"] = 0}; + SuperVillain.db.filter["Blocked"][name] = {["enable"] = true, ["priority"] = 0} MOD:RefreshUnitFrames() end end @@ -93,8 +93,8 @@ local AuraBarRemover_OnClick = function(self) if not IsShiftKeyDown() then return end local name = self:GetParent().aura.name if name then - SuperVillain:AddonMessage(format(L["The spell '%s' has been added to the Blocked unitframe aura filter."], name)) - SuperVillain.Filters["Blocked"][name] = {["enable"] = true, ["priority"] = 0} + SuperVillain:AddonMessage((L["The spell '%s' has been added to the Blocked unitframe aura filter."]):format(name)) + SuperVillain.db.filter["Blocked"][name] = {["enable"] = true, ["priority"] = 0} MOD:RefreshUnitFrames() end end @@ -110,11 +110,13 @@ local PostCreateAuraIcon = function(self, aura) aura.cd:SetReverse() aura.overlay:SetTexture(nil) aura.stealable:SetTexture(nil) + if aura.styled then return end if aura.SetNormalTexture then aura:SetNormalTexture("") end if aura.SetHighlightTexture then aura:SetHighlightTexture("") end if aura.SetPushedTexture then aura:SetPushedTexture("") end if aura.SetDisabledTexture then aura:SetDisabledTexture("") end + aura:SetBackdrop({ bgFile = [[Interface\BUTTONS\WHITE8X8]], tile = false, @@ -145,7 +147,7 @@ local ColorizeAuraBars = function(self) local color local spellName = auraBar.statusBar.aura.name; local spellID = auraBar.statusBar.aura.spellID; - if(SuperVillain.Filters["Shield"][spellName]) then + if(SuperVillain.db.filter["Shield"][spellName]) then color = oUF_SuperVillain.colors.shield_bars elseif(SuperVillain.db.media.unitframes.spellcolor[spellName]) then color = SuperVillain.db.media.unitframes.spellcolor[spellName] @@ -298,7 +300,7 @@ do icon.name = name; icon.priority = 0; - local shieldSpell = SuperVillain.Filters["Shield"][name] + local shieldSpell = SuperVillain.db.filter["Shield"][name] if shieldSpell and shieldSpell.enable then icon.priority = shieldSpell.priority end @@ -329,14 +331,14 @@ do pass = true end if _test(auraDB.useBlocked, friendly) then - local blackListSpell = SuperVillain.Filters["Blocked"][name] + local blackListSpell = SuperVillain.db.filter["Blocked"][name] if blackListSpell and blackListSpell.enable then filtered = false end pass = true end if _test(auraDB.useAllowed, friendly) then - local whiteListSpell = SuperVillain.Filters["Allowed"][name] + local whiteListSpell = SuperVillain.db.filter["Allowed"][name] if whiteListSpell and whiteListSpell.enable then filtered = true; icon.priority = whiteListSpell.priority @@ -346,8 +348,8 @@ do pass = true end local active = auraDB.useFilter - if active and active ~= "" and SuperVillain.Filters[active] then - local spellDB = SuperVillain.Filters[active]; + if active and active ~= "" and SuperVillain.db.filter[active] then + local spellDB = SuperVillain.db.filter[active]; if active ~= "Blocked" then if spellDB[name] and spellDB[name].enable and fromPlayer then filtered = true; @@ -404,12 +406,12 @@ do pass = true end if _test(barDB.filterBlocked, friendly) then - local blackList = SuperVillain.Filters["Blocked"][name] + local blackList = SuperVillain.db.filter["Blocked"][name] if blackList and blackList.enable then filtered = false end pass = true end if _test(barDB.filterAllowed, friendly) then - local whiteList = SuperVillain.Filters["Allowed"][name] + local whiteList = SuperVillain.db.filter["Allowed"][name] if whiteList and whiteList.enable then filtered = true elseif not pass then @@ -418,8 +420,8 @@ do pass = true end local active = barDB.useFilter - if active and active ~= "" and SuperVillain.Filters[active] then - local spellsDB = SuperVillain.Filters[active]; + if active and active ~= "" and SuperVillain.db.filter[active] then + local spellsDB = SuperVillain.db.filter[active]; if active ~= "Blocked" then if spellsDB[name] and spellsDB[name].enable and fromPlayer then filtered = true @@ -552,7 +554,7 @@ function MOD:UpdateAuraWatch(frame, key, override) local AW = frame.AuraWatch local WATCH_CACHE = {} if not MOD.db[key] then return end - local db = MOD.db[key].buffIndicator + local db = MOD.db[key].auraWatch if not db then return end if not db.enable then @@ -565,7 +567,7 @@ function MOD:UpdateAuraWatch(frame, key, override) local bwSize = db.size; if key == "pet" and not override then - local petBW = SuperVillain.Filters["PetBuffWatch"] + local petBW = SuperVillain.db.filter["PetBuffWatch"] if(petBW) then for _, buff in pairs(petBW)do if buff.style == "text" then @@ -575,7 +577,7 @@ function MOD:UpdateAuraWatch(frame, key, override) end end else - local unitBW = SuperVillain.Filters["BuffWatch"][SuperVillain.class] + local unitBW = SuperVillain.db.filter["BuffWatch"][SuperVillain.class] if(unitBW) then for _, buff in pairs(unitBW)do if buff.style == "text" then diff --git a/Interface/AddOns/SVUI/packages/unit/frames.lua b/Interface/AddOns/SVUI/packages/unit/frames.lua index 4586c8e..834d490 100644 --- a/Interface/AddOns/SVUI/packages/unit/frames.lua +++ b/Interface/AddOns/SVUI/packages/unit/frames.lua @@ -133,20 +133,7 @@ local UpdateTargetGlow = function(self) end --[[ ########################################################## -███████╗████████╗ █████╗ ███╗ ██╗██████╗ █████╗ ██████╗ ██████╗ -██╔════╝╚══██╔══╝██╔══██╗████╗ ██║██╔══██╗██╔══██╗██╔══██╗██╔══██╗ -███████╗ ██║ ███████║██╔██╗ ██║██║ ██║███████║██████╔╝██║ ██║ -╚════██║ ██║ ██╔══██║██║╚██╗██║██║ ██║██╔══██║██╔══██╗██║ ██║ -███████║ ██║ ██║ ██║██║ ╚████║██████╔╝██║ ██║██║ ██║██████╔╝ -╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ - -██╗ ██╗███╗ ██╗██╗████████╗███████╗ -██║ ██║████╗ ██║██║╚══██╔══╝██╔════╝ -██║ ██║██╔██╗ ██║██║ ██║ ███████╗ -██║ ██║██║╚██╗██║██║ ██║ ╚════██║ -╚██████╔╝██║ ╚████║██║ ██║ ███████║ - ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚══════╝ -########################################################## +STANDARD UNITS ########################################################## PLAYER ########################################################## @@ -1086,21 +1073,8 @@ function MOD:SetEnemyFrames(key, maxCount) end end --[[ -################################################################## -██╗ ██╗███████╗ █████╗ ██████╗ ███████╗██████╗ -██║ ██║██╔════╝██╔══██╗██╔══██╗██╔════╝██╔══██╗ -███████║█████╗ ███████║██║ ██║█████╗ ██████╔╝ -██╔══██║██╔══╝ ██╔══██║██║ ██║██╔══╝ ██╔══██╗ -██║ ██║███████╗██║ ██║██████╔╝███████╗██║ ██║ -╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝ - -███████╗██████╗ █████╗ ███╗ ███╗███████╗███████╗ -██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██╔════╝ -█████╗ ██████╔╝███████║██╔████╔██║█████╗ ███████╗ -██╔══╝ ██╔══██╗██╔══██║██║╚██╔╝██║██╔══╝ ╚════██║ -██║ ██║ ██║██║ ██║██║ ╚═╝ ██║███████╗███████║ -╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝ -################################################################## +########################################################## +HEADER UNITS ########################################################## HEADER FRAME HELPERS ########################################################## diff --git a/Interface/AddOns/SVUI/system/_load.xml b/Interface/AddOns/SVUI/system/_load.xml index 04fb5ce..a153d8c 100644 --- a/Interface/AddOns/SVUI/system/_load.xml +++ b/Interface/AddOns/SVUI/system/_load.xml @@ -1,7 +1,7 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> <Script file='system.lua'/> <Script file='database.lua'/> - <Script file='filters.lua'/> + <!-- <Script file='filters.lua'/> --> <Script file='screen.lua'/> <Script file='visibility.lua'/> <Script file='utilities.lua'/> diff --git a/Interface/AddOns/SVUI/system/database.lua b/Interface/AddOns/SVUI/system/database.lua index 26a4036..0080585 100644 --- a/Interface/AddOns/SVUI/system/database.lua +++ b/Interface/AddOns/SVUI/system/database.lua @@ -52,7 +52,7 @@ local assert = enforce; GET ADDON DATA ########################################################## ]]-- -local SuperVillain, L = unpack(select(2, ...)); +local SuperVillain, L, G = unpack(select(2, ...)); local realm = GetRealmName() local name = UnitName("player") local pkey = name .. " - " .. realm @@ -200,7 +200,8 @@ local rez = GetCVar("gxResolution"); local gxWidth = tonumber(match(rez,"(%d+)x%d+")); local bw = gxWidth * 0.5 local statBarWidth = max(bw, 600) -local DatabaseDefaults = { + +local DefaultSettings = { ["copyKey"] = pkey, ["profileKey"] = pkey, ["framelocations"] = {}, @@ -293,7 +294,7 @@ local DatabaseDefaults = { [SpellName(86659)] = {0.98, 0.57, 0.11}, --Guardian of Ancient Kings } } - }, + }, ["SVAura"] = { ["enable"] = true, ["disableBlizzard"] = true, @@ -1905,7 +1906,7 @@ local DatabaseDefaults = { ["castingColor"] = {0.8, 0.8, 0}, ["sparkColor"] = {1, 0.72, 0}, }, - ["buffIndicator"] = + ["auraWatch"] = { ["enable"] = true, ["size"] = 8, @@ -2465,7 +2466,7 @@ local DatabaseDefaults = { ["yOffset"] = 0, ["sizeOverride"] = 0, }, - ["buffIndicator"] = + ["auraWatch"] = { ["enable"] = true, ["size"] = 8, @@ -2640,7 +2641,7 @@ local DatabaseDefaults = { ["yOffset"] = 0, ["sizeOverride"] = 0, }, - ["buffIndicator"] = + ["auraWatch"] = { ["enable"] = true, ["size"] = 8, @@ -2789,7 +2790,7 @@ local DatabaseDefaults = { ["yOffset"] = 0, ["sizeOverride"] = 0, }, - ["buffIndicator"] = + ["auraWatch"] = { ["enable"] = true, ["size"] = 8, @@ -2946,7 +2947,7 @@ local DatabaseDefaults = { ["xOffset"] = 0, ["yOffset"] = 2, }, - ["buffIndicator"] = + ["auraWatch"] = { ["enable"] = true, ["size"] = 8, @@ -3078,7 +3079,7 @@ local DatabaseDefaults = { ["yOffset"] = 0, ["sizeOverride"] = 0, }, - ["buffIndicator"] = + ["auraWatch"] = { ["enable"] = true, ["size"] = 8, @@ -3217,95 +3218,594 @@ local DatabaseDefaults = { }, } }, - ["SVStyle"] = { - ["blizzard"] = { - ["enable"] = true, - ["bags"] = true, - ["bmah"] = true, - ["reforge"] = true, - ["calendar"] = true, - ["achievement"] = true, - ["lfguild"] = true, - ["inspect"] = true, - ["binding"] = true, - ["gbank"] = true, - ["archaeology"] = true, - ["guildcontrol"] = true, - ["gossip"] = true, - ["guild"] = true, - ["tradeskill"] = true, - ["raid"] = false, - ["talent"] = true, - ["auctionhouse"] = true, - ["barber"] = true, - ["macro"] = true, - ["debug"] = true, - ["trainer"] = true, - ["socket"] = true, - ["loot"] = true, - ["alertframes"] = true, - ["bgscore"] = true, - ["merchant"] = true, - ["mail"] = true, - ["help"] = true, - ["trade"] = true, - ["gossip"] = true, - ["greeting"] = true, - ["worldmap"] = true, - ["taxi"] = true, - ["quest"] = true, - ["petition"] = true, - ["dressingroom"] = true, - ["pvp"] = true, - ["lfg"] = true, - ["nonraid"] = true, - ["friends"] = true, - ["spellbook"] = true, - ["character"] = true, - ["misc"] = true, - ["tabard"] = true, - ["guildregistrar"] = true, - ["timemanager"] = true, - ["encounterjournal"] = true, - ["voidstorage"] = true, - ["transmogrify"] = true, - ["stable"] = true, - ["bgmap"] = true, - ["mounts"] = true, - ["petbattleui"] = true, - ["losscontrol"] = true, - ["itemUpgrade"] = true, - }, - ["addons"] = { - ["enable"] = true, - ["Skada"] = true, - ["Recount"] = true, - ["AuctionLite"] = true, - ["AtlasLoot"] = true, - ["SexyCooldown"] = true, - ["Lightheaded"] = true, - ["Outfitter"] = true, - ["WeakAuras"] = true, - ["Quartz"] = true, - ["TomTom"] = true, - ["TinyDPS"] = true, - ["Clique"] = true, - ["CoolLine"] = true, - ["ACP"] = true, - ["DXE"] = true, - ["MogIt"] = true, - ["alDamageMeter"] = true, - ["Omen"] = true, - ["TradeSkillDW"] = true, - } - }, + ["filter"] = { + ["CC"] = {}, + ["Shield"] = {}, + ["Player"] = {}, + ["Blocked"] = {}, + ["Allowed"] = {}, + ["Strict"] = {}, + ["Raid"] = {}, + } +} +--[[ +########################################################## +CONSTRUCT FILTER DEFAULTS +########################################################## +]]-- +local CLASS_WATCH_INDEX = { + PRIEST = { + {-- Weakened Soul + ["enabled"] = true, + ["id"] = 6788, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 1, ["g"] = 0, ["b"] = 0}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Prayer of Mending + ["enabled"] = true, + ["id"] = 41635, + ["point"] = "BOTTOMRIGHT", + ["color"] = {["r"] = 0.2, ["g"] = 0.7, ["b"] = 0.2}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Renew + ["enabled"] = true, + ["id"] = 139, + ["point"] = "BOTTOMLEFT", + ["color"] = {["r"] = 0.4, ["g"] = 0.7, ["b"] = 0.2}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Power Word: Shield + ["enabled"] = true, + ["id"] = 17, + ["point"] = "TOPLEFT", + ["color"] = {["r"] = 0.81, ["g"] = 0.85, ["b"] = 0.1}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Power Word: Shield Power Insight + ["enabled"] = true, + ["id"] = 123258, + ["point"] = "TOPLEFT", + ["color"] = {["r"] = 0.81, ["g"] = 0.85, ["b"] = 0.1}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Power Infusion + ["enabled"] = true, + ["id"] = 10060, + ["point"] = "RIGHT", + ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Guardian Spirit + ["enabled"] = true, + ["id"] = 47788, + ["point"] = "LEFT", + ["color"] = {["r"] = 0.86, ["g"] = 0.44, ["b"] = 0}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Pain Suppression + ["enabled"] = true, + ["id"] = 33206, + ["point"] = "LEFT", + ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + }, + DRUID = { + {-- Rejuvenation + ["enabled"] = true, + ["id"] = 774, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.8, ["g"] = 0.4, ["b"] = 0.8}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Regrowth + ["enabled"] = true, + ["id"] = 8936, + ["point"] = "BOTTOMLEFT", + ["color"] = {["r"] = 0.2, ["g"] = 0.8, ["b"] = 0.2}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Lifebloom + ["enabled"] = true, + ["id"] = 33763, + ["point"] = "TOPLEFT", + ["color"] = {["r"] = 0.4, ["g"] = 0.8, ["b"] = 0.2}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Wild Growth + ["enabled"] = true, + ["id"] = 48438, + ["point"] = "BOTTOMRIGHT", + ["color"] = {["r"] = 0.8, ["g"] = 0.4, ["b"] = 0}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + }, + PALADIN = { + {-- Beacon of Light + ["enabled"] = true, + ["id"] = 53563, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.7, ["g"] = 0.3, ["b"] = 0.7}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Hand of Protection + ["enabled"] = true, + ["id"] = 1022, + ["point"] = "BOTTOMRIGHT", + ["color"] = {["r"] = 0.2, ["g"] = 0.2, ["b"] = 1}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Hand of Freedom + ["enabled"] = true, + ["id"] = 1044, + ["point"] = "BOTTOMRIGHT", + ["color"] = {["r"] = 0.89, ["g"] = 0.45, ["b"] = 0}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Hand of Salvation + ["enabled"] = true, + ["id"] = 1038, + ["point"] = "BOTTOMRIGHT", + ["color"] = {["r"] = 0.93, ["g"] = 0.75, ["b"] = 0}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Hand of Sacrifice + ["enabled"] = true, + ["id"] = 6940, + ["point"] = "BOTTOMRIGHT", + ["color"] = {["r"] = 0.89, ["g"] = 0.1, ["b"] = 0.1}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Hand of Purity + ["enabled"] = true, + ["id"] = 114039, + ["point"] = "BOTTOMRIGHT", + ["color"] = {["r"] = 0.64, ["g"] = 0.41, ["b"] = 0.72}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Sacred Shield + ["enabled"] = true, + ["id"] = 20925, + ["point"] = "TOPLEFT", + ["color"] = {["r"] = 0.93, ["g"] = 0.75, ["b"] = 0}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Eternal Flame + ["enabled"] = true, + ["id"] = 114163, + ["point"] = "BOTTOMLEFT", + ["color"] = {["r"] = 0.87, ["g"] = 0.7, ["b"] = 0.03}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + }, + SHAMAN = { + {-- Riptide + ["enabled"] = true, + ["id"] = 61295, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.7, ["g"] = 0.3, ["b"] = 0.7}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Earth Shield + ["enabled"] = true, + ["id"] = 974, + ["point"] = "BOTTOMLEFT", + ["color"] = {["r"] = 0.2, ["g"] = 0.7, ["b"] = 0.2}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Earthliving + ["enabled"] = true, + ["id"] = 51945, + ["point"] = "BOTTOMRIGHT", + ["color"] = {["r"] = 0.7, ["g"] = 0.4, ["b"] = 0.4}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + }, + MONK = { + {--Renewing Mist + ["enabled"] = true, + ["id"] = 119611, + ["point"] = "TOPLEFT", + ["color"] = {["r"] = 0.8, ["g"] = 0.4, ["b"] = 0.8}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Life Cocoon + ["enabled"] = true, + ["id"] = 116849, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.2, ["g"] = 0.8, ["b"] = 0.2}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Enveloping Mist + ["enabled"] = true, + ["id"] = 132120, + ["point"] = "BOTTOMLEFT", + ["color"] = {["r"] = 0.4, ["g"] = 0.8, ["b"] = 0.2}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Zen Sphere + ["enabled"] = true, + ["id"] = 124081, + ["point"] = "BOTTOMRIGHT", + ["color"] = {["r"] = 0.7, ["g"] = 0.4, ["b"] = 0}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + }, + ROGUE = { + {-- Tricks of the Trade + ["enabled"] = true, + ["id"] = 57934, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + }, + MAGE = { + {-- Ice Ward + ["enabled"] = true, + ["id"] = 111264, + ["point"] = "TOPLEFT", + ["color"] = {["r"] = 0.2, ["g"] = 0.2, ["b"] = 1}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + }, + WARRIOR = { + {-- Vigilance + ["enabled"] = true, + ["id"] = 114030, + ["point"] = "TOPLEFT", + ["color"] = {["r"] = 0.2, ["g"] = 0.2, ["b"] = 1}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Intervene + ["enabled"] = true, + ["id"] = 3411, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Safe Guard + ["enabled"] = true, + ["id"] = 114029, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + }, + DEATHKNIGHT = { + {-- Unholy Frenzy + ["enabled"] = true, + ["id"] = 49016, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, + ["anyUnit"] = false, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + }, +} + +local PET_WATCH = { + {-- Frenzy + ["enabled"] = true, + ["id"] = 19615, + ["point"] = "TOPLEFT", + ["color"] = {["r"] = 0.89, ["g"] = 0.09, ["b"] = 0.05}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, + {-- Mend Pet + ["enabled"] = true, + ["id"] = 136, + ["point"] = "TOPRIGHT", + ["color"] = {["r"] = 0.2, ["g"] = 0.8, ["b"] = 0.2}, + ["anyUnit"] = true, + ["onlyShowMissing"] = false, + ['style'] = 'coloredIcon', + ['displayText'] = false, + ['textColor'] = {["r"] = 1, ["g"] = 1, ["b"] = 1}, + ['textThreshold'] = -1, + ['xOffset'] = 0, + ['yOffset'] = 0 + }, +} + +local FilterIDs = { + ["Blocked"] = [[36900,36901,36893,114216,97821,36032,132365,8733,57724,25771,57723,36032,58539,26013,6788,71041,41425,55711,8326,23445,24755,25163,80354,95809,95223,124275,124274,124273,117870,123981,15007,113942,89140]], + + ["Allowed"] = [[31821,2825,32182,80353,90355,47788,33206,116849,22812,1490,116202,123059,136431,137332,137375,144351,142863,142864,142865,143198]], + + ["Strict"] = [[123059,136431,137332,137375,144351,142863,142864,142865,143198]], + + ["CC"] = [[47476,91800,91807,91797,108194,115001,33786,2637,339,78675,22570,5211,9005,102359,99,127797,45334,102795,114238,113004,3355,1513,19503,34490,24394,64803,19386,117405,128405,50519,91644,90337,54706,4167,90327,56626,50245,50541,96201,96201,31661,118,55021,122,82691,118271,44572,33395,102051,20066,10326,853,105593,31935,105421,605,64044,8122,9484,15487,114404,88625,113792,87194,2094,1776,6770,1833,51722,1330,408,88611,115197,113953,51514,64695,63685,76780,118905,118345,710,6789,118699,5484,6358,30283,24259,115782,115268,118093,89766,137143,20511,7922,676,105771,107566,132168,107570,118895,18498,116706,117368,115078,122242,119392,119381,120086,116709,123407,140023,25046,20549,107079]], + + ["Shield"] = [[17,47515,45243,45438,115610,48797,48792,49039,87256,55233,50461,33206,47788,62618,47585,104773,110913,108359,22812,102342,106922,61336,19263,53480,1966,31224,74001,5277,45182,98007,30823,108271,1022,6940,114039,31821,498,642,86659,31850,118038,55694,97463,12975,114029,871,114030,120954,131523,122783,122278,115213,116849,20594]], + + ["Player"] = [[17,47515,45243,45438,45438,115610,110909,12051,12472,80353,12042,32612,110960,108839,111264,108843,48797,48792,49039,87256,49222,55233,50461,49016,51271,96268,33206,47788,62618,47585,6346,10060,114239,119032,27827,104773,110913,108359,113860,113861,113858,88448,22812,102342,106922,61336,117679,102543,102558,102560,16689,132158,106898,1850,106951,29166,52610,69369,112071,124974,19263,53480,51755,54216,34471,3045,3584,131894,90355,90361,31224,74001,5277,45182,51713,114018,2983,121471,11327,108212,57933,79140,13750,98007,30823,108271,16188,2825,79206,16191,8178,58875,108281,108271,16166,114896,1044,1022,1038,6940,114039,31821,498,642,86659,20925,31850,31884,53563,31842,54428,105809,85499,118038,55694,97463,12975,114029,871,114030,18499,1719,23920,114028,46924,3411,107574,120954,131523,122783,122278,115213,116849,125174,116841,20594,59545,20572,26297,68992]], + + ["Raid"] = [[116281,116784,116417,116942,116161,117708,118303,118048,118135,117878,117949,116835,116778,116525,122761,122760,122740,123812,123180,123474,122835,123081,122125,121885,121949,117436,118091,117519,122752,123011,116161,123121,119985,119086,119775,122151,138349,137371,136767,137641,137359,137972,136903,136753,137633,137731,133767,133768,136050,138569,134691,137440,137408,137360,135000,143436,143579,147383,146124,144851,144358,144774,147207,144215,143990,144330,143494,142990,143919,143766,143773,146589,143777,143385,143974,145183]] } -local GlobalDefaults = { - ["Accountant"] = {}, - ["profiles"] = {}, - ["profileKeys"] = {}, +local FilterOverrides = { + ["45438"] = 5, ["48797"] = 5, ["87256"] = 4, + ["33206"] = 3, ["47585"] = 5, ["22812"] = 2, + ["102342"] = 2, ["19263"] = 5, ["5277"] = 5, + ["1022"] = 5, ["31821"] = 3, ["498"] = 2, + ["642"] = 5, ["86659"] = 4, ["31850"] = 4, + ["118038"] = 5, ["114029"] = 2, ["871"] = 3, + ["120954"] = 2, ["131523"] = 5 } + +local function safename(id) + local n = GetSpellInfo(id) + if not n then + if type(id) == "string" then + n = id + else + print('|cffFF9900SVUI:|r Spell not found: (#ID) '..id) + n = "Voodoo Doll"; + end + end + return n +end + +for k, x in pairs(FilterIDs) do + local src = {}; + for id in gmatch(x, '([^,]+)') do + if(id) then + local saved + local n = safename(id); + local p = FilterOverrides[tostring(id)] or 0; + if k == "Strict" then + saved = {['enable'] = true, ['spellID'] = id, ['priority'] = p} + else + saved = {['enable'] = true, ['priority'] = p} + end + src[n] = saved + end + end + DefaultSettings.filter[k] = src +end + +DefaultSettings.filter.BuffWatch = CLASS_WATCH_INDEX[SuperVillain.class] +DefaultSettings.filter.PetBuffWatch = PET_WATCH --[[ ########################################################## CREATE DB @@ -3426,7 +3926,7 @@ end local function exportprofile(t, key) local sv = rawget(t, "profile") local dv = rawget(t, "defaults") - local globals = SuperVillain.global + local globals = G if(not globals.profiles[key]) then globals.profiles[key] = {} end local saved = globals.profiles[key] tablecopy(saved, sv) @@ -3438,12 +3938,26 @@ local function exportprofile(t, key) end local function removeprofile(t, key) - local globals = SuperVillain.global + local globals = G if(globals.profiles[key]) then globals.profiles[key] = nil end if(globals.profileKeys[key]) then globals.profileKeys[key] = nil end collectgarbage("collect") end +local function insertdata(t, src) + local sv = rawget(t, "profile") + local dv = rawget(t, "defaults") + local src = dv and dv[k] + for k,v in pairs(src) do + if(not sv[k]) then sv[k] = {} end + tablecopy(sv[k], src[k]) + if(not dv[k]) then dv[k] = {} end + tablecopy(dv[k], src[k]) + + rawset(t, k, sv[k]) + end +end + local function initializedata(t) local sv = rawget(t, "profile") if(not sv.copyKey or (sv.copyKey and type(sv.copyKey) ~= "string")) then @@ -3452,8 +3966,9 @@ local function initializedata(t) end local function SanitizeDatabase() - local db = _G["SVUI_Profile"] - local src = DatabaseDefaults + if(not SuperVillain.db) then return end + local db = SuperVillain.db + local src = DefaultSettings for k,v in pairs(db) do if(k ~= "SAFEDATA" and src[k]) then removedefaults(db[k], src[k]) @@ -3486,8 +4001,9 @@ local METAPROFILE = function(sv) local db = setmetatable({}, metadatabase) db.profile = sv - db.defaults = DatabaseDefaults + db.defaults = DefaultSettings db.Init = initializedata + db.Append = insertdata db.Reset = resetprofile db.SetDefault = setdefaults db.GetDefault = getdefaults @@ -3498,59 +4014,19 @@ local METAPROFILE = function(sv) return db end -local function listprofiles(t) - local globals = t.globals - local list = globals.profileKeys or {} - return list +function SuperVillain:GetProfiles() + return G.profileKeys or {} end -local function checkprofiles(t) +function SuperVillain:CheckProfiles() local hasProfile = false - local globals = rawget(t, "globals") - local list = globals.profileKeys or {} + local list = G.profileKeys or {} for key,_ in pairs(list) do hasProfile = true end return hasProfile end -local function initializeglobals(t) - local sv = _G["SVUI_Global"] - local dv = GlobalDefaults - local keys = {} - for k,v in pairs(sv.profiles) do - keys[k] = k - end - sv.profileKeys = keys -end - -local metaglobals = { - __index = function(t, k) - if(not k or k == "") then return end - local sv = rawget(t, "globals") - local dv = rawget(t, "defaults") - local src = dv and dv[k] - if(not sv[k]) then sv[k] = {} end - if(src) then - tablecopy(sv[k], src) - end - rawset(t, k, sv[k]) - return rawget(t, k) - end -} - -local METAGLOBAL = function(sv) - local db = setmetatable({}, metaglobals) - - db.globals = sv - db.defaults = GlobalDefaults - db.GetProfiles = listprofiles - db.CheckProfiles = checkprofiles - db.Init = initializeglobals - - return db -end - function SuperVillain:HexColor(arg1,arg2,arg3) local r,g,b; if arg1 and type(arg1) == "string" then @@ -3558,7 +4034,7 @@ function SuperVillain:HexColor(arg1,arg2,arg3) if(self.Media or self.db.media) then t = self.Media.color[arg1] or self.db.media.unitframes[arg1] else - t = DatabaseDefaults.media.colors[arg1] or DatabaseDefaults.media.unitframes[arg1] + t = DefaultSettings.media.colors[arg1] or DefaultSettings.media.unitframes[arg1] end if t then r,g,b = t[1],t[2],t[3] @@ -3579,17 +4055,17 @@ end function SuperVillain:SetDatabaseObjects(init) if(init) then - self.global = tcopy(GlobalDefaults, true) - self.db = tcopy(DatabaseDefaults, true) + self.db = tcopy(DefaultSettings, true) else - local sv = _G["SVUI_Profile"] - local gv = _G["SVUI_Global"] + G = self:TableSplice(SVUI_Global, G) + G.profileKeys = {} + for k,v in pairs(G.profiles) do + G.profileKeys[k] = k + end - twipe(self.global) - twipe(self.db) + local sv = _G["SVUI_Profile"] - self.global = METAGLOBAL(gv) - self.global:Init() + twipe(self.db) self.db = METAPROFILE(sv) self.db:Init() diff --git a/Interface/AddOns/SVUI/system/filters.lua b/Interface/AddOns/SVUI/system/filters.lua index 1bb2252..f2a5e95 100644 --- a/Interface/AddOns/SVUI/system/filters.lua +++ b/Interface/AddOns/SVUI/system/filters.lua @@ -604,6 +604,7 @@ local FilterDefaults = { ["Strict"] = {}, ["Raid"] = {}, } + local function safename(id) local n = GetSpellInfo(id) if not n then @@ -616,6 +617,7 @@ local function safename(id) end return n end + for k, x in pairs(FilterIDs) do local src = {}; for id in gmatch(x, '([^,]+)') do diff --git a/Interface/AddOns/SVUI/system/system.lua b/Interface/AddOns/SVUI/system/system.lua index 1e06d5f..36f5f29 100644 --- a/Interface/AddOns/SVUI/system/system.lua +++ b/Interface/AddOns/SVUI/system/system.lua @@ -51,7 +51,8 @@ local tremove, tcopy, twipe, tsort, tconcat, tdump = table.remove, table.copy, t GET ADDON DATA ########################################################## ]]-- -local SVUINameSpace, SVUICore = ...; +local SuperVillain, L, G = unpack(select(2, ...)); +SuperVillain.Shared = LibStub("LibSharedMedia-3.0") --[[ ########################################################## LOCALS @@ -63,57 +64,12 @@ local rez = GetCVar("gxResolution"); local gxHeight = tonumber(match(rez,"%d+x(%d+)")); local gxWidth = tonumber(match(rez,"(%d+)x%d+")); local NewHook = hooksecurefunc; -local version = GetAddOnMetadata(..., "Version"); ---[[ -########################################################## -BUILD ADDON OBJECTS -########################################################## -]]-- -local SuperVillain = SVUI_LIB:SetObject(SVUINameSpace, version, true) -local L = SVUI_LOCALE:SetObject() - -SVUICore[1] = SuperVillain; -SVUICore[2] = L; ---[[ -########################################################## -CREATE GLOBAL NAMESPACE -########################################################## -]]-- -_G[SVUINameSpace] = SVUICore; --[[ ########################################################## SET MANY VARIABLES ########################################################## ]]-- local SVUISystemEventHandler = CreateFrame("Frame", "SVUISystemEventHandler") -local SVUIParent = CreateFrame("Frame", "SVUIParent", UIParent); -local StealthFrame = CreateFrame("Frame", nil, UIParent); -StealthFrame:Hide(); -SVUIParent:SetFrameLevel(UIParent:GetFrameLevel()); -SVUIParent:SetPoint("CENTER", UIParent, "CENTER"); -SVUIParent:SetSize(UIParent:GetSize()); - -SuperVillain.db = {}; -SuperVillain.fubar = function() return end -SuperVillain.Media = {}; -SuperVillain.Filters = {}; -SuperVillain.DisplayAudit = {}; -SuperVillain.DynamicOptions = {}; -SuperVillain.snaps = {}; -SuperVillain.Dispellable = {}; -SuperVillain.Options = { type="group", name="|cff339fffConfig-O-Matic|r", args={}, }; -SuperVillain.Shared = LibStub("LibSharedMedia-3.0") -SuperVillain.class = toonClass; -SuperVillain.name = UnitName("player"); -SuperVillain.realm = GetRealmName(); -SuperVillain.build = tonumber(bld); -SuperVillain.guid = UnitGUID('player'); -SuperVillain.mult = 1; -SuperVillain.ConfigurationMode = false; -SuperVillain.ClassRole = ""; -SuperVillain.UIParent = SVUIParent; -SuperVillain.Cloaked = StealthFrame; -SuperVillain.snaps[#SuperVillain.snaps + 1] = SuperVillain.UIParent; --[[ ########################################################## THE CLEANING LADY @@ -287,8 +243,8 @@ function SuperVillain:ToggleConfig() end end local aceConfig = LibStub("AceConfigDialog-3.0") - local switch = not aceConfig.OpenFrames[SVUINameSpace] and "Open" or "Close" - aceConfig[switch](aceConfig,SVUINameSpace) + local switch = not aceConfig.OpenFrames["SVUI"] and "Open" or "Close" + aceConfig[switch](aceConfig, "SVUI") GameTooltip:Hide() end @@ -735,6 +691,26 @@ SuperVillain.Animate = Animate; SYSTEM UPDATES ########################################################## ]]-- +local function DeleteOldSavedVars() + --[[ BEGIN DEPRECATED ]]-- + if SVUI_DATA then SVUI_DATA = nil end + if SVUI_SAFE_DATA then SVUI_SAFE_DATA = nil end + if SVUI_TRACKER then SVUI_TRACKER = nil end + if SVUI_ENEMIES then SVUI_ENEMIES = nil end + if SVUI_JOURNAL then SVUI_JOURNAL = nil end + if SVUI_CHARACTER_LOG then SVUI_CHARACTER_LOG = nil end + if SVUI_MOVED_FRAMES then SVUI_MOVED_FRAMES = nil end + if SVUI_SystemData then SVUI_SystemData = nil end + if SVUI_ProfileData then SVUI_ProfileData = nil end + if SVUI_Filters then SVUI_Filters = nil end + if SVUI_AuraFilters then SVUI_AuraFilters = nil end + if SVUI_AuraWatch then SVUI_AuraWatch = nil end + if SVUI_Cache["Mentalo"]["Blizzard"] then SVUI_Cache["Mentalo"]["Blizzard"] = nil end + if SVUI_Cache["Mentalo"]["UI"] then SVUI_Cache["Mentalo"]["UI"] = nil end + if(SVUI_Profile.SAFEDATA.install_complete) then SVUI_Profile.SAFEDATA.install_complete = nil end + --[[ END DEPRECATED ]]-- +end + function SuperVillain:VersionCheck() local minimumVersion = 4.06; local installedVersion = SVUI_Profile.SAFEDATA.install_version @@ -743,9 +719,11 @@ function SuperVillain:VersionCheck() installedVersion = tonumber(SVUI_Profile.SAFEDATA.install_version) end if(type(installedVersion) == "number" and installedVersion < minimumVersion) then + DeleteOldSavedVars() self:Install(true) end else + DeleteOldSavedVars() self:Install(true) end end @@ -772,19 +750,7 @@ end SVUI LOAD PROCESS ########################################################## ]]-- -local function PreLoad(self) - --[[ BEGIN DEPRECATED ]]-- - if SVUI_DATA then SVUI_DATA = nil end - if SVUI_SAFE_DATA then SVUI_SAFE_DATA = nil end - if SVUI_TRACKER then SVUI_TRACKER = nil end - if SVUI_ENEMIES then SVUI_ENEMIES = nil end - if SVUI_JOURNAL then SVUI_JOURNAL = nil end - if SVUI_CHARACTER_LOG then SVUI_CHARACTER_LOG = nil end - if SVUI_MOVED_FRAMES then SVUI_MOVED_FRAMES = nil end - if SVUI_SystemData then SVUI_SystemData = nil end - if SVUI_ProfileData then SVUI_ProfileData = nil end - --[[ END DEPRECATED ]]-- - +function SuperVillain:Load() if not SVUI_Global then SVUI_Global = {} end if not SVUI_Global["profiles"] then SVUI_Global["profiles"] = {} end @@ -793,11 +759,6 @@ local function PreLoad(self) if not SVUI_Profile then SVUI_Profile = {} end if not SVUI_Profile.SAFEDATA then SVUI_Profile.SAFEDATA = {} end - if(SVUI_Profile.SAFEDATA.install_complete) then SVUI_Profile.SAFEDATA.install_complete = nil end - - if SVUI_Filters then SVUI_Filters = nil end - if not SVUI_AuraFilters then SVUI_AuraFilters = {} end - if not SVUI_AuraWatch then SVUI_AuraWatch = {} end if not SVUI_Cache then SVUI_Cache = {} end if not SVUI_Cache["Dock"] then SVUI_Cache["Dock"] = {} end @@ -809,33 +770,29 @@ local function PreLoad(self) SVUI_Cache["screenwidth"] = gxWidth end - --[[ MORE DEPRECATED ]]-- - if SVUI_Cache["Mentalo"]["Blizzard"] then SVUI_Cache["Mentalo"]["Blizzard"] = nil end - if SVUI_Cache["Mentalo"]["UI"] then SVUI_Cache["Mentalo"]["UI"] = nil end - --[[ END DEPRECATED ]]-- - self:SetDatabaseObjects(true) self:UIScale(); self:RefreshSystemFonts(); self:LoadSystemAlerts(); - self.Registry:Lights(); + self.Registry:PreLoadPackages(); + SVUISystemEventHandler:RegisterEvent('PLAYER_REGEN_DISABLED'); + self.AddonLoaded = true end -local function FullLoad(self) +function SuperVillain:Launch() self:SetDatabaseObjects() self:UIScale("PLAYER_LOGIN"); - self.Registry:Camera(); - self.Registry:Action(); + self.Registry:LoadPackages(); self:DefinePlayerRole(); self:LoadMovables(); self:SetSVMovablesPositions(); - self.CoreEnabled = true; self:VersionCheck() self:RefreshAllSystemMedia(); + NewHook("StaticPopup_Show", self.StaticPopup_Show) SVUISystemEventHandler:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED"); @@ -861,23 +818,16 @@ local function FullLoad(self) if self.db.system.loginmessage then self:AddonMessage(format(L["LOGIN_MSG"], "|cffffcc1a", "|cffff801a", self.version)); end -end -SVUISystemEventHandler:RegisterEvent("ADDON_LOADED") -SVUISystemEventHandler:RegisterEvent("PLAYER_LOGIN") + self.AddonLaunched = true +end --[[ ########################################################## -EVENT HANDLER +EVENT HANDLERS ########################################################## ]]-- local SVUISystem_OnEvent = function(self, event, arg, ...) - if(event == "ADDON_LOADED" and arg ~= "Blizzard_DebugTools") then - PreLoad(SuperVillain) - self:UnregisterEvent("ADDON_LOADED") - elseif(event == "PLAYER_LOGIN" and IsLoggedIn()) then - FullLoad(SuperVillain) - self:UnregisterEvent("PLAYER_LOGIN") - elseif(event == "ACTIVE_TALENT_GROUP_CHANGED" or event == "PLAYER_TALENT_UPDATE" or event == "CHARACTER_POINTS_CHANGED" or event == "UNIT_INVENTORY_CHANGED" or event == "UPDATE_BONUS_ACTIONBAR") then + if(event == "ACTIVE_TALENT_GROUP_CHANGED" or event == "PLAYER_TALENT_UPDATE" or event == "CHARACTER_POINTS_CHANGED" or event == "UNIT_INVENTORY_CHANGED" or event == "UPDATE_BONUS_ACTIONBAR") then SuperVillain:DefinePlayerRole() elseif(event == "UI_SCALE_CHANGED") then SuperVillain:UIScale("UI_SCALE_CHANGED") @@ -916,9 +866,9 @@ local SVUISystem_OnEvent = function(self, event, arg, ...) local forceClosed = false; if IsAddOnLoaded("SVUI_ConfigOMatic") then local aceConfig=LibStub("AceConfigDialog-3.0") - if aceConfig.OpenFrames[SVUINameSpace] then + if aceConfig.OpenFrames["SVUI"] then self:RegisterEvent('PLAYER_REGEN_ENABLED') - aceConfig:Close(SVUINameSpace) + aceConfig:Close("SVUI") forceClosed = true end end @@ -943,4 +893,28 @@ local SVUISystem_OnEvent = function(self, event, arg, ...) self:UnregisterEvent('PLAYER_REGEN_ENABLED') end end -SVUISystemEventHandler:SetScript("OnEvent", SVUISystem_OnEvent) \ No newline at end of file +SVUISystemEventHandler:SetScript("OnEvent", SVUISystem_OnEvent) + +-- Load/Creation Handling +local LoadEventHandler = CreateFrame("Frame", nil) +local function LoadEventHandler_OnEvent(self, event, arg1) + if (event == "ADDON_LOADED" and arg1 ~= "Blizzard_DebugTools") or event == "PLAYER_LOGIN" then + local actionsTaken = false + if(not SuperVillain.AddonLoaded) then + SuperVillain:Load() + actionsTaken = true + end + if(not SuperVillain.AddonLaunched and IsLoggedIn()) then + SuperVillain:Launch() + actionsTaken = true + end + if(not actionsTaken) then + self:UnregisterEvent("ADDON_LOADED") + self:UnregisterEvent("PLAYER_LOGIN") + end + end +end + +LoadEventHandler:RegisterEvent("ADDON_LOADED") +LoadEventHandler:RegisterEvent("PLAYER_LOGIN") +LoadEventHandler:SetScript("OnEvent", LoadEventHandler_OnEvent) \ No newline at end of file diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua index e3d96b6..5bc38eb 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/filter.lua @@ -31,9 +31,21 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local MOD = SuperVillain.SVUnit -if(not MOD) then return end; +if(not MOD) then return end +local _, ns = ...; local selectedSpell,filterType,filters; -local tinsert = table.insert; +local nameMapping = { + ["CC"] = "Control Type Auras", + ["Shield"] = "Defensive Auras", + ["Player"] = "Player Only Auras", + ["Blocked"] = "Blocked Auras", + ["Allowed"] = "Always Allowed Auras", + ["Strict"] = "Specific Auras", + ["Raid"] = "Raid Buffs/Debuffs", + ["BuffWatch"] = "(AuraWatch) Player Buffs", + ["PetBuffWatch"] = "(AuraWatch) Pet Buffs", +} + local function generateFilterOptions() if filterType == 'AuraBar Colors' then @@ -53,7 +65,7 @@ local function generateFilterOptions() set = function(e, arg) if not SuperVillain.db.media.unitframes.spellcolor[arg] then SuperVillain.db.media.unitframes.spellcolor[arg] = false - end; + end generateFilterOptions() MOD:SetUnitFrame("player") MOD:SetUnitFrame("target") @@ -73,7 +85,7 @@ local function generateFilterOptions() SuperVillain:AddonMessage(L["You may not remove a spell from a default filter that is not customly added. Setting spell to false instead."]) else SuperVillain.db.media.unitframes.spellcolor[arg] = nil - end; + end selectedSpell = nil; generateFilterOptions() MOD:SetUnitFrame("player") @@ -96,7 +108,7 @@ local function generateFilterOptions() filters[""] = NONE; for g in pairs(SuperVillain.db.media.unitframes.spellcolor)do filters[g] = g - end; + end return filters end } @@ -106,7 +118,7 @@ local function generateFilterOptions() if not selectedSpell or SuperVillain.db.media.unitframes.spellcolor[selectedSpell] == nil then SuperVillain.Options.args.filters.args.spellGroup = nil; return - end; + end SuperVillain.Options.args.filters.args.spellGroup = { type = "group", @@ -129,7 +141,7 @@ local function generateFilterOptions() set = function(e, r, g, b) if type(SuperVillain.db.media.unitframes.spellcolor[selectedSpell]) ~= "table"then SuperVillain.db.media.unitframes.spellcolor[selectedSpell] = {} - end; + end local abColor = {r, g, b} SuperVillain.db.media.unitframes.spellcolor[selectedSpell] = abColor MOD:SetUnitFrame("player") @@ -151,16 +163,16 @@ local function generateFilterOptions() } } - elseif filterType == 'Buff Indicator (Pet)' then + elseif filterType == 'PetBuffWatch' then - local watchedBuffs={} + local watchedBuffs = {} - if not SuperVillain.Filters["PetBuffWatch"] then - SuperVillain.Filters["PetBuffWatch"] = {} - end; - for o,f in pairs(SuperVillain.Filters["PetBuffWatch"])do + if not SuperVillain.db.filter.PetBuffWatch then + SuperVillain.db.filter.PetBuffWatch = {} + end + for o,f in pairs(SuperVillain.db.filter.PetBuffWatch)do tinsert(watchedBuffs,f) - end; + end SuperVillain.Options.args.filters.args.filterGroup = { type = "group", @@ -181,7 +193,7 @@ local function generateFilterOptions() elseif not GetSpellInfo(arg)then SuperVillain:AddonMessage(L["Not valid spell id"]) else - tinsert(SuperVillain.Filters["PetBuffWatch"], {["enable"] = true, ["id"] = tonumber(arg), ["point"] = "TOPRIGHT", ["color"] = {["r"] = 1, ["g"] = 0, ["b"] = 0}, ["anyUnit"] = true}) + tinsert(SuperVillain.db.filter.PetBuffWatch, {["enable"] = true, ["id"] = tonumber(arg), ["point"] = "TOPRIGHT", ["color"] = {["r"] = 1, ["g"] = 0, ["b"] = 0}, ["anyUnit"] = true}) generateFilterOptions() MOD:SetUnitFrame("pet") selectedSpell = nil @@ -201,22 +213,22 @@ local function generateFilterOptions() SuperVillain:AddonMessage(L["Not valid spell id"]) else local p; - for q, r in pairs(SuperVillain.Filters["PetBuffWatch"])do + for q, r in pairs(SuperVillain.db.filter.PetBuffWatch)do if r["id"] == tonumber(arg)then p = r; - if SuperVillain.Filters["PetBuffWatch"][q]then - SuperVillain.Filters["PetBuffWatch"][q].enable = false; + if SuperVillain.db.filter.PetBuffWatch[q]then + SuperVillain.db.filter.PetBuffWatch[q].enable = false; else - SuperVillain.Filters["PetBuffWatch"][q] = nil + SuperVillain.db.filter.PetBuffWatch[q] = nil end end - end; + end if p == nil then SuperVillain:AddonMessage(L["Spell not found in list."]) else generateFilterOptions() end - end; + end selectedSpell = nil; generateFilterOptions() MOD:SetUnitFrame("pet") @@ -229,15 +241,15 @@ local function generateFilterOptions() values = function() local v = {} watchedBuffs = {} - for o, f in pairs(SuperVillain.Filters["PetBuffWatch"])do + for o, f in pairs(SuperVillain.db.filter.PetBuffWatch)do tinsert(watchedBuffs, f) - end; + end for o, l in pairs(watchedBuffs)do if l.id then local name = GetSpellInfo(l.id) v[l.id] = name end - end; + end return v end, get = function(e)return selectedSpell end, @@ -248,20 +260,20 @@ local function generateFilterOptions() local registeredSpell; - for t,l in pairs(SuperVillain.Filters["PetBuffWatch"])do + for t,l in pairs(SuperVillain.db.filter.PetBuffWatch)do if l.id == selectedSpell then registeredSpell = t end - end; + end if selectedSpell and registeredSpell then local currentSpell = GetSpellInfo(selectedSpell) SuperVillain.Options.args.filters.args.filterGroup.args[currentSpell] = { name = currentSpell.." ("..selectedSpell..")", type = "group", - get = function(e)return SuperVillain.Filters["PetBuffWatch"][registeredSpell][e[#e]] end, + get = function(e)return SuperVillain.db.filter.PetBuffWatch[registeredSpell][e[#e]] end, set = function(e, arg) - SuperVillain.Filters["PetBuffWatch"][registeredSpell][e[#e]] = arg; + SuperVillain.db.filter.PetBuffWatch[registeredSpell][e[#e]] = arg; MOD:SetUnitFrame("pet") end, order = -10, @@ -299,11 +311,11 @@ local function generateFilterOptions() type = "color", order = 4, get = function(e) - local abColor = SuperVillain.Filters["PetBuffWatch"][registeredSpell][e[#e]] + local abColor = SuperVillain.db.filter.PetBuffWatch[registeredSpell][e[#e]] return abColor.r, abColor.g, abColor.b, abColor.a end, set = function(e, i, j, k) - local abColor = SuperVillain.Filters["PetBuffWatch"][registeredSpell][e[#e]] + local abColor = SuperVillain.db.filter.PetBuffWatch[registeredSpell][e[#e]] abColor.r, abColor.g, abColor.b = i, j, k; MOD:SetUnitFrame("pet") end @@ -318,7 +330,7 @@ local function generateFilterOptions() type = "color", order = 6, get = function(e) - local abColor = SuperVillain.Filters["PetBuffWatch"][registeredSpell][e[#e]] + local abColor = SuperVillain.db.filter.PetBuffWatch[registeredSpell][e[#e]] if abColor then return abColor.r,abColor.g,abColor.b,abColor.a else @@ -326,7 +338,7 @@ local function generateFilterOptions() end end, set = function(e,i,j,k) - local abColor = SuperVillain.Filters["PetBuffWatch"][registeredSpell][e[#e]] + local abColor = SuperVillain.db.filter.PetBuffWatch[registeredSpell][e[#e]] abColor.r,abColor.g,abColor.b = i,j,k; MOD:SetUnitFrame("pet") end @@ -349,24 +361,24 @@ local function generateFilterOptions() name = L["Show When Not Active"], order = 8, type = "toggle", - disabled = function()return SuperVillain.Filters["PetBuffWatch"][registeredSpell].style == "text"end + disabled = function()return SuperVillain.db.filter.PetBuffWatch[registeredSpell].style == "text"end } } } - end; + end watchedBuffs = nil; - elseif filterType == 'Buff Indicator' then + elseif filterType == 'BuffWatch' then local watchedBuffs={} - if not SuperVillain.Filters["BuffWatch"][SuperVillain.class] then - SuperVillain.Filters["BuffWatch"][SuperVillain.class] = {} - end; - for o,f in pairs(SuperVillain.Filters["BuffWatch"][SuperVillain.class]) do + if not SuperVillain.db.filter.BuffWatch then + SuperVillain.db.filter.BuffWatch = {} + end + for o,f in pairs(SuperVillain.db.filter.BuffWatch) do tinsert(watchedBuffs,f) - end; + end SuperVillain.Options.args.filters.args.filterGroup = { type = "group", @@ -387,11 +399,11 @@ local function generateFilterOptions() elseif not GetSpellInfo(arg)then SuperVillain:AddonMessage(L["Not valid spell id"]) else - tinsert(SuperVillain.Filters["BuffWatch"][SuperVillain.class], {["enable"] = true, ["id"] = tonumber(arg), ["point"] = "TOPRIGHT", ["color"] = {["r"] = 1, ["g"] = 0, ["b"] = 0}, ["anyUnit"] = false}) + tinsert(SuperVillain.db.filter.BuffWatch, {["enable"] = true, ["id"] = tonumber(arg), ["point"] = "TOPRIGHT", ["color"] = {["r"] = 1, ["g"] = 0, ["b"] = 0}, ["anyUnit"] = false}) generateFilterOptions() for t = 10, 40, 15 do MOD:UpdateGroupAuraWatch("raid"..t) - end; + end MOD:UpdateGroupAuraWatch("party") MOD:UpdateGroupAuraWatch("raidpet", true) selectedSpell = nil @@ -411,27 +423,27 @@ local function generateFilterOptions() SuperVillain:AddonMessage(L["Not valid spell id"]) else local p; - for q, r in pairs(SuperVillain.Filters["BuffWatch"][SuperVillain.class])do + for q, r in pairs(SuperVillain.db.filter.BuffWatch)do if r["id"] == tonumber(arg)then p = r; - if SuperVillain.Filters["BuffWatch"][SuperVillain.class][q]then - SuperVillain.Filters["BuffWatch"][SuperVillain.class][q].enable = false; + if SuperVillain.db.filter.BuffWatch[q]then + SuperVillain.db.filter.BuffWatch[q].enable = false; else - SuperVillain.Filters["BuffWatch"][SuperVillain.class][q] = nil + SuperVillain.db.filter.BuffWatch[q] = nil end end - end; + end if p == nil then SuperVillain:AddonMessage(L["Spell not found in list."]) else generateFilterOptions() end - end; + end selectedSpell = nil; generateFilterOptions() for t = 10, 40, 15 do MOD:UpdateGroupAuraWatch("raid"..t) - end; + end MOD:UpdateGroupAuraWatch("party") MOD:UpdateGroupAuraWatch("raidpet", true) end @@ -443,15 +455,15 @@ local function generateFilterOptions() values = function() local v = {} watchedBuffs = {} - for o, f in pairs(SuperVillain.Filters["BuffWatch"][SuperVillain.class])do + for o, f in pairs(SuperVillain.db.filter.BuffWatch)do tinsert(watchedBuffs, f) - end; + end for o, l in pairs(watchedBuffs)do if l.id then local name = GetSpellInfo(l.id) v[l.id] = name end - end; + end return v end, get = function(e)return selectedSpell end, @@ -460,18 +472,18 @@ local function generateFilterOptions() } } local registeredSpell; - for t,l in pairs(SuperVillain.Filters["BuffWatch"][SuperVillain.class])do if l.id==selectedSpell then registeredSpell=t end end; + for t,l in pairs(SuperVillain.db.filter.BuffWatch)do if l.id==selectedSpell then registeredSpell=t end end if selectedSpell and registeredSpell then local currentSpell=GetSpellInfo(selectedSpell) SuperVillain.Options.args.filters.args.filterGroup.args[currentSpell] = { name = currentSpell.." ("..selectedSpell..")", type = "group", - get = function(e)return SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]]end, + get = function(e)return SuperVillain.db.filter.BuffWatch[registeredSpell][e[#e]]end, set = function(e, arg) - SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] = arg; + SuperVillain.db.filter.BuffWatch[registeredSpell][e[#e]] = arg; for t = 10, 40, 15 do MOD:UpdateGroupAuraWatch("raid"..t) - end; + end MOD:UpdateGroupAuraWatch("party") MOD:UpdateGroupAuraWatch("raidpet", true) end, @@ -501,15 +513,15 @@ local function generateFilterOptions() type = "color", order = 4, get = function(e) - local abColor = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] + local abColor = SuperVillain.db.filter.BuffWatch[registeredSpell][e[#e]] return abColor.r, abColor.g, abColor.b, abColor.a end, set = function(e, i, j, k) - local abColor = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] + local abColor = SuperVillain.db.filter.BuffWatch[registeredSpell][e[#e]] abColor.r, abColor.g, abColor.b = i, j, k; for t = 10, 40, 15 do MOD:UpdateGroupAuraWatch("raid"..t) - end; + end MOD:UpdateGroupAuraWatch("party") MOD:UpdateGroupAuraWatch("raidpet", true) end @@ -524,7 +536,7 @@ local function generateFilterOptions() type = "color", order = 6, get = function(e) - local abColor = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] + local abColor = SuperVillain.db.filter.BuffWatch[registeredSpell][e[#e]] if abColor then return abColor.r, abColor.g, abColor.b, abColor.a else @@ -532,12 +544,12 @@ local function generateFilterOptions() end end, set = function(e, i, j, k) - SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] or {} - local abColor = SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell][e[#e]] + SuperVillain.db.filter.BuffWatch[registeredSpell][e[#e]] = SuperVillain.db.filter.BuffWatch[registeredSpell][e[#e]] or {} + local abColor = SuperVillain.db.filter.BuffWatch[registeredSpell][e[#e]] abColor.r, abColor.g, abColor.b = i, j, k; for t = 10, 40, 15 do MOD:UpdateGroupAuraWatch("raid"..t) - end; + end MOD:UpdateGroupAuraWatch("party") MOD:UpdateGroupAuraWatch("raidpet", true) end @@ -560,18 +572,18 @@ local function generateFilterOptions() name = L["Show When Not Active"], order = 8, type = "toggle", - disabled = function()return SuperVillain.Filters["BuffWatch"][SuperVillain.class][registeredSpell].style == "text" end + disabled = function()return SuperVillain.db.filter.BuffWatch[registeredSpell].style == "text" end } } } - end; + end watchedBuffs=nil else - if not filterType or not SuperVillain.Filters[filterType]then + if not filterType or not SuperVillain.db.filter[filterType]then SuperVillain.Options.args.filters.args.filterGroup = nil; SuperVillain.Options.args.filters.args.spellGroup = nil; return - end; + end SuperVillain.Options.args.filters.args.filterGroup = { type = "group", name = filterType, @@ -585,12 +597,12 @@ local function generateFilterOptions() type = "input", get = function(e)return""end, set = function(e, arg) - if not SuperVillain.Filters[filterType][arg]then - SuperVillain.Filters[filterType][arg] = { + if not SuperVillain.db.filter[filterType][arg]then + SuperVillain.db.filter[filterType][arg] = { ["enable"] = true, ["priority"] = 0 } - end; + end generateFilterOptions() MOD:RefreshUnitFrames() end @@ -602,16 +614,16 @@ local function generateFilterOptions() type = "input", get = function(e)return""end, set = function(e, arg) - if SuperVillain.Filters[filterType] then - if SuperVillain.Filters[filterType][arg] then - SuperVillain.Filters[filterType][arg].enable = false; + if SuperVillain.db.filter[filterType] then + if SuperVillain.db.filter[filterType][arg] then + SuperVillain.db.filter[filterType][arg].enable = false; SuperVillain:AddonMessage(L["You may not remove a spell from a default filter that is not customly added. Setting spell to false instead."]) else - SuperVillain.Filters[filterType][arg] = nil + SuperVillain.db.filter[filterType][arg] = nil end else - SuperVillain.Filters[filterType][arg] = nil - end; + SuperVillain.db.filter[filterType][arg] = nil + end generateFilterOptions() MOD:RefreshUnitFrames() end @@ -628,21 +640,21 @@ local function generateFilterOptions() end, values = function() local filters = {} - local list = SuperVillain.Filters[filterType] + local list = SuperVillain.db.filter[filterType] filters[""] = NONE; for g in pairs(list)do filters[g] = g - end; + end return filters end } } } - if not selectedSpell or not SuperVillain.Filters[filterType][selectedSpell] then + if not selectedSpell or not SuperVillain.db.filter[filterType][selectedSpell] then SuperVillain.Options.args.filters.args.spellGroup = nil; return - end; + end SuperVillain.Options.args.filters.args.spellGroup = { type = "group", @@ -657,11 +669,11 @@ local function generateFilterOptions() if selectedFolder or not selectedSpell then return false else - return SuperVillain.Filters[filterType][selectedSpell].enable + return SuperVillain.db.filter[filterType][selectedSpell].enable end end, set = function(e, arg) - SuperVillain.Filters[filterType][selectedSpell].enable = arg; + SuperVillain.db.filter[filterType][selectedSpell].enable = arg; generateFilterOptions() MOD:RefreshUnitFrames() end @@ -673,11 +685,11 @@ local function generateFilterOptions() if selectedFolder or not selectedSpell then return 0 else - return SuperVillain.Filters[filterType][selectedSpell].priority + return SuperVillain.db.filter[filterType][selectedSpell].priority end end, set = function(e, arg) - SuperVillain.Filters[filterType][selectedSpell].priority = arg; + SuperVillain.db.filter[filterType][selectedSpell].priority = arg; generateFilterOptions() MOD:RefreshUnitFrames() end, @@ -688,10 +700,10 @@ local function generateFilterOptions() } } } - end; + end MOD:RefreshUnitFrames() collectgarbage("collect") -end; +end SuperVillain.Options.args.filters = { type = "group", name = L["Filters"], @@ -704,8 +716,8 @@ SuperVillain.Options.args.filters = { type = "input", get = function(e)return""end, set = function(e, arg) - SuperVillain.Filters[arg] = {} - SuperVillain.Filters[arg]["spells"] = {} + SuperVillain.db.filter[arg] = {} + SuperVillain.db.filter[arg]["spells"] = {} end }, deleteFilter = { @@ -715,10 +727,10 @@ SuperVillain.Options.args.filters = { desc = L["Delete a created filter, you cannot delete pre-existing filters, only custom ones."], get = function(e)return""end, set = function(e, arg) - if SuperVillain.Filters[arg] then + if SuperVillain.db.filter[arg] then SuperVillain:AddonMessage(L["You can't remove a pre-existing filter."]) else - SuperVillain.Filters[arg] = nil; + SuperVillain.db.filter[arg] = nil; filterType = nil; selectedSpell = nil; SuperVillain.Options.args.filters.args.filterGroup = nil @@ -727,9 +739,9 @@ SuperVillain.Options.args.filters = { values = function() filters = {} filters[""] = NONE; - for g in pairs(SuperVillain.Filters) do - filters[g] = g - end; + for g in pairs(SuperVillain.db.filter) do + filters[g] = nameMapping[g] or g + end return filters end }, @@ -744,17 +756,15 @@ SuperVillain.Options.args.filters = { selectedSpell = nil else filterType = arg - end; + end generateFilterOptions() end, values = function() filters = {} filters[""] = NONE; - for g in pairs(SuperVillain.Filters) do - filters[g] = g - end; - filters["Buff Indicator"] = "Buff Indicator" - filters["Buff Indicator (Pet)"] = "Buff Indicator (Pet)" + for g in pairs(SuperVillain.db.filter) do + filters[g] = nameMapping[g] or g + end filters["AuraBar Colors"] = "AuraBar Colors" return filters end @@ -762,10 +772,9 @@ SuperVillain.Options.args.filters = { } } -local aceConfig = LibStub("AceConfigDialog-3.0") -function SuperVillain:SetToFilterConfig(newFilter) - filterType = newFilter or "Buff Indicator" +function ns:SetToFilterConfig(newFilter) + filterType = newFilter or "BuffWatch" generateFilterOptions() - aceConfig:SelectGroup("SVUI", "filters") + LibStub("AceConfigDialog-3.0"):SelectGroup("SVUI", "filters") end \ No newline at end of file diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/plate.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/plate.lua index d624706..7671eab 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/plate.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/plate.lua @@ -31,6 +31,7 @@ GET ADDON DATA ]]-- local SuperVillain, L = unpack(SVUI); local MOD = SuperVillain.SVPlate; +local _, ns = ...; --[[ ########################################################## SET PACKAGE OPTIONS @@ -527,14 +528,14 @@ SuperVillain.Options.args.SVPlate={ type = "select", order = 2, name = L["Additional Filter"], - values = function()filters = {}filters[""] = NONE;for j in pairs(SuperVillain.Filters)do filters[j] = j end;return filters end + values = function()filters = {}filters[""] = NONE;for j in pairs(SuperVillain.db.filter)do filters[j] = j end;return filters end }, configureButton = { order = 4, name = L["Configure Selected Filter"], type = "execute", width = "full", - func = function()SuperVillain:SetToFilterConfig(SuperVillain.db.SVPlate.auras.additionalFilter)end + func = function()ns:SetToFilterConfig(SuperVillain.db.SVPlate.auras.additionalFilter)end }, fontGroup = { order = 100, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/profiles.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/profiles.lua index 67f7379..c2edb85 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/profiles.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/profiles.lua @@ -76,8 +76,8 @@ SuperVillain.Options.args.profiles = { order = 6, get = function() return " SELECT ONE" end, set = function(key, value) SuperVillain.db:Import(value) end, - disabled = function() local t = SuperVillain.global:CheckProfiles() return (not t) end, - values = SuperVillain.global:GetProfiles(), + disabled = function() local t = SuperVillain:CheckProfiles() return (not t) end, + values = SuperVillain:GetProfiles(), }, spacer2 = { order = 7, @@ -97,8 +97,8 @@ SuperVillain.Options.args.profiles = { desc = L["delete_sub"], get = function() return " SELECT ONE" end, set = function(key, value) SuperVillain.db:Remove(value) end, - values = SuperVillain.global:GetProfiles(), - disabled = function() local t = SuperVillain.global:CheckProfiles() return (not t) end, + values = SuperVillain:GetProfiles(), + disabled = function() local t = SuperVillain:CheckProfiles() return (not t) end, confirm = true, confirmText = L["delete_confirm"], }, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua index 06de724..ad339bf 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/core.lua @@ -316,7 +316,7 @@ function ns:SetAuraConfigGroup(custom, auraType, unused, updateFunction, unitNam values = function() filterList = {} filterList[""] = NONE; - for n in pairs(SuperVillain.Filters)do + for n in pairs(SuperVillain.db.filter)do filterList[n] = n end; return filterList @@ -483,7 +483,7 @@ function ns:SetAuraConfigGroup(custom, auraType, unused, updateFunction, unitNam values = function() filterList = {} filterList[""] = NONE; - for n in pairs(SuperVillain.Filters)do + for n in pairs(SuperVillain.db.filter)do filterList[n] = n end; return filterList @@ -1210,7 +1210,7 @@ function ns:SetAurabarConfigGroup(custom, updateFunction, unitName) configureButton2 = { order = 2, name = L["Coloring (Specific)"], - type = "execute", func = function()SuperVillain:SetToFilterConfig("AuraBar Colors")end + type = "execute", func = function()ns:SetToFilterConfig("AuraBar Colors")end }, anchorPoint = { type = "select", @@ -1310,7 +1310,7 @@ function ns:SetAurabarConfigGroup(custom, updateFunction, unitName) values = function() filterList = {} filterList[""] = NONE; - for n in pairs(SuperVillain.Filters)do + for n in pairs(SuperVillain.db.filter)do filterList[n] = n end; return filterList @@ -1445,7 +1445,7 @@ function ns:SetAurabarConfigGroup(custom, updateFunction, unitName) values = function() filterList = {} filterList[""] = NONE; - for n in pairs(SuperVillain.Filters)do + for n in pairs(SuperVillain.db.filter)do filterList[n] = n end; return filterList diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/party.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/party.lua index 3e75e35..1e797b1 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/party.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/party.lua @@ -296,13 +296,13 @@ SuperVillain.Options.args.SVUnit.args.party ={ }, }, - buffIndicator ={ + auraWatch ={ order = 600, type = 'group', - name = L['Buff Indicator'], + name = L['Aura Watch'], get = function(l)return - SuperVillain.db.SVUnit['party']['buffIndicator'][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party", "buffIndicator");MOD:SetGroupFrame('party')end, + SuperVillain.db.SVUnit['party']['auraWatch'][l[#l]]end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "party", "auraWatch");MOD:SetGroupFrame('party')end, args ={ enable ={ type = 'toggle', @@ -321,7 +321,7 @@ SuperVillain.Options.args.SVUnit.args.party ={ configureButton ={ type = 'execute', name = L['Configure Auras'], - func = function()SuperVillain:SetToFilterConfig('Buff Indicator')end, + func = function()ns:SetToFilterConfig('BuffWatch')end, order = 3, }, diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/pet.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/pet.lua index 9da18fc..c9a2f95 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/pet.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/pet.lua @@ -112,9 +112,9 @@ SuperVillain.Options.args.SVUnit.args.pet = { order = 8, type = "group", guiInline = true, - name = L["Buff Indicator"], - get = function(l)return SuperVillain.db.SVUnit["pet"]["buffIndicator"][l[#l]]end, - set = function(l, m)MOD:ChangeDBVar(m, l[#l], "pet", "buffIndicator");MOD:SetUnitFrame("pet")end, + name = L["Aura Watch"], + get = function(l)return SuperVillain.db.SVUnit["pet"]["auraWatch"][l[#l]]end, + set = function(l, m)MOD:ChangeDBVar(m, l[#l], "pet", "auraWatch");MOD:SetUnitFrame("pet")end, args = { enable = { type = "toggle", diff --git a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua index 7327d31..f323337 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/modules/units/raid.lua @@ -339,17 +339,17 @@ for w=10,40,15 do name = ns:SetNameConfigGroup(MOD.SetGroupFrame, "raid" .. w), buffs = ns:SetAuraConfigGroup(true, "buffs", true, MOD.SetGroupFrame, "raid" .. w), debuffs = ns:SetAuraConfigGroup(true, "debuffs", true, MOD.SetGroupFrame, "raid" .. w), - buffIndicator = { + auraWatch = { order = 600, type = "group", - name = L["Buff Indicator"], + name = L["Aura Watch"], args = { enable = { type = "toggle", name = L["Enable"], order = 1, - get = function(l)return SuperVillain.db.SVUnit["raid" .. w].buffIndicator.enable end, - set = function(l, m)MOD:ChangeDBVar(m, "enable", "raid" .. w, "buffIndicator");MOD:SetGroupFrame("raid" .. w)end, + get = function(l)return SuperVillain.db.SVUnit["raid" .. w].auraWatch.enable end, + set = function(l, m)MOD:ChangeDBVar(m, "enable", "raid" .. w, "auraWatch");MOD:SetGroupFrame("raid" .. w)end, }, size = { type = "range", @@ -359,13 +359,13 @@ for w=10,40,15 do min = 4, max = 15, step = 1, - get = function(l)return SuperVillain.db.SVUnit["raid" .. w].buffIndicator.size end, - set = function(l, m)MOD:ChangeDBVar(m, "size", "raid" .. w, "buffIndicator");MOD:SetGroupFrame("raid" .. w)end, + get = function(l)return SuperVillain.db.SVUnit["raid" .. w].auraWatch.size end, + set = function(l, m)MOD:ChangeDBVar(m, "size", "raid" .. w, "auraWatch");MOD:SetGroupFrame("raid" .. w)end, }, configureButton = { type = "execute", name = L["Configure Auras"], - func = function()SuperVillain:SetToFilterConfig("Buff Indicator")end, + func = function()ns:SetToFilterConfig("BuffWatch")end, order = 3, }, @@ -419,7 +419,7 @@ for w=10,40,15 do configureButton = { type = "execute", name = L["Configure Auras"], - func = function()SuperVillain:SetToFilterConfig("Raid")end, + func = function()ns:SetToFilterConfig("Raid")end, order = 7, }, }, @@ -662,17 +662,17 @@ SuperVillain.Options.args.SVUnit.args.raidpet ={ name = ns:SetNameConfigGroup(MOD.SetGroupFrame, 'raidpet'), buffs = ns:SetAuraConfigGroup(true, 'buffs', true, MOD.SetGroupFrame, 'raidpet'), debuffs = ns:SetAuraConfigGroup(true, 'debuffs', true, MOD.SetGroupFrame, 'raidpet'), - buffIndicator ={ + auraWatch ={ order = 600, type = 'group', - name = L['Buff Indicator'], + name = L['Aura Watch'], args ={ enable = { type = "toggle", name = L["Enable"], order = 1, - get = function(l)return SuperVillain.db.SVUnit["raid" .. w].buffIndicator.enable end, - set = function(l, m)MOD:ChangeDBVar(m, "enable", "raid" .. w, "buffIndicator");MOD:SetGroupFrame("raid" .. w)end, + get = function(l)return SuperVillain.db.SVUnit["raid" .. w].auraWatch.enable end, + set = function(l, m)MOD:ChangeDBVar(m, "enable", "raid" .. w, "auraWatch");MOD:SetGroupFrame("raid" .. w)end, }, size = { type = "range", @@ -682,13 +682,13 @@ SuperVillain.Options.args.SVUnit.args.raidpet ={ min = 4, max = 15, step = 1, - get = function(l)return SuperVillain.db.SVUnit["raid" .. w].buffIndicator.size end, - set = function(l, m)MOD:ChangeDBVar(m, "size", "raid" .. w, "buffIndicator");MOD:SetGroupFrame("raid" .. w)end, + get = function(l)return SuperVillain.db.SVUnit["raid" .. w].auraWatch.size end, + set = function(l, m)MOD:ChangeDBVar(m, "size", "raid" .. w, "auraWatch");MOD:SetGroupFrame("raid" .. w)end, }, configureButton ={ type = 'execute', name = L['Configure Auras'], - func = function()SuperVillain:SetToFilterConfig('Buff Indicator')end, + func = function()ns:SetToFilterConfig('BuffWatch')end, order = 3, }, }, @@ -733,7 +733,7 @@ SuperVillain.Options.args.SVUnit.args.raidpet ={ configureButton ={ type = 'execute', name = L['Configure Auras'], - func = function()SuperVillain:SetToFilterConfig('Raid')end, + func = function()ns:SetToFilterConfig('Raid')end, order = 5, }, }, diff --git a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua index 1bce173..de9121b 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua @@ -37,20 +37,29 @@ local twipe, tcopy = table.wipe, table.copy; GET ADDON DATA ########################################################## ]]-- +local SVUIAddOnName, StyleVillain = ...; local SuperVillain, L = unpack(SVUI); -local SVUIAddOnName, SVUIAddOn = ...; +local NewHook = hooksecurefunc; +local SVUIAddonEventHandler = CreateFrame("Frame", "SVUIAddonEventHandler") local version = GetAddOnMetadata(..., "Version"); -local StyleVillain = SVUI_LIB:SetObject(SVUIAddOnName, version); - -SVUIAddOn = StyleVillain; +local rootstring = function(self) return self.__namekey end +local function SetAddonObject() + local obj = {} + obj.__namekey = SVUIAddOnName + obj.version = version + local mt = {} + local old = getmetatable(obj) + if old then + for k, v in pairs(old) do mt[k] = v end + end + mt.__tostring = rootstring + setmetatable(obj, mt) + return obj +end -_G["StyleVillain"] = SVUIAddOn; +StyleVillain = SetAddonObject() -local SuperDockWindow = _G["SuperDockWindow"]; -local SuperDockletMain = _G["SuperDockletMain"]; -local SuperDockletExtra = _G["SuperDockletExtra"]; -local NewHook = hooksecurefunc; -local SVUIAddonEventHandler = CreateFrame("Frame", "SVUIAddonEventHandler") +_G["StyleVillain"] = StyleVillain; --[[ ########################################################## CORE DATA @@ -282,267 +291,267 @@ function StyleVillain:SetConfigOptions() name = L["Black Market AH"], desc = L["TOGGLEART_DESC"] }, - transmogrify = { + transmogrify = { type = "toggle", name = L["Transmogrify Frame"], desc = L["TOGGLEART_DESC"] }, - encounterjournal = { + encounterjournal = { type = "toggle", name = L["Encounter Journal"], desc = L["TOGGLEART_DESC"] }, - reforge = { + reforge = { type = "toggle", name = L["Reforge Frame"], desc = L["TOGGLEART_DESC"] }, - calendar = { + calendar = { type = "toggle", name = L["Calendar Frame"], desc = L["TOGGLEART_DESC"] }, - achievement = { + achievement = { type = "toggle", name = L["Achievement Frame"], desc = L["TOGGLEART_DESC"] }, - lfguild = { + lfguild = { type = "toggle", name = L["LF Guild Frame"], desc = L["TOGGLEART_DESC"] }, - inspect = { + inspect = { type = "toggle", name = L["Inspect Frame"], desc = L["TOGGLEART_DESC"] }, - binding = { + binding = { type = "toggle", name = L["KeyBinding Frame"], desc = L["TOGGLEART_DESC"] }, - gbank = { + gbank = { type = "toggle", name = L["Guild Bank"], desc = L["TOGGLEART_DESC"] }, - archaeology = { + archaeology = { type = "toggle", name = L["Archaeology Frame"], desc = L["TOGGLEART_DESC"] }, - guildcontrol = { + guildcontrol = { type = "toggle", name = L["Guild Control Frame"], desc = L["TOGGLEART_DESC"] }, - guild = { + guild = { type = "toggle", name = L["Guild Frame"], desc = L["TOGGLEART_DESC"] }, - tradeskill = { + tradeskill = { type = "toggle", name = L["TradeSkill Frame"], desc = L["TOGGLEART_DESC"] }, - raid = { + raid = { type = "toggle", name = L["Raid Frame"], desc = L["TOGGLEART_DESC"] }, - talent = { + talent = { type = "toggle", name = L["Talent Frame"], desc = L["TOGGLEART_DESC"] }, - auctionhouse = { + auctionhouse = { type = "toggle", name = L["Auction Frame"], desc = L["TOGGLEART_DESC"] }, - timemanager = { + timemanager = { type = "toggle", name = L["Time Manager"], desc = L["TOGGLEART_DESC"] }, - barber = { + barber = { type = "toggle", name = L["Barbershop Frame"], desc = L["TOGGLEART_DESC"] }, - macro = { + macro = { type = "toggle", name = L["Macro Frame"], desc = L["TOGGLEART_DESC"] }, - debug = { + debug = { type = "toggle", name = L["Debug Tools"], desc = L["TOGGLEART_DESC"] }, - trainer = { + trainer = { type = "toggle", name = L["Trainer Frame"], desc = L["TOGGLEART_DESC"] }, - socket = { + socket = { type = "toggle", name = L["Socket Frame"], desc = L["TOGGLEART_DESC"] }, - alertframes = { + alertframes = { type = "toggle", name = L["Alert Frames"], desc = L["TOGGLEART_DESC"] }, - loot = { + loot = { type = "toggle", name = L["Loot Frames"], desc = L["TOGGLEART_DESC"] }, - bgscore = { + bgscore = { type = "toggle", name = L["BG Score"], desc = L["TOGGLEART_DESC"] }, - merchant = { + merchant = { type = "toggle", name = L["Merchant Frame"], desc = L["TOGGLEART_DESC"] }, - mail = { + mail = { type = "toggle", name = L["Mail Frame"], desc = L["TOGGLEART_DESC"] }, - help = { + help = { type = "toggle", name = L["Help Frame"], desc = L["TOGGLEART_DESC"] }, - trade = { + trade = { type = "toggle", name = L["Trade Frame"], desc = L["TOGGLEART_DESC"] }, - gossip = { + gossip = { type = "toggle", name = L["Gossip Frame"], desc = L["TOGGLEART_DESC"] }, - greeting = { + greeting = { type = "toggle", name = L["Greeting Frame"], desc = L["TOGGLEART_DESC"] }, - worldmap = { + worldmap = { type = "toggle", name = L["World Map"], desc = L["TOGGLEART_DESC"] }, - taxi = { + taxi = { type = "toggle", name = L["Taxi Frame"], desc = L["TOGGLEART_DESC"] }, - lfg = { + lfg = { type = "toggle", name = L["LFG Frame"], desc = L["TOGGLEART_DESC"] }, - mounts = { + mounts = { type = "toggle", name = L["Mounts & Pets"], desc = L["TOGGLEART_DESC"] }, - quest = { + quest = { type = "toggle", name = L["Quest Frames"], desc = L["TOGGLEART_DESC"] }, - petition = { + petition = { type = "toggle", name = L["Petition Frame"], desc = L["TOGGLEART_DESC"] }, - dressingroom = { + dressingroom = { type = "toggle", name = L["Dressing Room"], desc = L["TOGGLEART_DESC"] }, - pvp = { + pvp = { type = "toggle", name = L["PvP Frames"], desc = L["TOGGLEART_DESC"] }, - nonraid = { + nonraid = { type = "toggle", name = L["Non-Raid Frame"], desc = L["TOGGLEART_DESC"] }, - friends = { + friends = { type = "toggle", name = L["Friends"], desc = L["TOGGLEART_DESC"] }, - spellbook = { + spellbook = { type = "toggle", name = L["Spellbook"], desc = L["TOGGLEART_DESC"] }, - character = { + character = { type = "toggle", name = L["Character Frame"], desc = L["TOGGLEART_DESC"] }, - misc = { + misc = { type = "toggle", name = L["Misc Frames"], desc = L["TOGGLEART_DESC"] }, - tabard = { + tabard = { type = "toggle", name = L["Tabard Frame"], desc = L["TOGGLEART_DESC"] }, - guildregistrar = { + guildregistrar = { type = "toggle", name = L["Guild Registrar"], desc = L["TOGGLEART_DESC"] }, - bags = { + bags = { type = "toggle", name = L["Bags"], desc = L["TOGGLEART_DESC"] }, - stable = { + stable = { type = "toggle", name = L["Stable"], desc = L["TOGGLEART_DESC"] }, - bgmap = { + bgmap = { type = "toggle", name = L["BG Map"], desc = L["TOGGLEART_DESC"] }, - petbattleui = { + petbattleui = { type = "toggle", name = L["Pet Battle"], desc = L["TOGGLEART_DESC"] }, - losscontrol = { + losscontrol = { type = "toggle", name = L["Loss Control"], desc = L["TOGGLEART_DESC"] }, - voidstorage = { + voidstorage = { type = "toggle", name = L["Void Storage"], desc = L["TOGGLEART_DESC"] }, - itemUpgrade = { + itemUpgrade = { type = "toggle", name = L["Item Upgrade"], desc = L["TOGGLEART_DESC"] @@ -554,7 +563,94 @@ function StyleVillain:SetConfigOptions() } end; +local defaults = { + ["SVStyle"] = { + ["blizzard"] = { + ["enable"] = true, + ["bags"] = true, + ["bmah"] = true, + ["reforge"] = true, + ["calendar"] = true, + ["achievement"] = true, + ["lfguild"] = true, + ["inspect"] = true, + ["binding"] = true, + ["gbank"] = true, + ["archaeology"] = true, + ["guildcontrol"] = true, + ["gossip"] = true, + ["guild"] = true, + ["tradeskill"] = true, + ["raid"] = false, + ["talent"] = true, + ["auctionhouse"] = true, + ["barber"] = true, + ["macro"] = true, + ["debug"] = true, + ["trainer"] = true, + ["socket"] = true, + ["loot"] = true, + ["alertframes"] = true, + ["bgscore"] = true, + ["merchant"] = true, + ["mail"] = true, + ["help"] = true, + ["trade"] = true, + ["gossip"] = true, + ["greeting"] = true, + ["worldmap"] = true, + ["taxi"] = true, + ["quest"] = true, + ["petition"] = true, + ["dressingroom"] = true, + ["pvp"] = true, + ["lfg"] = true, + ["nonraid"] = true, + ["friends"] = true, + ["spellbook"] = true, + ["character"] = true, + ["misc"] = true, + ["tabard"] = true, + ["guildregistrar"] = true, + ["timemanager"] = true, + ["encounterjournal"] = true, + ["voidstorage"] = true, + ["transmogrify"] = true, + ["stable"] = true, + ["bgmap"] = true, + ["mounts"] = true, + ["petbattleui"] = true, + ["losscontrol"] = true, + ["itemUpgrade"] = true, + }, + ["addons"] = { + ["enable"] = true, + ["Skada"] = true, + ["Recount"] = true, + ["AuctionLite"] = true, + ["AtlasLoot"] = true, + ["SexyCooldown"] = true, + ["Lightheaded"] = true, + ["Outfitter"] = true, + ["WeakAuras"] = true, + ["Quartz"] = true, + ["TomTom"] = true, + ["TinyDPS"] = true, + ["Clique"] = true, + ["CoolLine"] = true, + ["ACP"] = true, + ["DXE"] = true, + ["MogIt"] = true, + ["alDamageMeter"] = true, + ["Omen"] = true, + ["TradeSkillDW"] = true, + } + }, +} + local RegisterAddonDocklets = function() + local MAIN = _G["SuperDockletMain"]; + local EXTRA = _G["SuperDockletExtra"]; local main = SuperVillain.db.SVDock.docklets.DockletMain; local alternate = SuperVillain.db.SVDock.docklets.enableExtra and SuperVillain.db.SVDock.docklets.DockletExtra or ""; local tipLeft, tipRight = "", ""; @@ -563,75 +659,75 @@ local RegisterAddonDocklets = function() if find(main, "Skada") or find(alternate, "Skada") then if SuperVillain:IsDockletReady("Skada") then StyleVillain:Docklet_Skada() - if find(alternate, "Skada") and SuperDockletExtra.FrameName ~= "SkadaHolder2" then + if find(alternate, "Skada") and EXTRA.FrameName ~= "SkadaHolder2" then tipRight = "and Skada"; SuperVillain:RegisterExtraDocklet("SkadaHolder2") - --StyleVillain.DockedParent["Skada"] = SuperDockletExtra + --StyleVillain.DockedParent["Skada"] = EXTRA end - if find(main, "Skada") and SuperDockletMain.FrameName ~= "SkadaHolder" then + if find(main, "Skada") and MAIN.FrameName ~= "SkadaHolder" then tipLeft = "Skada"; SuperVillain:RegisterMainDocklet("SkadaHolder") - --StyleVillain.DockedParent["Skada"] = SuperDockletMain + --StyleVillain.DockedParent["Skada"] = MAIN end end; end; if main == "Omen" or alternate == "Omen" then if SuperVillain:IsDockletReady("Omen") then - if alternate == "Omen" and SuperDockletExtra.FrameName ~= "OmenAnchor" then + if alternate == "Omen" and EXTRA.FrameName ~= "OmenAnchor" then tipRight = "and Omen"; SuperVillain:RegisterExtraDocklet("OmenAnchor") - StyleVillain:Docklet_Omen(SuperDockletExtra) - StyleVillain.DockedParent["Omen"] = SuperDockletExtra - elseif SuperDockletMain.FrameName ~= "OmenAnchor" then + StyleVillain:Docklet_Omen(EXTRA) + StyleVillain.DockedParent["Omen"] = EXTRA + elseif MAIN.FrameName ~= "OmenAnchor" then tipLeft = "Omen"; SuperVillain:RegisterMainDocklet("OmenAnchor") - StyleVillain:Docklet_Omen(SuperDockletMain) - StyleVillain.DockedParent["Omen"] = SuperDockletMain + StyleVillain:Docklet_Omen(MAIN) + StyleVillain.DockedParent["Omen"] = MAIN end end; end; if main == "Recount" or alternate == "Recount" then if SuperVillain:IsDockletReady("Recount") then - if alternate == "Recount" and SuperDockletExtra.FrameName ~= "Recount_MainWindow" then + if alternate == "Recount" and EXTRA.FrameName ~= "Recount_MainWindow" then tipRight = "and Recount"; SuperVillain:RegisterExtraDocklet("Recount_MainWindow") - StyleVillain:Docklet_Recount(SuperDockletExtra) - StyleVillain.DockedParent["Recount"] = SuperDockletExtra - elseif SuperDockletMain.FrameName ~= "Recount_MainWindow" then + StyleVillain:Docklet_Recount(EXTRA) + StyleVillain.DockedParent["Recount"] = EXTRA + elseif MAIN.FrameName ~= "Recount_MainWindow" then tipLeft = "Recount"; SuperVillain:RegisterMainDocklet("Recount_MainWindow") - StyleVillain:Docklet_Recount(SuperDockletMain) - StyleVillain.DockedParent["Recount"] = SuperDockletMain + StyleVillain:Docklet_Recount(MAIN) + StyleVillain.DockedParent["Recount"] = MAIN end end; end; if main == "TinyDPS" or alternate == "TinyDPS" then if SuperVillain:IsDockletReady("TinyDPS") then - if alternate == "TinyDPS" and SuperDockletExtra.FrameName ~= "tdpsFrame" then + if alternate == "TinyDPS" and EXTRA.FrameName ~= "tdpsFrame" then tipRight = "and TinyDPS"; SuperVillain:RegisterExtraDocklet("tdpsFrame") - StyleVillain:Docklet_TinyDPS(SuperDockletExtra) - StyleVillain.DockedParent["TinyDPS"] = SuperDockletExtra - elseif SuperDockletMain.FrameName ~= "tdpsFrame" then + StyleVillain:Docklet_TinyDPS(EXTRA) + StyleVillain.DockedParent["TinyDPS"] = EXTRA + elseif MAIN.FrameName ~= "tdpsFrame" then tipLeft = "TinyDPS"; SuperVillain:RegisterMainDocklet("tdpsFrame") - StyleVillain:Docklet_TinyDPS(SuperDockletMain) - StyleVillain.DockedParent["TinyDPS"] = SuperDockletMain + StyleVillain:Docklet_TinyDPS(MAIN) + StyleVillain.DockedParent["TinyDPS"] = MAIN end end; end; if main == "alDamageMeter" or alternate == "alDamageMeter" then if SuperVillain:IsDockletReady("alDamageMeter") then - if alternate == "alDamageMeter" and SuperDockletExtra.FrameName ~= "alDamagerMeterFrame" then + if alternate == "alDamageMeter" and EXTRA.FrameName ~= "alDamagerMeterFrame" then tipRight = "and alDamageMeter"; SuperVillain:RegisterExtraDocklet("alDamagerMeterFrame") - StyleVillain:Docklet_alDamageMeter(SuperDockletExtra) - StyleVillain.DockedParent["alDamageMeter"] = SuperDockletExtra - elseif SuperDockletMain.FrameName ~= "alDamagerMeterFrame" then + StyleVillain:Docklet_alDamageMeter(EXTRA) + StyleVillain.DockedParent["alDamageMeter"] = EXTRA + elseif MAIN.FrameName ~= "alDamagerMeterFrame" then tipLeft = "alDamageMeter"; SuperVillain:RegisterMainDocklet("alDamagerMeterFrame") - StyleVillain:Docklet_alDamageMeter(SuperDockletMain) - StyleVillain.DockedParent["alDamageMeter"] = SuperDockletMain + StyleVillain:Docklet_alDamageMeter(MAIN) + StyleVillain.DockedParent["alDamageMeter"] = MAIN end end; end; @@ -646,6 +742,7 @@ BUILD FUNCTION ########################################################## ]]-- local function LoadStyleOMatic() + SuperVillain.db:Append(defaults) local alert = CreateFrame('Frame', nil, UIParent); alert:SetFixedPanelTemplate('Transparent'); alert:SetSize(250, 70); @@ -694,7 +791,7 @@ local Registry_OnEvent = function(self, event, ...) StyleVillain.BlizzardQueue[addon] = nil; return end; - if not SuperVillain.CoreEnabled or not StyleVillain.BlizzardQueue[addon] then return end; + if not SuperVillain.AddonLaunched or not StyleVillain.BlizzardQueue[addon] then return end; StyleVillain.BlizzardQueue[addon]() StyleVillain.BlizzardQueue[addon] = nil elseif(StyleVillain[event]) then diff --git a/Interface/AddOns/SVUI_StyleOMatic/database/SVStyle.lua b/Interface/AddOns/SVUI_StyleOMatic/database/SVStyle.lua deleted file mode 100644 index a3476be..0000000 --- a/Interface/AddOns/SVUI_StyleOMatic/database/SVStyle.lua +++ /dev/null @@ -1,103 +0,0 @@ ---[[ -############################################################################## -_____/\\\\\\\\\\\____/\\\________/\\\__/\\\________/\\\__/\\\\\\\\\\\_ # - ___/\\\/////////\\\_\/\\\_______\/\\\_\/\\\_______\/\\\_\/////\\\///__ # - __\//\\\______\///__\//\\\______/\\\__\/\\\_______\/\\\_____\/\\\_____ # - ___\////\\\__________\//\\\____/\\\___\/\\\_______\/\\\_____\/\\\_____ # - ______\////\\\________\//\\\__/\\\____\/\\\_______\/\\\_____\/\\\_____ # - _________\////\\\______\//\\\/\\\_____\/\\\_______\/\\\_____\/\\\_____ # - __/\\\______\//\\\______\//\\\\\______\//\\\______/\\\______\/\\\_____ # - _\///\\\\\\\\\\\/________\//\\\________\///\\\\\\\\\/____/\\\\\\\\\\\_# - ___\///////////___________\///___________\/////////_____\///////////_# -############################################################################## -S U P E R - V I L L A I N - U I By: Munglunch # -############################################################################## ---]] -local SuperVillain, L = unpack(SVUI); ---[[ -########################################################## -DB PROFILE VARS -########################################################## -]]-- -defaults["SVStyle"] = { - ["blizzard"] = { - ["enable"] = true, - ["bags"] = true, - ["bmah"] = true, - ["reforge"] = true, - ["calendar"] = true, - ["achievement"] = true, - ["lfguild"] = true, - ["inspect"] = true, - ["binding"] = true, - ["gbank"] = true, - ["archaeology"] = true, - ["guildcontrol"] = true, - ["gossip"] = true, - ["guild"] = true, - ["tradeskill"] = true, - ["raid"] = false, - ["talent"] = true, - ["auctionhouse"] = true, - ["barber"] = true, - ["macro"] = true, - ["debug"] = true, - ["trainer"] = true, - ["socket"] = true, - ["loot"] = true, - ["alertframes"] = true, - ["bgscore"] = true, - ["merchant"] = true, - ["mail"] = true, - ["help"] = true, - ["trade"] = true, - ["gossip"] = true, - ["greeting"] = true, - ["worldmap"] = true, - ["taxi"] = true, - ["quest"] = true, - ["petition"] = true, - ["dressingroom"] = true, - ["pvp"] = true, - ["lfg"] = true, - ["nonraid"] = true, - ["friends"] = true, - ["spellbook"] = true, - ["character"] = true, - ["misc"] = true, - ["tabard"] = true, - ["guildregistrar"] = true, - ["timemanager"] = true, - ["encounterjournal"] = true, - ["voidstorage"] = true, - ["transmogrify"] = true, - ["stable"] = true, - ["bgmap"] = true, - ["mounts"] = true, - ["petbattleui"] = true, - ["losscontrol"] = true, - ["itemUpgrade"] = true, - }, - ["addons"] = { - ["enable"] = true, - ["ace3"] = true, - ["Skada"] = true, - ["Recount"] = true, - ["AtlasLoot"] = true, - ["SexyCooldown"] = true, - ["Lightheaded"] = true, - ["Outfitter"] = true, - ["WeakAuras"] = true, - ["Quartz"] = true, - ["TomTom"] = true, - ["TinyDPS"] = true, - ["Clique"] = true, - ["CoolLine"] = true, - ["ACP"] = true, - ["DXE"] = true, - ["MogIt"] = true, - ["alDamageMeter"] = true, - ["Omen"] = true, - ["TradeSkillDW"] = true, - } -}; \ No newline at end of file