From f82040a99f6405f041d4fcfc71ef3310353806d8 Mon Sep 17 00:00:00 2001 From: andrew6180 <16847730+andrew6180@users.noreply.github.com> Date: Sun, 8 Sep 2024 11:44:49 -0700 Subject: [PATCH] Kinda temporary handler for spell school absorbs. May cause side issues but should have school specific total absorb eventually. --- core/parser.lua | 23 ++++++++++++++++++++--- functions/spells.lua | 9 +++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/core/parser.lua b/core/parser.lua index c1c6e573..2348cbc5 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -1931,16 +1931,30 @@ end function parser:heal_absorb(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetFlags2, spellId, spellName, spellSchool, shieldOwnerSerial, shieldOwnerName, shieldOwnerFlags, shieldOwnerFlags2, shieldSpellId, shieldName, shieldType, amount) + if not amount or amount <= 0 then + return + end + if not shield_cache[targetName] or not shield_cache[targetName].absorbList then return end - local found_absorb = shield_cache[targetName].absorbList[1] + local absorbList = shield_cache[targetName].absorbList - if not found_absorb then -- we have no absorb, think dmg funcs take care of this + if not absorbList or not absorbList[1] then return end - if not amount or amount <= 0 then + local found_absorb + + for i = 1, #absorbList do + local absorb = shield_cache[targetName].absorbList[i] + if Details.IsAbsorbSpellSchool(absorb[1], spellSchool) then + found_absorb = absorb + break + end + end + + if not found_absorb then -- we have no absorb, think dmg funcs take care of this return end @@ -1969,6 +1983,9 @@ shield_cache[targetName].totalAbsorb = math.max(shield_cache[targetName].totalAbsorb - amount, 0) shield_cache[targetName][shieldSpellId][shieldOwnerName] = absorbAmount return parser:heal(token, time, shieldOwnerSerial, shieldOwnerName, shieldOwnerFlags, targetSerial, targetName, targetFlags, targetFlags2, shieldSpellId, shieldName, shieldType, amount, 0, 0, nil, true) + else + -- this absorb isnt tracked by UnitGetTotalAbsorb, probably school specific. Just award full amount + return parser:heal(token, time, shieldOwnerSerial, shieldOwnerName, shieldOwnerFlags, targetSerial, targetName, targetFlags, targetFlags2, shieldSpellId, shieldName, shieldType, amount, 0, 0, nil, true) end end diff --git a/functions/spells.lua b/functions/spells.lua index e89abe5a..75bb699a 100644 --- a/functions/spells.lua +++ b/functions/spells.lua @@ -25,8 +25,13 @@ do -- redirect AbsorbSpells to check IsAbsorbSpell - -- only true if mask = 127 (absorbs all schools/phys) - _detalhes.AbsorbSpells = setmetatable({}, { __index = function(t,k) local isAbsorb, mask = IsAbsorbSpell(k) return isAbsorb and mask == 127 end }) + _detalhes.AbsorbSpells = setmetatable({}, { __index = function(t,k) local isAbsorb, mask = IsAbsorbSpell(k) return isAbsorb end }) + + -- checks if a spell absorbs a specific school + _detalhes.IsAbsorbSpellSchool = function(spellID, school) + local isAbsorb, mask = IsAbsorbSpell(spellID) + return isAbsorb and mask and (mask == 127 or bit.contains(mask, school)) + end local allowedCooldownTypes = { --LIB_OPEN_RAID_COOLDOWNS_INFO types [1] = false, --attack