Bots Home
|
Create an App
bl
Author:
wanwan
Description
Source Code
Launch Bot
Current Users
Created by:
Wanwan
// wheel bot var totalTipped = 0; var topTipAmount = 0; var topTipper = null; var currentPlayer = null; var currentPlayerTip = 0; var deck = null; var CONFIG_TIPPER_COLOR = '#EBFAFA'; var CONFIG_TOP_TIPPER_COLOR = '#FFF700'; var CONFIG_ADVERT_TIME = 7; var EMOTE_LOGO = ' :blackjackoff '; var EMOTE_WINNER = ' :app_win '; var EMOTE_LOSER = ' :app_lose '; var nl = '\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501'; var COMMAND_PRIZES = '!p'; var COMMAND_HIT = '!h'; var COMMAND_STAY = '!s'; var COMMAND_RULES = '!r'; var COMMAND_STATS = '!stats'; var COMMAND_RESET = '!reset'; var COMMAND_NEXT = '!next'; var COMMAND_CMDS = '!cmds'; var COMMAND_QUEUE = '!queue'; var CONFIG_PLAYERWINS = 'wins'; var CONFIG_PLAYERLOSES = 'loses'; var draw = false; var queue = []; var noticeColorIndex = 0; var noticeColors = ["#25258e", "#006666"]; var cheat = false; var queueCheck = 0; var advert_delay = 7; // function getCommandList() { // return nl + '\n' + COMMAND_HIT + " player hits\n" + COMMAND_STAY + " player stands\n" + COMMAND_PRIZES + " see prize list\n" + COMMAND_RULES + " game rules\n" + nl // } cb.settings_choices = [{ name: 'buyin', type: 'int', minValue: 1, defaultValue: 33, label: "Minimum token bet" }, { name: 'advert_delay', type: 'int', minValue: 1, defaultValue: 5, label: "Delay between Wheel Bot information announcments", required: true }, { name: 'goal', type: 'int', minValue: 0, defaultValue: 0, label: "Tip goal (optional)", required: false }, { name: 'goal_description', type: 'str', minLength: 0, maxLength: 255, label: 'Goal Description (optional)', required: false }, { name: 'wprizes', type: 'str', minLength: 1, maxLength: 255, label: 'Player Prizes' }]; // var dealerHand = new Array(); // var playerHand = new Array(); // var playerStats = {}; // var gameOver = true; var player_prizes = new Array(); // var player_penalities = new Array(); cb.onDrawPanel(function(user) { var row1label = 'Tips received:'; var row1value = '' + totalTipped; if (cb.settings.goal && cb.settings.goal != 0) { row1label = 'Tips received / goal:'; row1value = '' + totalTipped + ' / ' + cb.settings.goal } var row2label = 'Top Tipper:'; var row2value = '--'; if (topTipper) { row2value = '' + formatName(topTipper, 12) + ' (' + topTipAmount + ')' } return { 'template': '3_rows_12_22_31', 'row1_label': row1label, 'row1_value': row1value, 'row2_label': row2label, 'row2_value': row2value, } }); cb.onMessage(function(msg) { // if(msg['m'] == "!h" || msg['m'] == "!hit" || msg['m'] == "!s" || msg['m'] == "!stay") { // cb.sendNotice("bj|"+msg['user']+"|"+msg['m'], "", "#FFE4E1", "#B232B2", "bold"); // } else if (msg['m'].indexOf(COMMAND_PRIZES) > -1) { if(canUseModCmds(msg)) { drawPrizes(msg, true) } else { drawPrizes(msg, false) } } else // if (msg['m'].indexOf(COMMAND_CMDS) > -1) { // cb.chatNotice(getCommandList(), msg['user']) // } else // if (msg['m'].indexOf(COMMAND_RULES) > -1) { // cb.chatNotice(getRules(), msg['user']) // } else if(msg['m'].startsWith("/jw ")) { if(canUseModCmds(msg)) { msg['X-Spam'] = true; var tmp = msg['m'].substring(4); tmp = tmp.replace(/,\s/g, ","); player_prizes = tmp.split(",") } } else // if(msg['m'].startsWith("/jl ")) { // if(canUseModCmds(msg)) { // msg['X-Spam'] = true; // var tmp = msg['m'].substring(4); // tmp = tmp.replace(/,\s/g, ","); // player_penalities = tmp.split(",") // } // } if(msg['m'].toLowerCase().includes("rigged")) { riggedName = msg['user']; cb.setTimeout(riggedMessage, 50) } return msg }); var riggedName = ""; function riggedMessage() { cb.chatNotice('Shut up, ' + riggedName + ". It's not rigged, you just suck.", '', '', '', 'bold'); } function drawPrizes(msg, mod) { var out = ""; // if(mod) { // out = nl + '\nDealer prize list:\n'; // for (var i = 0; i < player_penalities.length; i++) { // out += (i + 1) + '. ' + player_penalities[i] + '\n' // } // } out += 'Player prize list:\n'; for (var i = 0; i < player_prizes.length; i++) { out += (i + 1) + '. ' + player_prizes[i] + '\n' } out += nl; cb.chatNotice(out, msg['user'], '', ''); // cb.chatNotice(out) } function canUseCmds(msg) { if (msg['user'] == cb.room_slug || msg['is_mod'] || msg['has_tokens']) { return true } return false } function canUseModCmds(msg) { if (msg['user'] == cb.room_slug || msg['is_mod']) { return true } return false } function updateSubject() { cb.changeRoomSubject('June\'s Wheel of Fortune is running! ' + getSubject()) } function getSubject() { var subject = ''; subject += 'Tip ' + cb.settings.buyin + ' to play!'; if (cb.settings.goal_description && cb.settings.goal_description != '') { subject += ' Goal is [' + cb.settings.goal_description + ']' } return subject } function getRules() { var rules = 'GAME RULES\n' + nl + '\nTip ' + cb.settings.buyin + ' to spin the wheel.\n' + '- If a game is already running, you can still tip to queue up.\n'; rules += nl; return rules } function formatName(val, length) { if (val === null) { return "--" } else { return val.substring(0, length) } } function advert() { cb.chatNotice('June\'s Wheel of Fortune is running! ' + getSubject(), '', '', '', 'bold'); cb.setTimeout(advert, (parseInt(cb.settings['advert_delay']) * 60000)) } function init() { try { var wtemp = cb.settings.wprizes.replace(/,\s/g, ",").split(","); // var ltemp = new Array(cb.settings.lprize1, cb.settings.lprize2, cb.settings.lprize3, cb.settings.lprize4, cb.settings.lprize5); for (var i = 0; i < wtemp.length; i++) { if (wtemp[i] != '') { player_prizes.push(wtemp[i]) } } // for (var i = 0; i < ltemp.length; i++) { // if (ltemp[i] != '') { // player_penalities.push(ltemp[i]) // } // } } catch(e) { } updateSubject(); cb.chatNotice('June\'s Wheel of Fortune has been activated. ' + getSubject()); cb.setTimeout(advert, (parseInt(cb.settings['advert_delay']) * 60000)) } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.