Game messages won't show up unless you're playing or watching.` : ''}
`\r\n\t\t\t);\r\n\t\t} else if (this.onSendHand(user) === false) {\r\n\t\t\tconnection.sendTo(\r\n\t\t\t\tthis.room,\r\n\t\t\t\t`|uhtml|uno-${this.gameNumber}|
A game of UNO is currently in progress.
` +\r\n\t\t\t\t`${this.suppressMessages ? `
Game messages won't show up unless you're playing or watching.` : ''}
`\r\n\t\t\t);\r\n\t\t}\r\n\t}\r\n\r\n\tonStart(isAutostart?: boolean) {\r\n\t\tif (this.playerCount < 2) {\r\n\t\t\tif (isAutostart) {\r\n\t\t\t\tthis.room.add(\"The game of UNO was forcibly ended because there aren't enough users.\");\r\n\t\t\t\tthis.destroy();\r\n\t\t\t\treturn false;\r\n\t\t\t} else {\r\n\t\t\t\tthrow new Chat.ErrorMessage(\"There must be at least 2 players to start a game of UNO.\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (this.autostartTimer) clearTimeout(this.autostartTimer);\r\n\t\tthis.sendToRoom(`|uhtmlchange|uno-${this.gameNumber}|
The game of UNO has started.
${this.suppressMessages ? `
Game messages won't show up unless you're playing or watching.` : ''}
`, true);\r\n\t\tthis.state = 'play';\r\n\r\n\t\tthis.onNextPlayer(); // determines the first player\r\n\r\n\t\t// give cards to the players\r\n\t\tfor (const i in this.playerTable) {\r\n\t\t\tthis.playerTable[i].hand.push(...this.drawCard(7));\r\n\t\t}\r\n\r\n\t\t// top card of the deck.\r\n\t\tdo {\r\n\t\t\tthis.topCard = this.drawCard(1)[0];\r\n\t\t\tthis.discards.unshift(this.topCard);\r\n\t\t} while (this.topCard.color === 'Black');\r\n\r\n\t\tthis.sendToRoom(`|raw|The top card is ${this.topCard.name}.`);\r\n\r\n\t\tthis.onRunEffect(this.topCard.value, true);\r\n\t\tthis.nextTurn(true);\r\n\t}\r\n\r\n\tjoinGame(user: User) {\r\n\t\tif (user.id in this.playerTable) {\r\n\t\t\tthrow new Chat.ErrorMessage(\"You have already joined the game of UNO.\");\r\n\t\t}\r\n\t\tif (this.state === 'signups' && this.addPlayer(user)) {\r\n\t\t\tthis.sendToRoom(`${user.name} has joined the game of UNO.`);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tleaveGame(user: User) {\r\n\t\tif (!(user.id in this.playerTable)) return false;\r\n\t\tif ((this.state === 'signups' && this.removePlayer(user)) || this.eliminate(user.id)) {\r\n\t\t\tthis.sendToRoom(`${user.name} has left the game of UNO.`);\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\t/**\r\n\t * Overwrite the default makePlayer so it makes an UNOPlayer instead.\r\n\t */\r\n\tmakePlayer(user: User) {\r\n\t\treturn new UNOPlayer(user, this);\r\n\t}\r\n\r\n\tonRename(user: User, oldUserid: ID, isJoining: boolean, isForceRenamed: boolean) {\r\n\t\tif (!(oldUserid in this.playerTable) || user.id === oldUserid) return false;\r\n\t\tif (!user.named && !isForceRenamed) {\r\n\t\t\tuser.games.delete(this.roomid);\r\n\t\t\tuser.updateSearch();\r\n\t\t\treturn; // dont set users to their guest accounts.\r\n\t\t}\r\n\t\tthis.playerTable[user.id] = this.playerTable[oldUserid];\r\n\t\t// only run if it's a rename that involves a change of userid\r\n\t\tif (user.id !== oldUserid) delete this.playerTable[oldUserid];\r\n\r\n\t\t// update the user's name information\r\n\t\tthis.playerTable[user.id].name = user.name;\r\n\t\tthis.playerTable[user.id].id = user.id;\r\n\t\tif (this.awaitUno && this.awaitUno === oldUserid) this.awaitUno = user.id;\r\n\r\n\t\tif (this.currentPlayerid === oldUserid) this.currentPlayerid = user.id;\r\n\t}\r\n\r\n\teliminate(userid: ID) {\r\n\t\tif (!(userid in this.playerTable)) return false;\r\n\r\n\t\tconst name = this.playerTable[userid].name;\r\n\r\n\t\tif (this.playerCount === 2) {\r\n\t\t\tthis.removePlayer(this.playerTable[userid]);\r\n\t\t\tthis.onWin(this.playerTable[Object.keys(this.playerTable)[0]]);\r\n\t\t\treturn name;\r\n\t\t}\r\n\r\n\t\t// handle current player...\r\n\t\tconst removingCurrentPlayer = userid === this.currentPlayerid;\r\n\t\tif (removingCurrentPlayer) {\r\n\t\t\tif (this.state === 'color') {\r\n\t\t\t\tif (!this.topCard) {\r\n\t\t\t\t\t// should never happen\r\n\t\t\t\t\tthrow new Error(`No top card in the discard pile.`);\r\n\t\t\t\t}\r\n\t\t\t\tthis.topCard.changedColor = this.discards[1].changedColor || this.discards[1].color;\r\n\t\t\t\tthis.sendToRoom(`|raw|${Utils.escapeHTML(name)} has not picked a color, the color will stay as ${this.topCard.changedColor}.`);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (this.awaitUno === userid) this.awaitUno = null;\r\n\t\tif (!this.topCard) {\r\n\t\t\tthrow new Chat.ErrorMessage(`Unable to disqualify ${name}.`);\r\n\t\t}\r\n\r\n\t\t// put that player's cards into the discard pile to prevent cards from being permanently lost\r\n\t\tthis.discards.push(...this.playerTable[userid].hand);\r\n\r\n\t\tif (removingCurrentPlayer) {\r\n\t\t\tthis.onNextPlayer();\r\n\t\t}\r\n\t\tthis.removePlayer(this.playerTable[userid]);\r\n\t\tif (removingCurrentPlayer) {\r\n\t\t\tthis.nextTurn(true);\r\n\t\t}\r\n\t\treturn name;\r\n\t}\r\n\r\n\tsendToRoom(msg: string, overrideSuppress = false) {\r\n\t\tif (!this.suppressMessages || overrideSuppress) {\r\n\t\t\tthis.room.add(msg).update();\r\n\t\t} else {\r\n\t\t\t// send to the players first\r\n\t\t\tfor (const i in this.playerTable) {\r\n\t\t\t\tthis.playerTable[i].sendRoom(msg);\r\n\t\t\t}\r\n\r\n\t\t\t// send to spectators\r\n\t\t\tfor (const i in this.spectators) {\r\n\t\t\t\tif (i in this.playerTable) continue; // don't double send to users already in the game.\r\n\t\t\t\tconst user = Users.getExact(i);\r\n\t\t\t\tif (user) user.sendTo(this.roomid, msg);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tgetPlayers(showCards?: boolean): string {\r\n\t\tlet playerList = Object.keys(this.playerTable);\r\n\t\tif (!showCards) {\r\n\t\t\treturn playerList.sort().map(id => Utils.escapeHTML(this.playerTable[id].name)).join(', ');\r\n\t\t}\r\n\t\tif (this.direction === -1) playerList = playerList.reverse();\r\n\t\tlet buf = ``;\r\n\t\tfor (const playerid of playerList) {\r\n\t\t\tbuf += `
`;\r\n\t\t}\r\n\t\tbuf += ``;\r\n\t\treturn buf;\r\n\t}\r\n\r\n\tonAwaitUno() {\r\n\t\treturn new Promise(resolve => {\r\n\t\t\tif (!this.awaitUno) return resolve();\r\n\r\n\t\t\tthis.state = \"uno\";\r\n\t\t\t// the throttle for sending messages is at 600ms for non-authed users,\r\n\t\t\t// wait 750ms before sending the next person's turn.\r\n\t\t\t// this allows games to be fairer, so the next player would not spam the pass command blindly\r\n\t\t\t// to force the player to draw 2 cards.\r\n\t\t\t// this also makes games with uno bots not always turn in the bot's favour.\r\n\t\t\t// without a delayed turn, 3 bots playing will always result in a endless game\r\n\t\t\tsetTimeout(() => resolve(), 750);\r\n\t\t});\r\n\t}\r\n\r\n\tnextTurn(starting?: boolean) {\r\n\t\tvoid this.onAwaitUno().then(() => {\r\n\t\t\tif (!starting) this.onNextPlayer();\r\n\r\n\t\t\tif (this.timer) clearTimeout(this.timer);\r\n\t\t\tconst player = this.playerTable[this.currentPlayerid];\r\n\r\n\t\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${player.name}'s turn.`);\r\n\t\t\tthis.state = 'play';\r\n\t\t\tif (player.cardLock) player.cardLock = null;\r\n\t\t\tplayer.sendDisplay();\r\n\r\n\t\t\tthis.timer = setTimeout(() => {\r\n\t\t\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${player.name} has been automatically disqualified.`);\r\n\t\t\t\tthis.eliminate(this.currentPlayerid);\r\n\t\t\t}, this.maxTime * 1000);\r\n\t\t});\r\n\t}\r\n\r\n\tonNextPlayer() {\r\n\t\t// if none is set\r\n\t\tif (!this.currentPlayerid) {\r\n\t\t\tconst userList = Object.keys(this.playerTable);\r\n\t\t\tthis.currentPlayerid = userList[Math.floor(this.playerCount * Math.random())] as ID;\r\n\t\t}\r\n\r\n\t\tthis.currentPlayerid = this.getNextPlayer();\r\n\t}\r\n\r\n\tgetNextPlayer() {\r\n\t\tconst userList = Object.keys(this.playerTable);\r\n\r\n\t\tlet player: ID = userList[(userList.indexOf(this.currentPlayerid) + this.direction)] as ID;\r\n\r\n\t\tif (!player) {\r\n\t\t\tplayer = toID(this.direction === 1 ? userList[0] : userList[this.playerCount - 1]);\r\n\t\t}\r\n\t\treturn player;\r\n\t}\r\n\r\n\tonDraw(player: UNOPlayer) {\r\n\t\tif (this.currentPlayerid !== player.id || this.state !== 'play') return false;\r\n\t\tif (player.cardLock) return true;\r\n\r\n\t\tthis.onCheckUno();\r\n\r\n\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${player.name} has drawn a card.`);\r\n\r\n\t\tconst card = this.onDrawCard(player, 1);\r\n\t\tplayer.sendDisplay();\r\n\t\tplayer.cardLock = card[0].name;\r\n\t}\r\n\r\n\tonPlay(player: UNOPlayer, cardName: string) {\r\n\t\tif (this.currentPlayerid !== player.id || this.state !== 'play') return false;\r\n\r\n\t\tconst card = player.hasCard(cardName);\r\n\t\tif (!card) return \"You do not have that card.\";\r\n\r\n\t\t// check for legal play\r\n\t\tif (!this.topCard) {\r\n\t\t\t// should never happen\r\n\t\t\tthrow new Error(`No top card in the discard pile.`);\r\n\t\t}\r\n\t\tif (player.cardLock && player.cardLock !== cardName) return `You can only play ${player.cardLock} after drawing.`;\r\n\t\tif (\r\n\t\t\tcard.color !== 'Black' &&\r\n\t\t\tcard.color !== (this.topCard.changedColor || this.topCard.color) &&\r\n\t\t\tcard.value !== this.topCard.value\r\n\t\t) {\r\n\t\t\treturn `You cannot play this card; you can only play: Wild cards, ${this.topCard.changedColor ? 'and' : ''} ${this.topCard.changedColor || this.topCard.color} cards${this.topCard.changedColor ? \"\" : ` and cards with the digit ${this.topCard.value}`}.`;\r\n\t\t}\r\n\t\tif (card.value === '+4' && !player.canPlayWildFour()) {\r\n\t\t\treturn \"You cannot play Wild +4 when you still have a card with the same color as the top card.\";\r\n\t\t}\r\n\r\n\t\tif (this.timer) clearTimeout(this.timer); // reset the autodq timer.\r\n\r\n\t\tthis.onCheckUno();\r\n\r\n\t\t// update the game information.\r\n\t\tthis.topCard = card;\r\n\t\tplayer.removeCard(cardName);\r\n\t\tthis.discards.unshift(card);\r\n\r\n\t\t// update the unoId here, so when the display is sent to the player when the play is made\r\n\t\tif (player.hand.length === 1) {\r\n\t\t\tthis.awaitUno = player.id;\r\n\t\t\tthis.unoId = Math.floor(Math.random() * 100).toString() as ID;\r\n\t\t}\r\n\r\n\t\tplayer.sendDisplay(); // update display without the card in it for purposes such as choosing colors\r\n\r\n\t\tthis.sendToRoom(`|raw|${Utils.escapeHTML(player.name)} has played a ${card.name}.`);\r\n\r\n\t\t// handle hand size\r\n\t\tif (!player.hand.length) {\r\n\t\t\tthis.onWin(player);\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// continue with effects and next player\r\n\t\tthis.onRunEffect(card.value);\r\n\t\tif (this.state === 'play') this.nextTurn();\r\n\t}\r\n\r\n\tonRunEffect(value: string, initialize?: boolean) {\r\n\t\tconst colorDisplay = `|uhtml|uno-color|
`;\r\n\r\n\t\tswitch (value) {\r\n\t\tcase 'Reverse':\r\n\t\t\tthis.direction *= -1;\r\n\t\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|The direction of the game has changed.`);\r\n\t\t\t// in 2 player games, reverse sends the turn back to the player.\r\n\t\t\tif (!initialize && this.playerCount === 2) this.onNextPlayer();\r\n\t\t\tbreak;\r\n\t\tcase 'Skip':\r\n\t\t\tthis.onNextPlayer();\r\n\t\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${this.playerTable[this.currentPlayerid].name}'s turn has been skipped.`);\r\n\t\t\tbreak;\r\n\t\tcase '+2':\r\n\t\t\tthis.onNextPlayer();\r\n\t\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${this.playerTable[this.currentPlayerid].name} has been forced to draw 2 cards.`);\r\n\t\t\tthis.onDrawCard(this.playerTable[this.currentPlayerid], 2);\r\n\t\t\tbreak;\r\n\t\tcase '+4':\r\n\t\t\tthis.playerTable[this.currentPlayerid].sendRoom(colorDisplay);\r\n\t\t\tthis.state = 'color';\r\n\t\t\t// apply to the next in line, since the current player still has to choose the color\r\n\t\t\tconst next = this.getNextPlayer();\r\n\t\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${this.playerTable[next].name} has been forced to draw 4 cards.`);\r\n\t\t\tthis.onDrawCard(this.playerTable[next], 4);\r\n\t\t\tthis.isPlusFour = true;\r\n\t\t\tthis.timer = setTimeout(() => {\r\n\t\t\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${this.playerTable[this.currentPlayerid].name} has been automatically disqualified.`);\r\n\t\t\t\tthis.eliminate(this.currentPlayerid);\r\n\t\t\t}, this.maxTime * 1000);\r\n\t\t\tbreak;\r\n\t\tcase 'Wild':\r\n\t\t\tthis.playerTable[this.currentPlayerid].sendRoom(colorDisplay);\r\n\t\t\tthis.state = 'color';\r\n\t\t\tthis.timer = setTimeout(() => {\r\n\t\t\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${this.playerTable[this.currentPlayerid].name} has been automatically disqualified.`);\r\n\t\t\t\tthis.eliminate(this.currentPlayerid);\r\n\t\t\t}, this.maxTime * 1000);\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\tif (initialize) this.onNextPlayer();\r\n\t}\r\n\r\n\tonSelectColor(player: UNOPlayer, color: Color) {\r\n\t\tif (\r\n\t\t\t!['Red', 'Blue', 'Green', 'Yellow'].includes(color) ||\r\n\t\t\tplayer.id !== this.currentPlayerid ||\r\n\t\t\tthis.state !== 'color'\r\n\t\t) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tif (!this.topCard) {\r\n\t\t\t// should never happen\r\n\t\t\tthrow new Error(`No top card in the discard pile.`);\r\n\t\t}\r\n\t\tthis.topCard.changedColor = color;\r\n\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|The color has been changed to ${color}.`);\r\n\t\tif (this.timer) clearTimeout(this.timer);\r\n\r\n\t\t// remove color change menu and send the display of their cards again\r\n\t\tplayer.sendRoom(\"|uhtmlchange|uno-color|\");\r\n\t\tplayer.sendDisplay();\r\n\r\n\t\tif (this.isPlusFour) {\r\n\t\t\tthis.isPlusFour = false;\r\n\t\t\tthis.onNextPlayer(); // handle the skipping here.\r\n\t\t}\r\n\r\n\t\tthis.nextTurn();\r\n\t}\r\n\r\n\tonDrawCard(player: UNOPlayer, count: number) {\r\n\t\tif (typeof count === 'string') count = parseInt(count);\r\n\t\tif (!count || isNaN(count) || count < 1) count = 1;\r\n\t\tconst drawnCards = this.drawCard(count);\r\n\r\n\t\tplayer.hand.push(...drawnCards);\r\n\t\tplayer.sendRoom(\r\n\t\t\t`|raw|You have drawn the following card${Chat.plural(drawnCards)}: ` +\r\n\t\t\t`${drawnCards.map(card => `${card.name}`).join(', ')}.`\r\n\t\t);\r\n\t\treturn drawnCards;\r\n\t}\r\n\r\n\tdrawCard(count: number) {\r\n\t\tif (typeof count === 'string') count = parseInt(count);\r\n\t\tif (!count || isNaN(count) || count < 1) count = 1;\r\n\t\tconst drawnCards: Card[] = [];\r\n\r\n\t\tfor (let i = 0; i < count; i++) {\r\n\t\t\tif (!this.deck.length) {\r\n\t\t\t\t// shuffle the cards back into the deck, or if there are no discards, add another deck into the game.\r\n\t\t\t\tthis.deck = this.discards.length ? Utils.shuffle(this.discards) : Utils.shuffle(createDeck());\r\n\t\t\t\tthis.discards = []; // clear discard pile\r\n\t\t\t}\r\n\t\t\tdrawnCards.push(this.deck[this.deck.length - 1]);\r\n\t\t\tthis.deck.pop();\r\n\t\t}\r\n\t\treturn drawnCards;\r\n\t}\r\n\r\n\tonUno(player: UNOPlayer, unoId: ID) {\r\n\t\t// uno id makes spamming /uno uno impossible\r\n\t\tif (this.unoId !== unoId || player.id !== this.awaitUno) return false;\r\n\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|**UNO!** ${player.name} is down to their last card!`);\r\n\t\tthis.awaitUno = null;\r\n\t\tthis.unoId = null;\r\n\t}\r\n\r\n\tonCheckUno() {\r\n\t\tif (this.awaitUno) {\r\n\t\t\t// if the previous player hasn't hit UNO before the next player plays something, they are forced to draw 2 cards;\r\n\t\t\tif (this.awaitUno !== this.currentPlayerid) {\r\n\t\t\t\tthis.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${this.playerTable[this.awaitUno].name} forgot to say UNO! and is forced to draw 2 cards.`);\r\n\t\t\t\tthis.onDrawCard(this.playerTable[this.awaitUno], 2);\r\n\t\t\t}\r\n\t\t\tthis.awaitUno = null;\r\n\t\t\tthis.unoId = null;\r\n\t\t}\r\n\t}\r\n\r\n\tonSendHand(user: User) {\r\n\t\tif (!(user.id in this.playerTable) || this.state === 'signups') return false;\r\n\r\n\t\tthis.playerTable[user.id].sendDisplay();\r\n\t}\r\n\r\n\tonWin(player: UNOPlayer) {\r\n\t\tthis.sendToRoom(\r\n\t\t\tUtils.html`|raw|
Congratulations to ${player.name} for winning the game of UNO!
`, true);\r\n\r\n\t\t// deallocate games for each player.\r\n\t\tfor (const i in this.playerTable) {\r\n\t\t\tthis.playerTable[i].destroy();\r\n\t\t}\r\n\t\tthis.room.game = null;\r\n\t}\r\n}\r\n\r\nclass UNOPlayer extends Rooms.RoomGamePlayer {\r\n\thand: Card[];\r\n\tcardLock: string | null;\r\n\r\n\tconstructor(user: User, game: UNO) {\r\n\t\tsuper(user, game);\r\n\t\tthis.hand = [];\r\n\t\tthis.cardLock = null;\r\n\t}\r\n\r\n\tcanPlayWildFour() {\r\n\t\tif (!this.game.topCard) {\r\n\t\t\t// should never happen\r\n\t\t\tthrow new Error(`No top card in the discard pile.`);\r\n\t\t}\r\n\t\tconst color = (this.game.topCard.changedColor || this.game.topCard.color);\r\n\r\n\t\tif (this.hand.some(c => c.color === color)) return false;\r\n\t\treturn true;\r\n\t}\r\n\r\n\thasCard(cardName: string) {\r\n\t\treturn this.hand.find(card => card.name === cardName);\r\n\t}\r\n\r\n\tremoveCard(cardName: string) {\r\n\t\tfor (const [i, card] of this.hand.entries()) {\r\n\t\t\tif (card.name === cardName) {\r\n\t\t\t\tthis.hand.splice(i, 1);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tbuildHand() {\r\n\t\treturn Utils.sortBy(this.hand, card => [card.color, card.value])\r\n\t\t\t.map((card, i) => cardHTML(card, i === this.hand.length - 1));\r\n\t}\r\n\r\n\tsendDisplay() {\r\n\t\tconst hand = this.buildHand().join('');\r\n\t\tconst players = `
Players (${this.game.playerCount}):
${this.game.getPlayers(true)}`;\r\n\t\tconst draw = '';\r\n\t\tconst pass = '';\r\n\t\tconst uno = ``;\r\n\r\n\t\tif (!this.game.topCard) {\r\n\t\t\t// should never happen\r\n\t\t\tthrow new Error(`No top card in the discard pile.`);\r\n\t\t}\r\n\t\tconst top = `Top Card: ${this.game.topCard.name}`;\r\n\r\n\t\t// clear previous display and show new display\r\n\t\tthis.sendRoom(\"|uhtmlchange|uno-hand|\");\r\n\t\tthis.sendRoom(\r\n\t\t\t`|uhtml|uno-hand|
`\r\n\t\t);\r\n\t}\r\n}\r\n\r\nexport const commands: Chat.ChatCommands = {\r\n\tuno: {\r\n\t\t// roomowner commands\r\n\t\toff: 'disable',\r\n\t\tdisable(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tthis.checkCan('gamemanagement', null, room);\r\n\t\t\tif (room.settings.unoDisabled) {\r\n\t\t\t\tthrow new Chat.ErrorMessage(\"UNO is already disabled in this room.\");\r\n\t\t\t}\r\n\t\t\troom.settings.unoDisabled = true;\r\n\t\t\troom.saveSettings();\r\n\t\t\treturn this.sendReply(\"UNO has been disabled for this room.\");\r\n\t\t},\r\n\r\n\t\ton: 'enable',\r\n\t\tenable(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tthis.checkCan('gamemanagement', null, room);\r\n\t\t\tif (!room.settings.unoDisabled) {\r\n\t\t\t\tthrow new Chat.ErrorMessage(\"UNO is already enabled in this room.\");\r\n\t\t\t}\r\n\t\t\tdelete room.settings.unoDisabled;\r\n\t\t\troom.saveSettings();\r\n\t\t\treturn this.sendReply(\"UNO has been enabled for this room.\");\r\n\t\t},\r\n\r\n\t\t// moderation commands\r\n\t\tnew: 'create',\r\n\t\tmake: 'create',\r\n\t\tcreatepublic: 'create',\r\n\t\tmakepublic: 'create',\r\n\t\tcreateprivate: 'create',\r\n\t\tmakeprivate: 'create',\r\n\t\tcreate(target, room, user, connection, cmd) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\t\t\tif (room.settings.unoDisabled) throw new Chat.ErrorMessage(\"UNO is currently disabled for this room.\");\r\n\t\t\tif (room.game) throw new Chat.ErrorMessage(\"There is already a game in progress in this room.\");\r\n\r\n\t\t\tconst suppressMessages = cmd.includes('private') || !(cmd.includes('public') || room.roomid === 'gamecorner');\r\n\r\n\t\t\tlet cap = parseInt(target);\r\n\t\t\tif (isNaN(cap)) cap = 12;\r\n\t\t\tif (cap < 2) cap = 2;\r\n\t\t\troom.game = new UNO(room, cap, suppressMessages);\r\n\t\t\tthis.privateModAction(`A game of UNO was created by ${user.name}.`);\r\n\t\t\tthis.modlog('UNO CREATE');\r\n\t\t},\r\n\r\n\t\tcap: 'setcap',\r\n\t\tsetcap(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (game.state !== 'signups') {\r\n\t\t\t\tthrow new Chat.ErrorMessage(`There is no UNO game in the signups phase in this room, so adjusting the player cap would do nothing.`);\r\n\t\t\t}\r\n\t\t\tlet cap = parseInt(target);\r\n\t\t\tif (isNaN(cap) || cap < 2) {\r\n\t\t\t\tcap = 2;\r\n\t\t\t}\r\n\t\t\tgame.playerCap = cap;\r\n\t\t\tthis.privateModAction(`The playercap was set to ${game.playerCap} by ${user.name}.`);\r\n\t\t\tthis.modlog('UNO PLAYERCAP');\r\n\t\t},\r\n\r\n\t\tstart(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (game.state !== 'signups') {\r\n\t\t\t\tthrow new Chat.ErrorMessage(\"There is no UNO game in signups phase in this room.\");\r\n\t\t\t}\r\n\t\t\tgame.onStart();\r\n\t\t\tthis.privateModAction(`The game of UNO was started by ${user.name}.`);\r\n\t\t\tthis.modlog('UNO START');\r\n\t\t},\r\n\r\n\t\tstop: 'end',\r\n\t\tend(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\t\t\tif (!room.game || room.game.gameid !== 'uno') {\r\n\t\t\t\tthrow new Chat.ErrorMessage(\"There is no UNO game going on in this room.\");\r\n\t\t\t}\r\n\t\t\troom.game.destroy();\r\n\t\t\troom.add(\"The game of UNO was forcibly ended.\").update();\r\n\t\t\tthis.privateModAction(`The game of UNO was ended by ${user.name}.`);\r\n\t\t\tthis.modlog('UNO END');\r\n\t\t},\r\n\r\n\t\tautodq: 'timer',\r\n\t\ttimer(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tconst amount = parseInt(target);\r\n\t\t\tif (!amount || amount < 5 || amount > 300) {\r\n\t\t\t\tthrow new Chat.ErrorMessage(\"The amount must be a number between 5 and 300.\");\r\n\t\t\t}\r\n\r\n\t\t\tgame.maxTime = amount;\r\n\t\t\tif (game.timer) clearTimeout(game.timer);\r\n\t\t\tgame.timer = setTimeout(() => {\r\n\t\t\t\tgame.eliminate(game.currentPlayerid);\r\n\t\t\t}, amount * 1000);\r\n\t\t\tthis.addModAction(`${user.name} has set the UNO automatic disqualification timer to ${amount} seconds.`);\r\n\t\t\tthis.modlog('UNO TIMER', null, `${amount} seconds`);\r\n\t\t},\r\n\r\n\t\tautostart(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (toID(target) === 'off') {\r\n\t\t\t\tif (!game.autostartTimer) throw new Chat.ErrorMessage(\"There is no autostart timer running on.\");\r\n\t\t\t\tthis.addModAction(`${user.name} has turned off the UNO autostart timer.`);\r\n\t\t\t\tclearTimeout(game.autostartTimer);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tconst amount = parseInt(target);\r\n\t\t\tif (!amount || amount < 30 || amount > 600) {\r\n\t\t\t\tthrow new Chat.ErrorMessage(\"The amount must be a number between 30 and 600 seconds.\");\r\n\t\t\t}\r\n\t\t\tif (game.state !== 'signups') throw new Chat.ErrorMessage(\"The game of UNO has already started.\");\r\n\t\t\tif (game.autostartTimer) clearTimeout(game.autostartTimer);\r\n\t\t\tgame.autostartTimer = setTimeout(() => {\r\n\t\t\t\tgame.onStart(true);\r\n\t\t\t}, amount * 1000);\r\n\t\t\tthis.addModAction(`${user.name} has set the UNO autostart timer to ${amount} seconds.`);\r\n\t\t},\r\n\r\n\t\tdq: 'disqualify',\r\n\t\tdisqualify(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\r\n\t\t\tconst disqualified = game.eliminate(toID(target));\r\n\t\t\tif (disqualified === false) throw new Chat.ErrorMessage(`Unable to disqualify ${target}.`);\r\n\t\t\tthis.privateModAction(`${user.name} has disqualified ${disqualified} from the UNO game.`);\r\n\t\t\tthis.modlog('UNO DQ', toID(target));\r\n\t\t\troom.add(`${disqualified} has been disqualified from the UNO game.`).update();\r\n\t\t},\r\n\r\n\t\t// player/user commands\r\n\t\tj: 'join',\r\n\t\tjoin(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tthis.checkChat();\r\n\t\t\tif (!game.joinGame(user)) throw new Chat.ErrorMessage(\"Unable to join the game.\");\r\n\r\n\t\t\treturn this.sendReply(\"You have joined the game of UNO.\");\r\n\t\t},\r\n\r\n\t\tl: 'leave',\r\n\t\tleave(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (!game.leaveGame(user)) throw new Chat.ErrorMessage(\"Unable to leave the game.\");\r\n\t\t\treturn this.sendReply(\"You have left the game of UNO.\");\r\n\t\t},\r\n\r\n\t\tplay(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (!game) throw new Chat.ErrorMessage(\"There is no UNO game going on in this room right now.\");\r\n\t\t\tconst player: UNOPlayer | undefined = game.playerTable[user.id];\r\n\t\t\tif (!player) throw new Chat.ErrorMessage(`You are not in the game of UNO.`);\r\n\t\t\tconst error = game.onPlay(player, target);\r\n\t\t\tif (typeof error === 'string') throw new Chat.ErrorMessage(error);\r\n\t\t},\r\n\r\n\t\tdraw(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = room.getGame(UNO);\r\n\t\t\tif (!game) throw new Chat.ErrorMessage(\"There is no UNO game going on in this room right now.\");\r\n\t\t\tconst player: UNOPlayer | undefined = game.playerTable[user.id];\r\n\t\t\tif (!player) throw new Chat.ErrorMessage(`You are not in the game of UNO.`);\r\n\t\t\tconst error = game.onDraw(player);\r\n\t\t\tif (error) throw new Chat.ErrorMessage(\"You have already drawn a card this turn.\");\r\n\t\t},\r\n\r\n\t\tpass(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (!game) throw new Chat.ErrorMessage(\"There is no UNO game going on in this room right now.\");\r\n\t\t\tif (game.currentPlayerid !== user.id) throw new Chat.ErrorMessage(\"It is currently not your turn.\");\r\n\t\t\tconst player: UNOPlayer | undefined = game.playerTable[user.id];\r\n\t\t\tif (!player) throw new Chat.ErrorMessage(`You are not in the game of UNO.`);\r\n\t\t\tif (!player.cardLock) throw new Chat.ErrorMessage(\"You cannot pass until you draw a card.\");\r\n\t\t\tif (game.state === 'color') throw new Chat.ErrorMessage(\"You cannot pass until you choose a color.\");\r\n\r\n\t\t\tgame.sendToRoom(`|c:|${Math.floor(Date.now() / 1000)}|&|${user.name} has passed.`);\r\n\t\t\tgame.nextTurn();\r\n\t\t},\r\n\r\n\t\tcolor(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tconst player: UNOPlayer | undefined = game.playerTable[user.id];\r\n\t\t\tif (!player) throw new Chat.ErrorMessage(`You are not in the game of UNO.`);\r\n\t\t\tlet color: Color;\r\n\t\t\tif (target === 'Red' || target === 'Green' || target === 'Blue' || target === 'Yellow' || target === 'Black') {\r\n\t\t\t\tcolor = target;\r\n\t\t\t} else {\r\n\t\t\t\tthrow new Chat.ErrorMessage(`\"${target}\" is not a valid color.`);\r\n\t\t\t}\r\n\t\t\tgame.onSelectColor(player, color);\r\n\t\t},\r\n\r\n\t\tuno(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tconst player: UNOPlayer | undefined = game.playerTable[user.id];\r\n\t\t\tif (!player) throw new Chat.ErrorMessage(`You are not in the game of UNO.`);\r\n\t\t\tgame.onUno(player, toID(target));\r\n\t\t},\r\n\r\n\t\t// information commands\r\n\t\t'': 'hand',\r\n\t\thand(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tgame.onSendHand(user);\r\n\t\t},\r\n\r\n\t\t'c': 'cards',\r\n\t\tcards(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (!this.runBroadcast()) return false;\r\n\t\t\tconst players = `Players (${game.playerCount}):
`);\r\n\t\t},\r\n\r\n\t\tplayers: 'getusers',\r\n\t\tusers: 'getusers',\r\n\t\tgetplayers: 'getusers',\r\n\t\tgetusers(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (!this.runBroadcast()) return false;\r\n\t\t\tthis.sendReplyBox(`Players (${game.playerCount}):${game.getPlayers()}`);\r\n\t\t},\r\n\r\n\t\thelp(target, room, user) {\r\n\t\t\tthis.parse('/help uno');\r\n\t\t},\r\n\r\n\t\t// suppression commands\r\n\t\tsuppress(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\r\n\t\t\ttarget = toID(target);\r\n\t\t\tconst state = target === 'on' ? true : target === 'off' ? false : undefined;\r\n\r\n\t\t\tif (state === undefined) {\r\n\t\t\t\treturn this.sendReply(`Suppression of UNO game messages is currently ${game.suppressMessages ? 'on' : 'off'}.`);\r\n\t\t\t}\r\n\t\t\tif (state === game.suppressMessages) {\r\n\t\t\t\tthrow new Chat.ErrorMessage(`Suppression of UNO game messages is already ${game.suppressMessages ? 'on' : 'off'}.`);\r\n\t\t\t}\r\n\r\n\t\t\tgame.suppressMessages = state;\r\n\r\n\t\t\tthis.addModAction(`${user.name} has turned ${state ? 'on' : 'off'} suppression of UNO game messages.`);\r\n\t\t\tthis.modlog('UNO SUPRESS', null, (state ? 'ON' : 'OFF'));\r\n\t\t},\r\n\r\n\t\tspectate(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (!game) throw new Chat.ErrorMessage(\"There is no UNO game going on in this room right now.\");\r\n\r\n\t\t\tif (!game.suppressMessages) throw new Chat.ErrorMessage(\"The current UNO game is not suppressing messages.\");\r\n\t\t\tif (user.id in game.spectators) throw new Chat.ErrorMessage(\"You are already spectating this game.\");\r\n\r\n\t\t\tgame.spectators[user.id] = 1;\r\n\t\t\tthis.sendReply(\"You are now spectating this private UNO game.\");\r\n\t\t},\r\n\r\n\t\tunspectate(target, room, user) {\r\n\t\t\tconst game = this.requireGame(UNO);\r\n\t\t\tif (!game) throw new Chat.ErrorMessage(\"There is no UNO game going on in this room right now.\");\r\n\r\n\t\t\tif (!game.suppressMessages) throw new Chat.ErrorMessage(\"The current UNO game is not suppressing messages.\");\r\n\t\t\tif (!(user.id in game.spectators)) throw new Chat.ErrorMessage(\"You are currently not spectating this game.\");\r\n\r\n\t\t\tdelete game.spectators[user.id];\r\n\t\t\tthis.sendReply(\"You are no longer spectating this private UNO game.\");\r\n\t\t},\r\n\t},\r\n\r\n\tunohelp: [\r\n\t\t`/uno create [player cap] - creates a new UNO game with an optional player cap (default player cap at 12). Use the command [createpublic] to force a public game or [createprivate] to force a private game. Requires: % @ # &`,\r\n\t\t`/uno setcap [player cap] - adjusts the player cap of the current UNO game. Requires: % @ # &`,\r\n\t\t`/uno timer [amount] - sets an auto disqualification timer for [amount] seconds. Requires: % @ # &`,\r\n\t\t`/uno autostart [amount] - sets an auto starting timer for [amount] seconds. Requires: % @ # &`,\r\n\t\t`/uno end - ends the current game of UNO. Requires: % @ # &`,\r\n\t\t`/uno start - starts the current game of UNO. Requires: % @ # &`,\r\n\t\t`/uno disqualify [player] - disqualifies the player from the game. Requires: % @ # &`,\r\n\t\t`/uno hand - displays your own hand.`,\r\n\t\t`/uno cards - displays the number of cards for each player.`,\r\n\t\t`/uno getusers - displays the players still in the game.`,\r\n\t\t`/uno [spectate|unspectate] - spectate / unspectate the current private UNO game.`,\r\n\t\t`/uno suppress [on|off] - Toggles suppression of game messages.`,\r\n\t],\r\n};\r\n\r\nexport const roomSettings: Chat.SettingsHandler = room => ({\r\n\tlabel: \"UNO\",\r\n\tpermission: 'editroom',\r\n\toptions: [\r\n\t\t[`disabled`, room.settings.unoDisabled || 'uno disable'],\r\n\t\t[`enabled`, !room.settings.unoDisabled || 'uno enable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