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>
--
-- 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 <https://www.gnu.org/licenses/>.
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omif = select(2, ...)
-- Run all functions that start with Setup

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com>
--
-- 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,13 +13,13 @@
-- more details.
--
-- 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 = ...
omif.events = {} -- event (str) to list of handlers
omif.db = nil
OmicronFrames = {}
omif.modules = {public=OmicronFrames}
omif.modules = { public = OmicronFrames }
-- Simple function that creates or returns a local module table
function omif.GetModule(name)
if omif.modules[name] == nil then
@@ -29,7 +29,7 @@ function omif.GetModule(name)
end
-- 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)
if omif.events[event] == nil then
omif.events[event] = {}
@@ -66,6 +66,7 @@ function omif.OnAddonLoaded(name)
omif.MainEventHandler(nil, "OMICRON_LOADING")
print("Loaded", AddonName)
end
omif.SetEventHandler("ADDON_LOADED", omif.OnAddonLoaded)
-- 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")
end
end
omif.SetEventHandler("PLAYER_ENTERING_WORLD", omif.FireFullyLoadedEvent)
function omif.SlashCommand(args)

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com>
--
-- 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 <https://www.gnu.org/licenses/>.
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...)
local types = omi.GetModule("types")
@@ -24,39 +24,86 @@ types.AuraList = AuraList
local statusLists = {
Immune = {
[642] = true, -- Divine Shield, Paladin
[186265] = true, -- Aspect of the Turtle, Hunter
[45438] = true, -- Ice Block
[31224] = true, -- Cloak of Shadows
[196555] = true, -- Netherwalk
[642] = true, -- Divine Shield, Paladin
[186265] = true, -- Aspect of the Turtle, Hunter
[45438] = true, -- Ice Block
[31224] = true, -- Cloak of Shadows
[196555] = true, -- Netherwalk
},
Bomb = {
[381615] = true, -- Raszageth, Static Charge
[377467] = true, -- Raszageth, Fulminating Charge
[399713] = true, -- Raszageth, Magnetic Charge
[397797] = true, -- Corrupted Vortex, Jade Serpent Temple
[387843] = true, -- Astral Bomb, Algeth'ar Academy
[386181] = true, -- Mana Bomb, Algeth'ar Academy
[411241] = true, -- Sarkareth, Void Claws (p2 tank)
[408429] = true, -- Sarkareth, Void Slash (p3 tank)
[410642] = true, -- Sarkareth, Void fracture (bombs)
[381615] = true, -- Raszageth, Static Charge
[377467] = true, -- Raszageth, Fulminating Charge
[399713] = true, -- Raszageth, Magnetic Charge
[397797] = true, -- Corrupted Vortex, Jade Serpent Temple
[387843] = true, -- Astral Bomb, Algeth'ar Academy
[386181] = true, -- Mana Bomb, Algeth'ar Academy
[401330] = true, -- Sarkareth, Burning Claws (p1 tank)
[411241] = true, -- Sarkareth, Void Claws (p2 tank)
[408429] = true, -- Sarkareth, Void Slash (p3 tank)
[404218] = true, -- Sarkareth, Void fracture (bombs)
},
Burn = {
[114803] = true, -- Throw Torch, Jade Serpent Temple
[397914] = true, -- Defiling Mist, Jade Serpent Temple
[106114] = true, -- Touch of Nothingness, Jade Serpent temple
[152819] = true, -- Shadow Word: Frailty, Shadowmoon Burial Ground
[153524] = true, -- Plague Spit, Shadowmoon Burial Ground
[397907] = true, -- Impending Doom, ???
[209516] = true, -- Mana Fang, Court of Stars
[207980] = true, -- Disintegration Beam, Court of Stars
[211464] = true, -- Fel Detonation, Court of Stars
[376997] = true, -- Savage Peck, Algeth'ar Academy
[388912] = true, -- Severing Slash, Algeth'ar Academy
[388866] = true, -- Mana Void, Algeth'ar Academy
[390911] = true, -- Raszageth, Lingering Charge
[255582] = true, -- Priestess Alun'za, Molten Gold
[259853] = true, -- Rixxa Fluxflame, Chemical Burn
-- Jade Serpent Temple
[114803] = true, -- Throw Torch
[397914] = true, -- Defiling Mist
[106114] = true, -- Touch of Nothingness
-- Shadow moon Burial Ground
[152819] = true, -- Shadow Word: Frailty
[153524] = true, -- Plague Spit
-- Court of Stars
[397907] = true, -- Impending Doom
[209516] = true, -- Mana Fang
[207980] = true, -- Disintegration Beam
[211464] = true, -- Fel Detonation
-- 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 GetAuraDataBySlot = C_UnitAuras.GetAuraDataBySlot
local n = select('#', ...)
for i=1, n do
for i = 1, n do
local slot = select(i, ...)
fn(GetAuraDataBySlot(unit, slot))
end

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com>
--
-- 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 <https://www.gnu.org/licenses/>.
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...)
local types = omi.GetModule("types")
@@ -77,7 +77,6 @@ function BorderIndicator:Show(data)
frame:Show()
end
function BorderIndicator:Update(data)
if data.color then
self:SetColor(data.color)
@@ -90,7 +89,7 @@ function BorderIndicator:GetFrame()
frame.backdropInfo = {
edgeFile = "Interface\\Addons\\OmicronFrames\\media\\textures\\pixel_edge",
edgeSize = 1,
insets = {left=0, right=0, top=0, bottom=0},
insets = { left = 0, right = 0, top = 0, bottom = 0 },
}
end
@@ -109,4 +108,3 @@ function BorderIndicator:Hide()
self.frame = nil
borderPool:Release(frame)
end

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com>
--
-- 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 <https://www.gnu.org/licenses/>.
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...)
local types = omi.GetModule("types")
local AuraTrigger = types.AuraTrigger
@@ -36,4 +36,3 @@ end
--- Hide the indicator
function Indicator:Hide()
end

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com>
--
-- 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 <https://www.gnu.org/licenses/>.
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...)
---@class Object

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com>
--
-- 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 <https://www.gnu.org/licenses/>.
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...)
local types = omi.GetModule("types")
@@ -30,7 +30,7 @@ function StatusBar:Init(parent, width, height, level, top)
local bar = CreateFrame("StatusBar", nil, parentFrame)
bar:SetFrameStrata("MEDIUM")
bar:SetFrameLevel(level)
if top then
bar:SetPoint("TOPLEFT", parentFrame, "TOPLEFT", 0, 0)
else
@@ -42,12 +42,12 @@ function StatusBar:Init(parent, width, height, level, top)
bar:GetStatusBarTexture():SetHorizTile(false)
bar:GetStatusBarTexture():SetVertTile(false)
self.bar = bar
local bg = bar:CreateTexture(nil, "BACKGROUND")
bg:SetTexture("Interface\\Addons\\OmicronFrames\\media\\textures\\bar_subtle_diagonal")
bg:SetAllPoints(true)
self.bg = bg
self:SetRange(0, 1)
self:SetValue(1)
bar:Show()
@@ -70,13 +70,13 @@ function StatusBar:Hide()
end
function StatusBar:SetInterpolatedColor(start, stop, progress)
local r = start[1] + (stop[1] - start[1])*progress
local g = start[2] + (stop[2] - start[2])*progress
local b = start[3] + (stop[3] - start[3])*progress
local r = start[1] + (stop[1] - start[1]) * progress
local g = start[2] + (stop[2] - start[2]) * progress
local b = start[3] + (stop[3] - start[3]) * progress
self:SetColor(r, g, b)
end
function StatusBar:SetColor(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

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com>
--
-- 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 <https://www.gnu.org/licenses/>.
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omif = select(2, ...)
local types = omif.GetModule("types")
@@ -48,6 +48,7 @@ function types.IsDerivedFrom(a, b)
return true
end
current = current.__typeInfo.parent
until current == nil;
until current == nil
;
return false
end

View File

@@ -1,7 +1,7 @@
-- Copyright 2023 <omicron.me@protonmail.com>
--
-- 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 <https://www.gnu.org/licenses/>.
-- Omicron Frames. If not, see <https://www.gnu.org/licenses/>.
local omi = select(2, ...)
local types = omi.GetModule("types")
local UnitGroup = types.CreateClass("UnitGroup")
@@ -38,7 +38,7 @@ local function UnitFrameDefaultCompare(lhs, rhs)
end
local lunit, runit = lhs.unit, rhs.unit
-- players < non-players
local player = UnitIsPlayer(lunit)
if UnitIsPlayer(lunit) ~= UnitIsPlayer(runit) then
@@ -50,16 +50,16 @@ local function UnitFrameDefaultCompare(lhs, rhs)
if UnitIsUnit(lunit, "player") ~= UnitIsUnit(runit, "player") then
return UnitIsUnit(lunit, "player")
end
-- tank < healer < damage < ?
local lrole = RoleValue(UnitGroupRolesAssigned(lunit))
local rrole = RoleValue(UnitGroupRolesAssigned(runit))
if lrole ~= rrole then
return lrole < rrole
end
end
return lunit < runit
end
@@ -121,14 +121,14 @@ function UnitGroup:Sort()
table.sort(self.units, UnitFrameDefaultCompare)
local left, top, width, height = self.left, self.top, self.width, self.height
local maxFrameIndex = #self.units
for y=0,5 do
for x=0,4 do
local num = y*5 + x + 1
for y = 0, 5 do
for x = 0, 4 do
local num = y * 5 + x + 1
if num > maxFrameIndex then
return
end
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