Download
(2Kb)
Download
Updated: 05-08-08 06:47 AM
Updated:05-08-08 06:47 AM
Created:unknown
Downloads:2,054
Favorites:2
MD5:

RCE

Version: r59
by: ganders [More]

RCE
Using RCE

Introduction
RegisterCombatEvent

Details
The point of this library is to instead of having one large COMBAT_LOG_EVENT_UNFILTERED function with if-else checks for the event type, you can "register" the event types and set a function for each one.

Where as before you might have:

Code:
function CLEU(...)
    if arg2 == "SPELL_AURA_APPLIED" then
        do stuff
    elseif arg2 == "SPELL_AURA_REMOVED" then
        do other stuff
    end
end
Now you can do:

Code:
RCE:Embed(MyFrame)

function Applied(self, ...)
    do stuff
end

function Removed(self, ...)
    do other stuff
end

function Missed(self, ...)
    do some more stuff
end

MyFrame:RegisterCombatEvent("SPELL_AURA_APPLIED", Applied)
MyFrame:RegisterCombatEvent("SPELL_AURA_REMOVED", Removed)
MyFrame:RegisterCombatEvents("SPELL_MISSED", "SPELL_CAST_FAILED", Missed)
The self in the above functions will return as the frame registered with the combat event, in this case MyFrame.

There is also no need to register the event COMBAT_LOG_EVENT_UNFILTERED to your addon, as RegisterCombatEvent will do it for you.

It is important to note that the first 2 arguments normally returned by COMBAT_LOG_EVENT_UNFILTERED (timestamp and eventType) are NOT returned using RCE. In the above functions, ... will start at the 3rd argument (source name) and carry on from there.

API
RCE:Embed(frame)
- Hook RCE's functions into your frame

:RegisterCombatEvent("event", function)
- Where "event" is any event found on http://www.wowwiki.com/API_COMBAT_LOG_EVENT

:RegisterCombatEvents("event1", "event2", "event3", function)
- Where "event" is any event found on http://www.wowwiki.com/API_COMBAT_LOG_EVENT
- :RegisterCombatEvents() will take as many events as you'd like, but only one function.

:IsCombatEventRegistered("event")
- Returns true if "event" is registered to your frame, false otherwise

Optional Files (0)


There have been no comments posted to this file.
Be the first to add one.



Category Jump: