From d66d6d6687c31a817847c2990da6e932d5888b6e Mon Sep 17 00:00:00 2001 From: PhatDave Date: Fri, 12 Nov 2021 16:27:51 +0100 Subject: [PATCH] Absorb amount is now properly displayed --- NewAge/NullBarrier/CLEU.lua | 9 ++++++++- NewAge/NullBarrier/CustomDuration | 0 NewAge/NullBarrier/INIT.lua | 27 +++++++++++++++++++++++++++ NewAge/NullBarrier/Text.lua | 3 +++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 NewAge/NullBarrier/CustomDuration create mode 100644 NewAge/NullBarrier/Text.lua diff --git a/NewAge/NullBarrier/CLEU.lua b/NewAge/NullBarrier/CLEU.lua index e493906..4c6d995 100644 --- a/NewAge/NullBarrier/CLEU.lua +++ b/NewAge/NullBarrier/CLEU.lua @@ -1,3 +1,10 @@ function() - + if select(2, CombatLogGetCurrentEventInfo()) == "SPELL_AURA_APPLIED" then + local target = select(5, CombatLogGetCurrentEventInfo()) + local buff = select(13, CombatLogGetCurrentEventInfo()) + if target == UnitName("player") and aura_env.buffs[buff] ~= nil then + aura_env.max = select(16, CombatLogGetCurrentEventInfo()) + end + end + return true end \ No newline at end of file diff --git a/NewAge/NullBarrier/CustomDuration b/NewAge/NullBarrier/CustomDuration new file mode 100644 index 0000000..e69de29 diff --git a/NewAge/NullBarrier/INIT.lua b/NewAge/NullBarrier/INIT.lua index a3bcf60..c3aeabc 100644 --- a/NewAge/NullBarrier/INIT.lua +++ b/NewAge/NullBarrier/INIT.lua @@ -1,7 +1,34 @@ +aura_env.buffs = {"Null Barrier", "Empowered Null Barrier"} +aura_env.max = 0 + aura_env.GetBuff = function(name) for i = 1, 40 do if UnitBuff("player", i) == name then return i end end + return 0 +end + +aura_env.GetAbsorb = function(name) + local temp = select(16, UnitBuff("player", aura_env.GetBuff(name))) + if temp then return temp else return 0 end +end + +aura_env.GetAbsorbs = function() + local abs = 0 + for k, v in ipairs(aura_env.buffs) do + abs = abs + aura_env.GetAbsorb(v) + end + return abs +end + +aura_env.PrettyPrintNum = function(n) + if n > 1e6 then + return string.format("%.2fM", n / 1e6) + elseif n > 1e3 then + return string.format("%.2fk", n / 1e3) + else + return n + end end \ No newline at end of file diff --git a/NewAge/NullBarrier/Text.lua b/NewAge/NullBarrier/Text.lua new file mode 100644 index 0000000..7459d14 --- /dev/null +++ b/NewAge/NullBarrier/Text.lua @@ -0,0 +1,3 @@ +function() + return aura_env.PrettyPrintNum(aura_env.GetAbsorbs()) +end \ No newline at end of file