(5 Kb)
Updated: 10-03-06 09:09 AM
Updated:10-03-06 09:09 AM
Cirk's Eventlogger
Version: v1.12.0
by: Cirk [More]
Note that this is a developer tool, and doesn't provide any end-user functionality

Have you ever wanted to write a combat log parser (of any sort) and just didn't know which events to look for?

Eventlogger is a very simple addon that runs silently (or nearly) in the background, collecting data on which events correspond to which combat strings, and saving this into Eventlogger's SavedVariables file (i.e., there is no ingame output at all). After its been running for a while (and I recommend running it in a few raids, doing quests, PvP, battlegrounds, etc., to make sure you have a good sample of event data) you can look in the Eventlogger.lua in your SavedVariables folder, and look for what you are interested in.

Eventlogger's SavedVariables data
Eventlogger stores events and their corresponding format strings in two ways - indexed by event in the subtable EventloggerState.Events (so you can see all the format strings corresponding to a specific event) and indexed by format string in the subtable EventloggerState.FormatStrings (so you can see what events correspond to a specific format string). Each table entry contains an example text string to help you determine what the various %s's and %d's in the format string are actually used for.

As an example, this might look something like:
EventLoggerState = {
  ["FormatStrings"] = {
      ["CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE"] = "Greater Plainstrider performs Dazed on you.",
      ["CHAT_MSG_COMBAT_CREATURE_VS_PARTY_MISSES"] = "Rage Talon Captain attacks. Vean blocks.",
      ["CHAT_MSG_COMBAT_FRIENDLYPLAYER_MISSES"] = "Barnswallow attacks. Lava Annihilator blocks.",
      ["CHAT_MSG_COMBAT_HOSTILEPLAYER_MISSES"] = "Scurrvy attacks. Dgswarrior blocks.",
      ["CHAT_MSG_COMBAT_PARTY_MISSES"] = "Feliciana attacks. Onyxia blocks.",
      ["CHAT_MSG_COMBAT_PET_MISSES"] = "Hathkresh attacks. Green Recluse blocks.",
      ["CHAT_MSG_COMBAT_CREATURE_VS_CREATURE_MISSES"] = "Flamewaker Elite attacks. Thunderous blocks.",
  ["Events"] = {
      ["SPELLPOWERLEECHOTHERSELF"] = "Moam's Drain Mana drains 500 Mana from you. Moam gains 1000 Mana.",
      ["SIMPLEPERFORMOTHERSELF"] = "Greater Plainstrider performs Dazed on you.",
      ["SIMPLEPERFORMOTHEROTHER"] = "Flesh Eater performs Dazed on Hathkresh.",
      ["SPELLIMMUNEOTHERSELF"] = "Magmadar's Panic failed. You are immune.",
      ["SPELLLOGSCHOOLOTHERSELF"] = "Scalding Broodling's Fireball hits you for 201 Fire damage. (74 resisted)",
      ["SPELLINTERRUPTOTHERSELF"] = "Molten Destroyer interrupts your Heal.",
      ["SPELLPARRIEDOTHEROTHER"] = "Skeletal Warrior's Hamstring was parried by Hathkresh.",
      ["SPELLDODGEDOTHERSELF"] = "Defias Henchman's Shield Slam was dodged.",
      ["SPELLBLOCKEDOTHERSELF"] = "Defias Watchman's Shoot was blocked.",
      ["SPELLDODGEDOTHEROTHER"] = "Mottled Scytheclaw's Rend Flesh was dodged by Hathkresh.",
      ["SPELLPARRIEDOTHERSELF"] = "Riverpaw Bandit's Backstab was parried.",
      ["SPELLLOGSCHOOLOTHEROTHER"] = "Skeletal Mage's Frostbolt hits Hathkresh for 66 Frost damage.",
      ["SPELLLOGOTHEROTHER"] = "Skeletal Warrior's Hamstring hits Hathkresh for 35.",
      ["SPELLMISSOTHEROTHER"] = "Dragonmaw Grunt's Shield Slam missed Hathkresh.",
      ["SPELLLOGOTHERSELF"] = "Molten Destroyer's Massive Tremor hits you for 975.",
      ["SPELLRESISTOTHEROTHER"] = "Thunderhead's Lizard Bolt was resisted by Hathkresh.",
      ["SPELLRESISTOTHERSELF"] = "Black Broodling's Fireball was resisted.",
      ["SPELLLOGABSORBOTHERSELF"] = "You absorb Black Broodling's Fireball.",
      ["SIMPLECASTOTHERSELF"] = "Forlorn Spirit casts Polymorph on you.",
      ["SPELLMISSOTHERSELF"] = "Molten Giant's Smash misses you.",
  ["Enabled"] = 1,
Which, as you can imagine, tells you quite a lot about which events correspond to which combat log messages. For example, in the above snippet, some of the format strings for the CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE event only make sense if you realize that Hathkresh is the name of one of my Warlock's pets (i.e., damage to a pet is signalled in the damage to self events, but using a damage to other format strings).

Eventlogger slash commands
All the /eventlogger slash command allows you to do is turn it on or off (which is a global state, irrespective of realm or character). Turning Eventlogger off will make it remove all the indices it added to the format strings and unregister from all its events, so once disabled, you don't even need to remove the addon if you don't want to (although of course you can save some memory that way).

Eventlogger's implementation
To ensure that Eventlogger can simply and most importantly quickly match combat log text with the corresponding format string, Eventlogger appends a small string containing an index onto the end of every global string that it is told to look for. By changing the global string values themselves, Eventlogger can easily identify which format string was used to generate each line of combat text with minimal parsing. For example, Eventlogger would change the COMBATHITOTHERSELF format string from "%s hits you for %d." to "%s hits you for %d. <022>".

The downside to this is that you will see this in every combat log message written to your chat frames, although you can also quite quickly learn to tune it out. (One possible improvement would be to have Eventlogger hook the ChatFrame_OnEvent function and strip the index string off the end of any matching text strings). You will also see these index strings written into your WoWCombatLog.txt file if you have combat logging enabled.

Note that Eventlogger's overall implementation is pretty basic - it uses a table that holds the various combat log format strings that are of interest (basically copied from GlobalStrings.lua) and another table that contains possible events for which those strings might be matched (copied from the ChatTypeGroup assignments in ChatFrame.lua). There are probably easier ways of doing this (including just having Eventlogger register for all events), and if you think its worthwhile making any changes or improvements, feel free to post them here!

Making use of the Eventlogger data
If you are writing a combat log parser, you can make an immediate improvement in performance by only checking for the format patterns that correspond to an event, rather than checking all possible patterns for each event received, and the data that Eventlogger collects allows you to easily (and robustly) correlate this information.

Forwards compatibility
Probably the biggest problem you might face with writing a combat log event parser is the fact that Blizzard might just go ahead and change the association between the combat log events and format strings. To minimize the risk of missing such a change, you could have Eventlogger periodically rebuild all its data (i.e., delete its saved variables after a new patch) and then check that the event and format string associations are as you still expect them to be. If you are only interested in specific format strings (e.g., damage to your own character, or healing done, etc.) then just trim down the list of format strings in Eventlogger.lua's _formatStrings table to make it easier to check the event associations.

Hope you find it useful!
-- Cirk
Optional Files (0)

Post A Reply Comment Options
Old 10-03-06, 05:03 PM  
A Pyroguard Emberseer
Mazzlefizz's Avatar
AddOn Author - Click to view AddOns

Forum posts: 3521
File comments: 60
Uploads: 2
Awesome as usual, Cirk! This will help me better configure SimpleCombatLog. (Wait a second. That's kinda like an end-user benefit )
MazzleUI Home Page:
Info, FAQs, Forums, Download can be found at that link.
Mazzlefizz is offline Report comment to moderator  
Reply With Quote
Post A Reply

Category Jump: