Note: Total rewrite of the start post. Mod is uploaded to the Beta interface section, will update when it's available / posted.
Download
Complete documentation is on
http://digibites.net/wiki/mcp/start. The following are excepts taken from it:
Miles Combat Parser
Miles Combat Parser is a generic parser module for combatlog events. The basics are to extract information from the text of events, to something that programs can easily understand. For example, "You hit Target for 400." will be translated to a "Melee" event, with { "You", "Target", 300 } as parameters.
The need for a generic parser
A lot of mods, but mostly recap, damagemeters and combatlogs, listen to such events. Currently, every one of those tries to match the text events into something they can understand. Except for the complication of parsing all the events (~1k lines for a nearly complete ruleset), this parsing also consumes quite a lot of cpu resources. Instead of everyone parses their own, I've decided to create a easy to understand and extend mod to do all this, so mods can concentrate on doing what they do the best, whether it is to display it, record stats or something else.
Design goals
Because of the nature of event processing, and other mods depending on it, I have set a few goals for MCP:
* Speed - Text processing is realtime, compared to waiting for stuff to load / be done, parsing has to be done *right now*, and without introducing lag or delays. Goal in this addon is to have a worst case delay of 0.2ms / 5000 msg/sec, an overhead of 10x above a plain string.find. Benchmark by replaying a Ragnaros and ZG fights shows the parser reaches 16k msg/sec - totally unnoticible in game, or 1 sec lag when you see the whole Ragnaros fight at once after a uber-lagspike :P
* Complete - I aim for a 100% completeness of all possible combatlog strings, including the exotic ones I never seen before, like "%s loses %d health for swimming in slime."
* Universal - It's *very* easy to write addons that listen to events fired by the parser, an example is posted for watching HoT's in SpellTimers. Integration with Recap, MilesCombatLog, and some other parsing-heavy mods will be added, hopefully starting a chain of events leading to exchangeble parsers who parses, and addons which processes the events, instead of regex everything everywhere.
* Standard compliant - Should there ever be a parsing output standard, it will be compliant with it.
Events in MCP
Events in MCP are catagorized into 11 main groups, namely:
Code:
Heal = "Heal", -- caster, target, spell, amount, crit, ishot
Aura = "Aura", -- target, aura, fade, harmful, replaced
Melee = "Melee", -- caster, target, amount, crit, school
Spell = "Spell", -- caster, target, spell, amount, crit, school, isdot
Cast = "Cast", -- caster, spell, begin
Dot = "Spell", -- caster, target, spell, amount, crit, school, isdot
Miss = "Miss", -- caster, target, spell, type (Caster Spell Target Resist, example Ragnaros Lava Burst You Resist)
Reflect = "Reflect", -- caster, target, damage, type
Interrupt = "Interrupt", -- who, target, spell
Env = "Environment", -- who damage type
Death = "Death", -- who killer
It's represents the 11 basic types of messages you can get in WoW.
Listening to Events
Subscribing to MCP is quite simple, for example, if you want to print the "Miss" type messages in ChatFrame1, you can do it with a few lines.
Code:
function FormatMiss(v)
-- caster, target, spell, type
-- (format: Caster Spell Target Resist, expample: Ragnaros Lava Burst You Resist)
if (not v[3]) then v[3] = "Attacks" end
ChatFrame1:AddMessage(string.format("%s %s %s %s", v[1], v[3], v[2], v[4]));
end
MilesCombatParser.addListener("Miss", "MissPrinter", FormatMiss);
When a "Miss" occures, your function will be called with the parameters, "caster, target, spell, type" in a table. Optionally, you can declare a second parameter, function bla(v, t) will be supplied the type of the event too.
--
This mod will enable much easier processing of combat information, enabling a whole new world of possibilities. Next thing on my todo is to integrate it further in MilesSpellTimers (not released yet), a mod used for starting timers at OnCast events, and for timing Healing over Time events with MCP.
Renew from Kupo on Kupo, with a 35 hp tick strength, 10 seconds left.
No more 'how many tick do I have on pain?' :P