Skip to content

Commit

Permalink
Format.
Browse files Browse the repository at this point in the history
  • Loading branch information
hexingzhou committed Nov 26, 2024
1 parent 6522a07 commit 5115616
Show file tree
Hide file tree
Showing 16 changed files with 208 additions and 37 deletions.
4 changes: 2 additions & 2 deletions WeakAuras_Scripts/HWA/Group_Grow(Core - HWA - CLASS).lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
--]]
function(newPositions, activeRegions)
local HWA = HWA and HWA[aura_env.id:gsub("Core %- HWA %- ", "")] or {}

if HWA and HWA.coreGrow then
HWA.coreGrow(newPositions, activeRegions)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
--]]
function(newPositions, activeRegions)
local HWA = HWA and HWA[aura_env.id:gsub("Dynamic Effects %- HWA %- ", "")] or {}

if HWA and HWA.dynamicEffectsGrow then
HWA.dynamicEffectsGrow(newPositions, activeRegions)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
--]]
function(newPositions, activeRegions)
local HWA = HWA and HWA[aura_env.id:gsub("Maintenance %- HWA %- ", "")] or {}

if HWA and HWA.maintenanceGrow then
HWA.maintenanceGrow(newPositions, activeRegions)
end
end
end
4 changes: 2 additions & 2 deletions WeakAuras_Scripts/HWA/Group_Grow(Power - HWA - CLASS).lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
--]]
function(newPositions, activeRegions)
local HWA = HWA and HWA[aura_env.id:gsub(".+ %- HWA %- ", "")] or {}

if HWA and HWA.resourceGrow then
HWA.resourceGrow(newPositions, activeRegions)
end
end
end
4 changes: 2 additions & 2 deletions WeakAuras_Scripts/HWA/Group_Sort(Core - HWA - CLASS).lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
--]]
function(a, b)
local HWA = HWA and HWA[aura_env.id:gsub("Core %- HWA %- ", "")] or {}

if HWA and HWA.coreSort then
return HWA.coreSort(a, b)
end
return a.dataIndex < b.dataIndex
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
--]]
function(a, b)
local HWA = HWA and HWA[aura_env.id:gsub("Dynamic Effects %- HWA %- ", "")] or {}

if HWA and HWA.dynamicEffectsSort then
return HWA.dynamicEffectsSort(a, b)
end
return a.dataIndex < b.dataIndex
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
--]]
function(a, b)
local HWA = HWA and HWA[aura_env.id:gsub("Maintenance %- HWA %- ", "")] or {}

if HWA and HWA.maintenanceSort then
return HWA.maintenanceSort(a, b)
end
return a.dataIndex < b.dataIndex
end
end
175 changes: 175 additions & 0 deletions WeakAuras_Scripts/HWA/Init(General Options - HWA).lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,181 @@ local function tcontains(t, v)
return false
end

HWA.bit = {
tobit = function(x)
x = x % (2 ^ 32)
if x >= 2 ^ 31 then
return x - 2 ^ 32
end
return x
end,
tohex = function(x, n)
if n == nil then
n = 8
elseif n < 0 then
n = -n
x = x % (2 ^ (n * 4))
x = string.format("%0" .. n .. "X", x)
return x
end
x = x % (2 ^ (n * 4))
x = string.format("%0" .. n .. "x", x)
return x
end,
bnot = function(x)
x = x % (2 ^ 32)
local output = 0
for i = 0, 31 do
if x % 2 == 0 then
output = output + 2 ^ i
end
x = math.floor(x / 2)
end
if output >= 2 ^ 31 then
output = output - 2 ^ 32
end
return output
end,
bor = function(...)
local output = 0
local bits = {}
for i = 1, select("#", ...) do
local x = select(i, ...)
x = x % (2 ^ 32)
for i = 1, 32 do
if x % 2 ~= 0 and bits[i] == nil then
bits[i] = true
output = output + 2 ^ (i - 1)
end
x = math.floor(x / 2)
end
end
if output >= 2 ^ 31 then
output = output - 2 ^ 32
end
return output
end,
band = function(...)
local output = 2 ^ 32 - 1
local bits = {}
for i = 1, select("#", ...) do
local x = select(i, ...)
x = x % (2 ^ 32)
for i = 1, 32 do
if x % 2 == 0 and bits[i] == nil then
bits[i] = true
output = output - 2 ^ (i - 1)
end
x = math.floor(x / 2)
end
end
if output >= 2 ^ 31 then
output = output - 2 ^ 32
end
return output
end,
bxor = function(...)
local bits = {}
for i = 1, select("#", ...) do
local x = select(i, ...)
x = x % (2 ^ 32)
for i = 1, 32 do
if x % 2 ~= 0 then
bits[i] = not bits[i]
end
x = math.floor(x / 2)
end
end
local output = 0
for i = 1, 32 do
if bits[i] == true then
output = output + 2 ^ (i - 1)
end
end
if output >= 2 ^ 31 then
output = output - 2 ^ 32
end
return output
end,
lshift = function(x, n)
x = x % (2 ^ 32)
n = n % 32
x = x * (2 ^ n)
x = x % (2 ^ 32)
if x >= 2 ^ 31 then
x = x - 2 ^ 32
end
return x
end,
rshift = function(x, n)
x = x % (2 ^ 32)
n = n % 32
for i = 1, n do
x = math.floor(x / 2)
end
if x >= 2 ^ 31 then
x = x - 2 ^ 32
end
return x
end,
arshift = function(x, n)
x = x % (2 ^ 32)
n = n % 32
local extension = 0
if x >= 2 ^ 31 then
extension = 2 ^ 31
end
for i = 1, n do
x = math.floor(x / 2) + extension
end
if x >= 2 ^ 31 then
x = x - 2 ^ 32
end
return x
end,
rol = function(x, n)
x = x % (2 ^ 32)
n = n % 32
for i = 1, n do
x = x * 2
if x >= 2 ^ 32 then
x = x % (2 ^ 32) + 1
end
end
if x >= 2 ^ 31 then
x = x - 2 ^ 32
end
return x
end,
ror = function(x, n)
x = x % (2 ^ 32)
n = n % 32
for i = 1, n do
local msb = 0
if x % 2 ~= 0 then
msb = 2 ^ 31
end
x = math.floor(x / 2) + msb
end
if x >= 2 ^ 31 then
x = x - 2 ^ 32
end
return x
end,
bswap = function(x)
x = x % (2 ^ 32)
local b1 = math.floor(x / 0x1000000)
local b2 = math.floor(x / 0x10000) % 0x100
local b3 = math.floor(x / 0x100) % 0x100
local b4 = x % 0x100
x = b4 * 0x1000000 + b3 * 0x10000 + b2 * 0x100 + b1
if x >= 2 ^ 31 then
x = x - 2 ^ 32
end
return x
end,
}

function HWA.getShow(config)
if not config then
return true
Expand Down
4 changes: 2 additions & 2 deletions WeakAuras_Scripts/HWA/TSU(Icon - HWA)_Aura.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function(states, event, ...)
if not state.show then
states[key] = {
show = false,
changed = true
changed = true,
}
else
states[key] = {
Expand All @@ -36,7 +36,7 @@ function(states, event, ...)
progressType = state.progressType,
duration = state.duration,
expirationTime = state.expirationTime,
stacks = state.stacks
stacks = state.stacks,
}
end
return true
Expand Down
2 changes: 1 addition & 1 deletion WeakAuras_Scripts/HWA/TSU(Icon - HWA)_Spell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function(states, event)
if not state.show then
states[key] = {
show = false,
changed = true
changed = true,
}
else
states[key] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
--]]
function(event)
WeakAuras.ScanEvents("HWA_OPTIONS")
end
end
19 changes: 11 additions & 8 deletions WeakAuras_Scripts/HWA/Trigger(General Options - HWA - CLASS)_1.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
--[[
- Events: OPTIONS, HWA_OPTIONS, HWA_INIT, PLAYER_ENTERING_WORLD, PLAYER_SPECIALIZATION_CHANGED, TRAIT_CONFIG_UPDATED, UPDATE_SHAPESHIFT_FORM
- Events: OPTIONS, HWA_OPTIONS, HWA_INIT, PLAYER_ENTERING_WORLD, PLAYER_SPECIALIZATION_CHANGED, TRAIT_CONFIG_UPDATED, GROUP_JOINED, GROUP_LEFT, UPDATE_SHAPESHIFT_FORM
--]]
function(event, ...)
local arg1, arg2 = ...
if "OPTIONS" == event or "HWA_OPTIONS" == event or ("HWA_INIT" == event and arg1) then
local arg = ...

if "OPTIONS" == event or "HWA_OPTIONS" == event or ("HWA_INIT" == event and arg) then
aura_env.initThrottled()

elseif "HWA_INIT" == event then
aura_env.init()

elseif "PLAYER_ENTERING_WORLD" == event or "PLAYER_SPECIALIZATION_CHANGED" == event or "TRAIT_CONFIG_UPDATED" == event then
elseif
"PLAYER_ENTERING_WORLD" == event
or "PLAYER_SPECIALIZATION_CHANGED" == event
or "TRAIT_CONFIG_UPDATED" == event
or "GROUP_JOINED" == event
or "GROUP_LEFT" == event
then
aura_env.initThrottled()
C_Timer.After(1, function()
WeakAuras.ScanEvents("HWA_INIT", true)
end)

elseif "UPDATE_SHAPESHIFT_FORM" == event then
local formID = GetShapeshiftFormID()
if aura_env.formID ~= formID then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ function(event, ...)
end

local class = UnitClassBase("player")
local isMounted = IsMounted() or ("DRUID" == class and tContains({3, 4, 27, 29}, GetShapeshiftFormID()))
local isMounted = IsMounted() or ("DRUID" == class and tContains({ 3, 4, 27, 29 }, GetShapeshiftFormID()))
local isSkyriding = WeakAuras.IsRetail() and isMounted and select(2, C_PlayerInfo.GetGlidingInfo())
local isPetBattle = C_PetBattles.IsInBattle()
local isVehicle = UnitInVehicle('player') or UnitOnTaxi('player')
local isVehicleUI = UnitHasVehicleUI('player') or HasOverrideActionBar() or HasVehicleActionBar()
local isVehicle = UnitInVehicle("player") or UnitOnTaxi("player")
local isVehicleUI = UnitHasVehicleUI("player") or HasOverrideActionBar() or HasVehicleActionBar()

if isSkyriding or (isMounted and not config.skyriding_only) then
alpha = min(alpha, config.mounted or 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ function(event)
WeakAuras.ScanEvents("HWA_INIT")
end)
end
end
end
4 changes: 0 additions & 4 deletions WeakAuras_Scripts/HWA/Trigger(Icon - HWA)_Aura.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function(event, ...)
return false
end


-- Untrigger
function(event, ...)
local key = "AURA"
Expand All @@ -39,7 +38,6 @@ function(event, ...)
return false
end


-- Duration Info
function()
local key = "AURA"
Expand All @@ -50,7 +48,6 @@ function()
return 0, 0
end


-- Name Info
function()
local key = "AURA"
Expand All @@ -61,7 +58,6 @@ function()
return nil
end


-- Stack Info
function()
local key = "AURA"
Expand Down
Loading

0 comments on commit 5115616

Please sign in to comment.