{ "version": 3, "sources": ["../../../../server/chat-plugins/jeopardy.ts"], "sourcesContent": ["import {Utils} from '../../lib';\r\n\r\nconst BACKGROUND_COLOR = \"#0000FF\";\r\nconst HEIGHT = 40;\r\nconst MAX_CATEGORY_COUNT = 5;\r\nconst MAX_QUESTION_COUNT = 5;\r\nconst BUZZ_COOLDOWN = 500; // 0.5 seconds\r\n\r\ninterface Question {\r\n\tquestion: string;\r\n\tanswer: string;\r\n\tpoints: number;\r\n\tanswered: boolean;\r\n\tdd: boolean;\r\n}\r\n\r\ntype JeopardyState = 'signups' | 'selecting' | 'answering' | 'wagering' | 'buzzing' | 'checking' | 'round2';\r\n\r\nexport class Jeopardy extends Rooms.RoomGame {\r\n\thost: User;\r\n\tstate: JeopardyState;\r\n\tgameid: ID;\r\n\tcategories: string[];\r\n\tquestion: Question;\r\n\tquestions: Question[][];\r\n\tfinalQuestion: Question;\r\n\tstarted: boolean;\r\n\tcategoryCount: number;\r\n\tquestionCount: number;\r\n\tround: number;\r\n\tcanBuzz: boolean;\r\n\tnumUpdates: number;\r\n\tfinalCategory: string;\r\n\tansweringTime: number;\r\n\tfinalAnsweringTime: number;\r\n\ttimeout: NodeJS.Timer | null;\r\n\troundStarted: boolean;\r\n\t// FIXME: this type should be `JeopardyGamePlayer | null`\r\n\tcurPlayer: JeopardyGamePlayer;\r\n\tprevPlayer: JeopardyGamePlayer;\r\n\torder: string[];\r\n\tpoints: Map;\r\n\tfinals: boolean;\r\n\tgameNumber: number;\r\n\r\n\tconstructor(room: Room, user: User, categoryCount: number, questionCount: number, playerCap: number) {\r\n\t\tsuper(room);\r\n\t\tthis.gameNumber = room.nextGameNumber();\r\n\t\tthis.host = user;\r\n\t\tthis.allowRenames = true;\r\n\t\tthis.state = \"signups\";\r\n\t\tthis.gameid = 'jeopardy' as ID;\r\n\t\tthis.title = 'Jeopardy';\r\n\t\tthis.categories = [];\r\n\t\tthis.question = Object.create(null);\r\n\t\tthis.questions = [];\r\n\t\tthis.finalQuestion = Object.create(null);\r\n\t\tthis.started = false;\r\n\t\tthis.categoryCount = categoryCount;\r\n\t\tthis.questionCount = questionCount;\r\n\t\tthis.round = 1;\r\n\t\tthis.points = new Map();\r\n\t\tthis.playerCap = playerCap;\r\n\t\tthis.canBuzz = false;\r\n\t\tthis.numUpdates = 0;\r\n\t\tthis.finalCategory = \"\";\r\n\t\tthis.answeringTime = 10;\r\n\t\tthis.finalAnsweringTime = 30;\r\n\t\tthis.timeout = null;\r\n\t\tthis.roundStarted = false;\r\n\t\tthis.curPlayer = new JeopardyGamePlayer(user, this);\r\n\t\tthis.prevPlayer = new JeopardyGamePlayer(user, this);\r\n\t\tthis.order = [];\r\n\t\tthis.finals = false;\r\n\t\tthis.setupGrid();\r\n\t}\r\n\r\n\tdestroy() {\r\n\t\tif (this.timeout) clearTimeout(this.timeout);\r\n\t\tsuper.destroy();\r\n\t}\r\n\r\n\tmakePlayer(user: User) {\r\n\t\treturn new JeopardyGamePlayer(user, this);\r\n\t}\r\n\r\n\tsetupGrid() {\r\n\t\tthis.categories = [];\r\n\t\tfor (let j = 0; j < this.categoryCount; j++) {\r\n\t\t\tthis.categories.push(\"\");\r\n\t\t}\r\n\t\tthis.questions = [];\r\n\t\tfor (let i = 0; i < this.questionCount; i++) {\r\n\t\t\tthis.questions.push([]);\r\n\t\t\tfor (let j = 0; j < this.categoryCount; j++) {\r\n\t\t\t\tthis.questions[i].push({question: '', answer: '', points: 200 * this.round * (i + 1), answered: false, dd: false});\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.finalQuestion = Object.create(null);\r\n\t\tthis.roundStarted = false;\r\n\t\tthis.question = Object.create(null);\r\n\t\tif (this.round === 1) {\r\n\t\t\tthis.display();\r\n\t\t} else {\r\n\t\t\tthis.update();\r\n\t\t}\r\n\t}\r\n\r\n\tstart() {\r\n\t\tif (this.roundStarted) throw new Chat.ErrorMessage(\"The game has already been started.\");\r\n\t\tif (this.playerCount < 2) throw new Chat.ErrorMessage(\"The game needs at least two players to start.\");\r\n\t\tconst noquestions = [];\r\n\t\tfor (let i = 0; i < this.categoryCount; i++) {\r\n\t\t\tfor (let j = 0; j < this.questionCount; j++) {\r\n\t\t\t\tif (!this.questions[j][i].question) {\r\n\t\t\t\t\tnoquestions.push(`(${(i + 1)}, ${(j + 1)})`);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tlet badstr = noquestions.join(\", \");\r\n\t\tif (!this.finalQuestion.question && this.round === 2) {\r\n\t\t\tbadstr += `${(badstr ? \", \" : \"\")} final`;\r\n\t\t}\r\n\t\tif (badstr) {\r\n\t\t\tthrow new Chat.ErrorMessage(`The following questions still need questions and answers: ${badstr}.`);\r\n\t\t}\r\n\t\tthis.roundStarted = true;\r\n\t\tif (this.round === 1) {\r\n\t\t\tfor (const userID in this.playerTable) {\r\n\t\t\t\tconst player = this.playerTable[userID];\r\n\t\t\t\tthis.points.set(player, 0);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.state = 'selecting';\r\n\t\tlet lowest: string[] = [];\r\n\t\tlet minpoints;\r\n\t\tfor (const userID in this.playerTable) {\r\n\t\t\tconst points = this.playerTable[userID].points;\r\n\t\t\tif (!minpoints) {\r\n\t\t\t\tlowest.push(userID);\r\n\t\t\t\tminpoints = points;\r\n\t\t\t} else if (points < minpoints) {\r\n\t\t\t\tlowest = [userID];\r\n\t\t\t\tminpoints = points;\r\n\t\t\t} else if (points === minpoints) {\r\n\t\t\t\tlowest.push(userID);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.curPlayer = this.playerTable[lowest[Math.floor(lowest.length * Math.random())]];\r\n\t\tthis.prevPlayer = this.curPlayer;\r\n\t\tthis.update();\r\n\t\tthis.nextPlayer();\r\n\t}\r\n\r\n\tnextPlayer() {\r\n\t\tthis.room.addRaw(`${this.curPlayer.name}, you're up!`);\r\n\t}\r\n\r\n\tgetGrid() {\r\n\t\tlet buffer = `
`;\r\n\t\tfor (let i = 0; i < this.categoryCount; i++) {\r\n\t\t\tbuffer += ``;\r\n\t\t}\r\n\t\tbuffer += ``;\r\n\t\tfor (let i = 0; i < this.questionCount; i++) {\r\n\t\t\tbuffer += ``;\r\n\t\t\tfor (let j = 0; j < this.categoryCount; j++) {\r\n\t\t\t\tbuffer += ``;\r\n\t\t\t}\r\n\t\t\tbuffer += ``;\r\n\t\t}\r\n\t\tbuffer += `
${Utils.escapeHTML(this.categories[i])}
${(this.questions[i][j].answered ? \"\" : this.questions[i][j].points)}

`;\r\n\t\tfor (const userID in this.playerTable) {\r\n\t\t\tconst player = this.playerTable[userID];\r\n\t\t\tconst bold = this.curPlayer?.name === player.name;\r\n\t\t\tbuffer += `${bold ? \"\" : \"\"}${Utils.escapeHTML(player.name)} (${(player.points || 0)})${bold ? \"\" : \"\"}
`;\r\n\t\t}\r\n\t\tbuffer += `
`;\r\n\t\treturn buffer;\r\n\t}\r\n\r\n\tdisplay() {\r\n\t\tthis.room.add(`|uhtml|jeopardy${this.gameNumber}-${this.numUpdates}|${this.getGrid()}`);\r\n\t}\r\n\r\n\tupdate(dontMove = false) {\r\n\t\tif (dontMove) {\r\n\t\t\tthis.room.add(`|uhtmlchange|jeopardy${this.gameNumber}-${this.numUpdates}|${this.getGrid()}`);\r\n\t\t} else {\r\n\t\t\tthis.room.add(`|uhtmlchange|jeopardy${this.gameNumber}-${this.numUpdates}|`);\r\n\t\t\tthis.numUpdates++;\r\n\t\t\tthis.room.add(`|uhtml|jeopardy${this.gameNumber}-${this.numUpdates}|${this.getGrid()}`);\r\n\t\t}\r\n\t}\r\n\r\n\tdailyDouble() {\r\n\t\tif (this.timeout) clearTimeout(this.timeout);\r\n\t\tthis.state = 'answering';\r\n\t\tif (!this.curPlayer.wager) this.curPlayer.wager = 0;\r\n\t\tthis.askQuestion();\r\n\t}\r\n\r\n\tselect(target: string) {\r\n\t\tif (this.state !== 'selecting') throw new Chat.ErrorMessage(\"The game of Jeopardy is not in the selection phase.\");\r\n\r\n\t\tconst params = target.split(\",\");\r\n\t\tif (params.length < 2) throw new Chat.ErrorMessage(\"You must specify a row and a column number.\");\r\n\t\tconst categoryNumber = parseInt(params[0]);\r\n\t\tif (!categoryNumber || categoryNumber < 1 || categoryNumber > this.categoryCount) {\r\n\t\t\tthrow new Chat.ErrorMessage(`The category must be a number between 1 and ${this.categoryCount}.`);\r\n\t\t}\r\n\t\tconst questionNumber = parseInt(params[1]);\r\n\t\tif (!questionNumber || questionNumber < 1 || questionNumber > this.questionCount) {\r\n\t\t\tthrow new Chat.ErrorMessage(`The question must be a number between 1 and ${this.questionCount}.`);\r\n\t\t}\r\n\t\tconst question = this.questions[questionNumber - 1][categoryNumber - 1];\r\n\t\tif (question.answered) throw new Chat.ErrorMessage(\"That question has already been answered.\");\r\n\t\tthis.question = question;\r\n\t\tif (question.dd) {\r\n\t\t\tthis.room.add(`That was a daily double! ${this.curPlayer.name}, how much would you like to wager?`);\r\n\t\t\tthis.clearWagers();\r\n\t\t\tthis.state = 'wagering';\r\n\t\t\tthis.timeout = setTimeout(() => this.dailyDouble(), 30 * 1000);\r\n\t\t} else {\r\n\t\t\tthis.state = 'buzzing';\r\n\t\t\tthis.askQuestion();\r\n\t\t}\r\n\t}\r\n\r\n\tclearWagers() {\r\n\t\tfor (const userID in this.playerTable) {\r\n\t\t\tthis.playerTable[userID].wager = 0;\r\n\t\t}\r\n\t}\r\n\r\n\tclearBuzzes() {\r\n\t\tfor (const userID in this.playerTable) {\r\n\t\t\tthis.playerTable[userID].buzzed = false;\r\n\t\t}\r\n\t}\r\n\r\n\taskQuestion() {\r\n\t\tif (!this.question.dd) {\r\n\t\t\tthis.curPlayer = null!;\r\n\t\t}\r\n\t\tthis.clearBuzzes();\r\n\t\tthis.room.addRaw(Utils.html`
Your question is: ${this.question.question}
`);\r\n\t\tif (!this.finals) {\r\n\t\t\tthis.canBuzz = false;\r\n\t\t\tthis.update(true);\r\n\t\t\tthis.timeout = setTimeout(() => this.allowBuzzes(), this.question.question.length / 15 * 1000);\r\n\t\t}\r\n\t}\r\n\r\n\tallowBuzzes() {\r\n\t\tthis.canBuzz = true;\r\n\t\tthis.room.add(`You may now buzz in for the Jeopardy game!`);\r\n\t\tthis.update(true);\r\n\t\tthis.timeout = setTimeout(() => this.allowAllBuzzes(), BUZZ_COOLDOWN);\r\n\t}\r\n\r\n\tallowAllBuzzes() {\r\n\t\tfor (const userID in this.playerTable) {\r\n\t\t\tthis.playerTable[userID].buzzedEarly = false;\r\n\t\t}\r\n\t}\r\n\r\n\trevealAnswer() {\r\n\t\tthis.room.addRaw(`
The answer was: ${Utils.escapeHTML(this.question.answer)}
`);\r\n\t\tthis.question.answered = true;\r\n\t}\r\n\r\n\tbuzz(user: User) {\r\n\t\tif (this.state !== 'buzzing') throw new Chat.ErrorMessage(\"You cannot buzz in at this time.\");\r\n\t\tconst player = this.playerTable[user.id];\r\n\t\tif (!player) throw new Chat.ErrorMessage(\"You are not in the game of Jeopardy.\");\r\n\t\tif (player.buzzed) throw new Chat.ErrorMessage(\"You have already buzzed in to the current question.\");\r\n\t\tif (!this.canBuzz) {\r\n\t\t\tplayer.buzzedEarly = true;\r\n\t\t\tplayer.send(\"You buzzed early! You now have a delay before you will be able to buzz.\");\r\n\t\t\treturn;\r\n\t\t} else if (player.buzzedEarly) {\r\n\t\t\tthrow new Chat.ErrorMessage(\"Your buzzing cooldown has not yet ended.\");\r\n\t\t}\r\n\t\tthis.curPlayer = player;\r\n\t\tthis.curPlayer.buzzed = true;\r\n\t\tthis.room.add(`${user.name} has buzzed in!`);\r\n\t\tthis.state = \"answering\";\r\n\t\tthis.timeout = setTimeout(() => this.check({correct: false, isBuzzTimeout: true}), this.answeringTime * 1000);\r\n\t}\r\n\r\n\thasRemainingQuestion() {\r\n\t\tfor (let i = 0; i < this.questionCount; i++) {\r\n\t\t\tfor (let j = 0; j < this.categoryCount; j++) {\r\n\t\t\t\tif (!this.questions[i][j].answered) return true;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tstartFinals() {\r\n\t\tthis.update();\r\n\t\tthis.room.add(\"Time to begin finals! The category is: \" + this.finalCategory + \"! Please wager your amounts now.\");\r\n\t\tthis.finals = true;\r\n\t\tthis.state = \"wagering\";\r\n\t\tthis.clearWagers();\r\n\t\tthis.timeout = setTimeout(() => this.finalWagers(), this.finalAnsweringTime * 1000);\r\n\t}\r\n\r\n\twager(amount: string | number, user: User) {\r\n\t\tif (this.state !== \"wagering\" && (!this.finals || this.curPlayer?.id !== user.id)) {\r\n\t\t\tthrow new Chat.ErrorMessage(\"You cannot wager at this time.\");\r\n\t\t}\r\n\t\tconst player = this.playerTable[user.id];\r\n\t\tif (!player) throw new Chat.ErrorMessage(\"You are not in the game of Jeopardy.\");\r\n\t\tamount = toID(amount);\r\n\t\tconst wager = (amount === 'all' ? player.points : parseInt(amount));\r\n\t\tif (!wager || isNaN(wager)) throw new Chat.ErrorMessage(\"Your wager must be a number, or 'all'.\");\r\n\t\tif (wager < 0) throw new Chat.ErrorMessage(\"You cannot wager a negative amount.\");\r\n\t\tif (wager > player.points && (wager > (this.round * 1000) || this.finals)) {\r\n\t\t\tthrow new Chat.ErrorMessage(\"You cannot wager more than your current number of points.\");\r\n\t\t}\r\n\t\tif (player.wager) throw new Chat.ErrorMessage(\"You have already wagered.\");\r\n\t\tplayer.wager = wager;\r\n\t\tplayer.send(`You have wagered ${wager} points!`);\r\n\t\tif (!this.finals) {\r\n\t\t\tthis.dailyDouble();\r\n\t\t} else {\r\n\t\t\tfor (const userID in this.playerTable) {\r\n\t\t\t\tif (!this.playerTable[userID].wager) return;\r\n\t\t\t}\r\n\t\t\tif (this.timeout) clearTimeout(this.timeout);\r\n\t\t\tthis.finalWagers();\r\n\t\t}\r\n\t}\r\n\tfinalWagers() {\r\n\t\tfor (const userID in this.playerTable) {\r\n\t\t\tconst player = this.playerTable[userID];\r\n\t\t\tif (!player.wager) player.wager = 0;\r\n\t\t}\r\n\t\tthis.question = this.finalQuestion;\r\n\t\tthis.state = \"answering\";\r\n\t\tthis.askQuestion();\r\n\t\tthis.timeout = setTimeout(() => this.doFinals(), this.finalAnsweringTime * 1000);\r\n\t}\r\n\r\n\tdoFinals() {\r\n\t\tif (!this.playerTable) return this.room?.add(`Could not play finals because the player table does not exist.`);\r\n\t\tthis.order = Object.keys(this.playerTable);\r\n\t\tthis.doFinalPlayer();\r\n\t}\r\n\r\n\tdoFinalPlayer() {\r\n\t\tif (this.order.length === 0) {\r\n\t\t\tthis.revealAnswer();\r\n\t\t\tlet highest: string[] = [];\r\n\t\t\tlet maxpoints;\r\n\t\t\tfor (const userID in this.playerTable) {\r\n\t\t\t\tconst player = this.playerTable[userID];\r\n\t\t\t\tconst points = player.points;\r\n\t\t\t\tif (!maxpoints) {\r\n\t\t\t\t\thighest.push(player.name);\r\n\t\t\t\t\tmaxpoints = points;\r\n\t\t\t\t} else if (points > maxpoints) {\r\n\t\t\t\t\thighest = [player.name];\r\n\t\t\t\t\tmaxpoints = points;\r\n\t\t\t\t} else if (points === maxpoints) {\r\n\t\t\t\t\thighest.push(player.name);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.room.add(`|raw|
Congratulations to ${highest.map(n => Utils.escapeHTML(n)).join(\", \")} for winning the game of Jeopardy with ${maxpoints} points!`);\r\n\t\t\tthis.destroy();\r\n\t\t\treturn;\r\n\t\t} else {\r\n\t\t\tconst index = this.order.shift() || 0;\r\n\t\t\tthis.curPlayer = this.playerTable[index];\r\n\t\t\tconst answer = this.curPlayer.finalAnswer;\r\n\t\t\tif (answer) {\r\n\t\t\t\tthis.room.add(`${this.curPlayer.name} has answered ${Utils.escapeHTML(answer)}!`);\r\n\t\t\t\tthis.state = \"checking\";\r\n\t\t\t} else {\r\n\t\t\t\tconst wager = this.curPlayer.wager;\r\n\t\t\t\tthis.room.add(`${this.curPlayer.name} did not answer the final Jeopardy and loses ${wager} points`);\r\n\t\t\t\tlet points = this.curPlayer.points;\r\n\t\t\t\tpoints -= wager;\r\n\t\t\t\tthis.curPlayer.points = points;\r\n\t\t\t\tthis.timeout = setTimeout(() => this.doFinalPlayer(), 5 * 1000);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tanswer(target: string, user: User) {\r\n\t\tif (this.state !== 'answering') throw new Chat.ErrorMessage(\"You cannot answer the question at this time.\");\r\n\t\tconst player = this.playerTable[user.id];\r\n\t\tif (!player) throw new Chat.ErrorMessage(\"You are not in the game of Jeopardy.\");\r\n\t\tif (this.finals) {\r\n\t\t\tif (player.finalAnswer) throw new Chat.ErrorMessage(\"You have already answered the Final Jeopardy\");\r\n\t\t\tplayer.answer = Utils.escapeHTML(target);\r\n\t\t\tplayer.send(`You have selected your answer as ${Utils.escapeHTML(target)}.`);\r\n\t\t} else {\r\n\t\t\tif (this.timeout) clearTimeout(this.timeout);\r\n\t\t\tif (!this.curPlayer || this.curPlayer.id !== user.id) throw new Chat.ErrorMessage(\"It is not your turn to answer.\");\r\n\t\t\tthis.state = \"checking\";\r\n\t\t\tthis.room.add(`${user.name} has answered ${Utils.escapeHTML(target)}!`);\r\n\t\t}\r\n\t}\r\n\r\n\tmark(correct: boolean) {\r\n\t\tif (this.state !== 'checking') throw new Chat.ErrorMessage(\"There is no answer to currently check.\");\r\n\t\tthis.check({correct});\r\n\t}\r\n\r\n\tcheck(info: {correct: boolean, isBuzzTimeout?: boolean}) {\r\n\t\tif (info.correct) {\r\n\t\t\tconst gainpoints = ((this.question.dd || this.finals) ? this.curPlayer.wager : this.question.points);\r\n\t\t\tlet points = this.curPlayer.points;\r\n\t\t\tpoints += gainpoints;\r\n\t\t\tthis.curPlayer.points = points;\r\n\t\t\tthis.room.add(`${this.curPlayer.name} has answered the question correctly and gained ${gainpoints} points!`);\r\n\t\t\tif (!this.finals) {\r\n\t\t\t\tthis.revealAnswer();\r\n\t\t\t}\r\n\t\t\tif (this.finals) {\r\n\t\t\t\tthis.doFinalPlayer();\r\n\t\t\t} else if (!this.hasRemainingQuestion()) {\r\n\t\t\t\tif (this.round === 1) {\r\n\t\t\t\t\tthis.round++;\r\n\t\t\t\t\tthis.setupGrid();\r\n\t\t\t\t\tthis.state = \"round2\";\r\n\t\t\t\t} else {\r\n\t\t\t\t\tthis.startFinals();\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tthis.prevPlayer = this.curPlayer;\r\n\t\t\t\tthis.state = 'selecting';\r\n\t\t\t\tthis.question = Object.create(null);\r\n\t\t\t\tthis.update();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tconst losspoints = ((this.question.dd || this.finals) ? this.curPlayer.wager : this.question.points);\r\n\t\t\tconst action = info.isBuzzTimeout ? 'failed to answer in time' : 'answered incorrectly';\r\n\t\t\tthis.room.add(`${this.curPlayer.name} ${action} and loses ${losspoints} points!`);\r\n\t\t\tlet points = this.curPlayer.points;\r\n\t\t\tpoints -= losspoints;\r\n\t\t\tthis.curPlayer.points = points;\r\n\t\t\tif (this.finals) {\r\n\t\t\t\tthis.doFinalPlayer();\r\n\t\t\t} else if (this.everyBuzzed() || this.question.dd) {\r\n\t\t\t\tthis.nextQuestion();\r\n\t\t\t} else {\r\n\t\t\t\tthis.state = 'buzzing';\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\teveryBuzzed() {\r\n\t\tfor (const userID in this.playerTable) {\r\n\t\t\tif (!this.playerTable[userID].buzzed) return false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}\r\n\tsetCategory(categoryNumber: string | number, category: string) {\r\n\t\tif (typeof categoryNumber === 'string') {\r\n\t\t\tthis.finalCategory = category.trim();\r\n\t\t} else {\r\n\t\t\tthis.categories[categoryNumber] = category.trim();\r\n\t\t\tthis.update();\r\n\t\t}\r\n\t}\r\n\r\n\tnextQuestion() {\r\n\t\tthis.revealAnswer();\r\n\t\tif (!this.hasRemainingQuestion()) {\r\n\t\t\tif (this.round === 1) {\r\n\t\t\t\tthis.round++;\r\n\t\t\t\tthis.setupGrid();\r\n\t\t\t\tthis.state = \"round2\";\r\n\t\t\t} else {\r\n\t\t\t\tthis.startFinals();\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tthis.curPlayer = this.prevPlayer;\r\n\t\t\tthis.state = \"selecting\";\r\n\t\t\tthis.question = Object.create(null);\r\n\t\t\tthis.update();\r\n\t\t}\r\n\t}\r\n\r\n\tsetCategories(categories: string[]) {\r\n\t\tif (this.state !== \"signups\" && this.state !== \"round2\") return false;\r\n\t\tfor (const [i, category] of categories.entries()) {\r\n\t\t\tthis.categories[i] = category;\r\n\t\t}\r\n\t\tthis.update();\r\n\t}\r\n\r\n\tgetQuestion(categoryNumber: number, questionNumber: number) {\r\n\t\tconst question = this.questions[questionNumber][categoryNumber];\r\n\t\tif (question.question) {\r\n\t\t\treturn `Question: ${Utils.escapeHTML(question.question)}
Answer: ${Utils.escapeHTML(question.answer)}`;\r\n\t\t} else {\r\n\t\t\treturn \"That question has not yet been imported.\";\r\n\t\t}\r\n\t}\r\n\r\n\tsetDailyDouble(categoryNumber: number, questionNumber: number) {\r\n\t\tconst question = this.questions[questionNumber][categoryNumber];\r\n\t\tif (question.dd) throw new Chat.ErrorMessage(\"That question is already a daily double.\");\r\n\t\tquestion.dd = true;\r\n\t}\r\n\r\n\timportQuestions(questions: string[], questionStart: number, categoryStart: string | number) {\r\n\t\tif (typeof categoryStart === 'string') {\r\n\t\t\tconst split = questions[0].split(\"|\");\r\n\t\t\tif (split.length !== 2) throw new Chat.ErrorMessage(\"Final question was unable to be imported.\");\r\n\t\t\tthis.finalQuestion.question = split[0].trim();\r\n\t\t\tthis.finalQuestion.answer = split[1].trim();\r\n\t\t} else {\r\n\t\t\tfor (let i = categoryStart; i < this.categoryCount; i++) {\r\n\t\t\t\tfor (let j = (i === categoryStart ? questionStart : 0); j < this.questionCount; j++) {\r\n\t\t\t\t\tif (questions.length === 0) {\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst split = questions[0].split(\"|\");\r\n\t\t\t\t\tif (split.length !== 2) {\r\n\t\t\t\t\t\tthrow new Chat.ErrorMessage(`Questions before ${questions[0]} imported successfully, but ${questions[0]} did not have a question and one answer.`);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.questions[j][i].question = split[0].trim();\r\n\t\t\t\t\tthis.questions[j][i].answer = split[1].trim();\r\n\t\t\t\t\tquestions.shift();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif (questions.length > 0) {\r\n\t\t\t\tconst split = questions[0].split(\"|\");\r\n\t\t\t\tif (split.length !== 2) {\r\n\t\t\t\t\tthrow new Chat.ErrorMessage(`Questions before ${questions[0]} imported successfully, but ${questions[0]} did not have a question and one answer.`);\r\n\t\t\t\t}\r\n\t\t\t\tthis.finalQuestion.question = split[0].trim();\r\n\t\t\t\tthis.finalQuestion.answer = split[1].trim();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tgivePoints(user: User | ID, n: number) {\r\n\t\tconst id = toID(user);\r\n\t\tif (!(id in this.playerTable)) throw new Chat.ErrorMessage(`'${id}' is not a player in the game of Jeopardy.`);\r\n\t\tthis.playerTable[id].points += n;\r\n\t}\r\n\r\n\tsubstitute(original: User, substitute: User) {\r\n\t\tconst originalPlayer = this.playerTable[original.id];\r\n\t\tif (!originalPlayer) throw new Chat.ErrorMessage(`${original.name} is not a player in the game of Jeopardy.`);\r\n\r\n\t\tdelete this.playerTable[original.id];\r\n\t\tthis.addPlayer(substitute);\r\n\r\n\t\tthis.playerTable[substitute.id].answer = originalPlayer.answer;\r\n\t\tthis.playerTable[substitute.id].points = originalPlayer.points;\r\n\t\tthis.playerTable[substitute.id].wager = originalPlayer.wager;\r\n\t\tthis.playerTable[substitute.id].buzzedEarly = originalPlayer.buzzedEarly;\r\n\t\tthis.playerTable[substitute.id].finalAnswer = originalPlayer.finalAnswer;\r\n\t\tthis.playerTable[substitute.id].buzzed = originalPlayer.buzzed;\r\n\r\n\t\tthis.room.add(`${substitute.name} subbed in for ${original.name}!`);\r\n\t}\r\n}\r\n\r\nclass JeopardyGamePlayer extends Rooms.RoomGamePlayer {\r\n\tanswer: string;\r\n\tpoints: number;\r\n\twager: number;\r\n\tbuzzedEarly: boolean;\r\n\tfinalAnswer: string;\r\n\tbuzzed: boolean;\r\n\r\n\tconstructor(user: User, game: Jeopardy) {\r\n\t\tsuper(user, game);\r\n\t\tthis.answer = '';\r\n\t\tthis.points = 0;\r\n\t\tthis.wager = 0;\r\n\t\tthis.buzzedEarly = false;\r\n\t\tthis.finalAnswer = '';\r\n\t\tthis.buzzed = false;\r\n\t}\r\n}\r\n\r\nexport const commands: Chat.ChatCommands = {\r\n\tjp: 'jeopardy',\r\n\tjeopardy: {\r\n\t\t'': 'help',\r\n\t\thelp() {\r\n\t\t\treturn this.parse(\"/help jeopardy\");\r\n\t\t},\r\n\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.jeopardyDisabled) {\r\n\t\t\t\treturn this.errorReply(\"Jeopardy is already disabled in this room.\");\r\n\t\t\t}\r\n\t\t\troom.settings.jeopardyDisabled = true;\r\n\t\t\troom.saveSettings();\r\n\t\t\treturn this.sendReply(\"Jeopardy 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.jeopardyDisabled) {\r\n\t\t\t\treturn this.errorReply(\"Jeopardy is already enabled in this room.\");\r\n\t\t\t}\r\n\t\t\tdelete room.settings.jeopardyDisabled;\r\n\t\t\troom.saveSettings();\r\n\t\t\treturn this.sendReply(\"Jeopardy has been enabled for this room.\");\r\n\t\t},\r\n\r\n\t\tcreate: 'new',\r\n\t\tnew(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tif (room.game) {\r\n\t\t\t\treturn this.errorReply(`There is already a game of ${room.game.title} in progress in this room.`);\r\n\t\t\t}\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\t\t\tconst params = target.split(\",\");\r\n\r\n\t\t\tconst playerCap = parseInt(params[0]);\r\n\t\t\tconst categoryCount = parseInt(params[1]);\r\n\t\t\tconst questionCount = parseInt(params[2]);\r\n\t\t\tif (isNaN(playerCap) || playerCap <= 1) {\r\n\t\t\t\treturn this.errorReply(`The player cap must be a number above 1.`);\r\n\t\t\t}\r\n\r\n\t\t\tif (isNaN(categoryCount) || categoryCount <= 0) {\r\n\t\t\t\treturn this.errorReply(`The category count must be a number above 0.`);\r\n\t\t\t}\r\n\t\t\tif (categoryCount > MAX_CATEGORY_COUNT) {\r\n\t\t\t\treturn this.sendReply(`A match with more than ${MAX_CATEGORY_COUNT} categories cannot be created.`);\r\n\t\t\t}\r\n\r\n\t\t\tif (isNaN(questionCount) || questionCount <= 0) {\r\n\t\t\t\treturn this.errorReply(`The question count must be a number above 0.`);\r\n\t\t\t}\r\n\t\t\tif (questionCount > MAX_QUESTION_COUNT) {\r\n\t\t\t\treturn this.sendReply(\r\n\t\t\t\t\t`A match with more than ${MAX_QUESTION_COUNT} questions per category cannot be created.`\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\troom.game = new Jeopardy(room, user, categoryCount, questionCount, playerCap);\r\n\t\t\tthis.privateModAction(`${user.name} started a new game of Jeopardy.`);\r\n\t\t\tthis.modlog('JEOPARDY', null, `maximum of ${playerCap} players, ${categoryCount} categories, and ${questionCount} questions`);\r\n\t\t},\r\n\r\n\t\tcategories(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tconst params = target.split(\",\");\r\n\t\t\tif (params.length !== game.categoryCount) {\r\n\t\t\t\treturn this.errorReply(`You must set exactly ${game.categoryCount} categories.`);\r\n\t\t\t}\r\n\t\t\tconst reply = game.setCategories(params);\r\n\t\t\tif (reply) this.errorReply(reply);\r\n\t\t},\r\n\r\n\t\tcategory(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tconst params = target.split(\",\");\r\n\t\t\tif (params.length !== 2) return this.errorReply(\"You must specify the category number and the category.\");\r\n\t\t\tlet categoryNumber: string | number;\r\n\t\t\tif (params[0] === \"final\") {\r\n\t\t\t\tcategoryNumber = \"final\";\r\n\t\t\t} else {\r\n\t\t\t\tcategoryNumber = parseInt(params[0]);\r\n\t\t\t\tif (!categoryNumber || categoryNumber < 1 || categoryNumber > game.categoryCount) {\r\n\t\t\t\t\treturn this.errorReply(`The category number must be between 1 and ${game.categoryCount}.`);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tgame.setCategory((typeof categoryNumber === 'string' ? categoryNumber : categoryNumber - 1), params[1]);\r\n\t\t},\r\n\r\n\t\tselect(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tgame.select(target);\r\n\t\t},\r\n\r\n\t\tbuzz(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tgame.buzz(user);\r\n\t\t},\r\n\r\n\t\twager(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.lastCommand !== `/jeopardy wager ${target}`) {\r\n\t\t\t\tuser.lastCommand = `/jeopardy wager ${target}`;\r\n\t\t\t\treturn this.sendReply(`To confirm your wager of ${target}, type '${user.lastCommand}' again.`);\r\n\t\t\t}\r\n\t\t\tgame.wager(target, user);\r\n\t\t},\r\n\r\n\t\tanswer(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tgame.answer(target, user);\r\n\t\t},\r\n\r\n\t\timport(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (!target) return this.errorReply(\"You must specify at least one question\");\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tconst params = target.split(\",\");\r\n\t\t\tlet dataStart = 0;\r\n\t\t\tlet catStart: string | number;\r\n\t\t\tlet questionStart = 1;\r\n\t\t\tif (toID(params[0]) === 'final') {\r\n\t\t\t\tcatStart = 'finals';\r\n\t\t\t\tparams.splice(0, 1);\r\n\t\t\t} else {\r\n\t\t\t\tif (isNaN(Utils.parseExactInt(params[0])) || isNaN(Utils.parseExactInt(params[1]))) {\r\n\t\t\t\t\treturn this.errorReply(`You must specify numeric values for Category Number Start and Question Number Start.`);\r\n\t\t\t\t}\r\n\t\t\t\tcatStart = parseInt(params[0]);\r\n\t\t\t\tif (catStart) {\r\n\t\t\t\t\tif (catStart < 1 || catStart > game.categoryCount) {\r\n\t\t\t\t\t\treturn this.errorReply(`The category must be a number between 1 and ${game.categoryCount}.`);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tdataStart = 1;\r\n\t\t\t\t\tquestionStart = parseInt(params[1]);\r\n\t\t\t\t\tif (questionStart) {\r\n\t\t\t\t\t\tif (questionStart < 1 || questionStart > game.questionCount) {\r\n\t\t\t\t\t\t\treturn this.errorReply(`The question must be a number between 1 and ${game.questionCount}.`);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tdataStart = 2;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tquestionStart = 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tcatStart = 1;\r\n\t\t\t\t\tquestionStart = 1;\r\n\t\t\t\t}\r\n\t\t\t\tparams.splice(0, dataStart);\r\n\t\t\t}\r\n\t\t\tconst numberOfQuestions = params.length;\r\n\t\t\tgame.importQuestions(\r\n\t\t\t\tparams, questionStart - 1, (typeof catStart === 'string' ? catStart : catStart - 1)\r\n\t\t\t);\r\n\t\t\tthis.sendReply(`Imported ${numberOfQuestions} questions.`);\r\n\t\t},\r\n\r\n\t\tdd: 'dailydouble',\r\n\t\tdailydouble(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tconst params = target.split(\",\");\r\n\t\t\tif (params.length !== 2) return this.errorReply(\"You must specify the category number and question number\");\r\n\t\t\tconst categoryNumber = parseInt(params[0]);\r\n\t\t\tif (!categoryNumber || categoryNumber < 1 || categoryNumber > game.categoryCount) {\r\n\t\t\t\treturn this.errorReply(`The category must be a number between 1 and ${game.categoryCount}.`);\r\n\t\t\t}\r\n\t\t\tconst questionNumber = parseInt(params[0]);\r\n\t\t\tif (!questionNumber || questionNumber < 1 || questionNumber > game.questionCount) {\r\n\t\t\t\treturn this.errorReply(`The question must be a number between 1 and ${game.questionCount}.`);\r\n\t\t\t}\r\n\t\t\tgame.setDailyDouble(categoryNumber - 1, questionNumber - 1);\r\n\t\t\tthis.sendReply(\"Daily double has been added.\");\r\n\t\t},\r\n\t\tdailydoublehelp: [\r\n\t\t\t`/jeopardy dailydouble [category number], [question number] - Set a question to be a daily double.`,\r\n\t\t],\r\n\r\n\t\tview(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tconst params = target.split(\",\");\r\n\t\t\tif (params.length !== 2) return this.errorReply(\"You must specify the category number and question number\");\r\n\t\t\tconst categoryNumber = parseInt(params[0]);\r\n\t\t\tif (!categoryNumber || categoryNumber < 1 || categoryNumber > game.categoryCount) {\r\n\t\t\t\treturn this.errorReply(`The category must be a number between 1 and ${game.categoryCount}.`);\r\n\t\t\t}\r\n\t\t\tconst questionNumber = parseInt(params[1]);\r\n\t\t\tif (!questionNumber || questionNumber < 1 || questionNumber > game.questionCount) {\r\n\t\t\t\treturn this.errorReply(`The question must be a number between 1 and ${game.questionCount}.`);\r\n\t\t\t}\r\n\t\t\tthis.sendReplyBox(game.getQuestion(categoryNumber - 1, questionNumber - 1));\r\n\t\t},\r\n\r\n\t\tjoin(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (game.host.id === user.id) return this.errorReply(\"You are the host and therefore cannot join the game.\");\r\n\t\t\tif (game.state !== 'signups') return this.errorReply(\"This Jeopardy game is not in its signups phase.\");\r\n\t\t\tif (game.addPlayer(user)) {\r\n\t\t\t\tgame.update();\r\n\t\t\t} else {\r\n\t\t\t\tthis.errorReply(\"Unable to join the game.\");\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tincorrect: 'correct',\r\n\t\tcorrect(target, room, user, connection, cmd) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tgame.mark(cmd === 'correct');\r\n\t\t},\r\n\r\n\t\tstart(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tgame.start();\r\n\t\t},\r\n\r\n\t\tkick: 'leave',\r\n\t\tleave(target, room, user, connection, cmd) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tconst kicking = cmd.includes('kick');\r\n\t\t\tif (kicking && user.id !== game.host.id) return this.errorReply(\"Only the host can kick players.\");\r\n\t\t\tconst targetUser = kicking ? Users.get(target) : user;\r\n\t\t\tif (!targetUser) return this.errorReply(`User '${target}' not found.`);\r\n\t\t\tif (game.removePlayer(targetUser)) {\r\n\t\t\t\tgame.update();\r\n\t\t\t} else {\r\n\t\t\t\treturn this.errorReply(`Unable to remove '${targetUser.name}' from the game.`);\r\n\t\t\t}\r\n\t\t},\r\n\r\n\t\tsubhost(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tconst targetUser = Users.get(target);\r\n\t\t\tif (!targetUser) return this.errorReply(`User '${target}' not found.`);\r\n\t\t\tgame.host = targetUser;\r\n\t\t\tthis.sendReply(`${targetUser.name} has subbed in as the host.`);\r\n\t\t},\r\n\r\n\t\tsubplayer(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\r\n\t\t\tconst split = target.split(',');\r\n\t\t\tif (split.length !== 2) return this.parse(`/help jeopardy`);\r\n\t\t\tconst [toSubOut, toSubIn] = split.map(u => Users.get(u));\r\n\t\t\tif (!toSubOut) return this.errorReply(`User '${target[0]}' not found.`);\r\n\t\t\tif (!toSubIn) return this.errorReply(`User '${target[1]}' not found.`);\r\n\r\n\t\t\tgame.substitute(toSubOut, toSubIn);\r\n\t\t},\r\n\r\n\t\tstate(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tthis.sendReply(`The game is currently in the ${game.state} state.`);\r\n\t\t},\r\n\r\n\t\tend(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tthis.checkCan('minigame', null, room);\r\n\t\t\tgame.destroy();\r\n\t\t\tthis.privateModAction(`${user.name} ended the game of Jeopardy.`);\r\n\t\t\tthis.modlog('JEOPARDY END');\r\n\t\t},\r\n\r\n\t\tpass(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tgame.nextQuestion();\r\n\t\t},\r\n\r\n\t\ttimer(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tconst amount = parseInt(target);\r\n\t\t\tif (!amount || amount < 2 || amount > 120) return this.errorReply(\"The amount must be a number between 2 and 120.\");\r\n\r\n\t\t\tgame.answeringTime = amount;\r\n\t\t\tthis.addModAction(`${user.name} has set the answering window for questions to ${amount} seconds`);\r\n\t\t\tthis.modlog('JEOPARDY TIMER', null, `${amount} seconds`);\r\n\t\t},\r\n\r\n\t\tfinaltimer(target, room, user) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\t\t\tconst amount = parseInt(target);\r\n\t\t\tif (!amount || amount < 2 || amount > 300) return this.errorReply(\"The amount must be a number between 2 and 300.\");\r\n\r\n\t\t\tgame.finalAnsweringTime = amount;\r\n\t\t\tthis.addModAction(`${user.name} has set the answering window for the final question to ${amount} seconds`);\r\n\t\t\tthis.modlog('JEOPARDY FINALTIMER', null, `${amount} seconds`);\r\n\t\t},\r\n\r\n\t\tremovepoints: 'addpoints',\r\n\t\taddpoints(target, room, user, connection, cmd) {\r\n\t\t\troom = this.requireRoom();\r\n\t\t\tif (!target) return this.parse(`/help jeopardy`);\r\n\t\t\tconst game = this.requireGame(Jeopardy);\r\n\t\t\tif (user.id !== game.host.id) return this.errorReply(\"This command can only be used by the host.\");\r\n\r\n\t\t\tconst [recipient, pointsString] = target.split(',');\r\n\t\t\tlet points = parseInt(pointsString);\r\n\t\t\tif (points <= 0 || isNaN(points)) {\r\n\t\t\t\treturn this.errorReply(`You must provide a positive number of points to add/remove.`);\r\n\t\t\t}\r\n\t\t\tif (cmd.includes('remove')) points *= -1;\r\n\t\t\tgame.givePoints(toID(recipient), points);\r\n\t\t},\r\n\t},\r\n\tjeopardyhelp() {\r\n\t\tthis.runBroadcast();\r\n\t\treturn this.sendReply(\r\n\t\t\t`|html|
/jp new [player cap], [number of categories], [number of questions]: Host a new game of Jeopardy. Requires: % @ # &
` +\r\n\t\t\t`/jp join: Join the game of Jeopardy.
` +\r\n\t\t\t`/jp leave: Leave the game of Jeopardy.
` +\r\n\t\t\t`/jp buzz: Buzz into the current question.
` +\r\n\t\t\t`/jp answer [answer]: Attempt to answer the current question.
` +\r\n\t\t\t`/jp start: Start the game of Jeopardy. Must be the host.
` +\r\n\t\t\t`/jp correct/incorrect: Mark an answer as correct or incorrect. Must be the host.
` +\r\n\t\t\t`/jp categories [First Category], [Second Category], etc.: Set the categories of the jeopardy game. Must be the host.
` +\r\n\t\t\t`/jp category [Category Number], [Category Name]: Set a specific category of the jeopardy game. Must be the host.
` +\r\n\t\t\t`/jp select [Category Number], [Question Number]: Select a question of the Jeopardy game.
` +\r\n\t\t\t`/jp end: End the current game of Jeopardy. Requires: % @ # &
` +\r\n\t\t\t`/jp dailydouble [Category Number], [Question Number]: Set a question to be a daily double. Must be the host.
` +\r\n\t\t\t`/jp wager [amount]: Wager some money for a daily double or finals. Must be a number or 'all'
` +\r\n\t\t\t`/jp kick [User]: Remove a user from the game of Jeopardy. Must be the host.
` +\r\n\t\t\t`/jp view [Category Number], [Question Number]: View a specific question and answer. Must be the host.
` +\r\n\t\t\t`/jp subhost [User]: Sub a new host into the game. Must be the host.
` +\r\n\t\t\t`/jp subplayer [original], [substitute]: Sub a new player into the game. Must be the host.
` +\r\n\t\t\t`/jp import [Category Number Start], [Question Number Start], [Question 1 | Answer 1], [Question 2 | Answer 2], etc.: Import questions into the current game of Jeopardy. Must be the host.
` +\r\n\t\t\t`/jp pass: Skip the current question of Jeopardy. Must be the host.
` +\r\n\t\t\t`/jp state: Check the state of the current Jeopardy game. Must be the host.
` +\r\n\t\t\t`/jp timer [seconds]: Set the answering window after buzzing for questions
` +\r\n\t\t\t`/jp finaltimer [seconds]: Set the answering window for answering the final question
` +\r\n\t\t\t`/jp addpoints [user], [number of points]: Give a player an arbitrary number of points. Must be the host.
` +\r\n\t\t\t`/jp remove [user], [number of points]: Subtract an arbitrary number of points from a player. Must be the host.
`\r\n\t\t);\r\n\t},\r\n};\r\n\r\nexport const roomSettings: Chat.SettingsHandler = room => ({\r\n\tlabel: \"Jeopardy\",\r\n\tpermission: 'editroom',\r\n\toptions: [\r\n\t\t[`disabled`, room.settings.jeopardyDisabled || 'jeopardy disable'],\r\n\t\t[`enabled`, !room.settings.jeopardyDisabled || 'jeopardy enable'],\r\n\t],\r\n});\r\n"], "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAoB;AAEpB,MAAM,mBAAmB;AACzB,MAAM,SAAS;AACf,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAC3B,MAAM,gBAAgB;AAYf,MAAM,iBAAiB,MAAM,SAA6B;AAAA,EA2BhE,YAAY,MAAY,MAAY,eAAuB,eAAuB,WAAmB;AACpG,UAAM,IAAI;AACV,SAAK,aAAa,KAAK,eAAe;AACtC,SAAK,OAAO;AACZ,SAAK,eAAe;AACpB,SAAK,QAAQ;AACb,SAAK,SAAS;AACd,SAAK,QAAQ;AACb,SAAK,aAAa,CAAC;AACnB,SAAK,WAAW,uBAAO,OAAO,IAAI;AAClC,SAAK,YAAY,CAAC;AAClB,SAAK,gBAAgB,uBAAO,OAAO,IAAI;AACvC,SAAK,UAAU;AACf,SAAK,gBAAgB;AACrB,SAAK,gBAAgB;AACr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