Files
wow-weakauras/FreshShit/RayOfHope/trigger2.lua
2025-05-15 20:37:58 +02:00

123 lines
3.3 KiB
Lua

-- COMBAT_LOG_EVENT_UNFILTERED
function(
allstates,
event,
timestamp,
eventtype,
hideCaster,
srcGUID,
srcName,
srcFlags,
srcRaidFlags,
dstGUID,
dstName,
dstFlags,
dstRaidFlags,
...
)
local rayActive = aura_env.rayActive
if aura_env.debug then rayActive = true end
if rayActive and (eventtype == "SPELL_ABSORBED" or eventtype == "SPELL_HEAL_ABSORBED") then
local spellID, spellName, spellSchool, aSrcGUID, aSrcName, _, _, aSpellID, aSpellName, aSpellSchool, aSpellAmountAbsorbed, somebullshit, horseshit =
...
local function debuggerprinter()
if aura_env.debug then
local str = string.format(
"event: %s, timestamp: %s, eventtype: %s, hideCaster: %s, srcGUID: %s, srcName: %s, dstGUID: %s, dstName: %s, spellID: %s, spellName: %s, spellSchool: %s, aSpellAmountAbsorbed: %s, somebullshit: %s, horseshit: %s",
tostring(event),
tostring(timestamp),
tostring(eventtype),
tostring(hideCaster),
tostring(srcGUID),
tostring(srcName),
tostring(dstGUID),
tostring(dstName),
tostring(spellID),
tostring(spellName),
tostring(spellSchool),
tostring(aSpellAmountAbsorbed),
tostring(somebullshit),
tostring(horseshit)
)
print(str)
end
end
-- Ray absorbed heal
-- srcName = Player
-- dstName = RoH Target
-- spellID = RoH spellID
-- aSrcName = Absorbed Heal Caster
-- aSpellID = Absorbed Heal SpellID
-- aSpellAmountAbsorbed = duh;
if eventtype == "SPELL_HEAL_ABSORBED" then
if aura_env.debug then spellID = 197268 end
if srcGUID == UnitGUID("player") and spellID == 197268 then
debuggerprinter()
if aura_env.debug then
local str = string.format(
"Ray of Hope absorbed %s's heal, %s, for %d.",
aSrcName,
aSpellName,
aSpellAmountAbsorbed
)
print(str)
end
aura_env.totalHealAbsorb = aura_env.totalHealAbsorb + aSpellAmountAbsorbed
return true
end
end
-- Ray absorbed dmg
-- srcName = enemy
-- dstName = RoH Target
-- spellID = Spell Absorbed spellID
-- spellName = Spell Absorbed Name
-- aSrcName = Player
-- aSpellID = RoH spellID
if eventtype == "SPELL_ABSORBED" then
if aura_env.debug then aSpellID = 197268 end
if aSrcGUID == UnitGUID("player") and aSpellID == 197268 then
debuggerprinter()
if aura_env.debug then
local str = string.format(
"Ray of Hope absorbed %s's damage, %s, for %d.",
srcName,
spellName,
aSpellAmountAbsorbed
)
print(str)
end
aura_env.totalDmgAbsorb = aura_env.totalDmgAbsorb + aSpellAmountAbsorbed
return true
end
end
end
-- Ray expire
if aura_env.rayActive and eventtype == "SPELL_AURA_REMOVED" then
local spellID = ...
if spellID == 197268 and srcGUID == UnitGUID("player") then
if aura_env.debug then
print("Ray removed.")
print("RoH heals taken: ", aura_env.totalHealAbsorb)
print("RoH dmg taken: ", aura_env.totalDmgAbsorb)
-- 1.5 represents the 50% modifier to heals into ray
local net = aura_env.totalHealAbsorb * 1.5 - aura_env.totalDmgAbsorb
local colorString = ""
if net > 0 then
colorString = string.format("|cff00ff00%d|r", net)
else
colorString = string.format("|cffff0000%d|r", net)
end
print("Net: ", colorString)
end
aura_env.rayActive = false
end
end
end