Code format

This commit is contained in:
2025-05-15 21:19:10 +02:00
parent 4220b4d0bd
commit 635147c29b
7 changed files with 141 additions and 168 deletions

View File

@@ -1,13 +1,6 @@
local function getItemLink(container, slot) local function getItemLink(container, slot) return select(7, GetContainerItemInfo(container, slot)) or "" end
return select(7, GetContainerItemInfo(container, slot)) or "" local function getBindType(container, slot) return select(14, GetItemInfo(getItemLink(container, slot))) or 0 end
end local function isBoe(container, slot) return getBindType(container, slot) == 1 end
local function getBindType(container, slot)
return select(14, GetItemInfo(getItemLink(container, slot))) or 0
end
local function isBoe(container, slot)
return getBindType(container, slot) == 1
end
local showGlow = function(container, slot) local showGlow = function(container, slot)
ActionButton_ShowOverlayGlow(_G["ElvUI_ContainerFrameBag" .. container .. "Slot" .. slot]) ActionButton_ShowOverlayGlow(_G["ElvUI_ContainerFrameBag" .. container .. "Slot" .. slot])

View File

@@ -8,16 +8,12 @@ local CooldownType = {
} }
local NullType = CooldownType:New() local NullType = CooldownType:New()
NullType.GetActiveInfo = function(self) NullType.GetActiveInfo = function(self) return false, 0, 0 end
return false, 0, 0
end
local TotemType = CooldownType:New() local TotemType = CooldownType:New()
TotemType.GetActiveInfo = function(self) TotemType.GetActiveInfo = function(self)
for i = 1, 4 do for i = 1, 4 do
local present, name, start, duration = GetTotemInfo(i) local present, name, start, duration = GetTotemInfo(i)
if present and name == self.name then if present and name == self.name then return true, start, duration end
return true, start, duration
end
end end
return false, 0, 0 return false, 0, 0
end end
@@ -41,9 +37,7 @@ local Cooldown = {
return start > 0 and duration > aura_env.gcdThreshold, start, duration return start > 0 and duration > aura_env.gcdThreshold, start, duration
end, end,
GetActiveInfo = function(self) GetActiveInfo = function(self) return self.type:GetActiveInfo() end,
return self.type:GetActiveInfo()
end
} }
aura_env.cooldowns = { aura_env.cooldowns = {

View File

@@ -37,9 +37,9 @@ aura_env.processEvent = function(allstates)
for k, spellId in pairs(aura_env.trackedSpells) do for k, spellId in pairs(aura_env.trackedSpells) do
-- Handle spells with charges -- Handle spells with charges
local isReady local isReady
if (aura_env.cache[spellId].hasCharges) then if aura_env.cache[spellId].hasCharges then
local charges = select(1, GetSpellCharges(spellId)) local charges = select(1, GetSpellCharges(spellId))
if (charges > aura_env.cache[spellId].charges) then if charges > aura_env.cache[spellId].charges then
isReady = true isReady = true
aura_env.cache[spellId].charges = charges aura_env.cache[spellId].charges = charges
else else
@@ -50,8 +50,7 @@ aura_env.processEvent = function(allstates)
isReady = select(2, GetSpellCooldown(spellId)) < gcdDuration isReady = select(2, GetSpellCooldown(spellId)) < gcdDuration
end end
if not aura_env.cache[spellId].ready and isReady then
if (not aura_env.cache[spellId].ready and isReady) then
local icon = select(3, GetSpellInfo(spellId)) local icon = select(3, GetSpellInfo(spellId))
allstates[spellId] = { allstates[spellId] = {
show = true, show = true,

View File

@@ -7,9 +7,7 @@ for _, group in ipairs(groups) do
local playerFrames = { playerFrame1, playerFrame2, playerFrame3, playerFrame4, playerFrame5 } local playerFrames = { playerFrame1, playerFrame2, playerFrame3, playerFrame4, playerFrame5 }
for _, player in ipairs(playerFrames) do for _, player in ipairs(playerFrames) do
if player.Name:IsVisible() then if player.Name:IsVisible() then aura_env.players[#aura_env.players + 1] = player end
aura_env.players[#aura_env.players + 1] = player
end
end end
end end

View File

@@ -8,38 +8,31 @@ local allianceRaces = {
"Gnome", "Gnome",
"Human", "Human",
"Night Elf", "Night Elf",
"Worgen" "Worgen",
} }
PlayerController = { PlayerController = {
nearbyPlayers = {}, nearbyPlayers = {},
addPlayer = function(self, name) addPlayer = function(self, name) self.nearbyPlayers[name] = Player:New(name) end,
self.nearbyPlayers[name] = Player:New(name) getPlayers = function(self) end,
end,
getPlayers = function(self)
end,
process = function(guid) process = function(guid)
if (self.nearbyPlayers[guid] == nil) then if self.nearbyPlayers[guid] == nil then
self.addPlayer(guid) self.addPlayer(guid)
else else
end
end end
end,
} }
Player = { Player = {
guid = nil, guid = nil,
lastSighted = nil, lastSighted = nil,
info = nil, info = nil,
update = function(self) update = function(self) self.lastSighted = GetTime() end,
self.lastSighted = GetTime()
end,
getFormatted = function(self) getFormatted = function(self)
-- Color by class -- Color by class
-- Format time -- Format time
return info.name .. " " .. self.lastSighted return info.name .. " " .. self.lastSighted
end end,
} }
PlayerInfo = { PlayerInfo = {
class = nil, class = nil,
@@ -73,7 +66,7 @@ function PlayerInfo:New(guid)
class = info.class, class = info.class,
race = info.race, race = info.race,
name = info.name, name = info.name,
isHostile = allianceRaces[race] ~= nil isHostile = allianceRaces[race] ~= nil,
} }
end end
o.class = info.class or "" o.class = info.class or ""

View File

@@ -1,5 +1,3 @@
aura_env.getCharges = function() aura_env.getCharges = function() return select(1, GetSpellCharges(53600)) end
return select(1, GetSpellCharges(53600))
end
aura_env.currentCharges = 0 aura_env.currentCharges = 0

View File

@@ -1,8 +1,6 @@
aura_env.findAura = function(LFname) aura_env.findAura = function(LFname)
for i = 1, 40 do for i = 1, 40 do
local name = UnitAura("player", i) local name = UnitAura("player", i)
if (name == LFname) then if name == LFname then return i end
return i
end
end end
end end