Skip to content

Commit

Permalink
- Code clean-up.
Browse files Browse the repository at this point in the history
  • Loading branch information
StormFX committed Dec 25, 2023
1 parent da6662f commit f587df8
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Core/Button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local pairs, type = pairs, type
-- WoW API
---

local ContainerFrame_GetContainerNumSlots, hooksecurefunc = _G.ContainerFrame_GetContainerNumSlots, _G.hooksecurefunc
local ContainerFrame_GetContainerNumSlots, hooksecurefunc = ContainerFrame_GetContainerNumSlots, hooksecurefunc

----------------------------------------
-- Internal
Expand Down
9 changes: 3 additions & 6 deletions Core/Group.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,14 @@ local DEFAULT_SKIN = Core.DEFAULT_SKIN
local ActionTypes, RegTypes = Core.ActionTypes, Core.RegTypes

-- @ Core\Utility
local GetColor, GetScale, NoOp = Core.GetColor, Core.GetScale, Core.NoOp
local GetColor, GetScale = Core.GetColor, Core.GetScale

-- @ Core\Core
local GetRegion, GetType = Core.GetRegion, Core.GetType

-- @ Core\Button
local SkinButton = Core.SkinButton

-- @ Core\Callback
local Callback = Core.Callback

-- @ Core\Regions\*
local SetPulse, SetTextureColor = Core.SetPulse, Core.SetTextureColor

Expand Down Expand Up @@ -486,7 +483,7 @@ function GMT:__Update(IsNew)
if db.Inherit then
local Options = {"SkinID", "Backdrop", "Shadow", "Gloss", "Pulse", "Scale", "UseScale"}

for i, v in ipairs(Options) do
for _, v in ipairs(Options) do
db[v] = p_db[v]
end

Expand Down Expand Up @@ -550,7 +547,7 @@ end
---

-- Temporary function to catch add-ons using deprecated API.
function GMT:SetCallback(...)
function GMT:SetCallback()
if self.ID == MASQUE then return end

local Warn = Core.db.profile.CB_Warn
Expand Down
2 changes: 1 addition & 1 deletion Core/Regions/Backdrop.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ local function AddBackdrop(Region, Button, Skin, Color, xScale, yScale)

Region:SetParent(Button)
Color = Color or Skin.Color

local Atlas = Skin.Atlas
local UseAtlasSize = Skin.UseAtlasSize

Expand Down
2 changes: 1 addition & 1 deletion Core/Regions/Cooldown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local type = type
-- WoW API
---

local hooksecurefunc = _G.hooksecurefunc
local hooksecurefunc = hooksecurefunc

----------------------------------------
-- Internal
Expand Down
4 changes: 2 additions & 2 deletions Core/Regions/Icon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local error, type = error, type
-- WoW API
---

local hooksecurefunc = _G.hooksecurefunc
local hooksecurefunc = hooksecurefunc

----------------------------------------
-- Internal
Expand Down Expand Up @@ -75,7 +75,7 @@ local IconHook = {
Pet = true,
}

-- We don't need to hook these in Retail.
-- We don't need to hook these in Retail.
-- @ Core\Button Hooks
if not Core.WOW_RETAIL then
IconHook.BagSlot = true
Expand Down
2 changes: 1 addition & 1 deletion Core/Regions/IconBorder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local _, Core = ...
-- WoW API
---

local hooksecurefunc = _G.hooksecurefunc
local hooksecurefunc = hooksecurefunc

----------------------------------------
-- Internal
Expand Down
2 changes: 1 addition & 1 deletion Core/Regions/NewItem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local _, Core = ...
-- WoW API
---

local hooksecurefunc = _G.hooksecurefunc
local hooksecurefunc = hooksecurefunc

----------------------------------------
-- Internal
Expand Down
2 changes: 1 addition & 1 deletion Core/Regions/Normal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ local error, type = error, type
-- WoW API
---

local hooksecurefunc, random = _G.hooksecurefunc, _G.random
local hooksecurefunc, random = hooksecurefunc, random

----------------------------------------
-- Internal
Expand Down
2 changes: 1 addition & 1 deletion Core/Regions/QuestBorder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local _, Core = ...
-- WoW API
---

local hooksecurefunc = _G.hooksecurefunc
local hooksecurefunc = hooksecurefunc

----------------------------------------
-- Internal
Expand Down
17 changes: 6 additions & 11 deletions Core/Regions/SpellAlert.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local error, type = error, type
-- WoW API
---

local ActionButton_HideOverlayGlow, C_Timer_After = _G.ActionButton_HideOverlayGlow, _G.C_Timer.After
local ActionButton_HideOverlayGlow, C_Timer_After = ActionButton_HideOverlayGlow, C_Timer.After

----------------------------------------
-- Internal
Expand All @@ -31,9 +31,6 @@ local ActionButton_HideOverlayGlow, C_Timer_After = _G.ActionButton_HideOverlayG
-- @ Core\Utility
local GetScale, GetSize, GetTexCoords = Core.GetScale, Core.GetSize, Core.GetTexCoords

-- @ Core\Regions\Frame
local SkinFrame = Core.SkinFrame

----------------------------------------
-- Locals
---
Expand Down Expand Up @@ -140,7 +137,7 @@ local function SkinSpellAlert(Region, Button, Skin, xScale, yScale)
Loop_Flipbook:SetAtlas("UI-HUD-ActionBar-Proc-Loop-Flipbook")

-- Defaults to 150 x 150, causing visual scaling-up on transition.
Start_Flipbook:SetSize(160, 160)
Start_Flipbook:SetSize(160, 160)
end

Region.__MSQ_Skin = Skin or true
Expand Down Expand Up @@ -168,7 +165,7 @@ local function UpdateSpellAlert(Button)
local Active = Region.__MSQ_Skin

-- Update the skin if necessary.
if not Active or (Active ~= Skin) or (Scale ~= Region.__MSQ_Scale) then
if not Active or (Active ~= Skin) or (Scale ~= Region.__MSQ_Scale) then
SkinSpellAlert(Region, Button, Skin, GetScale(Button))
end

Expand All @@ -179,7 +176,7 @@ local function UpdateSpellAlert(Button)
ActionButton_HideOverlayGlow(Button)
return

-- Hide the circular flash of the starting animation.
-- Hide the circular flash of the starting animation.
elseif Option == 2 then
if Flash:IsPlaying() then
Region:SetAlpha(0)
Expand All @@ -192,14 +189,12 @@ local function UpdateSpellAlert(Button)

-- Still used by LibActionButton-1.0.
elseif Region.spark then
local Skin = Button.__MSQ_Skin

SkinOverlay(Region, Button, Skin and Skin.SpellAlert)
SkinOverlay(Region, Button, Skin)
end
end

-- @ FrameXML\ActionButton.lua
_G.hooksecurefunc("ActionButton_ShowOverlayGlow", UpdateSpellAlert)
hooksecurefunc("ActionButton_ShowOverlayGlow", UpdateSpellAlert)

----------------------------------------
-- Core
Expand Down
12 changes: 1 addition & 11 deletions Core/Utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ local _, Core = ...

local type = type

----------------------------------------
-- Internal
---

-- @ Masque
local WOW_RETAIL = Core.WOW_RETAIL

-- @ Skins\Regions
local ActionTypes = Core.ActionTypes

----------------------------------------
-- Functions
---
Expand Down Expand Up @@ -156,7 +146,7 @@ end
---

-- Temporary function to catch add-ons using deprecated API.
function Core.API:Register(Addon, ...)
function Core.API:Register(Addon)
if type(Addon) ~= "string" then
return
end
Expand Down
16 changes: 8 additions & 8 deletions Options/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local MASQUE, Core = ...
-- WoW API
---

local InCombatLockdown = _G.InCombatLockdown
local InCombatLockdown = InCombatLockdown

----------------------------------------
-- Libraries
Expand All @@ -29,11 +29,11 @@ local LIB_ACR = LibStub("AceConfigRegistry-3.0")
-- Locals
---

-- Necessary for consistency across clients.
-- Empty lines need a space.
local CRLF = "\n "

-- Loader Frame
local OPT_FRAME
-- Options Loader Frame
local OPT_LDR_FRAME

----------------------------------------
-- Setup
Expand Down Expand Up @@ -83,8 +83,8 @@ function Setup.Core(self)
local Path = "Core"
self:AddOptionsPanel(Path, LIB_ACD:AddToBlizOptions(MASQUE, MASQUE, nil, Path))

OPT_FRAME = CreateFrame("Frame", "MSQ_OPT_FRAME", SettingsPanel or InterfaceOptionsFrame)
OPT_FRAME:SetScript("OnShow", function() Setup("LoD") end)
OPT_LDR_FRAME = CreateFrame("Frame", "MSQ_LDR_FRAME", SettingsPanel)
OPT_LDR_FRAME:SetScript("OnShow", function() Setup("LoD") end)

-- GC
Setup.Core = nil
Expand All @@ -101,8 +101,8 @@ function Setup.LoD(self)
Setup("Profiles")

-- GC
if OPT_FRAME then
OPT_FRAME:SetScript("OnShow", nil)
if OPT_LDR_FRAME then
OPT_LDR_FRAME:SetScript("OnShow", nil)
end

Setup.LoD = nil
Expand Down
9 changes: 3 additions & 6 deletions Options/General.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local MASQUE, Core = ...
-- WoW API
---

local ReloadUI = _G.ReloadUI
local ReloadUI = ReloadUI

----------------------------------------
-- Libraries
Expand All @@ -28,9 +28,6 @@ local LIB_DBI = Core.LIB_DBI
-- Internal
---

-- @ Masque
local WOW_RETAIL = Core.WOW_RETAIL

-- @ Core\Groups
local Groups = Core.Groups

Expand Down Expand Up @@ -73,7 +70,7 @@ local Effects = {

-- Registers/unregisters events that trigger animations.
local function UpdateEffect(Name, Value)
local Frame = _G.ActionBarActionEventsFrame
local Frame = ActionBarActionEventsFrame
local Events = Effects[Name]

if Value then
Expand Down Expand Up @@ -223,7 +220,7 @@ function Setup.General(self)
},
},
},
Effects = Core.WOW_RETAIL and {
Effects = self.WOW_RETAIL and {
type = "group",
name = L["Advanced"],
desc = Tooltip,
Expand Down
5 changes: 3 additions & 2 deletions Options/LDB.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ local MASQUE, Core = ...
---

local AOC_FRAME = AddonCompartmentFrame
local InCombatLockdown = _G.InCombatLockdown
local InCombatLockdown = InCombatLockdown

----------------------------------------
-- Libraries
Expand Down Expand Up @@ -47,6 +47,7 @@ function Setup.LDB(self)
type = "launcher",
label = MASQUE,
icon = "Interface\\Addons\\Masque\\Textures\\LDB",
tocname = MASQUE, -- Required by Diagnostics
OnClick = function(Tip, Button)
if Button == "LeftButton" or Button == "RightButton" then
Core:ToggleOptions()
Expand All @@ -58,7 +59,7 @@ function Setup.LDB(self)
end
Tip:AddLine(MASQUE)
Tip:AddLine(L["Click to open Masque's settings."], 1, 1, 1)

if InCombatLockdown() then
Tip:AddLine(L["Unavailable in combat."], 1, 0, 0)
end
Expand Down
2 changes: 1 addition & 1 deletion Skins/Skins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ Core.SkinOrder = SkinOrder
local API = Core.API

-- Wrapper for the AddSkin function.
function API:AddSkin(SkinID, SkinData, Replace)
function API:AddSkin(SkinID, SkinData)
local Debug = Core.Debug

if type(SkinID) ~= "string" then
Expand Down

0 comments on commit f587df8

Please sign in to comment.