From fbabfadcead90e286d22acc1782d70a48b4f528d Mon Sep 17 00:00:00 2001 From: Munglunch Date: Fri, 25 Jul 2014 15:47:45 -0700 Subject: [PATCH] more code consolidation --- Interface/AddOns/SVUI/SVUI.lua | 435 +++++------ Interface/AddOns/SVUI/SVUI.toc | 4 +- Interface/AddOns/SVUI/language/chinese_ui.lua | 4 +- Interface/AddOns/SVUI/language/english_ui.lua | 4 +- Interface/AddOns/SVUI/language/french_ui.lua | 4 +- Interface/AddOns/SVUI/language/german_ui.lua | 4 +- Interface/AddOns/SVUI/language/italian_ui.lua | 4 +- Interface/AddOns/SVUI/language/korean_ui.lua | 4 +- Interface/AddOns/SVUI/language/portuguese_ui.lua | 4 +- Interface/AddOns/SVUI/language/russian_ui.lua | 4 +- Interface/AddOns/SVUI/language/spanish_ui.lua | 4 +- Interface/AddOns/SVUI/language/taiwanese_ui.lua | 4 +- Interface/AddOns/SVUI/packages/plates/SVPlate.lua | 2 +- Interface/AddOns/SVUI/packages/unit/SVUnit.lua | 10 +- .../AddOns/SVUI/packages/unit/elements/auras.lua | 34 +- Interface/AddOns/SVUI/packages/unit/frames.lua | 32 +- Interface/AddOns/SVUI/system/_load.xml | 2 +- Interface/AddOns/SVUI/system/database.lua | 782 ++++++++++++++++---- Interface/AddOns/SVUI/system/filters.lua | 2 + Interface/AddOns/SVUI/system/system.lua | 154 ++-- .../AddOns/SVUI_ConfigOMatic/modules/filter.lua | 215 +++--- .../AddOns/SVUI_ConfigOMatic/modules/plate.lua | 5 +- .../AddOns/SVUI_ConfigOMatic/modules/profiles.lua | 8 +- .../SVUI_ConfigOMatic/modules/units/core.lua | 10 +- .../SVUI_ConfigOMatic/modules/units/party.lua | 10 +- .../AddOns/SVUI_ConfigOMatic/modules/units/pet.lua | 6 +- .../SVUI_ConfigOMatic/modules/units/raid.lua | 32 +- .../AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua | 281 ++++--- .../AddOns/SVUI_StyleOMatic/database/SVStyle.lua | 103 --- 29 files changed, 1310 insertions(+), 857 deletions(-) delete mode 100644 Interface/AddOns/SVUI_StyleOMatic/database/SVStyle.lua 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 @@