diff --git a/Interface/AddOns/SVUI/assets/artwork/Doodads/COMICS-TYPE1.blp b/Interface/AddOns/SVUI/assets/artwork/Doodads/COMICS-TYPE1.blp index ac9790e..b155a11 100644 Binary files a/Interface/AddOns/SVUI/assets/artwork/Doodads/COMICS-TYPE1.blp and b/Interface/AddOns/SVUI/assets/artwork/Doodads/COMICS-TYPE1.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Doodads/COMICS-TYPE2.blp b/Interface/AddOns/SVUI/assets/artwork/Doodads/COMICS-TYPE2.blp index fa76942..149053b 100644 Binary files a/Interface/AddOns/SVUI/assets/artwork/Doodads/COMICS-TYPE2.blp and b/Interface/AddOns/SVUI/assets/artwork/Doodads/COMICS-TYPE2.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Icons/AURA-MULTISTRIKE.blp b/Interface/AddOns/SVUI/assets/artwork/Icons/AURA-MULTISTRIKE.blp new file mode 100644 index 0000000..6ce3690 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Icons/AURA-MULTISTRIKE.blp differ diff --git a/Interface/AddOns/SVUI/assets/artwork/Icons/AURA-VERSATILITY.blp b/Interface/AddOns/SVUI/assets/artwork/Icons/AURA-VERSATILITY.blp new file mode 100644 index 0000000..9b05708 Binary files /dev/null and b/Interface/AddOns/SVUI/assets/artwork/Icons/AURA-VERSATILITY.blp differ diff --git a/Interface/AddOns/SVUI/docs/schema.lua b/Interface/AddOns/SVUI/docs/schema.lua index fdf841f..b676b51 100644 --- a/Interface/AddOns/SVUI/docs/schema.lua +++ b/Interface/AddOns/SVUI/docs/schema.lua @@ -42,7 +42,7 @@ S U P E R - V I L L A I N - U I By: Munglunch # ]]-- -local lib = _G.LibSuperVillain +local lib = LibSuperVillain("Registry") local PKG = {}; --Here you would build your package object, then... diff --git a/Interface/AddOns/SVUI/language/chinese_ui.lua b/Interface/AddOns/SVUI/language/chinese_ui.lua index 77be406..30304d0 100644 --- a/Interface/AddOns/SVUI/language/chinese_ui.lua +++ b/Interface/AddOns/SVUI/language/chinese_ui.lua @@ -1,4 +1,4 @@ -local L = _G.LibSuperVillain:Lang("zhCN"); +local L = LibSuperVillain("Linguist"):Lang("zhCN"); if not L then return end --[[LOGIN MESSAGE]]-- L["LOGIN_MSG"] = "歡迎使用 |cffFFFF1ASupervillain UI|r! 让您的 %s 和你 %s." diff --git a/Interface/AddOns/SVUI/language/english_ui.lua b/Interface/AddOns/SVUI/language/english_ui.lua index 42b63ea..cb9ca76 100644 --- a/Interface/AddOns/SVUI/language/english_ui.lua +++ b/Interface/AddOns/SVUI/language/english_ui.lua @@ -1,4 +1,4 @@ -local L = _G.LibSuperVillain:Lang("enUS", true); +local L = LibSuperVillain("Linguist"):Lang("enUS", true); if not L then return; end --[[LOGIN MESSAGE]]-- L["LOGIN_MSG"] = "Welcome to |cffFFFF1ASupervillain UI|r! Keep your %s and your %s." diff --git a/Interface/AddOns/SVUI/language/french_ui.lua b/Interface/AddOns/SVUI/language/french_ui.lua index d5f51b8..f25b5f9 100644 --- a/Interface/AddOns/SVUI/language/french_ui.lua +++ b/Interface/AddOns/SVUI/language/french_ui.lua @@ -1,4 +1,4 @@ -local L = _G.LibSuperVillain:Lang("frFR"); +local L = LibSuperVillain("Linguist"):Lang("frFR"); if not L then return; end --[[LOGIN MESSAGE]]-- L["LOGIN_MSG"] = "Bienvenue sur |cffFFFF1ASupervillain UI|r! Gardez votre %s et votre %s." diff --git a/Interface/AddOns/SVUI/language/german_ui.lua b/Interface/AddOns/SVUI/language/german_ui.lua index fc3ac5c..ce04b12 100644 --- a/Interface/AddOns/SVUI/language/german_ui.lua +++ b/Interface/AddOns/SVUI/language/german_ui.lua @@ -1,4 +1,4 @@ -local L = _G.LibSuperVillain:Lang("deDE"); +local L = LibSuperVillain("Linguist"):Lang("deDE"); if not L then return end --[[LOGIN MESSAGE]]-- L["LOGIN_MSG"] = "Willkommen zu |cffFFFF1ASupervillain UI|r! halten Sie Ihre %s und Ihre %s." diff --git a/Interface/AddOns/SVUI/language/italian_ui.lua b/Interface/AddOns/SVUI/language/italian_ui.lua index 66eeb36..b663781 100644 --- a/Interface/AddOns/SVUI/language/italian_ui.lua +++ b/Interface/AddOns/SVUI/language/italian_ui.lua @@ -1,4 +1,4 @@ -local L = _G.LibSuperVillain:Lang("itIT"); +local L = LibSuperVillain("Linguist"):Lang("itIT"); if not L then return; end --[[LOGIN MESSAGE]]-- L["LOGIN_MSG"] = "Benvenuti a |cffFFFF1ASupervillain UI|r! Mantenete il vostro %s e il vostro %s." diff --git a/Interface/AddOns/SVUI/language/korean_ui.lua b/Interface/AddOns/SVUI/language/korean_ui.lua index 30cea20..386315e 100644 --- a/Interface/AddOns/SVUI/language/korean_ui.lua +++ b/Interface/AddOns/SVUI/language/korean_ui.lua @@ -1,4 +1,4 @@ -local L = _G.LibSuperVillain:Lang("koKR"); +local L = LibSuperVillain("Linguist"):Lang("koKR"); if not L then return; end --[[LOGIN MESSAGE]]-- L["LOGIN_MSG"] = "|cffFFFF1AUI를 악당|r에 오신 것을 환영합니다! 귀하의 유지 %s 당신을 %s." diff --git a/Interface/AddOns/SVUI/language/portuguese_ui.lua b/Interface/AddOns/SVUI/language/portuguese_ui.lua index 1bc2bd0..f875f2d 100644 --- a/Interface/AddOns/SVUI/language/portuguese_ui.lua +++ b/Interface/AddOns/SVUI/language/portuguese_ui.lua @@ -1,4 +1,4 @@ -local L = _G.LibSuperVillain:Lang("ptBR"); +local L = LibSuperVillain("Linguist"):Lang("ptBR"); if not L then return; end --[[LOGIN MESSAGE]]-- L["LOGIN_MSG"] = "Bem vindo à |cffFFFF1ASupervillain UI|r! Manter o seu %s e seu %s." diff --git a/Interface/AddOns/SVUI/language/russian_ui.lua b/Interface/AddOns/SVUI/language/russian_ui.lua index 9962fb7..d76aa24 100644 --- a/Interface/AddOns/SVUI/language/russian_ui.lua +++ b/Interface/AddOns/SVUI/language/russian_ui.lua @@ -1,4 +1,4 @@ -local L = _G.LibSuperVillain:Lang("ruRU"); +local L = LibSuperVillain("Linguist"):Lang("ruRU"); if not L then return; end --[[LOGIN MESSAGE]]-- L["LOGIN_MSG"] = "обро пожаловать в |cffFFFF1ASupervillain UI|r! Держите свои %s и ваши %s." diff --git a/Interface/AddOns/SVUI/language/spanish_ui.lua b/Interface/AddOns/SVUI/language/spanish_ui.lua index b5fabba..0e1c185 100644 --- a/Interface/AddOns/SVUI/language/spanish_ui.lua +++ b/Interface/AddOns/SVUI/language/spanish_ui.lua @@ -1,6 +1,7 @@ -local L = _G.LibSuperVillain:Lang("esES"); +local Localization = LibSuperVillain("Linguist") +local L = Localization:Lang("esES"); if not L then - L = _G.LibSuperVillain:Lang("esMX") + L = Localization:Lang("esMX") end if not L then return; end --[[LOGIN MESSAGE]]-- diff --git a/Interface/AddOns/SVUI/language/taiwanese_ui.lua b/Interface/AddOns/SVUI/language/taiwanese_ui.lua index 9a60c71..de62e82 100644 --- a/Interface/AddOns/SVUI/language/taiwanese_ui.lua +++ b/Interface/AddOns/SVUI/language/taiwanese_ui.lua @@ -1,4 +1,4 @@ -local L = _G.LibSuperVillain:Lang("zhTW"); +local L = LibSuperVillain("Linguist"):Lang("zhTW"); if not L then return; end --[[LOGIN MESSAGE]]-- L["LOGIN_MSG"] = "歡迎使用 |cffFFFF1ASupervillain UI|r! 让您的 %s 和你 %s." diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.lua index b7e8b1c..014c72a 100644 --- a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.lua +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.lua @@ -17,1280 +17,32 @@ \_/ |______/|________/|________/|__/ |__/|______/|__/ \__/ -LibSuperVillain is a library used to manage localization, packages, scripts and data embedded +LibSuperVillain is a library used to manage localization, packages, scripts, animations and data embedded into the SVUI core addon. It's main purpose is to keep all methods and logic needed to properly keep -core add-ins functioning outside of the core object. +core add-ins functioning outside of the core object and away from other libraries like LibStub. --]] +local _G = getfenv(0) ---[[ LOCALIZED GLOBALS ]]-- ---GLOBAL NAMESPACE -local _G = getfenv(0); ---LUA -local unpack = _G.unpack; -local select = _G.select; -local assert = _G.assert; -local type = _G.type; -local error = _G.error; -local pcall = _G.pcall; -local print = _G.print; -local ipairs = _G.ipairs; -local pairs = _G.pairs; -local next = _G.next; -local rawset = _G.rawset; -local rawget = _G.rawget; -local tostring = _G.tostring; -local tonumber = _G.tonumber; -local getmetatable = _G.getmetatable; -local setmetatable = _G.setmetatable; ---STRING -local string = _G.string; -local upper = string.upper; -local format = string.format; -local find = string.find; -local match = string.match; -local gsub = string.gsub; ---MATH -local math = _G.math; -local floor = math.floor ---TABLE -local table = _G.table; -local tsort = table.sort; -local tconcat = table.concat; -local tinsert = _G.tinsert; -local tremove = _G.tremove; -local twipe = _G.wipe; ---BLIZZARD API -local ReloadUI = _G.ReloadUI; -local GetLocale = _G.GetLocale; -local CreateFrame = _G.CreateFrame; -local IsAddOnLoaded = _G.IsAddOnLoaded; -local GetNumAddOns = _G.GetNumAddOns; -local GetAddOnInfo = _G.GetAddOnInfo; -local LoadAddOn = _G.LoadAddOn; -local EnableAddOn = _G.EnableAddOn; -local GetSpecialization = _G.GetSpecialization; -local GetAddOnMetadata = _G.GetAddOnMetadata; -local IsAddOnLoadOnDemand = _G.IsAddOnLoadOnDemand; +local LibSuperVillain = _G["LibSuperVillain"] - ---[[ LIB CONSTRUCT ]]-- -local lib -do - _G.LibSuperVillain = {} - lib = _G.LibSuperVillain -end - ---[[ ADDON DATA ]]-- - -local CoreName, CoreObject = ... -local AddonVersion = GetAddOnMetadata(..., "Version"); -local SchemaFromMeta = "X-" .. CoreName .. "-Schema"; -local HeaderFromMeta = "X-" .. CoreName .. "-Header"; -local InterfaceVersion = select(4, GetBuildInfo()); - ---[[ COMMON LOCAL VARS ]]-- - -local GLOBAL_FILENAME = CoreName.."_Global"; -local ERROR_FILENAME = CoreName.."_Errors"; -local PROFILE_FILENAME = CoreName.."_Profile"; -local CACHE_FILENAME = CoreName.."_Cache"; -local SOURCE_KEY = 1; -local GLOBAL_SV, PROFILE_SV, CACHE_SV, ERROR_CACHE, PLUGINS, MODULES; -local PluginString = "" -local AllowedIndexes, LoadOnDemand = {},{}; -local Callbacks, ScriptQueue = {},{}; - -local playerClass = select(2,UnitClass("player")); - -local INFO_FORMAT = "|cffFFFF00%s|r\n |cff33FF00Version: %s|r |cff0099FFby %s|r"; - -if GetLocale() == "ruRU" then - INFO_FORMAT = "|cffFFFF00%s|r\n |cff33FF00Версия: %s|r |cff0099FFот %s|r"; -end - ---[[ LIB EVENT LISTENER ]]-- - -lib.EventManager = CreateFrame("Frame", nil) - ---[[ COMMON META METHODS ]]-- - -local rootstring = function(self) return self.NameID end - ---[[ CUSTOM LUA METHODS ]]-- - ---LOCAL HELPERS -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 - ---APPENDED METHODS -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 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.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 find(this, '^%s*$') and '' or match(this, '^%s*(.*%S)') -end - -function string.color(this, color) - return format("|cff%s%s|r", color, this) -end - -function string.link(this, prefix, text, color) - text = tostring(text) - local colorstring = tostring(this):color(color or "ffffff") - return format("|H%s:%s|h%s|h", prefix, text, colorstring) -end - -function string.explode(str, delim) - local res = {} - local pattern = format("([^%s]+)%s()", delim, delim) - local line, pos - while (true) do - line, pos = match(str, pattern, pos) - if line == nil then break end - tinsert(res, line) - end - return res -end - ---[[ - /$$ /$$ /$$ /$$ -| $$ |__/ |__/ | $$ -| $$ /$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$$$$$$/$$$$$$ -| $$ | $$| $$__ $$ /$$__ $$| $$ | $$| $$ /$$_____/_ $$_/ -| $$ | $$| $$ \ $$| $$ \ $$| $$ | $$| $$| $$$$$$ | $$ -| $$ | $$| $$ | $$| $$ | $$| $$ | $$| $$ \____ $$ | $$ /$$ -| $$$$$$$$| $$| $$ | $$| $$$$$$$| $$$$$$/| $$ /$$$$$$$/ | $$$$/ -|________/|__/|__/ |__/ \____ $$ \______/ |__/|_______/ \___/ - /$$ \ $$ - | $$$$$$/ - \______/ - -Linguist is a simple localization component. Seriously, thats it! ---]] - ---LINGUIST HELPERS -local activeLocale - -local failsafe = function() assert(false) end - ---LINGUIST META METHODS -local metaread = { - __index = function(self, key) - rawset(self, key, key) - return key - end -} - -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 metawrite = setmetatable({}, { - __newindex = function(self, key, value) - rawset(activeLocale, key, value == true and key or value) - end, - __index = failsafe -}) - ---LINGUIST STORAGE -lib.Localization = setmetatable({}, metaread); - ---LINGUIST PUBLIC METHOD -function lib:Lang(locale, isDefault) - if(not locale) then - return self.Localization - else - local GAME_LOCALE = GetLocale() - if GAME_LOCALE == "enGB" then GAME_LOCALE = "enUS" end - - activeLocale = self.Localization - - if isDefault then - return defaultwrite - elseif(locale == GAME_LOCALE) then - return metawrite - end - end -end - ---[[ - /$$$$$$$ /$$ /$$ -| $$__ $$ | $$ | $$ -| $$ \ $$ /$$$$$$ /$$$$$$ /$$$$$$ | $$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ -| $$ | $$|____ $$|_ $$_/ |____ $$| $$__ $$|____ $$ /$$_____/ /$$__ $$ -| $$ | $$ /$$$$$$$ | $$ /$$$$$$$| $$ \ $$ /$$$$$$$| $$$$$$ | $$$$$$$$ -| $$ | $$/$$__ $$ | $$ /$$/$$__ $$| $$ | $$/$$__ $$ \____ $$| $$_____/ -| $$$$$$$/ $$$$$$$ | $$$$/ $$$$$$$| $$$$$$$/ $$$$$$$ /$$$$$$$/| $$$$$$$ -|_______/ \_______/ \___/ \_______/|_______/ \_______/|_______/ \_______/ - - -DataBase is a component used to create and manage SVUI data objects. - -It's main purpose is to keep all methods and logic needed to properly maintain -valid data outside of the core object. ---]] - ---DATABASE LOCAL HELPERS -local function SanitizeStorage(data) - for k,v in pairs(data) do - if(k == "STORED" or k == "SAFEDATA" or k == "LAYOUT") then - data[k] = nil - end - end -end - -local function LiveProfileChange() - local LastKey = SOURCE_KEY - if(PROFILE_SV.SAFEDATA and PROFILE_SV.SAFEDATA.dualSpecEnabled) then - SOURCE_KEY = GetSpecialization() - lib.EventManager:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") - - if(not SOURCE_KEY) then - SOURCE_KEY = 1 - end - - if(LastKey ~= SOURCE_KEY) then - --construct core dataset - local db = rawget(CoreObject.db, "data") - db = PROFILE_SV.STORED[SOURCE_KEY] - - local cache = rawget(CoreObject.cache, "data") - cache = CACHE_SV.STORED[SOURCE_KEY] - - if(CoreObject.ReLoad) then - CoreObject:ReLoad() - end - - lib:RefreshAll() - end - else - SOURCE_KEY = 1 - lib.EventManager:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") - end -end - -local function tablecopy(d, s, debug) - if(debug) then - print(debug) - assert(type(s) == "table", "tablecopy ERROR: source (" .. debug .. ") is not a table") - assert(type(d) == "table", "tablecopy ERROR: destination (" .. debug .. ") is not a table") - end - if(type(s) ~= "table") then return end - if(type(d) ~= "table") then return end - for k, v in pairs(s) do - local saved = rawget(d, k) - if type(v) == "table" then - if not saved then rawset(d, k, {}) end - tablecopy(d[k], v) - elseif(saved == nil or (saved and type(saved) ~= type(v))) then - rawset(d, k, v) - end - end -end - -local function tablesplice(targetTable, mergeTable) - if type(targetTable) ~= "table" then targetTable = {} end - - if type(mergeTable) == 'table' then - for key,val in pairs(mergeTable) do - if type(val) == "table" then - val = tablesplice(targetTable[key], val) - end - targetTable[key] = val - end - end - return targetTable -end - -local function importdata(s, d) - if type(d) ~= "table" then d = {} end - if type(s) == "table" then - for k,v in pairs(s) do - if type(v) == "table" then - v = importdata(v, d[k]) - end - d[k] = v - end - end - return d -end - -local function removedefaults(db, src, nometa) - if(type(src) ~= "table") then - if(db == src) then db = nil end - return - end - if(not nometa) then - setmetatable(db, nil) - end - for k,v in pairs(src) do - if type(v) == "table" and type(db[k]) == "table" then - removedefaults(db[k], v, nometa) - if next(db[k]) == nil then - db[k] = nil - end - else - if db[k] == v then - db[k] = nil - end - end - end -end - ---DATABASE META METHODS -local meta_transdata = { - __index = function(t, k) - if(not k or k == "") then return end - local sv = rawget(t, "data") - local dv = rawget(t, "defaults") - local src = dv and dv[k] - - if(src ~= nil) then - if(type(src) == "table") then - if(sv[k] == nil or (sv[k] ~= nil and type(sv[k]) ~= "table")) then sv[k] = {} end - tablecopy(sv[k], src) - else - if(sv[k] == nil or (sv[k] ~= nil and type(sv[k]) ~= type(src))) then sv[k] = src end - end - end - - rawset(t, k, sv[k]) - return rawget(t, k) - end, -} - -local meta_database = { - __index = function(t, k) - if(not k or k == "") then return end - local sv = rawget(t, "data") - if(not sv[k]) then sv[k] = {} end - rawset(t, k, sv[k]) - return rawget(t, k) - end, -} - ---DATABASE PUBLIC METHODS -function lib:Remove(key) - if(GLOBAL_SV.profiles[key]) then GLOBAL_SV.profiles[key] = nil end - if(GLOBAL_SV.cache[key]) then GLOBAL_SV.cache[key] = nil end - twipe(GLOBAL_SV.profileKeys) - for k,v in pairs(GLOBAL_SV.profiles) do - GLOBAL_SV.profileKeys[k] = k - end - for k,v in pairs(GLOBAL_SV.cache) do - GLOBAL_SV.profileKeys[k] = k - end -end - -function lib:GetProfiles() - local list = GLOBAL_SV.profileKeys or {} - return list -end - -function lib:CheckProfiles() - local hasProfile = false - local list = GLOBAL_SV.profileKeys or {} - for key,_ in pairs(list) do - hasProfile = true - end - return hasProfile -end - -function lib:ImportDatabase(key) - if(not GLOBAL_SV.profiles[key]) then GLOBAL_SV.profiles[key] = {} end; - PROFILE_SV.STORED[SOURCE_KEY] = GLOBAL_SV.profiles[key] - - if(not GLOBAL_SV.cache[key]) then GLOBAL_SV.cache[key] = {} end; - CACHE_SV.STORED[SOURCE_KEY] = GLOBAL_SV.cache[key] - - ReloadUI() -end - -function lib:ExportDatabase(key) - local export, saved - - if(not GLOBAL_SV.profiles[key]) then GLOBAL_SV.profiles[key] = {} end; - export = rawget(CoreObject.db, "data"); - saved = GLOBAL_SV.profiles[key]; - tablecopy(saved, export); - - if not GLOBAL_SV.cache[key] then GLOBAL_SV.cache[key] = {} end - export = rawget(CoreObject.cache, "data") - saved = GLOBAL_SV.cache[key] - tablecopy(saved, export); - - - twipe(GLOBAL_SV.profileKeys) - for k,v in pairs(GLOBAL_SV.profiles) do - GLOBAL_SV.profileKeys[k] = k - end - for k,v in pairs(GLOBAL_SV.cache) do - GLOBAL_SV.profileKeys[k] = k - end -end - -function lib:WipeDatabase() - for k,v in pairs(PROFILE_SV.STORED[SOURCE_KEY]) do - PROFILE_SV.STORED[SOURCE_KEY][k] = nil - end -end - -function lib:WipeCache(index) - if(index) then - CACHE_SV.STORED[SOURCE_KEY][index] = nil - else - for k,v in pairs(CACHE_SV.STORED[SOURCE_KEY]) do - CACHE_SV.STORED[SOURCE_KEY][k] = nil - end - end -end - -function lib:WipeGlobal() - for k,v in pairs(GLOBAL_SV) do - GLOBAL_SV[k] = nil - end -end - -function lib:GetSafeData(index) - if(index) then - return PROFILE_SV.SAFEDATA[index] - else - return PROFILE_SV.SAFEDATA - end -end - -function lib:SaveSafeData(index, value) - PROFILE_SV.SAFEDATA[index] = value -end - -function lib:CheckData(schema, key) - local file = PROFILE_SV.STORED[SOURCE_KEY][schema] - print("______" .. schema .. ".db[" .. key .. "]_____") - print(file[key]) - print("______SAVED_____") -end - -function lib:NewGlobal(index) - index = index or CoreObject.Schema - if(not GLOBAL_SV[index]) then - GLOBAL_SV[index] = {} - end - return GLOBAL_SV[index] -end - ---[[ - /$$$$$$$ /$$ /$$ -| $$__ $$ |__/ | $$ -| $$ \ $$ /$$$$$$ /$$$$$$ /$$ /$$$$$$$/$$$$$$ /$$$$$$ /$$ /$$ -| $$$$$$$/ /$$__ $$ /$$__ $$| $$ /$$_____/_ $$_/ /$$__ $$| $$ | $$ -| $$__ $$| $$$$$$$$| $$ \ $$| $$| $$$$$$ | $$ | $$ \__/| $$ | $$ -| $$ \ $$| $$_____/| $$ | $$| $$ \____ $$ | $$ /$$| $$ | $$ | $$ -| $$ | $$| $$$$$$$| $$$$$$$| $$ /$$$$$$$/ | $$$$/| $$ | $$$$$$$ -|__/ |__/ \_______/ \____ $$|__/|_______/ \___/ |__/ \____ $$ - /$$ \ $$ /$$ | $$ - | $$$$$$/ | $$$$$$/ - \______/ \______/ - -Registry is a component used to manage packages and scripts embedded -into the SVUI core addon. - -It's main purpose is to keep all methods and logic needed to properly keep -core add-ins functioning outside of the core object. ---]] - ---REGISTRY LOCAL HELPERS - -local function HandleErrors(schema, action, catch) - if(CoreObject.DebugMode == true) then - schema = schema or "LibSuperVillain" - action = action or "Unknown Function" - local timestamp = date("%m/%d/%y %H:%M:%S") - local err_message = ("%s [%s] - (%s) %s"):format(schema, action, timestamp, catch) - tinsert(ERROR_CACHE.FOUND, err_message) - --ScriptErrorsFrame_OnError(catch, false, true) - CoreObject:Debugger(err_message) - end -end - -local function LoadingProxy(schema, obj) - if(not obj) then return end - if(not obj.initialized) then - if(obj.Load and type(obj.Load) == "function") then - local _, catch = pcall(obj.Load, obj) - if(catch) then - HandleErrors(schema, "Load", catch) - else - obj.initialized = true - end - end - else - if(obj.ReLoad and type(obj.ReLoad) == "function") then - local _, catch = pcall(obj.ReLoad, obj) - if(catch) then - HandleErrors(schema, "ReLoad", catch) - end - end - end -end - ---OBJECT INTERNALS - -local changeDBVar = function(self, value, key, sub1, sub2, sub3) - local db = CoreObject.db[self.Schema] - if((sub1 and sub2 and sub3) and (db[sub1] and db[sub1][sub2] and db[sub1][sub2][sub3])) then - db[sub1][sub2][sub3][key] = value - elseif((sub1 and sub2) and (db[sub1] and db[sub1][sub2])) then - db[sub1][sub2][key] = value - elseif(sub1 and db[sub1]) then - db[sub1][key] = value - else - db[key] = value - end - - if(self.UpdateLocals) then - self:UpdateLocals() - end -end - -local changePluginDBVar = function(self, value, key, sub1, sub2, sub3) - local db = self.db - if((sub1 and sub2 and sub3) and (db[sub1] and db[sub1][sub2] and db[sub1][sub2][sub3])) then - db[sub1][sub2][sub3][key] = value - elseif((sub1 and sub2) and (db[sub1] and db[sub1][sub2])) then - db[sub1][sub2][key] = value - elseif(sub1 and db[sub1]) then - db[sub1][key] = value - else - db[key] = value - end - - if(self.UpdateLocals) then - self:UpdateLocals() - end -end - -local innerOnEvent = function(self, event, ...) - local obj = self.___owner - local fn = self[event] - if(fn and type(fn) == "function" and obj.initialized) then - local _, catch = pcall(fn, obj, event, ...) - if(catch) then - local schema = obj.Schema - HandleErrors(schema, event, catch) - end - end -end - -local registerEvent = function(self, eventname, eventfunc) - if not self.___eventframe then - self.___eventframe = CreateFrame("Frame", nil) - self.___eventframe.___owner = self - self.___eventframe:SetScript("OnEvent", innerOnEvent) - end - - if(not self.___eventframe[eventname]) then - local fn = eventfunc - if type(eventfunc) == "string" then - fn = self[eventfunc] - elseif(not fn and self[eventname]) then - fn = self[eventname] - end - self.___eventframe[eventname] = fn - end +if not LibSuperVillain then + LibSuperVillain = LibSuperVillain or {libs = {}} + _G["LibSuperVillain"] = LibSuperVillain - self.___eventframe:RegisterEvent(eventname) -end - -local unregisterEvent = function(self, event, ...) - if(self.___eventframe) then - self.___eventframe:UnregisterEvent(event) - end -end - -local innerOnUpdate = function(self, elapsed) - if self.elapsed and self.elapsed > (self.throttle) then - local obj = self.___owner - local callbacks = self.callbacks - - for name, fn in pairs(callbacks) do - local _, catch = pcall(fn, obj) - if(catch and CoreObject.Debugging) then - print(catch) - end - end - - self.elapsed = 0 - else - self.elapsed = (self.elapsed or 0) + elapsed - end -end - -local registerUpdate = function(self, updatefunc, throttle) - if not self.___updateframe then - self.___updateframe = CreateFrame("Frame", nil); - self.___updateframe.___owner = self; - self.___updateframe.callbacks = {}; - self.___updateframe.elapsed = 0; - self.___updateframe.throttle = throttle or 0.2; - end - - if(updatefunc and type(updatefunc) == "string" and self[updatefunc]) then - self.___updateframe.callbacks[updatefunc] = self[updatefunc] - end - - self.___updateframe:SetScript("OnUpdate", innerOnUpdate) -end - -local unregisterUpdate = function(self, updatefunc) - if(updatefunc and type(updatefunc) == "string" and self.___updateframe.callbacks[updatefunc]) then - self.___updateframe.callbacks[updatefunc] = nil - if(#self.___updateframe.callbacks == 0) then - self.___updateframe:SetScript("OnUpdate", nil) - end - else - self.___updateframe:SetScript("OnUpdate", nil) - end -end - -local function SetPluginString(addonName) - local author = GetAddOnMetadata(addonName, "Author") or "Unknown" - local name = GetAddOnMetadata(addonName, "Title") or addonName - local version = GetAddOnMetadata(addonName, "Version") or "???" - return INFO_FORMAT:format(name, version, author) -end - ---REGISTRY PUBLIC METHODS - -function lib:RunCallbacks() - for i=1, #Callbacks do - local fn = Callbacks[i] - if(fn and type(fn) == "function") then - local _, catch = pcall(fn) - if(catch) then - HandleErrors("LibSuperVillain", "Callback", catch) - end - end - end -end - -function lib:RefreshModule(schema) - local obj = CoreObject[schema] - LoadingProxy(schema, obj) -end - -function lib:RefreshPlugin(schema) - local obj = _G[schema] - LoadingProxy(schema, obj) -end - -function lib:RefreshAll() - for _,schema in pairs(MODULES) do - local obj = CoreObject[schema] - LoadingProxy(schema, obj) - end - - for schema,_ in pairs(PLUGINS) do - local obj = _G[schema] - LoadingProxy(schema, obj) - end -end - -function lib:LiveUpdate() - if(PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE and not C_PetBattles.IsInBattle()) then - self:RefreshAll() - PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE = false - end -end - -function lib:GetModuletable() - return MODULES -end - -function lib:GetPlugins() - return PluginString -end - -function lib:CheckDualProfile() - return PROFILE_SV.SAFEDATA.dualSpecEnabled -end - -function lib:ToggleDualProfile(enabled) - PROFILE_SV.SAFEDATA.dualSpecEnabled = enabled - if(enabled) then - self.EventManager:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") - LiveProfileChange() - else - self.EventManager:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") - end -end - -function lib:LoadQueuedModules() - if MODULES then - for i=1,#MODULES do - local schema = MODULES[i] - local obj = CoreObject[schema] - local data = CoreObject.db[schema] - if(obj and data and data.enable and (not obj.initialized)) then - local halt = false - if(data.incompatible) then - for addon,_ in pairs(data.incompatible) do - if IsAddOnLoaded(addon) then halt = true end - end - end - if(not halt) then - LoadingProxy(schema, obj) - end - end - end - end -end - -function lib:LoadQueuedPlugins() - if PLUGINS then - for schema,files in pairs(PLUGINS) do - local obj = _G[schema] - local enabled = PROFILE_SV.SAFEDATA[schema].enable - if(obj and enabled and (not obj.initialized)) then - local halt = false - - if((not obj.db) and files.PROFILE and _G[files.PROFILE]) then - local db = setmetatable({}, meta_transdata) - db.data = _G[files.PROFILE] - db.defaults = obj.configs - obj.db = db - end - - if((not obj.cache) and files.CACHE and _G[files.CACHE]) then - local cache = setmetatable({}, meta_database) - cache.data = _G[files.CACHE] - obj.cache = cache - end - - if((not obj.public) and files.GLOBAL and _G[files.GLOBAL]) then - local public = setmetatable({}, meta_database) - public.data = _G[files.GLOBAL] - obj.public = public - end - - if(obj.db and obj.db.incompatible) then - for addon,_ in pairs(obj.db.incompatible) do - if IsAddOnLoaded(addon) then halt = true end - end - end - - if(not halt) then - LoadingProxy(schema, obj) - end - end - end + function LibSuperVillain:NewLibrary(libName) + assert(type(libName) == "string", "Missing Library Name") + self.libs[libName] = self.libs[libName] or {} + return self.libs[libName] end -end - ---[[ CONSTRUCTORS ]]-- - -function lib:NewPlugin(addonName, addonObject, pfile, gfile, cfile) - local version = GetAddOnMetadata(addonName, "Version") - local header = GetAddOnMetadata(addonName, HeaderFromMeta) - local schema = GetAddOnMetadata(addonName, SchemaFromMeta) - local lod = IsAddOnLoadOnDemand(addonName) - - PROFILE_SV.SAFEDATA[schema] = PROFILE_SV.SAFEDATA[schema] or {["enable"] = true} - - local addonmeta = {} - local oldmeta = getmetatable(addonObject) - if oldmeta then - for k, v in pairs(oldmeta) do addonmeta[k] = v end - end - addonmeta.__tostring = rootstring - setmetatable( addonObject, addonmeta ) - - addonObject.Version = version - addonObject.NameID = addonName - addonObject.TitleID = header - addonObject.Schema = schema - addonObject.LoD = lod - addonObject.initialized = false - addonObject.CombatLocked = false - addonObject.ChangeDBVar = changePluginDBVar - addonObject.RegisterEvent = registerEvent - addonObject.UnregisterEvent = unregisterEvent - addonObject.RegisterUpdate = registerUpdate - addonObject.UnregisterUpdate = unregisterUpdate - - if(IsAddOnLoaded(addonName) and not lod) then - CoreObject.Options.args.plugins.args.pluginOptions.args[schema] = { - type = "group", - name = header, - childGroups = "tree", - args = { - enable = { - order = 1, - type = "toggle", - name = "Enable", - get = function() - return PROFILE_SV.SAFEDATA[schema].enable - end, - set = function(key, value) - PROFILE_SV.SAFEDATA[schema].enable = value; - CoreObject:StaticPopup_Show("RL_CLIENT") - end, - } - } - } - end - - _G[schema] = addonObject - - if(not PLUGINS) then PLUGINS = {} end - - PLUGINS[schema] = { - ["GLOBAL"] = gfile, - ["PROFILE"] = pfile, - ["CACHE"] = cfile, - }; - - local infoString = SetPluginString(addonName) - local oldString = PluginString - PluginString = ("%s%s\n"):format(oldString, infoString) - - return addonObject -end - -local function NewLoadOnDemand(addonName, schema, header) - LoadOnDemand[schema] = addonName; - PROFILE_SV.SAFEDATA[schema] = PROFILE_SV.SAFEDATA[schema] or {["enable"] = false} - CoreObject.Options.args.plugins.args.pluginOptions.args[schema] = { - type = "group", - name = header, - childGroups = "tree", - args = { - enable = { - order = 1, - type = "execute", - width = "full", - name = function() - local nameString = "Disable" - if(not IsAddOnLoaded(addonName)) then - nameString = "Enable" - end - return nameString - end, - func = function() - if(not IsAddOnLoaded(addonName)) then - local loaded, reason = LoadAddOn(addonName) - PROFILE_SV.SAFEDATA[schema].enable = true - lib:LoadQueuedPlugins() - else - PROFILE_SV.SAFEDATA[schema].enable = false - CoreObject:StaticPopup_Show("RL_CLIENT") - end - end, - } - } - } -end - ---LIBRARY EVENT HANDLING - -local Library_OnEvent = function(self, event, arg, ...) - if(event == "PLAYER_LOGOUT") then - local sv = rawget(CoreObject.db, "data") - local src = rawget(CoreObject.db, "defaults") - for k,v in pairs(sv) do - if(not src[k]) then - sv[k] = nil - elseif(src[k] ~= nil and (not LoadOnDemand[k])) then - removedefaults(sv[k], src[k]) - end - end - elseif(event == "ADDON_LOADED") then - if(arg == CoreName) then - if(not CoreObject.___loaded and CoreObject.Load) then - CoreObject:Load() - CoreObject.___loaded = true - self:UnregisterEvent("ADDON_LOADED") - end - end - elseif(event == "PLAYER_LOGIN") then - if(not CoreObject.___initialized and CoreObject.Initialize and IsLoggedIn()) then - CoreObject:Initialize() - CoreObject.___initialized = true - self:UnregisterEvent("PLAYER_LOGIN") - end - elseif(event == "ACTIVE_TALENT_GROUP_CHANGED") then - LiveProfileChange() - end -end - --- CORE OBJECT CONSTRUCT - -local Core_NewCallback = function(self, fn) - if(fn and type(fn) == "function") then - Callbacks[#Callbacks+1] = fn - end -end - -local Core_NewScript = function(self, fn) - if(fn and type(fn) == "function") then - ScriptQueue[#ScriptQueue+1] = fn - end -end - -local Core_NewPackage = function(self, schema, header) - if(self[schema]) then return end - - if(not MODULES) then MODULES = {} end - MODULES[#MODULES+1] = schema - - AllowedIndexes[schema] = schema - - local addonName = ("SVUI [%s]"):format(schema) - - local obj = { - NameID = addonName, - TitleID = header, - Schema = schema, - initialized = false, - CombatLocked = false, - ChangeDBVar = changeDBVar, - RegisterEvent = registerEvent, - UnregisterEvent = unregisterEvent, - RegisterUpdate = registerUpdate, - UnregisterUpdate = unregisterUpdate - } - - local addonmeta = {} - local oldmeta = getmetatable(obj) - if oldmeta then - for k, v in pairs(oldmeta) do addonmeta[k] = v end - end - addonmeta.__tostring = rootstring - setmetatable( obj, addonmeta ) - - self[schema] = obj - return self[schema] -end - -local Core_ResetData = function(self, sub, sub2, sub3) - local data = self.db - local sv = rawget(data, "data") - local src = rawget(data, "defaults") - local targetData - if(sub3 and sub2 and sv and sv[sub] and sv[sub][sub2]) then - targetData = sv[sub][sub2][sub3] - elseif(sub2 and sv and sv[sub]) then - targetData = sv[sub][sub2] - elseif(sub and sv) then - targetData = sv[sub] - else - targetData = sv - end - if(targetData) then - for k,v in pairs(targetData) do - targetData[k] = nil + function LibSuperVillain:Fetch(libName, silent) + if not self.libs[libName] and not silent then + error(("Cannot find a library instance of %q."):format(tostring(libName)), 2) end - else - sv = {} - end - tablecopy(sv, src) -end - -function lib:NewCore(gfile, efile, pfile, cfile) - --meta assurance - local mt = {}; - local old = getmetatable(CoreObject); - if old then - for k, v in pairs(old) do mt[k] = v end - end - mt.__tostring = rootstring; - setmetatable(CoreObject, mt); - - --database - GLOBAL_FILENAME = gfile or GLOBAL_FILENAME - ERROR_FILENAME = efile or ERROR_FILENAME - PROFILE_FILENAME = pfile or PROFILE_FILENAME - CACHE_FILENAME = cfile or CACHE_FILENAME - - --events - if(not self.EventManager.Initialized) then - self.EventManager:RegisterEvent("ADDON_LOADED") - self.EventManager:RegisterEvent("PLAYER_LOGIN") - self.EventManager:RegisterEvent("PLAYER_LOGOUT") - self.EventManager:SetScript("OnEvent", Library_OnEvent) - self.EventManager.Initialized = true + return self.libs[libName] end - --internals - CoreObject.___errors = {}; - - CoreObject.NameID = CoreName; - CoreObject.Version = AddonVersion; - CoreObject.GameVersion = tonumber(InterfaceVersion); - CoreObject.DebugMode = false; - CoreObject.Schema = GetAddOnMetadata(CoreName, SchemaFromMeta); - CoreObject.TitleID = GetAddOnMetadata(CoreName, HeaderFromMeta); - - CoreObject.RegisterEvent = registerEvent - CoreObject.UnregisterEvent = unregisterEvent - CoreObject.RegisterUpdate = registerUpdate - CoreObject.UnregisterUpdate = unregisterUpdate - - CoreObject.NewCallback = Core_NewCallback - CoreObject.NewScript = Core_NewScript - CoreObject.NewPackage = Core_NewPackage - CoreObject.ResetData = Core_ResetData - CoreObject.db = tablesplice(CoreObject.configs, {}) - CoreObject.L = self:Lang() - - --set global - _G[CoreName] = CoreObject; - - return _G[CoreName] + setmetatable(LibSuperVillain, { __call = LibSuperVillain.Fetch }) end - --- INITIALIZE AND LAUNCH - -function lib:Initialize() - local coreSchema = CoreObject.Schema - --GLOBAL SAVED VARIABLES - if not _G[GLOBAL_FILENAME] then _G[GLOBAL_FILENAME] = {} end - GLOBAL_SV = _G[GLOBAL_FILENAME] - - if(GLOBAL_SV.profileKeys) then - twipe(GLOBAL_SV.profileKeys) - else - GLOBAL_SV.profileKeys = {} - end - - GLOBAL_SV.profiles = GLOBAL_SV.profiles or {} - for k,v in pairs(GLOBAL_SV.profiles) do - GLOBAL_SV.profileKeys[k] = k - end - - GLOBAL_SV.cache = GLOBAL_SV.cache or {} - for k,v in pairs(GLOBAL_SV.cache) do - GLOBAL_SV.profileKeys[k] = k - end - - --SAVED ERRORS - if not _G[ERROR_FILENAME] then _G[ERROR_FILENAME] = {} end - ERROR_CACHE = _G[ERROR_FILENAME] - - local datestamp = date("%m_%d_%y") - - if(ERROR_CACHE.TODAY and ERROR_CACHE.TODAY ~= datestamp) then - ERROR_CACHE.FOUND = {} - end - - if(not ERROR_CACHE.FOUND) then - ERROR_CACHE.FOUND = {} - end - - ERROR_CACHE.TODAY = datestamp - - --CACHE SAVED VARIABLES - if not _G[CACHE_FILENAME] then _G[CACHE_FILENAME] = {} end - CACHE_SV = _G[CACHE_FILENAME] - if(not CACHE_SV.STORED) then - CACHE_SV.STORED = {} - CACHE_SV.STORED[1] = {} - CACHE_SV.STORED[2] = {} - CACHE_SV.STORED[3] = {} - if playerClass == "DRUID" then - CACHE_SV.STORED[4] = {} - end - for k,v in pairs(CACHE_SV) do - if(k ~= "STORED") then - CACHE_SV.STORED[1][k] = v - end - end - end - - --PROFILE SAVED VARIABLES - if not _G[PROFILE_FILENAME] then _G[PROFILE_FILENAME] = {} end - PROFILE_SV = _G[PROFILE_FILENAME] - PROFILE_SV.SAFEDATA = PROFILE_SV.SAFEDATA or {dualSpecEnabled = false} - - if not PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE then PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE = false end - - if(PROFILE_SV.SAFEDATA and PROFILE_SV.SAFEDATA.dualSpecEnabled) then - SOURCE_KEY = GetSpecialization() or 1 - self.EventManager:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") - else - SOURCE_KEY = 1 - self.EventManager:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") - end - - if(not PROFILE_SV.STORED) then - PROFILE_SV.STORED = {} - PROFILE_SV.STORED[1] = {} - PROFILE_SV.STORED[1][coreSchema] = {} - PROFILE_SV.STORED[2] = {} - PROFILE_SV.STORED[2][coreSchema] = {} - PROFILE_SV.STORED[3] = {} - PROFILE_SV.STORED[3][coreSchema] = {} - if playerClass == "DRUID" then - PROFILE_SV.STORED[4] = {} - PROFILE_SV.STORED[4][coreSchema] = {} - end - - --Attempt to copy any prior variables, even outdated - if(PROFILE_SV.system or (MODULES[1] and PROFILE_SV[MODULES[1]])) then - for k,v in pairs(PROFILE_SV) do - if(k == "system") then - tablecopy(v, PROFILE_SV.STORED[1][coreSchema]) - elseif(k == "media" or k == "filter") then - PROFILE_SV.STORED[1][coreSchema][k] = v - elseif(AllowedIndexes[k]) then - PROFILE_SV.STORED[1][k] = v - end - end - end - else - PROFILE_SV.STORED[1] = PROFILE_SV.STORED[1] or {} - PROFILE_SV.STORED[1][coreSchema] = PROFILE_SV.STORED[1][coreSchema] or {} - SanitizeStorage(PROFILE_SV.STORED[1]) - - PROFILE_SV.STORED[2] = PROFILE_SV.STORED[2] or {} - PROFILE_SV.STORED[2][coreSchema] = PROFILE_SV.STORED[2][coreSchema] or {} - SanitizeStorage(PROFILE_SV.STORED[2]) - - PROFILE_SV.STORED[3] = PROFILE_SV.STORED[3] or {} - PROFILE_SV.STORED[3][coreSchema] = PROFILE_SV.STORED[3][coreSchema] or {} - SanitizeStorage(PROFILE_SV.STORED[3]) - - if playerClass == "DRUID" then - PROFILE_SV.STORED[4] = PROFILE_SV.STORED[4] or {} - PROFILE_SV.STORED[4][coreSchema] = PROFILE_SV.STORED[4][coreSchema] or {} - SanitizeStorage(PROFILE_SV.STORED[4]) - elseif PROFILE_SV.STORED[4] then - PROFILE_SV.STORED[4] = nil - end - - end - - for k,v in pairs(PROFILE_SV) do - if(k ~= "STORED" and k ~= "SAFEDATA") then - PROFILE_SV[k] = nil - end - end - - --construct core dataset - local db = setmetatable({}, meta_transdata) - db.data = PROFILE_SV.STORED[SOURCE_KEY] - db.defaults = CoreObject.configs - CoreObject.db = db - - local cache = setmetatable({}, meta_database) - cache.data = CACHE_SV.STORED[SOURCE_KEY] - CoreObject.cache = cache - - --check for LOD plugins - local addonCount = GetNumAddOns() - - for i = 1, addonCount do - local addonName, _, _, _, _, reason = GetAddOnInfo(i) - local lod = IsAddOnLoadOnDemand(i) - local header = GetAddOnMetadata(i, HeaderFromMeta) - local schema = GetAddOnMetadata(i, SchemaFromMeta) - - if(lod and schema) then - NewLoadOnDemand(addonName, schema, header) - end - end -end - -function lib:Launch() - if LoadOnDemand then - for schema,name in pairs(LoadOnDemand) do - local db = PROFILE_SV.SAFEDATA[schema] - if(db and (db.enable or db.enable ~= false)) then - if(not IsAddOnLoaded(name)) then - local loaded, reason = LoadAddOn(name) - end - EnableAddOn(name) - end - end - end - - self:LoadQueuedModules() - self:LoadQueuedPlugins() - - if ScriptQueue then - for i=1, #ScriptQueue do - local fn = ScriptQueue[i] - if(fn and type(fn) == "function") then - fn() - end - end - - ScriptQueue = nil - end - - PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE = C_PetBattles.IsInBattle() -end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.xml b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.xml new file mode 100644 index 0000000..ec560ff --- /dev/null +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/LibSuperVillain-1.0.xml @@ -0,0 +1,7 @@ +<Ui xmlns="http://www.blizzard.com/wow/ui/"> + <Script file="LibSuperVillain-1.0.lua"/> + <Script file="modules\Linguist.lua"/> + <Script file="modules\Registry.lua"/> + <Script file="modules\Timers.lua"/> + <Script file="modules\Animate.lua"/> +</Ui> \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Animate.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Animate.lua new file mode 100644 index 0000000..02a83de --- /dev/null +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Animate.lua @@ -0,0 +1,483 @@ +--[[ + /$$$$$$ /$$ /$$ + /$$__ $$ |__/ | $$ +| $$ \ $$ /$$$$$$$ /$$ /$$$$$$/$$$$ /$$$$$$ /$$$$$$ /$$$$$$ +| $$$$$$$$| $$__ $$| $$| $$_ $$_ $$ |____ $$|_ $$_/ /$$__ $$ +| $$__ $$| $$ \ $$| $$| $$ \ $$ \ $$ /$$$$$$$ | $$ | $$$$$$$$ +| $$ | $$| $$ | $$| $$| $$ | $$ | $$ /$$__ $$ | $$ /$$| $$_____/ +| $$ | $$| $$ | $$| $$| $$ | $$ | $$| $$$$$$$ | $$$$/| $$$$$$$ +|__/ |__/|__/ |__/|__/|__/ |__/ |__/ \_______/ \___/ \_______/ +--]] + +--[[ LOCALIZED GLOBALS ]]-- +--GLOBAL NAMESPACE +local _G = getfenv(0); +--LUA +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +--BLIZZARD API +local UIFrameFadeOut = _G.UIFrameFadeOut; +local FlickerAlpha = {0.2,0.15,0.1,0.15,0.2,0.15,0.1,0.15} +--[[ LIB CONSTRUCT ]]-- + +local lib = LibSuperVillain:NewLibrary("Animate") + +if not lib then return end -- No upgrade needed + +--[[ LOCAL FUNCTIONS ]]-- + +local Anim_OnShow = function(self) + if not self.anim:IsPlaying() then + self.anim:Play() + end +end + +local Anim_OnHide = function(self) + self.anim:Finish() +end + +local Anim_OnPlay = function(self) + local parent = self.parent + parent:SetAlpha(1) + if self.hideOnFinished and not parent:IsShown() then + parent:Show() + end +end + +local Anim_OnStop = function(self) + local parent = self.parent + if self.fadeOnFinished then + parent:SetAlpha(0) + end + if self.hideOnFinished and parent:IsShown() then + parent:Hide() + end + if self.savedFrameLevel or self.startscale then + parent:SetScale(1) + if self.startscale then + self.startscale = 1 + end + if self.savedFrameLevel then + parent:SetFrameLevel(self.savedFrameLevel) + end + end +end + +local Anim_OnFinished = function(self) + local parent = self.parent + local looped = self:GetLooping() + self:Stop() + if(looped and looped == "REPEAT" and parent:IsShown()) then + self:Play() + end +end + +local Sprite_OnUpdate = function(self) + local order = self:GetOrder() + local parent = self.parent + local left, right; + if(self.isFadeFrame) then + parent:SetAlpha(0) + return + end + left = (order - 1) * 0.25; + right = left + 0.25; + parent:SetTexCoord(left,right,0,1) + if parent.overlay then + parent.overlay:SetTexCoord(left,right,0,1) + parent.overlay:SetVertexColor(1,1,1,FlickerAlpha[order]) + end +end + +local SmallSprite_OnUpdate = function(self) + local order = self:GetOrder() + local parent = self.parent + local left, right; + if(self.isFadeFrame) then + parent:SetAlpha(0) + return + end + left = (order - 1) * 0.125; + right = left + 0.125; + parent:SetTexCoord(left,right,0,1) + if parent.overlay then + parent.overlay:SetTexCoord(left,right,0,1) + parent.overlay:SetVertexColor(1,1,1,FlickerAlpha[order]) + end +end + +local PulseIn_OnUpdate = function(self) + local parent = self.parent + local step = self:GetProgress() + if(parent.savedFrameLevel) then + parent:SetFrameLevel(128) + end + parent:SetScale(1 + (1.05 * step)) +end + +local PulseOut_OnUpdate = function(self) + local parent = self.parent + local step = self:GetProgress() + if(parent.savedFrameLevel) then + parent:SetFrameLevel(128) + end + parent:SetScale(1 + (1.05 * (1 - step))) +end + +local Kapow_OnPlay = function(self) + local parent = self.parent + if(not parent.startscale) then + parent.startscale = parent:GetScale() + end + parent:SetAlpha(1) + parent:SetScale(parent.startscale or 1) +end + +local Kapow_OnFinished = function(self) + self.parent:SetAlpha(0) +end + +local Kapow_OnUpdate = function(self) + local parent = self.parent + local step = self:GetProgress() + local scale = 1 + if(parent.startscale) then + scale = scale * parent.startscale + end + parent:SetScale(scale + (1.05 * step)) +end + +local Kapow_OnUpdate2 = function(self) + local parent = self.parent + local step = self:GetProgress() + parent:SetAlpha(1 + (1.05 * (1 - step))) +end + +local Slide_OnUpdate = function(self) + local parent = self.parent + local step = self:GetProgress() + parent:SetScale(1 + (1.05 * step)) +end + +local Slide_OnPlay = function(self) + local parent = self.parent + parent:SetScale(0.01) + parent:SetAlpha(1) +end + +local Slide_FadeStart = function(self) + local parent = self.parent + UIFrameFadeOut(parent, 0.3, 1, 0) +end + +local Slide_FadeStop = function(self) + self.parent:SetAlpha(0) +end + +--[[ HELPER FUNCTION ]]-- + +local function SetNewAnimation(frame, animType, subType) + local anim = frame:CreateAnimation(animType, subType) + anim.parent = frame.parent + return anim +end + +--[[ LIB METHODS ]]-- + +local function AnimationTemplate(frame, animType, hideOnFinished, speed, special, scriptToParent) + if not animType then return end + + frame.anim = frame:CreateAnimationGroup(animType) + frame.anim.parent = frame; + frame.anim.hideOnFinished = hideOnFinished + + if animType ~= 'Flash' and animType ~= 'Kapow' then + frame.anim:SetScript("OnPlay", Anim_OnPlay) + frame.anim:SetScript("OnFinished", Anim_OnFinished) + frame.anim:SetScript("OnStop", Anim_OnStop) + end + + if scriptToParent then + local frameParent = frame:GetParent(); + if(frameParent.SetScript) then + frameParent.anim = frame.anim; + frameParent:SetScript("OnShow", Anim_OnShow) + frameParent:SetScript("OnHide", Anim_OnHide) + end + elseif(frame.SetScript) then + frame:SetScript("OnShow", Anim_OnShow) + frame:SetScript("OnHide", Anim_OnHide) + end + + if animType == 'Flash'then + frame.anim.fadeOnFinished = true + if not speed then speed = 0.33 end + + frame.anim[1] = SetNewAnimation(frame.anim, "Alpha", "FadeIn") + frame.anim[1]:SetChange(1) + frame.anim[1]:SetOrder(2) + frame.anim[1]:SetDuration(speed) + + frame.anim[2] = SetNewAnimation(frame.anim, "Alpha", "FadeOut") + frame.anim[2]:SetChange(-1) + frame.anim[2]:SetOrder(1) + frame.anim[2]:SetDuration(speed) + + if special then + frame.anim:SetLooping("REPEAT") + end + elseif animType == 'Orbit' then + frame.anim[1] = SetNewAnimation(frame.anim, "Rotation") + if special then + frame.anim[1]:SetDegrees(-360) + else + frame.anim[1]:SetDegrees(360) + end + frame.anim[1]:SetDuration(speed) + frame.anim:SetLooping("REPEAT") + frame.anim:Play() + elseif animType == 'Sprite' then + frame.anim[1] = SetNewAnimation(frame.anim, "Translation") + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetDuration(speed) + frame.anim[1]:SetScript("OnUpdate", Sprite_OnUpdate) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation") + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetDuration(speed) + frame.anim[2]:SetScript("OnUpdate", Sprite_OnUpdate) + + frame.anim[3] = SetNewAnimation(frame.anim, "Translation") + frame.anim[3]:SetOrder(3) + frame.anim[3]:SetDuration(speed) + frame.anim[3]:SetScript("OnUpdate", Sprite_OnUpdate) + + frame.anim[4] = SetNewAnimation(frame.anim, "Translation") + frame.anim[4]:SetOrder(4) + frame.anim[4]:SetDuration(speed) + frame.anim[4]:SetScript("OnUpdate", Sprite_OnUpdate) + + if special then + frame.anim[5] = SetNewAnimation(frame.anim, "Translation") + frame.anim[5]:SetOrder(5) + frame.anim[5]:SetDuration(special) + frame.anim[5].isFadeFrame = true; + frame.anim[5]:SetScript("OnUpdate", Sprite_OnUpdate) + end + + frame.anim:SetLooping("REPEAT") + elseif animType == 'SmallSprite' then + frame.anim[1] = SetNewAnimation(frame.anim, "Translation") + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetDuration(speed) + frame.anim[1]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation") + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetDuration(speed) + frame.anim[2]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[3] = SetNewAnimation(frame.anim, "Translation") + frame.anim[3]:SetOrder(3) + frame.anim[3]:SetDuration(speed) + frame.anim[3]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[4] = SetNewAnimation(frame.anim, "Translation") + frame.anim[4]:SetOrder(4) + frame.anim[4]:SetDuration(speed) + frame.anim[4]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[5] = SetNewAnimation(frame.anim, "Translation") + frame.anim[5]:SetOrder(5) + frame.anim[5]:SetDuration(speed) + frame.anim[5]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[6] = SetNewAnimation(frame.anim, "Translation") + frame.anim[6]:SetOrder(6) + frame.anim[6]:SetDuration(speed) + frame.anim[6]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[7] = SetNewAnimation(frame.anim, "Translation") + frame.anim[7]:SetOrder(7) + frame.anim[7]:SetDuration(speed) + frame.anim[7]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + frame.anim[8] = SetNewAnimation(frame.anim, "Translation") + frame.anim[8]:SetOrder(8) + frame.anim[8]:SetDuration(speed) + frame.anim[8]:SetScript("OnUpdate", SmallSprite_OnUpdate) + + if special then + frame.anim[9] = SetNewAnimation(frame.anim, "Translation") + frame.anim[9]:SetOrder(9) + frame.anim[9]:SetDuration(special) + frame.anim[9].isFadeFrame = true; + frame.anim[9]:SetScript("OnUpdate", Sprite_OnUpdate) + end + + frame.anim:SetLooping("REPEAT") + elseif animType == 'Pulse' then + frame.anim.savedFrameLevel = frame:GetFrameLevel() + + frame.anim[1] = SetNewAnimation(frame.anim) + frame.anim[1]:SetDuration(0.2) + frame.anim[1]:SetEndDelay(0.1) + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetScript("OnUpdate", PulseIn_OnUpdate) + + frame.anim[2] = SetNewAnimation(frame.anim) + frame.anim[2]:SetDuration(0.6) + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetScript("OnUpdate", PulseOut_OnUpdate) + elseif animType == 'Kapow' then + frame.anim:SetScript("OnPlay", Kapow_OnPlay) + + frame.anim.startscale = frame:GetScale() + + frame.anim[1] = SetNewAnimation(frame.anim, "Rotation") + frame.anim[1]:SetDuration(0.2) + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetDegrees(360) + frame.anim[1]:SetScript("OnUpdate", Kapow_OnUpdate) + + frame.anim[2] = SetNewAnimation(frame.anim) + frame.anim[2]:SetDuration(0.3) + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetScript("OnUpdate", Kapow_OnUpdate2) + end +end + +--[[ ROTATE AND WOBBLE (kinda like twerking i guess...) ]]-- + +function lib:Orbit(frame, speed, reversed, hideOnFinished) + if not frame then return end + if not speed then speed = 1 end + AnimationTemplate(frame, 'Orbit', hideOnFinished, speed, reversed) +end + +function lib:Pulse(frame, hideOnFinished) + if not frame then return end + AnimationTemplate(frame, 'Pulse', hideOnFinished) +end + +function lib:Kapow(frame, hideOnFinished) + if not frame then return end + AnimationTemplate(frame, 'Kapow', hideOnFinished) +end + +--[[ ANIMATED SPRITES ]]-- + +function lib:Sprite(frame, speed, fadeTime, scriptToParent) + if not frame then return end + speed = speed or 0.08; + AnimationTemplate(frame, 'Sprite', false, speed, fadeTime, scriptToParent) +end + +function lib:SmallSprite(frame, speed, fadeTime, scriptToParent) + if not frame then return end + speed = speed or 0.08; + AnimationTemplate(frame, 'SmallSprite', false, speed, fadeTime, scriptToParent) +end + +function lib:StopSprite(frame) + if not frame then return end + frame.anim:Finish() +end + +--[[ FLASHING ]]-- + +function lib:Flash(frame, speed, looped) + if not frame.anim then + AnimationTemplate(frame, 'Flash', false, speed, looped) + end + if not frame.anim:IsPlaying() then + frame.anim:Play() + end +end + +function lib:StopFlash(frame) + if not frame.anim then return end + frame.anim:Finish() + frame.anim:Stop() +end + +--[[ SLIDING ]]-- + +function lib:Slide(frame, xDirection, yDirection, bounce, extendedTime) + if(not frame or (frame and frame.anim)) then return end + + frame.anim = frame:CreateAnimationGroup("Slide") + frame.anim.hideOnFinished = true; + frame.anim.parent = frame; + frame.anim:SetScript("OnPlay", Anim_OnPlay) + frame.anim:SetScript("OnFinished", Anim_OnFinished) + frame.anim:SetScript("OnStop", Anim_OnStop) + + frame.anim[1] = SetNewAnimation(frame.anim, "Translation") + frame.anim[1]:SetDuration(0) + frame.anim[1]:SetOrder(1) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation") + frame.anim[2]:SetDuration(0.3) + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetSmoothing("OUT") + + if bounce then + frame.anim[3] = SetNewAnimation(frame.anim, "Translation") + frame.anim[3]:SetDuration(extendedTime or 0.5) + frame.anim[3]:SetOrder(3) + + frame.anim[4] = SetNewAnimation(frame.anim, "Translation") + frame.anim[4]:SetDuration(0.3) + frame.anim[4]:SetOrder(4) + frame.anim[4]:SetSmoothing("IN") + frame.anim[4]:SetOffset(xDirection, yDirection) + end +end + +function lib:RandomSlide(frame, raised) + if not frame then return end + if raised then + frame:SetFrameLevel(30) + else + frame:SetFrameLevel(20) + end + frame:SetPoint("CENTER", UIParent, "CENTER", 0, -150) + + frame.anim = frame:CreateAnimationGroup("RandomSlide") + frame.anim.parent = frame; + frame.anim[1] = SetNewAnimation(frame.anim, "Translation") + frame.anim[1]:SetOrder(1) + frame.anim[1]:SetDuration(0.1) + frame.anim[1]:SetScript("OnUpdate", Slide_OnUpdate) + frame.anim[1]:SetScript("OnPlay", Slide_OnPlay) + + frame.anim[2] = SetNewAnimation(frame.anim, "Translation") + frame.anim[2]:SetOrder(2) + frame.anim[2]:SetDuration(1) + + frame.anim[3] = SetNewAnimation(frame.anim, "Translation") + frame.anim[3]:SetOrder(3) + frame.anim[3]:SetDuration(0.3) + frame.anim[3]:SetSmoothing("OUT") + frame.anim[3]:SetScript("OnPlay", Slide_FadeStart) + frame.anim[3]:SetScript("OnStop", Slide_FadeStop) + + frame.anim:SetScript("OnFinished", Slide_FadeStop) +end + +function lib:SlideIn(frame) + if not frame.anim then return end + frame:Show() + frame.anim:Play() +end + +function lib:SlideOut(frame) + if not frame.anim then return end + frame.anim:Finish() + frame.anim:Stop() +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Linguist.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Linguist.lua new file mode 100644 index 0000000..6be159b --- /dev/null +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Linguist.lua @@ -0,0 +1,86 @@ +--[[ + /$$ /$$ /$$ /$$ +| $$ |__/ |__/ | $$ +| $$ /$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$$$$$$/$$$$$$ +| $$ | $$| $$__ $$ /$$__ $$| $$ | $$| $$ /$$_____/_ $$_/ +| $$ | $$| $$ \ $$| $$ \ $$| $$ | $$| $$| $$$$$$ | $$ +| $$ | $$| $$ | $$| $$ | $$| $$ | $$| $$ \____ $$ | $$ /$$ +| $$$$$$$$| $$| $$ | $$| $$$$$$$| $$$$$$/| $$ /$$$$$$$/ | $$$$/ +|________/|__/|__/ |__/ \____ $$ \______/ |__/|_______/ \___/ + /$$ \ $$ + | $$$$$$/ + \______/ + +Linguist is a simple localization component. Seriously, thats it! +--]] + +--[[ LOCALIZED GLOBALS ]]-- +--GLOBAL NAMESPACE +local _G = getfenv(0); +--LUA +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local rawset = _G.rawset; +local rawget = _G.rawget; +local getmetatable = _G.getmetatable; +local setmetatable = _G.setmetatable; +--BLIZZARD API +local GetLocale = _G.GetLocale; + +--[[ LIB CONSTRUCT ]]-- + +local lib = LibSuperVillain:NewLibrary("Linguist") + +if not lib then return end -- No upgrade needed + +--[[ COMMON LOCAL VARS ]]-- + +local activeLocale + +local failsafe = function() assert(false) end + +--LINGUIST META METHODS +local metaread = { + __index = function(self, key) + rawset(self, key, key) + return key + end +} + +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 metawrite = setmetatable({}, { + __newindex = function(self, key, value) + rawset(activeLocale, key, value == true and key or value) + end, + __index = failsafe +}) + +--LINGUIST STORAGE +lib.Localization = setmetatable({}, metaread); + +--LINGUIST PUBLIC METHOD +function lib:Lang(locale, isDefault) + if(not locale) then + return self.Localization + else + local GAME_LOCALE = GetLocale() + if GAME_LOCALE == "enGB" then GAME_LOCALE = "enUS" end + + activeLocale = self.Localization + + if isDefault then + return defaultwrite + elseif(locale == GAME_LOCALE) then + return metawrite + end + end +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Registry.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Registry.lua new file mode 100644 index 0000000..d439b2c --- /dev/null +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Registry.lua @@ -0,0 +1,1202 @@ +--[[ + /$$$$$$$ /$$ /$$ +| $$__ $$ |__/ | $$ +| $$ \ $$ /$$$$$$ /$$$$$$ /$$ /$$$$$$$/$$$$$$ /$$$$$$ /$$ /$$ +| $$$$$$$/ /$$__ $$ /$$__ $$| $$ /$$_____/_ $$_/ /$$__ $$| $$ | $$ +| $$__ $$| $$$$$$$$| $$ \ $$| $$| $$$$$$ | $$ | $$ \__/| $$ | $$ +| $$ \ $$| $$_____/| $$ | $$| $$ \____ $$ | $$ /$$| $$ | $$ | $$ +| $$ | $$| $$$$$$$| $$$$$$$| $$ /$$$$$$$/ | $$$$/| $$ | $$$$$$$ +|__/ |__/ \_______/ \____ $$|__/|_______/ \___/ |__/ \____ $$ + /$$ \ $$ /$$ | $$ + | $$$$$$/ | $$$$$$/ + \______/ \______/ + +Registry is a component used to manage packages and scripts embedded +into the SVUI core addon. + +It's main purpose is to keep all methods and logic needed to properly keep +core add-ins functioning outside of the core object. +--]] + +--[[ LOCALIZED GLOBALS ]]-- +--GLOBAL NAMESPACE +local _G = getfenv(0); +--LUA +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local type = _G.type; +local error = _G.error; +local pcall = _G.pcall; +local print = _G.print; +local ipairs = _G.ipairs; +local pairs = _G.pairs; +local next = _G.next; +local rawset = _G.rawset; +local rawget = _G.rawget; +local tostring = _G.tostring; +local tonumber = _G.tonumber; +local getmetatable = _G.getmetatable; +local setmetatable = _G.setmetatable; +--STRING +local string = _G.string; +local upper = string.upper; +local format = string.format; +local find = string.find; +local match = string.match; +local gsub = string.gsub; +--MATH +local math = _G.math; +local floor = math.floor +--TABLE +local table = _G.table; +local tsort = table.sort; +local tconcat = table.concat; +local tinsert = _G.tinsert; +local tremove = _G.tremove; +local twipe = _G.wipe; +--BLIZZARD API +local ReloadUI = _G.ReloadUI; +local GetLocale = _G.GetLocale; +local CreateFrame = _G.CreateFrame; +local IsAddOnLoaded = _G.IsAddOnLoaded; +local GetNumAddOns = _G.GetNumAddOns; +local GetAddOnInfo = _G.GetAddOnInfo; +local LoadAddOn = _G.LoadAddOn; +local EnableAddOn = _G.EnableAddOn; +local GetSpecialization = _G.GetSpecialization; +local GetAddOnMetadata = _G.GetAddOnMetadata; +local IsAddOnLoadOnDemand = _G.IsAddOnLoadOnDemand; + + +--[[ LIB CONSTRUCT ]]-- + +local lib = LibSuperVillain:NewLibrary("Registry") + +if not lib then return end -- No upgrade needed + +--[[ ADDON DATA ]]-- + +local CoreName, CoreObject = ... +local AddonVersion = GetAddOnMetadata(..., "Version"); +local SchemaFromMeta = "X-" .. CoreName .. "-Schema"; +local HeaderFromMeta = "X-" .. CoreName .. "-Header"; +local InterfaceVersion = select(4, GetBuildInfo()); + +--[[ COMMON LOCAL VARS ]]-- + +local GLOBAL_FILENAME = CoreName.."_Global"; +local ERROR_FILENAME = CoreName.."_Errors"; +local PROFILE_FILENAME = CoreName.."_Profile"; +local CACHE_FILENAME = CoreName.."_Cache"; +local SOURCE_KEY = 1; +local GLOBAL_SV, PROFILE_SV, CACHE_SV, ERROR_CACHE, PLUGINS, MODULES; +local PluginString = "" +local AllowedIndexes, LoadOnDemand = {},{}; +local Callbacks, ScriptQueue = {},{}; + +local playerClass = select(2,UnitClass("player")); + +local INFO_FORMAT = "|cffFFFF00%s|r\n |cff33FF00Version: %s|r |cff0099FFby %s|r"; + +if GetLocale() == "ruRU" then + INFO_FORMAT = "|cffFFFF00%s|r\n |cff33FF00Версия: %s|r |cff0099FFот %s|r"; +end + +--[[ LIB EVENT LISTENER ]]-- + +lib.EventManager = CreateFrame("Frame", nil) + +--[[ COMMON META METHODS ]]-- + +local rootstring = function(self) return self.NameID end + +--[[ CUSTOM LUA METHODS ]]-- + +--LOCAL HELPERS +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 + +--APPENDED METHODS +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 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.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 find(this, '^%s*$') and '' or match(this, '^%s*(.*%S)') +end + +function string.color(this, color) + return format("|cff%s%s|r", color, this) +end + +function string.link(this, prefix, text, color) + text = tostring(text) + local colorstring = tostring(this):color(color or "ffffff") + return format("|H%s:%s|h%s|h", prefix, text, colorstring) +end + +function string.explode(str, delim) + local res = {} + local pattern = format("([^%s]+)%s()", delim, delim) + local line, pos + while (true) do + line, pos = match(str, pattern, pos) + if line == nil then break end + tinsert(res, line) + end + return res +end + +--[[ + /$$$$$$$ /$$ /$$ +| $$__ $$ | $$ | $$ +| $$ \ $$ /$$$$$$ /$$$$$$ /$$$$$$ | $$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ +| $$ | $$|____ $$|_ $$_/ |____ $$| $$__ $$|____ $$ /$$_____/ /$$__ $$ +| $$ | $$ /$$$$$$$ | $$ /$$$$$$$| $$ \ $$ /$$$$$$$| $$$$$$ | $$$$$$$$ +| $$ | $$/$$__ $$ | $$ /$$/$$__ $$| $$ | $$/$$__ $$ \____ $$| $$_____/ +| $$$$$$$/ $$$$$$$ | $$$$/ $$$$$$$| $$$$$$$/ $$$$$$$ /$$$$$$$/| $$$$$$$ +|_______/ \_______/ \___/ \_______/|_______/ \_______/|_______/ \_______/ + + +DataBase is a component used to create and manage SVUI data objects. + +It's main purpose is to keep all methods and logic needed to properly maintain +valid data outside of the core object. +--]] + +--DATABASE LOCAL HELPERS +local function SanitizeStorage(data) + for k,v in pairs(data) do + if(k == "STORED" or k == "SAFEDATA" or k == "LAYOUT") then + data[k] = nil + end + end +end + +local function LiveProfileChange() + local LastKey = SOURCE_KEY + if(PROFILE_SV.SAFEDATA and PROFILE_SV.SAFEDATA.dualSpecEnabled) then + SOURCE_KEY = GetSpecialization() + lib.EventManager:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") + + if(not SOURCE_KEY) then + SOURCE_KEY = 1 + end + + if(LastKey ~= SOURCE_KEY) then + --construct core dataset + local db = rawget(CoreObject.db, "data") + db = PROFILE_SV.STORED[SOURCE_KEY] + + local cache = rawget(CoreObject.cache, "data") + cache = CACHE_SV.STORED[SOURCE_KEY] + + if(CoreObject.ReLoad) then + CoreObject:ReLoad() + end + + lib:RefreshAll() + end + else + SOURCE_KEY = 1 + lib.EventManager:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") + end +end + +local function tablecopy(d, s, debug) + if(debug) then + print(debug) + assert(type(s) == "table", "tablecopy ERROR: source (" .. debug .. ") is not a table") + assert(type(d) == "table", "tablecopy ERROR: destination (" .. debug .. ") is not a table") + end + if(type(s) ~= "table") then return end + if(type(d) ~= "table") then return end + for k, v in pairs(s) do + local saved = rawget(d, k) + if type(v) == "table" then + if not saved then rawset(d, k, {}) end + tablecopy(d[k], v) + elseif(saved == nil or (saved and type(saved) ~= type(v))) then + rawset(d, k, v) + end + end +end + +local function tablesplice(targetTable, mergeTable) + if type(targetTable) ~= "table" then targetTable = {} end + + if type(mergeTable) == 'table' then + for key,val in pairs(mergeTable) do + if type(val) == "table" then + val = tablesplice(targetTable[key], val) + end + targetTable[key] = val + end + end + return targetTable +end + +local function importdata(s, d) + if type(d) ~= "table" then d = {} end + if type(s) == "table" then + for k,v in pairs(s) do + if type(v) == "table" then + v = importdata(v, d[k]) + end + d[k] = v + end + end + return d +end + +local function removedefaults(db, src, nometa) + if(type(src) ~= "table") then + if(db == src) then db = nil end + return + end + if(not nometa) then + setmetatable(db, nil) + end + for k,v in pairs(src) do + if type(v) == "table" and type(db[k]) == "table" then + removedefaults(db[k], v, nometa) + if next(db[k]) == nil then + db[k] = nil + end + else + if db[k] == v then + db[k] = nil + end + end + end +end + +--DATABASE META METHODS +local meta_transdata = { + __index = function(t, k) + if(not k or k == "") then return end + local sv = rawget(t, "data") + local dv = rawget(t, "defaults") + local src = dv and dv[k] + + if(src ~= nil) then + if(type(src) == "table") then + if(sv[k] == nil or (sv[k] ~= nil and type(sv[k]) ~= "table")) then sv[k] = {} end + tablecopy(sv[k], src) + else + if(sv[k] == nil or (sv[k] ~= nil and type(sv[k]) ~= type(src))) then sv[k] = src end + end + end + + rawset(t, k, sv[k]) + return rawget(t, k) + end, +} + +local meta_database = { + __index = function(t, k) + if(not k or k == "") then return end + local sv = rawget(t, "data") + if(not sv[k]) then sv[k] = {} end + rawset(t, k, sv[k]) + return rawget(t, k) + end, +} + +--DATABASE PUBLIC METHODS +function lib:Remove(key) + if(GLOBAL_SV.profiles[key]) then GLOBAL_SV.profiles[key] = nil end + if(GLOBAL_SV.cache[key]) then GLOBAL_SV.cache[key] = nil end + twipe(GLOBAL_SV.profileKeys) + for k,v in pairs(GLOBAL_SV.profiles) do + GLOBAL_SV.profileKeys[k] = k + end + for k,v in pairs(GLOBAL_SV.cache) do + GLOBAL_SV.profileKeys[k] = k + end +end + +function lib:GetProfiles() + local list = GLOBAL_SV.profileKeys or {} + return list +end + +function lib:CheckProfiles() + local hasProfile = false + local list = GLOBAL_SV.profileKeys or {} + for key,_ in pairs(list) do + hasProfile = true + end + return hasProfile +end + +function lib:ImportDatabase(key) + if(not GLOBAL_SV.profiles[key]) then GLOBAL_SV.profiles[key] = {} end; + PROFILE_SV.STORED[SOURCE_KEY] = GLOBAL_SV.profiles[key] + + if(not GLOBAL_SV.cache[key]) then GLOBAL_SV.cache[key] = {} end; + CACHE_SV.STORED[SOURCE_KEY] = GLOBAL_SV.cache[key] + + ReloadUI() +end + +function lib:ExportDatabase(key) + local export, saved + + if(not GLOBAL_SV.profiles[key]) then GLOBAL_SV.profiles[key] = {} end; + export = rawget(CoreObject.db, "data"); + saved = GLOBAL_SV.profiles[key]; + tablecopy(saved, export); + + if not GLOBAL_SV.cache[key] then GLOBAL_SV.cache[key] = {} end + export = rawget(CoreObject.cache, "data") + saved = GLOBAL_SV.cache[key] + tablecopy(saved, export); + + + twipe(GLOBAL_SV.profileKeys) + for k,v in pairs(GLOBAL_SV.profiles) do + GLOBAL_SV.profileKeys[k] = k + end + for k,v in pairs(GLOBAL_SV.cache) do + GLOBAL_SV.profileKeys[k] = k + end +end + +function lib:WipeDatabase() + for k,v in pairs(PROFILE_SV.STORED[SOURCE_KEY]) do + PROFILE_SV.STORED[SOURCE_KEY][k] = nil + end +end + +function lib:WipeCache(index) + if(index) then + CACHE_SV.STORED[SOURCE_KEY][index] = nil + else + for k,v in pairs(CACHE_SV.STORED[SOURCE_KEY]) do + CACHE_SV.STORED[SOURCE_KEY][k] = nil + end + end +end + +function lib:WipeGlobal() + for k,v in pairs(GLOBAL_SV) do + GLOBAL_SV[k] = nil + end +end + +function lib:GetSafeData(index) + if(index) then + return PROFILE_SV.SAFEDATA[index] + else + return PROFILE_SV.SAFEDATA + end +end + +function lib:SaveSafeData(index, value) + PROFILE_SV.SAFEDATA[index] = value +end + +function lib:CheckData(schema, key) + local file = PROFILE_SV.STORED[SOURCE_KEY][schema] + print("______" .. schema .. ".db[" .. key .. "]_____") + print(file[key]) + print("______SAVED_____") +end + +function lib:NewGlobal(index) + index = index or CoreObject.Schema + if(not GLOBAL_SV[index]) then + GLOBAL_SV[index] = {} + end + return GLOBAL_SV[index] +end + +--REGISTRY LOCAL HELPERS + +local function HandleErrors(schema, action, catch) + if(CoreObject.DebugMode == true) then + schema = schema or "LibSuperVillain:Registry" + action = action or "Unknown Function" + local timestamp = date("%m/%d/%y %H:%M:%S") + local err_message = ("%s [%s] - (%s) %s"):format(schema, action, timestamp, catch) + tinsert(ERROR_CACHE.FOUND, err_message) + --ScriptErrorsFrame_OnError(catch, false, true) + CoreObject:Debugger(err_message) + end +end + +local function LoadingProxy(schema, obj) + if(not obj) then return end + if(not obj.initialized) then + if(obj.Load and type(obj.Load) == "function") then + local _, catch = pcall(obj.Load, obj) + if(catch) then + HandleErrors(schema, "Load", catch) + else + obj.initialized = true + end + end + else + if(obj.ReLoad and type(obj.ReLoad) == "function") then + local _, catch = pcall(obj.ReLoad, obj) + if(catch) then + HandleErrors(schema, "ReLoad", catch) + end + end + end +end + +--OBJECT INTERNALS + +local changeDBVar = function(self, value, key, sub1, sub2, sub3) + local db = CoreObject.db[self.Schema] + if((sub1 and sub2 and sub3) and (db[sub1] and db[sub1][sub2] and db[sub1][sub2][sub3])) then + db[sub1][sub2][sub3][key] = value + elseif((sub1 and sub2) and (db[sub1] and db[sub1][sub2])) then + db[sub1][sub2][key] = value + elseif(sub1 and db[sub1]) then + db[sub1][key] = value + else + db[key] = value + end + + if(self.UpdateLocals) then + self:UpdateLocals() + end +end + +local changePluginDBVar = function(self, value, key, sub1, sub2, sub3) + local db = self.db + if((sub1 and sub2 and sub3) and (db[sub1] and db[sub1][sub2] and db[sub1][sub2][sub3])) then + db[sub1][sub2][sub3][key] = value + elseif((sub1 and sub2) and (db[sub1] and db[sub1][sub2])) then + db[sub1][sub2][key] = value + elseif(sub1 and db[sub1]) then + db[sub1][key] = value + else + db[key] = value + end + + if(self.UpdateLocals) then + self:UpdateLocals() + end +end + +local innerOnEvent = function(self, event, ...) + local obj = self.___owner + local fn = self[event] + if(fn and type(fn) == "function" and obj.initialized) then + local _, catch = pcall(fn, obj, event, ...) + if(catch) then + local schema = obj.Schema + HandleErrors(schema, event, catch) + end + end +end + +local registerEvent = function(self, eventname, eventfunc) + if not self.___eventframe then + self.___eventframe = CreateFrame("Frame", nil) + self.___eventframe.___owner = self + self.___eventframe:SetScript("OnEvent", innerOnEvent) + end + + if(not self.___eventframe[eventname]) then + local fn = eventfunc + if type(eventfunc) == "string" then + fn = self[eventfunc] + elseif(not fn and self[eventname]) then + fn = self[eventname] + end + self.___eventframe[eventname] = fn + end + + self.___eventframe:RegisterEvent(eventname) +end + +local unregisterEvent = function(self, event, ...) + if(self.___eventframe) then + self.___eventframe:UnregisterEvent(event) + end +end + +local innerOnUpdate = function(self, elapsed) + if self.elapsed and self.elapsed > (self.throttle) then + local obj = self.___owner + local callbacks = self.callbacks + + for name, fn in pairs(callbacks) do + local _, catch = pcall(fn, obj) + if(catch and CoreObject.Debugging) then + print(catch) + end + end + + self.elapsed = 0 + else + self.elapsed = (self.elapsed or 0) + elapsed + end +end + +local registerUpdate = function(self, updatefunc, throttle) + if not self.___updateframe then + self.___updateframe = CreateFrame("Frame", nil); + self.___updateframe.___owner = self; + self.___updateframe.callbacks = {}; + self.___updateframe.elapsed = 0; + self.___updateframe.throttle = throttle or 0.2; + end + + if(updatefunc and type(updatefunc) == "string" and self[updatefunc]) then + self.___updateframe.callbacks[updatefunc] = self[updatefunc] + end + + self.___updateframe:SetScript("OnUpdate", innerOnUpdate) +end + +local unregisterUpdate = function(self, updatefunc) + if(updatefunc and type(updatefunc) == "string" and self.___updateframe.callbacks[updatefunc]) then + self.___updateframe.callbacks[updatefunc] = nil + if(#self.___updateframe.callbacks == 0) then + self.___updateframe:SetScript("OnUpdate", nil) + end + else + self.___updateframe:SetScript("OnUpdate", nil) + end +end + +local function SetPluginString(addonName) + local author = GetAddOnMetadata(addonName, "Author") or "Unknown" + local name = GetAddOnMetadata(addonName, "Title") or addonName + local version = GetAddOnMetadata(addonName, "Version") or "???" + return INFO_FORMAT:format(name, version, author) +end + +--REGISTRY PUBLIC METHODS + +function lib:RunCallbacks() + for i=1, #Callbacks do + local fn = Callbacks[i] + if(fn and type(fn) == "function") then + local _, catch = pcall(fn) + if(catch) then + HandleErrors("LibSuperVillain:Registry", "Callback", catch) + end + end + end +end + +function lib:RefreshModule(schema) + local obj = CoreObject[schema] + LoadingProxy(schema, obj) +end + +function lib:RefreshPlugin(schema) + local obj = _G[schema] + LoadingProxy(schema, obj) +end + +function lib:RefreshAll() + for _,schema in pairs(MODULES) do + local obj = CoreObject[schema] + LoadingProxy(schema, obj) + end + + for schema,_ in pairs(PLUGINS) do + local obj = _G[schema] + LoadingProxy(schema, obj) + end +end + +function lib:LiveUpdate() + if(PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE and not C_PetBattles.IsInBattle()) then + self:RefreshAll() + PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE = false + end +end + +function lib:GetModuletable() + return MODULES +end + +function lib:GetPlugins() + return PluginString +end + +function lib:CheckDualProfile() + return PROFILE_SV.SAFEDATA.dualSpecEnabled +end + +function lib:ToggleDualProfile(enabled) + PROFILE_SV.SAFEDATA.dualSpecEnabled = enabled + if(enabled) then + self.EventManager:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") + LiveProfileChange() + else + self.EventManager:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") + end +end + +function lib:LoadQueuedModules() + if MODULES then + for i=1,#MODULES do + local schema = MODULES[i] + local obj = CoreObject[schema] + local data = CoreObject.db[schema] + if(obj and data and data.enable and (not obj.initialized)) then + local halt = false + if(data.incompatible) then + for addon,_ in pairs(data.incompatible) do + if IsAddOnLoaded(addon) then halt = true end + end + end + if(not halt) then + LoadingProxy(schema, obj) + end + end + end + end +end + +function lib:LoadQueuedPlugins() + if PLUGINS then + for schema,files in pairs(PLUGINS) do + local obj = _G[schema] + local enabled = PROFILE_SV.SAFEDATA[schema].enable + if(obj and enabled and (not obj.initialized)) then + local halt = false + + if((not obj.db) and files.PROFILE and _G[files.PROFILE]) then + local db = setmetatable({}, meta_transdata) + db.data = _G[files.PROFILE] + db.defaults = obj.configs + obj.db = db + end + + if((not obj.cache) and files.CACHE and _G[files.CACHE]) then + local cache = setmetatable({}, meta_database) + cache.data = _G[files.CACHE] + obj.cache = cache + end + + if((not obj.public) and files.GLOBAL and _G[files.GLOBAL]) then + local public = setmetatable({}, meta_database) + public.data = _G[files.GLOBAL] + obj.public = public + end + + if(obj.db and obj.db.incompatible) then + for addon,_ in pairs(obj.db.incompatible) do + if IsAddOnLoaded(addon) then halt = true end + end + end + + if(not halt) then + LoadingProxy(schema, obj) + end + end + end + end +end + +--[[ CONSTRUCTORS ]]-- + +function lib:NewPlugin(addonName, addonObject, pfile, gfile, cfile) + local version = GetAddOnMetadata(addonName, "Version") + local header = GetAddOnMetadata(addonName, HeaderFromMeta) + local schema = GetAddOnMetadata(addonName, SchemaFromMeta) + local lod = IsAddOnLoadOnDemand(addonName) + + PROFILE_SV.SAFEDATA[schema] = PROFILE_SV.SAFEDATA[schema] or {["enable"] = true} + + local addonmeta = {} + local oldmeta = getmetatable(addonObject) + if oldmeta then + for k, v in pairs(oldmeta) do addonmeta[k] = v end + end + addonmeta.__tostring = rootstring + setmetatable( addonObject, addonmeta ) + + addonObject.Version = version + addonObject.NameID = addonName + addonObject.TitleID = header + addonObject.Schema = schema + addonObject.LoD = lod + addonObject.initialized = false + addonObject.CombatLocked = false + addonObject.ChangeDBVar = changePluginDBVar + addonObject.RegisterEvent = registerEvent + addonObject.UnregisterEvent = unregisterEvent + addonObject.RegisterUpdate = registerUpdate + addonObject.UnregisterUpdate = unregisterUpdate + + if(IsAddOnLoaded(addonName) and not lod) then + CoreObject.Options.args.plugins.args.pluginOptions.args[schema] = { + type = "group", + name = header, + childGroups = "tree", + args = { + enable = { + order = 1, + type = "toggle", + name = "Enable", + get = function() + return PROFILE_SV.SAFEDATA[schema].enable + end, + set = function(key, value) + PROFILE_SV.SAFEDATA[schema].enable = value; + CoreObject:StaticPopup_Show("RL_CLIENT") + end, + } + } + } + end + + _G[schema] = addonObject + + if(not PLUGINS) then PLUGINS = {} end + + PLUGINS[schema] = { + ["GLOBAL"] = gfile, + ["PROFILE"] = pfile, + ["CACHE"] = cfile, + }; + + local infoString = SetPluginString(addonName) + local oldString = PluginString + PluginString = ("%s%s\n"):format(oldString, infoString) + + return addonObject +end + +local function NewLoadOnDemand(addonName, schema, header) + LoadOnDemand[schema] = addonName; + PROFILE_SV.SAFEDATA[schema] = PROFILE_SV.SAFEDATA[schema] or {["enable"] = false} + CoreObject.Options.args.plugins.args.pluginOptions.args[schema] = { + type = "group", + name = header, + childGroups = "tree", + args = { + enable = { + order = 1, + type = "execute", + width = "full", + name = function() + local nameString = "Disable" + if(not IsAddOnLoaded(addonName)) then + nameString = "Enable" + end + return nameString + end, + func = function() + if(not IsAddOnLoaded(addonName)) then + local loaded, reason = LoadAddOn(addonName) + PROFILE_SV.SAFEDATA[schema].enable = true + lib:LoadQueuedPlugins() + else + PROFILE_SV.SAFEDATA[schema].enable = false + CoreObject:StaticPopup_Show("RL_CLIENT") + end + end, + } + } + } +end + +--LIBRARY EVENT HANDLING + +local Library_OnEvent = function(self, event, arg, ...) + if(event == "PLAYER_LOGOUT") then + local sv = rawget(CoreObject.db, "data") + local src = rawget(CoreObject.db, "defaults") + for k,v in pairs(sv) do + if(not src[k]) then + sv[k] = nil + elseif(src[k] ~= nil and (not LoadOnDemand[k])) then + removedefaults(sv[k], src[k]) + end + end + elseif(event == "ADDON_LOADED") then + if(arg == CoreName) then + if(not CoreObject.___loaded and CoreObject.Load) then + CoreObject:Load() + CoreObject.___loaded = true + self:UnregisterEvent("ADDON_LOADED") + end + end + elseif(event == "PLAYER_LOGIN") then + if(not CoreObject.___initialized and CoreObject.Initialize and IsLoggedIn()) then + CoreObject:Initialize() + CoreObject.___initialized = true + self:UnregisterEvent("PLAYER_LOGIN") + end + elseif(event == "ACTIVE_TALENT_GROUP_CHANGED") then + LiveProfileChange() + end +end + +-- CORE OBJECT CONSTRUCT + +local Core_NewCallback = function(self, fn) + if(fn and type(fn) == "function") then + Callbacks[#Callbacks+1] = fn + end +end + +local Core_NewScript = function(self, fn) + if(fn and type(fn) == "function") then + ScriptQueue[#ScriptQueue+1] = fn + end +end + +local Core_NewPackage = function(self, schema, header) + if(self[schema]) then return end + + if(not MODULES) then MODULES = {} end + MODULES[#MODULES+1] = schema + + AllowedIndexes[schema] = schema + + local addonName = ("SVUI [%s]"):format(schema) + + local obj = { + NameID = addonName, + TitleID = header, + Schema = schema, + initialized = false, + CombatLocked = false, + ChangeDBVar = changeDBVar, + RegisterEvent = registerEvent, + UnregisterEvent = unregisterEvent, + RegisterUpdate = registerUpdate, + UnregisterUpdate = unregisterUpdate + } + + local addonmeta = {} + local oldmeta = getmetatable(obj) + if oldmeta then + for k, v in pairs(oldmeta) do addonmeta[k] = v end + end + addonmeta.__tostring = rootstring + setmetatable( obj, addonmeta ) + + self[schema] = obj + + return self[schema] +end + +local Core_ResetData = function(self, sub, sub2, sub3) + local data = self.db + local sv = rawget(data, "data") + local src = rawget(data, "defaults") + local targetData + if(sub3 and sub2 and sv and sv[sub] and sv[sub][sub2]) then + targetData = sv[sub][sub2][sub3] + elseif(sub2 and sv and sv[sub]) then + targetData = sv[sub][sub2] + elseif(sub and sv) then + targetData = sv[sub] + else + targetData = sv + end + if(targetData) then + for k,v in pairs(targetData) do + targetData[k] = nil + end + else + sv = {} + end + tablecopy(sv, src) +end + +function lib:NewCore(gfile, efile, pfile, cfile) + --meta assurance + local mt = {}; + local old = getmetatable(CoreObject); + if old then + for k, v in pairs(old) do mt[k] = v end + end + mt.__tostring = rootstring; + setmetatable(CoreObject, mt); + + --database + GLOBAL_FILENAME = gfile or GLOBAL_FILENAME + ERROR_FILENAME = efile or ERROR_FILENAME + PROFILE_FILENAME = pfile or PROFILE_FILENAME + CACHE_FILENAME = cfile or CACHE_FILENAME + + --events + if(not self.EventManager.Initialized) then + self.EventManager:RegisterEvent("ADDON_LOADED") + self.EventManager:RegisterEvent("PLAYER_LOGIN") + self.EventManager:RegisterEvent("PLAYER_LOGOUT") + self.EventManager:SetScript("OnEvent", Library_OnEvent) + self.EventManager.Initialized = true + end + + --internals + CoreObject.___errors = {}; + + CoreObject.NameID = CoreName; + CoreObject.Version = AddonVersion; + CoreObject.GameVersion = tonumber(InterfaceVersion); + CoreObject.DebugMode = true; + CoreObject.Schema = GetAddOnMetadata(CoreName, SchemaFromMeta); + CoreObject.TitleID = GetAddOnMetadata(CoreName, HeaderFromMeta); + + CoreObject.RegisterEvent = registerEvent + CoreObject.UnregisterEvent = unregisterEvent + CoreObject.RegisterUpdate = registerUpdate + CoreObject.UnregisterUpdate = unregisterUpdate + + CoreObject.NewCallback = Core_NewCallback + CoreObject.NewScript = Core_NewScript + CoreObject.NewPackage = Core_NewPackage + CoreObject.ResetData = Core_ResetData + CoreObject.db = tablesplice(CoreObject.configs, {}) + + --set global + _G[CoreName] = CoreObject; + + return _G[CoreName] +end + +-- INITIALIZE AND LAUNCH + +function lib:Initialize() + local coreSchema = CoreObject.Schema + --GLOBAL SAVED VARIABLES + if not _G[GLOBAL_FILENAME] then _G[GLOBAL_FILENAME] = {} end + GLOBAL_SV = _G[GLOBAL_FILENAME] + + if(GLOBAL_SV.profileKeys) then + twipe(GLOBAL_SV.profileKeys) + else + GLOBAL_SV.profileKeys = {} + end + + GLOBAL_SV.profiles = GLOBAL_SV.profiles or {} + for k,v in pairs(GLOBAL_SV.profiles) do + GLOBAL_SV.profileKeys[k] = k + end + + GLOBAL_SV.cache = GLOBAL_SV.cache or {} + for k,v in pairs(GLOBAL_SV.cache) do + GLOBAL_SV.profileKeys[k] = k + end + + --SAVED ERRORS + if not _G[ERROR_FILENAME] then _G[ERROR_FILENAME] = {} end + ERROR_CACHE = _G[ERROR_FILENAME] + + local datestamp = date("%m_%d_%y") + + if(ERROR_CACHE.TODAY and ERROR_CACHE.TODAY ~= datestamp) then + ERROR_CACHE.FOUND = {} + end + + if(not ERROR_CACHE.FOUND) then + ERROR_CACHE.FOUND = {} + end + + ERROR_CACHE.TODAY = datestamp + + --CACHE SAVED VARIABLES + if not _G[CACHE_FILENAME] then _G[CACHE_FILENAME] = {} end + CACHE_SV = _G[CACHE_FILENAME] + if(not CACHE_SV.STORED) then + CACHE_SV.STORED = {} + CACHE_SV.STORED[1] = {} + CACHE_SV.STORED[2] = {} + CACHE_SV.STORED[3] = {} + if playerClass == "DRUID" then + CACHE_SV.STORED[4] = {} + end + for k,v in pairs(CACHE_SV) do + if(k ~= "STORED") then + CACHE_SV.STORED[1][k] = v + end + end + end + + --PROFILE SAVED VARIABLES + if not _G[PROFILE_FILENAME] then _G[PROFILE_FILENAME] = {} end + PROFILE_SV = _G[PROFILE_FILENAME] + PROFILE_SV.SAFEDATA = PROFILE_SV.SAFEDATA or {dualSpecEnabled = false} + + if not PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE then PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE = false end + + if(PROFILE_SV.SAFEDATA and PROFILE_SV.SAFEDATA.dualSpecEnabled) then + SOURCE_KEY = GetSpecialization() or 1 + self.EventManager:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") + else + SOURCE_KEY = 1 + self.EventManager:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED") + end + + if(not PROFILE_SV.STORED) then + PROFILE_SV.STORED = {} + PROFILE_SV.STORED[1] = {} + PROFILE_SV.STORED[1][coreSchema] = {} + PROFILE_SV.STORED[2] = {} + PROFILE_SV.STORED[2][coreSchema] = {} + PROFILE_SV.STORED[3] = {} + PROFILE_SV.STORED[3][coreSchema] = {} + if playerClass == "DRUID" then + PROFILE_SV.STORED[4] = {} + PROFILE_SV.STORED[4][coreSchema] = {} + end + + --Attempt to copy any prior variables, even outdated + if(PROFILE_SV.system or (MODULES[1] and PROFILE_SV[MODULES[1]])) then + for k,v in pairs(PROFILE_SV) do + if(k == "system") then + tablecopy(v, PROFILE_SV.STORED[1][coreSchema]) + elseif(k == "media" or k == "filter") then + PROFILE_SV.STORED[1][coreSchema][k] = v + elseif(AllowedIndexes[k]) then + PROFILE_SV.STORED[1][k] = v + end + end + end + else + PROFILE_SV.STORED[1] = PROFILE_SV.STORED[1] or {} + PROFILE_SV.STORED[1][coreSchema] = PROFILE_SV.STORED[1][coreSchema] or {} + SanitizeStorage(PROFILE_SV.STORED[1]) + + PROFILE_SV.STORED[2] = PROFILE_SV.STORED[2] or {} + PROFILE_SV.STORED[2][coreSchema] = PROFILE_SV.STORED[2][coreSchema] or {} + SanitizeStorage(PROFILE_SV.STORED[2]) + + PROFILE_SV.STORED[3] = PROFILE_SV.STORED[3] or {} + PROFILE_SV.STORED[3][coreSchema] = PROFILE_SV.STORED[3][coreSchema] or {} + SanitizeStorage(PROFILE_SV.STORED[3]) + + if playerClass == "DRUID" then + PROFILE_SV.STORED[4] = PROFILE_SV.STORED[4] or {} + PROFILE_SV.STORED[4][coreSchema] = PROFILE_SV.STORED[4][coreSchema] or {} + SanitizeStorage(PROFILE_SV.STORED[4]) + elseif PROFILE_SV.STORED[4] then + PROFILE_SV.STORED[4] = nil + end + + end + + for k,v in pairs(PROFILE_SV) do + if(k ~= "STORED" and k ~= "SAFEDATA") then + PROFILE_SV[k] = nil + end + end + + --construct core dataset + local db = setmetatable({}, meta_transdata) + db.data = PROFILE_SV.STORED[SOURCE_KEY] + db.defaults = CoreObject.configs + CoreObject.db = db + + local cache = setmetatable({}, meta_database) + cache.data = CACHE_SV.STORED[SOURCE_KEY] + CoreObject.cache = cache + + --check for LOD plugins + local addonCount = GetNumAddOns() + + for i = 1, addonCount do + local addonName, _, _, _, _, reason = GetAddOnInfo(i) + local lod = IsAddOnLoadOnDemand(i) + local header = GetAddOnMetadata(i, HeaderFromMeta) + local schema = GetAddOnMetadata(i, SchemaFromMeta) + + if(lod and schema) then + NewLoadOnDemand(addonName, schema, header) + end + end +end + +function lib:Launch() + if LoadOnDemand then + for schema,name in pairs(LoadOnDemand) do + local db = PROFILE_SV.SAFEDATA[schema] + if(db and (db.enable or db.enable ~= false)) then + if(not IsAddOnLoaded(name)) then + local loaded, reason = LoadAddOn(name) + end + EnableAddOn(name) + end + end + end + + self:LoadQueuedModules() + self:LoadQueuedPlugins() + + if ScriptQueue then + for i=1, #ScriptQueue do + local fn = ScriptQueue[i] + if(fn and type(fn) == "function") then + fn() + end + end + + ScriptQueue = nil + end + + PROFILE_SV.SAFEDATA.NEEDSLIVEUPDATE = C_PetBattles.IsInBattle() +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Timers.lua b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Timers.lua new file mode 100644 index 0000000..5ae10b2 --- /dev/null +++ b/Interface/AddOns/SVUI/libs/LibSuperVillain-1.0/modules/Timers.lua @@ -0,0 +1,133 @@ +--[[ + /$$$$$$$$/$$ +|__ $$__/__/ + | $$ /$$ /$$$$$$/$$$$ /$$$$$$ /$$$$$$ /$$$$$$$ + | $$ | $$| $$_ $$_ $$ /$$__ $$ /$$__ $$/$$_____/ + | $$ | $$| $$ \ $$ \ $$| $$$$$$$$| $$ \__/ $$$$$$ + | $$ | $$| $$ | $$ | $$| $$_____/| $$ \____ $$ + | $$ | $$| $$ | $$ | $$| $$$$$$$| $$ /$$$$$$$/ + |__/ |__/|__/ |__/ |__/ \_______/|__/ |_______/ +--]] + +--[[ LOCALIZED GLOBALS ]]-- +--GLOBAL NAMESPACE +local _G = getfenv(0); +--LUA +local unpack = _G.unpack; +local select = _G.select; +local assert = _G.assert; +local rawset = _G.rawset; +local rawget = _G.rawget; +local getmetatable = _G.getmetatable; +local setmetatable = _G.setmetatable; +local tinsert = _G.tinsert; +local string = _G.string; +local math = _G.math; +local table = _G.table; +--[[ STRING METHODS ]]-- +local format = string.format; +--[[ MATH METHODS ]]-- +local abs, ceil, floor, round = math.abs, math.ceil, math.floor, math.round; +--[[ TABLE METHODS ]]-- +local tremove = table.remove; +--BLIZZARD API +local wipe = _G.wipe; +local GetLocale = _G.GetLocale; + +--[[ LIB CONSTRUCT ]]-- + +local lib = LibSuperVillain:NewLibrary("Timers") + +if not lib then return end -- No upgrade needed + +--[[ LIB EVENT LISTENER ]]-- + +lib.Handler = CreateFrame("Frame", nil) + +--[[ LOCAL VARS ]]-- + +local TimerQueue = {}; +local TimerCount = 0; + +local ExeTimerManager_OnUpdate = function(self, elapsed) + if(TimerCount > 0) then + for id,_ in pairs(TimerQueue) do + local callback = TimerQueue[id] + if(callback.f) then + if callback.t > elapsed then + local newTime = callback.t - elapsed + TimerQueue[id].t = newTime + else + callback.f() + if(callback.x) then + TimerQueue[id].t = callback.x + else + TimerQueue[id] = nil + TimerCount = TimerCount - 1; + end + end + end + end + end +end + +local Timers_EventHandler = function(self, event) + if(event == "PLAYER_REGEN_DISABLED") then + self:SetScript("OnUpdate", nil) + else + self:SetScript("OnUpdate", ExeTimerManager_OnUpdate) + end +end + +--[[ PUBLIC METHODS ]]-- + +function lib:ExecuteTimer(timeOutFunction, duration, idCheck) + if(type(duration) == "number" and type(timeOutFunction) == "function") then + if(idCheck and TimerQueue[idCheck]) then + TimerQueue[idCheck].t = duration + return idCheck + else + TimerCount = TimerCount + 1 + local id = "LOOP" .. TimerCount; + TimerQueue[id] = {t = duration, f = timeOutFunction} + return id + end + end + return false +end + +function lib:ExecuteLoop(timeOutFunction, duration, idCheck) + if(type(duration) == "number" and type(timeOutFunction) == "function") then + if(idCheck and TimerQueue[idCheck]) then + TimerQueue[idCheck].x = duration + TimerQueue[idCheck].t = duration + return idCheck + else + TimerCount = TimerCount + 1 + local id = "LOOP" .. TimerCount; + TimerQueue[id] = {x = duration, t = duration, f = timeOutFunction} + return id + end + end + return false +end + +function lib:RemoveLoop(id) + if(TimerQueue[id]) then + TimerQueue[id] = nil + TimerCount = TimerCount - 1; + end +end + +function lib:ClearAllTimers() + wipe(TimerQueue) + self.Handler:SetScript("OnUpdate", nil) + self.Handler:SetScript("OnUpdate", ExeTimerManager_OnUpdate) +end + +function lib:Initialize() + self.Handler:RegisterEvent('PLAYER_REGEN_ENABLED') + self.Handler:RegisterEvent('PLAYER_REGEN_DISABLED') + self.Handler:SetScript("OnEvent", Timers_EventHandler) + self.Handler:SetScript("OnUpdate", ExeTimerManager_OnUpdate) +end \ No newline at end of file diff --git a/Interface/AddOns/SVUI/libs/_load.xml b/Interface/AddOns/SVUI/libs/_load.xml index bc724e1..cad829b 100644 --- a/Interface/AddOns/SVUI/libs/_load.xml +++ b/Interface/AddOns/SVUI/libs/_load.xml @@ -1,5 +1,5 @@ <Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file="LibSuperVillain-1.0\LibSuperVillain-1.0.lua"/> + <Include file="LibSuperVillain-1.0\LibSuperVillain-1.0.xml"/> <Script file="LibStub\LibStub.lua"/> <Script file="CallbackHandler-1.0\CallbackHandler-1.0.lua"/> <Script file="LibSharedMedia-3.0\LibSharedMedia-3.0.lua"/> diff --git a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua index 0f85b3f..f8c37b8 100644 --- a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua +++ b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua @@ -263,10 +263,7 @@ local function SaveActionButton(parent) local cooldown = _G[button.."Cooldown"] cooldown.SizeOverride = SV.db.SVBar.cooldownSize MOD:FixKeybindText(parent) - if not MOD.ButtonCache[parent] then - SV.Timers:AddCooldown(cooldown) - MOD.ButtonCache[parent] = true - end + MOD.ButtonCache[parent] = true parent:SetSlotTemplate(true, 2, 0, 0, 0.75) parent:SetCheckedTexture("") end diff --git a/Interface/AddOns/SVUI/packages/aura/SVAura.lua b/Interface/AddOns/SVUI/packages/aura/SVAura.lua index be9351b..849eef4 100644 --- a/Interface/AddOns/SVUI/packages/aura/SVAura.lua +++ b/Interface/AddOns/SVUI/packages/aura/SVAura.lua @@ -98,9 +98,10 @@ local AURA_ICONS = { [[Interface\Addons\SVUI\assets\artwork\Icons\AURA-POWER]], [[Interface\Addons\SVUI\assets\artwork\Icons\AURA-HASTE]], [[Interface\Addons\SVUI\assets\artwork\Icons\AURA-SPELL]], - [[Interface\Addons\SVUI\assets\artwork\Icons\AURA-HASTE]], [[Interface\Addons\SVUI\assets\artwork\Icons\AURA-CRIT]], - [[Interface\Addons\SVUI\assets\artwork\Icons\AURA-MASTERY]] + [[Interface\Addons\SVUI\assets\artwork\Icons\AURA-MASTERY]], + [[Interface\Addons\SVUI\assets\artwork\Icons\AURA-MULTISTRIKE]], + [[Interface\Addons\SVUI\assets\artwork\Icons\AURA-VERSATILITY]] }; -- local RefHyperBuffs = { -- [1]={1126,115921,20217}, @@ -426,24 +427,19 @@ do function MOD:Update_ConsolidatedBuffsSettings(event) SVUI_ConsolidatedBuffs:SetAllPoints(SVUI_AurasAnchor) - local swapIndex1, swapIndex2, hideIndex1, hideIndex2 + local hideIndex1 if SV.db.SVAura.hyperBuffs.filter then if SV.ClassRole == 'C' then - swapIndex1 = 4 - hideIndex1 = 3 - swapIndex2 = 5 - hideIndex2 = 4 + hideIndex = 3 else - swapIndex1 = 6 - hideIndex1 = 5 - swapIndex2 = 7 - hideIndex2 = 6 + hideIndex = 5 end end local lastGoodFrame - local buffSize = (Minimap:GetHeight() / 8) + 4 + local maxShown = #AURA_ICONS - 1 + local buffSize = (Minimap:GetHeight() / maxShown) + 4 - for i=1,NUM_LE_RAID_BUFF_TYPES do + for i=1, NUM_LE_RAID_BUFF_TYPES do local buff = SVUI_ConsolidatedBuffs[i] local lastIndex = (i - 1) if(buff) then @@ -456,7 +452,7 @@ do buff:Point("TOP", lastGoodFrame, "BOTTOM", 0, -4) end - if((hideIndex1 and i == hideIndex1) or (hideIndex2 and i == hideIndex2)) then + if(hideIndex and i == hideIndex) then buff:Hide() else buff:Show() diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua index decc0d4..90283e6 100644 --- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua +++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua @@ -251,20 +251,35 @@ function MOD:INVENTORY_SEARCH_UPDATE() for _, frame in pairs(self.BagFrames) do for id, bag in ipairs(frame.Bags) do for i = 1, GetContainerNumSlots(id) do - local _, _, _, _, _, _, _, n = GetContainerItemInfo(id, i) + local _, _, _, _, _, _, _, isFiltered = GetContainerItemInfo(id, i) local item = bag[i] if(item and item:IsShown()) then - if n then - SetItemButtonDesaturated(item, 1, 1, 1, 1) + if isFiltered then + SetItemButtonDesaturated(item, 1) item:SetAlpha(0.4) else - SetItemButtonDesaturated(item, 0, 1, 1, 1) + SetItemButtonDesaturated(item) item:SetAlpha(1) end end end end - end + end + if(self.ReagentFrame) then + for i = 1, self.ReagentFrame.numSlots do + local _, _, _, _, _, _, _, isFiltered = GetContainerItemInfo(id, i) + local item = bag[i] + if(item and item:IsShown()) then + if isFiltered then + SetItemButtonDesaturated(item, 1) + item:SetAlpha(0.4) + else + SetItemButtonDesaturated(item) + item:SetAlpha(1) + end + end + end + end end local SlotUpdate = function(self, slotID) @@ -585,8 +600,6 @@ local ContainerFrame_UpdateLayout = function(self) slot.iconTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9); slot.cooldown = _G[cdName]; - SV.Timers:AddCooldown(slot.cooldown) - bag[slotID] = slot else slot = bag[slotID] @@ -659,6 +672,7 @@ local ReagentFrame_UpdateLayout = function(self) local totalSlots = 0; self.holderFrame:Width(holderWidth); + self.BagID = bagID local bag; local bagName = ("%sBag%d"):format(containerName, bagID) @@ -673,6 +687,7 @@ local ReagentFrame_UpdateLayout = function(self) bag = self.Bags[bagID] end + self.numSlots = maxCount; bag.numSlots = maxCount; bag.bagFamily = false; @@ -701,8 +716,6 @@ local ReagentFrame_UpdateLayout = function(self) slot.iconTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9); slot.cooldown = _G[cdName]; - SV.Timers:AddCooldown(slot.cooldown) - bag[slotID] = slot else slot = bag[slotID] @@ -1069,8 +1082,15 @@ do end elseif(event == "BAG_UPDATE_COOLDOWN") then self:RefreshCooldowns() - elseif(event == "PLAYERBANKSLOTS_CHANGED" or event == "PLAYERREAGENTBANKSLOTS_CHANGED") then + elseif(event == "PLAYERBANKSLOTS_CHANGED") then self:RefreshBags() + elseif(event == "PLAYERREAGENTBANKSLOTS_CHANGED") then + local slotID = ... + local container = _G["SVUI_ReagentContainerFrame"] + if(slotID and container) then + local bagID = container.BagID + container.Bags[bagID]:SlotUpdate(slotID) + end end end @@ -1213,7 +1233,8 @@ do frame:RegisterEvent("BAG_UPDATE") frame:RegisterEvent("EQUIPMENT_SETS_CHANGED") frame:RegisterEvent("PLAYERBANKSLOTS_CHANGED") - --frame:RegisterEvent("PLAYERREAGENTBANKSLOTS_CHANGED") + frame:RegisterEvent("PLAYERREAGENTBANKSLOTS_CHANGED") + frame:SetMovable(true) frame:RegisterForDrag("LeftButton", "RightButton") @@ -1402,7 +1423,7 @@ do frame:RegisterEvent("BAG_UPDATE") frame:RegisterEvent("EQUIPMENT_SETS_CHANGED") frame:RegisterEvent("PLAYERBANKSLOTS_CHANGED") - --frame:RegisterEvent("PLAYERREAGENTBANKSLOTS_CHANGED") + frame:RegisterEvent("PLAYERREAGENTBANKSLOTS_CHANGED") frame:SetMovable(true) frame:RegisterForDrag("LeftButton", "RightButton") @@ -1577,8 +1598,6 @@ do frame.transferButton:SetScript("OnLeave", Tooltip_Hide) frame.transferButton:SetScript("OnClick", DepositReagentBank) - hooksecurefunc("DepositReagentBank", function() SVUI_ReagentContainerFrame.Bags[REAGENTBANK_CONTAINER]:RefreshSlots() end) - frame:SetPoint("BOTTOMLEFT", self.BankFrame, "BOTTOMRIGHT", 2, 0) self.ReagentFrame = frame end @@ -1715,10 +1734,10 @@ function MOD:BANKFRAME_CLOSED() end function MOD:PLAYERBANKBAGSLOTS_CHANGED() - if(self.BankFrame and self.BankFrame:IsShown()) then + if(self.BankFrame) then self.BankFrame:UpdateLayout() end - if(self.ReagentFrame and self.ReagentFrame:IsShown()) then + if(self.ReagentFrame) then self.ReagentFrame:UpdateLayout() end end @@ -1845,7 +1864,6 @@ function MOD:Load() self:RegisterEvent("PLAYER_TRADE_MONEY", "UpdateGoldText") self:RegisterEvent("TRADE_MONEY_CHANGED", "UpdateGoldText") self:RegisterEvent("PLAYERBANKBAGSLOTS_CHANGED") - self:RegisterEvent("PLAYERREAGENTBANKSLOTS_CHANGED") StackSplitFrame:SetFrameStrata("DIALOG") diff --git a/Interface/AddOns/SVUI/packages/stats/SVStats.lua b/Interface/AddOns/SVUI/packages/stats/SVStats.lua index 4718289..4c41f7f 100644 --- a/Interface/AddOns/SVUI/packages/stats/SVStats.lua +++ b/Interface/AddOns/SVUI/packages/stats/SVStats.lua @@ -677,7 +677,7 @@ function MOD:Load() local hexClass = classColor.colorStr BGStatString = "|cff" .. hexHighlight .. "%s: |c" .. hexClass .. "%s|r"; - self.Accountant = _G.LibSuperVillain:NewGlobal("Accountant") + self.Accountant = LibSuperVillain("Registry"):NewGlobal("Accountant") self.Accountant = self.Accountant or {}; self.Accountant[playerRealm] = self.Accountant[playerRealm] or {}; diff --git a/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua b/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua index 467a40c..17f5170 100644 --- a/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua +++ b/Interface/AddOns/SVUI/packages/unit/elements/essentials.lua @@ -402,7 +402,7 @@ function MOD:SetActionPanel(frame, unit, noHealthText, noPowerText, noMiscText) frame.ActionPanel.class = CreateFrame("Frame", nil, frame.InfoPanel) frame.ActionPanel.class:Size(18) frame.ActionPanel.class:Point("TOPLEFT", frame.ActionPanel, "TOPLEFT", 2, -2) - frame.ActionPanel.class:SetPanelTemplate("", true, 2, 0, 0) + frame.ActionPanel.class:SetPanelTemplate("Default", true, 2, 0, 0) frame.ActionPanel.class.texture = frame.ActionPanel.class.Panel:CreateTexture(nil, "BORDER") frame.ActionPanel.class.texture:SetAllPoints(frame.ActionPanel.class.Panel) diff --git a/Interface/AddOns/SVUI/scripts/comix.lua b/Interface/AddOns/SVUI/scripts/comix.lua index f279bce..379291a 100644 --- a/Interface/AddOns/SVUI/scripts/comix.lua +++ b/Interface/AddOns/SVUI/scripts/comix.lua @@ -84,46 +84,51 @@ CORE FUNCTIONS function Comix:ReadyState(state) if(state == nil) then return animReady end animReady = state -end +end -function Comix:LaunchPopup(comicType) +function Comix:LaunchPremiumPopup() local rng = random(1, 16); local coords = COMIX_DATA[1][rng]; - if(comicType == "PREMIUM") then - ComixPremiumPanel.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - ComixPremiumPanelBG.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - local offsets = COMIX_DATA[2][rng] - ComixPremiumPanel.anim[1]:SetOffset(offsets[1],offsets[2]) - ComixPremiumPanel.anim[2]:SetOffset(offsets[3],offsets[4]) - ComixPremiumPanel.anim[3]:SetOffset(0,0) - ComixPremiumPanelBG.anim[1]:SetOffset(offsets[5],offsets[6]) - ComixPremiumPanelBG.anim[2]:SetOffset(offsets[7],offsets[8]) - ComixPremiumPanelBG.anim[3]:SetOffset(0,0) - ComixPremiumPanel.anim:Play() - ComixPremiumPanelBG.anim:Play() - elseif(comicType == "DELUXE") then - local frame = ComixDeluxePanel - local step1_x = random(-100, 100); - if(step1_x > -30 and step1_x < 30) then step1_x = step1_x * 3 end - local step1_y = random(-100, 100); - if(step1_y > -30 and step1_y < 30) then step1_y = step1_y * 3 end - frame.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - frame:Point("CENTER", SV.UIParent, "CENTER", step1_x, step1_y) - frame.anim:Play() - else - local frame = ComixBasicPanel - local step1_x = random(-100, 100); - if(step1_x > -30 and step1_x < 30) then step1_x = step1_x * 3 end - local step1_y = random(-100, 100); - if(step1_y > -30 and step1_y < 30) then step1_y = step1_y * 3 end - local step2_x = step1_x * 0.5; - local step2_y = step1_y * 0.75; - frame.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) - frame.anim[1]:SetOffset(step1_x, step1_y) - frame.anim[2]:SetOffset(step2_x, step2_y) - frame.anim[3]:SetOffset(0,0) - frame.anim:Play() - end + local offsets = COMIX_DATA[2][rng] + + self.Premium.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) + self.Premium.bg.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) + self.Premium.anim[1]:SetOffset(offsets[1],offsets[2]) + self.Premium.anim[2]:SetOffset(offsets[3],offsets[4]) + self.Premium.anim[3]:SetOffset(0,0) + self.Premium.bg.anim[1]:SetOffset(offsets[5],offsets[6]) + self.Premium.bg.anim[2]:SetOffset(offsets[7],offsets[8]) + self.Premium.bg.anim[3]:SetOffset(0,0) + self.Premium.anim:Play() + self.Premium.bg.anim:Play() +end + +function Comix:LaunchDeluxePopup() + local rng = random(1, 16); + local coords = COMIX_DATA[1][rng]; + local step1_x = random(-100, 100); + if(step1_x > -30 and step1_x < 30) then step1_x = step1_x * 3 end + local step1_y = random(-100, 100); + if(step1_y > -30 and step1_y < 30) then step1_y = step1_y * 3 end + local step2_x = step1_x * 0.5; + local step2_y = step1_y * 0.75; + self.Deluxe.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) + self.Deluxe.anim[1]:SetOffset(step1_x, step1_y) + self.Deluxe.anim[2]:SetOffset(step2_x, step2_y) + self.Deluxe.anim[3]:SetOffset(0,0) + self.Deluxe.anim:Play() +end + +function Comix:LaunchPopup() + local rng = random(1, 16); + local coords = COMIX_DATA[1][rng]; + local step1_x = random(-100, 100); + if(step1_x > -30 and step1_x < 30) then step1_x = step1_x * 3 end + local step1_y = random(-100, 100); + if(step1_y > -30 and step1_y < 30) then step1_y = step1_y * 3 end + self.Basic.tex:SetTexCoord(coords[1],coords[2],coords[3],coords[4]) + self.Basic:Point("CENTER", SV.UIParent, "CENTER", step1_x, step1_y) + self.Basic.anim:Play() end local Comix_OnEvent = function(self, event, ...) @@ -134,20 +139,14 @@ local Comix_OnEvent = function(self, event, ...) if subEvent == "PARTY_KILL" and guid == playerGUID and ready then self:ReadyState(false) local rng = random(1,15) - if((rng < 3) and SV.db.general.bigComix) then - self:LaunchPopup("PREMIUM") - elseif rng < 8 then - self:LaunchPopup("DELUXE") + if rng < 8 then + self:LaunchDeluxePopup() else - self:LaunchPopup("BASIC") + self:LaunchPopup() end end end -function ComixPop() - Comix:LaunchPopup("DELUXE") -end --- /script ComixPop() function SV:ToggleComix() if not SV.db.general.comix then Comix:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") @@ -178,9 +177,11 @@ local function LoadSVComix() basic.tex:FillInner(basic) basic.tex:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\COMICS-TYPE1]]) basic.tex:SetTexCoord(0,0.25,0,0.25) - SV.Animate:RandomSlide(basic, true) + SV.Animate:Kapow(basic, true) basic:SetAlpha(0) - basic.anim[3]:SetScript("OnFinished", Comix_OnUpdate) + basic.anim[2]:SetScript("OnFinished", Comix_OnUpdate) + + Comix.Basic = basic local deluxe = CreateFrame("Frame", "ComixDeluxePanel", SV.UIParent) deluxe:SetSize(100, 100) @@ -190,9 +191,11 @@ local function LoadSVComix() deluxe.tex:FillInner(deluxe) deluxe.tex:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\COMICS-TYPE2]]) deluxe.tex:SetTexCoord(0,0.25,0,0.25) - SV.Animate:Kapow(deluxe, true) + SV.Animate:RandomSlide(deluxe, true) deluxe:SetAlpha(0) - deluxe.anim[2]:SetScript("OnFinished", Comix_OnUpdate) + deluxe.anim[3]:SetScript("OnFinished", Comix_OnUpdate) + + Comix.Deluxe = deluxe local premium = CreateFrame("Frame", "ComixPremiumPanel", SV.UIParent) premium:SetSize(100, 100) @@ -206,17 +209,22 @@ local function LoadSVComix() premium:SetAlpha(0) premium.anim[3]:SetScript("OnFinished", Comix_OnUpdate) - local premiumbg = CreateFrame("Frame", "ComixPremiumPanelBG", SV.UIParent) - premiumbg:SetSize(128, 128) - premiumbg:SetFrameStrata("BACKGROUND") - premiumbg:Point("CENTER", SV.UIParent, "CENTER", 0, -50) - premiumbg.tex = premiumbg:CreateTexture(nil, "ARTWORK") - premiumbg.tex:FillInner(premiumbg) - premiumbg.tex:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\COMICS-TYPE3-BG]]) - premiumbg.tex:SetTexCoord(0,0.25,0,0.25) - SV.Animate:RandomSlide(premiumbg, false) - premiumbg:SetAlpha(0) - premiumbg.anim[3]:SetScript("OnFinished", Comix_OnUpdate) + local bg = CreateFrame("Frame", "ComixPremiumPanelBG", SV.UIParent) + bg:SetSize(128, 128) + bg:SetFrameStrata("BACKGROUND") + bg:Point("CENTER", SV.UIParent, "CENTER", 0, -50) + bg.tex = bg:CreateTexture(nil, "ARTWORK") + bg.tex:FillInner(bg) + bg.tex:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Doodads\COMICS-TYPE3-BG]]) + bg.tex:SetTexCoord(0,0.25,0,0.25) + SV.Animate:RandomSlide(bg, false) + bg:SetAlpha(0) + bg.anim[3]:SetScript("OnFinished", Comix_OnUpdate) + + premium.bg = bg + + Comix.Premium = premium + --MOD local toasty = CreateFrame("Frame", "ComixToastyPanelBG", UIParent) toasty:SetSize(256, 256) diff --git a/Interface/AddOns/SVUI/scripts/ego.lua b/Interface/AddOns/SVUI/scripts/ego.lua index 4cebace..c8a591a 100644 --- a/Interface/AddOns/SVUI/scripts/ego.lua +++ b/Interface/AddOns/SVUI/scripts/ego.lua @@ -51,6 +51,7 @@ local GoGoGadget = function(self, key) end local function LoadSVEgo() + if(not SV.db.general.ego) then return end local GameMenuFrame = _G.GameMenuFrame local EgoFrame = CreateFrame("Frame", "SVUI_EgoFrame", UIParent); diff --git a/Interface/AddOns/SVUI/scripts/misc.lua b/Interface/AddOns/SVUI/scripts/misc.lua index 03dc85a..2880fdf 100644 --- a/Interface/AddOns/SVUI/scripts/misc.lua +++ b/Interface/AddOns/SVUI/scripts/misc.lua @@ -481,7 +481,6 @@ local function CreateTotemBar() local id = priorities[i] local totem = CreateFrame("Button", "TotemBarTotem"..id, TotemBar) totem:SetID(id) - totem:SetButtonTemplate() totem:Hide() totem.Icon = totem:CreateTexture(nil, "ARTWORK") @@ -489,12 +488,12 @@ local function CreateTotemBar() totem.Icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) totem.CD = CreateFrame("Cooldown", "TotemBarTotem"..id.."Cooldown", totem, "CooldownFrameTemplate") totem.CD:SetReverse(true) - totem.CD:FillInner() - SV.Timers:AddCooldown(totem.CD) totem.Anchor = CreateFrame("Frame", nil, totem) totem.Anchor:SetAllPoints() + totem:SetButtonTemplate() + totem:EnableMouse(true) totem:SetScript('OnEnter', Totem_OnEnter) totem:SetScript('OnLeave', Totem_OnLeave) diff --git a/Interface/AddOns/SVUI/scripts/raid.lua b/Interface/AddOns/SVUI/scripts/raid.lua index 9a4aa55..df8743e 100644 --- a/Interface/AddOns/SVUI/scripts/raid.lua +++ b/Interface/AddOns/SVUI/scripts/raid.lua @@ -48,9 +48,7 @@ end local function ButtonEnter(self) self:SetPanelColor("highlight") - if(self.icon) then - self.icon:SetGradient(unpack(SV.Media.gradient.inverse)) - end + if(self.TText) then GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4) GameTooltip:ClearLines() @@ -61,9 +59,7 @@ end local function ButtonLeave(self) self:SetPanelColor("inverse") - if(self.icon) then - self.icon:SetGradient(unpack(SV.Media.gradient.icon)) - end + GameTooltip:Hide() end @@ -285,6 +281,8 @@ local function LoadRaidUtility() button:HookScript("OnLeave", ButtonLeave) end end + + SVUI_RaidTools.icon:SetTexture([[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-RAIDTOOL]]) end end SV:NewScript(LoadRaidUtility); \ No newline at end of file diff --git a/Interface/AddOns/SVUI/scripts/spellbind.lua b/Interface/AddOns/SVUI/scripts/spellbind.lua index 22d5eb8..2ae643e 100644 --- a/Interface/AddOns/SVUI/scripts/spellbind.lua +++ b/Interface/AddOns/SVUI/scripts/spellbind.lua @@ -33,7 +33,7 @@ local tconcat = table.concat; local tinsert = _G.tinsert; local tremove = _G.tremove; -local SVLib = _G.LibSuperVillain +local SVLib = LibSuperVillain("Registry") --[[ ########################################################## Simple click2cast spell SpellBinder(sBinder by Fernir) diff --git a/Interface/AddOns/SVUI/setup/installer.lua b/Interface/AddOns/SVUI/setup/installer.lua index cf4385e..f6aa752 100644 --- a/Interface/AddOns/SVUI/setup/installer.lua +++ b/Interface/AddOns/SVUI/setup/installer.lua @@ -42,7 +42,7 @@ GET ADDON DATA ########################################################## ]]-- local SV = select(2, ...) -local SVLib = _G.LibSuperVillain; +local SVLib = LibSuperVillain("Registry"); local L = SV.L; --[[ ########################################################## diff --git a/Interface/AddOns/SVUI/setup/presets.lua b/Interface/AddOns/SVUI/setup/presets.lua index ecb2a56..e62d239 100644 --- a/Interface/AddOns/SVUI/setup/presets.lua +++ b/Interface/AddOns/SVUI/setup/presets.lua @@ -42,7 +42,7 @@ GET ADDON DATA ########################################################## ]]-- local SV = select(2, ...) -local SVLib = _G.LibSuperVillain +local SVLib = LibSuperVillain("Registry") local L = SV.L; --[[ ########################################################## diff --git a/Interface/AddOns/SVUI/system/_load.xml b/Interface/AddOns/SVUI/system/_load.xml index 458130c..2cd3e19 100644 --- a/Interface/AddOns/SVUI/system/_load.xml +++ b/Interface/AddOns/SVUI/system/_load.xml @@ -3,10 +3,8 @@ <Script file="configs.lua"/> <Script file="media.lua"/> <Script file="utilities.lua"/> - <Script file="animate.lua"/> <Script file="common.lua"/> <Script file="visibility.lua"/> - <Script file="timers.lua"/> <Script file="slash.lua"/> <Script file="alerts.lua"/> <Script file="moveable.lua"/> diff --git a/Interface/AddOns/SVUI/system/alerts.lua b/Interface/AddOns/SVUI/system/alerts.lua index a4bcfef..480920f 100644 --- a/Interface/AddOns/SVUI/system/alerts.lua +++ b/Interface/AddOns/SVUI/system/alerts.lua @@ -42,7 +42,7 @@ GET ADDON DATA ########################################################## ]]-- local SV = select(2, ...) -local SVLib = _G.LibSuperVillain; +local SVLib = LibSuperVillain("Registry"); local L = SV.L; --[[ ########################################################## @@ -828,7 +828,7 @@ end function SV:StaticPopup_Hide(which, data) for index = 1, MAX_STATIC_POPUPS, 1 do local dialog = _G["SVUI_SystemAlert"..index]; - if ( (dialog.which == which) and (not data or (data == dialog.data)) ) then + if (dialog and (dialog.which == which) and (not data or (data == dialog.data)) ) then dialog:Hide(); end end diff --git a/Interface/AddOns/SVUI/system/common.lua b/Interface/AddOns/SVUI/system/common.lua index ae2b968..34e7219 100644 --- a/Interface/AddOns/SVUI/system/common.lua +++ b/Interface/AddOns/SVUI/system/common.lua @@ -346,7 +346,7 @@ SV:NewCallback(FontTemplateUpdates) XML TEMPLATE LOOKUP TABLE ########################################################## ]]-- -local _templates = { +local XML_LOOKUP = { ["Default"] = "SVUI_PanelTemplate_Default", ["Transparent"] = "SVUI_PanelTemplate_Transparent", ["Component"] = "SVUI_PanelTemplate_Component", @@ -358,7 +358,7 @@ local _templates = { ["Slot"] = "SVUI_PanelTemplate_Slot", ["Inset"] = "SVUI_PanelTemplate_Inset", ["Comic"] = "SVUI_PanelTemplate_Comic", - ["ModelComic"] = "SVUI_PanelTemplate_ModelComic", + ["Model"] = "SVUI_PanelTemplate_Model", ["Paper"] = "SVUI_PanelTemplate_Paper", ["Container"] = "SVUI_PanelTemplate_Container", ["Pattern"] = "SVUI_PanelTemplate_Pattern", @@ -403,7 +403,8 @@ local HookVertexColor = function(self,...) end local HookCustomBackdrop = function(self) - local newBgFile = SV.Media.bg[self._bdtex] + local bgid = self.Panel:GetAttribute("panelID") + local newBgFile = SV.Media.bg[bgid] local bd = { bgFile = newBgFile, edgeFile = [[Interface\BUTTONS\WHITE8X8]], @@ -426,50 +427,181 @@ local HookFrameLevel = function(self, level) if(adjustment < 0) then adjustment = 0 end self.Panel:SetFrameLevel(adjustment) end + +local Cooldown_ForceUpdate = function(self) + self.nextUpdate = 0; + self:Show() +end + +local Cooldown_StopTimer = function(self) + self.enable = nil; + self:Hide() +end + +local Cooldown_OnUpdate = function(self, elapsed) + if self.nextUpdate > 0 then + self.nextUpdate = self.nextUpdate - elapsed; + return + end + local expires = (self.duration - (GetTime() - self.start)); + if expires > 0.05 then + if (self.fontScale * self:GetEffectiveScale() / UIParent:GetScale()) < 0.5 then + self.text:SetText('') + self.nextUpdate = 500 + else + local timeLeft = 0; + local calc = 0; + if expires < 4 then + self.nextUpdate = 0.051 + self.text:SetFormattedText("|cffff0000%.1f|r", expires) + elseif expires < 60 then + self.nextUpdate = 0.51 + self.text:SetFormattedText("|cffffff00%d|r", floor(expires)) + elseif expires < 3600 then + timeLeft = ceil(expires / 60); + calc = floor((expires / 60) + .5); + self.nextUpdate = calc > 1 and ((expires - calc) * 29.5) or (expires - 59.5); + self.text:SetFormattedText("|cffffffff%dm|r", timeLeft) + elseif expires < 86400 then + timeLeft = ceil(expires / 3600); + calc = floor((expires / 3600) + .5); + self.nextUpdate = calc > 1 and ((expires - calc) * 1799.5) or (expires - 3570); + self.text:SetFormattedText("|cff66ffff%dh|r", timeLeft) + else + timeLeft = ceil(expires / 86400); + calc = floor((expires / 86400) + .5); + self.nextUpdate = calc > 1 and ((expires - calc) * 43199.5) or (expires - 86400); + self.text:SetFormattedText("|cff6666ff%dd|r", timeLeft) + end + end + else + Cooldown_StopTimer(self) + end +end + +local Cooldown_OnSizeChanged = function(self, width, height) + local frame = self.timer + local override = self.SizeOverride + local newSize = floor(width + .5) / 36; + override = override or frame:GetParent():GetParent().SizeOverride; + if override then + newSize = override / 20 + end + if newSize == frame.fontScale then + return + end + frame.fontScale = newSize; + if newSize < 0.5 and not override then + frame:Hide() + else + frame:Show() + frame.text:SetFont([[Interface\AddOns\SVUI\assets\fonts\Numbers.ttf]], newSize * 15, 'OUTLINE') + if frame.enable then + Cooldown_ForceUpdate(frame) + end + end +end + +local function CreateCooldownTimer(frame) + local timer = CreateFrame('Frame', nil, frame) + timer:Hide() + timer:SetAllPoints() + timer:SetScript('OnUpdate', Cooldown_OnUpdate) + + local timeText = timer:CreateFontString(nil,'OVERLAY') + timeText:SetPoint('CENTER',1,1) + timeText:SetJustifyH("CENTER") + timer.text = timeText; + + frame.timer = timer; + local width, height = frame:GetSize() + Cooldown_OnSizeChanged(frame, width, height) + frame:SetScript('OnSizeChanged', Cooldown_OnSizeChanged) + + return frame.timer +end + +local _hook_Cooldown_SetCooldown = function(self, start, duration, elapsed) + if start > 0 and duration > 2.5 then + local timer = self.timer or CreateCooldownTimer(self) + timer.start = start; + timer.duration = duration; + timer.enable = true; + timer.nextUpdate = 0; + + if timer.fontScale >= 0.5 then + timer:Show() + end + else + local timer = self.timer; + if timer then + Cooldown_StopTimer(timer) + end + end + if self.timer then + if elapsed and elapsed > 0 then + self.timer:SetAlpha(0) + else + self.timer:SetAlpha(0.8) + end + end +end +--[[ +########################################################## +COOLDOWN HELPER +########################################################## +]]-- +local function CreateCooldown(frame) + if(SV.db.general and not SV.db.general.cooldown) then return end + local button = frame:GetName() + if(button) then + local cooldown = _G[button.."Cooldown"] + if(not cooldown or (not frame.Panel)) then return end + if(cooldown.HookedCooldown) then return end + cooldown:ClearAllPoints() + cooldown:FillInner(frame.Panel) + cooldown:SetSwipeColor(0, 0, 0, 1) + cooldown.HookedCooldown = true + cooldown:SetHideCountdownNumbers(true) + + hooksecurefunc(cooldown, "SetCooldown", _hook_Cooldown_SetCooldown) + end +end --[[ ########################################################## TEMPLATE HELPERS ########################################################## ]]-- local function CreatePanelTemplate(frame, templateName, underlay, noupdate, padding, xOffset, yOffset, defaultColor) - if(not templateName or not _templates[templateName]) then templateName = frame._template or 'Default' end - - local xmlTemplate = _templates[templateName] + local xmlTemplate = XML_LOOKUP[templateName] or "SVUI_PanelTemplate_Default" local borderColor = {0,0,0,1} - local needsHooks = false; - if(not frame.Panel) then - needsHooks = true + frame.Panel = NewFrame('Frame', nil, frame, xmlTemplate) - local panel = NewFrame('Frame', nil, frame, xmlTemplate) + local level = frame:GetFrameLevel() + if(level == 0 and not InCombatLockdown()) then + frame:SetFrameLevel(1) + level = 1 + end - local level = frame:GetFrameLevel() - if(level == 0 and not InCombatLockdown()) then - frame:SetFrameLevel(1) - level = 1 - end + local adjustment = level - 1; - local adjustment = level - 1; - if(adjustment < 0) then adjustment = 0 end + if(adjustment < 0) then adjustment = 0 end - panel:SetFrameLevel(adjustment) + frame.Panel:SetFrameLevel(adjustment) - NewHook(frame, "SetFrameLevel", HookFrameLevel) + NewHook(frame, "SetFrameLevel", HookFrameLevel) - frame.Panel = panel + if(defaultColor) then + frame.Panel:SetAttribute("panelColor", defaultColor) + end + if(noupdate) then + frame.Panel:SetAttribute("panelSkipUpdate", noupdate) end - local colorName = defaultColor or frame.Panel:GetAttribute("panelColor") or "default" - local gradientName = frame.Panel:GetAttribute("panelGradient") - local bypass = noupdate or frame.Panel:GetAttribute("panelSkipUpdate") - - frame._template = templateName; - frame._color = colorName; - frame._gradient = gradientName; - frame._texture = false; - frame._noupdate = bypass; - - local forcedOffset = frame.Panel:GetAttribute("panelOffset") + local colorName = frame.Panel:GetAttribute("panelColor") + local gradientName = frame.Panel:GetAttribute("panelGradient") + local forcedOffset = frame.Panel:GetAttribute("panelOffset") xOffset = forcedOffset or xOffset or 1 yOffset = forcedOffset or yOffset or 1 @@ -515,7 +647,7 @@ local function CreatePanelTemplate(frame, templateName, underlay, noupdate, padd frame.Panel:SetBackdrop(nil) end - if(needsHooks and templateName ~= 'Transparent') then + if(templateName ~= 'Transparent') then NewHook(frame.Panel, "SetBackdropBorderColor", HookPanelBorderColor) NewHook(frame, "SetBackdropBorderColor", HookBackdropBorderColor) if(underlay) then @@ -524,7 +656,6 @@ local function CreatePanelTemplate(frame, templateName, underlay, noupdate, padd end frame.BackdropNeedsUpdate = true if(templateName == 'Pattern' or templateName == 'Comic') then - frame._bdtex = lower(templateName) frame.UpdateBackdrop = HookCustomBackdrop end end @@ -543,8 +674,7 @@ local function CreatePanelTemplate(frame, templateName, underlay, noupdate, padd frame.Panel.Skin:SetVertexColor(bgColor[1], bgColor[2], bgColor[3], bgColor[4] or 1) end - if((not bypass) and frame.Panel:GetAttribute("panelTexUpdate")) then - frame._texture = lower(templateName) + if((not frame.Panel:GetAttribute("panelSkipUpdate")) and frame.Panel:GetAttribute("panelTexUpdate")) then frame.TextureNeedsUpdate = true if(templateName == 'UnitLarge' or templateName == 'UnitSmall') then frame.UpdateColor = HookVertexColor @@ -552,11 +682,6 @@ local function CreatePanelTemplate(frame, templateName, underlay, noupdate, padd end end end -end - -local function HasCooldown(n) - local cd = n and n.."Cooldown" - return cd and _G[cd] end local function CreateButtonPanel(frame, noChecked, brightChecked) @@ -624,12 +749,7 @@ local function CreateButtonPanel(frame, noChecked, brightChecked) frame:SetCheckedTexture(frame.checked) end - local cd = HasCooldown(frame:GetName()) - if cd then - cd:ClearAllPoints() - cd:FillInner(frame.Panel) - cd:SetSwipeColor(0, 0, 0, 1) - end + CreateCooldown(frame) end --[[ ########################################################## @@ -711,6 +831,7 @@ local function SetBasicPanel(self, topX, topY, bottomX, bottomY, hasShadow) end local function SetPanelTemplate(self, templateName, noupdate, overridePadding, xOffset, yOffset, defaultColor) + if(not self or (self and self.Panel)) then return end local padding = false if(overridePadding and type(overridePadding) == "number") then padding = overridePadding @@ -718,13 +839,14 @@ local function SetPanelTemplate(self, templateName, noupdate, overridePadding, x CreatePanelTemplate(self, templateName, true, noupdate, padding, xOffset, yOffset, defaultColor) - if(not self._noupdate and not self.__registered) then + if(not self.Panel:GetAttribute("panelSkipUpdate") and not self.__registered) then TemplateUpdateFrames[self] = true self.__registered = true end end local function SetFixedPanelTemplate(self, templateName, noupdate, overridePadding, xOffset, yOffset, defaultColor) + if(not self or (self and self.Panel)) then return end local padding = false if(overridePadding and type(overridePadding) == "number") then padding = overridePadding @@ -732,7 +854,7 @@ local function SetFixedPanelTemplate(self, templateName, noupdate, overridePaddi CreatePanelTemplate(self, templateName, false, noupdate, padding, xOffset, yOffset, defaultColor) - if(not self._noupdate and not self.__registered) then + if(not self.Panel:GetAttribute("panelSkipUpdate") and not self.__registered) then TemplateUpdateFrames[self] = true self.__registered = true end @@ -741,7 +863,7 @@ end local function SetPanelColor(self, ...) local arg1,arg2,arg3,arg4,arg5,arg6,arg7 = select(1, ...) if(not self.Panel or not arg1) then return; end - if(self.Panel.Skin and self._gradient) then + if(self.Panel.Skin and self.Panel:GetAttribute("panelGradient")) then if(type(arg1) == "string") then if(arg1 == "VERTICAL" or arg1 == "HORIZONTAL") then self.Panel.Skin:SetGradient(...) @@ -868,12 +990,7 @@ local function SetButtonTemplate(self, invisible, overridePadding, xOffset, yOff self:SetCheckedTexture(self.checked) end - local cd = HasCooldown(self:GetName()) - if cd then - cd:ClearAllPoints() - cd:FillInner(self.Panel) - cd:SetSwipeColor(0, 0, 0, 1) - end + CreateCooldown(self) end local function SetSlotTemplate(self, underlay, padding, x, y, shadowAlpha) @@ -887,7 +1004,7 @@ local function SetSlotTemplate(self, underlay, padding, x, y, shadowAlpha) end local function SetCheckboxTemplate(self, underlay, x, y) - if(not self or (self and self.__hooked)) then return end + if(not self or (self and self.Panel)) then return end if(underlay) then x = x or -7 @@ -904,7 +1021,6 @@ local function SetCheckboxTemplate(self, underlay, x, y) end self:SetBackdropBorderColor(r,g,b) end) - self.__hooked = true end local function SetEditboxTemplate(self, x, y, fixed) @@ -946,7 +1062,7 @@ local function SetFramedButtonTemplate(self, template, borderSize) borderSize = borderSize or 2 - template = template or self._template or "FramedBottom" + template = template or "FramedBottom" CreatePanelTemplate(self, template, false, false, 0, -borderSize, -borderSize) @@ -1051,27 +1167,30 @@ TEMPLATE UPDATE CALLBACK local function FrameTemplateUpdates() for frame in pairs(TemplateUpdateFrames) do if(frame) then - local p = SV.Media.color[frame._color]; + local panelID = frame.Panel:GetAttribute("panelID") + local colorID = frame.Panel:GetAttribute("panelColor") + local panelColor = SV.Media.color[colorID]; if(frame.BackdropNeedsUpdate) then if(frame.UpdateBackdrop) then frame:UpdateBackdrop() end - if(p) then - frame:SetBackdropColor(p[1], p[2], p[3], p[4] or 1) + if(panelColor) then + frame:SetBackdropColor(panelColor[1], panelColor[2], panelColor[3], panelColor[4] or 1) end frame:SetBackdropBorderColor(0,0,0,1) end - if(frame.TextureNeedsUpdate and frame._texture) then - local tex = SV.Media.bg[frame._texture] + if(frame.TextureNeedsUpdate and frame.Panel.Skin) then + local tex = SV.Media.bg[panelID] if(tex) then frame.Panel.Skin:SetTexture(tex) end if(not frame.NoColorUpdate) then - if(frame._gradient and SV.Media.gradient[frame._gradient]) then - local g = SV.Media.gradient[frame._gradient] + local gradient = frame.Panel:GetAttribute("panelGradient") + if(gradient and SV.Media.gradient[gradient]) then + local g = SV.Media.gradient[gradient] frame.Panel.Skin:SetGradient(g[1], g[2], g[3], g[4], g[5], g[6], g[7]) - elseif(p) then - frame.Panel.Skin:SetVertexColor(p[1], p[2], p[3], p[4] or 1) + elseif(panelColor) then + frame.Panel.Skin:SetVertexColor(panelColor[1], panelColor[2], panelColor[3], panelColor[4] or 1) end end end diff --git a/Interface/AddOns/SVUI/system/configs.lua b/Interface/AddOns/SVUI/system/configs.lua index f49ae4e..5a4848b 100644 --- a/Interface/AddOns/SVUI/system/configs.lua +++ b/Interface/AddOns/SVUI/system/configs.lua @@ -50,10 +50,11 @@ SV.configs["general"] = { ["threatbar"] = false, ["bubbles"] = true, ["comix"] = true, - ["bigComix"] = true, + ["bigComix"] = false, ["questWatch"] = true, ["questHeaders"] = true, ["woot"] = true, + ["ego"] = true, ["pvpinterrupt"] = true, ["lookwhaticando"] = false, ["reactionChat"] = false, diff --git a/Interface/AddOns/SVUI/system/core.lua b/Interface/AddOns/SVUI/system/core.lua index e160299..587d6f9 100644 --- a/Interface/AddOns/SVUI/system/core.lua +++ b/Interface/AddOns/SVUI/system/core.lua @@ -80,7 +80,7 @@ _G.SLASH_RELOADUI2 = "/reloadui" --[[ GET THE REGISTRY LIB ]]-- -local SVLib = _G.LibSuperVillain; +local SVLib = LibSuperVillain("Registry"); --[[ ##################################################################################### @@ -227,6 +227,12 @@ SVUI.ActualWidth = actualWidth SVUI.yScreenArea = (actualHeight * 0.33) SVUI.xScreenArea = (actualWidth * 0.33) +--[[ EMBEDDED LIBS ]]-- + +SVUI.L = LibSuperVillain("Linguist"):Lang(); +SVUI.Animate = LibSuperVillain("Animate"); +SVUI.Timers = LibSuperVillain("Timers"); + --[[ UTILITY FRAMES ]]-- SVUI.UIParent = CreateFrame("Frame", "SVUIParent", UIParent); @@ -529,6 +535,7 @@ function SVUI:Load() self:LoadSystemAlerts(); self:RegisterEvent('PLAYER_REGEN_DISABLED'); + self.Timers:Initialize() end function SVUI:Initialize() diff --git a/Interface/AddOns/SVUI/system/media.lua b/Interface/AddOns/SVUI/system/media.lua index abff273..709625c 100644 --- a/Interface/AddOns/SVUI/system/media.lua +++ b/Interface/AddOns/SVUI/system/media.lua @@ -39,7 +39,7 @@ GET ADDON DATA ########################################################## ]]-- local SV = select(2, ...) -local SVLib = _G.LibSuperVillain +local SVLib = LibSuperVillain("Registry") local L = SV.L local LSM = LibStub("LibSharedMedia-3.0") --[[ diff --git a/Interface/AddOns/SVUI/xml/widgets.xml b/Interface/AddOns/SVUI/xml/widgets.xml index 37326b9..85a85b7 100644 --- a/Interface/AddOns/SVUI/xml/widgets.xml +++ b/Interface/AddOns/SVUI/xml/widgets.xml @@ -13,10 +13,11 @@ <Frame name="SVUI_PanelTemplate_Default" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="default" /> + <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelColor" type="string" value="default" /> <Attribute name="panelGradient" type="string" value="default" /> <Attribute name="panelTexUpdate" type="boolean" value="false" /> - <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\BUTTONS\WHITE8X8" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -78,10 +79,11 @@ <Frame name="SVUI_PanelTemplate_Transparent" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="transparent" /> + <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelColor" type="string" value="transparent" /> <Attribute name="panelGradient" type="boolean" value="false" /> <Attribute name="panelTexUpdate" type="boolean" value="false" /> - <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelSkipUpdate" type="boolean" value="true" /> </Attributes> <Backdrop bgFile="Interface\BUTTONS\WHITE8X8" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -139,10 +141,11 @@ <Frame name="SVUI_PanelTemplate_Component" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="component" /> + <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelColor" type="string" value="default" /> <Attribute name="panelGradient" type="string" value="default" /> <Attribute name="panelTexUpdate" type="boolean" value="false" /> - <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\BUTTONS\WHITE8X8" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -207,10 +210,11 @@ <Frame name="SVUI_PanelTemplate_Headline" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="headline" /> + <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelColor" type="string" value="darkest" /> <Attribute name="panelGradient" type="boolean" value="false" /> <Attribute name="panelTexUpdate" type="boolean" value="false" /> - <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT" tile="true"> @@ -221,10 +225,11 @@ <Frame name="SVUI_PanelTemplate_Button" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="button" /> + <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelColor" type="string" value="default" /> <Attribute name="panelGradient" type="boolean" value="false" /> <Attribute name="panelTexUpdate" type="boolean" value="false" /> - <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\BUTTON" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -285,10 +290,11 @@ <Frame name="SVUI_PanelTemplate_FramedTop" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="framedtop" /> + <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelColor" type="string" value="default" /> <Attribute name="panelGradient" type="string" value="darkest2" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\BUTTONS\WHITE8X8" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -350,10 +356,11 @@ <Frame name="SVUI_PanelTemplate_FramedBottom" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="framedbottom" /> + <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelColor" type="string" value="default" /> <Attribute name="panelGradient" type="string" value="darkest" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\BUTTONS\WHITE8X8" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -415,10 +422,11 @@ <Frame name="SVUI_PanelTemplate_Bar" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="bar" /> + <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelColor" type="string" value="transparent" /> <Attribute name="panelGradient" type="boolean" value="false" /> <Attribute name="panelTexUpdate" type="boolean" value="false" /> - <Attribute name="panelPadding" type="number" value="1" /> <Attribute name="panelSkipUpdate" type="boolean" value="true" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -476,10 +484,11 @@ <Frame name="SVUI_PanelTemplate_Slot" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="slot" /> + <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelColor" type="string" value="transparent" /> <Attribute name="panelGradient" type="boolean" value="false" /> <Attribute name="panelTexUpdate" type="boolean" value="false" /> - <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelSkipUpdate" type="boolean" value="true" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -540,10 +549,11 @@ <Frame name="SVUI_PanelTemplate_Inset" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="inset" /> + <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelColor" type="string" value="transparent" /> <Attribute name="panelGradient" type="boolean" value="false" /> <Attribute name="panelTexUpdate" type="boolean" value="false" /> - <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelSkipUpdate" type="boolean" value="true" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\DEFAULT" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -601,10 +611,11 @@ <Frame name="SVUI_PanelTemplate_Comic" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="comic" /> + <Attribute name="panelPadding" type="number" value="3" /> <Attribute name="panelColor" type="string" value="class" /> <Attribute name="panelGradient" type="string" value="class" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="3" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\Background\COMIC1" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -664,12 +675,13 @@ </Layers> </Frame> - <Frame name="SVUI_PanelTemplate_ModelComic" virtual="true"> + <Frame name="SVUI_PanelTemplate_Model" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="model" /> + <Attribute name="panelPadding" type="number" value="3" /> <Attribute name="panelColor" type="string" value="special" /> <Attribute name="panelGradient" type="string" value="class" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="3" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\Background\COMIC-MODEL" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -731,10 +743,11 @@ <Frame name="SVUI_PanelTemplate_Paper" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="paper" /> + <Attribute name="panelPadding" type="number" value="3" /> <Attribute name="panelColor" type="string" value="white" /> <Attribute name="panelGradient" type="string" value="white" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="3" /> <Attribute name="panelSkipUpdate" type="boolean" value="true" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\Background\PAPER" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -796,10 +809,11 @@ <Frame name="SVUI_PanelTemplate_Container" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="container" /> + <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelColor" type="string" value="special" /> <Attribute name="panelGradient" type="string" value="special" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\Background\PATTERN3" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -861,10 +875,11 @@ <Frame name="SVUI_PanelTemplate_Pattern" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="pattern" /> + <Attribute name="panelPadding" type="number" value="3" /> <Attribute name="panelColor" type="string" value="special" /> <Attribute name="panelGradient" type="string" value="special" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="3" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\AddOns\SVUI\assets\artwork\Template\Background\PATTERN1" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -929,10 +944,11 @@ <Frame name="SVUI_PanelTemplate_Action" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="action" /> + <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelColor" type="string" value="default" /> <Attribute name="panelGradient" type="string" value="special" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\BUTTONS\WHITE8X8" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -1031,10 +1047,11 @@ <Frame name="SVUI_PanelTemplate_Halftone" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="halftone" /> + <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelColor" type="string" value="default" /> <Attribute name="panelGradient" type="string" value="special" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> <Backdrop bgFile="Interface\BUTTONS\WHITE8X8" edgeFile="Interface\BUTTONS\WHITE8X8" tile="false"> @@ -1133,10 +1150,11 @@ <Frame name="SVUI_PanelTemplate_Blackout" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="blackout" /> + <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelColor" type="string" value="transparent" /> <Attribute name="panelGradient" type="boolean" value="false" /> <Attribute name="panelTexUpdate" type="boolean" value="false" /> - <Attribute name="panelPadding" type="number" value="2" /> <Attribute name="panelOffset" type="number" value="2" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> </Attributes> @@ -1202,10 +1220,11 @@ <Frame name="SVUI_PanelTemplate_UnitLarge" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="unitlarge" /> + <Attribute name="panelPadding" type="number" value="0" /> <Attribute name="panelColor" type="string" value="special" /> <Attribute name="panelGradient" type="boolean" value="false" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="0" /> <Attribute name="panelOffset" type="number" value="3" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> <Attribute name="panelNoBackdrop" type="boolean" value="true" /> @@ -1220,10 +1239,11 @@ <Frame name="SVUI_PanelTemplate_UnitSmall" virtual="true"> <Attributes> + <Attribute name="panelID" type="string" value="unitlarge" /> + <Attribute name="panelPadding" type="number" value="0" /> <Attribute name="panelColor" type="string" value="special" /> <Attribute name="panelGradient" type="boolean" value="false" /> <Attribute name="panelTexUpdate" type="boolean" value="true" /> - <Attribute name="panelPadding" type="number" value="0" /> <Attribute name="panelOffset" type="number" value="3" /> <Attribute name="panelSkipUpdate" type="boolean" value="false" /> <Attribute name="panelNoBackdrop" type="boolean" value="true" /> diff --git a/Interface/AddOns/SVUI_ChatOMatic/Loader.lua b/Interface/AddOns/SVUI_ChatOMatic/Loader.lua index 41cf0e5..152f5cb 100644 --- a/Interface/AddOns/SVUI_ChatOMatic/Loader.lua +++ b/Interface/AddOns/SVUI_ChatOMatic/Loader.lua @@ -25,9 +25,9 @@ local assert = _G.assert; local AddonName, AddonObject = ... -assert(_G.LibSuperVillain, AddonName .. " requires LibSuperVillain") +assert(LibSuperVillain, AddonName .. " requires LibSuperVillain") -local PLUGIN = _G.LibSuperVillain:NewPlugin(AddonName, AddonObject, "ChatOMatic_Profile", nil, "ChatOMatic_Cache") +local PLUGIN = LibSuperVillain("Registry"):NewPlugin(AddonName, AddonObject, "ChatOMatic_Profile", nil, "ChatOMatic_Cache") local Schema = PLUGIN.Schema; local SV = _G["SVUI"]; diff --git a/Interface/AddOns/SVUI_ChatOMatic/components/chat_history.lua b/Interface/AddOns/SVUI_ChatOMatic/components/chat_history.lua index 76b9b2e..dd4f8c7 100644 --- a/Interface/AddOns/SVUI_ChatOMatic/components/chat_history.lua +++ b/Interface/AddOns/SVUI_ChatOMatic/components/chat_history.lua @@ -120,12 +120,14 @@ function PLUGIN:EnableChatHistory() for i = 1, #temp_cache do local lineID = tostring(temp_cache[i]) data_cache = self.cache.chat[lineID] - local GUID = data_cache[12] - if(data_cache and (type(data_cache) == "table") and data_cache[20] ~= nil and (GUID and type(GUID) == "string")) then - if(not GUID:find("Player-")) then - self.cache.chat[lineID] = nil - else - ChatFrame_MessageEventHandler(DEFAULT_CHAT_FRAME, data_cache[20], unpack(data_cache)) + if(data_cache) then + local GUID = data_cache[12] + if((type(data_cache) == "table") and data_cache[20] ~= nil and (GUID and type(GUID) == "string")) then + if(not GUID:find("Player-")) then + self.cache.chat[lineID] = nil + else + ChatFrame_MessageEventHandler(DEFAULT_CHAT_FRAME, data_cache[20], unpack(data_cache)) + end end end end diff --git a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua index ff6beb2..001c852 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/SVUI_ConfigOMatic.lua @@ -381,6 +381,13 @@ SV.Options.args.common = { get = function(j)return SV.db.general.reactionEmote end, set = function(j,value)SV.db.general.reactionEmote = value;SV:ToggleReactions()end }, + ego = { + order = 1, + type = 'toggle', + name = L["Awesome Game Menu"], + get = function(j)return SV.db.general.ego end, + set = function(j,value) SV.db.general.ego = value; SV:StaticPopup_Show("RL_CLIENT") end + }, } }, otherGroup = { diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/bar.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/bar.lua index cd8150c..9666dd6 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/components/bar.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/components/bar.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SV = _G["SVUI"]; -local SVLib = _G.LibSuperVillain; +local SVLib = LibSuperVillain("Registry"); local L = SV.L; local MOD = SV.SVBar; --[[ diff --git a/Interface/AddOns/SVUI_ConfigOMatic/components/profiles.lua b/Interface/AddOns/SVUI_ConfigOMatic/components/profiles.lua index dbf99be..a1ceeaa 100644 --- a/Interface/AddOns/SVUI_ConfigOMatic/components/profiles.lua +++ b/Interface/AddOns/SVUI_ConfigOMatic/components/profiles.lua @@ -30,7 +30,7 @@ GET ADDON DATA ########################################################## ]]-- local SV = _G["SVUI"]; -local SVLib = _G.LibSuperVillain; +local SVLib = LibSuperVillain("Registry"); local L = SV.L; local playerRealm = GetRealmName() diff --git a/Interface/AddOns/SVUI_CraftOMatic/Loader.lua b/Interface/AddOns/SVUI_CraftOMatic/Loader.lua index c826b73..86d5ef7 100644 --- a/Interface/AddOns/SVUI_CraftOMatic/Loader.lua +++ b/Interface/AddOns/SVUI_CraftOMatic/Loader.lua @@ -25,9 +25,9 @@ local assert = _G.assert; local AddonName, AddonObject = ... -assert(_G.LibSuperVillain, AddonName .. " requires LibSuperVillain") +assert(LibSuperVillain, AddonName .. " requires LibSuperVillain") -local PLUGIN = _G.LibSuperVillain:NewPlugin(AddonName, AddonObject, "CraftOMatic_Profile", nil, "CraftOMatic_Cache") +local PLUGIN = LibSuperVillain("Registry"):NewPlugin(AddonName, AddonObject, "CraftOMatic_Profile", nil, "CraftOMatic_Cache") local Schema = PLUGIN.Schema; local SV = _G["SVUI"]; diff --git a/Interface/AddOns/SVUI_FightOMatic/Loader.lua b/Interface/AddOns/SVUI_FightOMatic/Loader.lua index 408d9c5..0953aed 100644 --- a/Interface/AddOns/SVUI_FightOMatic/Loader.lua +++ b/Interface/AddOns/SVUI_FightOMatic/Loader.lua @@ -25,9 +25,9 @@ local assert = _G.assert; local AddonName, AddonObject = ... -assert(_G.LibSuperVillain, AddonName .. " requires LibSuperVillain") +assert(LibSuperVillain, AddonName .. " requires LibSuperVillain") -local PLUGIN = _G.LibSuperVillain:NewPlugin(AddonName, AddonObject, "FightOMatic_Profile", nil, "FightOMatic_Cache") +local PLUGIN = LibSuperVillain("Registry"):NewPlugin(AddonName, AddonObject, "FightOMatic_Profile", nil, "FightOMatic_Cache") local Schema = PLUGIN.Schema; local SV = _G["SVUI"]; diff --git a/Interface/AddOns/SVUI_LogOMatic/Loader.lua b/Interface/AddOns/SVUI_LogOMatic/Loader.lua index 08cb432..b00375d 100644 --- a/Interface/AddOns/SVUI_LogOMatic/Loader.lua +++ b/Interface/AddOns/SVUI_LogOMatic/Loader.lua @@ -25,9 +25,9 @@ local assert = _G.assert; local AddonName, AddonObject = ... -assert(_G.LibSuperVillain, AddonName .. " requires LibSuperVillain") +assert(LibSuperVillain, AddonName .. " requires LibSuperVillain") -local PLUGIN = _G.LibSuperVillain:NewPlugin(AddonName, AddonObject, "LogOMatic_Profile") +local PLUGIN = LibSuperVillain("Registry"):NewPlugin(AddonName, AddonObject, "LogOMatic_Profile") --[[ ########################################################## CONFIG DATA diff --git a/Interface/AddOns/SVUI_StyleOMatic/Loader.lua b/Interface/AddOns/SVUI_StyleOMatic/Loader.lua index 1fdb879..ee266a1 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/Loader.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/Loader.lua @@ -25,9 +25,9 @@ local assert = _G.assert; local AddonName, AddonObject = ... -assert(_G.LibSuperVillain, AddonName .. " requires LibSuperVillain") +assert(LibSuperVillain, AddonName .. " requires LibSuperVillain") -local PLUGIN = _G.LibSuperVillain:NewPlugin(AddonName, AddonObject, "StyleOMatic_Profile", "StyleOMatic_Global") +local PLUGIN = LibSuperVillain("Registry"):NewPlugin(AddonName, AddonObject, "StyleOMatic_Profile", "StyleOMatic_Global") local Schema = PLUGIN.Schema; local SV = _G["SVUI"]; diff --git a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua index 9782850..4363182 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua @@ -107,6 +107,7 @@ function PLUGIN:Style(style, fn, ...) self.StyledAddons[style] = true local verb = charming[math.random(1,#charming)] self:AddonMessage(styleMessage:format(style, verb)) + self.AddOnQueue[style] = nil end self.Debugging = false end @@ -191,14 +192,6 @@ function PLUGIN:SafeEventRemoval(addon, event) if not defined then self:UnregisterEvent(event) end -end - -function PLUGIN:RefreshAddonStyles() - for addon,fn in pairs(self.AddOnQueue) do - if(self:IsAddonReady(addon)) then - self:Style(addon, fn) - end - end end function PLUGIN:PLAYER_ENTERING_WORLD(event, ...) diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Ace3.lua b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Ace3.lua index b066c8f..a4dc0f4 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Ace3.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Ace3.lua @@ -27,7 +27,7 @@ local Schema = PLUGIN.Schema; HELPERS ########################################################## ]]-- -local externaltest = false; +local RegisterAsWidget, RegisterAsContainer; local ProxyLSMType = { ["LSM30_Font"] = true, @@ -79,18 +79,16 @@ local NOOP = SV.fubar local WidgetButton_OnClick = function(self) local obj = self.obj; - if(obj and obj.pullout and obj.pullout.frame and (not obj.pullout.frame.Panel)) then - obj.pullout.frame:SetFixedPanelTemplate("Default") + if(obj and obj.pullout and obj.pullout.frame) then + PLUGIN:ApplyFrameStyle(obj.pullout.frame, "Default", true) end end local WidgetDropButton_OnClick = function(self) local obj = self.obj; local widgetFrame = obj.dropdown - if(widgetFrame and not widgetFrame.Panel) then - widgetFrame:SetBasicPanel() - widgetFrame.Panel:SetPoint("TOPLEFT", widgetFrame, "TOPLEFT", 20, -2) - widgetFrame.Panel:SetPoint("BOTTOMRIGHT", widgetFrame, "BOTTOMRIGHT", -20, 2) + if(widgetFrame) then + PLUGIN:ApplyAdjustedFrameStyle(widgetFrame, "Transparent", 20, -2, -20, 2) end end --[[ @@ -99,23 +97,21 @@ AceGUI PLUGIN ########################################################## ]]-- local function StyleAceGUI(event, addon) - assert((LibStub("AceGUI-3.0")), "Addon Not Loaded") + local AceGUI = LibStub("AceGUI-3.0", true) - local AceGUI = LibStub("AceGUI-3.0") + assert(AceGUI and (AceGUI.RegisterAsContainer ~= RegisterAsContainer or AceGUI.RegisterAsWidget ~= RegisterAsWidget), "Addon Not Loaded") local regWidget = AceGUI.RegisterAsWidget; local regContainer = AceGUI.RegisterAsContainer; - AceGUI.RegisterAsWidget = function(self, widget) + RegisterAsWidget = function(self, widget) local widgetType = widget.type; -- print("RegisterAsWidget: " .. widgetType); if(widgetType == "MultiLineEditBox") then local widgetFrame = widget.frame; - widgetFrame:SetFixedPanelTemplate("Default") - if not widget.scrollBG.Panel then - widget.scrollBG:SetBasicPanel() - end + PLUGIN:ApplyFixedFrameStyle(widgetFrame, "Default", true) + PLUGIN:ApplyFrameStyle(widget.scrollBG, "Transparent", true) Widget_ButtonStyle(widget.button) PLUGIN:ApplyScrollFrameStyle(widget.scrollBar) widget.scrollBar:SetPoint("RIGHT", widgetFrame, "RIGHT", -4) @@ -129,7 +125,7 @@ local function StyleAceGUI(event, addon) if not widget.styledCheckBG then widget.styledCheckBG = CreateFrame("Frame", nil, widget.frame) widget.styledCheckBG:FillInner(widget.check) - widget.styledCheckBG:SetFixedPanelTemplate("Inset") + PLUGIN:ApplyFixedFrameStyle(widget.styledCheckBG, "Inset") end widget.check:SetParent(widget.styledCheckBG) @@ -143,11 +139,7 @@ local function StyleAceGUI(event, addon) widgetButton:SetFrameLevel(widgetButton:GetFrameLevel() + 1) Widget_PaginationStyle(widgetButton, true) - if(not widgetDropdown.Panel) then - widgetDropdown:SetBasicPanel() - widgetDropdown.Panel:Point("TOPLEFT", widgetDropdown, "TOPLEFT", 20, -2) - widgetDropdown.Panel:Point("BOTTOMRIGHT", widgetDropdown, "BOTTOMRIGHT", -20, 2) - end + PLUGIN:ApplyAdjustedFrameStyle(widgetDropdown, "Transparent", 20, -2, -20, 2) widgetButton:SetParent(widgetDropdown.Panel) widget.text:SetParent(widgetDropdown.Panel) @@ -155,8 +147,7 @@ local function StyleAceGUI(event, addon) elseif(widgetType == "EditBox") then local widgetEditbox = widget.editbox; - widgetEditbox:Height(15) - widgetEditbox:SetEditboxTemplate(2, -2, false) + PLUGIN:ApplyEditBoxStyle(widgetEditbox, nil, 15, 2, -2) elseif(widgetType == "Button") then local widgetFrame = widget.frame; @@ -167,8 +158,7 @@ local function StyleAceGUI(event, addon) local widgetSlider = widget.slider; local widgetEditbox = widget.editbox; - widgetSlider:RemoveTextures() - widgetSlider:SetFixedPanelTemplate("Bar") + PLUGIN:ApplyFixedFrameStyle(widgetSlider, "Bar") widgetSlider:Height(20) widgetSlider:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob") @@ -191,22 +181,22 @@ local function StyleAceGUI(event, addon) dropButton:ClearAllPoints() dropButton:Point("RIGHT", widgetFrame, "RIGHT", -10, -6) if(not widgetFrame.Panel) then - widgetFrame:SetBasicPanel() if(widgetType == "LSM30_Font") then - widgetFrame.Panel:Point("TOPLEFT", 20, -17) + PLUGIN:ApplyAdjustedFrameStyle(widgetFrame, "Transparent", 20, -17, 2, -2) elseif(widgetType == "LSM30_Sound") then - widgetFrame.Panel:Point("TOPLEFT", 20, -17) + PLUGIN:ApplyAdjustedFrameStyle(widgetFrame, "Transparent", 20, -17, 2, -2) widget.soundbutton:SetParent(widgetFrame.Panel) widget.soundbutton:ClearAllPoints() widget.soundbutton:Point("LEFT", widgetFrame.Panel, "LEFT", 2, 0) elseif(widgetType == "LSM30_Statusbar") then - widgetFrame.Panel:Point("TOPLEFT", 20, -17) + PLUGIN:ApplyAdjustedFrameStyle(widgetFrame, "Transparent", 20, -17, 2, -2) widget.bar:SetParent(widgetFrame.Panel) widget.bar:FillInner() elseif(widgetType == "LSM30_Border" or widgetType == "LSM30_Background") then - widgetFrame.Panel:Point("TOPLEFT", 42, -16) + PLUGIN:ApplyAdjustedFrameStyle(widgetFrame, "Transparent", 42, -16, 2, -2) end widgetFrame.Panel:Point("BOTTOMRIGHT", dropButton, "BOTTOMRIGHT", 2, -2) + PLUGIN:ApplyAdjustedFrameStyle(widgetFrame, "Transparent", 20, -2, 2, -2) end dropButton:SetParent(widgetFrame.Panel) widgetFrame.text:SetParent(widgetFrame.Panel) @@ -215,14 +205,15 @@ local function StyleAceGUI(event, addon) return regWidget(self, widget) end - AceGUI.RegisterAsContainer = function(self, widget) + AceGUI.RegisterAsWidget = RegisterAsWidget + + RegisterAsContainer = function(self, widget) local widgetType = widget.type; -- print("RegisterAsContainer: " .. widgetType); local widgetParent = widget.content:GetParent() if widgetType == "ScrollFrame" then PLUGIN:ApplyScrollFrameStyle(widget.scrollBar) elseif widgetType == "Frame" then - widgetParent:RemoveTextures() for i = 1, widgetParent:GetNumChildren()do local childFrame = select(i, widgetParent:GetChildren()) if childFrame:GetObjectType() == "Button" and childFrame:GetText() then @@ -231,11 +222,11 @@ local function StyleAceGUI(event, addon) childFrame:RemoveTextures() end end - widgetParent:SetPanelTemplate("Halftone") + PLUGIN:ApplyWindowStyle(widgetParent) elseif(ProxyType[widgetType]) then if widget.treeframe then - widget.treeframe:SetFixedPanelTemplate("Transparent") + PLUGIN:ApplyFrameStyle(widget.treeframe, "Transparent", true) widgetParent:SetPoint("TOPLEFT", widget.treeframe, "TOPRIGHT", 1, 0) local oldFunc = widget.CreateButton; widget.CreateButton = function(self) @@ -251,7 +242,7 @@ local function StyleAceGUI(event, addon) return newButton end else - widgetParent:SetFixedPanelTemplate("Default") + PLUGIN:ApplyFrameStyle(widgetParent, "Default", true) end if(widgetType == "TabGroup") then @@ -269,6 +260,8 @@ local function StyleAceGUI(event, addon) end return regContainer(self, widget) end + + AceGUI.RegisterAsContainer = RegisterAsContainer end --[[ ########################################################## diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Altoholic.lua b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Altoholic.lua index b483641..1855ee0 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Altoholic.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Altoholic.lua @@ -169,7 +169,7 @@ local function StyleAltoholic(event, addon) end if IsAddOnLoaded("Altoholic_Achievements") or addon == "Altoholic_Achievements" then - PLUGIN:ApplyUnderlayStyle(AltoholicFrameAchievements) + PLUGIN:ApplyFixedFrameStyle(AltoholicFrameAchievements) AltoholicFrameAchievementsScrollFrame:RemoveTextures(true) AltoholicAchievementsMenuScrollFrame:RemoveTextures(true) PLUGIN:ApplyScrollBarStyle(AltoholicFrameAchievementsScrollFrameScrollBar) @@ -183,7 +183,7 @@ local function StyleAltoholic(event, addon) for i = 1, 8 do for j = 1, 10 do - PLUGIN:ApplyUnderlayStyle(_G["AltoholicFrameAchievementsEntry"..i.."Item"..j]) + PLUGIN:ApplyFixedFrameStyle(_G["AltoholicFrameAchievementsEntry"..i.."Item"..j]) local Backdrop = _G["AltoholicFrameAchievementsEntry"..i.."Item"..j].backdrop or _G["AltoholicFrameAchievementsEntry"..i.."Item"..j].Backdrop PLUGIN:ApplyTextureStyle(_G["AltoholicFrameAchievementsEntry"..i.."Item"..j..'_Background']) _G["AltoholicFrameAchievementsEntry"..i.."Item"..j..'_Background']:SetInside(Backdrop) @@ -206,14 +206,14 @@ local function StyleAltoholic(event, addon) if IsAddOnLoaded("Altoholic_Grids") or addon == "Altoholic_Grids" then AltoholicFrameGridsScrollFrame:RemoveTextures(true) - PLUGIN:ApplyUnderlayStyle(AltoholicFrameGrids) + PLUGIN:ApplyFixedFrameStyle(AltoholicFrameGrids) PLUGIN:ApplyScrollBarStyle(AltoholicFrameGridsScrollFrameScrollBar) PLUGIN:ApplyDropdownStyle(AltoholicTabGrids_SelectRealm) PLUGIN:ApplyDropdownStyle(AltoholicTabGrids_SelectView) for i = 1, 8 do for j = 1, 10 do - PLUGIN:ApplyUnderlayStyle(_G["AltoholicFrameGridsEntry"..i.."Item"..j], nil, nil, nil, true) + PLUGIN:ApplyFixedFrameStyle(_G["AltoholicFrameGridsEntry"..i.."Item"..j], nil, nil, nil, true) _G["AltoholicFrameGridsEntry"..i.."Item"..j]:HookScript('OnShow', ColorAltoBorder) end end @@ -256,7 +256,7 @@ local function StyleAltoholic(event, addon) end if IsAddOnLoaded("Altoholic_Search") or addon == "Altoholic_Search" then - PLUGIN:ApplyUnderlayStyle(AltoholicFrameSearch, true) + PLUGIN:ApplyFixedFrameStyle(AltoholicFrameSearch, true) AltoholicFrameSearchScrollFrame:RemoveTextures(true) AltoholicSearchMenuScrollFrame:RemoveTextures(true) PLUGIN:ApplyScrollBarStyle(AltoholicFrameSearchScrollFrameScrollBar) diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/addons/AtlasLoot.lua b/Interface/AddOns/SVUI_StyleOMatic/components/addons/AtlasLoot.lua index 1f635f5..28ca016 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/addons/AtlasLoot.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/addons/AtlasLoot.lua @@ -142,7 +142,7 @@ local function StyleAtlasLoot(event, addon) -- Manipulate the main frames PLUGIN:ApplyFrameStyle(_G["AtlasLootDefaultFrame"], "Action"); - PLUGIN:ApplyUnderlayStyle(_G["AtlasLootItemsFrame"], "Inset"); + PLUGIN:ApplyFixedFrameStyle(_G["AtlasLootItemsFrame"], "Inset"); PLUGIN:ApplyFrameStyle(_G["AtlasLootPanel"], "Default"); hooksecurefunc(_G["AtlasLootPanel"], "SetPoint", _hook_ALPanel); diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/auctionhouse.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/auctionhouse.lua index 79944d8..9f0a003 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/auctionhouse.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/auctionhouse.lua @@ -115,7 +115,7 @@ local function AuctionStyle() SideDressUpFrame.SetPoint = SV.fubar SideDressUpModel:RemoveTextures(true) SideDressUpModel:SetAllPoints(SideDressUpFrame) - SideDressUpModel:SetFixedPanelTemplate("ModelComic") + SideDressUpModel:SetFixedPanelTemplate("Model") SideDressUpModelResetButton:SetButtonTemplate() SideDressUpModelResetButton:SetPoint("BOTTOM", SideDressUpModel, "BOTTOM", 0, 20) PLUGIN:ApplyCloseButtonStyle(SideDressUpModelCloseButton) diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/character.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/character.lua index fe96f80..e25e9ee 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/character.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/character.lua @@ -29,6 +29,8 @@ local Schema = PLUGIN.Schema; HELPERS ########################################################## ]]-- +local SlotListener = CreateFrame("Frame") + local CharacterSlotNames = { "HeadSlot", "NeckSlot", @@ -97,19 +99,37 @@ local function SetItemFrame(frame, point) end local function StyleCharacterSlots() - for _,slotName in pairs(CharacterSlotNames)do - local charSlot = _G["Character"..slotName] - local slotID,_,_ = GetInventorySlotInfo(slotName) - local itemID = GetInventoryItemID("player",slotID) - if itemID then - local _,_,info = GetItemInfo(itemID) - if info and info > 1 then - charSlot:SetBackdropBorderColor(GetItemQualityColor(info)) - else - charSlot:SetBackdropBorderColor(0,0,0,1) - end - else - charSlot:SetBackdropBorderColor(0,0,0,1) + for _,slotName in pairs(CharacterSlotNames) do + local globalName = ("Character%s"):format(slotName) + local charSlot = _G[globalName] + if(charSlot) then + if(not charSlot.Panel) then + charSlot:RemoveTextures() + charSlot.ignoreTexture:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-LeaveItem-Transparent]]) + charSlot:SetSlotTemplate(true, 2, 0, 0) + + local iconTex = _G[globalName.."IconTexture"] + if(iconTex) then + iconTex:SetTexCoord(0.1, 0.9, 0.1, 0.9) + iconTex:SetParent(charSlot.Panel) + iconTex:SetAllPoints(charSlot.Panel) + end + end + + local slotID = GetInventorySlotInfo(slotName) + if(slotID) then + local itemID = GetInventoryItemID("player", slotID) + if(itemID) then + local info = select(3, GetItemInfo(itemID)) + if info and info > 1 then + charSlot:SetBackdropBorderColor(GetItemQualityColor(info)) + else + charSlot:SetBackdropBorderColor(0,0,0,1) + end + else + charSlot:SetBackdropBorderColor(0,0,0,1) + end + end end end end @@ -180,7 +200,62 @@ local function Reputation_OnShow() _G["ReputationBar"..i.."ReputationBarRightTexture"]:SetTexture(0,0,0,0) end end -end +end + +local function PaperDollTitlesPane_OnShow() + for _,gName in pairs(PaperDollTitlesPane.buttons) do + local btn = _G[gName] + if(btn) then + btn.BgTop:SetTexture(0,0,0,0) + btn.BgBottom:SetTexture(0,0,0,0) + btn.BgMiddle:SetTexture(0,0,0,0) + btn.Check:SetTexture(0,0,0,0) + btn.text:FillInner(btn) + btn.text:SetFont(SV.Media.font.roboto,10,"NONE","LEFT") + end + end +end + +local function PaperDollEquipmentManagerPane_OnShow() + for _,gName in pairs(PaperDollEquipmentManagerPane.buttons) do + local btn = _G[gName] + if(btn) then + btn.BgTop:SetTexture(0,0,0,0) + btn.BgBottom:SetTexture(0,0,0,0) + btn.BgMiddle:SetTexture(0,0,0,0) + btn.icon:Size(36, 36) + btn.Check:SetTexture(0,0,0,0) + btn.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + btn.icon:SetPoint("LEFT", btn, "LEFT", 4, 0) + if not btn.icon.bordertop then + SetItemFrame(btn, btn.icon) + end + end + end + + GearManagerDialogPopup:RemoveTextures() + GearManagerDialogPopup:SetPanelTemplate("Inset", true) + GearManagerDialogPopup:Point("LEFT", PaperDollFrame, "RIGHT", 4, 0) + GearManagerDialogPopupScrollFrame:RemoveTextures() + GearManagerDialogPopupEditBox:RemoveTextures() + GearManagerDialogPopupEditBox:SetBasicPanel() + GearManagerDialogPopupOkay:SetButtonTemplate() + GearManagerDialogPopupCancel:SetButtonTemplate() + + for i = 1, NUM_GEARSET_ICONS_SHOWN do + local btn = _G["GearManagerDialogPopupButton"..i] + if(btn and (not btn.Panel)) then + btn:RemoveTextures() + btn:SetFrameLevel(btn:GetFrameLevel() + 2) + btn:SetButtonTemplate() + if(btn.icon) then + btn.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + btn.icon:SetTexture(0,0,0,0) + btn.icon:FillInner() + end + end + end + end --[[ ########################################################## CHARACTERFRAME PLUGINR @@ -199,29 +274,12 @@ local function CharacterFrameStyle() PLUGIN:ApplyScrollFrameStyle(TokenFrameContainerScrollBar) PLUGIN:ApplyScrollFrameStyle(GearManagerDialogPopupScrollFrameScrollBar) - for _,slotName in pairs(CharacterSlotNames) do - local charSlot = _G["Character"..slotName] - local iconTex = _G["Character"..slotName.."IconTexture"] - local cd = _G["Character"..slotName.."Cooldown"] - charSlot:RemoveTextures() - charSlot:SetSlotTemplate(true) - charSlot.Panel:SetFrameLevel(charSlot.Panel:GetFrameLevel() + 1) - charSlot.ignoreTexture:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-LeaveItem-Transparent]]) - iconTex:SetTexCoord(0.1, 0.9, 0.1, 0.9) - iconTex:FillInner(charSlot, 0, 0) - if cd then - SV.Timers:AddCooldown(cd) - end - end - - local eqSlotListener = CreateFrame("Frame") - eqSlotListener:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") - eqSlotListener:SetScript("OnEvent", StyleCharacterSlots) + StyleCharacterSlots() + SlotListener:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") + SlotListener:SetScript("OnEvent", StyleCharacterSlots) CharacterFrame:HookScript("OnShow", StyleCharacterSlots) - StyleCharacterSlots() - CharacterFrameExpandButton:Size(CharacterFrameExpandButton:GetWidth() - 7, CharacterFrameExpandButton:GetHeight() - 7) PLUGIN:ApplyPaginationStyle(CharacterFrameExpandButton) @@ -259,29 +317,25 @@ local function CharacterFrameStyle() CharacterFramePortrait:Die() PLUGIN:ApplyScrollFrameStyle(_G["PaperDollTitlesPaneScrollBar"], 5) PLUGIN:ApplyScrollFrameStyle(_G["PaperDollEquipmentManagerPaneScrollBar"], 5) - for _,btn in pairs(CharFrameList)do - _G[btn]:RemoveTextures(true) + + for _,gName in pairs(CharFrameList) do + local frame = _G[gName] + if(frame) then + frame:RemoveTextures(true) + end end + CharacterModelFrameBackgroundTopLeft:SetTexture(0,0,0,0) CharacterModelFrameBackgroundTopRight:SetTexture(0,0,0,0) CharacterModelFrameBackgroundBotLeft:SetTexture(0,0,0,0) CharacterModelFrameBackgroundBotRight:SetTexture(0,0,0,0) - CharacterModelFrame:SetFixedPanelTemplate("ModelComic") + CharacterModelFrame:SetFixedPanelTemplate("Model") CharacterFrameExpandButton:SetFrameLevel(CharacterModelFrame:GetFrameLevel() + 5) PaperDollTitlesPane:SetBasicPanel() - PaperDollTitlesPane:HookScript("OnShow", function(f) - for _,btn in pairs(PaperDollTitlesPane.buttons)do - btn.BgTop:SetTexture(0,0,0,0) - btn.BgBottom:SetTexture(0,0,0,0) - btn.BgMiddle:SetTexture(0,0,0,0) - btn.Check:SetTexture(0,0,0,0) - btn.text:FillInner(btn) - btn.text:SetFont(SV.Media.font.roboto,10,"NONE","LEFT") - end - end) + PaperDollTitlesPane:HookScript("OnShow", PaperDollTitlesPane_OnShow) PaperDollEquipmentManagerPane:SetBasicPanel() PaperDollEquipmentManagerPaneEquipSet:SetButtonTemplate() @@ -291,47 +345,8 @@ local function CharacterFrameStyle() PaperDollEquipmentManagerPaneEquipSet:Point("TOPLEFT", PaperDollEquipmentManagerPane, "TOPLEFT", 8, 0) PaperDollEquipmentManagerPaneSaveSet:Point("LEFT", PaperDollEquipmentManagerPaneEquipSet, "RIGHT", 4, 0) PaperDollEquipmentManagerPaneEquipSet.ButtonBackground:SetTexture(0,0,0,0) - PaperDollEquipmentManagerPane:HookScript("OnShow", function(f) - for _,btn in pairs(PaperDollEquipmentManagerPane.buttons)do - btn.BgTop:SetTexture(0,0,0,0) - btn.BgBottom:SetTexture(0,0,0,0) - btn.BgMiddle:SetTexture(0,0,0,0) - btn.icon:Size(36, 36) - btn.Check:SetTexture(0,0,0,0) - btn.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - btn.icon:SetPoint("LEFT", btn, "LEFT", 4, 0) - if not btn.icon.bordertop then - SetItemFrame(btn, btn.icon) - end - end - GearManagerDialogPopup:RemoveTextures() - GearManagerDialogPopup:SetPanelTemplate("Inset", true) - GearManagerDialogPopup:Point("LEFT", PaperDollFrame, "RIGHT", 4, 0) - GearManagerDialogPopupScrollFrame:RemoveTextures() - GearManagerDialogPopupEditBox:RemoveTextures() - - GearManagerDialogPopupEditBox:SetBasicPanel() - GearManagerDialogPopupOkay:SetButtonTemplate() - GearManagerDialogPopupCancel:SetButtonTemplate() - - for i = 1, NUM_GEARSET_ICONS_SHOWN do - local e = _G["GearManagerDialogPopupButton"..i] - local texture = e.icon; - if e then - e:RemoveTextures() - e:SetButtonTemplate() - texture:SetTexCoord(0.1, 0.9, 0.1, 0.9) - _G["GearManagerDialogPopupButton"..i.."Icon"]:SetTexture(0,0,0,0) - texture:FillInner() - e:SetFrameLevel(e:GetFrameLevel() + 2) - if not e.Panel then - e:SetPanelTemplate("Default") - e.Panel:SetAllPoints() - end - end - end - end) + PaperDollEquipmentManagerPane:HookScript("OnShow", PaperDollEquipmentManagerPane_OnShow) for i = 1, 4 do PLUGIN:ApplyTabStyle(_G["CharacterFrameTab"..i]) @@ -374,6 +389,7 @@ local function CharacterFrameStyle() TokenFramePopup:SetPanelTemplate("Inset", true) TokenFramePopup:Point("TOPLEFT", TokenFrame, "TOPRIGHT", 4, -28) end) + PetModelFrame:SetPanelTemplate("Comic",false,1,-7,-7) PetPaperDollPetInfo:GetRegions():SetTexCoord(.12, .63, .15, .55) PetPaperDollPetInfo:SetFrameLevel(PetPaperDollPetInfo:GetFrameLevel() + 10) diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/dressup.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/dressup.lua index b9b3c6e..c7e4c6a 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/dressup.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/dressup.lua @@ -38,7 +38,7 @@ local function DressUpStyle() DressUpModel:SetPoint("TOPLEFT", DressUpFrame, "TOPLEFT", 12, -76) DressUpModel:SetPoint("BOTTOMRIGHT", DressUpFrame, "BOTTOMRIGHT", -12, 36) - DressUpModel:SetFixedPanelTemplate("ModelComic") + DressUpModel:SetFixedPanelTemplate("Model") DressUpFrameCancelButton:Point("BOTTOMRIGHT", DressUpFrame, "BOTTOMRIGHT", -12, 12) DressUpFrameCancelButton:SetButtonTemplate() diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/guild.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/guild.lua index b12e734..85522e6 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/guild.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/guild.lua @@ -415,7 +415,7 @@ local function GuildFrameStyle() end end end - + GuildNewsBossModel:SetBasicPanel() GuildNewsBossModelTextFrame:SetPanelTemplate("Default") GuildNewsBossModelTextFrame.Panel:Point("TOPLEFT", GuildNewsBossModel.Panel, "BOTTOMLEFT", 0, -1) @@ -430,20 +430,6 @@ local function GuildFrameStyle() GuildFactionBar:SetPanelTemplate("Inset") GuildFactionBar.Panel:Point("TOPLEFT", GuildFactionBar.progress, "TOPLEFT", -1, 1) GuildFactionBar.Panel:Point("BOTTOMRIGHT", GuildFactionBar, "BOTTOMRIGHT", 1, 1) - - GuildLatestPerkButton:RemoveTextures() - GuildLatestPerkButtonIconTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9) - GuildLatestPerkButtonIconTexture:ClearAllPoints() - GuildLatestPerkButtonIconTexture:Point("TOPLEFT", 2, -2) - GuildLatestPerkButton:SetPanelTemplate("Inset") - GuildLatestPerkButton.Panel:WrapOuter(GuildLatestPerkButtonIconTexture) - - GuildNextPerkButton:RemoveTextures() - GuildNextPerkButtonIconTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9) - GuildNextPerkButtonIconTexture:ClearAllPoints() - GuildNextPerkButtonIconTexture:Point("TOPLEFT", 2, -2) - GuildNextPerkButton:SetPanelTemplate("Inset") - GuildNextPerkButton.Panel:WrapOuter(GuildNextPerkButtonIconTexture) GuildRosterContainer:SetBasicPanel(-2, 2, -1, -2) PLUGIN:ApplyScrollFrameStyle(GuildRosterContainerScrollBar, 4, -4) @@ -559,8 +545,8 @@ local function GuildFrameStyle() GuildRewardsFrame:SetBasicPanel(2, 0, -22, 18) PLUGIN:ApplyScrollFrameStyle(GuildRewardsContainerScrollBar, 4, -4) - GuildNewPerksFrame:SetBasicPanel(-1, 0, 1, 0) - GuildPerksContainer:SetBasicPanel(-3, 0, 26, -3) + --GuildNewPerksFrame:SetBasicPanel(-1, 0, 1, 0) + --GuildPerksContainer:SetBasicPanel(-3, 0, 26, -3) PLUGIN:ApplyScrollFrameStyle(GuildPerksContainerScrollBar, 4, 2) @@ -568,25 +554,26 @@ local function GuildFrameStyle() local button = _G["GuildPerksContainerButton"..i] if button then button:RemoveTextures() - if button.icon then - PLUGIN:ApplyItemButtonStyle(button, nil, true) - button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) - button.icon:ClearAllPoints() - button.icon:Point("TOPLEFT", button, "TOPLEFT", 2, -2) - button.icon:SetParent(button.Panel) + PLUGIN:ApplyItemButtonStyle(button, nil, true) + local icon = button.icon or button.Icon + if icon then + icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + icon:ClearAllPoints() + icon:Point("TOPLEFT", button, "TOPLEFT", 2, -2) + icon:SetParent(button.Panel) end end end - + for i = 1, 8 do local button = _G["GuildRewardsContainerButton"..i] if button then button:RemoveTextures() + button:SetFixedPanelTemplate("Button") if button.icon then button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) button.icon:ClearAllPoints() button.icon:Point("TOPLEFT", button, "TOPLEFT", 2, -2) - button:SetFixedPanelTemplate("Button") button.Panel:WrapOuter(button.icon) button.icon:SetParent(button.Panel) end @@ -664,11 +651,11 @@ local function GuildRegistrarStyle() PLUGIN:ApplyCloseButtonStyle(GuildRegistrarFrameCloseButton) GuildRegistrarFrameEditBox:SetEditboxTemplate() - for b = 1, GuildRegistrarFrameEditBox:GetNumRegions()do - local a2 = select(b, GuildRegistrarFrameEditBox:GetRegions()) - if a2 and a2:GetObjectType() == "Texture"then - if a2:GetTexture() == "Interface\\ChatFrame\\UI-ChatInputBorder-Left" or a2:GetTexture() == "Interface\\ChatFrame\\UI-ChatInputBorder-Right" then - a2:Die() + for i = 1, GuildRegistrarFrameEditBox:GetNumRegions() do + local region = select(i, GuildRegistrarFrameEditBox:GetRegions()) + if region and region:GetObjectType() == "Texture"then + if region:GetTexture() == "Interface\\ChatFrame\\UI-ChatInputBorder-Left" or region:GetTexture() == "Interface\\ChatFrame\\UI-ChatInputBorder-Right" then + region:Die() end end end diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/petition.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/petition.lua index c22e847..e64bb53 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/petition.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/petition.lua @@ -30,24 +30,34 @@ PETITIONFRAME PLUGINR local function PetitionFrameStyle() if PLUGIN.db.blizzard.enable ~= true or PLUGIN.db.blizzard.petition ~= true then return - end - PetitionFrame:RemoveTextures(true) - PetitionFrame:SetFixedPanelTemplate("Transparent", true) + end + + PLUGIN:ApplyWindowStyle(PetitionFrame, nil, true) PetitionFrameInset:Die() + PetitionFrameSignButton:SetButtonTemplate() PetitionFrameRequestButton:SetButtonTemplate() PetitionFrameRenameButton:SetButtonTemplate() PetitionFrameCancelButton:SetButtonTemplate() + PLUGIN:ApplyCloseButtonStyle(PetitionFrameCloseButton) + PetitionFrameCharterTitle:SetTextColor(1, 1, 0) PetitionFrameCharterName:SetTextColor(1, 1, 1) PetitionFrameMasterTitle:SetTextColor(1, 1, 0) PetitionFrameMasterName:SetTextColor(1, 1, 1) PetitionFrameMemberTitle:SetTextColor(1, 1, 0) - for g = 1, 9 do - _G["PetitionFrameMemberName"..g]:SetTextColor(1, 1, 1) + + for i=1, 9 do + local frameName = ("PetitionFrameMemberName%d"):format(i) + local frame = _G[frameName]; + if(frame) then + frame:SetTextColor(1, 1, 1) + end end + PetitionFrameInstructions:SetTextColor(1, 1, 1) + PetitionFrameRenameButton:Point("LEFT", PetitionFrameRequestButton, "RIGHT", 3, 0) PetitionFrameRenameButton:Point("RIGHT", PetitionFrameCancelButton, "LEFT", -3, 0) end diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/petjournal.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/petjournal.lua index af9fd67..2389a63 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/petjournal.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/petjournal.lua @@ -117,7 +117,7 @@ local function PetJournalStyle() MountJournalSearchBox:SetEditboxTemplate() PLUGIN:ApplyScrollFrameStyle(MountJournalListScrollFrameScrollBar) - MountJournal.MountDisplay:SetFixedPanelTemplate("ModelComic") + MountJournal.MountDisplay:SetFixedPanelTemplate("Model") local buttons = MountJournal.ListScrollFrame.buttons for i = 1, #buttons do @@ -279,7 +279,7 @@ local function PetJournalStyle() ToyBoxFilterButton:RemoveTextures() ToyBoxFilterButton:SetButtonTemplate() ToyBoxIconsFrame:RemoveTextures() - ToyBoxIconsFrame:SetFixedPanelTemplate('ModelComic') + ToyBoxIconsFrame:SetFixedPanelTemplate('Model') MountJournalFilterButton:RemoveTextures() MountJournalFilterButton:SetButtonTemplate() diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/quest.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/quest.lua index 4ad2612..56a49d3 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/quest.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/quest.lua @@ -26,6 +26,8 @@ local SV = _G.SVUI; local L = SV.L; local PLUGIN = select(2, ...); local Schema = PLUGIN.Schema; + +local MAX_NUM_ITEMS = _G.MAX_NUM_ITEMS --[[ ########################################################## HELPERS @@ -64,38 +66,37 @@ local QuestRewardScrollFrame_OnShow = function(self) end end -local Hook_QuestInfo_Display = function(self, ...) - local MAX_NUM_ITEMS = _G.MAX_NUM_ITEMS +local function StyleQuestRewards() if(not MAX_NUM_ITEMS) then return end; + for i = 1, MAX_NUM_ITEMS do local name = ("QuestInfoRewardsFrameQuestInfoItem%d"):format(i) local item = _G[name] - if(item and item:IsShown()) then - local initialAnchor, anchorParent, relativeAnchor, xPosition, yPosition = item:GetPoint() - if(initialAnchor) then - if(i == 1) then - item:SetPoint(initialAnchor, anchorParent, relativeAnchor, 0, yPosition) - elseif(relativeAnchor == "BOTTOMLEFT") then - item:SetPoint(initialAnchor, anchorParent, relativeAnchor, 0, -4) - else - item:SetPoint(initialAnchor, anchorParent, relativeAnchor, 4, 0) + if(item) then + if(item:IsShown()) then + local initialAnchor, anchorParent, relativeAnchor, xPosition, yPosition = item:GetPoint() + if(initialAnchor) then + if(i == 1) then + item:SetPoint(initialAnchor, anchorParent, relativeAnchor, 0, yPosition) + elseif(relativeAnchor == "BOTTOMLEFT") then + item:SetPoint(initialAnchor, anchorParent, relativeAnchor, 0, -4) + else + item:SetPoint(initialAnchor, anchorParent, relativeAnchor, 4, 0) + end end end - if(not item.isStyled) then - local cLvl = item:GetFrameLevel() + 1 - item:RemoveTextures() + if(not item.Panel) then item:Width(item:GetWidth() - 4) - item:SetFrameLevel(cLvl) + item:SetFrameLevel(item:GetFrameLevel() + 1) PLUGIN:ApplyItemButtonStyle(item, false, true) - item.isStyled = true - end - local tex = _G["QuestInfoRewardsFrameQuestInfoItem"..i.."IconTexture"] - if(tex) then - tex:SetTexCoord(0.1, 0.9, 0.1, 0.9) - tex:SetDrawLayer("OVERLAY",1) - tex:SetPoint("TOPLEFT", 2, -2) - tex:Size(tex:GetWidth() - 2, tex:GetHeight() - 2) - tex:SetParent(item.Panel) + local tex = _G[name.."IconTexture"] + if(tex) then + tex:SetTexCoord(0.1, 0.9, 0.1, 0.9) + tex:SetDrawLayer("OVERLAY",1) + tex:SetPoint("TOPLEFT", 2, -2) + tex:Size(tex:GetWidth() - 2, tex:GetHeight() - 2) + tex:SetParent(item.Panel) + end end end end @@ -184,25 +185,7 @@ local function QuestFrameStyle() QuestGreetingScrollFrame:RemoveTextures() PLUGIN:ApplyScrollFrameStyle(QuestGreetingScrollFrameScrollBar) - for i = 1, MAX_NUM_ITEMS do - local item = _G["QuestInfoRewardsFrameQuestInfoItem"..i] - if(item and not item.isStyled) then - local cLvl = item:GetFrameLevel() + 1 - item:RemoveTextures() - item:Width(item:GetWidth() - 4) - item:SetFrameLevel(cLvl) - - local tex = _G["QuestInfoRewardsFrameQuestInfoItem"..i.."IconTexture"] - if(tex) then - tex:SetTexCoord(0.1, 0.9, 0.1, 0.9) - tex:SetDrawLayer("OVERLAY",1) - tex:SetPoint("TOPLEFT", 2, -2) - tex:Size(tex:GetWidth() - 2, tex:GetHeight() - 2) - end - PLUGIN:ApplyItemButtonStyle(item, false, true) - item.isStyled = true - end - end + StyleQuestRewards() QuestInfoSkillPointFrame:RemoveTextures() QuestInfoSkillPointFrame:Width(QuestInfoSkillPointFrame:GetWidth() - 4) @@ -223,7 +206,7 @@ local function QuestFrameStyle() QuestInfoItemHighlight:Size(142, 40) hooksecurefunc("QuestInfoItem_OnClick", Hook_QuestInfoItem_OnClick) - hooksecurefunc("QuestInfo_Display", Hook_QuestInfo_Display) + hooksecurefunc("QuestInfo_Display", StyleQuestRewards) QuestRewardScrollFrame:HookScript("OnShow", QuestRewardScrollFrame_OnShow) diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/transmog.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/transmog.lua index 033c5b2..636e347 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/transmog.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/transmog.lua @@ -68,7 +68,7 @@ local function TransmogStyle() select(2, TransmogrifyModelFrame:GetRegions()):Die() - TransmogrifyModelFrame:SetFixedPanelTemplate("ModelComic") + TransmogrifyModelFrame:SetFixedPanelTemplate("Model") TransmogrifyFrameButtonFrame:GetRegions():Die() TransmogrifyApplyButton:RemoveTextures() TransmogrifyApplyButton:SetButtonTemplate() diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/voidstorage.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/voidstorage.lua index dc407bc..ff3e5c6 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/voidstorage.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/voidstorage.lua @@ -62,29 +62,47 @@ local function ChangeTabHelper(this) this.pushed = true; this.backdrop = CreateFrame("Frame", nil, this) + this.backdrop:WrapOuter(this,1,1) this.backdrop:SetFrameLevel(0) + this.backdrop:SetBackdrop({ - bgFile = [[Interface\BUTTONS\WHITE8X8]], - tile = false, - tileSize = 0, - edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], - edgeSize = 3, - insets = { - left = 0, - right = 0, - top = 0, - bottom = 0 - } - }); - this.backdrop:SetBackdropColor(0,0,0,1) + bgFile = [[Interface\BUTTONS\WHITE8X8]], + tile = false, + tileSize = 0, + edgeFile = [[Interface\AddOns\SVUI\assets\artwork\Template\GLOW]], + edgeSize = 3, + insets = { + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }); + + this.backdrop:SetBackdropColor(0,0,0,1) this.backdrop:SetBackdropBorderColor(0,0,0,1) this:SetScript("OnEnter", Tab_OnEnter) this:SetScript("OnLeave", Tab_OnLeave) local a,b,c,d,e = this:GetPoint() this:Point(a,b,c,1,e) -end +end + +local function VoidSlotStyler(name, index) + local gName = ("%sButton%d"):format(name, index) + local button = _G[gName] + local icon = _G[gName .. "IconTexture"] + local bg = _G[gName .. "Bg"] + if(button) then + if(bg) then bg:Hide() end + button:SetSlotTemplate(true, 2, 0, 0) + if(icon) then + icon:SetTexCoord(0.1, 0.9, 0.1, 0.9) + icon:FillInner() + end + end +end --[[ ########################################################## VOIDSTORAGE PLUGINR @@ -98,8 +116,11 @@ local function VoidStorageStyle() PLUGIN:ApplyWindowStyle(VoidStorageFrame, true) - for _,frame in pairs(VoidStorageList)do - _G[frame]:RemoveTextures() + for _,gName in pairs(VoidStorageList) do + local frame = _G[gName] + if(frame) then + frame:RemoveTextures() + end end VoidStoragePurchaseFrame:SetFrameStrata('DIALOG') @@ -112,33 +133,20 @@ local function VoidStorageStyle() VoidStoragePurchaseButton:SetButtonTemplate() VoidStorageHelpBoxButton:SetButtonTemplate() VoidStorageTransferButton:SetButtonTemplate() + PLUGIN:ApplyCloseButtonStyle(VoidStorageBorderFrame.CloseButton) + VoidItemSearchBox:SetPanelTemplate("Inset") VoidItemSearchBox.Panel:Point("TOPLEFT", 10, -1) VoidItemSearchBox.Panel:Point("BOTTOMRIGHT", 4, 1) - for e = 1, 9 do - local f = _G["VoidStorageDepositButton"..e] - local g = _G["VoidStorageWithdrawButton"..e] - local h = _G["VoidStorageDepositButton"..e.."IconTexture"] - local i = _G["VoidStorageWithdrawButton"..e.."IconTexture"] - _G["VoidStorageDepositButton"..e.."Bg"]:Hide() - _G["VoidStorageWithdrawButton"..e.."Bg"]:Hide() - f:SetSlotTemplate(true) - g:SetSlotTemplate(true) - h:SetTexCoord(0.1, 0.9, 0.1, 0.9) - h:FillInner() - i:SetTexCoord(0.1, 0.9, 0.1, 0.9) - i:FillInner() + for i=1, 9 do + VoidSlotStyler("VoidStorageDeposit", i) + VoidSlotStyler("VoidStorageWithdraw", i) end - for e = 1, 80 do - local j = _G["VoidStorageStorageButton"..e] - local k = _G["VoidStorageStorageButton"..e.."IconTexture"] - _G["VoidStorageStorageButton"..e.."Bg"]:Hide() - j:SetSlotTemplate(true, 2, 0, 0) - k:SetTexCoord(0.1, 0.9, 0.1, 0.9) - k:FillInner() + for i = 1, 80 do + VoidSlotStyler("VoidStorageStorage", i) end ChangeTabHelper(VoidStorageFrame.Page1) diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/style_methods.lua b/Interface/AddOns/SVUI_StyleOMatic/components/style_methods.lua index 8051212..368548e 100644 --- a/Interface/AddOns/SVUI_StyleOMatic/components/style_methods.lua +++ b/Interface/AddOns/SVUI_StyleOMatic/components/style_methods.lua @@ -70,7 +70,15 @@ function PLUGIN:ApplyFrameStyle(this, template, noStripping, fullStripping) this:SetPanelTemplate(template) end -function PLUGIN:ApplyUnderlayStyle(this, template, noStripping, fullStripping) +function PLUGIN:ApplyAdjustedFrameStyle(this, template, xTopleft, yTopleft, xBottomright, yBottomright) + if(not this or (this and this.Panel)) then return end + template = template or "Transparent" + this:SetPanelTemplate(template) + this.Panel:SetPoint("TOPLEFT", this, "TOPLEFT", xTopleft, yTopleft) + this.Panel:SetPoint("BOTTOMRIGHT", this, "BOTTOMRIGHT", xBottomright, yBottomright) +end + +function PLUGIN:ApplyFixedFrameStyle(this, template, noStripping, fullStripping) if(not this or (this and this.Panel)) then return end if not noStripping then this:RemoveTextures(fullStripping) end template = template or "Transparent" @@ -667,10 +675,10 @@ end |__/ |__/|______/ \______/ \______/ ########################################################## --]] -function PLUGIN:ApplyEditBoxStyle(this, width, height) +function PLUGIN:ApplyEditBoxStyle(this, width, height, x, y) if not this then return end this:RemoveTextures(true) - this:SetEditboxTemplate() + this:SetEditboxTemplate(x, y) if width then this:Width(width) end if height then this:Height(height) end end diff --git a/Interface/AddOns/SVUI_TrackOMatic/Loader.lua b/Interface/AddOns/SVUI_TrackOMatic/Loader.lua index dd85d68..31f1b26 100644 --- a/Interface/AddOns/SVUI_TrackOMatic/Loader.lua +++ b/Interface/AddOns/SVUI_TrackOMatic/Loader.lua @@ -25,9 +25,9 @@ local assert = _G.assert; local AddonName, AddonObject = ... -assert(_G.LibSuperVillain, AddonName .. " requires LibSuperVillain") +assert(LibSuperVillain, AddonName .. " requires LibSuperVillain") -local PLUGIN = _G.LibSuperVillain:NewPlugin(AddonName, AddonObject, "TrackOMatic_Profile", "TrackOMatic_Global") +local PLUGIN = LibSuperVillain("Registry"):NewPlugin(AddonName, AddonObject, "TrackOMatic_Profile", "TrackOMatic_Global") local Schema = PLUGIN.Schema; local SV = _G["SVUI"];