Skip to content

Casino RedV3

Redjumpman edited this page Sep 10, 2018 · 14 revisions

@ WIP

Casino Plugin Wiki for Red V3

This cog was created exclusively for the Red-DiscordBot project. For installation instructions go to my main github repository for more information.

Table of Contents

Major Changes

The migration from Red v2 to Red v3 resulted in an opportunity to completely rewrite Casino. As a result, many things have been renamed, changed, and/or deprecated. Below lists some of the major changes, but for a more detailed list look at the 2.0.0 patch notes.

  • Chips have been removed and all operations regarding it (exchange, payday, etc).

  • Players no longer need to join the Casino to begin playing.

  • Casino no longer requires players to have first registered with economy.

  • Casino now has a new game, Craps. Enjoy!

  • Memberships can now be assigned by Admins.

  • Support for local and global modes.*

  • You can now use MongoDB via Redv3 to better service large communities.

  • Multi-language support ready.

  • Many outputs condensed to be more mobile friendly.**

* Casino must be either local or global. It cannot be both. Changing the mode will wipe all of your data. See Mode and Global and Local Modes for more information.

** While many outputs are better on mobile, results may vary depending on your device. I've made a lot of them about as small as possible without sacrificing readability.

Patch Notes

2.0.0
2.0.4

Commmand List

User Level

Name Command Description
Alllin [p]allin <multiplier> Bets all your credits for a chance to win big!
Blackjack [p]blackjack <bet> Play a game of blackjack.
Coin [p]coin <bet> <choice> Coinflip game with a 50/50 chance to win.
Craps [p]craps <bet> Plays a modified version of craps
Cups [p]cups <bet> <cup> Guess which cup of three is hiding the coin.
Dice [p]dice <bet> Roll a set of dice and win on 2, 7, 11, 12.
Hilo [p]hilo <bet> <choice> Pick high, Low, or 7 in a dice rolling game.
War [p]war <bet> Play a modified game of war.
Memberships [p]memberships Displays a list of server/global memberships
Info [p]info Shows information about Casino.
Stats [p]stats Shows your play statistics for Casino.
Version [p]version Shows the current Casino version.

Admin Level

Name Command Description
Access [p]casinoset access <game> <access> Sets the access level required to play a game.
Admin [p]casino admin Shows a list of admin commands.
Assign Membership [p]casino assignmem <user> <membership> Manually assigns a membership to a user.
Revoke Membership [p]casino revokemem <user> Revokes an assigned membership.
Set Cooldown [p]casinoset cooldown <game>, <cooldown> Sets the cooldown for a game.
Set Max Bet [p]casinoset max <game> <maximum> Sets the maximum bid for a game.
Set Min Bet [p]casinoset min <game> <minimum> Sets the minimum bid for a game.
Set Multiplier [p]casinoset multiplier <game> <multiplier> Sets the payout multiplier for a game.
Set Casino Name [p]casinoset name <name> Sets the name of the Casino.
Set Payout Limit [p]casinoset payoutlimit <limit> Sets a payout limit.
Payout Limit Toggle [p]casinoset payouttoggle Turns on/off a payout limit.
Release Credits [p]casino releasecredits <user> Approves pending currency for a user.
Reset Instance [p]casino resetinstance Reset global/server cooldowns, settings, or everything.
Reset User [p]casino resetuser <user> Reset a user's cooldowns, stats, or everything.
Membership Process [p]casino memprocess A process to create, edit, and delete memberships.

Note: In Global mode, all admin commands become owner commands.

Owner Level

Name Command Description
Wipe Casino [p]casino wipe Completely wipes casino data.
Mode [p]casinoset mode Toggles Casino between global and local modes

Games

Allin

Command
[p]allin <multiplier>

Aliases
None

Description
All-In is an All-or-Nothing gamble. It wagers your entire bank balance. The higher the multiplier the lower your chance for success. If you use a 2 as your multiplier than your chances for success will be 1 in 4. The logic for this is a random number from 0 to multiplier + 1. If a 0 is picked then you win.

Default Settings

Access Cooldown Minimum Maximum Multiplier
0 12h N/A N/A User Defined

Blackjack

Command
[p]blackjack <bet>

Aliases
bj, 21

Description
Blackjack draws 1 card face up for the dealer, and two cards face up for the player. The player may choose hit, stay, or double on their first turn. Doubling down when you do not have enough credits forces you to hit or stay. Double will double your bet, draw one card, and end the game. Choosing to stay will end the game. Choosing to hit will deal you another card face up, until you choose stay or have 21 or greater. If you wait longer than 15 seconds to pick hit, stay, or double, then the game will automatically pick stay for you.

When the game concludes the dealer will draw cards face up until it beats your score or busts. If the outcome results in a tie the bet will be pushed (returned).

Also, Blackjack uses a 'shared' deck. Meaning that one deck is shared per server (local mode) or to every server (global mode). Cards are drawn from the top of the deck, and it is shuffled when all 52 cards have been exhausted.

Default Settings

Access Cooldown Minimum Maximum Multiplier
0 5s 50 500 2.0

Craps

Command
[p]craps <bet>

Aliases
None

Description
Craps is a modified version of a classic casino dice game. The player will roll a pair of six-sided die. This is known as the come-out roll. If the total of their roll equals 7, they will win 7x their bet. If they roll an 11 they will win and their bet will be multiplied by the game's set multiplier. If the player rolls a 2, 3, or 12 they will automatically lose. Rolling a 4, 5, 6, 7, 8, 9, or 10 will establish a point. The player will continue rolling the dice until they hit their point number (and win) or they hit a 7 or 11 and lose.

Default Settings

Access Cooldown Minimum Maximum Multiplier
0 5s 50 500 2.0

Coin

Command
[p]coin <bet> <choice>

Aliases
None

Description
Coin is a simple coin flip game. You must pick either heads or tails as your choice. This isn't case sensitive. The bot will randomly pick heads or tails as an outcome.

Default Settings

Access Cooldown Minimum Maximum Multiplier
0 5s 10 10 1.5

Cups

[p]cups <bet> <choice>

Aliases
None

Description
Cups is a simple guessing game. A coin is hidden under one of three cups. The player must correctly guess which cup is hiding the coin.

Default Settings

Access Cooldown Minimum Maximum Multiplier
0 5s 25 100 1.8

Dice

Command
[p]dice <bet>

Aliases
None

Description
Rolls two six-sided die. If a 2, 7, 11, or 12 is rolled, then the player wins.

Default Settings

Access Cooldown Minimum Maximum Multiplier
0 5s 25 100 1.8

Hilo

Command
[p]hilo <bet> <choice>

Aliases
hl

Description
Player has three choices. Pick High (8, 9, 10, 11, 12), Low (1, 2, 3, 4, 5, 6), or Seven (7). If the player picks 7 and wins, they will receive their bet * (multiplier + 2). The 2 is hard coded into hi-lo because I feel this is fair. There is a 1/12 chance that a seven will show up, and a player will most likely not choose 7 because the odds are low. Thus the high payout. The normal payout multiplier can still be changed.

Default Settings

Access Cooldown Minimum Maximum Multiplier
0 5s 25 75 1.7

War

Command
[p]war <bet>

Aliases
None

Description
War is based on the real life casino version card game. The dealer shuffles the deck and draws to cards face down. One for the player, and one for the dealer. The cards are then flipped. The higher card wins. In the result of a tie, the player has the option of going to war by typing war.

If the player decides to go to war, their bet is doubled and three cards are burned (discarded) from the deck. Then, two more cards are drawn. If the player's hand is greater than or equal to the dealer's card, then the player wins. This is an important difference, because the player card must be higher on the initial draw, but during war they only need to equal. If the player wins the war, they only receives a multiplier for half the bet. The rest is pushed (returned) to the player.

If the player does not have enough credits to go to war, gives no response, or types surrender / ffs, then the player only loses half of their original bet.

Default Settings

Access Cooldown Minimum Maximum Multiplier
0 5s 25 75 1.5

User Commands

Memberships

Command
[p]casino memberships

Description
Creates a list of memberships the user can pick from. Choosing one of the displayed memberships, will output an embed with information on that particular membership. It will show what games can be played by that membership, along with it's requirements and perks.

Info

Command
[p]casino info

Description
Shows settings information about casino. Displays all game parameters (name, access level, maximum/minimum bets, payout multiplier, if it is open, and the cooldown set. Additionally, it will display the set casino name, if it is open, the current mode, If a payout limit is on, and what the set payout limit is.

Stats

Command
[p]casino stats

Description
Displays all relevant data pertaining to your stats. Shows current membership, perks, and play stats. In addition to player win and losses it will display how long, if needed, you need to wait to play your games again.

Version

Command
[p]casino version

Description
Shows the current installed version of casino. Make sure you check to make sure you are always on the latest version.

Admin Commands

Release Credits

Command
[p]casino releasecredits <user>

Description
This command is used to release pending credits to the specified user. The use of this command is required when a payout limit has been set, and is exceeded by a player. Releasing these credits will immediately deposit them into the user's bank. Details of this exchange will be recorded in the casino log. See Set Payout Limit and Payout Limit Toggle for more information on this mechanic.

Reset User

Command
[p]casino resetuser <user>

Description
This command lets you reset a user's cooldowns, their stats, or everything. You are walked through some questions to indicate what you wish to do. The result of this action is submitted to the log.

Example
Reset User Cooldowns

Reset Instance

Command
[p]casino resetinstance

Description
This command can be used to reset cooldowns for every user in the server or global (depending on which mode you are in), or it can reset all of your settings to the default parameters. Choosing everything, will reset all settings and games to their default settings. The result of this action is submitted to the log.

Wipe

Command
[p] casino wipe

Description
This command will wipe all casino data from members/users and from the local/global scope. You are given a chance to confirm or deny this action. If you confirm, the result will be documented in the log.

Example
Casino Wipe

Assign Membership

Command
[p]casino assignmem <user> <membership>

Description
Assigns a membership directly to a user. This command MUST be used on the server the user resides, even if the mode is global. Players who are assigned a membership, will be skipped over in the auto-membership update process. Their membership will remain the same until a different one is granted or the current one is revoked. This action is recorded in the log.

Revoke Membership

Command
[p]casino assignmem <user> <membership>

Description
Revokes a membership that was assigned to a player. You MUST use this command on the server the user resides, even if the mode is global. Once a membership is revoked, you will have to wait until the user is put through the membership update process before the remove is final. They will be reevaluated at that point for any memberships they qualify for. You CANNOT revoke a membership that was assigned via the membership updater.

Admin

Command
[p]casino admin

Description
This command will show a list of all commands that can be used by Admins and above. Note that if you are in global mode, only the owner can use this command.

Membership Creation Process

Command [p]casino memprocess

Description

Mode

Command
[p]casinoset mode

Description
Casino now supports both local(per guild/server) and global(all servers/guilds connected) modes. When changing between modes, all prior data will be completely wiped.

In local mode, each server the bot is connected to, will have it's own instance of casino. Admins on those servers/guilds will be able to use all admin level commands that casino offers, but will not be able use [p]casinoset mode or [p]casino wipe.

When in global mode, all servers/guilds that the bot is connected to will share one casino instance. All admin level commands will be restricted to only the owner (and co-owners if applicable). There are also changes within the membership system during this mode. Roles cannot be used as a requirement in global mode. The days on server requirement is converted to a time since account was created condition.

NOTE

It is highly recommended that you make sure Economy matches the mode that casino is in. If you have casino in local mode, and economy in global mode, admins can change the payout multipliers and it can adversely affect your global leader boards.

Set Payout Limit

Command
[p]casinoset payoutlimit <limit>

Description
Sets the total amount of winnings a player can receive before it is with held by the bot. Winnings will only be with held if the payout toggle is set to ON. You can check to see the status of the payout toggle using the [p]casino info command. When credits have been withheld you must use the [p]casino releasecredits to give them back to the user.

Payout Limit Toggle

Command
[p]payouttoggle

Description
This will turn on the payout limiter. Winnings that exceed that amount you set for the payout limit will be with held from users. The user will be sent a DM from the bot, and only one amount may be pending for a player at one time. See the related commands Set Payout Limit and Release Credits for additional information.

Casino Toggle

Command
[p]casinoset toggle

Description
This will open and close the casino. While closed, no one can play any games, but players can still use stats, info, memeberships, and version commands. This action will be recorded in the log.

Casino Name

Command
[p]casinoset name <name>

Description
Sets the name of your casino. Casino names can only be 30 characters in length.

Multiplier

Command
[p]casinoset multiplier <game> <multiplier>

Description
Sets the payout multiplier for winning to a specific game. You can use a float, but the total amount will be rounded using the half up rounding style to the nearest tens place. This action will be recorded in the log.

Cooldown

Command
[p]casinoset cooldown <game> <cooldown>

Description
Sets how long a player must wait between plays of a game. The cooldown parameter supports DD:HH:MM:SS formats as well as raw seconds. Meaning any of the following are valid inputs:

  • 30:30 - 30 minutes and 30 seconds
  • 3600 - 1 hour
  • 01:25:15 - 1 hour, 25 minutes, and 15 seconds
  • 05:00:38:50 - 5 days, 38 minutes, and 50 seconds.

This action will be recorded in the log.

Min

Command
[p]casinoset min <game> <minimum>

Description
Sets the minimum bet that can be placed for a specific game. The minimum bet must be higher than the maximum bet. This action will be recorded in the log.

Max

Command
[p]casinoset max <game> <maximum>

Description
Sets the maximum bet that can be placed for a specific game. The maximum bet must be higher than the minimum bet. This action will be recorded in the log.

Access

Command
[p]casinoset access <game> <access>

Description
This command will set an access level to a game. All games have a default access level of 0 so that they can be played by everyone from the start. Increasing the access level will limit who can play it. The only way to get a higher access level than 0, is through memberships. This action will be recorded in the log.

Additional Information

Using Access Levels

Access levels are a way for admins/owners to limit accessability to certain games via memberships. By default all access levels are set to 1, and therefore every game is accessible to every user. For example, you could create a membership called 'Subscribers' that requires the server role "Patron" and set it's access level to 2. Then, you can set blackjack's access level to 2. Now, only users with the subscriber membership can play blackjack.

Membership Auto-Updater

Users will have their membership status automatically updated every five minutes. When a user meets the requirements for multiple memberships, then the one with the highest access level will be chosen. However, if a user has been assigned a membership, this process will skip over them. Please note that if you revoke a membership from a user, they will still need to wait until the next cycle before they are re-evaluated.

Managing Cooldowns

Cooldowns are set to 5 seconds for every game. DO NOT DECREASE THIS TIME IF YOUR BOT IS ON A LARGE OR MUTLIPLE SERVERS. When you decrease the cooldown to less than five, then you are opening yourself up to spam, possible rate limitations, or the bot struggling to keep up with the requests.

Global and Local Modes

Casino supports both a local and global mode. In local mode, settings and player data is restricted on a per server basis. In global mode, all data is shared with all servers the bot is connected to. Switching between these modes will wipe all of your data. In addition, when casino is in global mode, only the owner/co-owners may use admin level commands.

NOTE

If you have casino set to local mode, and your economy set to global you are opening yourself up to a bad time.

Setting up and managing payout limits

Payout limits are a way to add another layer of security to Casino. While maximum bets can be a good tool for mitigating large payouts, you may want to investigate wins that made with this amount. When a payout limit is set, the user will be sent a DM letting them know that they exceeded a set amount of currency. A log will also be created detailing information about their win. Additionally, users may only have one pending payout at any time.

Reviewing Logs

Casino creates a log that stores a multitude of information. The bot stores information regarding admin level commands and when users exceed the payout limit. This info will only be saved on the bot owner's system. Depending on the level of activity and mode, owners should consider making a backup of their log and deleting it. If you do decide to delete your log, make sure you unload Casino first.

Running Casino With Huge User Bases

If your bot is connected to an active user base of over 10k users, then it is highly recommend that you use Red's MongoDB drivers instead of JSON. This will vastly improve your performance. Also, make sure that you have all game cooldowns set to atleast five seconds. If you are still having issues, please contact me on discord.

FAQ

Have you thought about adding poker to Casino?

God dammit. Stop fucking asking me about poker. I'm not adding it to Casino. It will be too much of a burden on Casino and I will have people coming to me crying about why it is so slow on their 10k+ user base.

Are any of these games rigged? I feel like I can never win.

No. You just suck.

Will casino support languages other than English?

Yes! I already have Casino ready for translations, but I'm still working on sitting up the right platform to allow people to start translations. More on that to come.

How do I prevent certain people from using Casino?

Take a look at the permissions cog. I had considered using a whitelist/blacklist system at one point, but it is a lot of work for very little payoff. If I get enough people asking about it, I'll consider adding it in a later patch.

Clone this wiki locally