Mercurial > wow > skeletonkey
view SkeletonStats/Views/DamageDone.lua @ 5:9ac29fe77455
- dynamic profession spell mapping
- dynamic talent spell mapping
- protection of dynamic slots that aren't in use
- plugin abstractors for accessing state data
- a lot of fixes related to the 7.0.3 API
author | Nenue |
---|---|
date | Tue, 26 Jul 2016 19:29:44 -0400 |
parents | a30285f8191e |
children |
line wrap: on
line source
local core = select(2, ...) local prototypes = core.prototypes local SOURCE_MASK = COMBATLOG_OBJECT_AFFILIATION_RAID+COMBATLOG_OBJECT_AFFILIATION_PARTY+COMBATLOG_OBJECT_AFFILIATION_MINE local dd = { header = 'Damage Done', } dd.SPELL_DAMAGE = function(subEvent, ...) local sourceGUID, sourceName, sourceFlags, _, destGUID, destName, destFlags, _, spellID, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = ... if not sourceName then return false end if bit.band(sourceFlags, SOURCE_MASK) == 0 then --print('discarded non-raid damage event', sourceFlags, sourceName) return false end local view = core.current.view view[sourceName] = view[sourceName] or {} local p = view[sourceName] p.guid = sourceGUID p.last = amount p.damage = (p.damage or 0) + amount p.name = (sourceName or 'Unknown') p.child = p.child or {} p.child[spellName] = p.child[spellName] or {} p.child[spellName].hit = (p.child[spellName].hit or 0) + 1 -- true = store this event's actor return true end dd.SPELL_DAMAGE_PERIODIC = dd.SPELL_DAMAGE dd.RANGE_DAMAGE = dd.SPELL_DAMAGE dd.SWING_DAMAGE = function(subEvent, ...) local sourceGUID, sourceName, sourceFlags, _, destGUID, destName, destFlags, _, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = ... local spellID, spellName, spellSchool = -1, 'Attack', 1 dd.SPELL_DAMAGE(subEvent, sourceGUID, sourceName, sourceFlags, _, destGUID, destName, destFlags, _, spellID, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing) end dd.init = function() dd.maxDamage = 0 end dd.sort = function(a, b) return a.damage > b.damage end dd.calculate = function(bar, data, actor) if dd.maxDamage < data.damage then dd.maxDamage = data.damage end end dd.refresh = function(bar, data, actor) local icon, textLeft, textRight local r, g, b, a, percent = 1,1,1,1,1 if actor.class and CLASS_ICON_TCOORDS[actor.classFilename] then icon = { "Interface\\TargetingFrame\\UI-Classes-Circles" , CLASS_ICON_TCOORDS[actor.classFilename] } end textLeft = data.name textRight = data.damage .. ' ('..data.last..')' if actor.class and RAID_CLASS_COLORS[actor.classFilename] then r = RAID_CLASS_COLORS[actor.classFilename].r g = RAID_CLASS_COLORS[actor.classFilename].g b = RAID_CLASS_COLORS[actor.classFilename].b end percent = (data.damage / dd.maxDamage) return icon, textLeft, textRight, r, g, b, a, percent end prototypes.damageDone = dd