Various changes #1

Merged
omicron merged 11 commits from absorb into main 2025-08-24 12:40:06 +00:00
10 changed files with 38 additions and 44 deletions
Showing only changes of commit f181c0022c - Show all commits

1
.stylua.toml Normal file
View File

@@ -0,0 +1 @@
indent_type = "Spaces"

View File

@@ -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,
})

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -28,7 +28,6 @@ local types = omi.GetModule("types")
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

View File

@@ -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

View File

@@ -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