#!/usr/bin/env lua actors = {}; timeLimit = 5; minimumTime = 1.5; reqFireball = false; function ProcessLine(l) if l:find("SPELL_DAMAGE.*Frostbolt") then local delta; local h,m,s,ms,source,target = l:match([[.+ (..):(..):(..).(...) .+"(.+)".+"(.+)".+"Frostbolt"]]); --print(h,m,s,ms,source,target); if source then local t = (ms + 1000 * (s + 60 * (m + 60 * h))) / 1000; local entry = actors[source]; if entry then delta = t - entry.last; -- print(delta, fireball); if entry.fireball == reqFireball and delta < timeLimit and delta > minimumTime then entry.count = entry.count + 1; entry.cum = entry.cum + delta; else delta = nil; end entry.last = t; entry.fireball = false; else actors[source] = { last = t, count = 0, cum = 0, fireball = false }; end end elseif l:find("SPELL_DAMAGE.*Fireball") then local h,m,s,ms,source,target = l:match([[.+ (..):(..):(..).(...) .+"(.+)".+"(.+)".+"Fireball"]]); if actors[source] then actors[source].fireball = true; end end end function ShowResults(title) print(); print(title, "Intervals per source:"); for name, entry in pairs(actors) do if entry.count > 0 then local avg = math.floor(entry.cum / entry.count * 10000)/10000; print(entry.count, avg, name); end end end function RunAnalysis(logName, timeLimitOption) local fileName = logName or "WoWCombatLog.txt"; if timeLimitOption then timeLimit = tonumber(timeLimitOption) end local f = io.open(fileName, "r"); if f then repeat line = f:read(); if line then -- print(line); ProcessLine(line); end until not line; f:close(); else print("Unable to open the requested file:", fileName); end end reqFireball = false; RunAnalysis(...); ShowResults("Frostbolt:"); reqFireball = true; actors = {}; sources = {}; RunAnalysis(...); ShowResults("Combos:"); print();