View Single Post
01-10-22, 04:46 PM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Assuming addon should respect individual player options, ie if the player has disabled announces or has them routed to their local chatframe as an example they shouldn't announce.

What I'd do is.
1. Monitor GROUP_JOINED GROUP_FORMED and GROUP_LEFT events.
2. When your addon detects that you joined a group (check with IsInGroup) it sends a single SendAddonMessage with distribution RAID (this will automatically go to PARTY if you are in a 5man) that essentially says "hey I have calloutAddon with announces on" C_ChatInfo.SendAddonMessage("calloutPrefix", "yourversion;announcestatus", "RAID")
3. You also send this message if you are in a group and you changed your announce option from ON to OFF or vice versa)
4. You also register your prefix to receive messages from other instances of your addon. Any time you receive a message from another player in your group, you update a table with players having your addon with announce "on".
5. You sort that table alphabetically. Any instance of the addon does a simple check "am I the player that's first on the list?" If yes > call out. If not > mute.
6. Each instance of the addon also monitors for players leaving the group. If it was one of those in the group announce list, they get removed.

That would limit addon messages significantly, while still letting each instance of the addon decide on its own if it should call out or not, without constant traffic.
  Reply With Quote