44 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
| --GAVE UP
 | |
| --COMBAT_LOG_EVENT_UNFILTERED
 | |
| function(e, ...)
 | |
|     local se = select(2, ...)
 | |
|     if se and (se == "SPELL_DAMAGE" or se == "SPELL_PERIODIC_DAMAGE" or se == "SWING_DAMAGE") then
 | |
|         local targetguid = select(8, ...)
 | |
|         local hit = select(15, ...)
 | |
|         if se == "SWING_DAMAGE" then
 | |
|             hit = select(12, ...)
 | |
|         end
 | |
|         if targetguid and hit and targetguid == UnitGUID("target") then
 | |
|             aura_env.hitTable[#aura_env.hitTable + 1] = hit
 | |
|             aura_env.hitTimerTable[#aura_env.hitTimerTable + 1] = debugprofilestop()
 | |
|         end
 | |
|     end
 | |
|     return true
 | |
| end
 | |
| 
 | |
| --DISPLAY
 | |
| function()
 | |
|     local totalDamage = 0
 | |
|     if UnitExists("target") then
 | |
|         local thp, tmhp = UnitHealth("target"), UnitHealthMax("target")
 | |
|         for k, v in ipairs(aura_env.hitTable) do
 | |
|             totalDamage = totalDamage + v
 | |
|         end
 | |
|         return thp / (totalDamage / aura_env.lifespan)
 | |
|     end
 | |
| end
 | |
| 
 | |
| --EVERY_FRAME
 | |
| function()
 | |
|     if aura_env.hitTimerTable[1] and debugprofilestop() - aura_env.hitTimerTable[1] > aura_env.lifespan then
 | |
|         table.remove(aura_env.hitTimerTable, 1)
 | |
|         table.remove(aura_env.hitTable, 1)
 | |
|         return true
 | |
|     end
 | |
| end
 | |
| 
 | |
| --INIT
 | |
| aura_env.hitTable = {}
 | |
| aura_env.hitTimerTable = {}
 | |
| aura_env.lifespan = 5000
 |