Apps Home
|
My Uploads
|
Create an App
Texas Hold'em
Author:
romeo_john
Description
Source Code
Launch App
Current Users
Created by:
Romeo_John
App Images
var TEXAS_HOLDEM=function(){var e=[{name:"Most Common",weight:350},{name:"More Common",weight:250},{name:"Common",weight:150},{name:"Less Common",weight:120},{name:"Least Common",weight:90},{name:"Rare",weight:25},{name:"Very Rare",weight:10},{name:"Extremely Rare",weight:4},{name:"Ultra Rare",weight:1}],r=[{rank:"2",suit:"S",order:2},{rank:"3",suit:"S",order:3},{rank:"4",suit:"S",order:4},{rank:"5",suit:"S",order:5},{rank:"6",suit:"S",order:6},{rank:"7",suit:"S",order:7},{rank:"8",suit:"S",order:8},{rank:"9",suit:"S",order:9},{rank:"10",suit:"S",order:10},{rank:"J",suit:"S",order:11},{rank:"Q",suit:"S",order:12},{rank:"K",suit:"S",order:13},{rank:"A",suit:"S",order:14},{rank:"2",suit:"C",order:2},{rank:"3",suit:"C",order:3},{rank:"4",suit:"C",order:4},{rank:"5",suit:"C",order:5},{rank:"6",suit:"C",order:6},{rank:"7",suit:"C",order:7},{rank:"8",suit:"C",order:8},{rank:"9",suit:"C",order:9},{rank:"10",suit:"C",order:10},{rank:"J",suit:"C",order:11},{rank:"Q",suit:"C",order:12},{rank:"K",suit:"C",order:13},{rank:"A",suit:"C",order:14},{rank:"2",suit:"H",order:2},{rank:"3",suit:"H",order:3},{rank:"4",suit:"H",order:4},{rank:"5",suit:"H",order:5},{rank:"6",suit:"H",order:6},{rank:"7",suit:"H",order:7},{rank:"8",suit:"H",order:8},{rank:"9",suit:"H",order:9},{rank:"10",suit:"H",order:10},{rank:"J",suit:"H",order:11},{rank:"Q",suit:"H",order:12},{rank:"K",suit:"H",order:13},{rank:"A",suit:"H",order:14},{rank:"2",suit:"D",order:2},{rank:"3",suit:"D",order:3},{rank:"4",suit:"D",order:4},{rank:"5",suit:"D",order:5},{rank:"6",suit:"D",order:6},{rank:"7",suit:"D",order:7},{rank:"8",suit:"D",order:8},{rank:"9",suit:"D",order:9},{rank:"10",suit:"D",order:10},{rank:"J",suit:"D",order:11},{rank:"Q",suit:"D",order:12},{rank:"K",suit:"D",order:13},{rank:"A",suit:"D",order:14}],n=0,t="-",i="-",a="-",o=(cb.room_slug,"#D49A6A"),s="#552700",u={bg:"7e5ed272-9527-4cce-b338-5bd5b425a378",font_size:11,font_weight:"normal",font_colour:_()},l=[{slug:"highcard",name:"High Card",default:"Sorry, try again",rank:1,chance:17.4,display_chance:43.8,chance_rank:3,rollthedice_chance_index:0},{slug:"onepair",name:"One Pair",default:"Smile",rank:2,chance:43.8,display_chance:23.5,chance_rank:1,rollthedice_chance_index:1},{slug:"twopair",name:"Two Pair",default:"Boobs",rank:3,chance:23.5,display_chance:17.4,chance_rank:2,rollthedice_chance_index:2},{slug:"threeofakind",name:"Three of a Kind",default:"Ass",rank:4,chance:4.83,display_chance:4.83,chance_rank:4,rollthedice_chance_index:3},{slug:"straight",name:"Straight",default:"Pussy",rank:5,chance:4.62,display_chance:4.62,chance_rank:5,rollthedice_chance_index:4},{slug:"flush",name:"Flush",default:"Naked",rank:6,chance:3.03,display_chance:3.03,chance_rank:6,rollthedice_chance_index:5},{slug:"fullhouse",name:"Full House",default:"Cum show",rank:7,chance:2.6,display_chance:2.6,chance_rank:7,rollthedice_chance_index:6},{slug:"fourofakind",name:"Four of a Kind",default:"Password show (15 mins)",rank:8,chance:.168,display_chance:.168,chance_rank:8,rollthedice_chance_index:7},{slug:"straightflush",name:"Straight Flush",default:"Password show (30 mins)",rank:9,chance:.0279,display_chance:.0279,chance_rank:9,rollthedice_chance_index:7},{slug:"royalflush",name:"Royal Flush",default:"Password show (1 hour)",rank:10,chance:.0032,display_chance:.0032,chance_rank:10,rollthedice_chance_index:8}],d=0,c=[];function h(e){cb.settings_choices.push(e)}function f(e=null){var r="",n="##########################################",t=null===e?null:e.user,i=1==cb.settings.price?"token":"tokens",a=1==cb.settings.max_price_multiples?"hand":"hands";r+=n+" \n",r+=":texas-holdem-logo \n",r+="We are playing Texas Hold'em Poker!!!\n",r+="Tip "+cb.settings.price+" "+i+" to play a hand. \n",r+="You will be dealt 2 Hole cards, 3 Flop cards, 1 Turn card, and 1 River card. \n",r+="The best possible poker hand from all 7 cards will be automatically calculated for you, and the corresponding prize for that hand will be displayed in chat. \n","Yes"==cb.settings.use_price_multiples&&(r+="You may tip more than "+cb.settings.price+" "+i+" with a single tip to play multiple times, but no more than "+cb.settings.max_price_multiples+" "+a+" in a single tip ("+cb.settings.price*cb.settings.max_price_multiples+" tokens). \n"),r+='Type "!prizes" to see the list of prizes. \n',r+='Type "!prizes all" if you are the broadcaster (or a mod) to show the list of prizes to all users. \n',r+=n,cb.sendNotice(r,t,null,b(),"bold")}function k(e){var r,n,t=[];for(r=0;r<e.length;r++)n=e[r],t.push(n.rank.toString()+n.suit.toString());return t}function p(e,r="image"){var n,t,i="";for(n=0;n<e.length;n++)t=e[n],i+="image"===r?":playingcard-"+t.rank+t.suit+" ":"["+t.rank+t.suit+"] ";return i}function g(e=null){var r,n,t="",i="##########################################";for(t+=i+" \n",t+=":texas-holdem-logo \n",t+="PRIZES: \n",r=0;r<l.length;r++)t+=(n=l[r]).name+" = "+cb.settings["prize_"+n.slug]+" \n";t+=i,cb.sendNotice(t,e,null,b(),"bold")}function m(e){return e.toUpperCase()}function _(){return o}function b(){return s}function x(){let e=(r=0,n=c.length-1,Math.floor(Math.random()*(n-r+1))+r);var r,n;return l[c[e]]}function y(e){var r=parseInt(e.amount),n=parseInt(cb.settings.price);if(r===n)d+=n,T(e);else if("Yes"==cb.settings.use_price_multiples&&r>n){var t,i=function(e){var r=parseInt(cb.settings.price);if((e=parseInt(e))>r){let n=0;for(;e>=r;)n++,e-=r;return n}return 1}(r),a=parseInt(cb.settings.max_price_multiples);for(t=1;t<=i&&!(t>a);t++)d+=n,T(e)}}function S(e){return e.trim().toLowerCase()==cb.room_slug.trim().toLowerCase()}function w(e){var r,n=e.slice(0),t=[];for(r=0;r<n.length;r++)t.push(n[r].suit);t.sort();var i=t.join(",");return-1!==i.indexOf("S,S,S,S,S")||(-1!==i.indexOf("C,C,C,C,C")||(-1!==i.indexOf("H,H,H,H,H")||-1!==i.indexOf("D,D,D,D,D")))}function H(e){var r,n=e.slice(0),t=[];for(r=0;r<n.length;r++)t.push(n[r].order);t.sort(function(e,r){return(e=parseInt(e))<(r=parseInt(r))?-1:e>r?1:0});var i=t.join(",");return-1!==i.indexOf("2,2,2,2")||(-1!==i.indexOf("3,3,3,3")||(-1!==i.indexOf("4,4,4,4")||(-1!==i.indexOf("5,5,5,5")||(-1!==i.indexOf("6,6,6,6")||(-1!==i.indexOf("7,7,7,7")||(-1!==i.indexOf("8,8,8,8")||(-1!==i.indexOf("9,9,9,9")||(-1!==i.indexOf("10,10,10,10")||(-1!==i.indexOf("11,11,11,11")||(-1!==i.indexOf("12,12,12,12")||(-1!==i.indexOf("13,13,13,13")||-1!==i.indexOf("14,14,14,14"))))))))))))}function C(e){var r,n,t,i,a,o,s=e.slice(0);for(r=0;r<s.length;r++)for(i=s[r],n=0;n<s.length;n++)if(r!==n&&(a=s[n],i.rank===a.rank))for(t=0;t<s.length;t++)if(t!==r&&t!==n&&(o=s[t],i.rank===o.rank&&D(J(J(J(s.slice(0),i),a),o))))return!0;return!1}function D(e){var r,n,t,i,a=e.slice(0);for(r=0;r<a.length;r++)for(t=a[r],n=0;n<a.length;n++)if(r!==n&&(i=a[n],t.rank===i.rank))return!0;return!1}function O(e){var r,n,t,i,a=e.slice(0);for(a.sort(function(e,r){return e.order<r.order?-1:e.order>r.order?1:0}),i=k(a).join(","),n=["S","C","H","D"],r=0;r<n.length;r++)if(t=n[r],-1!==i.indexOf("10"+t+",J"+t+",Q"+t+",K"+t+",A"+t))return!0;return!1}function v(e){var r,n=e.slice(0),t=[];for(r=0;r<n.length;r++)t.push(n[r].order);t.sort(function(e,r){return(e=parseInt(e))<(r=parseInt(r))?-1:e>r?1:0});var i=t.join(",");return-1!==i.indexOf("2,3,4,5,6")||(-1!==i.indexOf("3,4,5,6,7")||(-1!==i.indexOf("4,5,6,7,8")||(-1!==i.indexOf("5,6,7,8,9")||(-1!==i.indexOf("6,7,8,9,10")||(-1!==i.indexOf("7,8,9,10,11")||(-1!==i.indexOf("8,9,10,11,12")||(-1!==i.indexOf("9,10,11,12,13")||-1!==i.indexOf("10,11,12,13,14"))))))))}function z(e){var r,n,t,i,a=e.slice(0);for(a.sort(function(e,r){return e.order<r.order?-1:e.order>r.order?1:0}),i=k(a).join(","),n=["S","C","H","D"],r=0;r<n.length;r++){if(t=n[r],-1!==i.indexOf("2"+t+",3"+t+",4"+t+",5"+t+",6"+t))return!0;if(-1!==i.indexOf("3"+t+",4"+t+",5"+t+",6"+t+",7"+t))return!0;if(-1!==i.indexOf("4"+t+",5"+t+",6"+t+",7"+t+",8"+t))return!0;if(-1!==i.indexOf("5"+t+",6"+t+",7"+t+",8"+t+",9"+t))return!0;if(-1!==i.indexOf("6"+t+",7"+t+",8"+t+",9"+t+",10"+t))return!0;if(-1!==i.indexOf("7"+t+",8"+t+",9"+t+",10"+t+",J"+t))return!0;if(-1!==i.indexOf("8"+t+",9"+t+",10"+t+",J"+t+",Q"+t))return!0;if(-1!==i.indexOf("9"+t+",10"+t+",J"+t+",Q"+t+",K"+t))return!0;if(-1!==i.indexOf("10"+t+",J"+t+",Q"+t+",K"+t+",A"+t))return!0}return!1}function A(e){var r,n,t,i,a,o,s=e.slice(0);for(r=0;r<s.length;r++)for(i=s[r],n=0;n<s.length;n++)if(r!==n&&(a=s[n],i.rank===a.rank))for(t=0;t<s.length;t++)if(t!==r&&t!==n&&(o=s[t],i.rank===o.rank))return!0;return!1}function P(e){var r,n,t,i,a=e.slice(0);for(r=0;r<a.length;r++)for(t=a[r],n=0;n<a.length;n++)if(r!==n&&(i=a[n],t.rank===i.rank&&D(J(J(a,t),i))))return!0;return!1}function T(e){var o,s,u,d,c,h=[],f=[],k=[],g=[],m="",y="",S=!1,T={};if(-1!==cb.settings.gamemode.toLowerCase().indexOf("standard")){for(T.hole=[],T.flop=[],T.turn=[],T.river=[],T.result="",T.msg="",T.prize=null,s=1;s<=5;s++){for(h=[],f=[],k=[],g=[],m="",y="",c=Q(r.slice(0)),o=0;o<2;o++)h.push(c.pop());for(y+=p(h)+"(Hole) \n",o=0;o<3;o++)f.push(c.pop());for(y+=p(f)+"(Flop) \n",o=0;o<1;o++)k.push(c.pop());for(o=0;o<1;o++)g.push(c.pop());if(y+=p(k)+p(g)+"(Turn & River) \n",(d=h.concat(f,k,g)).sort(function(e,r){return e.order<r.order?-1:e.order>r.order?1:0}),y+="Board: "+p(d,"text")+" \n",O(d)?(m+="Royal Flush",u=l[9]):z(d)?(m+="Straight Flush",u=l[8]):H(d)?(m+="Four of a Kind",u=l[7]):C(d)?(m+="Full House",u=l[6]):w(d)?(m+="Flush",u=l[5]):v(d)?(m+="Straight",u=l[4]):A(d)?(m+="Three of a Kind",u=l[3]):P(d)?(m+="Two Pair",u=l[2]):D(d)?(m+="One Pair",u=l[1]):(m+="High Card",u=l[0]),y+="Best Hand: "+m,(!1!==S||"onepair"!==u.slug&&"twopair"!==u.slug)&&!1===S){T=L(h,f,k,g,m,y,u);break}if(!1===S?(S=u,T=L(h,f,k,g,m,y,u)):u.rank<S.rank&&"onepair"!==u.slug&&(S=u.chance_rank,T=L(h,f,k,g,m,y,u)),"highcard"===T.prize.slug)break}t=T.result,a=cb.settings["prize_"+T.prize.slug],cb.sendNotice(T.msg,null,null,b(),"bold"),cb.sendNotice("Prize: "+cb.settings["prize_"+T.prize.slug],null,b(),_(),"bold")}else if(-1!==cb.settings.gamemode.toLowerCase().indexOf("dice")){for(c=Q(function(e="highcard"){let r=[];switch(e){case"highcard":r.push([{rank:"4",suit:"S",order:4},{rank:"5",suit:"C",order:5},{rank:"10",suit:"C",order:10},{rank:"6",suit:"H",order:6},{rank:"2",suit:"D",order:2},{rank:"Q",suit:"D",order:12},{rank:"A",suit:"D",order:14}]);break;case"onepair":r.push([{rank:"3",suit:"S",order:3},{rank:"A",suit:"S",order:14},{rank:"5",suit:"C",order:5},{rank:"A",suit:"C",order:14},{rank:"6",suit:"H",order:6},{rank:"K",suit:"H",order:13},{rank:"9",suit:"D",order:9}]);break;case"twopair":r.push([{rank:"5",suit:"S",order:5},{rank:"Q",suit:"S",order:12},{rank:"5",suit:"C",order:5},{rank:"Q",suit:"C",order:12},{rank:"4",suit:"H",order:4},{rank:"K",suit:"H",order:13},{rank:"10",suit:"D",order:10}]);break;case"threeofakind":r.push([{rank:"2",suit:"S",order:2},{rank:"J",suit:"S",order:11},{rank:"J",suit:"C",order:11},{rank:"7",suit:"H",order:7},{rank:"J",suit:"H",order:11},{rank:"3",suit:"D",order:3},{rank:"10",suit:"D",order:10}]);break;case"straight":r.push([{rank:"4",suit:"S",order:4},{rank:"5",suit:"S",order:5},{rank:"6",suit:"C",order:6},{rank:"7",suit:"C",order:7},{rank:"8",suit:"C",order:8},{rank:"A",suit:"H",order:14},{rank:"10",suit:"D",order:10}]);break;case"flush":r.push([{rank:"J",suit:"S",order:11},{rank:"6",suit:"H",order:6},{rank:"8",suit:"H",order:8},{rank:"10",suit:"H",order:10},{rank:"Q",suit:"H",order:12},{rank:"A",suit:"H",order:14},{rank:"2",suit:"D",order:2}]);break;case"fullhouse":r.push([{rank:"10",suit:"S",order:10},{rank:"A",suit:"S",order:14},{rank:"10",suit:"C",order:10},{rank:"A",suit:"C",order:14},{rank:"A",suit:"H",order:14},{rank:"8",suit:"D",order:8},{rank:"K",suit:"D",order:13}]);break;case"fourofakind":r.push([{rank:"4",suit:"S",order:4},{rank:"4",suit:"C",order:4},{rank:"8",suit:"C",order:8},{rank:"4",suit:"H",order:4},{rank:"4",suit:"D",order:4},{rank:"Q",suit:"D",order:12},{rank:"A",suit:"D",order:14}]);break;case"straightflush":r.push([{rank:"K",suit:"C",order:13},{rank:"6",suit:"D",order:6},{rank:"7",suit:"D",order:7},{rank:"8",suit:"D",order:8},{rank:"9",suit:"D",order:9},{rank:"10",suit:"D",order:10},{rank:"A",suit:"D",order:14}]);break;case"royalflush":r.push([{rank:"10",suit:"S",order:10},{rank:"J",suit:"S",order:11},{rank:"Q",suit:"S",order:12},{rank:"K",suit:"S",order:13},{rank:"A",suit:"S",order:14},{rank:"4",suit:"H",order:4},{rank:"7",suit:"D",order:7}])}return r[0]}((u=x()).slug)),o=0;o<2;o++)h.push(c.pop());for(y+=p(h)+"(Hole) \n",o=0;o<3;o++)f.push(c.pop());for(y+=p(f)+"(Flop) \n",o=0;o<1;o++)k.push(c.pop());for(o=0;o<1;o++)g.push(c.pop());y+=p(k)+p(g)+"(Turn & River) \n",d=h.concat(f,k,g),m=u.name,t=m,d.sort(function(e,r){return e.order<r.order?-1:e.order>r.order?1:0}),y+="Board: "+p(d,"text")+" \n",y+="Best Hand: "+m,cb.sendNotice(y,null,null,b(),"bold"),cb.sendNotice("Prize: "+cb.settings["prize_"+u.slug],null,b(),_(),"bold"),a=cb.settings["prize_"+u.slug]}n++,i=e.from_user,cb.drawPanel()}function K(){f(),cb.setTimeout(K,60*parseInt(cb.settings.advertisement_interval)*1e3)}function J(e,r){var n=e.slice(0),t=function(e,r){var n=k(e),t=r.rank.toString()+r.suit.toString();return n.indexOf(t)}(n,r);return n.splice(t,1),n}function L(e,r,n,t,i,a,o){let s={};return s.hole=e,s.flop=r,s.turn=n,s.river=t,s.result=i,s.msg=a,s.prize=o,s}function Q(e){var r,n,t;for(t=e.length-1;t>0;t--)r=Math.floor(Math.random()*(t+1)),n=e[t],e[t]=e[r],e[r]=n;return e}return{init:function(){cb.log("Loading Texas Hold'em..."),function(){var r,n,t,i,a;for(cb.settings_choices=[],h({name:"heading_general",type:"choice",label:m("General"),required:!1}),h({name:"gamemode",type:"choice",label:"Game Mode",choice1:"Standard (Simulated hands, Mostly-authentic chances)",choice2:'"Roll the Dice" (Non-simulated hands, Configurable chances)'}),h({name:"advertisement_interval",type:"int",label:"How often should the app advertise itself (in minutes)? ",minValue:1,maxValue:1e3,defaultValue:10,required:!0}),h({name:"heading_prices",type:"choice",label:m("Prices"),required:!1}),h({name:"price",type:"int",label:"How many tokens should it cost to play a hand of Texas Hold'em? ",minValue:0,maxValue:1e4,defaultValue:25,required:!0}),h({name:"use_price_multiples",type:"choice",label:"Should tips that are higher than the hand price result in multiple hands being played? ",choice1:"Yes",choice2:"No",defaultValue:"Yes"}),h({name:"max_price_multiples",type:"int",label:"What is the maximum number of hands allowed from a single tip? ",minValue:0,maxValue:100,defaultValue:20,required:!0}),h({name:"heading_prizes",type:"choice",label:m("Prizes"),required:!1}),r=0;r<l.length;r++)h({name:"prize_"+(n=l[r]).slug,type:"str",label:"Prize for "+n.name+" ("+n.display_chance.toString()+"% chance)",minLength:0,maxLength:1e3,defaultValue:n.default,required:!1});for(h({name:"heading_chances_rollthedice",type:"choice",label:m('Chances for "Roll the Dice" mode'),required:!1}),r=0;r<l.length;r++){for(n=l[r],(a={}).name="chance_rollthedice_"+n.slug,a.type="choice",a.label="Chance for "+n.name,a.required=!1,t=0;t<e.length;t++)i=e[t],a["choice"+(t+1).toString()]=i.name,t==n.rollthedice_chance_index&&(a.defaultValue=i.name);h(a)}}(),function(){let r,n,t,i,a;for(r=0;r<l.length;r++)for(t=l[r],a=(i=e[t.rollthedice_chance_index]).weight,n=0;n<a;n++)c.push(r)}(),cb.onDrawPanel(function(e){return{template:"image_template",layers:[{type:"image",fileID:u.bg},{type:"text",text:"Last hand:",top:3,left:10,"font-size":u.font_size,"font-weight":u.font_weight,color:u.font_colour},{type:"text",text:t,top:3,left:97,"font-size":u.font_size,"font-weight":u.font_weight,color:u.font_colour},{type:"text",text:"Last prize won:",top:20,left:10,"font-size":u.font_size,"font-weight":u.font_weight,color:u.font_colour},{type:"text",text:a,top:20,left:97,"font-size":u.font_size,"font-weight":u.font_weight,color:u.font_colour},{type:"text",text:"Last player:",top:37,left:10,"font-size":u.font_size,"font-weight":u.font_weight,color:u.font_colour},{type:"text",text:i,top:37,left:97,"font-size":u.font_size,"font-weight":u.font_weight,color:u.font_colour},{type:"text",text:"Hands played: "+n+" | Pot: "+d,top:54,left:10,"font-size":u.font_size,"font-weight":u.font_weight,color:u.font_colour}]}}),cb.onEnter(function(e){!function(e){f(e)}(e)}),cb.onMessage(function(e){return function(e){switch(e.m){case"!play":(S(e.user)||e.is_mod)&&T(e);break;case"!prizes":g(e.user);break;case"!prizes all":(S(e.user)||e.is_mod)&&g(null)}return e}(e)}),cb.onTip(function(e){y(e)}),cb.setTimeout(K,60*parseInt(cb.settings.advertisement_interval)*1e3),f(),cb.drawPanel()}}}();TEXAS_HOLDEM.init();
© Copyright Freesexcam 2011- 2024. All Rights Reserved.