annotate SkeletonStats/Views/DamageDone.lua @ 13:eeec4a600064

- kb.bindings carries the exact values needed for matching GetActionInfo() outputs
author Nenue
date Thu, 28 Jul 2016 18:20:32 -0400
parents a30285f8191e
children
rev   line source
Nenue@4 1
Nenue@4 2 local core = select(2, ...)
Nenue@4 3 local prototypes = core.prototypes
Nenue@4 4 local SOURCE_MASK = COMBATLOG_OBJECT_AFFILIATION_RAID+COMBATLOG_OBJECT_AFFILIATION_PARTY+COMBATLOG_OBJECT_AFFILIATION_MINE
Nenue@4 5
Nenue@4 6 local dd = {
Nenue@4 7 header = 'Damage Done',
Nenue@4 8 }
Nenue@4 9 dd.SPELL_DAMAGE = function(subEvent, ...)
Nenue@4 10 local sourceGUID, sourceName, sourceFlags, _, destGUID, destName, destFlags, _, spellID, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = ...
Nenue@4 11
Nenue@4 12 if not sourceName then
Nenue@4 13 return false
Nenue@4 14 end
Nenue@4 15
Nenue@4 16 if bit.band(sourceFlags, SOURCE_MASK) == 0 then
Nenue@4 17 --print('discarded non-raid damage event', sourceFlags, sourceName)
Nenue@4 18 return false
Nenue@4 19 end
Nenue@4 20
Nenue@4 21 local view = core.current.view
Nenue@4 22 view[sourceName] = view[sourceName] or {}
Nenue@4 23 local p = view[sourceName]
Nenue@4 24
Nenue@4 25
Nenue@4 26 p.guid = sourceGUID
Nenue@4 27 p.last = amount
Nenue@4 28 p.damage = (p.damage or 0) + amount
Nenue@4 29 p.name = (sourceName or 'Unknown')
Nenue@4 30
Nenue@4 31 p.child = p.child or {}
Nenue@4 32 p.child[spellName] = p.child[spellName] or {}
Nenue@4 33 p.child[spellName].hit = (p.child[spellName].hit or 0) + 1
Nenue@4 34
Nenue@4 35 -- true = store this event's actor
Nenue@4 36 return true
Nenue@4 37 end
Nenue@4 38
Nenue@4 39 dd.SPELL_DAMAGE_PERIODIC = dd.SPELL_DAMAGE
Nenue@4 40 dd.RANGE_DAMAGE = dd.SPELL_DAMAGE
Nenue@4 41
Nenue@4 42 dd.SWING_DAMAGE = function(subEvent, ...)
Nenue@4 43 local sourceGUID, sourceName, sourceFlags, _, destGUID, destName, destFlags, _, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = ...
Nenue@4 44 local spellID, spellName, spellSchool = -1, 'Attack', 1
Nenue@4 45 dd.SPELL_DAMAGE(subEvent, sourceGUID, sourceName, sourceFlags, _, destGUID, destName, destFlags, _, spellID, spellName, spellSchool, amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing)
Nenue@4 46 end
Nenue@4 47
Nenue@4 48 dd.init = function()
Nenue@4 49 dd.maxDamage = 0
Nenue@4 50 end
Nenue@4 51
Nenue@4 52 dd.sort = function(a, b)
Nenue@4 53 return a.damage > b.damage
Nenue@4 54 end
Nenue@4 55
Nenue@4 56 dd.calculate = function(bar, data, actor)
Nenue@4 57 if dd.maxDamage < data.damage then
Nenue@4 58 dd.maxDamage = data.damage
Nenue@4 59 end
Nenue@4 60
Nenue@4 61 end
Nenue@4 62
Nenue@4 63 dd.refresh = function(bar, data, actor)
Nenue@4 64 local icon, textLeft, textRight
Nenue@4 65 local r, g, b, a, percent = 1,1,1,1,1
Nenue@4 66 if actor.class and CLASS_ICON_TCOORDS[actor.classFilename] then
Nenue@4 67 icon = { "Interface\\TargetingFrame\\UI-Classes-Circles" , CLASS_ICON_TCOORDS[actor.classFilename] }
Nenue@4 68 end
Nenue@4 69 textLeft = data.name
Nenue@4 70 textRight = data.damage .. ' ('..data.last..')'
Nenue@4 71
Nenue@4 72
Nenue@4 73 if actor.class and RAID_CLASS_COLORS[actor.classFilename] then
Nenue@4 74 r = RAID_CLASS_COLORS[actor.classFilename].r
Nenue@4 75 g = RAID_CLASS_COLORS[actor.classFilename].g
Nenue@4 76 b = RAID_CLASS_COLORS[actor.classFilename].b
Nenue@4 77 end
Nenue@4 78 percent = (data.damage / dd.maxDamage)
Nenue@4 79
Nenue@4 80 return icon, textLeft, textRight, r, g, b, a, percent
Nenue@4 81 end
Nenue@4 82
Nenue@4 83 prototypes.damageDone = dd