Luna is a developers tool for handling addon commutation between players. It allows any addon to register with it and send messages that go out over a single private chat channel and then returns any messages it sees for that addon. Messages will be added to a queue and be sent out one at a time in 2 second intervals to avoid the spam filter. This means that Luna is not for time sensitive messages or for rapid sending, but for syncing of data like resource node locations or quest data. It is inspired by the old Sky addon from WoW and as such has been named Luna to be a companion for Sol.
1) Automatically connects to the Luna private channel to allow for the communication of your addon with other users of the addon
2) Register your addon's name and a function that the messages will be returned to
3) Queues messages to be sent at a first come first serve basis in 2 second intervals, to avoid the spam filter
4) Automatically breaks up long messages into multiple packets and recombines them on the other end
5) Adds messages into the body of a link so that the only text that appears in the ingame chat is <addonname>, though the channel is hidden by default
6) If a received message is for an addon you have registered, then it will send the sender's name and message to the function you registered
7) You can register and unregister addons at any time after "VARIABLES_LOADED"(any sooner could be to soon), to allow for optional configuration of your addons
8) Luna will tell you when a newer version is out
9) Luna currently works for all clients.
Ideas for Addons that would use Luna
1) add to Advanced Quest Book the ability to seen and receive quest dumps for users with quest dumper enabled
2) mob or boss drop loot table with the ability to send purple+ drop info to all users to allow large and accurate loot tables with percentages without having to manually create a database.
3) added to ygather to send resource node locations out to everyone
4) any addon could use it as an optional dependancy to tell there users when a newer version is available
Instructions for Addon Developers
(replace anything inside <> with your info)
DO NOT add this addon's files into your addon, add it as a dependency in curseforge and label it as a dependency on your addons description
register the event "VARIABLES_LOADED"
add this into your onevent function
if event == "VARIABLES_LOADED" then if Luna then Luna.RegisterAddon(<addonname>, <function_that_messages_are_returned_to>) else <do whatever you need to if Luna is not found, to prevent errors> DEFAULT_CHAT_FRAME:AddMessage("Luna not found, failed to register <addonname>") end end
use this command to send a message out
add this to handle receiving messages from others
function <function_that_messages_are_returned_to>(sendername, message) <do whatever with your message> end
note: messages and addonnames are strings, " and | characters will break the message, do not use them.
if you would like to unregister your addon then use this command
Much of this code was inspired or rewritten from Alleris2_0's AddonManager and Vlocka's ModTrader. A big thanks goes to you two for your coding genesis.
- Date created
- Sep 08, 2009
- Last update
- Dec 03, 2010
- Development stage
- GNU General Public License version 3 (GPLv3)
- Curse link
- Reverse relationships
- Recent files