LibCombatLogEvent-1.0

This project is experimental.

This project is only experimental and may change drastically between now and when it comes out of experimental status. It may even be disapproved once that happens, worst-case.

Be forewarned before downloading anything from this project.

LibCombatLogEvent-1.0 dispatchs combat log events using CallbackHandler-1.0, passing along a table with the event arguments. It integrates nicely with AceAddon-3.0 addons and use an efficient argument parsing.

AceAddon-3.0 integration

Quite simple, here is a basic sample:

local myAddon = LibStub('AceAddon-3.0'):NewAddon("foo", "LibCombatLogEvent-1.0")

function myAddon:OnEnable()
  self:RegisterCombatLogEvent("UNIT_DIED")
end

function myAddon:UNIT_DIED(event, eventArgs)
  print("Oh noes !", eventArgs.destName, "died !")
end

No need to unregister the event in OnDisable, the library takes care of it.

Callbacks

The library is based on CallbackHandler-1.0. The callback names are the COMBAT_LOG_EVENT_UNFILTERED (CLEU) event names.

:RegisterCombatLogEvent

myAddon:RegisterCombatLogEvent("eventName"[, methodNameOrFunc[, arg]])
library.RegisterCombatLogEvent(myTable, "eventName"[, methodNameOrFunc[, arg]])
library.RegisterCombatLogEvent("myAddonId", "eventName"[, func[, arg]])

Register a callback for the given myAddon/myTable/"myAddonId" and CLEU event.

The callback should have one of the following signatures:

function myAddon:method([arg, ]event, eventArgs)
function myTable:method([arg, ]event, eventArgs)
function func([arg, ]event, eventArgs)

:UnregisterCombatLogEvent

myAddon:UnregisterCombatLogEvent("eventName"[, methodNameOrFunc[, arg]])
library.UnregisterCombatLogEvent(myTable, "eventName"[, methodNameOrFunc[, arg]])
library.UnregisterCombatLogEvent("myAddonId", "eventName"[, func[, arg]])

Unregister the myAddon/myTable/"myAddonId" callback for the given event.

:UnregisterAllCombatLogEvents

myAddon:UnregisterAllCombatLogEvents()
library.UnregisterAllCombatLogEvents(myTable)
library.UnregisterAllCombatLogEvents("myAddonId")

Unregister all myAddon/myTable/"myAddonId" callbacks.

The eventArgs table

The event table is filled with the parameters of the COMBAT_LOG_EVENT_UNFILTERED event. For convenience, these positional parameters are mapped to named ones using this page: http://www.wowpedia.org/API_COMBAT_LOG_EVENT.

Important: the passed eventArgs is a table shared amongst all callbacks and reused on subsequent callbacks. Do not modifiy it or store a reference to it. If you absolutely need to modify it or keep the values, make a copy first.

For example, for the SPELL_MISS event, the table would be it was defined that way:

eventArgs  = {
  event = "SPELL_MISS",
  timestamp = ...,
  sourceGUID = ...,
  sourceName = ...,
  sourceFlags = ...,
  destGUID = ...,
  destName = ...,
  destFlags = ...,
  spellId = ...,
  spellName = ...,
  spellSchool = ...,
  missType = ...,
  amountMissed = ...
}

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Mar 15, 2011
Categories
Last update
Mar 15, 2011
Development stage
Inactive
Language
  • deDE
  • enUS
  • esES
  • esMX
  • frFR
  • koKR
  • ruRU
  • zhCN
  • zhTW
License
BSD License
Downloads
37
Recent files

Authors