From 7af4cefaa6519b7f406cba05ab63729be2db38eb Mon Sep 17 00:00:00 2001 From: Azilroka Date: Tue, 27 Aug 2024 08:26:58 -0500 Subject: [PATCH] 4.73 --- AddOnSkins/AddOnSkins.toc | 2 +- AddOnSkins/AddOnSkins_Cata.toc | 2 +- AddOnSkins/AddOnSkins_Classic.toc | 2 +- AddOnSkins/Core/API.lua | 2 +- AddOnSkins/Core/Core.lua | 8 +-- AddOnSkins/Init.lua | 62 +++++++------------ .../LibSharedMedia-3.0/LibSharedMedia-3.0.lua | 29 +++++---- 7 files changed, 47 insertions(+), 60 deletions(-) diff --git a/AddOnSkins/AddOnSkins.toc b/AddOnSkins/AddOnSkins.toc index 4fdf24e0..2ed38fd1 100644 --- a/AddOnSkins/AddOnSkins.toc +++ b/AddOnSkins/AddOnSkins.toc @@ -1,6 +1,6 @@ ## Interface: 110002 ## Title: |cff16C3F2AddOn|r|cFFFFFFFFSkins|r -## Version: 4.72 +## Version: 4.73 ## Author: Azilroka, Nihilistzsche ## SavedVariables: AddOnSkinsDB, AddOnSkinsDS ## OptionalDeps: AllTheThings, ElvUI diff --git a/AddOnSkins/AddOnSkins_Cata.toc b/AddOnSkins/AddOnSkins_Cata.toc index e95c1cbb..53775f71 100644 --- a/AddOnSkins/AddOnSkins_Cata.toc +++ b/AddOnSkins/AddOnSkins_Cata.toc @@ -1,6 +1,6 @@ ## Interface: 40400 ## Title: |cff16C3F2AddOn|r|cFFFFFFFFSkins|r -## Version: 4.72 +## Version: 4.73 ## Author: Azilroka, Nihilistzsche ## SavedVariables: AddOnSkinsDB, AddOnSkinsDS ## OptionalDeps: AllTheThings, ElvUI diff --git a/AddOnSkins/AddOnSkins_Classic.toc b/AddOnSkins/AddOnSkins_Classic.toc index 7b1380fa..c79c256a 100644 --- a/AddOnSkins/AddOnSkins_Classic.toc +++ b/AddOnSkins/AddOnSkins_Classic.toc @@ -1,6 +1,6 @@ ## Interface: 11503 ## Title: |cff16C3F2AddOn|r|cFFFFFFFFSkins|r -## Version: 4.72 +## Version: 4.73 ## Author: Azilroka, Nihilistzsche ## SavedVariables: AddOnSkinsDB, AddOnSkinsDS ## OptionalDeps: AllTheThings, ElvUI diff --git a/AddOnSkins/Core/API.lua b/AddOnSkins/Core/API.lua index da3c5791..2b9a0dd5 100644 --- a/AddOnSkins/Core/API.lua +++ b/AddOnSkins/Core/API.lua @@ -1,4 +1,4 @@ -local AS = unpack(AddOnSkins) +local AS = unpack(_G.AddOnSkins) local S = AS.Skins -- Deprecated - Moved to Skins Module diff --git a/AddOnSkins/Core/Core.lua b/AddOnSkins/Core/Core.lua index 59b23b83..bf2ea084 100644 --- a/AddOnSkins/Core/Core.lua +++ b/AddOnSkins/Core/Core.lua @@ -6,9 +6,8 @@ local AddOnName = ... local ES = AS.EmbedSystem local _G = _G -local pairs, ipairs, type, pcall = pairs, ipairs, type, pcall +local pairs, ipairs, type, pcall, tinsert = pairs, ipairs, type, pcall, tinsert local floor, print, format, strlower, strmatch, strlen = floor, print, format, strlower, strmatch, strlen -local sort, tinsert = sort, tinsert local geterrorhandler = geterrorhandler local IsAddOnLoaded, C_Timer = C_AddOns.IsAddOnLoaded, C_Timer @@ -38,8 +37,7 @@ function AS:IsSkinEnabled(name, elvName) end function AS:GetColor(name) - local color = '|cff1784d1%s|r' - return (color):format(name) + return format('|cff1784d1%s|r', name) end function AS:RGBToHex(r, g, b, header) @@ -200,7 +198,7 @@ function AS:UnregisterSkinEvent(addonName, event) end function AS:UpdateMedia() - AS.Blank = AS.Libs.LSM:Fetch('background', 'Solid') + AS.Blank = AS.Libs.LSM:Fetch('statusbar', 'Solid') AS.Font = AS.Libs.LSM:Fetch('font', "Friz Quadrata TT") AS.PixelFont = AS.Libs.LSM:Fetch('font', "Arial Narrow") AS.NormTex = AS.Libs.LSM:Fetch('statusbar', "Blizzard") diff --git a/AddOnSkins/Init.lua b/AddOnSkins/Init.lua index 05819276..b9d9eab7 100644 --- a/AddOnSkins/Init.lua +++ b/AddOnSkins/Init.lua @@ -1,49 +1,34 @@ local _G = _G -local format = format -local strlower = strlower -local CreateFrame = CreateFrame -local GetAddOnEnableState = C_AddOns.GetAddOnEnableState -local GetAddOnInfo = C_AddOns.GetAddOnInfo -local GetAddOnMetadata = C_AddOns.GetAddOnMetadata -local GetNumAddOns = C_AddOns.GetNumAddOns -local GetRealmName = GetRealmName -local UIParent = UIParent -local UnitClass = UnitClass -local UnitName = UnitName -local UnitFactionGroup = UnitFactionGroup +local format, strlower = format, strlower + +local GetAddOnEnableState, GetAddOnInfo, GetAddOnMetadata, GetNumAddOns = C_AddOns.GetAddOnEnableState, C_AddOns.GetAddOnInfo, C_AddOns.GetAddOnMetadata, C_AddOns.GetNumAddOns +local UnitName, GetRealmName, UnitClass, UnitFactionGroup = UnitName, GetRealmName, UnitClass, UnitFactionGroup + +local UIParent, CreateFrame = UIParent, CreateFrame +local LibStub = _G.LibStub local AddOnName, Engine = ... -local AS = _G.LibStub('AceAddon-3.0'):NewAddon('AddOnSkins', 'AceConsole-3.0', 'AceEvent-3.0', 'AceHook-3.0', 'AceTimer-3.0') -local _ +local AS, _ = LibStub('AceAddon-3.0'):NewAddon('AddOnSkins', 'AceConsole-3.0', 'AceEvent-3.0', 'AceHook-3.0', 'AceTimer-3.0') AS.EmbedSystem = AS:NewModule('EmbedSystem', 'AceEvent-3.0', 'AceHook-3.0') AS.Skins = AS:NewModule('Skins', 'AceTimer-3.0', 'AceHook-3.0', 'AceEvent-3.0') -Engine[1] = AS -Engine[2] = {} -Engine[3] = AS.Skins -Engine[4] = {} +_G.AddOnSkins, Engine[1], Engine[2], Engine[3], Engine[4], _G.AddOnSkinsDS = Engine, AS, {}, AS.Skins, {}, {} -_G.AddOnSkins = Engine -_G.AddOnSkinsDS = {} - -AS.Classic = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC -AS.Retail = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE -AS.TBC = WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC -AS.Wrath = WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC +AS.Retail, AS.Classic, AS.TBC, AS.Wrath = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE, WOW_PROJECT_ID == WOW_PROJECT_CLASSIC, WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC, WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC AS.Libs = { - AC = _G.LibStub('AceConfig-3.0'), - ACD = _G.LibStub('AceConfigDialog-3.0-ElvUI', true) or _G.LibStub('AceConfigDialog-3.0'), - ACH = _G.LibStub('LibAceConfigHelper'), - ADB = _G.LibStub('AceDB-3.0'), - ADBO = _G.LibStub('AceDBOptions-3.0'), - ACL = _G.LibStub("AceLocale-3.0-ElvUI", true) or _G.LibStub("AceLocale-3.0"), - EP = _G.LibStub('LibElvUIPlugin-1.0', true), - ACR = _G.LibStub('AceConfigRegistry-3.0'), - GUI = _G.LibStub('AceGUI-3.0'), - LCG = _G.LibStub('LibCustomGlow-1.0', true), - LSM = _G.LibStub('LibSharedMedia-3.0', true), + AC = LibStub('AceConfig-3.0'), + ACD = LibStub('AceConfigDialog-3.0-ElvUI', true) or LibStub('AceConfigDialog-3.0'), + ACH = LibStub('LibAceConfigHelper'), + ADB = LibStub('AceDB-3.0'), + ADBO = LibStub('AceDBOptions-3.0'), + ACL = LibStub("AceLocale-3.0-ElvUI", true) or LibStub("AceLocale-3.0"), + EP = LibStub('LibElvUIPlugin-1.0', true), + ACR = LibStub('AceConfigRegistry-3.0'), + GUI = LibStub('AceGUI-3.0'), + LCG = LibStub('LibCustomGlow-1.0', true), + LSM = LibStub('LibSharedMedia-3.0', true), } AS.Title = GetAddOnMetadata(AddOnName, 'Title') @@ -55,9 +40,8 @@ _, AS.MyClass = UnitClass('player') AS.MyName = UnitName('player') AS.MyRealm = GetRealmName() AS.Noop = function() end -AS.TexCoords = { .075, .925, .075, .925 } +AS.TexCoords = { .08, .92, .08, .92 } AS.Faction = UnitFactionGroup('player') -AS.Debug = false AS.preload = {} AS.skins = {} @@ -73,7 +57,5 @@ for i = 1, GetNumAddOns() do AS.AddOnVersion[strlower(Name)] = GetAddOnMetadata(Name, 'Version') end -AS.Libs.LSM:Register('statusbar', 'Solid', [[Interface\Buttons\WHITE8X8]]) - AS.Hider = CreateFrame('Frame', nil, UIParent) AS.Hider:Hide() diff --git a/AddOnSkins/Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua b/AddOnSkins/Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua index ce5ff14d..94ee292d 100644 --- a/AddOnSkins/Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua +++ b/AddOnSkins/Libs/LibSharedMedia-3.0/LibSharedMedia-3.0.lua @@ -1,6 +1,7 @@ +--@curseforge-project-slug: libsharedmedia-3-0@ --[[ Name: LibSharedMedia-3.0 -Revision: $Revision: 91 $ +Revision: $Revision: 151 $ Author: Elkano (elkano@gmx.de) Inspired By: SurfaceLib by Haste/Otravi (troeks@gmail.com) Website: http://www.wowace.com/projects/libsharedmedia-3-0/ @@ -9,7 +10,7 @@ Dependencies: LibStub, CallbackHandler-1.0 License: LGPL v2.1 ]] -local MAJOR, MINOR = "LibSharedMedia-3.0", 6010002 -- 6.1.0 v2 / increase manually on changes +local MAJOR, MINOR = "LibSharedMedia-3.0", 8020003 -- 8.2.0 v3 / increase manually on changes local lib = LibStub:NewLibrary(MAJOR, MINOR) if not lib then return end @@ -20,13 +21,11 @@ local pairs = _G.pairs local type = _G.type local band = _G.bit.band - -local table_insert = _G.table.insert local table_sort = _G.table.sort local locale = GetLocale() local locale_is_western -local LOCALE_MASK = 0 +local LOCALE_MASK lib.LOCALE_BIT_koKR = 1 lib.LOCALE_BIT_ruRU = 2 lib.LOCALE_BIT_zhCN = 4 @@ -193,11 +192,12 @@ if not lib.MediaTable.statusbar then lib.MediaTable.statusbar = {} end lib.MediaTable.statusbar["Blizzard"] = [[Interface\TargetingFrame\UI-StatusBar]] lib.MediaTable.statusbar["Blizzard Character Skills Bar"] = [[Interface\PaperDollInfoFrame\UI-Character-Skills-Bar]] lib.MediaTable.statusbar["Blizzard Raid Bar"] = [[Interface\RaidFrame\Raid-Bar-Hp-Fill]] +lib.MediaTable.statusbar["Solid"] = [[Interface\Buttons\WHITE8X8]] lib.DefaultMedia.statusbar = "Blizzard" -- SOUND if not lib.MediaTable.sound then lib.MediaTable.sound = {} end -lib.MediaTable.sound["None"] = [[Interface\Quiet.ogg]] -- Relies on the fact that PlaySound[File] doesn't error on non-existing input. +lib.MediaTable.sound["None"] = 1 -- Relies on the fact that PlaySoundFile doesn't error on this value lib.DefaultMedia.sound = "None" local function rebuildMediaList(mediatype) @@ -222,18 +222,25 @@ function lib:Register(mediatype, key, data, langmask) error(MAJOR..":Register(mediatype, key, data, langmask) - key must be string, got "..type(key)) end mediatype = mediatype:lower() - if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then return false end - if mediatype == lib.MediaType.SOUND and type(data) == "string" then + if mediatype == lib.MediaType.FONT and ((langmask and band(langmask, LOCALE_MASK) == 0) or not (langmask or locale_is_western)) then + -- ignore fonts that aren't flagged as supporting local glyphs on non-western clients + return false + end + if type(data) == "string" and (mediatype == lib.MediaType.BACKGROUND or mediatype == lib.MediaType.BORDER or mediatype == lib.MediaType.STATUSBAR or mediatype == lib.MediaType.SOUND) then local path = data:lower() - -- Only ogg and mp3 are valid sounds. - if not path:find(".ogg", nil, true) and not path:find(".mp3", nil, true) then + if not path:find("^interface") then + -- files accessed via path only allowed from interface folder + return false + end + if mediatype == lib.MediaType.SOUND and not (path:find(".ogg", nil, true) or path:find(".mp3", nil, true)) then + -- Only ogg and mp3 are valid sounds. return false end end if not mediaTable[mediatype] then mediaTable[mediatype] = {} end local mtable = mediaTable[mediatype] if mtable[key] then return false end - + mtable[key] = data rebuildMediaList(mediatype) self.callbacks:Fire("LibSharedMedia_Registered", mediatype, key)