So, I have a small mod I wrote to track "failures" and related events for Vengeful Shades on H. Deathwhisper. Anyways, I have it setup at the moment to announce when people get melee by the ghosts (which corresponds to being too close), when they are summoned, and when people take damage. For the latter two events, I wanted to condense them because they have multiple combat log events (multiple shades and multiple people taking damage).
I'm not sure what the "best practice" is for throttling such events, or if it would have to be a simple time delay. I'm sorry if this code is a travesty, I'm not a programmer by trade or hobby.
Code:
function WWH:OnCombatEvent(event, timestamp, eventType, srcGuid, srcName, srcFlags, dstGuid, dstName, dstFlags, ...)
local pName = dstName or "wat"
local colorpName = self:GetClassColor(pName) .. pName
local hour, minute = GetGameTime()
local ts = "[" .. hour .. ":" .. minute .. "] "
-- Spirit Summon
if ( eventType == "SPELL_SUMMON" ) then
local spellID, spellName, spellSchool = select(1, ...)
if ( spellName == "Summon Spirit" ) then
local summonEntry = ts .. ": |cffFCD116Spirits Summoned"
table.insert(WWH.historyBuffer, summonEntry)
WWH.Summoned = WWH.Summoned + 1
end
end
-- Failure
if ( eventType == "SWING_DAMAGE" or "SWING_MISSED" ) and ( srcName == "Vengeful Shade" ) then
local failEntry = ts .. colorpName .. ": |cff00FF00failed at Vengeful Spirits|r"
local ChannelDump = ts .. pName .. ": failed at Vengeful Spirits"
table.insert(WWH.historyBuffer, failEntry)
if (self.db.global.LiveReport) then
self:Print(failEntry)
end
if (self.db.global.RaidAnnounce) then
local msg = pName .. " FAILED at Ghosts"
SendChatMessage(msg, "RAID_WARNING")
end
if (self.db.global.ChannelDump) then
SendChatMessage(ChannelDump, db.ChannelDumpOutput)
end
end
-- Damage Taken from Explosion
if ( eventType == "SPELL_DAMAGE" and srcName == "Vengeful Shade" ) then
local dmgEntry = ts .. colorpName .. ": |cff008000took damage from ghosts"
table.insert(WWH.historyBuffer, dmgEntry)
-- used for compressed dmg taken raid announcing
WWH.lasteventwasghostdmg = true
if (WWH.whotookdmg == "") then
WWH.whotookdmg = pName
else
WWH.whotookdmg = WWH.whotookdmg .. ", " .. pName
end
end
-- Reduce who took raid damage spam
if ( WWH.lasteventwasghostdmg == true and eventType ~= "SPELL_DAMAGE" and srcName ~= "Vengeful Shade" ) then
if (self.db.global.RaidAnnounce) then
local msg = WWH.whotookdmg .. " took damage from ghosts"
SendChatMessage(msg, "RAID")
end
if (self.db.global.ChannelDump) then
local ChannelDump = ts .. WWH.whotookdmg .. " took damage from ghosts"
SendChatMessage(ChannelDump, db.ChannelDumpOutput)
end
if (self.db.global.LiveReport) then
self:Print(WWH.whotookdmg .. " took damage from ghosts")
end
WWH.lasteventwasghostdmg = false
WWH.whotookdmg = ""
end
-- only use summon warning once
if ( eventType ~= "SPELL_SUMMON" and WWH.Summoned > 1 ) then
WWH.Summoned = 0
end
if ( WWH.Summoned == 1 ) then
if (self.db.global.RaidAnnounce) then
SendChatMessage("INCOMING GHOSTS!", "RAID_WARNING")
end
if (self.db.global.LiveReport) then
local summonEntry = ts .. ": |cffFCD116Spirits Summoned"
self:Print(summonEntry)
end
end
end