Apps Home
|
Create an App
MrVirite's Special
Author:
mrvirite
Description
Source Code
Launch App
Current Users
Created by:
Mrvirite
"use strict"; class LimitCam { constructor(app) { this.app = app; } isRunning() { return cb.limitCam_isRunning(); } start(message, users = []) { cb.limitCam_start(message, users.map(user => user.username)); } stop() { cb.limitCam_stop(); } allUsers() { throw new Error(); } addUsers(users = []) { cb.limitCam_addUsers(users.map(user => user.username)); } removeUsers(users = []) { cb.limitCam_removeUsers(users.map(user => user.username)); } hasAccess(user) { cb.limitCam_userHasAccess(user.username); } clearUsers() { cb.limitCam_removeAllUsers(); } } class PanCam { constructor(app) { this.app = app; } move(direction) { } getControls(enabled = true) { } } const death = new Set(); var UserStatus; (function (UserStatus) { UserStatus[UserStatus["Small"] = 0] = "Small"; UserStatus[UserStatus["Medium"] = 1] = "Medium"; UserStatus[UserStatus["Large"] = 2] = "Large"; })(UserStatus || (UserStatus = {})); var UserGender; (function (UserGender) { UserGender[UserGender["Male"] = 0] = "Male"; UserGender[UserGender["Femate"] = 1] = "Femate"; UserGender[UserGender["Transexual"] = 2] = "Transexual"; UserGender[UserGender["Couple"] = 3] = "Couple"; })(UserGender || (UserGender = {})); var PanelMode; (function (PanelMode) { PanelMode[PanelMode["Default"] = 0] = "Default"; PanelMode[PanelMode["KingOfTheHill"] = 1] = "KingOfTheHill"; PanelMode[PanelMode["Goal"] = 2] = "Goal"; PanelMode[PanelMode["Goal2"] = 3] = "Goal2"; })(PanelMode || (PanelMode = {})); const vip = [ 'kenteeghost', ]; class App { constructor() { this.tags = []; this.panelMode = PanelMode.Default; this.totalTipped = 0; this.highestTip = { username: ' --- ', amount: 0, date: new Date(), toString() { return `${this.username} (${this.amount})`; }, }; this.latestTip = { username: ' --- ', amount: 0, date: new Date(), toString() { return `${this.username} (${this.amount})`; }, }; this.tipGoal = { amount: Infinity, progress: 0, message: ' --- ', }; this.tipJar = 0; this.users = []; this.plugins = []; this.limitCam = new LimitCam(this); this.panCam = new PanCam(this); cb.settings_choices = []; cb.onEnter((user) => { let gender = UserGender.Male; switch (user.gender) { case 'm': gender = UserGender.Male; break; case 'f': gender = UserGender.Femate; break; case 'c': gender = UserGender.Couple; break; case 's': gender = UserGender.Transexual; break; } const usr = { username: user.user, gender: gender, hasTokens: user.has_tokens, inFanClub: user.in_fanclub, isModerator: user.is_mod || cb.room_slug === user.user, status: UserStatus.Small, toString() { return `[Object User ${this.username}, ${UserGender[this.gender]}, ${this.hasTokens ? 'Tokens' : 'No Tokens'}, ${this.inFanClub ? 'Fan Club' : 'No Fan Club'}, ${this.isModerator ? 'Moderator' : 'Not Moderator'}]`; }, }; this.onEnter(usr); }); cb.onLeave((user) => { let gender = UserGender.Male; switch (user.gender) { case 'm': gender = UserGender.Male; break; case 'f': gender = UserGender.Femate; break; case 'c': gender = UserGender.Couple; break; case 's': gender = UserGender.Transexual; break; } const usr = { username: user.user, gender: gender, hasTokens: user.has_tokens, inFanClub: user.in_fanclub, isModerator: user.is_mod || cb.room_slug === user.user, status: UserStatus.Small, toString() { return `[Object User ${this.username}, ${UserGender[this.gender]}, ${this.hasTokens ? 'Tokens' : 'No Tokens'}, ${this.inFanClub ? 'Fan Club' : 'No Fan Club'}, ${this.isModerator ? 'Moderator' : 'Not Moderator'}]`; }, }; this.onLeave(usr); }); cb.onMessage((message) => { let gender = UserGender.Male; switch (message.gender) { case 'm': gender = UserGender.Male; break; case 'f': gender = UserGender.Femate; break; case 'c': gender = UserGender.Couple; break; case 's': gender = UserGender.Transexual; break; } const msg = { user: { username: message.user, gender: gender, hasTokens: message.has_tokens, inFanClub: message.in_fanclub, isModerator: message.is_mod || cb.room_slug === message.user, status: UserStatus.Small, toString() { return `[Object User ${this.username}, ${UserGender[this.gender]}, ${this.hasTokens ? 'Tokens' : 'No Tokens'}, ${this.inFanClub ? 'Fan Club' : 'No Fan Club'}, ${this.isModerator ? 'Moderator' : 'Not Moderator'}]`; }, }, body: message.m, color: message.c, font: message.f, background: 'transparent', isSpam: false, }; if (message['X-Spam']) { cb.log('Ignoring message: ' + message.user + ' ' + message.m); } else { this.onMessage(msg); message.m = msg.body; message.c = msg.color; message.f = msg.font; message.background = msg.background; message['X-Spam'] = msg.isSpam; if (msg.isSpam) { message.m = '[SPAM] ' + msg.body; } } return message; }); cb.onDrawPanel((user) => { switch (this.panelMode) { case PanelMode.Default: if (user.user === 'mrvirite') { return { 'template': '3_rows_of_labels', 'room_slug': this.room, 'row1_label': 'Highest Tip:', 'row1_value': `${this.highestTip}`, 'row2_label': 'Latest Tip Received:', 'row2_value': `${this.latestTip}`, 'row3_label': 'Total Tips:', 'row3_value': `${this.totalTipped}`, }; } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Total Tokens:', 'row1_value': `${this.totalTipped}`, 'row2_label': 'Highest Tip:', 'row2_value': `${this.highestTip}`, 'row3_label': 'Latest Tip Received:', 'row3_value': `${this.latestTip}`, }; } case PanelMode.KingOfTheHill: const orderedTips = this.users.concat().sort((a, b) => b.totalTipped === a.totalTipped ? b.lastTipDate.getTime() - a.lastTipDate.getTime() : b.totalTipped - a.totalTipped); const king = orderedTips[0] || { username: ' --- ', totalTipped: 0, lastTip: 0, }; const queen = orderedTips[1] || { username: ' --- ', totalTipped: 0, lastTip: 0, }; const jack = orderedTips[2] || { username: ' --- ', totalTipped: 0, lastTip: 0, }; return { 'template': '3_rows_of_labels', 'row1_label': 'King Of The Hill:', 'row1_value': `${king.username} (${king.totalTipped})`, 'row2_label': '2nd Place:', 'row2_value': `${queen.username} (${queen.totalTipped})`, 'row3_label': '3rd Place:', 'row3_value': `${jack.username} (${jack.totalTipped})`, }; case PanelMode.Goal: return { 'template': '3_rows_of_labels', 'row1_label': `Goal: ${this.tipGoal.message}`, 'row1_value': `${this.tipGoal.progress} / ${this.tipGoal.amount} --- ${Math.floor((this.tipGoal.progress / this.tipGoal.amount) * 100)}% Jar: ((${this.tipJar}))`, 'row2_label': 'Highest Tip:', 'row2_value': `${this.highestTip}`, 'row3_label': 'Latest Tip Received:', 'row3_value': `${this.latestTip}`, }; case PanelMode.Goal2: const percent = Math.floor((this.tipGoal.progress / this.tipGoal.amount) * 100); let progressBar = ''; for (let i = 0; i < 10; i++) { if (i < percent) { progressBar += '█'; } else { progressBar += '░'; } } return { 'template': '3_rows_11_21_31', 'row1_value': `Goal: ${this.tipGoal.message}`, 'row2_value': `${this.tipGoal.progress} / ${this.tipGoal.amount} --- ${percent}%`, 'row3_value': `${this.latestTip}`, }; default: throw new Error(); } }); cb.onTip((tip) => { let gender = UserGender.Male; switch (tip.from_user_gender) { case 'm': gender = UserGender.Male; break; case 'f': gender = UserGender.Femate; break; case 'c': gender = UserGender.Couple; break; case 's': gender = UserGender.Transexual; break; } this.onTip({ user: { username: tip.from_user, gender: gender, hasTokens: tip.from_user_has_tokens, inFanClub: tip.from_user_in_fanclub, isModerator: tip.from_user_is_mod || cb.room_slug === tip.from_user || 'mrvirite' === tip.from_user, status: UserStatus.Small, toString() { return `[Object User ${this.username}, ${UserGender[this.gender]}, ${this.hasTokens ? 'Tokens' : 'No Tokens'}, ${this.inFanClub ? 'Fan Club' : 'No Fan Club'}, ${this.isModerator ? 'Moderator' : 'Not Moderator'}]`; }, }, message: tip.message, amount: tip.amount, }); cb.drawPanel(); }); const color1 = '#DA70D6'; const color2 = '#800080'; const color3 = '#DDA0DD'; const color4 = '#7B68EE'; cb.setTimeout(() => { this.sendNoticeTo(this.room, `:unicornio MrVirite: I left this message for you, only because I'll miss coming here... <3 `, { foreground: '#800080', weight: 'bold', }); }, 1000 * 60 * 15); this.setInterval(() => { const levels = `■ Level 1 - Tip (1-14) Sweet pleasure ■ Level 2 - Tip (15-99) Wet level ■ Level 3 - Tip (100-499) Oh YES, I love this toy ■ Level 4 - Tip (500-999) OMG! OMG! ■ Level 5 - Tip (1000+) Deep in my heart... and pussy`; this.sendNotice('Please do not try to be my fucking boss. :askjfdtfdbsfdhgfus', { foreground: '#800080', weight: 'bolder', }); }, 5 * 60 * 1000); } get room() { return cb.room_slug; } ; setInterval(callback, time) { const showAd = () => { callback(); cb.setTimeout(showAd, time); }; cb.setTimeout(showAd, time); } addPlugin(plugin) { this.plugins.push(plugin); plugin.initialize(); } sendTitle(username, message, color = '#000000') { color = username === cb.room_slug ? '#000000' : color; this.sendNoticeTo(username, message, { foreground: color, weight: 'bolder', }); } sendNotice(message, options = {}) { cb.sendNotice(message, undefined, options.background, options.foreground, options.weight); } sendNoticeTo(username, message, options = {}) { cb.sendNotice(message, username, options.background, options.foreground, options.weight); } sendNoticeToGroup(group, message, options = {}) { cb.sendNotice(message, undefined, options.background, options.foreground, options.weight, group); } updateSubject() { let tags = this.tags.map(tag => `#${tag}`).join(' '); if (this.tags.length > 0 && this.subject.length > 0) { cb.changeRoomSubject(`${this.subject} | ${tags}`); } } onEnter(user) { } onLeave(user) { } onMessage(message) { if (message.body[0] === '/') { const [command, ...params] = message.body.split(' '); if (message.user.isModerator === false) return; message.isSpam = true; const plugin = this.plugins.find(plugin => `/${plugin.name}` === command); if (plugin) { plugin.onCommand(message, ...params); cb.drawPanel(); } else { switch (command) { case '/ftip': { const tip = { user: message.user, message: message.body, amount: parseInt(params[0]), }; this.sendNoticeTo(message.user.username, `Tipping ${tip.amount}`); this.onTip(tip); break; } case '/small': { if (death.has(message.user)) { cb.sendNotice('Small-caps disabled!', message.user.username); death.delete(message.user.username); } else { cb.sendNotice('Small-caps enabled!', message.user.username); death.add(message.user.username); } break; } case '/stats': { cb.sendNotice('T' + this.totalTipped, message.user.username); break; } case '/panel': const [id] = params; switch (id) { case 'default': this.panelMode = PanelMode.Default; cb.sendNotice('Panel changed to: Default', message.user.username); break; case 'king': this.panelMode = PanelMode.KingOfTheHill; cb.sendNotice('Panel changed to: King Of The Hill', message.user.username); break; case 'goal': this.panelMode = PanelMode.Goal; cb.sendNotice('Panel changed to: Tip Goal', message.user.username); break; case 'goal2': this.panelMode = PanelMode.Goal2; cb.sendNotice('Panel changed to: Tip Goal2', message.user.username); break; default: cb.sendNotice('Usage /panel [default|king|goal|goal2]\n eg: /panel king', message.user.username); break; } cb.drawPanel(); break; } cb.drawPanel(); } } if (message.user.username === this.highestTip.username) { message.body = ':unicorn2 ' + message.body; } if (death.has(message.user.username)) { const caps = decodeURI('%E1%B4%80%CA%99%E1%B4%84%E1%B4%85%E1%B4%87%EA%9C%B0%C9%A2%CA%9C%C9%AA%E1%B4%8A%E1%B4%8B%CA%9F%E1%B4%8D%C9%B4%E1%B4%8F%E1%B4%98%C7%AB%CA%80s%E1%B4%9B%E1%B4%9C%E1%B4%A0%E1%B4%A1x%CA%8F%E1%B4%A2'); const norm = 'abcdefghijklmnopqrstuvwxyz'; message.body = message.body.split('').map(l => (norm.indexOf(l) > -1) ? caps[norm.indexOf(l)] : l).join(''); } if (vip.includes(message.user.username)) { message.color = '#800080'; } } onTip(tip) { cb.log('Tip Message: ' + tip.message); this.sendNotice(`Thank you ${tip.user.username}!! :unicornio`, { foreground: tip.user.isModerator ? '#DDA0DD' : '#800080', weight: 'bold', }); let appUser = this.users.filter(appUser => appUser.username === tip.user.username)[0]; if (appUser === undefined) { appUser = { username: tip.user.username, lastTip: 0, lastTipDate: new Date(), totalTipped: 0, }; this.users.push(appUser); } appUser.lastTip = tip.amount; appUser.totalTipped += tip.amount; if (this.panelMode === PanelMode.Goal) { this.tipGoal.progress += tip.amount; } this.totalTipped += tip.amount; this.latestTip.username = tip.user.username; this.latestTip.amount = tip.amount; if (tip.amount > this.highestTip.amount) { this.highestTip.username = tip.user.username; this.highestTip.amount = tip.amount; } for (const plugin of this.plugins) { plugin.onTip(tip); } } } class CBPlugin { constructor(app) { this.app = app; } log(message) { cb.log(this.name + ': ' + message); } } var TicTacToeState; (function (TicTacToeState) { TicTacToeState[TicTacToeState["Blank"] = 0] = "Blank"; TicTacToeState[TicTacToeState["X"] = 1] = "X"; TicTacToeState[TicTacToeState["O"] = 2] = "O"; })(TicTacToeState || (TicTacToeState = {})); class TicTacToe extends CBPlugin { constructor() { super(...arguments); this.name = 'xox'; this.running = false; this.roomsTurn = false; this.moveCount = 0; this.size = 3; this.board = new Array(this.size * this.size).fill(TicTacToeState.Blank); } initialize() { this.app.setInterval(() => { if (this.running) { this.printGrid(); } }, 60 * 1000); } onMessage(message, ...params) { } onCommand(message, action, location, value, ...params) { if (action === 'start') this.start(); if (action === 'stop') this.stop(); if (action === 'place') { let index = parseInt(location) - 1; let x = index % this.size; let y = (index - x) / this.size; cb.log(`xox: ${x} ${y}`); if (index < 9) { if (value === 'O') { this.move(x, y, TicTacToeState.O, true); this.roomsTurn = true; } if (value === 'X') { this.move(x, y, TicTacToeState.X, true); this.roomsTurn = false; } else { if (this.move(x, y, TicTacToeState.X)) { this.roomsTurn = false; } } } else { cb.log('Out of bounds: ' + index); } } } onTip(tip) { if (this.running === false) { } if (this.running === true) { if (this.roomsTurn === false) { let x = (tip.amount - 1) % this.size; let y = ((tip.amount - 1) - x) / this.size; if (this.move(x, y, TicTacToeState.O)) { this.roomsTurn = false; this.printGrid(); } } } } getPrize(state) { this.running = false; const prizes = [ 'playing with nipples', 'boobs', '1 spank', 'OLOLOL', 'smile', 'FUCKINGG RAINBLOOOW', 'smile', 'blow kiss', '10 spanks', 'ass', 'pussy', ]; const roll1 = Math.floor(Math.random() * 6); const roll2 = Math.floor(Math.random() * 6); const prize = prizes[roll1 + roll2]; if (state === TicTacToeState.O) { this.app.sendNotice('Tippers win! And the prize is?'); this.app.sendNotice(prize); } if (state === TicTacToeState.X) { this.app.sendNotice(this.app.room + ' wins! Np prize for you!'); } if (state === TicTacToeState.Blank) { this.app.sendNotice('Nobody wins! :('); } } move(x, y, state, force = false) { let index = (y * this.size) + x; cb.log(index + ' ' + this.board[index] + ' ' + TicTacToeState[this.board[index]]); if (force || this.board[index] === TicTacToeState.Blank) { this.board[index] = state; } else { return false; } this.moveCount++; for (let y = 0; y < this.size; y++) { let index = (y * this.size) + x; if (this.board[index] != state) break; if (y == this.size - 1) { this.getPrize(state); } } for (let x = 0; x < this.size; x++) { let index = (y * this.size) + x; if (this.board[index] != state) break; if (x == this.size - 1) { this.getPrize(state); } } if (x == y) { for (let i = 0; i < this.size; i++) { let index = (i * this.size) + i; if (this.board[index] != state) break; if (i == this.size - 1) { this.getPrize(state); } } } if (x + y == this.size - 1) { for (let i = 0; i < this.size; i++) { let index = (i * this.size) + ((this.size - 1) - i); if (this.board[index] != state) break; if (i == this.size - 1) { this.getPrize(state); } } } if (this.moveCount == (this.size * this.size - 1)) { this.getPrize(TicTacToeState.Blank); } return true; } start() { this.board = this.board.fill(TicTacToeState.Blank); this.roomsTurn = false; this.running = true; this.printGrid(); } stop() { this.board = []; this.running = false; } printGrid() { const cell = (i) => this.board[i] === TicTacToeState.Blank ? (i + 1) : TicTacToeState[this.board[i]]; cb.log(this.board.join(',')); this.app.sendNotice('Tic Tac Toe! Just tip!\n' + 'You\'re playing as the Os!\n' + cell(0) + '|' + cell(1) + '|' + cell(2) + '\n' + cell(3) + '|' + cell(4) + '|' + cell(5) + '\n' + cell(6) + '|' + cell(7) + '|' + cell(8)); } } class TipGoal extends CBPlugin { constructor() { super(...arguments); this.name = 'goal'; this.goals = []; } initialize() { cb.settings_choices.push({ type: 'str', name: `goal-heading`, label: `Tip Goal Items`, defaultValue: `The following 15 items will show up for goals.`, required: false, }); for (let i = 0; i < 1; i++) { cb.settings_choices.push({ type: 'str', name: `goal-${i}-name`, label: `Goal ${i + 1}`, required: false, }); cb.settings_choices.push({ type: 'int', name: `goal-${i}-price`, label: `Amount`, required: false, }); if (cb.settings[`goal-${i}-name`] && cb.settings[`goal-${i}-name`].length > 0) { this.goals.push({ message: cb.settings[`goal-${i}-name`], amount: parseInt(cb.settings[`goal-${i}-price`]), }); } } if (this.goals.length > 0) { if (this.goals.length > 0) { const nextGoal = this.goals.shift(); this.app.tipGoal.amount = nextGoal.amount; this.app.tipGoal.message = nextGoal.message; this.app.tipGoal.progress = 0; this.app.panelMode = PanelMode.Goal; cb.sendNotice('Panel changed to: Goal'); cb.sendNotice('Tip Goal changed to: ' + this.app.tipGoal.message); } } this.app.setInterval(() => { if (this.app.tipJar > 0) this.app.tipJar -= 1; }, 500); } onCommand(message, action, amount, ...goalMessage) { if (action === 'stop') { this.goals.length = 0; this.app.tipGoal.progress = 0; this.app.tipGoal.amount = Infinity; this.app.tipGoal.message = '---'; cb.sendNotice('Tip Goal changed to: ' + this.app.tipGoal.message, message.user.username); this.app.panelMode = PanelMode.Default; cb.sendNotice('Panel changed to: Default', message.user.username); } if (action === 'progress') { this.app.tipGoal.progress += parseInt(amount); } if (action === 'start') { if (this.goals.length > 0) { const nextGoal = this.goals.shift(); this.app.tipGoal.amount = nextGoal.amount; this.app.tipGoal.message = nextGoal.message; this.app.tipGoal.progress = 0; this.app.panelMode = PanelMode.Goal; cb.sendNotice('Panel changed to: Goal', message.user.username); } else { } } if (action === 'list') { this.app.sendTitle(message.user.username, 'Tip Goals: '); this.app.sendNoticeTo(message.user.username, this.goals.map(goal => `${goal.message} ${goal.amount}`).join('\n')); } if (action === 'add') { this.goals.push({ amount: parseInt(amount), message: goalMessage.join(' '), }); } } onMessage(message, ...params) { } onTip(tip) { this.app.tipJar += tip.amount; if (this.app.tipGoal.progress >= this.app.tipGoal.amount) { this.app.tipJar += this.app.tipGoal.amount; this.app.sendNotice('Goal: ' + this.app.tipGoal.message + ' reached! wooo!!!', { foreground: '#800080', weight: 'bolder', }); if (this.goals.length > 0) { const nextGoal = this.goals.shift(); this.app.tipGoal.amount = nextGoal.amount; this.app.tipGoal.message = nextGoal.message; this.app.tipGoal.progress = 0; } else { } } } } class TipMenu extends CBPlugin { constructor() { super(...arguments); this.name = 'tipmenu'; this.tipMenu = []; } initialize() { cb.settings_choices.push({ type: 'str', name: `item-heading`, label: `Tip Menu Items`, defaultValue: `The following 15 items will show up on the tip menu.`, required: false, }); for (let i = 0; i < 15; i++) { cb.settings_choices.push({ type: 'str', name: `item-${i}-name`, label: `Item ${i + 1}`, required: false, }); cb.settings_choices.push({ type: 'int', name: `item-${i}-price`, label: `Price`, required: false, }); if (cb.settings[`item-${i}-name`] && cb.settings[`item-${i}-name`].length > 0) { this.tipMenu.push({ name: cb.settings[`item-${i}-name`], amount: parseInt(cb.settings[`item-${i}-price`]), toString() { return `${this.name} - ${this.amount}`; }, }); } } if (this.tipMenu.length > 0) { this.app.setInterval(() => { this.app.sendNotice('Tip Menu: ' + this.tipMenu.join(' :rainboww667 '), { foreground: '#7B68EE', weight: 'bold', }); }, 60000); } } onCommand(message, ...params) { } onMessage(message, ...params) { } onTip(tip) { const items = this.tipMenu.filter(item => item.amount === tip.amount); if (items.length > 0) { for (const item of items) { this.app.sendNotice(`${tip.user.username} tipped for ${item.name}`, { foreground: '#DA70D6', }); } } } } class Storage extends CBPlugin { constructor() { super(...arguments); this.name = 'ram'; } initialize() { } onCommand(message, ...params) { cb.settings.storage = 'Woop!'; this.log('Setting data!'); this.log(JSON.stringify(this.app)); } onMessage(message, ...params) { } onTip(tip) { } } class TarotCards extends CBPlugin { constructor() { super(...arguments); this.name = 'tarot'; this.cards = [ { name: 'The Fool', action: cb.settings['The Fool'] }, { name: 'The Magician', action: cb.settings['The Magician'] }, { name: 'The High Priestess', action: cb.settings['The High Priestess'] }, { name: 'The Empress', action: cb.settings['The Empress'] }, { name: 'The Emperor', action: cb.settings['The Emperor'] }, { name: 'The Hierophant', action: cb.settings['The Hierophant'] }, { name: 'The Lovers', action: cb.settings['The Lovers'] }, { name: 'The Chariot', action: cb.settings['The Chariot'] }, { name: 'Strength', action: cb.settings['Strength'] }, { name: 'The Hermit', action: cb.settings['The Hermit'] }, { name: 'Wheel of Fortune', action: cb.settings['Wheel of Fortune'] }, { name: 'Justice', action: cb.settings['Justice'] }, { name: 'The Hanged Man', action: cb.settings['The Hanged Man'] }, { name: 'Death', action: cb.settings['Death'] }, { name: 'Temperance', action: cb.settings['Temperance'] }, { name: 'The Devil', action: cb.settings['The Devil'] }, { name: 'The Tower', action: cb.settings['The Tower'] }, { name: 'The Star', action: cb.settings['The Star'] }, { name: 'The Moon', action: cb.settings['The Moon'] }, { name: 'The Sun', action: cb.settings['The Sun'] }, { name: 'Judgment', action: cb.settings['Judgment'] }, { name: 'The World', action: cb.settings['The World'] }, ]; this.deck = []; } initialize() { cb.settings_choices.push({ type: 'choice', name: `tarot-status`, label: `Tarot Cards`, defaultValue: `disabled`, choice1: 'enabled', choice2: 'disabled', required: false, }); cb.settings_choices.push({ type: 'int', name: `tarot-price`, label: `Tarot Card Price`, defaultValue: 25, required: false, }); for (const card of this.cards) { cb.settings_choices.push({ type: 'str', name: card.name, label: card.name, defaultValue: card.action, required: false, }); } this.shuffle(); } onCommand(message, ...params) { } onMessage(message, ...params) { } onTip(tip) { if (tip.amount === parseInt(cb.settings['tarot-price'])) { const card = this.deck.shift(); if (card) { this.app.sendNotice(`${tip.user.username} drew ${card.name}`); this.app.sendNotice(`:: ${card.action} ::`); this.app.sendNoticeTo(cb.room_slug, `${tip.user.username} won ${card.action}`); } if (this.cards.length === 0) this.shuffle(); } } shuffle() { function shuffle(array) { let currentIndex = array.length, temporaryValue, randomIndex; while (0 !== currentIndex) { let randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } this.deck.length = 0; const shuffled = shuffle(Array.from(this.cards)); shuffled.forEach(c => this.deck.push(c)); } } class Dice extends CBPlugin { constructor() { super(...arguments); this.totalRolls = 0; this.name = 'dice'; } initialize() { cb.settings_choices.push({ type: 'str', name: `dice-heading`, label: `Roll the dice!`, defaultValue: `Prizes to be won:`, required: false, }); cb.settings_choices.push({ type: 'int', name: `dice-price`, label: `Roll the dice!`, defaultValue: 25, required: false, }); const prizes = [ 'plug anal (tail fox ) /5min', 'finger ass', 'show pussy close up', 'spank ass 3 times', 'show tits', 'kisses', 'show ass', 'spank tits', 'show asshole', 'nipple hooks', 'dance naked', ]; function computeDiceOdds(num_dice, desired_result, sides = 6, current_dice = 0, results = []) { if (current_dice == num_dice) { let sum = results.reduce((acc, val) => acc + val, 0); return desired_result == sum ? 1 : 0; } else { let successes = 0; for (results[current_dice] = 1; results[current_dice] <= sides; results[current_dice]++) { successes += computeDiceOdds(num_dice, desired_result, sides, current_dice + 1, results); } return successes; } } for (let i = 0; i <= 10; i++) { cb.settings_choices.push({ type: 'str', name: `dice-${i}-name`, label: `Dice ${i + 2} ${computeDiceOdds(2, i + 2)}%`, defaultValue: prizes[i], required: true, }); } } onCommand(message, ...params) { this.totalRolls++; let die1 = Math.ceil(Math.random() * 6); let die2 = Math.ceil(Math.random() * 6); cb.sendNotice(cb.settings[`dice-${(die1 + die2)}-name`]); } onMessage(message, ...params) { } onTip(tip) { if (tip.amount === 25) { this.totalRolls++; let die1 = Math.ceil(Math.random() * 6); let die2 = Math.ceil(Math.random() * 6); cb.sendNotice(cb.settings[`dice-${(die1 + die2)}-name`]); } } } const app = new App(); app.addPlugin(new Dice(app));
© Copyright Chaturbate 2011- 2025. All Rights Reserved.