Mercurial > wow > skeletonkey
diff SkeletonStats/Views/DamageDone.lua @ 4:a30285f8191e
Units:
make sure unit frames are SecureUnitButton derivatives
remove of unnecessary target/focus events
Stats:
resolve GUID after event handlers have fired
keep frame manipulation in uf.ui, get needed values from wrapper functions
author | Nenue |
---|---|
date | Tue, 21 Jun 2016 11:56:14 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SkeletonStats/Views/DamageDone.lua Tue Jun 21 11:56:14 2016 -0400 @@ -0,0 +1,83 @@ + +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 \ No newline at end of file