diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..394e884 --- /dev/null +++ b/.stylua.toml @@ -0,0 +1 @@ +indent_type = "Spaces" diff --git a/src/profiler.lua b/src/profiler.lua index 99e9657..581f84c 100644 --- a/src/profiler.lua +++ b/src/profiler.lua @@ -88,7 +88,7 @@ Commander.RegisterCommand("omi-pstart", { PrintLn("To enable the script profiler run `/console scriptProfile 1`, then reload the UI.") return end - end + end, }) Commander.RegisterCommand("omi-pstop", { @@ -117,7 +117,9 @@ Commander.RegisterCommand("omi-pstop", { time = time * 1000, }) end - table.sort(data, function(a, b) return a.time < b.time end) + table.sort(data, function(a, b) + return a.time < b.time + end) end, }) @@ -136,5 +138,5 @@ Commander.RegisterCommand("omi-pprint", { local ms_per_sec = time / total Printf("% 6.1f%% % 7.2fms %7.2fms/s %s\n", pct, time, ms_per_sec, item.name) end - end + end, }) diff --git a/src/types/indicators/indicator.lua b/src/types/indicators/indicator.lua index 48badbc..a99fc6f 100644 --- a/src/types/indicators/indicator.lua +++ b/src/types/indicators/indicator.lua @@ -26,13 +26,10 @@ local Indicator = types.CreateClass("Indicator") types.Indicator = Indicator --- Show the indicator and supply it with data -function Indicator:Show(data) -end +function Indicator:Show(data) end --- Update the indicator with new data -function Indicator:Update(data) -end +function Indicator:Update(data) end --- Hide the indicator -function Indicator:Hide() -end +function Indicator:Hide() end diff --git a/src/types/statusbar.lua b/src/types/statusbar.lua index a18a18f..a221e69 100644 --- a/src/types/statusbar.lua +++ b/src/types/statusbar.lua @@ -21,7 +21,9 @@ types.StatusBar = types.CreateClass("StatusBar") local StatusBar = types.StatusBar function StatusBar:Init(parent, width, height, level, top, texture, bgtexture) - if top == nil then top = true end + if top == nil then + top = true + end level = level or 0 -- parent: the parent frame self.parent = parent diff --git a/src/types/triggers/auratrigger.lua b/src/types/triggers/auratrigger.lua index e08ee59..cef6135 100644 --- a/src/types/triggers/auratrigger.lua +++ b/src/types/triggers/auratrigger.lua @@ -27,20 +27,13 @@ local Trigger = types.Trigger local AuraTrigger = types.CreateClass("AuraTrigger", Trigger) types.AuraTrigger = AuraTrigger - ---Creates a new AuraTrigger from a config description and attaches it to the ---correct data source ---@param unit UnitFrame ---@param config table ---@return AuraTrigger function AuraTrigger.CreateFromConfig(unit, config) - local trigger = AuraTrigger:new( - config.spellId, - config.own, - config.requiredCount, - config.invert, - config.defaultData - ) + local trigger = AuraTrigger:new(config.spellId, config.own, config.requiredCount, config.invert, config.defaultData) unit.auras:AddTrigger(trigger) return trigger end diff --git a/src/types/triggers/multitrigger.lua b/src/types/triggers/multitrigger.lua index 71909e5..f065bb7 100644 --- a/src/types/triggers/multitrigger.lua +++ b/src/types/triggers/multitrigger.lua @@ -1,7 +1,7 @@ -- Copyright 2023 -- -- This file is part of Omicron Frames --- +-- -- Omicron Frames is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the Free -- Software Foundation, either version 3 of the License, or (at your option) @@ -13,7 +13,7 @@ -- more details. -- -- You should have received a copy of the GNU General Public License along with --- Omicron Frames. If not, see . +-- Omicron Frames. If not, see . local omi = select(2, ...) local types = omi.GetModule("types") @@ -26,7 +26,7 @@ local Trigger = types.Trigger ---indicator. ---@class MultiTrigger: Trigger ---@field active boolean ----@field invert boolean +---@field invert boolean local MultiTrigger = types.CreateClass("MultiTrigger", Trigger) types.MultiTrigger = MultiTrigger @@ -73,7 +73,7 @@ function MultiTrigger:AddTrigger(trigger) end, Hide = function(_, data) self:OnChildDeactivate(idx, trigger, data) - end + end, }) end @@ -141,4 +141,3 @@ end function MultiTrigger:Reset() self:SetState(false) end - diff --git a/src/types/triggers/statustrigger.lua b/src/types/triggers/statustrigger.lua index 520d13a..c28ab32 100644 --- a/src/types/triggers/statustrigger.lua +++ b/src/types/triggers/statustrigger.lua @@ -1,7 +1,7 @@ -- Copyright 2023 -- -- This file is part of Omicron Frames --- +-- -- Omicron Frames is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the Free -- Software Foundation, either version 3 of the License, or (at your option) @@ -13,7 +13,7 @@ -- more details. -- -- You should have received a copy of the GNU General Public License along with --- Omicron Frames. If not, see . +-- Omicron Frames. If not, see . local omi = select(2, ...) local types = omi.GetModule("types") ---@class Trigger @@ -29,8 +29,7 @@ types.StatusTrigger = StatusTrigger ---@param unit UnitFrame ---@param config table function StatusTrigger.CreateFromConfig(unit, config) - local trigger = StatusTrigger:new(config.status, config.requiredCount, - config.invert, config.defaultData) + local trigger = StatusTrigger:new(config.status, config.requiredCount, config.invert, config.defaultData) unit.auras:AddTrigger(trigger) return trigger end @@ -45,7 +44,7 @@ end --- Initialize a new AuraTrigger object ---@param status string The kind of status to trigger on ----@param requiredCount number | nil +---@param requiredCount number | nil ---@param invert boolean | nil function StatusTrigger:Init(status, requiredCount, invert, defaultData) Trigger.Init(self, invert, defaultData) diff --git a/src/types/triggers/trigger.lua b/src/types/triggers/trigger.lua index 6a80bc8..dfc306b 100644 --- a/src/types/triggers/trigger.lua +++ b/src/types/triggers/trigger.lua @@ -1,7 +1,7 @@ -- Copyright 2023 -- -- This file is part of Omicron Frames --- +-- -- Omicron Frames is free software: you can redistribute it and/or modify it -- under the terms of the GNU General Public License as published by the Free -- Software Foundation, either version 3 of the License, or (at your option) @@ -13,22 +13,21 @@ -- more details. -- -- You should have received a copy of the GNU General Public License along with --- Omicron Frames. If not, see . +-- Omicron Frames. If not, see . local omi = select(2, ...) local types = omi.GetModule("types") --- Triggers objects provide a link between indicators and some data source. They --- can pass data from the data source into the indicator. This is a supertype for --- all triggers and should not be constructed on its own. +-- can pass data from the data source into the indicator. This is a supertype for +-- all triggers and should not be constructed on its own. ---@class Trigger: Object ---@field active boolean ----@field invert boolean +---@field invert boolean ---@field indicator Indicator ---@field data table The most recent data updated by the data source local Trigger = types.CreateClass("Trigger") types.Trigger = Trigger - ---@param unit UnitFrame ---@param config table ---@return Trigger @@ -91,4 +90,3 @@ end function Trigger:Reset() self:SetState(false, false) end - diff --git a/src/types/types.lua b/src/types/types.lua index b3fec41..a036170 100644 --- a/src/types/types.lua +++ b/src/types/types.lua @@ -24,7 +24,7 @@ local function CreateClassRaw(name, parent) c.__typeInfo = { name = name, class = c, - parent = parent + parent = parent, } c.__index = c if parent ~= nil then @@ -49,6 +49,5 @@ function types.IsDerivedFrom(a, b) end current = current.__typeInfo.parent until current == nil - ; return false end diff --git a/src/types/unitframe.lua b/src/types/unitframe.lua index 123836f..1d4cf6b 100644 --- a/src/types/unitframe.lua +++ b/src/types/unitframe.lua @@ -36,7 +36,6 @@ local BorderIndicator = types.BorderIndicator local UnitFrame = types.CreateClass("UnitFrame") types.UnitFrame = UnitFrame - local colors = { hostile = { 0.5, 0.0, 0.0 }, neutral = { 0.7, 0.7, 0.0 }, @@ -54,8 +53,8 @@ local colors = { bomb = { 1.0, 0.7, 0.7 }, cyan = { 0.0, 0.8, 0.8 }, white = { 1.0, 1.0, 1.0 }, - shield = { 0.85, .95, 1.0 }, - absorb = { 0.5, .4, .75 }, + shield = { 0.85, 0.95, 1.0 }, + absorb = { 0.5, 0.4, 0.75 }, } -- This trucates _codepoints_ not graphemes. If combination codepoints are @@ -112,7 +111,6 @@ function UnitFrame:Init(unit, config) self.auras = AuraList:new(self) - local overlays = CreateFrame("Frame", nil, secure) overlays:SetFrameStrata("MEDIUM") overlays:SetFrameLevel(100) @@ -292,9 +290,15 @@ function UnitFrame:PrepareWheelBinds(bindings) if bind.button == "wheel-up" or bind.button == "wheel-down" then local prefix = ModifiersToPrefix(bind.mods) local button = bind.button == "wheel-up" and "MOUSEWHEELUP" or "MOUSEWHEELDOWN" - table.insert(bindScript, - string.format([[self:SetBindingClick(false, "%s%s", "OmicronSecureFrame%s", "%s%s")]], - prefix, button, unit, prefix, bind.button + table.insert( + bindScript, + string.format( + [[self:SetBindingClick(false, "%s%s", "OmicronSecureFrame%s", "%s%s")]], + prefix, + button, + unit, + prefix, + bind.button ) ) end