Kinda temporary handler for spell school absorbs. May cause side issues but should have school specific total absorb eventually.

This commit is contained in:
andrew6180
2024-09-08 11:44:49 -07:00
parent 14f904a832
commit f82040a99f
2 changed files with 27 additions and 5 deletions
+20 -3
View File
@@ -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
+7 -2
View File
@@ -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