Apply auto formatting to all source files

This commit is contained in:
2023-09-10 12:37:25 +02:00
parent e20887d46b
commit 24c571658c
9 changed files with 117 additions and 70 deletions

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com> -- Copyright 2023 <omicron.me@protonmail.com>
-- --
-- This file is part of Omicron Frames -- This file is part of Omicron Frames
-- --
-- Omicron Frames is free software: you can redistribute it and/or modify it -- 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 -- 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) -- Software Foundation, either version 3 of the License, or (at your option)
@@ -13,7 +13,7 @@
-- more details. -- more details.
-- --
-- You should have received a copy of the GNU General Public License along with -- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>. -- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omif = select(2, ...) local omif = select(2, ...)
-- Run all functions that start with Setup -- Run all functions that start with Setup

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com> -- Copyright 2023 <omicron.me@protonmail.com>
-- --
-- This file is part of Omicron Frames -- This file is part of Omicron Frames
-- --
-- Omicron Frames is free software: you can redistribute it and/or modify it -- 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 -- 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) -- Software Foundation, either version 3 of the License, or (at your option)
@@ -13,13 +13,13 @@
-- more details. -- more details.
-- --
-- You should have received a copy of the GNU General Public License along with -- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>. -- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local AddonName, omif = ... local AddonName, omif = ...
omif.events = {} -- event (str) to list of handlers omif.events = {} -- event (str) to list of handlers
omif.db = nil omif.db = nil
OmicronFrames = {} OmicronFrames = {}
omif.modules = {public=OmicronFrames} omif.modules = { public = OmicronFrames }
-- Simple function that creates or returns a local module table -- Simple function that creates or returns a local module table
function omif.GetModule(name) function omif.GetModule(name)
if omif.modules[name] == nil then if omif.modules[name] == nil then
@@ -29,7 +29,7 @@ function omif.GetModule(name)
end end
-- Adds a given function to the event handler list for a given event -- Adds a given function to the event handler list for a given event
-- This will later in the addon -- This will later in the addon
function omif.SetEventHandler(event, fn) function omif.SetEventHandler(event, fn)
if omif.events[event] == nil then if omif.events[event] == nil then
omif.events[event] = {} omif.events[event] = {}
@@ -66,6 +66,7 @@ function omif.OnAddonLoaded(name)
omif.MainEventHandler(nil, "OMICRON_LOADING") omif.MainEventHandler(nil, "OMICRON_LOADING")
print("Loaded", AddonName) print("Loaded", AddonName)
end end
omif.SetEventHandler("ADDON_LOADED", omif.OnAddonLoaded) omif.SetEventHandler("ADDON_LOADED", omif.OnAddonLoaded)
-- Fire custom event OMICRON_FULLY_LOADED. This event is fired when the player -- Fire custom event OMICRON_FULLY_LOADED. This event is fired when the player
@@ -75,6 +76,7 @@ function omif.FireFullyLoadedEvent(initialLogin, reloadUI)
omif.MainEventHandler(nil, "OMICRON_FULLY_LOADED") omif.MainEventHandler(nil, "OMICRON_FULLY_LOADED")
end end
end end
omif.SetEventHandler("PLAYER_ENTERING_WORLD", omif.FireFullyLoadedEvent) omif.SetEventHandler("PLAYER_ENTERING_WORLD", omif.FireFullyLoadedEvent)
function omif.SlashCommand(args) function omif.SlashCommand(args)

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com> -- Copyright 2023 <omicron.me@protonmail.com>
-- --
-- This file is part of Omicron Frames -- This file is part of Omicron Frames
-- --
-- Omicron Frames is free software: you can redistribute it and/or modify it -- 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 -- 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) -- Software Foundation, either version 3 of the License, or (at your option)
@@ -13,7 +13,7 @@
-- more details. -- more details.
-- --
-- You should have received a copy of the GNU General Public License along with -- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>. -- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...) local omi = select(2, ...)
local types = omi.GetModule("types") local types = omi.GetModule("types")
@@ -24,39 +24,86 @@ types.AuraList = AuraList
local statusLists = { local statusLists = {
Immune = { Immune = {
[642] = true, -- Divine Shield, Paladin [642] = true, -- Divine Shield, Paladin
[186265] = true, -- Aspect of the Turtle, Hunter [186265] = true, -- Aspect of the Turtle, Hunter
[45438] = true, -- Ice Block [45438] = true, -- Ice Block
[31224] = true, -- Cloak of Shadows [31224] = true, -- Cloak of Shadows
[196555] = true, -- Netherwalk [196555] = true, -- Netherwalk
}, },
Bomb = { Bomb = {
[381615] = true, -- Raszageth, Static Charge [381615] = true, -- Raszageth, Static Charge
[377467] = true, -- Raszageth, Fulminating Charge [377467] = true, -- Raszageth, Fulminating Charge
[399713] = true, -- Raszageth, Magnetic Charge [399713] = true, -- Raszageth, Magnetic Charge
[397797] = true, -- Corrupted Vortex, Jade Serpent Temple [397797] = true, -- Corrupted Vortex, Jade Serpent Temple
[387843] = true, -- Astral Bomb, Algeth'ar Academy [387843] = true, -- Astral Bomb, Algeth'ar Academy
[386181] = true, -- Mana Bomb, Algeth'ar Academy [386181] = true, -- Mana Bomb, Algeth'ar Academy
[411241] = true, -- Sarkareth, Void Claws (p2 tank) [401330] = true, -- Sarkareth, Burning Claws (p1 tank)
[408429] = true, -- Sarkareth, Void Slash (p3 tank) [411241] = true, -- Sarkareth, Void Claws (p2 tank)
[410642] = true, -- Sarkareth, Void fracture (bombs) [408429] = true, -- Sarkareth, Void Slash (p3 tank)
[404218] = true, -- Sarkareth, Void fracture (bombs)
}, },
Burn = { Burn = {
[114803] = true, -- Throw Torch, Jade Serpent Temple -- Jade Serpent Temple
[397914] = true, -- Defiling Mist, Jade Serpent Temple [114803] = true, -- Throw Torch
[106114] = true, -- Touch of Nothingness, Jade Serpent temple [397914] = true, -- Defiling Mist
[152819] = true, -- Shadow Word: Frailty, Shadowmoon Burial Ground [106114] = true, -- Touch of Nothingness
[153524] = true, -- Plague Spit, Shadowmoon Burial Ground
[397907] = true, -- Impending Doom, ??? -- Shadow moon Burial Ground
[209516] = true, -- Mana Fang, Court of Stars [152819] = true, -- Shadow Word: Frailty
[207980] = true, -- Disintegration Beam, Court of Stars [153524] = true, -- Plague Spit
[211464] = true, -- Fel Detonation, Court of Stars
[376997] = true, -- Savage Peck, Algeth'ar Academy -- Court of Stars
[388912] = true, -- Severing Slash, Algeth'ar Academy [397907] = true, -- Impending Doom
[388866] = true, -- Mana Void, Algeth'ar Academy [209516] = true, -- Mana Fang
[390911] = true, -- Raszageth, Lingering Charge [207980] = true, -- Disintegration Beam
[255582] = true, -- Priestess Alun'za, Molten Gold [211464] = true, -- Fel Detonation
[259853] = true, -- Rixxa Fluxflame, Chemical Burn
-- Algeth'ar Academy
[376997] = true, -- Savage Peck, Algeth'ar Academy
[388912] = true, -- Severing Slash, Algeth'ar Academy
[388866] = true, -- Mana Void, Algeth'ar Academy
-- Vault of the Incarnates
[390911] = true, -- Raszageth, Lingering Charge
-- Atal'Dazar
[255582] = true, -- Priestess Alun'za, Molten Gold
-- The MOTHERLODE!!
[259853] = true, -- Rixxa Fluxflame, Chemical Burn
-- Halls of Infusion
-- Uldaman: Legacy of Tyr
[372718] = true, -- Earthen Shards
-- Brackenhide Hollow
[367521] = true, -- Bone Bolt
[367484] = true, -- Vicious Clawmangle
[378020] = true, -- Gash Frenzy
[385058] = true, -- Withering Poison
[384575] = true, -- Crippling Bite
-- Neltharus
[373735] = true, -- Dragon Strike
[372224] = true, -- Draogonbone Axe
[377018] = true, -- Molten Gold
[372570] = true, -- Bold Ambush
-- Neltharion's Lair
-- Freehold
[413131] = true, -- Whirling Dagger
-- The Underrot
[265019] = true, -- Savage Cleave
[265568] = true, -- Dark Omen
[273226] = true, -- Decaying Spores
-- Vortex Pinnacle
-- Aberrus
[404010] = true, -- Zkarn, ???
[405462] = true, -- Zkarn, ???
}, },
} }
@@ -65,7 +112,7 @@ local statusLists = {
local function ForEachAuraSlots(unit, fn, continuationToken, ...) local function ForEachAuraSlots(unit, fn, continuationToken, ...)
local GetAuraDataBySlot = C_UnitAuras.GetAuraDataBySlot local GetAuraDataBySlot = C_UnitAuras.GetAuraDataBySlot
local n = select('#', ...) local n = select('#', ...)
for i=1, n do for i = 1, n do
local slot = select(i, ...) local slot = select(i, ...)
fn(GetAuraDataBySlot(unit, slot)) fn(GetAuraDataBySlot(unit, slot))
end end

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com> -- Copyright 2023 <omicron.me@protonmail.com>
-- --
-- This file is part of Omicron Frames -- This file is part of Omicron Frames
-- --
-- Omicron Frames is free software: you can redistribute it and/or modify it -- 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 -- 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) -- Software Foundation, either version 3 of the License, or (at your option)
@@ -13,7 +13,7 @@
-- more details. -- more details.
-- --
-- You should have received a copy of the GNU General Public License along with -- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>. -- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...) local omi = select(2, ...)
local types = omi.GetModule("types") local types = omi.GetModule("types")
@@ -77,7 +77,6 @@ function BorderIndicator:Show(data)
frame:Show() frame:Show()
end end
function BorderIndicator:Update(data) function BorderIndicator:Update(data)
if data.color then if data.color then
self:SetColor(data.color) self:SetColor(data.color)
@@ -90,7 +89,7 @@ function BorderIndicator:GetFrame()
frame.backdropInfo = { frame.backdropInfo = {
edgeFile = "Interface\\Addons\\OmicronFrames\\media\\textures\\pixel_edge", edgeFile = "Interface\\Addons\\OmicronFrames\\media\\textures\\pixel_edge",
edgeSize = 1, edgeSize = 1,
insets = {left=0, right=0, top=0, bottom=0}, insets = { left = 0, right = 0, top = 0, bottom = 0 },
} }
end end
@@ -109,4 +108,3 @@ function BorderIndicator:Hide()
self.frame = nil self.frame = nil
borderPool:Release(frame) borderPool:Release(frame)
end end

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com> -- Copyright 2023 <omicron.me@protonmail.com>
-- --
-- This file is part of Omicron Frames -- This file is part of Omicron Frames
-- --
-- Omicron Frames is free software: you can redistribute it and/or modify it -- 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 -- 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) -- Software Foundation, either version 3 of the License, or (at your option)
@@ -13,7 +13,7 @@
-- more details. -- more details.
-- --
-- You should have received a copy of the GNU General Public License along with -- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>. -- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...) local omi = select(2, ...)
local types = omi.GetModule("types") local types = omi.GetModule("types")
local AuraTrigger = types.AuraTrigger local AuraTrigger = types.AuraTrigger
@@ -36,4 +36,3 @@ end
--- Hide the indicator --- Hide the indicator
function Indicator:Hide() function Indicator:Hide()
end end

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com> -- Copyright 2023 <omicron.me@protonmail.com>
-- --
-- This file is part of Omicron Frames -- This file is part of Omicron Frames
-- --
-- Omicron Frames is free software: you can redistribute it and/or modify it -- 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 -- 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) -- Software Foundation, either version 3 of the License, or (at your option)
@@ -13,7 +13,7 @@
-- more details. -- more details.
-- --
-- You should have received a copy of the GNU General Public License along with -- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>. -- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...) local omi = select(2, ...)
---@class Object ---@class Object

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com> -- Copyright 2023 <omicron.me@protonmail.com>
-- --
-- This file is part of Omicron Frames -- This file is part of Omicron Frames
-- --
-- Omicron Frames is free software: you can redistribute it and/or modify it -- 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 -- 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) -- Software Foundation, either version 3 of the License, or (at your option)
@@ -13,7 +13,7 @@
-- more details. -- more details.
-- --
-- You should have received a copy of the GNU General Public License along with -- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>. -- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...) local omi = select(2, ...)
local types = omi.GetModule("types") local types = omi.GetModule("types")
@@ -30,7 +30,7 @@ function StatusBar:Init(parent, width, height, level, top)
local bar = CreateFrame("StatusBar", nil, parentFrame) local bar = CreateFrame("StatusBar", nil, parentFrame)
bar:SetFrameStrata("MEDIUM") bar:SetFrameStrata("MEDIUM")
bar:SetFrameLevel(level) bar:SetFrameLevel(level)
if top then if top then
bar:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", 0, 0) bar:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", 0, 0)
else else
@@ -42,12 +42,12 @@ function StatusBar:Init(parent, width, height, level, top)
bar:GetStatusBarTexture():SetHorizTile(false) bar:GetStatusBarTexture():SetHorizTile(false)
bar:GetStatusBarTexture():SetVertTile(false) bar:GetStatusBarTexture():SetVertTile(false)
self.bar = bar self.bar = bar
local bg = bar:CreateTexture(nil, "BACKGROUND") local bg = bar:CreateTexture(nil, "BACKGROUND")
bg:SetTexture("Interface\\Addons\\OmicronFrames\\media\\textures\\bar_subtle_diagonal") bg:SetTexture("Interface\\Addons\\OmicronFrames\\media\\textures\\bar_subtle_diagonal")
bg:SetAllPoints(true) bg:SetAllPoints(true)
self.bg = bg self.bg = bg
self:SetRange(0, 1) self:SetRange(0, 1)
self:SetValue(1) self:SetValue(1)
bar:Show() bar:Show()
@@ -70,13 +70,13 @@ function StatusBar:Hide()
end end
function StatusBar:SetInterpolatedColor(start, stop, progress) function StatusBar:SetInterpolatedColor(start, stop, progress)
local r = start[1] + (stop[1] - start[1])*progress local r = start[1] + (stop[1] - start[1]) * progress
local g = start[2] + (stop[2] - start[2])*progress local g = start[2] + (stop[2] - start[2]) * progress
local b = start[3] + (stop[3] - start[3])*progress local b = start[3] + (stop[3] - start[3]) * progress
self:SetColor(r, g, b) self:SetColor(r, g, b)
end end
function StatusBar:SetColor(r, g, b) function StatusBar:SetColor(r, g, b)
self.bar:SetStatusBarColor(r, g, b) self.bar:SetStatusBarColor(r, g, b)
self.bg:SetVertexColor(0.2*r, 0.2*g, 0.2*b) self.bg:SetVertexColor(0.2 * r, 0.2 * g, 0.2 * b)
end end

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com> -- Copyright 2023 <omicron.me@protonmail.com>
-- --
-- This file is part of Omicron Frames -- This file is part of Omicron Frames
-- --
-- Omicron Frames is free software: you can redistribute it and/or modify it -- 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 -- 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) -- Software Foundation, either version 3 of the License, or (at your option)
@@ -13,7 +13,7 @@
-- more details. -- more details.
-- --
-- You should have received a copy of the GNU General Public License along with -- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>. -- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omif = select(2, ...) local omif = select(2, ...)
local types = omif.GetModule("types") local types = omif.GetModule("types")
@@ -48,6 +48,7 @@ function types.IsDerivedFrom(a, b)
return true return true
end end
current = current.__typeInfo.parent current = current.__typeInfo.parent
until current == nil; until current == nil
;
return false return false
end end

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com> -- Copyright 2023 <omicron.me@protonmail.com>
-- --
-- This file is part of Omicron Frames -- This file is part of Omicron Frames
-- --
-- Omicron Frames is free software: you can redistribute it and/or modify it -- 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 -- 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) -- Software Foundation, either version 3 of the License, or (at your option)
@@ -13,7 +13,7 @@
-- more details. -- more details.
-- --
-- You should have received a copy of the GNU General Public License along with -- You should have received a copy of the GNU General Public License along with
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>. -- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...) local omi = select(2, ...)
local types = omi.GetModule("types") local types = omi.GetModule("types")
local UnitGroup = types.CreateClass("UnitGroup") local UnitGroup = types.CreateClass("UnitGroup")
@@ -38,7 +38,7 @@ local function UnitFrameDefaultCompare(lhs, rhs)
end end
local lunit, runit = lhs.unit, rhs.unit local lunit, runit = lhs.unit, rhs.unit
-- players < non-players -- players < non-players
local player = UnitIsPlayer(lunit) local player = UnitIsPlayer(lunit)
if UnitIsPlayer(lunit) ~= UnitIsPlayer(runit) then if UnitIsPlayer(lunit) ~= UnitIsPlayer(runit) then
@@ -50,16 +50,16 @@ local function UnitFrameDefaultCompare(lhs, rhs)
if UnitIsUnit(lunit, "player") ~= UnitIsUnit(runit, "player") then if UnitIsUnit(lunit, "player") ~= UnitIsUnit(runit, "player") then
return UnitIsUnit(lunit, "player") return UnitIsUnit(lunit, "player")
end end
-- tank < healer < damage < ? -- tank < healer < damage < ?
local lrole = RoleValue(UnitGroupRolesAssigned(lunit)) local lrole = RoleValue(UnitGroupRolesAssigned(lunit))
local rrole = RoleValue(UnitGroupRolesAssigned(runit)) local rrole = RoleValue(UnitGroupRolesAssigned(runit))
if lrole ~= rrole then if lrole ~= rrole then
return lrole < rrole return lrole < rrole
end end
end end
return lunit < runit return lunit < runit
end end
@@ -121,14 +121,14 @@ function UnitGroup:Sort()
table.sort(self.units, UnitFrameDefaultCompare) table.sort(self.units, UnitFrameDefaultCompare)
local left, top, width, height = self.left, self.top, self.width, self.height local left, top, width, height = self.left, self.top, self.width, self.height
local maxFrameIndex = #self.units local maxFrameIndex = #self.units
for y=0,5 do for y = 0, 5 do
for x=0,4 do for x = 0, 4 do
local num = y*5 + x + 1 local num = y * 5 + x + 1
if num > maxFrameIndex then if num > maxFrameIndex then
return return
end end
local frame = self.units[num] local frame = self.units[num]
frame:SetPosition(left + (x-2)*width, top - y*height) frame:SetPosition(left + (x - 2) * width, top - y * height)
end end
end end
end end