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