Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.88 KB | None | 0 0
  1. function(event,time,type,_,sourceGUID,_,_,_,destGUID,destname,_,_,spellid,spellname,_,_,_,_,_,_,_,_,_,_,_,_)
  2.    
  3.     if event == "COMBAT_LOG_EVENT_UNFILTERED" and sourceGUID == UnitGUID("player") then
  4.        
  5.         local Info = soulShard_timerInfo
  6.        
  7.         if type == "SPELL_AURA_APPLIED" then
  8.            
  9.             if spellid == 603 then -- doom was applied
  10.                
  11.                 local time = GetTime()
  12.                
  13.                 soulShard_timerInfo[destGUID] = {
  14.                     time, -- LastTick 1
  15.                     time + soulShard_tickLength, --DoomDuration 2
  16.                     time + soulShard_tickLength, --NextFullTick 3
  17.                     time + soulShard_tickLength, --NextTick 4
  18.                     soulShard_tickLength, --RefreshHaste 5
  19.                     soulShard_tickLength, --CurrentHastedTick 6
  20.                     destGUID, -- GUID 7
  21.                 }
  22.                 wipe(soulShard_sortedTable)
  23.                
  24.                 for _, v in pairs(soulShard_timerInfo) do
  25.                     table.insert(soulShard_sortedTable, v)
  26.                 end
  27.                 if soulShard_sortedTable and soulShard_sortedTable[2] and soulShard_sortedTable[2][4] then
  28.                     table.sort(soulShard_sortedTable, function(x,y)
  29.                             if x[4] and y[4] then
  30.                                 return x[4] < y[4]
  31.                             else return true
  32.                             end
  33.                     end)
  34.                 end
  35.             end
  36.         elseif type == "SPELL_AURA_REMOVED" or type == "SPELL_INSTAKILL" or type == "UNIT_DIED" then
  37.            
  38.             if spellid == 603 then -- doom was removed
  39.                 Info[destGUID] = nil
  40.                
  41.                 wipe(soulShard_sortedTable)
  42.                
  43.                 for _, v in pairs(soulShard_timerInfo) do
  44.                     table.insert(soulShard_sortedTable, v)
  45.                 end
  46.                 if soulShard_sortedTable and soulShard_sortedTable[2] and soulShard_sortedTable[2][4] then
  47.                     table.sort(soulShard_sortedTable, function(x,y)
  48.                             if x[4] and y[4] then
  49.                                 return x[4] < y[4]
  50.                             else return true
  51.                             end
  52.                     end)
  53.                 end
  54.             end
  55.            
  56.         elseif type =="SPELL_AURA_REFRESH" then
  57.            
  58.             if spellid == 603 then -- doom was refreshed
  59.                
  60.                 local time = GetTime()
  61.                
  62.                 Info[destGUID][5] = soulShard_tickLength
  63.                 if Info[destGUID][2] - time <= soulShard_tickLength*0.3 then -- Pandemic check, next version should take timer info from UnitDebuff()
  64.                     Info[destGUID][2] = Info[destGUID][2] + soulShard_tickLength
  65.                 else
  66.                     Info[destGUID][2] = time + soulShard_tickLength + soulShard_tickLength*0.3
  67.                 end
  68.                 -- check when the next tick will be
  69.                 if Info[destGUID][2] >= Info[destGUID][3] then
  70.                     Info[destGUID][4] = Info[destGUID][3]
  71.                 elseif Info[destGUID][2] < Info[destGUID][3] and Info[destGUID][2] - time >= soulShard_tickLength*soulShard_tickThreshold then
  72.                     Info[destGUID][4] = Info[destGUID][2]
  73.                 else
  74.                     Info[destGUID][4] = nil
  75.                 end
  76.                
  77.                 wipe(soulShard_sortedTable)
  78.                
  79.                 for _, v in pairs(soulShard_timerInfo) do
  80.                     table.insert(soulShard_sortedTable, v)
  81.                 end
  82.                
  83.                 if soulShard_sortedTable and soulShard_sortedTable[2] and soulShard_sortedTable[2][4] then
  84.                    
  85.                     table.sort(soulShard_sortedTable, function(x,y)
  86.                             if x[4] and y[4] then
  87.                                 return x[4] < y[4]
  88.                             else return true
  89.                             end
  90.                     end)
  91.                 end
  92.             end
  93.            
  94.         elseif type == "SPELL_PERIODIC_DAMAGE" then
  95.            
  96.             if spellid == 603 then -- doom ticked for damage
  97.                
  98.                 local time = GetTime()
  99.                
  100.                 Info[destGUID][6] = Info[destGUID][5]
  101.                 Info[destGUID][3] = time + Info[destGUID][6]
  102.                 Info[destGUID][1] = time
  103.                 -- check when the next tick will be
  104.                 if Info[destGUID][2] >= Info[destGUID][3] then
  105.                     Info[destGUID][4] = Info[destGUID][3]
  106.                 elseif Info[destGUID][2] < Info[destGUID][3] and Info[destGUID][2] - time >= soulShard_tickLength*soulShard_tickThreshold then
  107.                     Info[destGUID][4] = Info[destGUID][2]
  108.                 else
  109.                     Info[destGUID][4] = nil
  110.                 end
  111.                
  112.                 wipe(soulShard_sortedTable)
  113.                
  114.                 for _, v in pairs(soulShard_timerInfo) do
  115.                     table.insert(soulShard_sortedTable, v)
  116.                 end
  117.                 if soulShard_sortedTable and soulShard_sortedTable[2] and soulShard_sortedTable[2][4] then
  118.                     table.sort(soulShard_sortedTable, function(x,y)
  119.                             if x[4] and y[4] then
  120.                                 return x[4] < y[4]
  121.                             else return true
  122.                             end
  123.                     end)
  124.                 end
  125.             end
  126.         end
  127.         --[[if soulShard_timerInfo then
  128.             for k,v in pairs(soulShard_timerInfo) do
  129.                 for i,j in pairs(v) do
  130.                     if i == 4 then
  131.                         print(j, GetTime())
  132.                     end
  133.                 end
  134.             end
  135.         end]]
  136.     end
  137. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement