Add new Lua files and implement functions for various features

This commit is contained in:
2024-03-03 13:48:29 +01:00
parent b48cb28cb5
commit ea5269617b
10 changed files with 254 additions and 27 deletions

View File

@@ -16,15 +16,15 @@ aura_env.trackedSpells = {
local iconDisplayDuration = 0.4
local gcdDuration = 1.5
aura_env.workData = {}
aura_env.cache = {}
for k, spellId in pairs(aura_env.trackedSpells) do
aura_env.workData[spellId] = {
aura_env.cache[spellId] = {
ready = true,
hasCharges = false,
}
if GetSpellCharges(spellId) then
aura_env.workData[spellId].hasCharges = true
aura_env.workData[spellId].charges = select(1, GetSpellCharges(spellId))
aura_env.cache[spellId].hasCharges = true
aura_env.cache[spellId].charges = select(1, GetSpellCharges(spellId))
end
end
@@ -32,21 +32,21 @@ aura_env.processEvent = function(allstates)
for k, spellId in pairs(aura_env.trackedSpells) do
-- Handle spells with charges
local isReady
if (aura_env.workData[spellId].hasCharges) then
if (aura_env.cache[spellId].hasCharges) then
local charges = select(1, GetSpellCharges(spellId))
if (charges > aura_env.workData[spellId].charges) then
if (charges > aura_env.cache[spellId].charges) then
isReady = true
aura_env.workData[spellId].charges = charges
aura_env.cache[spellId].charges = charges
else
isReady = false
aura_env.workData[spellId].charges = charges
aura_env.cache[spellId].charges = charges
end
else
isReady = select(2, GetSpellCooldown(spellId)) < gcdDuration
end
if (not aura_env.workData[spellId].ready and isReady) then
if (not aura_env.cache[spellId].ready and isReady) then
local icon = select(3, GetSpellInfo(spellId))
allstates[spellId] = {
show = true,
@@ -63,6 +63,6 @@ aura_env.processEvent = function(allstates)
}
end
aura_env.workData[spellId].ready = isReady
aura_env.cache[spellId].ready = isReady
end
end