Apps Home
|
Create an App
slotbros
Author:
tinuviel
Description
Source Code
Launch App
Current Users
Created by:
Tinuviel
/** * App: Str8 bros slot Machine * Version: 4.00 * Author: losbananeros * Date: 02.08.16 */ cb.settings_choices = [ {name: 'tokens', type: 'int', label: 'Cost per spin (in tokens)', defaultValue: 10}, {name: 'notice_wait_time', type: 'choice', label: 'Notification Time (in minutes)', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 10, choice7: 15, choice8: 20, choice9: 25, choice10: 30, choice11: 45, choice12: 60, defaultValue: 10}, {name:'player_1', type:'str', label:'Player 1 nickname', defaultValue:'Left'}, {name:'player_2', type:'str', label:'Player 2 nickname', defaultValue:'Right'}, {name:'special_tokens', type:'int', label:'Cost per special spin (in tokens)', defaultValue: 100} ]; var langTokens = (cb.settings.tokens > 1) ? 'tokens' : 'token'; var lastPlayer = '--'; var lastPrizeWon = '--'; var spinCounter = 0; var tipCounter = 0; var prizesWon = Array(); var both = 'Both'; var kiss = 'Kiss'; var touch = 'Touch'; var grab = 'Grab'; var slap = 'Slap'; var poke = 'Dick Poke'; var actions = Array(kiss, touch, grab, slap, poke); var xactions = Array(kiss, grab, poke); var mouth = 'Mouth'; var ear = 'Ear'; var neck = 'Neck'; var nipples = 'Nipples'; var dick = 'Dick'; var balls = 'Balls'; var ass = 'Ass'; var feet = 'Feet'; var elbow = 'Elbow'; var shoulder = 'Shoulder'; var belly = 'Belly'; var back = 'Back'; var knee = 'Knee'; var fingers = 'Fingers'; var hand = 'Hand'; var forehead = 'Forehead'; var cheek = 'Cheek'; var hip = 'Hip'; var thigh = 'Thigh'; var calf = 'Calf'; var ankle = 'Ankle'; var armpit = 'Armpit'; var nose = 'Nose'; var bodyParts = Array(dick, balls, ass, mouth, ear, neck, nipples, hip, thigh, feet, shoulder, cheek, back, knee, hand, forehead, elbow, calf, ankle, fingers, belly, nose, armpit); var xbodyParts = Array(dick, balls, ass, mouth); cb.onTip(function (tip) { tipCounter += parseInt(tip['amount']); if (parseInt(tip['amount']) >= cb.settings.tokens) { var numberOfSpecialSpins = Math.floor(parseInt(tip['amount'])/cb.settings.special_tokens); for(var i=1;i<=numberOfSpecialSpins;i++) { cb.setTimeout(function() { special_spin(tip['from_user']); }, 2000*i); } var newAmount = parseInt(tip['amount']) - (numberOfSpecialSpins * cb.settings.special_tokens); var numberOfSpins = Math.floor(newAmount/cb.settings.tokens); for(var i=1;i<=numberOfSpins;i++) { cb.setTimeout(function() { spin(tip['from_user']); }, 2000*i); } } }); cb.onDrawPanel(function (user) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Last prize won:', 'row1_value': lastPrizeWon, 'row2_label': 'Last player:', 'row2_value': lastPlayer, 'row3_value': tipCounter + ' ' + langTokens + ' received / spun ' + spinCounter + ' time(s)' }; }); cb.onEnter(function (user) { var notices = "Welcome, " + user['user'] + ". We are playing the str8 bros slot machine by losbananeros\n"; notices += 'Tip ' + cb.settings.tokens + ' ' + langTokens + ' to spin the reels.\n'; notices += 'Tip ' + cb.settings.special_tokens + ' tokens to have a special spin in which the action is ' + cb.settings.special_action + ' (the player and the body part will still be random)\n'; notices += 'The selected player will perform the action in the other player\'s body part.\n'; notices += 'Each 5 spins, the last body part on the list will be removed from the game.\n'; notices += 'Type "/p" to see the possible combinations.\n'; notices += 'Type "/w" to see a list of the last 20 winners.\n'; notices += 'Type "/a" to see a list of all the winners.'; cb.sendNotice(notices, user['user'], '', '#FF6600', 'bold'); }); cb.onMessage(function(msg) { if(msg['m'].match(/\/w/i)) { msg['X-Spam'] = true; showPrizesWon(msg['user']); } else if(msg['m'].match(/\/p/i)) { msg['X-Spam'] = true; showPrizes(msg['user']); } else if(msg['m'].match(/\/s/i)) { msg['X-Spam'] = true; showSpecialPrizes(msg['user']); } else if(msg['m'].match(/\/a/i)) { msg['X-Spam'] = true; showAllPrizesWon(msg['user']); } return msg; }); function getPlayer(){ var aux = Math.floor(Math.random() * 3); switch(aux){ case 0: player = cb.settings.player_1; break; case 1: player = cb.settings.player_2; break; case 2: player = both; break; } return player; } function getAction(x){ var action = actions[Math.floor(Math.random() * actions.length)]; if(x){ action = xactions[Math.floor(Math.random() * xactions.length)]; } return action; } function getBodyPart(x){ var bodyPart = bodyParts[Math.floor(Math.random() * bodyParts.length)]; if(x){ var bodyPart = xbodyParts[Math.floor(Math.random() * xbodyParts.length)]; } return bodyPart; } function spin(username) { spinCounter++; var player = getPlayer(); var action = getAction(false); var bodyPart = getBodyPart(false); var prize = player + ' ' + action + ' ' + bodyPart; cb.sendNotice(prize); lastPlayer = username; lastPrizeWon = prize; prizesWon.push(prize + ' - ' + username); cb.sendNotice(username + ' won a prize! Prize: ' + prize, '', '#99FF99', '', 'bold'); cb.drawPanel(); adjustPrizes(); return prize; } function special_spin(username) { spinCounter++; var player = getPlayer(); var action = getAction(true); var bodyPart = getBodyPart(true); var prize = player + ' ' + action + ' ' + bodyPart; cb.sendNotice(prize); lastPlayer = username; lastPrizeWon = prize; prizesWon.push(prize + ' - ' + username); cb.sendNotice(username + ' won a prize in a special spin! Prize: ' + prize, '', '#99FF99', '', 'bold'); cb.drawPanel(); adjustPrizes(); return prize; } function adjustPrizes(){ if((spinCounter % 5 == 0) && (bodyParts.length > 5)){ var lastPart = bodyParts.pop(); cb.sendNotice(lastPart + ' is no longer a possible body part.'); } } function showPrizes(username) { var notices = '**** Possible Actions ****'; for(var i=0; i<actions.length; i++){ notices += '\n->' + actions[i]; } notices += '\n**** Possible Body Parts ****'; for(var i=0; i<bodyParts.length; i++){ notices += '\n->' + bodyParts[i]; } cb.sendNotice(notices, username, '#D1F0FF', '', 'bold'); } function showSpecialPrizes(username) { var notices = '**** Possible Actions in Special Spin ****'; for(var i=0; i<xactions.length; i++){ notices += '\n->' + xactions[i]; } notices += '\n**** Possible Body Parts in Special Spin****'; for(var i=0; i<xbodyParts.length; i++){ notices += '\n->' + xbodyParts[i]; } cb.sendNotice(notices, username, '#D1F0FF', '', 'bold'); } function showPrizesWon(username) { prizesWon.reverse(); if(prizesWon.length == 0) { cb.sendNotice('No one has won anything yet. Play the slot machine to win a prize!', username, '', '#CC0000', 'bold'); } else { //prizesWon.slice(0,20); var notices = "**** Last 20 Winners ****"; var prizeNum = 1; var totalWon = prizesWon.length; if(prizesWon.length >= 20) totalWon = 20; for(var i=0; i<totalWon;i++) { notices += "\n" + prizeNum + ") " + prizesWon[i]; prizeNum++; } cb.sendNotice(notices, username, '#EBFFEB', '', 'bold'); } prizesWon.reverse(); } function showAllPrizesWon(username) { if(prizesWon.length == 0) { cb.sendNotice('No one has won anything yet. Play the slot machine to win a prize!', username, '', '#CC0000', 'bold'); } else { var notices = "**** Winners ****"; var prizeNum = 1; var totalWon = prizesWon.length; for(var i=0; i<totalWon;i++) { notices += "\n" + prizeNum + ") " + prizesWon[i]; prizeNum++; } cb.sendNotice(notices, username, '#EBFFEB', '', 'bold'); } } function advertise() { var notices = "Str8 bros slot machine by losbananeros\n"; notices += 'Tip ' + cb.settings.tokens + ' ' + langTokens + ' to spin the reels.\n'; notices += 'Tip ' + cb.settings.special_tokens + ' tokens to have a special spin with a hot prize!.\n'; notices += 'The selected player will perform the action in the other player\'s body part.\n'; notices += 'Each 5 spins, the last body part on the list will be removed from the game.\n'; notices += 'Type "/p" to see the possible combinations.\n'; notices += 'Type "/s" to see the possible combinations of the special spin.\n'; notices += 'Type "/w" to see a list of the last 20 winners.\n'; notices += 'Type "/a" to see a list of all the winners.'; cb.sendNotice(notices, '', '', '#FF6600', 'bold'); cb.setTimeout(advertise, cb.settings.notice_wait_time * 60000); } function init() { advertise(); cb.changeRoomSubject("Let's play the str8 bros slot machine!"); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.