Bots Home
|
Create an App
TestEenTwintig
Author:
test_sammara_games
Description
Source Code
Launch Bot
Current Users
Created by:
Test_Sammara_Games
// startof CBSv2 module - not for re-compilation (function(a,k){function h(a){this.message=a}h.prototype=Error();h.prototype.name="InvalidCharacterError";a.btoa||(a.btoa=function(a){a=String(a);for(var g,b,p=0,c=k,r="";a.charAt(p|0)||(c="=",p%1);r+=c.charAt(63&g>>8-p%1*8)){b=a.charCodeAt(p+=.75);if(255<b)throw new h('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');g=g<<8|b}return r});a.atob||(a.atob=function(a){a=String(a).replace(/=+$/,"");if(1==a.length%4)throw new h('"atob" failed: The string to be decoded is not correctly encoded.'); for(var g=0,b,p,c=0,r="";p=a.charAt(c++);~p&&(b=g%4?64*b+p:p,g++%4)?r+=String.fromCharCode(255&b>>(-2*g&6)):0)p=k.indexOf(p);return r})})("undefined"===typeof exports?this:exports,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="); (function(a){var k=cb.onMessage,h=null,r=null,g,b="#"+(cb.settings.hasOwnProperty("slot")?cb.settings.slot:"")+"CBSv2",p=/^\/#[0-3]CBSv2\//;cb.log("CBS::v2::CB app/bot data Save/restore::20170118.008::Release");cb.onMessage=function(c){if("function"!==typeof c)throw new TypeError(c+" is not a function");k(function(k){var d=k.m.replace(/\s*/g,"").split("/"),n,t;3<d.length&&""===d[0]&&d[1]===b?(h&&r&&k.user===cb.room_slug&&(n=d[2],4===d.length?(d[3]="?",k.m=d.join("/")):6===d.length?((g||{}).hasOwnProperty(n)|| (t=h(),g={},g[n]=a.btoa(a.unescape(a.encodeURIComponent(t))),t||cb.log("onSave returned no data.")),g.hasOwnProperty(n)&&(t=parseInt(d[3],10),n=g[n].slice(t,t+512),d[4]=n,d[5]=n.length,k.m=d.join("/"))):7===d.length&&("0"===d[3]&&(g={},g[n]=""),g.hasOwnProperty(n)&&(d[3]=g[n].length,d[6]=d[4].length,k.m=d.join("/"),d[4]?g[n]+=d[4]:(t=a.decodeURIComponent(a.escape(a.atob(g[n]))),r(t),cb.chatNotice("Previously Saved Data Restored.",cb.room_slug))))),k["X-Spam"]=!0):p.test(k.m)&&(k["X-Spam"]=!0);return c(k)}); return c};cb.onRestore=function(a){if("function"!==typeof a)throw new TypeError(a+" is not a function");return r=a};cb.onSave=function(a){if("function"!==typeof a)throw new TypeError(a+" is not a function");return h=a};cb.onMessage(function(a){return a})})("undefined"===typeof exports?this:exports); // endof CBSv2 module - not for re-compilation /*****************************\ BJ21 (c)2017 (1/10/17) Author: cacho_gordo Version: v1.1 (1/10/2017) \*****************************/ "use strict";const version=["BJ21 (c)2017 (1/10/2017)","Version: v1.1 (1/10/2017)","Author: cacho_gordo (cachotest)"];const HEART="\u2665",PIKE="\u2660",DIAMOND="\u2666",CLOVER="\u2663",BSTAR="\u2605",BULLET="\u2022";var bullets=" \u2022 \u2022 \u2022 ",nbsp="\xa0";var BAR_TOT="\u2502";const purple="#B369B3",navy="#000080",red="#F00",green="#0F0",blue="#00F",yellow="#FFFF00",fluorlima="#CCFF00",white="#FFFFFF",backg="#89CFEF",colhast="#00FFFF",coltrec="#0000FF",colalot="#DDBBCC",coltons="#993377",colfan="#008000",colmods="#DC5500",colslug="#F04500",colnotice="#B22222",micolor="#2991f8";const bold="bold",bolder="bolder";const eBJ21=":BJ21-title-k8",eBJ21_table=":BJ21-table-k8";const faceCards="A234567890JQK",codeSuits="HPDC";const SUFFLE=3;var canInsurance=false,soft=false;var aEstados=["not start yet, wait","waiting for bets","cards dealing","playing","dealer play","results - round's end"];var aPurses=[],aDealer=[],aPlayers=[],aZapato=new Array(52).fill(0),estado=0,nPlayed=0;var nDecks=3,waitPlayers=7,secsPlay=100,maxBet=100;var pricedrgn=0,isRNTM=false;cb.onSave(function(){var a={nDecks:nDecks,waitPlayers:waitPlayers,secsPlay:secsPlay,maxBet:maxBet,adTimer:adTimer,aPlayers:aPlayers,aTimers:aTimers,aPurses:aPurses,aDealer:aDealer,aZapato:aZapato,estado:estado,pricedrgn:pricedrgn,isRNTM:isRNTM};return JSON.stringify(a)});cb.onRestore(function(b){var a=JSON.parse(b);Object.keys(a).forEach(function(c){if(this.hasOwnProperty(c)){this[c]=a[c]}});if(!a||a===""||estado===0){cargaSettings()}});cb.settings_choices=[{name:"ndecks",label:"Number of decks per session (2-6, < 4 all cards are shuffled for each round):",type:"int",minValue:2,maxValue:6,defaultValue:3},{name:"waitplayers",label:"Wait for how many players to start round? (2-12)",type:"int",minValue:2,maxValue:12,defaultValue:7},{name:"maxbet",label:"Bet maximum (100-2000):",type:"int",minValue:100,maxValue:2000,stepValue:10,defaultValue:200},{name:"secsplay",label:"Waiting for player's decision? (secs):",type:"int",minValue:60,maxValue:300,stepValue:10,defaultValue:100},{name:"adtimer",label:"Ad of Game for interval (mins):",type:"int",minValue:2,maxValue:20,defaultValue:6}];function myPurse(a){var b=hasPurse(a);if(b){cb.sendNotice("You have "+b+" tokens in your purse. See /spendbj and /betbj commands.",a,"",micolor,"bold")}return b}function hasPurse(b){for(var c=0,a=aPurses.length;c<a;c++){if(aPurses[c][0]===b){return aPurses[c][1]}}return 0}function getIndPurse(b){for(var c=0,a=aPurses.length;c<a;c++){if(aPurses[c][0]===b){return c}}return -1}function purseSpend(b,d){var a=parseInt(d,10);if(isNaN(a)||!a){return 0}var c=getIndPurse(b);if(c<0){cb.sendNotice("You do not even have a token!",b,"",micolor,"bold");return 0}var e=aPurses[c][1];if(a>e){cb.sendNotice("Sorry, you only have "+e+" tokens!",b,"",micolor,bold);return 0}aPurses[c][1]-=a;if(a==e){aPurses.splice(c,1)}return a}cb.onTip(function(f){var c=f.from_user,b=parseInt(f.amount),h=f.message;var g;if(h.indexOf('"betbj"')>=0||h.indexOf("'betbj'")>=0||h.indexOf("`betbj`")>=0){g="tipbet"}else{if(h.indexOf('"doublebj"')>=0||h.indexOf("'doublebj'")>=0||h.indexOf("`doublebj`")>=0){g="tipdouble"}else{if(h.indexOf('"insurbj"')>=0||h.indexOf("'insurbj'")>=0||h.indexOf("`insurbj`")>=0){g="tipinsur"}else{return}}}if(b==pricedrgn){cb.sendNotice(c+" tipped same price Dices game, should not give the prize.",cb.room_slug,colslug,yellow,bold)}if(isRNTM){cb.sendNotice(c+" tipped with Tip Menu, check no offer.",cb.room_slug,colslug,yellow,bold)}if(estado==0){cb.sendNotice('Thanks! "BJ21" is still not start.',cb.room_slug,colslug,yellow,bold);noticeClosed(c);cb.sendNotice("Thanks for tipping!",c,colslug,white,bold);return}if(estado!=1&&estado!=3){cb.sendNotice('Thanks! "BJ21" is not state for bet, double or insurance.',cb.room_slug,colslug,yellow,bold);cb.sendNotice("Thanks for tipping! Can't bet, insurance or double in this status!",c,colslug,white,bold);return}var a,d;if(g=="tipdouble"){if(estado!=3){return}var e=ndxPlayer(c);if(e<0){cb.sendNotice("Thanks, but tip bet before!",c,colslug,white,bold);return}a=Math.floor(b/10)*10;d=aPlayers[e][1];if(a<d){cb.sendNotice("Thanks for tipping, but for DOUBLE tip the same as your bet "+d,c,colslug,white,bold);return}if(a>d){cb.sendNotice("Thanks, for DOUBLE tip the same as your bet "+d,c,colslug,white,bold)}doubleDown(aPlayers[e]);return}if(g=="tipbet"){if(estado!=1){return}a=Math.floor(b/10)*10;if(a<10){cb.sendNotice("Thanks for tipping! Bets 10 minimum.",c,colslug,white,bold);return}if(a>maxBet){cb.sendNotice("Thanks, but you bet with the maximum "+maxBet,c,colslug,white,bold);a=maxBet}bet(c,a);return}if(g=="tipinsur"){if(estado!=3){return}var e=ndxPlayer(c);if(e<0){cb.sendNotice("Thanks, but tip bet before, and wait for deal.",c,colslug,white,bold);return}a=Math.floor(b/5)*5;d=aPlayers[e][1];if(a<d/2){cb.sendNotice("Thanks for tipping, but for INSURANCE place the half of your bet "+d,c,colslug,white,bold);return}if(a>d/2){cb.sendNotice("Thanks, but you INSURANCE with half bet "+d/2,c,colslug,white,bold)}insurance(aPlayers[e]);return}});cb.onMessage(function(c){var g=c.user;var e=c.m.trim().split(/\s+/g);if(e[0].charAt(0)=="/"){c["X-Spam"]=true;if(e[0]==="/handshake"){if(g!=cb.room_slug&&!c.is_mod){return c}var m="BJ21";if(e.length>1){e.splice(0,1);var f=e.join(" ");if(f==m){return c}if(f.substr(0,19)=="Dice Roll Game nice"){pricedrgn=parseInt(f.substr(19),10);var k=" >>price "+pricedrgn;cb.log(m+" ACK handshake from "+f.substr(0,19)+k);c.m=">> Dice game"+k;return c}else{if(f=="Rotating Notifier n Tip Menu"){isRNTM=true;cb.log(m+" ACK handshake from "+f);c.m=">> Rotating n Tip Menu >>present";return c}}cb.log(m+" ACK handshake from "+f+" but does nothing.")}return c}if(g==cb.room_slug||c.is_mod){switch(e[0]){case"/adgamebj":noticeGame();break;case"/notice":if(e.length<2){break}e.splice(0,1);var h=e.join(" ").replace(/\\n/g,"\n").replace(/<cr>/g,"\n");cb.sendNotice(h,"","",colnotice,"bold");c.m="notice =>";break;case"/purselistbj":case"/bjpurses":if(aPurses.length>0){lstPurses(g)}else{c.m+=" - None"}break;case"/betlistbj":case"/bjbets":if(aPlayers.length>0){lstBets(g)}else{c.m+=" - None"}break;case"/chdecks":if(g===cb.room_slug&&estado==0){if(e.length<2){break}var d=parseInt(e[1],10);if(isNaN(d)||d<2||d>6){break}nDecks=d;c.m+=" Ok"}break;case"/chplayers":if(g===cb.room_slug&&estado==0){if(e.length<2){break}var d=parseInt(e[1],10);if(isNaN(d)||d<2||d>12){break}waitPlayers=d;c.m+=" Ok"}break;case"/chmaxbet":if(g===cb.room_slug&&estado==0){if(e.length<2){break}var d=parseInt(e[1],10);if(isNaN(d)||d<100||d>2000){break}maxBet=d;c.m+=" Ok"}break;case"/chwaitplay":if(g===cb.room_slug&&estado==0){if(e.length<2){break}var d=parseInt(e[1],10);if(isNaN(d)||d<60||d>300){break}secsPlay=d;c.m+=" Ok"}break;case"/forerrorbj":if(e.length<3){break}if(estado!=1){cb.sendNotice("Can't BET in this status!",g,colslug,white,bold);break}var l=e[1];var b=ndxPlayer(l);if(b>=0){cb.sendNotice(l+" already bet, only one hand per round is allowed!",g,colslug,white,bold);break}var i=parseInt(e[2]);if(isNaN(i)||!i){break}if(i<10){cb.sendNotice("Bets 10 minimum.",g,colslug,white,bold);break}if(i>maxBet){cb.sendNotice("You bet with the maximum "+maxBet,g,colslug,white,bold);i=maxBet}i=Math.floor(i/10)*10;bet(l,i);break;case"/startbj":if(g===cb.room_slug&&estado==0){start()}break;case"/dealbj":if(g===cb.room_slug&&estado==1){if(aPlayers.length>1){cardsDeal()}}break;case"/verbj":if(g==cb.room_slug||g=="cacho_gordo"){cb.sendNotice(version.join("\n"),g,"",micolor)}break;default:}}switch(e[0]){case"/bj21":if(g==cb.room_slug||g=="cacho_gordo"){g=""}cb.setTimeout(function(){bjHead(g);bj21(g)},1000);break;case"/rulesbj":if(g==cb.room_slug||g=="cacho_gordo"){g=""}rules(g);break;case"/bjhelp":var j=(g==cb.room_slug||c.is_mod);if(e.length<2){cb.sendNotice(helpNotice(j),g,"",micolor)}else{cb.sendNotice(helpNotice(j,e[1]),g,"",micolor)}break;case"/statusbj":if(g==cb.room_slug||g=="cacho_gordo"){g=""}noticeStatus(g);break;case"/mypursebj":if(!myPurse(g)){cb.sendNotice("You do not even have a token!",g,"",micolor,"bold")}break;case"/spendbj":if(e.length<3){break}var i=purseSpend(g,e[1]);if(!i){break}e.splice(0,2);var c=e.join(" ");cb.sendNotice(g+" /spendbj "+i+" tokens for "+c,"",colhast,colnotice,bold);cb.sendNotice("Have been subtracted from purse "+i+" tokens.",g,"",micolor,"bold");break;case"/doublebj":if(estado!=3){cb.sendNotice("Thanks! Can't DOUBLE in this status!",g,colslug,white,bold);break}var b=ndxPlayer(g);if(b<0){cb.sendNotice("Thanks, but bet before!",g,colslug,white,bold);break}var a=aPlayers[b][1];i=purseSpend(g,a.toString());if(!i){break}cbsendNotice("Have been subtracted from purse "+i+" tokens.",g,"",micolor,"bold");doubleDown(aPlayers[b]);break;case"/betbj":if(e.length<2){break}if(estado!=1){cb.sendNotice("Can't BET in this status!",g,colslug,white,bold);break}var i=parseInt(e[1]);if(isNaN(i)||!i){break}if(i<10){cb.sendNotice("Bets 10 minimum.",g,colslug,white,bold);break}if(i>maxBet){cb.sendNotice("Thanks, but you bet with the maximum "+maxBet,g,colslug,white,bold);i=maxBet}i=Math.floor(i/10)*10;i=purseSpend(g,i.toString());if(!i){break}cb.sendNotice("Have been subtracted from purse "+i+" tokens.",g,"",micolor,"bold");bet(g,i);break;case"/insurbj":if(estado!=3){cb.sendNotice("Can't INSURANCE in this status!",g,colslug,white,bold);break}var b=ndxPlayer(g);if(b<0){cb.sendNotice("Bet before, and wait for deal.",g,colslug,white,bold);break}var a=aPlayers[b][1];i=purseSpend(g,(a/2).toString());if(!i){break}cb.sendNotice("Have been subtracted from purse "+i+" tokens.",g,"",micolor,"bold");insurance(aPlayers[b]);break;case"/hitbj":if(estado!=3){cb.sendNotice("Sorry! Can't PLAY in this status!",g,colslug,white,bold);break}var b=ndxPlayer(g);if(b<0){cb.sendNotice("Thanks, but bet before, and wait for deal.",g,colslug,white,bold);break}hit(aPlayers[b]);break;case"/standbj":if(estado!=3){cb.sendNotice("Sorry! Can't PLAY in this status!",g,colslug,white,bold);break}var b=ndxPlayer(g);if(b<0){cb.sendNotice("Thanks, but bet before, and wait for deal.",g,colslug,white,bold);break}stand(aPlayers[b]);break;default:}return c}return c});cb.onEnter(function(a){if(a.user==cb.room_slug||!a.has_tokens){return}cb.sendNotice("Welcome, "+a.user+"! Try luck in Blackjack game,\nit's simple, bet when START BJ21!",a.user,"",micolor,"bolder");myPurse(a.user);noticeGame(a.user)});function ndxPlayer(a){for(var b=0;b<aPlayers.length;b++){if(aPlayers[b][0]==a){return b}}return -1}function bet(c,a){var b=ndxPlayer(c);if(b>=0){cb.sendNotice("Thanks! You already bet, only one hand per round is allowed!",c,colslug,yellow,bold);return}aPlayers.push([c,a,[],false,0,null]);cb.sendNotice("BJ21: "+c+" place bet "+a,"",yellow,colnotice,bold);if(aPlayers.length===waitPlayers){cardsDeal()}}function cardsDeal(){aDealer=[];estado=2;if(nDecks<=SUFFLE){aZapato.fill(0)}cb.sendNotice("CARDS DEAL begins!","",fluorlima,colfan,bolder);dealing();canInsurance=false;if(getScore(aDealer)==11){canInsurance=true;cb.sendNotice('Enable INSURANCE cost 1/2 bet to pay 2 to 1\ntip bet/2 "insurbj" or /insurbj if you have in your purse.\nInsurance against a Dealer Blackjack',"",fluorlima,colnotice,bold)}var a="The round begins! Play your hand.\n";a+="NO game TURN, each plays anytime, with a timeout of "+secsPlay+" seconds.";cb.sendNotice(a,"","",micolor,"bold");estado=3;dealerPlay()}function dealing(){var d,c;var a,f;var e;for(var b=0;b<aPlayers.length;b++){d=draw();c=draw();aPlayers[b][2]=[d,c];e=getScore([d,c]);showHand(aPlayers[b][0],[d,c],e);if(e==10||e==11){cb.sendNotice(aPlayers[b][0]+' Enable DOUBLE DOWN, tip same bet "doublebj" or /doublebj if you have in your purse.',"",fluorlima,colfan,bold)}aPlayers[b][4]=1;if(e==21){aPlayers[b][4]=3;++nPlayed}else{timerAuto(aPlayers[b])}}aDealer.push(draw());e=getScore(aDealer);showHand("Dealer",aDealer,e)}function draw(){var a;do{a=Math.floor(Math.random()*52)}while(aZapato[a]==nDecks);++aZapato[a];return a}function getScore(f){var g=0;var d=0;var b,e;for(var c=0;c<f.length;c++){b=f[c];e=b%13+1;if(e>10){e=10}if(e>1){g+=e}else{d++}}soft=false;for(var a=0;a<d;a++){if(g+11<=21){g+=11;soft=true}else{g+=1}}if(soft&&g>21){g-=10;soft=false}return g}function showHand(b,a,e){var d=b+" => ";var c=strHand(a);d+=c+" ";d+="("+e+")";if(e==21&&a.length==2){d+=" Blackjack!"}if(e>21){d+=" Busts!"}cb.sendNotice(d,"","",colfan,bold)}function strHand(a){var d,c,e=[];for(var b=0;b<a.length;b++){d=faceCards[a[b]%13];if(d=="0"){d="10"}c=codeSuits[Math.floor(a[b]/13)];e.push(" :"+d+c+"-k8")}return e.join(" ")}function canDouble(a){if(a.length==2&&(getScore(a)==10||getScore(a)==11)){return true}return false}function stand(a){var b=a[4],c;if(b==1||b==2){cb.cancelTimeout(a[5]);a[5]=null;a[4]=3;c=getScore(a[2]);showHand(a[0],a[2],c);cb.sendNotice(a[0]+" - STAND.","",fluorlima,colfan,bold);++nPlayed;dealerPlay()}else{cb.sendNotice(a[0]+" - Can't STAND play or is NOT NECESSARY in this hand!","",colslug,yellow,bold)}}function doubleDown(a){var b=a[4];if(b==1&&canDouble(a[2])){a[4]=4;a[1]*=2;cb.sendNotice(a[0]+" - DOUBLE DOWN!","",yellow,colmods,bold);hit(a,true)}else{cb.sendNotice(a[0]+" - Can't play DOUBLE in this hand!","",colslug,yellow,bold)}}function hit(b,e){cb.cancelTimeout(b[5]);b[5]=null;var c=b[4],a,d;if(c==1){c=b[4]=2}if(c==2||e){a=b[2];a.push(draw());d=getScore(a);showHand(b[0],a,d);if(d>21){b[4]=9;++nPlayed;dealerPlay()}else{if(d==21){b[4]=3;++nPlayed;dealerPlay()}else{if(e){b[4]=4;++nPlayed;dealerPlay()}else{timerAuto(b)}}}}else{cb.sendNotice(b[0]+" - Can't HIT play in this moment!","",colslug,yellow,bold)}}function insurance(a){if(canInsurance&&a[4]==1&&!a[3]){cb.cancelTimeout(a[5]);a[5]=null;timerAuto(a);a[3]=true;cb.sendNotice(a[0]+" - INSURANCE!","",colfan,white,bold)}else{cb.sendNotice(a[0]+" - Can't INSURANCE in this moment!","",colslug,yellow,bold)}}function autoPlay(a,d){if(a!=="Dealer"){cb.sendNotice(a+" AUTO for "+secsPlay+" secs. timeout","","",colfan,bold)}var c=getScore(d);while(c<18){if(c==17&&!soft){break}showHand(a,d,c);d.push(draw());c=getScore(d)}showHand(a,d,c);if(a!=="Dealer"){if(c<21){var b=a+" => ";b+=strHand(d)+" ";b+="("+c+") - STAND";cb.sendNotice(b,"","",colfan,bold)}++nPlayed;dealerPlay()}}function timerAuto(a){var b=cb.setTimeout(function(){cb.cancelTimeout(a[5]);a[5]=null;autoPlay(a[0],a[2])},1000*secsPlay);a[5]=b}function dealerPlay(){if(nPlayed<aPlayers.length){return}estado=4;cb.sendNotice("Turn of Dealer!","","",colfan,"bold");autoPlay("Dealer",aDealer);cb.sendNotice("RESULTS:","",fluorlima,coltons,bold);estado=5;var c,d;for(var b=0;b<aPlayers.length;b++){c=aPlayers[b];d=getScore(c[2]);if(d>21){continue}showHand(c[0],c[2],d);var e=getScore(aDealer);var a=0;if(isBlackjack(c[2])){a=Math.floor(0.5*c[1])}if(e>21){keepPurse(c[0],a+2*c[1]);cb.sendNotice(c[0]+": Dealer Busts. You WIN "+(c[1]+a)+" tkns. ","","",coltons,bold)}else{if(d>e||isBlackjack(c[2])&&!isBlackjack(aDealer)){keepPurse(c[0],a+2*c[1]);cb.sendNotice(c[0]+": You WIN "+(c[1]+a)+" tkns.","","",coltons,bold)}else{if(d<e||isBlackjack(aDealer)&&!isBlackjack(c[2])){cb.sendNotice(c[0]+": Dealer wins draw with "+(isBlackjack(aDealer)?"Blackjack":e),"","",coltons,bold)}else{keepPurse(c[0],c[1]);cb.sendNotice(c[0]+": Matches Dealer. Push!","","",coltons,bold)}}}if(isBlackjack(aDealer)&&c[3]){keepPurse(c[0],c[1]);cb.sendNotice(c[0]+": You claim Insurance!","","",coltons,bold)}}cb.sendNotice("Use /spendbj qty why do you want to spend or /betbj qty to bet again","","",coltons,bold);estado=0}function isBlackjack(a){if(getScore(a)==21&&a.length==2){return true}return false}function keepPurse(d,c){for(var b=0,a=aPurses.length;b<a;b++){if(aPurses[b][0]==d){aPurses[b][1]+=c;return}}aPurses.push([d,c])}function lstBets(b){var d=[];for(var c=0,a=aPlayers.length;c<a;c++){d.push(aPlayers[c][0]+": "+aPlayers[c][1]+" tkns.")}cb.sendNotice("** Bet list **",b,fluorlima,colfan,"bold");cb.sendNotice(d.join("\n"),b,fluorlima,colfan)}function lstPurses(b){var d=[];for(var c=0,a=aPurses.length;c<a;c++){d.push(aPurses[c][0]+": "+aPurses[c][1]+" tkns.")}cb.sendNotice("** Purse list **",b,backg,navy,"bold");cb.sendNotice(d.join("\n"),b,backg,navy)}function start(){aPlayers=[];aDealer=[];noticeStart();estado=1;nPlayed=0;noticeBets()}function cargaSettings(){nDecks=cb.settings.ndecks;waitPlayers=cb.settings.waitplayers;maxBet=cb.settings.maxbet;secsPlay=cb.settings.secsplay;adTimer=cb.settings.adtimer}function init(){cargaSettings();cb.sendNotice();cb.sendNotice("********************************","","",navy,"bold");cb.sendNotice(nbsp+" "+version[0],"","",navy,"bold");cb.sendNotice(nbsp+" "+version[1],"","",navy,"bold");cb.sendNotice(nbsp+" "+version[2],"","",navy,"bold");cb.sendNotice("********************************","","",navy,"bold");cb.sendNotice("Commands:","","",navy);cb.sendNotice(" /bjhelp - to see the possible commands","","",navy);cb.sendNotice();cb.setTimeout(bjHead,232);adSpam();cb.setTimeout(bj21,5000);cb.setTimeout(rules,8000)}function bjHead(a){if(!a){a=""}var b=eBJ21+" Try your luck playing BJ21.\n";b+="European 'No Hole Card' real style Blackjack.\n";b+="Multiply your tokens bets.";cb.sendNotice(b,a,"",micolor,"bolder")}function bj21(a){if(!a||a==cb.room_slug){a=""}cb.sendNotice("You vs. Dealer who does not make decisions.\nGet 21 points on first 2 cards: Blackjack! \nReach a score higher Dealer without exceeding 21. \nPlayers are each dealt 2 cards face up, Dealer 1 face up also.\nCards 2-10 pip value; J, Q and K worth 10; and Ace 1 or 11.\nHit additional cards to improve their hands, or stand.\nDealer must hit only soft 17 (A=11 and 6 total), or less.",a,"",micolor,"bold")}function rules(a){if(!a){a=""}var b="Blackjack pays 3 to 2\n";b+="Dealer must hit soft 17\n";b+="Insurance pays 2 to 1\n";b+="Double down with 10/11\n";b+="Not enabled surrender or split.\n";b+="Is played with "+nDecks+" decks session, \n";if(nDecks<4){b+="each round is shuffled all cards."}else{b+="allowed counting. :rofl "}cb.sendNotice(b,a,fluorlima,colfan,"bolder")}function noticeGame(a){if(!a){a=""}var b=eBJ21+" Try your luck playing Blackjack.\nMultiply your tokens bets.\nThe state is "+aEstados[estado];cb.sendNotice(b,a,"",colfan,"bolder");if(estado==1){noticeBets(a)}if(Math.random()>0.6){rules(a)}}function noticeBets(b){if(!b){b=""}var a="";if(Math.random()>0.65){a=eBJ21_table}var c="BJ21 START: Make your bets ladies and gentlemen! "+a+"\nThere are "+aPlayers.length+" playes. \xa0 Wait for "+waitPlayers+"\nBet from 10 to "+maxBet+' maximum.\nTip with "betbj" (typed quotes included) in the tip note,\nor command message /betbj qty if you have it available in your purse.';cb.sendNotice(c,b,"",colslug,"bolder")}function noticeStatus(a){if(!a||a==cb.room_slug){a=""}cb.sendNotice('The state of "BJ21" game is '+aEstados[estado],a,"",micolor,bold);if(estado==1){noticeBets(a)}}function noticeClosed(a){if(!a){a=""}cb.sendNotice("The game is still not started. Sorry.\nStay tuned to Notices or check with command /statusbj",a,"",colslug,"bold")}function noticeStart(a){if(!a){a=""}var b="Make your bets ladies and gentlemen! "+eBJ21_table+" \n";b+="Bets multiple 10, max. "+maxBet+"\n";b+="Only one hand for player and round.\n";b+="Is played with "+nDecks+" decks session, ";if(nDecks<4){b+="each round is shuffled all cards."}else{b+="allowed counting. :rofl "}cb.sendNotice(b,a,"",micolor,"bold")}function adSpam(){cb.setTimeout(adSpamTimer,adTimer*60000)}function adSpamTimer(){noticeGame();adSpam()}var ahelp0=[' * * * "BJ21" · H E L P · * * *'," * * * ·created by cacho_gordo * * *","Bet for win to Dealer who does not make decisions, must hit soft 17.","Bets place in tokens and purse earnings to spend on the model.","Only one bet for player in round. Deal when max. players or model decision."," Commands you can use:"];var ahelp1=["/statusbj - show state of game - private","/bj21 - game description - private","/rulesbj - rules European 'No Hole Card' real style Blackjack - private","/betbj num - bet num tokens purse pay - private","/doublebj - play DOUBLE DOWN after deal - private","/insurbj - play INSURANCE 1/2 bet after deal - private","/hitbj - play HIT ME one card more - private","/standbj - play STAND none card more - private","/mypursebj - how many tokens you have in your purse - private","/spendbj qty msg - spend qty tokens for msg agreement to the model - private","/bjhelp [command] - this commands list [info of one of them] - private",""];var ahelp2=["/adgamebj - ad notice game, num. players if start - broadcaster and mods","/notice notice text - allows more than 3 graphics and multiline, <cr> new line - broadcaster and mods","/purselistbj /bjpurses - list of user purses for anote caution - broadcaster and mods","/betlistbj /bjbets - list of bets if betting - broadcaster and mods","/chdecks num - change the num. decks to deal (2-6) - broadcaster only","/chplayers num - change to num. maximun of players (2-12) - broadcaster only","/chmaxbet max - change to the max bet before double posible - broadcaster only","/chwaitplay secs - change to num. secs wait for play - broadcaster only","/startbj - start game betting - broadcaster only","/dealbj - begin deal before num. players wait for - broadcaster only","/forerrorbj user num - num tokens for user bet error, if is the moment - broadcaster only","/verbj - current version - private - use broadcaster and developer ( if mod ).",""];function helpNotice(a,b){var c="";if(!b||b==""){c=ahelp0.join("\n")+"\n";if(a){c+=ahelp2.join("\n")+"\n"}c+=ahelp1.join("\n")}else{switch(b){case"statusbj":return[" * Help statusbj command *","/statusbj - show state of game - private","Show private Notice of the state of de game: no start, betting, playing..."].join("\n");break;case"bj21":return[" * Help bj21 commad *","/bj21 - game description - private","Show private Notice: Way game play."].join("\n");break;case"rulesbj":return[" * Help rulesbj commad *","/rulesbj - rules European 'No Hole Card' real style Blackjack - private","Show private Notice: Rules style game play."].join("\n");break;case"betbj":return[" * Help betbj command *","/betbj num - bet num tokens purse pay - private","num. tokens multiple 10, abailable in your purse."].join("\n");break;case"doublebj":return[" * Help doublebj command *","/doublebj - play DOUBLE DOWN after deal - private","Player score for 2 first cards: 10 / 11."].join("\n");break;case"insurbj":return[" * Help insurbj command *","/insurbj - play INSURANCE 1/2 bet after deal - private","Dealer must have an Ace after deal."].join("\n");break;case"hitbj":return[" * Help hitbj command *","/hitbj - play HIT one card more - private","All conditions of the play are checked."].join("\n");break;case"standbj":return[" * Help standbj command *","/standbj - play STAND none card more - private","All conditions of the play are checked."].join("\n");break;case"mypursebj":return[" * Help mypursebj command *","/mypursebj - how many tokens you have - private","Sow how many tokens in your purse.","See /spendbj command for request to model.","also /betbj to bet again for next round."].join("\n");break;case"spendbj":return[" * Help spendbj command *","/spendbj qty msg - spend qty tokens for msg agreement to the model - private","num available in your 'purse', for price offer equal or less."].join("\n");break;case"adgamebj":if(a){return[" * Help adgamebj command *","/adgamebj - ad notice game, num. players if start",'Show "BJ21" game same as the ad.',"Only use of the broadcaster and mods."].join("\n")}break;case"notice":if(a){return[" * Help notice command *","/notice notice text - Show Notice: text and graphics","As notice allows more than 3 graphics and multiline,","Multiline separator <cr> - new line","Only use of the broadcaster and mods."].join("\n")}break;case"bjbets":case"betlistbj":if(a){return[" * Help betlistbj command *","/betlistbj /bjbets - list of bets if betting","Test for request or any other reason.","Only use of the broadcaster and mods."].join("\n")}break;case"purselistbj":case"bjpurses":if(a){return[" * Help purselistbj command *","/purselistbj /bjpurses - list of user purses for anote caution.","Only use of the broadcaster and mods."].join("\n")}break;case"chdecks":if(a){return[" * Help chdecks command *","/chdecks num - change the num. decks to deal (2-6)","Number Decks for session, less of 4 shuffle for each round.","Only use of the broadcaster."].join("\n")}break;case"chplayers":if(a){return[" * Help chplayers command *","/chplayers num - change to num. maximun of players (2-12)","Number maximun players bet for round,","if num players bet, begin the round deal.","Only use of the broadcaster."].join("\n")}break;case"chmaxbet":if(a){return[" * Help chmaxbet command *","/chmaxbet max - change to the max bet","Maximum bet (100-1000). Before double posible.","Only use of the broadcaster."].join("\n")}break;case"chwaitplay":if(a){return[" * Help chwaitplay command *","/chwaitplay secs - change to num. secs wait for play.","Wait (30-300) seconds to play. Afert play way Dealer.","Only use of the broadcaster."].join("\n")}break;case"startbj":if(a){return[" * Help startbj command *","/startbj - start game betting","Faites vos jeux. Make game ladies and gentlemen.","Only use of the broadcaster."].join("\n")}break;case"dealbj":if(a){return[" * Help dealbj command *","/dealbj - begin deal before num. players wait for.","Deal for players and Dealer finally.","After begin play free, without a turn.","Only use of the broadcaster."].join("\n")}break;case"forerrorbj":if(a){return[" * Help forerrorbj command *","/forerrorbj user num - num tokens for user bet error, if is the moment",'For user error on tip note "betbj". num same tip tokens.',"Check before that tip to see the tokens.","Only use of the broadcaster."].join("\n")}break;case"verbj":if(a){return[" * Help verbj command *","/verbj - Show software current version for developer info.","Only use of the broadcaster and developer (if mod) - private."].join("\n")}break;default:}}return c}init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.