Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-05-07, 12:00 AM   #1
Pastamancer
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 17
CastCommLib: a library for communicating spell casts and their targets

BSD-licensed, tiny, locale-independent, no dependencies, embeds nicely.

I'm looking for feedback from other addon developers and hoping to get addons other than Grid using it .

Get it here: http://grid.13th-floor.org/svn/trunk...astCommLib.lua

Code:
--[[ DOCUMENTATION
Description:

CastCommLib is an embedded library for communicating spell casts and their
targets using the AddonMessage channel.  Addons can register with CastCommLib
to receive notification of these messages.

CastCommLib will use ChatThrottleLib if it is available.

API:

CastCommLib:RegisterCallback(key, func)
-- Adds a callback funciton to be invoked when a spell event is received
--
-- If key is a table, then func must be a string and the callback will be
-- invoked as:
--   key[func](key, sender, senderUnit, action, target, channel, spell, rank,
--             displayName, icon, startTime, endTime, isTradeSkill)
-- otherwise func must be a function and will be invoked as:
--   func(sender, senderUnit, action, target, channel, spell, rank,
--        displayName, icon, startTime, endTime, isTradeSkill)
--
-- string sender:
--   the name of the character that sent the event
-- string senderUnit:
--   the unitid of the character that sent the event
-- string action:
--   one of "START", "DELAYED", "INTERRUPTED", "FAILED", "SUCCEEDED",
--          "CHANNEL_START", "CHANNEL_UPDATE", or "CHANNEL_STOP".
--   depending on the event that caused the message to be sent
-- string target:
--   the name of the target for the spell
-- boolean channel:
--   if the spell is channeled
-- string spell:
--   the name of the spell
-- string rank:
--   the rank of the spell
-- string displayName:
--   the name of the spell (not sure how this differes from spell, but it's
--                          from UnitCastingInfo())
-- string icon:
--   the path to the texture for the spell
-- number startTime:
--   the time the spell started casting/channeling
-- number endTime:
--   the time the spell will finish casting/channeling
-- boolean isTradeSkill:
--   if the spell is a tradeskill
--
-- Usage:
--   CastCommLib:RegisterCallback(MyAddon, "CastCommLib")
-- or
--   CastCommLib:RegisterCallback("MyAddon", OnCastCommLibReceived)


CastCommLib:UnregisterCallback(key)
-- Removes the callback function specified by key
--
-- Usage:
--   CastCommLib:UnregisterCallback(MyAddon)
-- or
--   CastCommLib:UnregisterCallback("MyAddon")

CastCommLib:GetUnitId(name)
-- returns the cached unitid for the specified name

CastCommLib:IterateGroupMembers(name)
-- returns an iterator suitable for use with for
-- return values for each iteration is the name of the next person in the
-- specified person's group

CastCommLib:GetCastingInfo(name)
-- returns target, channel, spell, rank, displayName, icon, startTime, endTime,
--         isTradeSkill
--
-- See CastCommLib:RegisterCallback for details

CastCommLib:Enable()
-- Enables the library.  You probably shouldn't be calling this.

CastCommLib:Disable()
-- Disables the library.  You probably shouldn't be calling this.

CastCommLib:ToggleDebugging(on)
-- Enables, disables, or toggles the debugging state of CastCommLib
--
-- If on is nil, the debugging state will be toggled, otherwise it will be set
-- to the value of on.

--]]

Last edited by Pastamancer : 01-11-07 at 08:17 AM. Reason: Updated documentation
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » CastCommLib: a library for communicating spell casts and their targets


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off