Update
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
function()
|
||||
return aura_env.Display
|
||||
function()
|
||||
return aura_env.Display
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
-- TICKER_500
|
||||
function()
|
||||
aura_env.SoulShardStack:CleanOld()
|
||||
aura_env.AgonyStack:CleanOld()
|
||||
aura_env.UpdateDisplay()
|
||||
aura_env.SoulShards = UnitPower("player", 7)
|
||||
end
|
||||
-- TICKER_500
|
||||
function()
|
||||
aura_env.SoulShardStack:CleanOld()
|
||||
aura_env.AgonyStack:CleanOld()
|
||||
aura_env.UpdateDisplay()
|
||||
aura_env.SoulShards = UnitPower("player", 7)
|
||||
end
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
-- UNIT_POWER
|
||||
function(e, unit, power)
|
||||
if unit ~= "player" then return end
|
||||
if power ~= "SOUL_SHARDS" then return end
|
||||
local soulShards = UnitPower("player", 7)
|
||||
if soulShards == aura_env.SoulShards then return end
|
||||
if soulShards < aura_env.SoulShards then
|
||||
aura_env.SoulShards = soulShards
|
||||
return
|
||||
end
|
||||
aura_env.SoulShards = soulShards
|
||||
aura_env.SoulShardStack:Push(time())
|
||||
WeakAuras.ScanEvents("PLAY_SOUND", "Interface\\Sounds\\quack.ogg")
|
||||
-- UNIT_POWER
|
||||
function(e, unit, power)
|
||||
if unit ~= "player" then return end
|
||||
if power ~= "SOUL_SHARDS" then return end
|
||||
local soulShards = UnitPower("player", 7)
|
||||
if soulShards == aura_env.SoulShards then return end
|
||||
if soulShards < aura_env.SoulShards then
|
||||
aura_env.SoulShards = soulShards
|
||||
return
|
||||
end
|
||||
aura_env.SoulShards = soulShards
|
||||
aura_env.SoulShardStack:Push(time())
|
||||
WeakAuras.ScanEvents("PLAY_SOUND", "Interface\\Sounds\\quack.ogg")
|
||||
end
|
||||
@@ -1,14 +1,14 @@
|
||||
-- COMBAT_LOG_EVENT_UNFILTERED
|
||||
function(e, ...)
|
||||
local caster, err = CLEUParser.GetSourceName(...)
|
||||
if err then return end
|
||||
if caster ~= aura_env.PlayerName then return end
|
||||
local subevent, err = CLEUParser.GetSubevent(...)
|
||||
if err then return end
|
||||
if subevent ~= "SPELL_PERIODIC_DAMAGE" then return end
|
||||
local spellID, err = CLEUParser.GetSpellId(...)
|
||||
if err then return end
|
||||
if spellID == 980 then
|
||||
aura_env.AgonyStack:Push(time())
|
||||
end
|
||||
-- COMBAT_LOG_EVENT_UNFILTERED
|
||||
function(e, ...)
|
||||
local caster, err = CLEUParser.GetSourceName(...)
|
||||
if err then return end
|
||||
if caster ~= aura_env.PlayerName then return end
|
||||
local subevent, err = CLEUParser.GetSubevent(...)
|
||||
if err then return end
|
||||
if subevent ~= "SPELL_PERIODIC_DAMAGE" then return end
|
||||
local spellID, err = CLEUParser.GetSpellId(...)
|
||||
if err then return end
|
||||
if spellID == 980 then
|
||||
aura_env.AgonyStack:Push(time())
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,7 @@
|
||||
-- PLAYER_REGEN_DISABLED
|
||||
function()
|
||||
if aura_env.config.resetOnCombat then
|
||||
aura_env.AgonyStack:CleanOld(0)
|
||||
aura_env.SoulShardStack:CleanOld(0)
|
||||
end
|
||||
-- PLAYER_REGEN_DISABLED
|
||||
function()
|
||||
if aura_env.config.resetOnCombat then
|
||||
aura_env.AgonyStack:CleanOld(0)
|
||||
aura_env.SoulShardStack:CleanOld(0)
|
||||
end
|
||||
end
|
||||
@@ -1,58 +1,58 @@
|
||||
---@class Stack
|
||||
---@field maxSize number
|
||||
---@field values table<any>
|
||||
aura_env.Stack = {
|
||||
---@param maxSize number
|
||||
---@return Stack
|
||||
new = function(maxSize)
|
||||
local self = setmetatable({}, {
|
||||
__index = aura_env.Stack
|
||||
})
|
||||
self.maxSize = maxSize
|
||||
self.values = {}
|
||||
return self
|
||||
end,
|
||||
---@param self Stack
|
||||
---@param value number
|
||||
Push = function(self, value)
|
||||
table.insert(self.values, 0, value)
|
||||
if #self.values > self.maxSize then
|
||||
table.remove(self.values, #self.values)
|
||||
end
|
||||
end,
|
||||
---@param self Stack
|
||||
---@return number
|
||||
PerSecond = function(self)
|
||||
local first = self.values[#self.values]
|
||||
local last = time()
|
||||
|
||||
if first and last then
|
||||
return #self.values / (math.max(last - first, 1))
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
---@param self Stack
|
||||
---@param threshold number?
|
||||
CleanOld = function(self, threshold)
|
||||
local timeThresh = time() - (threshold or aura_env.config.combatMemoryTime)
|
||||
-- print(string.format("Clean %d %d", #self.values, timeThresh))
|
||||
for i = #self.values, 1, -1 do
|
||||
if self.values[i] < timeThresh then
|
||||
table.remove(self.values, i)
|
||||
end
|
||||
end
|
||||
-- print(string.format("Clean after %d", #self.values))
|
||||
end,
|
||||
}
|
||||
|
||||
aura_env.SoulShardStack = aura_env.Stack.new(aura_env.config.soulShardStackMaxSize)
|
||||
aura_env.AgonyStack = aura_env.Stack.new(aura_env.config.agonyStackMaxSize)
|
||||
aura_env.Display = ""
|
||||
aura_env.SoulShards = 0
|
||||
aura_env.PlayerName = UnitName("player")
|
||||
|
||||
aura_env.UpdateDisplay = function()
|
||||
local shards = string.format("%-8s %-7.2f/m", "Shards: ", aura_env.SoulShardStack:PerSecond() * 60)
|
||||
local agony = string.format("%-8s %-7.2f/m", "Agony: ", aura_env.AgonyStack:PerSecond() * 60)
|
||||
aura_env.Display = string.format("%s\n%s", shards, agony)
|
||||
end
|
||||
---@class Stack
|
||||
---@field maxSize number
|
||||
---@field values table<any>
|
||||
aura_env.Stack = {
|
||||
---@param maxSize number
|
||||
---@return Stack
|
||||
new = function(maxSize)
|
||||
local self = setmetatable({}, {
|
||||
__index = aura_env.Stack
|
||||
})
|
||||
self.maxSize = maxSize
|
||||
self.values = {}
|
||||
return self
|
||||
end,
|
||||
---@param self Stack
|
||||
---@param value number
|
||||
Push = function(self, value)
|
||||
table.insert(self.values, 0, value)
|
||||
if #self.values > self.maxSize then
|
||||
table.remove(self.values, #self.values)
|
||||
end
|
||||
end,
|
||||
---@param self Stack
|
||||
---@return number
|
||||
PerSecond = function(self)
|
||||
local first = self.values[#self.values]
|
||||
local last = time()
|
||||
|
||||
if first and last then
|
||||
return #self.values / (math.max(last - first, 1))
|
||||
end
|
||||
return 0
|
||||
end,
|
||||
---@param self Stack
|
||||
---@param threshold number?
|
||||
CleanOld = function(self, threshold)
|
||||
local timeThresh = time() - (threshold or aura_env.config.combatMemoryTime)
|
||||
-- print(string.format("Clean %d %d", #self.values, timeThresh))
|
||||
for i = #self.values, 1, -1 do
|
||||
if self.values[i] < timeThresh then
|
||||
table.remove(self.values, i)
|
||||
end
|
||||
end
|
||||
-- print(string.format("Clean after %d", #self.values))
|
||||
end,
|
||||
}
|
||||
|
||||
aura_env.SoulShardStack = aura_env.Stack.new(aura_env.config.soulShardStackMaxSize)
|
||||
aura_env.AgonyStack = aura_env.Stack.new(aura_env.config.agonyStackMaxSize)
|
||||
aura_env.Display = ""
|
||||
aura_env.SoulShards = 0
|
||||
aura_env.PlayerName = UnitName("player")
|
||||
|
||||
aura_env.UpdateDisplay = function()
|
||||
local shards = string.format("%-8s %-7.2f/m", "Shards: ", aura_env.SoulShardStack:PerSecond() * 60)
|
||||
local agony = string.format("%-8s %-7.2f/m", "Agony: ", aura_env.AgonyStack:PerSecond() * 60)
|
||||
aura_env.Display = string.format("%s\n%s", shards, agony)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user