promotional bannermobile promotional banner
premium banner
BrosBeforeIOsGambling

Description

What it is

A raid/party/guild gambling addon where players enter a game, everyone /roll, and the highest roller wins the difference in gold from the lowest roller. Only the group leader can control the game. All addon communication uses a hidden addon channel (BBIGAMBLE) so nothing spams regular chat.


How a Game Works (Step by Step)

1. Leader clicks "New Game"

  • Reads the roll value from the edit box (default 1,000g)
  • Resets any previous game state
  • Starts background music
  • Begins listening for "1" / "-1" in party/raid/guild chat
  • Sends NEW_GAME:1000 over the hidden addon channel to all other addon users
  • All addon users see "New game started" in their message log

2. Players join

  • With addon: Click "Enter Self" button, which sends JOIN over the addon channel. The leader's addon receives it, adds the player, and broadcasts ENTERED:PlayerName to sync everyone.
  • Without addon: Type 1 in raid/party/guild chat. The leader's addon detects it, adds the player, and broadcasts ENTERED:PlayerName to sync addon users.
  • The button toggles to "Leave Game" once entered. Typing -1 in chat or clicking the button again sends QUIT, which the leader processes and broadcasts LEFT:PlayerName.

3. Leader clicks "Last Call" (optional)

  • Sends LAST_CALL to all addon users, showing an orange alert in everyone's log.

4. Leader clicks "Roll" (first time -- closes the game)

  • Requires at least 2 players
  • Sets Locked = true so no more joins/leaves
  • Sends CLOSE:1000 to all addon users
  • Everyone sees "Game is closed! /roll 1,000 now!" in their log
  • The "Self Roll" button enables for players who are in the game

5. Players /roll

  • Players either type /roll 1000 manually or click the "Self Roll" button (which calls RandomRoll(1, 1000))
  • WoW generates a system message like "PlayerName rolls 742 (1-1000)"
  • Every addon client parses CHAT_MSG_SYSTEM using the pattern ^(%S+)%s%S+%s(%d+)%s%((%d+)-(%d+)%) to extract the name, roll value, min, and max
  • Only rolls matching (1-CurrentRollValue) from registered players are counted
  • Each player's roll is recorded and they're marked as "has rolled"

6. Leader clicks "Roll" again (if people are slow)

  • Shows who still needs to roll, sends STILL:Name1,Name2 to all addon users

7. All rolls are in -- automatic resolution

  • Once #Rolls == #Players, the leader's addon fires SortRolls()
  • Rolls are sorted highest to lowest
  • Winner = highest roll, Loser = lowest roll, Difference = winner's roll minus loser's roll
  • Stats are updated (both overall and head-to-head)
  • The result is logged: "LoserName owes WinnerName 500g!"
  • A big on-screen raid warning appears for the winner (green) and loser (red)
  • RESULT:WinnerName:742:LoserName:123:619 is broadcast so all addon users see the result and update their stats
  • Game state resets, music stops

UI Layout

Main Frame (370x330, draggable, toggled via minimap button or /bbig)

Top half: Scrolling message log (500 lines, scrollable with mouse wheel) -- all game events appear here in color-coded text:

  • Gold = system messages
  • Light grey = info (player entered, rolled, etc.)
  • Orange = alerts (last call, still need to roll, results)
  • Red = errors

Bottom half: Button grid

  Column 1 Column 2 Column 3
Row 1
New Game
Channel (Party/Raid/Guild toggle)
Enter Self / Leave Game
Row 2
Last Call
[Roll Value edit box]
Self Roll
Row 3
Roll
Stats
Reset Game
Row 4
Reset Stats
 
 

Button state rules:

  • Only the group leader can use: New Game, Channel, Last Call, Roll, Reset Game, Reset Stats
  • "Enter Self" / "Leave Game" is available to everyone during the join phase
  • "Self Roll" only enables after the game is closed and you haven't rolled yet
  • Channel and Roll Value are locked once a game starts

Minimap button: Draggable dice icon, position saved between sessions. Click to toggle the window.


Communication Architecture

Two parallel input systems, both processed by the leader:

Method Who uses it How it works
Addon messages (C_ChatInfo.SendAddonMessage)
Players with the addon installed
Hidden channel, invisible in chat. Handles JOIN, QUIT, and all game state sync.
Chat monitoring (CHAT_MSG_PARTY/RAID/GUILD)
Players without the addon
Leader watches for "1" (enter) and "-1" (leave) typed in chat.

The leader is the authority -- all joins/leaves go through the leader, who then broadcasts the updated state to all addon users via addon messages.


Slash Commands

Command What it does
/bbig
Toggle the window
/bbig show / hide
Show or hide the window
/bbig leave
Leave the current game
/bbig stats
Show overall leaderboard in the log
/bbig stats PlayerName
Show head-to-head stats for a specific player
/bbig resetstats
Wipe all saved stats