Nenue@4: Nenue@4: local core = select(2, ...) Nenue@4: local prototypes = core.prototypes Nenue@4: local SOURCE_MASK = COMBATLOG_OBJECT_AFFILIATION_RAID+COMBATLOG_OBJECT_AFFILIATION_PARTY+COMBATLOG_OBJECT_AFFILIATION_MINE Nenue@4: Nenue@4: local dd = { Nenue@4: header = 'Damage Done', Nenue@4: } Nenue@4: dd.SPELL_DAMAGE = function(subEvent, ...) Nenue@4: local sourceGUID, sourceName, sourceFlags, _, destGUID, destName, destFlags, _, spellID, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = ... Nenue@4: Nenue@4: if not sourceName then Nenue@4: return false Nenue@4: end Nenue@4: Nenue@4: if bit.band(sourceFlags, SOURCE_MASK) == 0 then Nenue@4: --print('discarded non-raid damage event', sourceFlags, sourceName) Nenue@4: return false Nenue@4: end Nenue@4: Nenue@4: local view = core.current.view Nenue@4: view[sourceName] = view[sourceName] or {} Nenue@4: local p = view[sourceName] Nenue@4: Nenue@4: Nenue@4: p.guid = sourceGUID Nenue@4: p.last = amount Nenue@4: p.damage = (p.damage or 0) + amount Nenue@4: p.name = (sourceName or 'Unknown') Nenue@4: Nenue@4: p.child = p.child or {} Nenue@4: p.child[spellName] = p.child[spellName] or {} Nenue@4: p.child[spellName].hit = (p.child[spellName].hit or 0) + 1 Nenue@4: Nenue@4: -- true = store this event's actor Nenue@4: return true Nenue@4: end Nenue@4: Nenue@4: dd.SPELL_DAMAGE_PERIODIC = dd.SPELL_DAMAGE Nenue@4: dd.RANGE_DAMAGE = dd.SPELL_DAMAGE Nenue@4: Nenue@4: dd.SWING_DAMAGE = function(subEvent, ...) Nenue@4: local sourceGUID, sourceName, sourceFlags, _, destGUID, destName, destFlags, _, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = ... Nenue@4: local spellID, spellName, spellSchool = -1, 'Attack', 1 Nenue@4: dd.SPELL_DAMAGE(subEvent, sourceGUID, sourceName, sourceFlags, _, destGUID, destName, destFlags, _, spellID, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing) Nenue@4: end Nenue@4: Nenue@4: dd.init = function() Nenue@4: dd.maxDamage = 0 Nenue@4: end Nenue@4: Nenue@4: dd.sort = function(a, b) Nenue@4: return a.damage > b.damage Nenue@4: end Nenue@4: Nenue@4: dd.calculate = function(bar, data, actor) Nenue@4: if dd.maxDamage < data.damage then Nenue@4: dd.maxDamage = data.damage Nenue@4: end Nenue@4: Nenue@4: end Nenue@4: Nenue@4: dd.refresh = function(bar, data, actor) Nenue@4: local icon, textLeft, textRight Nenue@4: local r, g, b, a, percent = 1,1,1,1,1 Nenue@4: if actor.class and CLASS_ICON_TCOORDS[actor.classFilename] then Nenue@4: icon = { "Interface\\TargetingFrame\\UI-Classes-Circles" , CLASS_ICON_TCOORDS[actor.classFilename] } Nenue@4: end Nenue@4: textLeft = data.name Nenue@4: textRight = data.damage .. ' ('..data.last..')' Nenue@4: Nenue@4: Nenue@4: if actor.class and RAID_CLASS_COLORS[actor.classFilename] then Nenue@4: r = RAID_CLASS_COLORS[actor.classFilename].r Nenue@4: g = RAID_CLASS_COLORS[actor.classFilename].g Nenue@4: b = RAID_CLASS_COLORS[actor.classFilename].b Nenue@4: end Nenue@4: percent = (data.damage / dd.maxDamage) Nenue@4: Nenue@4: return icon, textLeft, textRight, r, g, b, a, percent Nenue@4: end Nenue@4: Nenue@4: prototypes.damageDone = dd