{ "version": 3, "sources": ["../../../server/chat-plugins/mafia.ts"], "sourcesContent": ["import { Utils, FS } from '../../lib';\n\ninterface MafiaData {\n\t// keys for all of these are IDs\n\talignments: { [k: string]: MafiaDataAlignment };\n\troles: { [k: string]: MafiaDataRole };\n\tthemes: { [k: string]: MafiaDataTheme };\n\tIDEAs: { [k: string]: MafiaDataIDEA };\n\tterms: { [k: string]: MafiaDataTerm };\n\taliases: { [k: string]: ID };\n}\ninterface MafiaDataAlignment {\n\tname: string;\n\tplural: string;\n\tcolor?: string;\n\tbuttonColor?: string;\n\tmemo: string[];\n\timage?: string;\n}\ninterface MafiaDataRole {\n\tname: string;\n\tmemo: string[];\n\talignment?: string;\n\timage?: string;\n}\ninterface MafiaDataTheme {\n\tname: string;\n\tmemo?: undefined;\n\tdesc: string;\n\t// roles\n\t[players: number]: string;\n}\ninterface MafiaDataIDEA {\n\tname: string;\n\tmemo?: undefined;\n\troles: string[];\n\tpicks: string[];\n\tchoices: number;\n}\ninterface MafiaDataTerm {\n\tname: string;\n\tmemo: string[];\n}\n\ninterface MafiaLogTable {\n\t[date: string]: { [userid: string]: number };\n}\ntype MafiaLogSection = 'leaderboard' | 'mvps' | 'hosts' | 'plays' | 'leavers';\ntype MafiaLog = { [section in MafiaLogSection]: MafiaLogTable };\n\ninterface MafiaRole {\n\tname: string;\n\tsafeName: string;\n\tid: string;\n\tmemo: string[];\n\talignment: string;\n\timage: string;\n}\n\ninterface MafiaVote {\n\t// number of people on this vote\n\tcount: number;\n\t// number of votes, accounting for doublevoter etc\n\ttrueCount: number;\n\tlastVote: number;\n\tdir: 'up' | 'down';\n\tvoters: ID[];\n}\n\ninterface MafiaIDEAData {\n\tname: string;\n\t// do we trust the roles to parse properly\n\tuntrusted?: true;\n\troles: string[];\n\t// eg, GestI has 3 choices\n\tchoices: number;\n\t// eg, GestI has 2 things to pick, role and alignment\n\tpicks: string[];\n}\n\ninterface MafiaIDEAModule {\n\tdata: MafiaIDEAData | null;\n\ttimer: NodeJS.Timeout | null;\n\tdiscardsHidden: boolean;\n\tdiscardsHTML: string;\n\t// users that haven't picked a role yet\n\twaitingPick: string[];\n}\n\ninterface MafiaIDEAPlayerData {\n\tchoices: string[];\n\toriginalChoices: string[];\n\tpicks: { [choice: string]: string | null };\n}\n\n// The different possible ways for a player to be eliminated\nconst MafiaEliminateType = {\n\tELIMINATE: \"was eliminated\", // standard (vote + faction kill + anything else)\n\tKICK: \"was kicked from the game\", // staff kick\n\tTREESTUMP: \"was treestumped\", // can still talk\n\tSPIRIT: \"became a restless spirit\", // can still vote\n\tSPIRITSTUMP: \"became a restless treestump\", // treestump + spirit\n} as const;\ntype MafiaEliminateType = typeof MafiaEliminateType[keyof typeof MafiaEliminateType];\n\nconst DATA_FILE = 'config/chat-plugins/mafia-data.json';\nconst LOGS_FILE = 'config/chat-plugins/mafia-logs.json';\n\n// see: https://play.pokemonshowdown.com/fx/\nconst VALID_IMAGES = [\n\t'cop', 'dead', 'doctor', 'fool', 'godfather', 'goon', 'hooker', 'mafia', 'mayor', 'villager', 'werewolf',\n];\n\nlet MafiaData: MafiaData = Object.create(null);\nlet logs: MafiaLog = { leaderboard: {}, mvps: {}, hosts: {}, plays: {}, leavers: {} };\n\nPunishments.addRoomPunishmentType({\n\ttype: 'MAFIAGAMEBAN',\n\tdesc: 'banned from playing mafia games',\n});\nPunishments.addRoomPunishmentType({\n\ttype: 'MAFIAHOSTBAN',\n\tdesc: 'banned from hosting mafia games',\n});\n\nconst hostQueue: ID[] = [];\n\nconst IDEA_TIMER = 60 * 1000;\n\nfunction readFile(path: string) {\n\ttry {\n\t\tconst json = FS(path).readIfExistsSync();\n\t\tif (!json) {\n\t\t\treturn false;\n\t\t}\n\t\treturn Object.assign(Object.create(null), JSON.parse(json));\n\t} catch (e: any) {\n\t\tif (e.code !== 'ENOENT') throw e;\n\t}\n}\nfunction writeFile(path: string, data: AnyObject) {\n\tFS(path).writeUpdate(() => (\n\t\tJSON.stringify(data)\n\t));\n}\n\n// data assumptions -\n// the alignments \"town\" and \"solo\" always exist (defaults)\n// .alignment is always a valid key in data.alignments\n// roles and alignments have no common keys (looked up together in the role parser)\n// themes and IDEAs have no common keys (looked up together when setting themes)\n\n// Load data\nMafiaData = readFile(DATA_FILE) || { alignments: {}, roles: {}, themes: {}, IDEAs: {}, terms: {}, aliases: {} };\nif (!MafiaData.alignments.town) {\n\tMafiaData.alignments.town = {\n\t\tname: 'town', plural: 'town', memo: [`This alignment is required for the script to function properly.`],\n\t};\n}\nif (!MafiaData.alignments.solo) {\n\tMafiaData.alignments.solo = {\n\t\tname: 'solo', plural: 'solo', memo: [`This alignment is required for the script to function properly.`],\n\t};\n}\n\nlogs = readFile(LOGS_FILE) || { leaderboard: {}, mvps: {}, hosts: {}, plays: {}, leavers: {} };\n\nconst tables: MafiaLogSection[] = ['leaderboard', 'mvps', 'hosts', 'plays', 'leavers'];\nfor (const section of tables) {\n\t// Check to see if we need to eliminate an old month's data.\n\tconst month = new Date().toLocaleString(\"en-us\", { month: \"numeric\", year: \"numeric\" });\n\tif (!logs[section]) logs[section] = {};\n\tif (!logs[section][month]) logs[section][month] = {};\n\tif (Object.keys(logs[section]).length >= 3) {\n\t\t// eliminate the oldest month(s)\n\t\tconst keys = Utils.sortBy(Object.keys(logs[section]), key => {\n\t\t\tconst [monthStr, yearStr] = key.split('/');\n\t\t\treturn [parseInt(yearStr), parseInt(monthStr)];\n\t\t});\n\t\twhile (keys.length > 2) {\n\t\t\tconst curKey = keys.shift();\n\t\t\tif (!curKey) break; // should never happen\n\t\t\tdelete logs[section][curKey];\n\t\t}\n\t}\n}\nwriteFile(LOGS_FILE, logs);\n\nclass MafiaPlayer extends Rooms.RoomGamePlayer {\n\tsafeName: string;\n\trole: MafiaRole | null;\n\tvoting: ID;\n\t/** false - can't hammer (priest), true - can only hammer (actor) */\n\thammerRestriction: null | boolean;\n\tlastVote: number;\n\teliminated: MafiaEliminateType | null;\n\teliminationOrder: number;\n\tsilenced: boolean;\n\tnighttalk: boolean;\n\trevealed: string;\n\tIDEA: MafiaIDEAPlayerData | null;\n\t/** false - used an action, true - idled, null - no response */\n\taction: null | boolean | string;\n\tactionArr: string[];\n\tconstructor(user: User, game: Mafia) {\n\t\tsuper(user, game);\n\t\tthis.safeName = Utils.escapeHTML(this.name);\n\t\tthis.role = null;\n\t\tthis.voting = '';\n\t\tthis.hammerRestriction = null;\n\t\tthis.lastVote = 0;\n\t\tthis.eliminated = null;\n\t\tthis.eliminationOrder = 0;\n\t\tthis.silenced = false;\n\t\tthis.nighttalk = false;\n\t\tthis.revealed = '';\n\t\tthis.IDEA = null;\n\t\tthis.action = null;\n\t\tthis.actionArr = [];\n\t}\n\n\t/**\n\t * Called if the player's name changes.\n\t */\n\tupdateSafeName() {\n\t\tthis.safeName = Utils.escapeHTML(this.name);\n\t}\n\n\tgetStylizedRole(button = false) {\n\t\tif (!this.role) return;\n\t\tlet color = MafiaData.alignments[this.role.alignment].color;\n\t\tif (button && MafiaData.alignments[this.role.alignment].buttonColor) {\n\t\t\tcolor = MafiaData.alignments[this.role.alignment].buttonColor;\n\t\t}\n\t\treturn `${this.role.safeName}`;\n\t}\n\n\tisEliminated() {\n\t\treturn this.eliminated !== null;\n\t}\n\n\tisTreestump() {\n\t\treturn this.eliminated === MafiaEliminateType.TREESTUMP ||\n\t\t\tthis.eliminated === MafiaEliminateType.SPIRITSTUMP;\n\t}\n\n\tisSpirit() {\n\t\treturn this.eliminated === MafiaEliminateType.SPIRIT ||\n\t\t\tthis.eliminated === MafiaEliminateType.SPIRITSTUMP;\n\t}\n\n\t// Only call updateHtmlRoom if the player is still involved in the game in some way\n\ttryUpdateHtmlRoom() {\n\t\tif ([null, MafiaEliminateType.SPIRIT, MafiaEliminateType.TREESTUMP,\n\t\t\tMafiaEliminateType.SPIRITSTUMP].includes(this.eliminated as any)) {\n\t\t\tthis.updateHtmlRoom();\n\t\t}\n\t}\n\n\t/**\n\t * Updates the mafia HTML room for this player.\n\t * @param id Only provided during the destruction process to update the HTML one last time after player.id is cleared.\n\t */\n\tupdateHtmlRoom() {\n\t\tif (this.game.ended) return this.closeHtmlRoom();\n\t\tconst user = Users.get(this.id);\n\t\tif (!user?.connected) return;\n\t\tfor (const conn of user.connections) {\n\t\t\tvoid Chat.resolvePage(`view-mafia-${this.game.room.roomid}`, user, conn);\n\t\t}\n\t}\n\n\tcloseHtmlRoom() {\n\t\tconst user = Users.get(this.id);\n\t\tif (!user?.connected) return;\n\t\treturn user.send(`>view-mafia-${this.game.room.roomid}\\n|deinit`);\n\t}\n\n\tupdateHtmlVotes() {\n\t\tconst user = Users.get(this.id);\n\t\tif (!user?.connected) return;\n\t\tconst votes = this.game.voteBoxFor(this.id);\n\t\tuser.send(`>view-mafia-${this.game.room.roomid}\\n|selectorhtml|#mafia-votes|` + votes);\n\t}\n}\n\nclass Mafia extends Rooms.RoomGame {\n\toverride readonly gameid = 'mafia' as ID;\n\tstarted: boolean;\n\ttheme: MafiaDataTheme | null;\n\thostid: ID;\n\thost: string;\n\tcohostids: ID[];\n\tcohosts: string[];\n\n\tsubs: ID[];\n\tautoSub: boolean;\n\trequestedSub: ID[];\n\thostRequestedSub: ID[];\n\tplayed: ID[];\n\n\thammerCount: number;\n\tvotes: { [userid: string]: MafiaVote };\n\tvoteModifiers: { [userid: string]: number };\n\thammerModifiers: { [userid: string]: number };\n\thasPlurality: ID | null;\n\n\tenableNV: boolean;\n\tvoteLock: boolean;\n\tvotingEnabled: boolean;\n\tforceVote: boolean;\n\tclosedSetup: boolean;\n\tnoReveal: boolean;\n\tselfEnabled: boolean | 'hammer';\n\ttakeIdles: boolean;\n\n\toriginalRoles: MafiaRole[];\n\toriginalRoleString: string;\n\troles: MafiaRole[];\n\troleString: string;\n\n\tphase: 'signups' | 'locked' | 'IDEApicking' | 'IDEAlocked' | 'day' | 'night';\n\tdayNum: number;\n\n\ttimer: NodeJS.Timeout | null;\n\tdlAt: number;\n\n\tIDEA: MafiaIDEAModule;\n\tconstructor(room: ChatRoom, host: User) {\n\t\tsuper(room);\n\n\t\tthis.title = 'Mafia';\n\t\tthis.playerCap = 20;\n\t\tthis.allowRenames = false;\n\t\tthis.started = false;\n\n\t\tthis.theme = null;\n\n\t\tthis.hostid = host.id;\n\t\tthis.host = Utils.escapeHTML(host.name);\n\t\tthis.cohostids = [];\n\t\tthis.cohosts = [];\n\n\t\tthis.subs = [];\n\t\tthis.autoSub = true;\n\t\tthis.requestedSub = [];\n\t\tthis.hostRequestedSub = [];\n\t\tthis.played = [];\n\n\t\tthis.hammerCount = 0;\n\t\tthis.votes = Object.create(null);\n\t\tthis.voteModifiers = Object.create(null);\n\t\tthis.hammerModifiers = Object.create(null);\n\t\tthis.hasPlurality = null;\n\n\t\tthis.enableNV = true;\n\t\tthis.voteLock = false;\n\t\tthis.votingEnabled = true;\n\t\tthis.forceVote = false;\n\t\tthis.closedSetup = false;\n\t\tthis.noReveal = true;\n\t\tthis.selfEnabled = false;\n\t\tthis.takeIdles = true;\n\n\t\tthis.originalRoles = [];\n\t\tthis.originalRoleString = '';\n\t\tthis.roles = [];\n\t\tthis.roleString = '';\n\n\t\tthis.phase = \"signups\";\n\t\tthis.dayNum = 0;\n\t\tthis.timer = null;\n\t\tthis.dlAt = 0;\n\n\t\tthis.IDEA = {\n\t\t\tdata: null,\n\t\t\ttimer: null,\n\t\t\tdiscardsHidden: false,\n\t\t\tdiscardsHTML: '',\n\t\t\twaitingPick: [],\n\t\t};\n\n\t\tthis.sendHTML(this.roomWindow());\n\t}\n\n\tjoin(user: User, staffAdd: User | null = null, force = false) {\n\t\tif (this.phase !== 'signups' && !staffAdd) {\n\t\t\treturn this.sendUser(user, `|error|The game of ${this.title} has already started.`);\n\t\t}\n\n\t\tthis.canJoin(user, !staffAdd, force);\n\t\tif (this.playerCount >= this.playerCap) return this.sendUser(user, `|error|The game of ${this.title} is full.`);\n\n\t\tconst player = this.addPlayer(user);\n\t\tif (!player) return this.sendUser(user, `|error|You have already joined the game of ${this.title}.`);\n\t\tif (this.started) {\n\t\t\tplayer.role = {\n\t\t\t\tname: `Unknown`,\n\t\t\t\tsafeName: `Unknown`,\n\t\t\t\tid: `unknown`,\n\t\t\t\talignment: 'solo',\n\t\t\t\timage: '',\n\t\t\t\tmemo: [`You were added to the game after it had started. To learn about your role, PM the host (${this.host}).`],\n\t\t\t};\n\t\t\tthis.roles.push(player.role);\n\t\t\tthis.played.push(player.id);\n\t\t} else {\n\t\t\t// TODO improve reseting roles\n\t\t\tthis.originalRoles = [];\n\t\t\tthis.originalRoleString = '';\n\t\t\tthis.roles = [];\n\t\t\tthis.roleString = '';\n\t\t}\n\n\t\tif (this.subs.includes(user.id)) this.subs.splice(this.subs.indexOf(user.id), 1);\n\t\tplayer.updateHtmlRoom();\n\t\tif (staffAdd) {\n\t\t\tthis.sendDeclare(`${player.name} has been added to the game by ${staffAdd.name}.`);\n\t\t\tthis.logAction(staffAdd, 'added player');\n\t\t} else {\n\t\t\tthis.sendRoom(`${player.name} has joined the game.`);\n\t\t}\n\t}\n\n\tleave(user: User) {\n\t\tconst player = this.getPlayer(user.id);\n\t\tif (!player) {\n\t\t\treturn this.sendUser(user, `|error|You have not joined the game of ${this.title}.`);\n\t\t}\n\t\tif (this.phase !== 'signups') return this.sendUser(user, `|error|The game of ${this.title} has already started.`);\n\t\tthis.removePlayer(player);\n\t\tlet subIndex = this.requestedSub.indexOf(user.id);\n\t\tif (subIndex !== -1) this.requestedSub.splice(subIndex, 1);\n\t\tsubIndex = this.hostRequestedSub.indexOf(user.id);\n\t\tif (subIndex !== -1) this.hostRequestedSub.splice(subIndex, 1);\n\t\tthis.sendRoom(`${user.name} has left the game.`);\n\t\tfor (const conn of user.connections) {\n\t\t\tvoid Chat.resolvePage(`view-mafia-${this.room.roomid}`, user, conn);\n\t\t}\n\t}\n\n\tstatic isGameBanned(room: Room, user: User) {\n\t\treturn Punishments.hasRoomPunishType(room, toID(user), 'MAFIAGAMEBAN');\n\t}\n\n\tstatic gameBan(room: Room, user: User, reason: string, duration: number) {\n\t\tPunishments.roomPunish(room, user, {\n\t\t\ttype: 'MAFIAGAMEBAN',\n\t\t\tid: toID(user),\n\t\t\texpireTime: Date.now() + (duration * 24 * 60 * 60 * 1000),\n\t\t\treason,\n\t\t});\n\t}\n\n\tstatic ungameBan(room: Room, user: User) {\n\t\tPunishments.roomUnpunish(room, toID(user), 'MAFIAGAMEBAN', false);\n\t}\n\n\tstatic isHostBanned(room: Room, user: User) {\n\t\treturn Mafia.isGameBanned(room, user) || Punishments.hasRoomPunishType(room, toID(user), 'MAFIAGAMEBAN');\n\t}\n\n\tstatic hostBan(room: Room, user: User, reason: string, duration: number) {\n\t\tPunishments.roomPunish(room, user, {\n\t\t\ttype: 'MAFIAHOSTBAN',\n\t\t\tid: toID(user),\n\t\t\texpireTime: Date.now() + (duration * 24 * 60 * 60 * 1000),\n\t\t\treason,\n\t\t});\n\t}\n\n\tstatic unhostBan(room: Room, user: User) {\n\t\tPunishments.roomUnpunish(room, toID(user), 'MAFIAHOSTBAN', false);\n\t}\n\n\tmakePlayer(user: User) {\n\t\treturn new MafiaPlayer(user, this);\n\t}\n\n\tgetPlayer(userid: ID) {\n\t\tconst matches = this.players.filter(p => p.id === userid);\n\t\tif (matches.length > 1) {\n\t\t\t// Should never happen\n\t\t\tthrow new Error(`Duplicate player IDs in Mafia game! Matches: ${matches.map(p => p.id).join(', ')}`);\n\t\t}\n\n\t\treturn matches.length > 0 ? matches[0] : null;\n\t}\n\n\tsetRoles(user: User, roleString: string, force = false, reset = false) {\n\t\tlet roles = roleString.split(',').map(x => x.trim());\n\n\t\tif (roles.length === 1) {\n\t\t\t// Attempt to set roles from a theme\n\t\t\tlet themeName: string = toID(roles[0]);\n\t\t\tif (themeName in MafiaData.aliases) themeName = MafiaData.aliases[themeName];\n\n\t\t\tif (themeName in MafiaData.themes) {\n\t\t\t\t// setting a proper theme\n\t\t\t\tconst theme = MafiaData.themes[themeName];\n\t\t\t\tif (!theme[this.playerCount]) {\n\t\t\t\t\treturn user.sendTo(\n\t\t\t\t\t\tthis.room,\n\t\t\t\t\t\t`|error|The theme \"${theme.name}\" does not have a role list for ${this.playerCount} players.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst themeRoles: string = theme[this.playerCount];\n\t\t\t\troles = themeRoles.split(',').map(x => x.trim());\n\t\t\t\tthis.theme = theme;\n\t\t\t} else if (themeName in MafiaData.IDEAs) {\n\t\t\t\t// setting an IDEA's rolelist as a theme, a la Great Idea\n\t\t\t\tconst IDEA = MafiaData.IDEAs[themeName];\n\t\t\t\troles = IDEA.roles;\n\t\t\t\tthis.theme = null;\n\t\t\t} else {\n\t\t\t\treturn this.sendUser(user, `|error|${roles[0]} is not a valid theme or IDEA.`);\n\t\t\t}\n\t\t} else {\n\t\t\tthis.theme = null;\n\t\t}\n\n\t\tif (roles.length < this.playerCount) {\n\t\t\treturn this.sendUser(user, `|error|You have not provided enough roles for the players.`);\n\t\t} else if (roles.length > this.playerCount) {\n\t\t\tuser.sendTo(\n\t\t\t\tthis.room,\n\t\t\t\t`|error|You have provided too many roles, ${roles.length - this.playerCount} ${Chat.plural(roles.length - this.playerCount, 'roles', 'role')} will not be assigned.`\n\t\t\t);\n\t\t}\n\n\t\tif (force) {\n\t\t\tthis.originalRoles = roles.map(r => ({\n\t\t\t\tname: r,\n\t\t\t\tsafeName: Utils.escapeHTML(r),\n\t\t\t\tid: toID(r),\n\t\t\t\talignment: 'solo',\n\t\t\t\timage: '',\n\t\t\t\tmemo: [`To learn more about your role, PM the host (${this.host}).`],\n\t\t\t}));\n\t\t\tUtils.sortBy(this.originalRoles, role => role.name);\n\t\t\tthis.roles = this.originalRoles.slice();\n\t\t\tthis.originalRoleString = this.originalRoles.map(\n\t\t\t\tr => `${r.safeName}`\n\t\t\t).join(', ');\n\t\t\tthis.roleString = this.originalRoleString;\n\t\t\tthis.sendRoom(`The roles have been ${reset ? 're' : ''}set.`);\n\t\t\tif (reset) this.distributeRoles();\n\t\t\treturn;\n\t\t}\n\n\t\tconst newRoles: MafiaRole[] = [];\n\t\tconst problems: string[] = [];\n\t\tconst alignments: string[] = [];\n\t\tconst cache: { [k: string]: MafiaRole } = Object.create(null);\n\t\tfor (const roleName of roles) {\n\t\t\tconst roleId = roleName.toLowerCase().replace(/[^\\w\\d\\s]/g, '');\n\t\t\tif (roleId in cache) {\n\t\t\t\tnewRoles.push({ ...cache[roleId] });\n\t\t\t} else {\n\t\t\t\tconst role = Mafia.parseRole(roleName);\n\t\t\t\tif (role.problems.length) {\n\t\t\t\t\tproblems.push(...role.problems);\n\t\t\t\t}\n\t\t\t\tif (!alignments.includes(role.role.alignment)) alignments.push(role.role.alignment);\n\t\t\t\tcache[roleId] = role.role;\n\t\t\t\tnewRoles.push(role.role);\n\t\t\t}\n\t\t}\n\t\tif (alignments.length < 2 && alignments[0] !== 'solo') {\n\t\t\tproblems.push(`There must be at least 2 different alignments in a game!`);\n\t\t}\n\t\tif (problems.length) {\n\t\t\tfor (const problem of problems) {\n\t\t\t\tthis.sendUser(user, `|error|${problem}`);\n\t\t\t}\n\t\t\treturn this.sendUser(user, `|error|To forcibly set the roles, use /mafia force${reset ? \"re\" : \"\"}setroles`);\n\t\t}\n\n\t\tthis.IDEA.data = null;\n\n\t\tthis.originalRoles = newRoles;\n\t\tUtils.sortBy(this.originalRoles, role => [role.alignment, role.name]);\n\t\tthis.roles = this.originalRoles.slice();\n\t\tthis.originalRoleString = this.originalRoles.map(\n\t\t\tr => `${r.safeName}`\n\t\t).join(', ');\n\t\tthis.roleString = this.originalRoleString;\n\n\t\tif (!reset) this.phase = 'locked';\n\t\tthis.updatePlayers();\n\t\tthis.sendRoom(`The roles have been ${reset ? 're' : ''}set.`);\n\t\tif (reset) this.distributeRoles();\n\t}\n\n\tresetGame() {\n\t\tthis.clearVotes();\n\t\tthis.dayNum = 0;\n\t\tthis.phase = 'night';\n\t\tfor (const hostid of [...this.cohostids, this.hostid]) {\n\t\t\tconst host = Users.get(hostid);\n\t\t\tif (host?.connected) host.send(`>${this.room.roomid}\\n|notify|It's night in your game of Mafia!`);\n\t\t}\n\t\tfor (const player of this.players) {\n\t\t\tconst user = Users.get(player.id);\n\t\t\tif (user?.connected) {\n\t\t\t\tthis.sendUser(user, `|notify|It's night in the game of Mafia! Send in an action or idle.`);\n\t\t\t}\n\n\t\t\tplayer.actionArr.length = 0; // Yes, this works. It empties the array.\n\t\t}\n\n\t\tif (this.timer) this.setDeadline(0);\n\t\tthis.sendDeclare(`The game has been reset.`);\n\t\tthis.distributeRoles();\n\t\tif (this.takeIdles) {\n\t\t\tthis.sendDeclare(`Night ${this.dayNum}. Submit whether you are using an action or idle. If you are using an action, DM your action to the host.`);\n\t\t} else {\n\t\t\tthis.sendDeclare(`Night ${this.dayNum}. PM the host your action, or idle.`);\n\t\t}\n\t}\n\n\tstatic parseRole(roleString: string) {\n\t\tconst roleName = roleString.replace(/solo/, '').trim();\n\n\t\tconst role = {\n\t\t\tname: roleName,\n\t\t\tsafeName: Utils.escapeHTML(roleName),\n\t\t\tid: toID(roleName),\n\t\t\timage: '',\n\t\t\tmemo: ['During the Day, you may vote for someone to be eliminated.'],\n\t\t\talignment: '',\n\t\t};\n\t\tconst problems: string[] = [];\n\n\t\t// if a role has a modifier with an alignment and a proper alignment,\n\t\t// the proper alignment overrides the modifier's alignment\n\t\tlet modAlignment = '';\n\n\t\tconst roleWords = roleString\n\t\t\t.replace(/\\(.+?\\)/g, '') // remove (notes within brackets)\n\t\t\t.split(' ')\n\t\t\t.map(toID);\n\n\t\tlet iters = 0;\n\t\touter: while (roleWords.length) {\n\t\t\tconst currentWord = roleWords.slice();\n\n\t\t\twhile (currentWord.length) {\n\t\t\t\tif (iters++ === 1000) throw new Error(`Infinite loop.`);\n\n\t\t\t\tlet currentSearch = currentWord.join('');\n\t\t\t\tif (currentSearch in MafiaData.aliases) currentSearch = MafiaData.aliases[currentSearch];\n\n\t\t\t\tif (currentSearch in MafiaData.roles) {\n\t\t\t\t\t// we found something with our current search, remove it from the main role and restart\n\t\t\t\t\tconst mod = MafiaData.roles[currentSearch];\n\n\t\t\t\t\tif (mod.memo) role.memo.push(...mod.memo);\n\t\t\t\t\tif (mod.alignment && !modAlignment) modAlignment = mod.alignment;\n\t\t\t\t\tif (mod.image && !role.image) role.image = mod.image;\n\n\t\t\t\t\troleWords.splice(0, currentWord.length);\n\t\t\t\t\tcontinue outer;\n\t\t\t\t} else if (currentSearch in MafiaData.alignments) {\n\t\t\t\t\tif (role.alignment && role.alignment !== currentSearch) {\n\t\t\t\t\t\tproblems.push(`The role ${roleString} has multiple possible alignments (${role.alignment} and ${currentSearch})`);\n\t\t\t\t\t}\n\t\t\t\t\trole.alignment = currentSearch;\n\n\t\t\t\t\troleWords.splice(0, currentWord.length);\n\t\t\t\t\tcontinue outer;\n\t\t\t\t}\n\n\t\t\t\t// we didnt find something, take the last word off our current search and continue\n\t\t\t\tcurrentWord.pop();\n\t\t\t}\n\t\t\t// no matches, take the first word off and continue\n\t\t\troleWords.shift();\n\t\t}\n\n\t\trole.alignment = role.alignment || modAlignment;\n\t\tif (!role.alignment) {\n\t\t\t// Default to town\n\t\t\trole.alignment = 'town';\n\t\t}\n\t\tif (problems.length) {\n\t\t\t// multiple possible alignment, default to solo\n\t\t\trole.alignment = 'solo';\n\t\t\trole.memo.push(`Your role has multiple conflicting alignments, ask the host for details.`);\n\t\t} else {\n\t\t\tconst alignment = MafiaData.alignments[role.alignment];\n\t\t\tif (alignment) {\n\t\t\t\trole.memo.push(...MafiaData.alignments[role.alignment].memo);\n\t\t\t\tif (alignment.image && !role.image) role.image = alignment.image;\n\t\t\t} else {\n\t\t\t\tproblems.push(`Alignment desync: role ${role.name}'s alignment ${role.alignment} doesn't exist in data. Please report this to a mod.`);\n\t\t\t}\n\t\t}\n\n\t\treturn { role, problems };\n\t}\n\n\tstart(user: User, day = false) {\n\t\tif (!user) return;\n\t\tif (this.phase !== 'locked' && this.phase !== 'IDEAlocked') {\n\t\t\tif (this.phase === 'signups') return this.sendUser(user, `You need to close the signups first.`);\n\t\t\tif (this.phase === 'IDEApicking') {\n\t\t\t\treturn this.sendUser(user, `You must wait for IDEA picks to finish before starting.`);\n\t\t\t}\n\t\t\treturn this.sendUser(user, `The game is already started!`);\n\t\t}\n\t\tif (this.playerCount < 2) return this.sendUser(user, `You need at least 2 players to start.`);\n\t\tif (this.phase === 'IDEAlocked') {\n\t\t\tfor (const p of this.players) {\n\t\t\t\tif (!p.role) return this.sendUser(user, `|error|Not all players have a role.`);\n\t\t\t}\n\t\t} else {\n\t\t\tif (!Object.keys(this.roles).length) return this.sendUser(user, `You need to set the roles before starting.`);\n\t\t\tif (Object.keys(this.roles).length < this.playerCount) {\n\t\t\t\treturn this.sendUser(user, `You have not provided enough roles for the players.`);\n\t\t\t}\n\t\t}\n\t\tthis.started = true;\n\t\tthis.sendDeclare(`The game of ${this.title} is starting!`);\n\t\t// Mafia#played gets set in distributeRoles\n\t\tthis.distributeRoles();\n\t\tif (day) {\n\t\t\tthis.day(null, true);\n\t\t} else {\n\t\t\tthis.night(false, true);\n\t\t}\n\t\tif (this.IDEA.data && !this.IDEA.discardsHidden) {\n\t\t\tthis.room.add(`|html|
IDEA discards:${this.IDEA.discardsHTML}
`).update();\n\t\t}\n\t}\n\n\tdistributeRoles() {\n\t\tconst roles = Utils.shuffle(this.roles.slice());\n\t\tif (roles.length) {\n\t\t\tfor (const p of this.players) {\n\t\t\t\tconst role = roles.shift()!;\n\t\t\t\tp.role = role;\n\t\t\t\tconst u = Users.get(p.id);\n\t\t\t\tp.revealed = '';\n\t\t\t\tif (u?.connected) {\n\t\t\t\t\tu.send(`>${this.room.roomid}\\n|notify|Your role is ${role.safeName}. For more details of your role, check your Role PM.`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.clearEliminations();\n\t\tthis.played = [this.hostid, ...this.cohostids, ...(this.players.map(p => p.id))];\n\t\tthis.sendDeclare(`The roles have been distributed.`);\n\t\tthis.updatePlayers();\n\t}\n\n\tgetPartners(alignment: string, player: MafiaPlayer) {\n\t\tif (!player?.role || ['town', 'solo', 'traitor'].includes(player.role.alignment)) return \"\";\n\t\tconst partners = [];\n\t\tfor (const p of this.players) {\n\t\t\tif (p.id === player.id) continue;\n\t\t\tconst role = p.role;\n\t\t\tif (role && role.alignment === player.role.alignment) partners.push(p.name);\n\t\t}\n\t\treturn partners.join(\", \");\n\t}\n\n\tday(extension: number | null = null, initial = false) {\n\t\tif (this.phase !== 'night' && !initial) return;\n\t\tif (this.dayNum === 0 && extension !== null) return this.sendUser(this.hostid, `|error|You cannot extend on day 0.`);\n\t\tif (this.timer) this.setDeadline(0);\n\t\tif (extension === null) {\n\t\t\tif (!isNaN(this.hammerCount)) this.hammerCount = Math.floor(this.getRemainingPlayers().length / 2) + 1;\n\t\t\tthis.clearVotes();\n\t\t}\n\t\tthis.phase = 'day';\n\t\tif (extension !== null && !initial) {\n\t\t\t// Day stays same\n\t\t\tthis.setDeadline(extension);\n\t\t} else {\n\t\t\tthis.dayNum++;\n\t\t}\n\t\tif (isNaN(this.hammerCount)) {\n\t\t\tthis.sendDeclare(`Day ${this.dayNum}. Hammering is disabled.`);\n\t\t} else {\n\t\t\tthis.sendDeclare(`Day ${this.dayNum}. The hammer count is set at ${this.hammerCount}`);\n\t\t}\n\t\tfor (const p of this.players) {\n\t\t\tp.action = null;\n\t\t}\n\t\tthis.sendPlayerList();\n\t\tthis.updatePlayers();\n\t}\n\n\tnight(early = false, initial = false) {\n\t\tif (this.phase !== 'day' && !initial) return;\n\t\tif (this.timer) this.setDeadline(0, true);\n\t\tthis.phase = 'night';\n\t\tfor (const hostid of [...this.cohostids, this.hostid]) {\n\t\t\tconst host = Users.get(hostid);\n\t\t\tif (host?.connected) host.send(`>${this.room.roomid}\\n|notify|It's night in your game of Mafia!`);\n\t\t}\n\n\t\tfor (const player of this.players) {\n\t\t\tconst user = Users.get(player.id);\n\t\t\tif (user?.connected) {\n\t\t\t\tthis.sendUser(user, `|notify|It's night in the game of Mafia! Send in an action or idle.`);\n\t\t\t}\n\t\t}\n\n\t\tif (this.takeIdles) {\n\t\t\tthis.sendDeclare(`Night ${this.dayNum}. Submit whether you are using an action or idle. If you are using an action, DM your action to the host.`);\n\t\t} else {\n\t\t\tthis.sendDeclare(`Night ${this.dayNum}. PM the host your action, or idle.`);\n\t\t}\n\n\t\tconst hasPlurality = this.getPlurality();\n\n\t\tif (!early && hasPlurality) {\n\t\t\tthis.sendRoom(`Plurality is on ${this.getPlayer(hasPlurality)?.name || 'No Vote'}`);\n\t\t}\n\t\tif (!early && !initial) this.sendRoom(`|raw|
${this.voteBox()}
`);\n\t\tif (initial && !isNaN(this.hammerCount)) this.hammerCount = Math.floor(this.getRemainingPlayers().length / 2) + 1;\n\t\tthis.updatePlayers();\n\t}\n\n\tvote(voter: MafiaPlayer, targetId: ID) {\n\t\tif (!this.votingEnabled) return this.sendUser(voter, `|error|Voting is not allowed.`);\n\t\tif (this.phase !== 'day') return this.sendUser(voter, `|error|You can only vote during the day.`);\n\t\tif (!voter || (voter.isEliminated() && !voter.isSpirit())) return;\n\n\t\tconst target = this.getPlayer(targetId);\n\t\tif ((!target || target.isEliminated()) && targetId !== 'novote') {\n\t\t\treturn this.sendUser(voter, `|error|${targetId} is not a valid player.`);\n\t\t}\n\n\t\tif (!this.enableNV && targetId === 'novote') return this.sendUser(voter, `|error|No Vote is not allowed.`);\n\t\tif (targetId === voter.id && !this.selfEnabled) return this.sendUser(voter, `|error|Self voting is not allowed.`);\n\n\t\tif (this.voteLock && voter.voting) {\n\t\t\treturn this.sendUser(voter, `|error|You cannot switch your vote because votes are locked.`);\n\t\t}\n\n\t\tconst currentVotes = this.votes[targetId] ? this.votes[targetId].count : 0;\n\t\t// 1 is added to the existing count to represent the vote we are processing now\n\t\tconst hammering = currentVotes + 1 >= this.hammerCount;\n\t\tif (targetId === voter.id && !hammering && this.selfEnabled === 'hammer') {\n\t\t\treturn this.sendUser(voter, `|error|You may only vote yourself when placing the hammer vote.`);\n\t\t}\n\n\t\tif (voter.hammerRestriction !== null) {\n\t\t\tif (voter.hammerRestriction && !hammering) {\n\t\t\t\treturn this.sendUser(voter, `|error|You can only vote when placing the hammer vote.`);\n\t\t\t} else if (!voter.hammerRestriction && hammering) {\n\t\t\t\treturn this.sendUser(voter, `|error|You cannot place the hammer vote.`);\n\t\t\t}\n\t\t}\n\n\t\tif (voter.lastVote + 2000 >= Date.now()) {\n\t\t\treturn this.sendUser(\n\t\t\t\tvoter,\n\t\t\t\t`|error|You must wait another ${Chat.toDurationString((voter.lastVote + 2000) - Date.now()) || '1 second'} before you can change your vote.`\n\t\t\t);\n\t\t}\n\n\t\t// -- VALID --\n\n\t\tconst previousVote = voter.voting;\n\t\tif (previousVote) this.unvote(voter, true);\n\t\tlet vote = this.votes[targetId];\n\t\tif (!vote) {\n\t\t\tthis.votes[targetId] = {\n\t\t\t\tcount: 1, trueCount: this.getVoteValue(voter), lastVote: Date.now(), dir: 'up', voters: [voter.id],\n\t\t\t};\n\t\t\tvote = this.votes[targetId];\n\t\t} else {\n\t\t\tvote.count++;\n\t\t\tvote.trueCount += this.getVoteValue(voter);\n\t\t\tvote.lastVote = Date.now();\n\t\t\tvote.dir = 'up';\n\t\t\tvote.voters.push(voter.id);\n\t\t}\n\t\tvoter.voting = targetId;\n\t\tvoter.lastVote = Date.now();\n\n\t\tconst name = voter.voting === 'novote' ? 'No Vote' : target?.name;\n\t\tif (previousVote) {\n\t\t\tthis.sendTimestamp(`${voter.name} has shifted their vote from ${previousVote === 'novote' ? 'No Vote' : this.getPlayer(previousVote)?.name} to ${name}`);\n\t\t} else {\n\t\t\tthis.sendTimestamp(\n\t\t\t\tname === 'No Vote' ?\n\t\t\t\t\t`${voter.name} has abstained from voting.` :\n\t\t\t\t\t`${voter.name} has voted ${name}.`\n\t\t\t);\n\t\t}\n\n\t\tthis.hasPlurality = null;\n\t\tif (this.getHammerValue(targetId) <= vote.trueCount) {\n\t\t\t// HAMMER\n\t\t\tthis.sendDeclare(`Hammer! ${targetId === 'novote' ? 'Nobody' : Utils.escapeHTML(name!)} was voted out!`);\n\t\t\tthis.sendRoom(`|raw|
${this.voteBox()}
`);\n\t\t\tif (targetId !== 'novote') this.eliminate(target!, MafiaEliminateType.ELIMINATE);\n\t\t\tthis.night(true);\n\t\t\treturn;\n\t\t}\n\t\tthis.updatePlayersVotes();\n\t}\n\n\tunvote(voter: MafiaPlayer, force = false) {\n\t\t// Force skips (most) validation\n\t\tif (!force) {\n\t\t\tif (this.phase !== 'day') return this.sendUser(voter, `|error|You can only vote during the day.`);\n\n\t\t\tif (voter.isEliminated() && !voter.isSpirit()) {\n\t\t\t\treturn; // can't vote\n\t\t\t}\n\n\t\t\t// autoselfvote blocking doesn't apply to restless spirits\n\t\t\tif (!voter.isEliminated() && this.forceVote) {\n\t\t\t\treturn this.sendUser(voter, `|error|You can only shift your vote, not unvote.`);\n\t\t\t}\n\n\t\t\tif (this.voteLock && voter.voting) {\n\t\t\t\treturn this.sendUser(voter, `|error|You cannot unvote because votes are locked.`);\n\t\t\t}\n\n\t\t\tif (voter.lastVote + 2000 >= Date.now()) {\n\t\t\t\treturn this.sendUser(\n\t\t\t\t\tvoter,\n\t\t\t\t\t`|error|You must wait another ${Chat.toDurationString((voter.lastVote + 2000) - Date.now()) || '1 second'} before you can change your vote.`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (!voter.voting) return this.sendUser(voter, `|error|You are not voting for anyone.`);\n\n\t\tconst vote = this.votes[voter.voting];\n\t\tvote.count--;\n\t\tvote.trueCount -= this.getVoteValue(voter);\n\t\tif (vote.count <= 0) {\n\t\t\tdelete this.votes[voter.voting];\n\t\t} else {\n\t\t\tvote.lastVote = Date.now();\n\t\t\tvote.dir = 'down';\n\t\t\tvote.voters.splice(vote.voters.indexOf(voter.id), 1);\n\t\t}\n\n\t\tconst target = this.getPlayer(voter.voting);\n\t\tif (!target && voter.voting !== 'novote') {\n\t\t\tthrow new Error(`Unable to find target when unvoting. Voter: ${voter.id}, Target: ${voter.voting}`);\n\t\t}\n\n\t\tif (!force) {\n\t\t\tthis.sendTimestamp(\n\t\t\t\tvoter.voting === 'novote' ?\n\t\t\t\t\t`${voter.name} is no longer abstaining from voting.` :\n\t\t\t\t\t`${voter.name} has unvoted ${target?.name}.`\n\t\t\t);\n\t\t}\n\t\tvoter.voting = '';\n\t\tvoter.lastVote = Date.now();\n\t\tthis.hasPlurality = null;\n\t\tthis.updatePlayersVotes();\n\t}\n\n\t/**\n\t * Returns HTML code that contains information about the current vote.\n\t */\n\tvoteBox() {\n\t\tif (!this.started) return `The game has not started yet.`;\n\t\tlet buf = `Votes (Hammer: ${this.hammerCount || \"Disabled\"})
`;\n\t\tconst plur = this.getPlurality();\n\t\tconst list = Utils.sortBy(Object.entries(this.votes), ([key, vote]) => [\n\t\t\tkey === plur,\n\t\t\t-vote.count,\n\t\t]);\n\t\tfor (const [key, vote] of list) {\n\t\t\tconst player = this.getPlayer(toID(key));\n\t\t\tbuf += `${vote.count}${plur === key ? '*' : ''} ${player?.safeName || 'No Vote'} (${vote.voters.map(a => this.getPlayer(a)?.safeName || a).join(', ')})
`;\n\t\t}\n\t\treturn buf;\n\t}\n\n\tvoteBoxFor(userid: ID) {\n\t\tlet buf = '';\n\t\tbuf += `

Votes (Hammer: ${this.hammerCount || 'Disabled'})

`;\n\t\tconst plur = this.getPlurality();\n\t\tconst self = this.getPlayer(userid);\n\n\t\tfor (const key of this.getRemainingPlayers().map(p => p.id).concat((this.enableNV ? ['novote' as ID] : []))) {\n\t\t\tconst votes = this.votes[key];\n\t\t\tconst player = this.getPlayer(key);\n\t\t\tbuf += `

${votes?.count || 0}${plur === key ? '*' : ''} `;\n\t\t\tif (player) {\n\t\t\t\tbuf += `${player.safeName} ${player.revealed ? `[${player.revealed}]` : ''} `;\n\t\t\t} else {\n\t\t\t\tbuf += `No Vote `;\n\t\t\t}\n\n\t\t\tif (votes) {\n\t\t\t\tbuf += `(${votes.voters.map(v => this.getPlayer(v)?.safeName || v).join(', ')}) `;\n\t\t\t}\n\n\t\t\tif (userid === this.hostid || this.cohostids.includes(userid)) {\n\t\t\t\tif (votes && votes.count !== votes.trueCount) buf += `(${votes.trueCount})`;\n\t\t\t\tif (this.hammerModifiers[key]) buf += `(${this.getHammerValue(key)} to hammer)`;\n\t\t\t} else if (self && this.votingEnabled && (!this.voteLock || !self.voting) &&\n\t\t\t\t(!self.isEliminated() || self.isSpirit())) {\n\t\t\t\tlet cmd = '';\n\t\t\t\tif (self.voting === key) {\n\t\t\t\t\tcmd = 'unvote';\n\t\t\t\t} else if (self.id !== key || (this.selfEnabled && !self.isSpirit())) {\n\t\t\t\t\tcmd = `vote ${key}`;\n\t\t\t\t}\n\n\t\t\t\tif (cmd) {\n\t\t\t\t\tbuf += ``;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf += `

`;\n\t\t}\n\t\treturn buf;\n\t}\n\n\tapplyVoteModifier(requester: User, targetPlayer: MafiaPlayer, mod: number) {\n\t\tif (!targetPlayer) return this.sendUser(requester, `|error|${targetPlayer} is not in the game of mafia.`);\n\t\tconst oldMod = this.voteModifiers[targetPlayer.id];\n\t\tif (mod === oldMod || ((isNaN(mod) || mod === 1) && oldMod === undefined)) {\n\t\t\tif (isNaN(mod) || mod === 1) return this.sendUser(requester, `|error|${targetPlayer} already has no vote modifier.`);\n\t\t\treturn this.sendUser(requester, `|error|${targetPlayer} already has a vote modifier of ${mod}`);\n\t\t}\n\t\tconst newMod = isNaN(mod) ? 1 : mod;\n\t\tif (targetPlayer.voting) {\n\t\t\tthis.votes[targetPlayer.voting].trueCount += oldMod - newMod;\n\t\t\tif (this.getHammerValue(targetPlayer.voting) <= this.votes[targetPlayer.voting].trueCount) {\n\t\t\t\tthis.sendRoom(`${targetPlayer.voting} has been voted out due to a modifier change! They have not been eliminated.`);\n\t\t\t\tthis.night(true);\n\t\t\t}\n\t\t}\n\t\tif (newMod === 1) {\n\t\t\tdelete this.voteModifiers[targetPlayer.id];\n\t\t\treturn this.sendUser(requester, `${targetPlayer.name} has had their vote modifier removed.`);\n\t\t} else {\n\t\t\tthis.voteModifiers[targetPlayer.id] = newMod;\n\t\t\treturn this.sendUser(requester, `${targetPlayer.name} has been given a vote modifier of ${newMod}`);\n\t\t}\n\t}\n\n\tapplyHammerModifier(user: User, target: MafiaPlayer, mod: number) {\n\t\tconst oldMod = this.hammerModifiers[target.id];\n\t\tif (mod === oldMod || ((isNaN(mod) || mod === 0) && oldMod === undefined)) {\n\t\t\tif (isNaN(mod) || mod === 0) return this.sendUser(user, `|error|${target} already has no hammer modifier.`);\n\t\t\treturn this.sendUser(user, `|error|${target} already has a hammer modifier of ${mod}`);\n\t\t}\n\t\tconst newMod = isNaN(mod) ? 0 : mod;\n\t\tif (this.votes[target.id]) {\n\t\t\t// do this manually since we havent actually changed the value yet\n\t\t\tif (this.hammerCount + newMod <= this.votes[target.id].trueCount) {\n\t\t\t\t// make sure these strings are the same\n\t\t\t\tthis.sendRoom(`${target} has been voted due to a modifier change! They have not been eliminated.`);\n\t\t\t\tthis.night(true);\n\t\t\t}\n\t\t}\n\t\tif (newMod === 0) {\n\t\t\tdelete this.hammerModifiers[target.id];\n\t\t\treturn this.sendUser(user, `${target} has had their hammer modifier removed.`);\n\t\t} else {\n\t\t\tthis.hammerModifiers[target.id] = newMod;\n\t\t\treturn this.sendUser(user, `${target} has been given a hammer modifier of ${newMod}`);\n\t\t}\n\t}\n\n\tclearVoteModifiers(user: User) {\n\t\tfor (const player of this.players) {\n\t\t\tif (this.voteModifiers[player.id]) this.applyVoteModifier(user, player, 1);\n\t\t}\n\t}\n\n\tclearHammerModifiers(user: User) {\n\t\tfor (const player of this.players) {\n\t\t\tif (this.hammerModifiers[player.id]) this.applyHammerModifier(user, player, 0);\n\t\t}\n\t}\n\n\tgetVoteValue(player: MafiaPlayer) {\n\t\tconst mod = this.voteModifiers[player.id];\n\t\treturn (mod === undefined ? 1 : mod);\n\t}\n\n\tgetHammerValue(player: ID) {\n\t\tconst mod = this.hammerModifiers[player];\n\t\treturn (mod === undefined ? this.hammerCount : this.hammerCount + mod);\n\t}\n\n\tresetHammer() {\n\t\tthis.setHammer(Math.floor(this.players.length / 2) + 1);\n\t}\n\n\tsetHammer(count: number) {\n\t\tthis.hammerCount = count;\n\t\tif (isNaN(count)) {\n\t\t\tthis.sendDeclare(`Hammering has been disabled, and votes have been reset.`);\n\t\t} else {\n\t\t\tthis.sendDeclare(`The hammer count has been set at ${this.hammerCount}, and votes have been reset.`);\n\t\t}\n\t\tthis.clearVotes();\n\t}\n\n\tshiftHammer(count: number) {\n\t\tthis.hammerCount = count;\n\t\tif (isNaN(count)) {\n\t\t\tthis.sendDeclare(`Hammering has been disabled. Votes have not been reset.`);\n\t\t} else {\n\t\t\tthis.sendDeclare(`The hammer count has been shifted to ${this.hammerCount}. Votes have not been reset.`);\n\t\t}\n\t\tconst hammered = [];\n\t\tfor (const vote in this.votes) {\n\t\t\tif (this.votes[vote].trueCount >= this.getHammerValue(vote as ID)) {\n\t\t\t\thammered.push(vote === 'novote' ? 'Nobody' : vote);\n\t\t\t}\n\t\t}\n\t\tif (hammered.length) {\n\t\t\tthis.sendDeclare(`${Chat.count(hammered, \"players have\")} been hammered: ${hammered.join(', ')}. They have not been removed from the game.`);\n\t\t\tthis.night(true);\n\t\t}\n\t}\n\n\tgetPlurality() {\n\t\tif (this.hasPlurality) return this.hasPlurality;\n\t\tif (!Object.keys(this.votes).length) return null;\n\t\tlet max = 0;\n\t\tlet topVotes: [ID, MafiaVote][] = [];\n\t\tfor (const [key, vote] of Object.entries(this.votes)) {\n\t\t\tif (vote.count > max) {\n\t\t\t\tmax = vote.count;\n\t\t\t\ttopVotes = [[key as ID, vote]];\n\t\t\t} else if (vote.count === max) {\n\t\t\t\ttopVotes.push([key as ID, vote]);\n\t\t\t}\n\t\t}\n\t\tif (topVotes.length <= 1) {\n\t\t\t[this.hasPlurality] = topVotes[0];\n\t\t\treturn this.hasPlurality;\n\t\t}\n\t\ttopVotes = Utils.sortBy(topVotes, ([key, vote]) => [\n\t\t\tvote.dir === 'down',\n\t\t\tvote.dir === 'up' ? vote.lastVote : -vote.lastVote,\n\t\t]);\n\t\t[this.hasPlurality] = topVotes[0];\n\t\treturn this.hasPlurality;\n\t}\n\n\toverride removePlayer(player: MafiaPlayer) {\n\t\tplayer.closeHtmlRoom();\n\t\tconst result = super.removePlayer(player);\n\t\treturn result;\n\t}\n\n\teliminate(toEliminate: MafiaPlayer, ability: MafiaEliminateType) {\n\t\tif (!this.started) {\n\t\t\t// Game has not started, simply kick the player\n\t\t\tthis.sendDeclare(`${toEliminate.safeName} was kicked from the game!`);\n\t\t\tif (this.hostRequestedSub.includes(toEliminate.id)) {\n\t\t\t\tthis.hostRequestedSub.splice(this.hostRequestedSub.indexOf(toEliminate.id), 1);\n\t\t\t}\n\t\t\tif (this.requestedSub.includes(toEliminate.id)) {\n\t\t\t\tthis.requestedSub.splice(this.requestedSub.indexOf(toEliminate.id), 1);\n\t\t\t}\n\t\t\tthis.removePlayer(toEliminate);\n\t\t\treturn;\n\t\t}\n\n\t\ttoEliminate.eliminationOrder = this.getEliminatedPlayers() // Before eliminating, get other eliminated players\n\t\t\t.map(p => p.eliminationOrder) // convert to an array of elimination order numbers\n\t\t\t.reduce((a, b) => Math.max(a, b), 0) + 1; // get the largest of the existing elim order numbers and add 1\n\t\ttoEliminate.eliminated = ability;\n\n\t\tif (toEliminate.voting) this.unvote(toEliminate, true);\n\t\tthis.sendDeclare(`${toEliminate.safeName} ${ability}! ${!this.noReveal && ability === MafiaEliminateType.ELIMINATE ? `${toEliminate.safeName}'s role was ${toEliminate.getStylizedRole()}.` : ''}`);\n\t\tif (toEliminate.role && !this.noReveal && ability === MafiaEliminateType.ELIMINATE) {\n\t\t\ttoEliminate.revealed = toEliminate.getStylizedRole()!;\n\t\t}\n\n\t\tconst targetRole = toEliminate.role;\n\t\tif (targetRole) {\n\t\t\tfor (const [roleIndex, role] of this.roles.entries()) {\n\t\t\t\tif (role.id === targetRole.id) {\n\t\t\t\t\tthis.roles.splice(roleIndex, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.clearVotes(toEliminate.id);\n\t\tlet subIndex = this.requestedSub.indexOf(toEliminate.id);\n\t\tif (subIndex !== -1) this.requestedSub.splice(subIndex, 1);\n\t\tsubIndex = this.hostRequestedSub.indexOf(toEliminate.id);\n\t\tif (subIndex !== -1) this.hostRequestedSub.splice(subIndex, 1);\n\n\t\tthis.updateRoleString();\n\t\tif (ability === MafiaEliminateType.KICK) {\n\t\t\ttoEliminate.closeHtmlRoom();\n\t\t\tthis.removePlayer(toEliminate);\n\t\t}\n\t\tthis.updatePlayers();\n\t}\n\n\trevealRole(user: User, toReveal: MafiaPlayer, revealAs: string) {\n\t\tif (!this.started) {\n\t\t\treturn this.sendUser(user, `|error|You may only reveal roles once the game has started.`);\n\t\t}\n\t\tif (!toReveal.role) {\n\t\t\treturn this.sendUser(user, `|error|The user ${toReveal.id} is not assigned a role.`);\n\t\t}\n\t\ttoReveal.revealed = revealAs;\n\t\tthis.sendDeclare(`${toReveal.safeName}'s role ${toReveal.isEliminated() ? `was` : `is`} ${revealAs}.`);\n\t\tthis.updatePlayers();\n\t}\n\n\trevive(user: User, toRevive: MafiaPlayer) {\n\t\tif (this.phase === 'IDEApicking') {\n\t\t\treturn this.sendUser(user, `|error|You cannot add or remove players while IDEA roles are being picked.`);\n\t\t}\n\t\tif (!toRevive.isEliminated()) {\n\t\t\tthis.sendUser(user, `|error|The user ${toRevive} is already a living player.`);\n\t\t\treturn;\n\t\t}\n\n\t\ttoRevive.eliminated = null;\n\t\tthis.sendDeclare(`${toRevive.safeName} was revived!`);\n\t\tconst targetRole = toRevive.role;\n\t\tif (targetRole) {\n\t\t\tthis.roles.push(targetRole);\n\t\t} else {\n\t\t\t// Should never happen\n\t\t\ttoRevive.role = {\n\t\t\t\tname: `Unknown`,\n\t\t\t\tsafeName: `Unknown`,\n\t\t\t\tid: `unknown`,\n\t\t\t\talignment: 'solo',\n\t\t\t\timage: '',\n\t\t\t\tmemo: [\n\t\t\t\t\t`You were revived, but had no role. Please let a Mafia Room Owner know this happened. To learn about your role, PM the host (${this.host}).`,\n\t\t\t\t],\n\t\t\t};\n\t\t\tthis.roles.push(toRevive.role);\n\t\t}\n\t\tUtils.sortBy(this.roles, r => [r.alignment, r.name]);\n\n\t\tthis.updateRoleString();\n\t\tthis.updatePlayers();\n\t\treturn true;\n\t}\n\n\tgetRemainingPlayers() {\n\t\treturn this.players.filter(player => !player.isEliminated());\n\t}\n\n\tgetEliminatedPlayers() {\n\t\treturn this.players.filter(player => player.isEliminated()).sort((a, b) => a.eliminationOrder - b.eliminationOrder);\n\t}\n\n\tsetDeadline(minutes: number, silent = false) {\n\t\tif (isNaN(minutes)) return;\n\t\tif (!minutes) {\n\t\t\tif (!this.timer) return;\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = null;\n\t\t\tthis.dlAt = 0;\n\t\t\tif (!silent) this.sendTimestamp(`**The deadline has been cleared.**`);\n\t\t\treturn;\n\t\t}\n\t\tif (minutes < 1 || minutes > 20) return;\n\t\tif (this.timer) clearTimeout(this.timer);\n\t\tthis.dlAt = Date.now() + (minutes * 60000);\n\t\tif (minutes > 3) {\n\t\t\tthis.timer = setTimeout(() => {\n\t\t\t\tthis.sendTimestamp(`**3 minutes left!**`);\n\t\t\t\tthis.timer = setTimeout(() => {\n\t\t\t\t\tthis.sendTimestamp(`**1 minute left!**`);\n\t\t\t\t\tthis.timer = setTimeout(() => {\n\t\t\t\t\t\tthis.sendTimestamp(`**Time is up!**`);\n\t\t\t\t\t\tthis.night();\n\t\t\t\t\t}, 60000);\n\t\t\t\t}, 2 * 60000);\n\t\t\t}, (minutes - 3) * 60000);\n\t\t} else if (minutes > 1) {\n\t\t\tthis.timer = setTimeout(() => {\n\t\t\t\tthis.sendTimestamp(`**1 minute left!**`);\n\t\t\t\tthis.timer = setTimeout(() => {\n\t\t\t\t\tthis.sendTimestamp(`**Time is up!**`);\n\t\t\t\t\tif (this.phase === 'day') this.night();\n\t\t\t\t}, 60000);\n\t\t\t}, (minutes - 1) * 60000);\n\t\t} else {\n\t\t\tthis.timer = setTimeout(() => {\n\t\t\t\tthis.sendTimestamp(`**Time is up!**`);\n\t\t\t\tif (this.phase === 'day') this.night();\n\t\t\t}, minutes * 60000);\n\t\t}\n\t\tthis.sendTimestamp(`**The deadline has been set for ${minutes} minute${minutes === 1 ? '' : 's'}.**`);\n\t}\n\n\tsub(player: MafiaPlayer, newUser: User) {\n\t\tconst oldPlayerId = player.id;\n\t\tconst oldSafeName = player.safeName;\n\t\tthis.setPlayerUser(player, newUser);\n\t\tplayer.updateSafeName();\n\n\t\tif (player.voting) {\n\t\t\t// Dont change plurality\n\t\t\tconst vote = this.votes[player.voting];\n\t\t\tvote.voters.splice(vote.voters.indexOf(oldPlayerId), 1);\n\t\t\tvote.voters.push(player.id);\n\t\t}\n\t\t// Transfer votes on the old player to the new one\n\t\tif (this.votes[oldPlayerId]) {\n\t\t\tthis.votes[player.id] = this.votes[oldPlayerId];\n\t\t\tdelete this.votes[oldPlayerId];\n\n\t\t\tfor (const p of this.players) {\n\t\t\t\tif (p.voting === oldPlayerId) {\n\t\t\t\t\tp.voting = player.id;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (this.hasPlurality === oldPlayerId) this.hasPlurality = player.id;\n\n\t\tif (newUser?.connected) {\n\t\t\tfor (const conn of newUser.connections) {\n\t\t\t\tvoid Chat.resolvePage(`view-mafia-${this.room.roomid}`, newUser, conn);\n\t\t\t}\n\t\t\tnewUser.send(`>${this.room.roomid}\\n|notify|You have been substituted in the mafia game for ${oldSafeName}.`);\n\t\t}\n\t\tif (this.started) this.played.push(player.id);\n\t\tthis.sendDeclare(`${oldSafeName} has been subbed out. ${player.safeName} has joined the game.`);\n\t\tthis.updatePlayers();\n\n\t\tif (this.room.roomid === 'mafia' && this.started) {\n\t\t\tconst month = new Date().toLocaleString(\"en-us\", { month: \"numeric\", year: \"numeric\" });\n\t\t\tif (!logs.leavers[month]) logs.leavers[month] = {};\n\t\t\tif (!logs.leavers[month][player.id]) logs.leavers[month][player.id] = 0;\n\t\t\tlogs.leavers[month][player.id]++;\n\t\t\twriteFile(LOGS_FILE, logs);\n\t\t}\n\t}\n\n\tnextSub(userid: ID | null = null) {\n\t\tif (!this.subs.length ||\n\t\t\t(!this.hostRequestedSub.length && ((!this.requestedSub.length || !this.autoSub)) && !userid)) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextSub = this.subs.shift();\n\t\tif (!nextSub) return;\n\t\tconst sub = Users.get(nextSub, true);\n\t\tif (!sub?.connected || !sub.named || !this.room.users[sub.id]) return; // should never happen, just to be safe\n\t\tconst toSubOut = this.getPlayer(userid || this.hostRequestedSub.shift() || this.requestedSub.shift() || '');\n\t\tif (!toSubOut) {\n\t\t\t// Should never happen\n\t\t\tthis.subs.unshift(nextSub);\n\t\t\treturn;\n\t\t}\n\t\tif (this.hostRequestedSub.includes(toSubOut.id)) {\n\t\t\tthis.hostRequestedSub.splice(this.hostRequestedSub.indexOf(toSubOut.id), 1);\n\t\t}\n\t\tif (this.requestedSub.includes(toSubOut.id)) {\n\t\t\tthis.requestedSub.splice(this.requestedSub.indexOf(toSubOut.id), 1);\n\t\t}\n\t\tthis.sub(toSubOut, sub);\n\t}\n\n\tcustomIdeaInit(user: User, choices: number, picks: string[], rolesString: string) {\n\t\tthis.originalRoles = [];\n\t\tthis.originalRoleString = '';\n\t\tthis.roles = [];\n\t\tthis.roleString = '';\n\n\t\tconst roles = Utils.stripHTML(rolesString);\n\t\tlet roleList = roles.split('\\n');\n\t\tif (roleList.length === 1) {\n\t\t\troleList = roles.split(',').map(r => r.trim());\n\t\t}\n\n\t\tthis.IDEA.data = {\n\t\t\tname: `${this.host}'s custom IDEA`, // already escaped\n\t\t\tuntrusted: true,\n\t\t\troles: roleList,\n\t\t\tpicks,\n\t\t\tchoices,\n\t\t};\n\t\treturn this.ideaDistributeRoles(user);\n\t}\n\tideaInit(user: User, moduleID: ID) {\n\t\tthis.originalRoles = [];\n\t\tthis.originalRoleString = '';\n\t\tthis.roles = [];\n\t\tthis.roleString = '';\n\n\t\tif (moduleID in MafiaData.aliases) moduleID = MafiaData.aliases[moduleID];\n\t\tthis.IDEA.data = MafiaData.IDEAs[moduleID];\n\t\tif (!this.IDEA.data) return this.sendUser(user, `|error|${moduleID} is not a valid IDEA.`);\n\t\treturn this.ideaDistributeRoles(user);\n\t}\n\n\tideaDistributeRoles(user: User) {\n\t\tif (!this.IDEA.data) return this.sendUser(user, `|error|No IDEA module loaded`);\n\t\tif (this.phase !== 'locked' && this.phase !== 'IDEAlocked') {\n\t\t\treturn this.sendUser(user, `|error|The game must be in a locked state to distribute IDEA roles.`);\n\t\t}\n\n\t\tconst neededRoles = this.IDEA.data.choices * this.playerCount;\n\t\tif (neededRoles > this.IDEA.data.roles.length) {\n\t\t\treturn this.sendUser(user, `|error|Not enough roles in the IDEA module.`);\n\t\t}\n\n\t\tconst roles = [];\n\t\tconst selectedIndexes: number[] = [];\n\t\tfor (let i = 0; i < neededRoles; i++) {\n\t\t\tlet randomIndex;\n\t\t\tdo {\n\t\t\t\trandomIndex = Math.floor(Math.random() * this.IDEA.data.roles.length);\n\t\t\t} while (selectedIndexes.includes(randomIndex));\n\t\t\troles.push(this.IDEA.data.roles[randomIndex]);\n\t\t\tselectedIndexes.push(randomIndex);\n\t\t}\n\t\tUtils.shuffle(roles);\n\t\tthis.IDEA.waitingPick = [];\n\t\tfor (const player of this.players) {\n\t\t\tplayer.role = null;\n\t\t\tplayer.IDEA = {\n\t\t\t\tchoices: roles.splice(0, this.IDEA.data.choices),\n\t\t\t\toriginalChoices: [], // MAKE SURE TO SET THIS\n\t\t\t\tpicks: {},\n\t\t\t};\n\t\t\tplayer.IDEA.originalChoices = player.IDEA.choices.slice();\n\t\t\tfor (const pick of this.IDEA.data.picks) {\n\t\t\t\tplayer.IDEA.picks[pick] = null;\n\t\t\t\tthis.IDEA.waitingPick.push(player.id);\n\t\t\t}\n\t\t\tconst u = Users.get(player.id);\n\t\t\tif (u?.connected) u.send(`>${this.room.roomid}\\n|notify|Pick your role in the IDEA module.`);\n\t\t}\n\n\t\tthis.phase = 'IDEApicking';\n\t\tthis.updatePlayers();\n\n\t\tthis.sendDeclare(`${this.IDEA.data.name} roles have been distributed. You will have ${IDEA_TIMER / 1000} seconds to make your picks.`);\n\t\tthis.IDEA.timer = setTimeout(() => { this.ideaFinalizePicks(); }, IDEA_TIMER);\n\n\t\treturn ``;\n\t}\n\n\tideaPick(user: User, selection: string[]) {\n\t\tlet buf = '';\n\t\tif (this.phase !== 'IDEApicking') return 'The game is not in the IDEA picking phase.';\n\t\tif (!this.IDEA?.data) {\n\t\t\treturn this.sendRoom(`Trying to pick an IDEA role with no module running, target: ${JSON.stringify(selection)}. Please report this to a mod.`);\n\t\t}\n\n\t\tconst player = this.getPlayer(user.id);\n\t\tif (!player?.IDEA) {\n\t\t\treturn this.sendRoom(`Trying to pick an IDEA role with no player IDEA object, user: ${user.id}. Please report this to a mod.`);\n\t\t}\n\n\t\tselection = selection.map(toID);\n\t\tif (selection.length === 1 && this.IDEA.data.picks.length === 1) selection = [this.IDEA.data.picks[0], selection[0]];\n\t\tif (selection.length !== 2) return this.sendUser(user, `|error|Invalid selection.`);\n\n\t\t// input is formatted as ['selection', 'role']\n\t\t// eg: ['role', 'bloodhound']\n\t\t// ['alignment', 'alien']\n\t\t// ['selection', ''] deselects\n\t\tif (selection[1]) {\n\t\t\tconst roleIndex = player.IDEA.choices.map(toID).indexOf(selection[1] as ID);\n\t\t\tif (roleIndex === -1) {\n\t\t\t\treturn this.sendUser(user, `|error|${selection[1]} is not an available role, perhaps it is already selected?`);\n\t\t\t}\n\t\t\tselection[1] = player.IDEA.choices.splice(roleIndex, 1)[0];\n\t\t} else {\n\t\t\tselection[1] = '';\n\t\t}\n\t\tconst selected = player.IDEA.picks[selection[0]];\n\t\tif (selected) {\n\t\t\tbuf += `You have deselected ${selected}. `;\n\t\t\tplayer.IDEA.choices.push(selected);\n\t\t}\n\n\t\tif (player.IDEA.picks[selection[0]] && !selection[1]) {\n\t\t\tthis.IDEA.waitingPick.push(player.id);\n\t\t} else if (!player.IDEA.picks[selection[0]] && selection[1]) {\n\t\t\tthis.IDEA.waitingPick.splice(this.IDEA.waitingPick.indexOf(player.id), 1);\n\t\t}\n\n\t\tplayer.IDEA.picks[selection[0]] = selection[1];\n\t\tif (selection[1]) buf += `You have selected ${selection[0]}: ${selection[1]}.`;\n\t\tplayer.updateHtmlRoom();\n\t\tif (!this.IDEA.waitingPick.length) {\n\t\t\tif (this.IDEA.timer) clearTimeout(this.IDEA.timer);\n\t\t\tthis.ideaFinalizePicks();\n\t\t\treturn;\n\t\t}\n\t\treturn this.sendUser(user, buf);\n\t}\n\n\tideaFinalizePicks() {\n\t\tif (!this.IDEA?.data) {\n\t\t\treturn this.sendRoom(`Tried to finalize IDEA picks with no IDEA module running, please report this to a mod.`);\n\t\t}\n\t\tconst randed = [];\n\t\tfor (const player of this.players) {\n\t\t\tif (!player.IDEA) {\n\t\t\t\treturn this.sendRoom(`Trying to pick an IDEA role with no player IDEA object, user: ${player.id}. Please report this to a mod.`);\n\t\t\t}\n\t\t\tlet randPicked = false;\n\t\t\tconst role = [];\n\t\t\tfor (const choice of this.IDEA.data.picks) {\n\t\t\t\tif (!player.IDEA.picks[choice]) {\n\t\t\t\t\trandPicked = true;\n\t\t\t\t\tconst randomChoice = player.IDEA.choices.shift();\n\t\t\t\t\tif (randomChoice) {\n\t\t\t\t\t\tplayer.IDEA.picks[choice] = randomChoice;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new Error(`No roles left to randomly assign from IDEA module choices.`);\n\t\t\t\t\t}\n\t\t\t\t\tthis.sendUser(player.id, `You were randomly assigned ${choice}: ${randomChoice}`);\n\t\t\t\t}\n\t\t\t\trole.push(`${choice}: ${player.IDEA.picks[choice]}`);\n\t\t\t}\n\t\t\tif (randPicked) randed.push(player.id);\n\t\t\t// if there's only one option, it's their role, parse it properly\n\t\t\tlet roleName = '';\n\t\t\tif (this.IDEA.data.picks.length === 1) {\n\t\t\t\tconst pick = player.IDEA.picks[this.IDEA.data.picks[0]];\n\t\t\t\tif (!pick) throw new Error('Pick not found when parsing role selected in IDEA module.');\n\t\t\t\tconst parsedRole = Mafia.parseRole(pick);\n\t\t\t\tif (parsedRole.problems.length) {\n\t\t\t\t\tthis.sendRoom(`Problems found when parsing IDEA role ${player.IDEA.picks[this.IDEA.data.picks[0]]}. Please report this to a mod.`);\n\t\t\t\t}\n\t\t\t\tplayer.role = parsedRole.role;\n\t\t\t} else {\n\t\t\t\troleName = role.join('; ');\n\t\t\t\tplayer.role = {\n\t\t\t\t\tname: roleName,\n\t\t\t\t\tsafeName: Utils.escapeHTML(roleName),\n\t\t\t\t\tid: toID(roleName),\n\t\t\t\t\talignment: 'solo',\n\t\t\t\t\tmemo: [`(Your role was set from an IDEA.)`],\n\t\t\t\t\timage: '',\n\t\t\t\t};\n\t\t\t\t// hardcoding this because it makes GestI so much nicer\n\t\t\t\tif (!this.IDEA.data.untrusted) {\n\t\t\t\t\tfor (const pick of role) {\n\t\t\t\t\t\tif (pick.substr(0, 10) === 'alignment:') {\n\t\t\t\t\t\t\tconst parsedRole = Mafia.parseRole(pick.substr(9));\n\t\t\t\t\t\t\tif (parsedRole.problems.length) {\n\t\t\t\t\t\t\t\tthis.sendRoom(`Problems found when parsing IDEA role ${pick}. Please report this to a mod.`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tplayer.role.alignment = parsedRole.role.alignment;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 'Innocent Discard' causes chosen role to become Town, when discarded.\n\t\t\tif (player.IDEA.choices.includes('Innocent Discard')) player.role.alignment = 'town';\n\t\t}\n\t\tthis.IDEA.discardsHTML = `Discards:
`;\n\t\tfor (const player of this.players.sort((a, b) => a.id.localeCompare(b.id))) {\n\t\t\tconst IDEA = player.IDEA;\n\t\t\tif (!IDEA) {\n\t\t\t\treturn this.sendRoom(`No IDEA data for player ${player} when finalising IDEAs. Please report this to a mod.`);\n\t\t\t}\n\n\t\t\tthis.IDEA.discardsHTML += `${player.safeName}: ${IDEA.choices.join(', ')}
`;\n\t\t}\n\n\t\tthis.phase = 'IDEAlocked';\n\t\tif (randed.length) {\n\t\t\tthis.sendDeclare(`${randed.join(', ')} did not pick a role in time and were randomly assigned one.`);\n\t\t}\n\t\tthis.sendDeclare(`IDEA picks are locked!`);\n\t\tthis.sendRoom(`To start, use /mafia start, or to reroll use /mafia ideareroll`);\n\t\tthis.updatePlayers();\n\t}\n\n\tsendPlayerList() {\n\t\tthis.room.add(`|c:|${(Math.floor(Date.now() / 1000))}|~|**Players (${this.getRemainingPlayers().length})**: ${this.getRemainingPlayers().map(p => p.name).sort().join(', ')}`).update();\n\t}\n\n\tupdatePlayers() {\n\t\tfor (const p of this.players) {\n\t\t\tp.tryUpdateHtmlRoom();\n\t\t}\n\t\t// Now do the host\n\t\tthis.updateHost();\n\t}\n\n\tupdatePlayersVotes() {\n\t\tfor (const p of this.players) {\n\t\t\tp.tryUpdateHtmlRoom();\n\t\t}\n\t}\n\n\tupdateHost(...hosts: ID[]) {\n\t\tif (!hosts.length) hosts = [...this.cohostids, this.hostid];\n\n\t\tfor (const hostid of hosts) {\n\t\t\tconst host = Users.get(hostid);\n\t\t\tif (!host?.connected) return;\n\t\t\tfor (const conn of host.connections) {\n\t\t\t\tvoid Chat.resolvePage(`view-mafia-${this.room.roomid}`, host, conn);\n\t\t\t}\n\t\t}\n\t}\n\n\tupdateRoleString() {\n\t\tthis.roleString = this.roles.map(\n\t\t\tr => `${r.safeName}`\n\t\t).join(', ');\n\t}\n\n\tsendRoom(message: string) {\n\t\tthis.room.add(message).update();\n\t}\n\tsendHTML(message: string) {\n\t\tthis.room.add(`|uhtml|mafia|${message}`).update();\n\t}\n\tsendDeclare(message: string) {\n\t\tthis.room.add(`|raw|
${message}
`).update();\n\t}\n\tsendStrong(message: string) {\n\t\tthis.room.add(`|raw|${message}`).update();\n\t}\n\tsendTimestamp(message: string) {\n\t\tthis.room.add(`|c:|${(Math.floor(Date.now() / 1000))}|~|${message}`).update();\n\t}\n\tlogAction(user: User, message: string) {\n\t\tif (user.id === this.hostid || this.cohostids.includes(user.id)) return;\n\t\tthis.room.sendModsByUser(user, `(${user.name}: ${message})`);\n\t}\n\tsecretLogAction(user: User, message: string) {\n\t\tif (user.id === this.hostid || this.cohostids.includes(user.id)) return;\n\t\tthis.room.roomlog(`(${user.name}: ${message})`);\n\t}\n\troomWindow() {\n\t\tif (this.ended) return `
The game of ${this.title} has ended.
`;\n\t\tlet output = `
`;\n\t\tif (this.phase === 'signups') {\n\t\t\toutput += `

A game of ${this.title} was created

`;\n\t\t} else {\n\t\t\toutput += `

A game of ${this.title} is in progress.

`;\n\t\t}\n\t\toutput += `
`;\n\t\treturn output;\n\t}\n\n\tcanJoin(user: User, self = false, force = false) {\n\t\tif (!user?.connected) throw new Chat.ErrorMessage(`User not found.`);\n\t\tconst targetString = self ? `You are` : `${user.id} is`;\n\t\tif (!this.room.users[user.id]) throw new Chat.ErrorMessage(`${targetString} not in the room.`);\n\t\tfor (const id of [user.id, ...user.previousIDs]) {\n\t\t\tif (this.getPlayer(id)) throw new Chat.ErrorMessage(`${targetString} already in the game.`);\n\t\t\tif (!force && this.played.includes(id)) {\n\t\t\t\tthrow new Chat.ErrorMessage(`${targetString} a previous player and cannot rejoin.`);\n\t\t\t}\n\t\t\tif (Mafia.isGameBanned(this.room, user)) {\n\t\t\t\tthrow new Chat.ErrorMessage(`${targetString} banned from joining mafia games.`);\n\t\t\t}\n\t\t\tif (this.hostid === id) throw new Chat.ErrorMessage(`${targetString} the host.`);\n\t\t\tif (this.cohostids.includes(id)) throw new Chat.ErrorMessage(`${targetString} a cohost.`);\n\t\t}\n\n\t\tfor (const alt of user.getAltUsers(true)) {\n\t\t\tif (!force && (this.getPlayer(alt.id) || this.played.includes(alt.id))) {\n\t\t\t\tthrow new Chat.ErrorMessage(`${self ? `You already have` : `${user.id} already has`} an alt in the game.`);\n\t\t\t}\n\t\t\tif (this.hostid === alt.id || this.cohostids.includes(alt.id)) {\n\t\t\t\tthrow new Chat.ErrorMessage(`${self ? `You have` : `${user.id} has`} an alt as a game host.`);\n\t\t\t}\n\t\t}\n\t}\n\n\tsendUser(user: MafiaPlayer | User | string, message: string) {\n\t\tlet userObject: User | null;\n\t\tif (user instanceof MafiaPlayer) {\n\t\t\tuserObject = user.getUser();\n\t\t} else if (typeof user === \"string\") {\n\t\t\tuserObject = Users.get(user);\n\t\t} else {\n\t\t\tuserObject = user;\n\t\t}\n\n\t\tif (!userObject?.connected) return;\n\t\tuserObject.sendTo(this.room, message);\n\t}\n\n\tsetSelfVote(user: User, setting: boolean | 'hammer') {\n\t\tconst from = this.selfEnabled;\n\t\tif (from === setting) {\n\t\t\treturn user.sendTo(\n\t\t\t\tthis.room,\n\t\t\t\t`|error|Selfvoting is already ${setting ? `set to Self${setting === 'hammer' ? 'hammering' : 'voting'}` : 'disabled'}.`\n\t\t\t);\n\t\t}\n\t\tif (from) {\n\t\t\tthis.sendDeclare(`Self${from === 'hammer' ? 'hammering' : 'voting'} has been ${setting ? `changed to Self${setting === 'hammer' ? 'hammering' : 'voting'}` : 'disabled'}.`);\n\t\t} else {\n\t\t\tthis.sendDeclare(`Self${setting === 'hammer' ? 'hammering' : 'voting'} has been ${setting ? 'enabled' : 'disabled'}.`);\n\t\t}\n\t\tthis.selfEnabled = setting;\n\t\tif (!setting) {\n\t\t\tfor (const player of this.players) {\n\t\t\t\tif (player.voting === player.id) this.unvote(player, true);\n\t\t\t}\n\t\t}\n\t\tthis.updatePlayers();\n\t}\n\n\tsetNoVote(user: User, setting: boolean) {\n\t\tif (this.enableNV === setting) {\n\t\t\treturn this.sendUser(user, `|error|No Vote is already ${setting ? 'enabled' : 'disabled'}.`);\n\t\t}\n\t\tthis.enableNV = setting;\n\t\tthis.sendDeclare(`No Vote has been ${setting ? 'enabled' : 'disabled'}.`);\n\t\tif (!setting) this.clearVotes('novote' as ID);\n\t\tthis.updatePlayers();\n\t}\n\n\tsetVotelock(user: User, setting: boolean) {\n\t\tif (!this.started) return this.sendUser(user, `The game has not started yet.`);\n\t\tif ((this.voteLock) === setting) {\n\t\t\treturn this.sendUser(user, `|error|Votes are already ${setting ? 'set to lock' : 'set to not lock'}.`);\n\t\t}\n\t\tthis.voteLock = setting;\n\t\tthis.clearVotes();\n\t\tthis.sendDeclare(`Votes are cleared and ${setting ? 'set to lock' : 'set to not lock'}.`);\n\t\tthis.updatePlayers();\n\t}\n\n\tsetVoting(user: User, setting: boolean) {\n\t\tif (!this.started) return this.sendUser(user, `The game has not started yet.`);\n\t\tif (this.votingEnabled === setting) {\n\t\t\treturn this.sendUser(user, `|error|Voting is already ${setting ? 'allowed' : 'disallowed'}.`);\n\t\t}\n\t\tthis.votingEnabled = setting;\n\t\tthis.clearVotes();\n\t\tthis.sendDeclare(`Voting is now ${setting ? 'allowed' : 'disallowed'}.`);\n\t\tthis.updatePlayers();\n\t}\n\n\tclearVotes(target: ID = '') {\n\t\tif (target) delete this.votes[target];\n\n\t\tif (!target) this.votes = Object.create(null);\n\n\t\tfor (const player of this.players) {\n\t\t\tif (player.isEliminated() && !player.isSpirit()) continue;\n\n\t\t\tif (this.forceVote) {\n\t\t\t\tif (!target || (player.voting === target)) {\n\t\t\t\t\tplayer.voting = player.id;\n\t\t\t\t\tthis.votes[player.id] = {\n\t\t\t\t\t\tcount: 1, trueCount: this.getVoteValue(player), lastVote: Date.now(), dir: 'up', voters: [player.id],\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (!target || (player.voting === target)) player.voting = '';\n\t\t\t}\n\t\t}\n\t\tthis.hasPlurality = null;\n\t}\n\n\t/**\n\t * Only intended to be used during pre-game setup.\n\t */\n\tclearEliminations() {\n\t\tfor (const player of this.players) {\n\t\t\tplayer.eliminated = null;\n\t\t}\n\t}\n\n\tonChatMessage(message: string, user: User) {\n\t\tconst subIndex = this.hostRequestedSub.indexOf(user.id);\n\t\tif (subIndex !== -1) {\n\t\t\tthis.hostRequestedSub.splice(subIndex, 1);\n\t\t\tfor (const hostid of [...this.cohostids, this.hostid]) {\n\t\t\t\tthis.sendUser(hostid, `${user.id} has spoken and been removed from the host sublist.`);\n\t\t\t}\n\t\t}\n\n\t\t// Hosts can always talk\n\t\tif (this.hostid === user.id || this.cohostids.includes(user.id) || !this.started) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst player = this.getPlayer(user.id);\n\t\tconst eliminated = player?.isEliminated();\n\t\tconst staff = user.can('mute', null, this.room);\n\n\t\tif (!player) {\n\t\t\tif (staff) {\n\t\t\t\t// Uninvolved staff can talk anytime\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\treturn `You cannot talk while a game of ${this.title} is going on.`;\n\t\t\t}\n\t\t}\n\n\t\tif (player.silenced) {\n\t\t\treturn `You are silenced and cannot speak.${staff ? \" You can remove this with /mafia unsilence.\" : ''}`;\n\t\t}\n\n\t\tif (eliminated) {\n\t\t\tif (!player.isTreestump()) {\n\t\t\t\treturn `You are dead.${staff ? \" You can treestump yourself with /mafia treestump.\" : ''}`;\n\t\t\t}\n\t\t}\n\n\t\tif (this.phase === 'night') {\n\t\t\tif (!player.nighttalk) {\n\t\t\t\treturn `You cannot talk at night.${staff ? \" You can bypass this using /mafia nighttalk.\" : ''}`;\n\t\t\t}\n\t\t}\n\t}\n\n\tonConnect(user: User) {\n\t\tthis.sendUser(user, `|uhtml|mafia|${this.roomWindow()}`);\n\t}\n\n\tonJoin(user: User) {\n\t\tconst player = this.getPlayer(user.id);\n\t\tif (player) {\n\t\t\treturn player.updateHtmlRoom();\n\t\t}\n\t\tif (user.id === this.hostid || this.cohostids.includes(user.id)) return this.updateHost(user.id);\n\t}\n\n\tremoveBannedUser(user: User) {\n\t\t// Player was banned, attempt to sub now\n\t\t// If we can't sub now, make subbing them out the top priority\n\t\tif (!this.getPlayer(user.id)) return;\n\t\tthis.requestedSub.unshift(user.id);\n\t\tthis.nextSub();\n\t}\n\n\tforfeit(user: User) {\n\t\t// Add the player to the sub list.\n\t\tconst player = this.getPlayer(user.id);\n\t\tif (!player || player.isEliminated()) return;\n\t\tthis.requestedSub.push(user.id);\n\t\tthis.nextSub();\n\t}\n\n\tend() {\n\t\tthis.setEnded();\n\t\tthis.sendHTML(this.roomWindow());\n\t\tthis.updatePlayers();\n\t\tif (this.room.roomid === 'mafia' && this.started) {\n\t\t\t// Intead of using this.played, which shows players who have subbed out as well\n\t\t\t// We check who played through to the end when recording playlogs\n\t\t\tconst played = this.players.map(p => p.id);\n\t\t\tconst month = new Date().toLocaleString(\"en-us\", { month: \"numeric\", year: \"numeric\" });\n\t\t\tif (!logs.plays[month]) logs.plays[month] = {};\n\t\t\tfor (const player of played) {\n\t\t\t\tif (!logs.plays[month][player]) logs.plays[month][player] = 0;\n\t\t\t\tlogs.plays[month][player]++;\n\t\t\t}\n\t\t\tif (!logs.hosts[month]) logs.hosts[month] = {};\n\t\t\tfor (const hostid of [...this.cohostids, this.hostid]) {\n\t\t\t\tif (!logs.hosts[month][hostid]) logs.hosts[month][hostid] = 0;\n\t\t\t\tlogs.hosts[month][hostid]++;\n\t\t\t}\n\t\t\twriteFile(LOGS_FILE, logs);\n\t\t}\n\t\tif (this.timer) {\n\t\t\tclearTimeout(this.timer);\n\t\t\tthis.timer = null;\n\t\t}\n\t\tthis.destroy();\n\t}\n\n\toverride destroy() {\n\t\t// Ensure timers are cleared as a part of game destruction\n\t\tif (this.timer) clearTimeout(this.timer);\n\t\tif (this.IDEA.timer) clearTimeout(this.IDEA.timer);\n\t\tsuper.destroy();\n\t}\n}\n\nexport const pages: Chat.PageTable = {\n\tmafia(query, user) {\n\t\tif (!user.named) return Rooms.RETRY_AFTER_LOGIN;\n\t\tif (!query.length) return this.close();\n\t\tlet roomid = query.shift();\n\t\tif (roomid === 'groupchat') roomid += `-${query.shift()}-${query.shift()}`;\n\t\tconst room = Rooms.get(roomid);\n\t\tconst game = room?.getGame(Mafia);\n\t\tif (!room?.users[user.id] || !game || game.ended) {\n\t\t\treturn this.close();\n\t\t}\n\n\t\tconst isPlayer = game.getPlayer(user.id);\n\t\tconst isHost = user.id === game.hostid || game.cohostids.includes(user.id);\n\t\tconst players = game.getRemainingPlayers();\n\t\tthis.title = game.title;\n\t\tlet buf = `
`;\n\t\tbuf += ``;\n\t\tbuf += `

${game.title}

Host: ${game.host}

${game.cohostids[0] ? `

Cohosts: ${game.cohosts.sort().join(', ')}

` : ''}`;\n\t\tbuf += `

Players (${players.length}): ${players.map(p => p.safeName).sort().join(', ')}

`;\n\n\t\tconst eliminatedPlayers = game.getEliminatedPlayers();\n\t\tif (game.started && eliminatedPlayers.length > 0) {\n\t\t\tbuf += `

Dead Players`;\n\t\t\tfor (const eliminated of eliminatedPlayers) {\n\t\t\t\tbuf += `

${eliminated.safeName} ${eliminated.revealed ? '(' + eliminated.revealed + ')' : ''}`;\n\t\t\t\tif (eliminated.isTreestump()) buf += ` (is a Treestump)`;\n\t\t\t\tif (eliminated.isSpirit()) buf += ` (is a Restless Spirit)`;\n\t\t\t\tif (isHost && !eliminated.revealed) {\n\t\t\t\t\tbuf += ``;\n\t\t\t\t}\n\t\t\t\tbuf += `

`;\n\t\t\t}\n\t\t\tbuf += `

`;\n\t\t}\n\n\t\tbuf += `
`;\n\t\tif (isPlayer && game.phase === 'IDEApicking') {\n\t\t\tbuf += `

IDEA information:
`;\n\t\t\tconst IDEA = isPlayer.IDEA;\n\t\t\tif (!IDEA) {\n\t\t\t\treturn game.sendRoom(`IDEA picking phase but no IDEA object for user: ${user.id}. Please report this to a mod.`);\n\t\t\t}\n\t\t\tfor (const key in IDEA.picks) {\n\t\t\t\tconst pick = IDEA.picks[key];\n\t\t\t\tbuf += `${key}: `;\n\t\t\t\tif (!pick) {\n\t\t\t\t\tbuf += ``;\n\t\t\t\t} else {\n\t\t\t\t\tbuf += ``;\n\t\t\t\t}\n\t\t\t\tconst selectedIndex = pick ? IDEA.originalChoices.indexOf(pick) : -1;\n\t\t\t\tfor (let i = 0; i < IDEA.originalChoices.length; i++) {\n\t\t\t\t\tconst choice = IDEA.originalChoices[i];\n\t\t\t\t\tif (i === selectedIndex) {\n\t\t\t\t\t\tbuf += ``;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuf += ``;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbuf += `
`;\n\t\t\t}\n\t\t\tbuf += `

`;\n\t\t\tbuf += `

Role details:

`;\n\t\t\tfor (const role of IDEA.originalChoices) {\n\t\t\t\tconst roleObject = Mafia.parseRole(role);\n\t\t\t\tbuf += `

${role}`;\n\t\t\t\tbuf += `
    ${roleObject.role.memo.map(m => `
  • ${m}
  • `).join('')}
`;\n\t\t\t\tbuf += `
`;\n\t\t\t}\n\t\t\tbuf += `

`;\n\t\t}\n\t\tif (game.IDEA.data) {\n\t\t\tbuf += `

${game.IDEA.data.name} information`;\n\t\t\tif (game.IDEA.discardsHTML && (!game.IDEA.discardsHidden || isHost)) {\n\t\t\t\tbuf += `
Discards:

${game.IDEA.discardsHTML}

`;\n\t\t\t}\n\t\t\tbuf += `
Role list

${game.IDEA.data.roles.join('
')}

`;\n\t\t\tbuf += `

`;\n\t\t} else {\n\t\t\tif (!game.closedSetup || isHost) {\n\t\t\t\tif (game.theme) {\n\t\t\t\t\tbuf += `

Theme: ${game.theme.name}

`;\n\t\t\t\t\tbuf += `

${game.theme.desc}

`;\n\t\t\t\t}\n\t\t\t\tif (game.noReveal) {\n\t\t\t\t\tbuf += `

Original Rolelist${game.closedSetup ? ' (CS)' : ''}: ${game.originalRoleString}

`;\n\t\t\t\t} else {\n\t\t\t\t\tbuf += `

Rolelist${game.closedSetup ? ' (CS)' : ''}: ${game.roleString}

`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (isPlayer) {\n\t\t\tconst role = isPlayer.role;\n\t\t\tlet previousActionsPL = `
`;\n\t\t\tif (role) {\n\t\t\t\tbuf += `

${isPlayer.safeName}, you are a ${isPlayer.getStylizedRole()}

`;\n\t\t\t\tif (!['town', 'solo'].includes(role.alignment)) {\n\t\t\t\t\tbuf += `

Partners: ${game.getPartners(role.alignment, isPlayer)}

`;\n\t\t\t\t}\n\t\t\t\tbuf += `

Role Details`;\n\t\t\t\tbuf += `
    ${role.memo.map(m => `
  • ${m}
  • `).join('')}
`;\n\t\t\t\tbuf += `

`;\n\t\t\t\tfor (let i = 0; i < game.dayNum; i++) {\n\t\t\t\t\tpreviousActionsPL += `Night ${i}
`;\n\t\t\t\t\tpreviousActionsPL += `${isPlayer.actionArr?.[i] ? `${isPlayer.actionArr[i]}` : ''}
`;\n\t\t\t\t}\n\t\t\t\tif (game.dayNum > 0) {\n\t\t\t\t\tbuf += `

Previous Actions${previousActionsPL}

`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (game.phase === \"day\") {\n\t\t\tbuf += ``;\n\t\t\tbuf += game.voteBoxFor(user.id);\n\t\t\tbuf += ``;\n\t\t} else if (game.phase === \"night\" && isPlayer && !isPlayer.isEliminated()) {\n\t\t\tif (!game.takeIdles) {\n\t\t\t\tbuf += `

PM the host (${game.host}) the action you want to use tonight, and who you want to use it on. Or PM the host \"idle\".

`;\n\t\t\t} else {\n\t\t\t\tbuf += `Night Actions:`;\n\t\t\t\tif (isPlayer.action === null) {\n\t\t\t\t\tbuf += ``;\n\t\t\t\t\tbuf += ``;\n\t\t\t\t\tbuf += `
`;\n\t\t\t\t} else {\n\t\t\t\t\tbuf += ``;\n\t\t\t\t\tif (isPlayer.action) {\n\t\t\t\t\t\tbuf += ``;\n\t\t\t\t\t\tbuf += ``;\n\t\t\t\t\t\tif (isPlayer.action === true) {\n\t\t\t\t\t\t\tbuf += `
`;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tbuf += `
`;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuf += ``;\n\t\t\t\t\t\tbuf += `
`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (isHost) {\n\t\t\tif (game.phase === \"night\" && isHost && game.takeIdles) {\n\t\t\t\tbuf += `

Night Responses

`;\n\t\t\t\tlet actions = `
`;\n\t\t\t\tlet idles = `
`;\n\t\t\t\tlet noResponses = `
`;\n\t\t\t\tfor (const player of game.getRemainingPlayers()) {\n\t\t\t\t\tif (player.action) {\n\t\t\t\t\t\tactions += `${player.safeName}${player.action === true ? '' : `: ${player.action}`}
`;\n\t\t\t\t\t} else if (player.action === false) {\n\t\t\t\t\t\tidles += `${player.safeName}
`;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnoResponses += `${player.safeName}
`;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbuf += `

Idles${idles}

`;\n\t\t\t\tbuf += `

Actions${actions}

`;\n\t\t\t\tbuf += `

No Response${noResponses}

`;\n\t\t\t}\n\t\t\tlet previousActions = `
`;\n\t\t\tfor (let i = 0; i < game.dayNum; i++) {\n\t\t\t\tpreviousActions += `Night ${i}
`;\n\t\t\t\tfor (const player of game.players) {\n\t\t\t\t\tpreviousActions += `${player.safeName}:${player.actionArr[i] ? `${player.actionArr[i]}` : ''}
`;\n\t\t\t\t}\n\t\t\t\tpreviousActions += `
`;\n\t\t\t}\n\t\t\tbuf += `

Host options

`;\n\t\t\tbuf += `

General Options`;\n\t\t\tbuf += `

General Options

`;\n\t\t\tif (!game.started) {\n\t\t\t\tbuf += ``;\n\t\t\t\tif (game.phase === 'locked' || game.phase === 'IDEAlocked') {\n\t\t\t\t\tbuf += ` `;\n\t\t\t\t} else {\n\t\t\t\t\tbuf += ` `;\n\t\t\t\t}\n\t\t\t} else if (game.phase === 'day') {\n\t\t\t\tbuf += ``;\n\t\t\t} else if (game.phase === 'night') {\n\t\t\t\tif (game.dayNum !== 0) {\n\t\t\t\t\tbuf += ` `;\n\t\t\t\t} else {\n\t\t\t\t\tbuf += ``;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf += ` `;\n\t\t\tbuf += ` `;\n\t\t\tbuf += ` `;\n\t\t\tbuf += ` `;\n\t\t\tbuf += ``;\n\t\t\tbuf += `

To set a deadline, use /mafia deadline [minutes].
To clear the deadline use /mafia deadline off.


`;\n\t\t\tbuf += `

Player Options`;\n\t\t\tbuf += `

Player Options

`;\n\t\t\tfor (const player of game.getRemainingPlayers()) {\n\t\t\t\tbuf += `

`;\n\t\t\t\tbuf += `${player.safeName} (${player.role ? player.getStylizedRole(true) : ''})`;\n\t\t\t\tbuf += game.voteModifiers[player.id] !== undefined ? `(votes worth ${game.getVoteValue(player)})` : '';\n\t\t\t\tbuf += player.hammerRestriction !== null ? `(${player.hammerRestriction ? 'actor' : 'priest'})` : '';\n\t\t\t\tbuf += player.silenced ? '(silenced)' : '';\n\t\t\t\tbuf += player.nighttalk ? '(insomniac)' : '';\n\t\t\t\tbuf += ``;\n\t\t\t\tbuf += ` `;\n\t\t\t\tbuf += ` `;\n\t\t\t\tbuf += ` `;\n\t\t\t\tbuf += ` `;\n\t\t\t\tbuf += `

`;\n\t\t\t}\n\t\t\tfor (const eliminated of game.getEliminatedPlayers()) {\n\t\t\t\tbuf += `

${eliminated.safeName} (${eliminated.role ? eliminated.getStylizedRole() : ''})`;\n\t\t\t\tif (eliminated.isTreestump()) buf += ` (is a Treestump)`;\n\t\t\t\tif (eliminated.isSpirit()) buf += ` (is a Restless Spirit)`;\n\t\t\t\tif (game.voteModifiers[eliminated.id] !== undefined) buf += ` (votes worth ${game.getVoteValue(eliminated)})`;\n\t\t\t\tbuf += eliminated.hammerRestriction !== null ? `(${eliminated.hammerRestriction ? 'actor' : 'priest'})` : '';\n\t\t\t\tbuf += eliminated.silenced ? '(silenced)' : '';\n\t\t\t\tbuf += eliminated.nighttalk ? '(insomniac)' : '';\n\t\t\t\tbuf += `:

`;\n\t\t\t}\n\t\t\tbuf += `

`;\n\t\t\tif (game.dayNum > 0) {\n\t\t\t\tbuf += `

Previous Night Actions${previousActions}

`;\n\t\t\t}\n\t\t\tbuf += `

How to setup roles`;\n\t\t\tbuf += `

Setting the roles

`;\n\t\t\tbuf += `

To set the roles, use /mafia setroles [comma seperated list of roles] OR /mafia setroles [theme] in ${room.title}.

`;\n\t\t\tbuf += `

If you set the roles from a theme, the role parser will get all the correct roles for you. (Not all themes are supported).

`;\n\t\t\tbuf += `

The following key words determine a role's alignment (If none are found, the default alignment is town):

`;\n\t\t\tbuf += `

${Object.values(MafiaData.alignments).map(a => `${a.name}`).join(', ')}

`;\n\t\t\tbuf += `

Please note that anything inside (parentheses) is ignored by the role parser.

`;\n\t\t\tbuf += `

If you have roles that have conflicting alignments or base roles, you can use /mafia forcesetroles [comma seperated list of roles] to forcibly set the roles.

`;\n\t\t\tbuf += `

Please note that you will have to PM all the players their alignment, partners (if any), and other information about their role because the server will not provide it.

`;\n\t\t\tbuf += `

`;\n\t\t\tbuf += `

Players who will be subbed unless they talk: ${game.hostRequestedSub.join(', ')}

`;\n\t\t\tbuf += `

Players who are requesting a sub: ${game.requestedSub.join(', ')}

`;\n\t\t}\n\t\tbuf += `

Sub List: ${game.subs.join(', ')}

`;\n\t\tif (!isHost) {\n\t\t\tif (game.phase === 'signups') {\n\t\t\t\tif (isPlayer) {\n\t\t\t\t\tbuf += `

`;\n\t\t\t\t} else {\n\t\t\t\t\tbuf += `

`;\n\t\t\t\t}\n\t\t\t} else if (!isPlayer?.isEliminated()) {\n\t\t\t\tif ((!isPlayer && game.subs.includes(user.id)) || (isPlayer && !game.requestedSub.includes(user.id))) {\n\t\t\t\t\tbuf += `

${isPlayer ? 'Request to be subbed out' : 'Cancel sub request'}`;\n\t\t\t\t\tbuf += `

`;\n\t\t\t\t} else {\n\t\t\t\t\tbuf += `

${isPlayer ? 'Cancel sub request' : 'Join the game as a sub'}`;\n\t\t\t\t\tbuf += `

`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbuf += `
`;\n\t\treturn buf;\n\t},\n\tmafialadder(query, user) {\n\t\tif (!user.named) return Rooms.RETRY_AFTER_LOGIN;\n\t\tconst mafiaRoom = Rooms.get('mafia');\n\t\tif (!query.length || !mafiaRoom) return this.close();\n\t\tconst headers: { [k: string]: { title: string, type: string, section: MafiaLogSection } } = {\n\t\t\tleaderboard: { title: 'Leaderboard', type: 'Points', section: 'leaderboard' },\n\t\t\tmvpladder: { title: 'MVP Ladder', type: 'MVPs', section: 'mvps' },\n\t\t\thostlogs: { title: 'Host Logs', type: 'Hosts', section: 'hosts' },\n\t\t\tplaylogs: { title: 'Play Logs', type: 'Plays', section: 'plays' },\n\t\t\tleaverlogs: { title: 'Leaver Logs', type: 'Leavers', section: 'leavers' },\n\t\t};\n\t\tconst date = new Date();\n\t\tif (query[1] === 'prev') date.setMonth(date.getMonth() - 1);\n\t\tconst month = date.toLocaleString(\"en-us\", { month: \"numeric\", year: \"numeric\" });\n\t\tconst ladder = headers[query[0]];\n\t\tif (!ladder) return this.close();\n\t\tif (['hosts', 'plays', 'leavers'].includes(ladder.section)) this.checkCan('mute', null, mafiaRoom);\n\t\tthis.title = `Mafia ${ladder.title} (${date.toLocaleString(\"en-us\", { month: 'long' })} ${date.getFullYear()})`;\n\t\tlet buf = `
`;\n\t\tbuf += `${query[1] === 'prev' ? '' : ` `}`;\n\t\tbuf += `

`;\n\t\tconst section = ladder.section;\n\t\tif (!logs[section][month] || !Object.keys(logs[section][month]).length) {\n\t\t\tbuf += `${ladder.title} for ${date.toLocaleString(\"en-us\", { month: 'long' })} ${date.getFullYear()} not found.
`;\n\t\t\treturn buf;\n\t\t}\n\t\tconst entries = Utils.sortBy(Object.entries(logs[section][month]), ([key, value]) => (\n\t\t\t-value\n\t\t));\n\t\tbuf += ``;\n\t\tbuf += ``;\n\t\tfor (const [key, value] of entries) {\n\t\t\tbuf += ``;\n\t\t}\n\t\treturn buf + `

Mafia ${ladder.title} for ${date.toLocaleString(\"en-us\", { month: 'long' })} ${date.getFullYear()}

User${ladder.type}
${key}${value}
`;\n\t},\n};\n\nexport const commands: Chat.ChatCommands = {\n\tmafia: {\n\t\t''(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = room.getGame(Mafia);\n\t\t\tif (game) {\n\t\t\t\tif (!this.runBroadcast()) return;\n\t\t\t\treturn this.sendReply(`|html|${game.roomWindow()}`);\n\t\t\t}\n\t\t\treturn this.parse('/help mafia');\n\t\t},\n\n\t\tforcehost: 'host',\n\t\tnexthost: 'host',\n\t\thost(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tif (room.settings.mafiaDisabled) return this.errorReply(`Mafia is disabled for this room.`);\n\t\t\tthis.checkChat();\n\t\t\tif (room.type !== 'chat') return this.errorReply(`This command is only meant to be used in chat rooms.`);\n\t\t\tif (room.game) return this.errorReply(`There is already a game of ${room.game.title} in progress in this room.`);\n\n\t\t\tconst nextHost = room.roomid === 'mafia' && cmd === 'nexthost';\n\t\t\tif (nextHost || !room.auth.has(user.id)) this.checkCan('show', null, room);\n\n\t\t\tlet targetUser!: User | null;\n\t\t\tlet targetUsername!: string;\n\t\t\tif (nextHost) {\n\t\t\t\tif (!hostQueue.length) return this.errorReply(`Nobody is on the host queue.`);\n\t\t\t\tconst skipped = [];\n\t\t\t\tlet hostid;\n\t\t\t\twhile ((hostid = hostQueue.shift())) {\n\t\t\t\t\t({ targetUser, targetUsername } = this.splitUser(hostid, { exactName: true }));\n\t\t\t\t\tif (!targetUser?.connected ||\n\t\t\t\t\t\t!room.users[targetUser.id] || Mafia.isHostBanned(room, targetUser)) {\n\t\t\t\t\t\tskipped.push(hostid);\n\t\t\t\t\t\ttargetUser = null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// found a host\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (skipped.length) {\n\t\t\t\t\tthis.sendReply(`${skipped.join(', ')} ${Chat.plural(skipped.length, 'were', 'was')} not online, not in the room, or are host banned and were removed from the host queue.`);\n\t\t\t\t}\n\t\t\t\tif (!targetUser) return this.errorReply(`Nobody on the host queue could be hosted.`);\n\t\t\t} else {\n\t\t\t\t({ targetUser, targetUsername } = this.splitUser(target, { exactName: true }));\n\t\t\t\tif (room.roomid === 'mafia' && hostQueue.length && toID(targetUsername) !== hostQueue[0]) {\n\t\t\t\t\tif (!cmd.includes('force')) {\n\t\t\t\t\t\treturn this.errorReply(`${targetUsername} isn't the next host on the queue. Use /mafia forcehost if you're sure.`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!targetUser?.connected) {\n\t\t\t\treturn this.errorReply(`The user \"${targetUsername}\" was not found.`);\n\t\t\t}\n\n\t\t\tif (!nextHost && targetUser.id !== user.id) this.checkCan('mute', null, room);\n\n\t\t\tif (!room.users[targetUser.id]) {\n\t\t\t\treturn this.errorReply(`${targetUsername} is not in this room, and cannot be hosted.`);\n\t\t\t}\n\t\t\tif (Mafia.isHostBanned(room, targetUser)) {\n\t\t\t\treturn this.errorReply(`${targetUsername} is banned from hosting mafia games.`);\n\t\t\t}\n\n\t\t\troom.game = new Mafia(room, targetUser);\n\n\t\t\tfor (const conn of targetUser.connections) {\n\t\t\t\tvoid Chat.resolvePage(`view-mafia-${room.roomid}`, targetUser, conn);\n\t\t\t}\n\t\t\troom.addByUser(user, `${targetUser.name} was appointed the mafia host by ${user.name}.`);\n\t\t\tif (room.roomid === 'mafia') {\n\t\t\t\tconst queueIndex = hostQueue.indexOf(targetUser.id);\n\t\t\t\tif (queueIndex > -1) hostQueue.splice(queueIndex, 1);\n\t\t\t\troom.add(`|c:|${(Math.floor(Date.now() / 1000))}|~|**Mafiasignup!**`).update();\n\t\t\t}\n\t\t\tthis.modlog('MAFIAHOST', targetUser, null, { noalts: true, noip: true });\n\t\t},\n\t\thosthelp: [\n\t\t\t`/mafia host [user] - Create a game of Mafia with [user] as the host. Requires whitelist + % @ # ~, drivers+ can host other people.`,\n\t\t],\n\n\t\tq: 'queue',\n\t\tqueue(target, room, user) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tif (room.settings.mafiaDisabled) return this.errorReply(`Mafia is disabled for this room.`);\n\t\t\tconst [command, targetUserID] = target.split(',').map(toID);\n\n\t\t\tswitch (command) {\n\t\t\tcase 'forceadd':\n\t\t\tcase 'add':\n\t\t\t\tthis.checkChat();\n\t\t\t\t// any rank can selfqueue\n\t\t\t\tif (targetUserID === user.id) {\n\t\t\t\t\tif (!room.auth.has(user.id)) this.checkCan('show', null, room);\n\t\t\t\t} else {\n\t\t\t\t\tthis.checkCan('mute', null, room);\n\t\t\t\t}\n\t\t\t\tif (!targetUserID) return this.parse(`/help mafia queue`);\n\t\t\t\tconst targetUser = Users.get(targetUserID);\n\t\t\t\tif ((!targetUser?.connected) && !command.includes('force')) {\n\t\t\t\t\treturn this.errorReply(`User ${targetUserID} not found. To forcefully add the user to the queue, use /mafia queue forceadd, ${targetUserID}`);\n\t\t\t\t}\n\t\t\t\tif (hostQueue.includes(targetUserID)) return this.errorReply(`User ${targetUserID} is already on the host queue.`);\n\t\t\t\tif (targetUser && Mafia.isHostBanned(room, targetUser)) {\n\t\t\t\t\treturn this.errorReply(`User ${targetUserID} is banned from hosting mafia games.`);\n\t\t\t\t}\n\t\t\t\thostQueue.push(targetUserID);\n\t\t\t\troom.add(`User ${targetUserID} has been added to the host queue by ${user.name}.`).update();\n\t\t\t\tbreak;\n\t\t\tcase 'del':\n\t\t\tcase 'delete':\n\t\t\tcase 'remove':\n\t\t\t\t// anyone can self remove\n\t\t\t\tif (targetUserID !== user.id) this.checkCan('mute', null, room);\n\t\t\t\tconst index = hostQueue.indexOf(targetUserID);\n\t\t\t\tif (index === -1) return this.errorReply(`User ${targetUserID} is not on the host queue.`);\n\t\t\t\thostQueue.splice(index, 1);\n\t\t\t\troom.add(`User ${targetUserID} has been removed from the host queue by ${user.name}.`).update();\n\t\t\t\tbreak;\n\t\t\tcase '':\n\t\t\tcase 'show':\n\t\t\tcase 'view':\n\t\t\t\tif (!this.runBroadcast()) return;\n\t\t\t\tthis.sendReplyBox(`Host Queue: ${hostQueue.join(', ')}`);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis.parse('/help mafia queue');\n\t\t\t}\n\t\t},\n\t\tqueuehelp: [\n\t\t\t`/mafia queue - Shows the upcoming users who are going to host.`,\n\t\t\t`/mafia queue add, (user) - Adds the user to the hosting queue. Requires whitelist + % @ # ~`,\n\t\t\t`/mafia queue remove, (user) - Removes the user from the hosting queue. Requires whitelist + % @ # ~`,\n\t\t],\n\n\t\tqadd: 'queueadd',\n\t\tqforceadd: 'queueadd',\n\t\tqueueforceadd: 'queueadd',\n\t\tqueueadd(target, room, user, connection, cmd) {\n\t\t\tthis.parse(`/mafia queue ${cmd.includes('force') ? `forceadd` : `add`}, ${target}`);\n\t\t},\n\n\t\tqdel: 'queueremove',\n\t\tqdelete: 'queueremove',\n\t\tqremove: 'queueremove',\n\t\tqueueremove(target, room, user) {\n\t\t\tthis.parse(`/mafia queue remove, ${target}`);\n\t\t},\n\n\t\tjoin(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tthis.checkChat(null, room);\n\t\t\tgame.join(user);\n\t\t},\n\t\tjoinhelp: [`/mafia join - Join the game.`],\n\n\t\tleave(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tgame.leave(user);\n\t\t},\n\t\tleavehelp: [`/mafia leave - Leave the game. Can only be done while signups are open.`],\n\n\t\tplayercap(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (game.phase !== 'signups') return this.errorReply(`Signups are already closed.`);\n\t\t\tconst num = parseInt(target);\n\t\t\tif (isNaN(num) || num > 50 || num < 2) return this.parse('/help mafia playercap');\n\t\t\tif (num < game.playerCount) {\n\t\t\t\treturn this.errorReply(`Player cap has to be equal or more than the amount of players in game.`);\n\t\t\t}\n\t\t\tif (num === game.playerCap) return this.errorReply(`Player cap is already set at ${game.playerCap}.`);\n\t\t\tgame.playerCap = num;\n\t\t\tgame.sendDeclare(`Player cap has been set to ${game.playerCap}`);\n\t\t\tgame.logAction(user, `set playercap to ${num}`);\n\t\t},\n\t\tplayercaphelp: [\n\t\t\t`/mafia playercap [cap]- Limit the number of players being able to join the game. Player cap cannot be more than 50 or less than 2. Default is 20. Requires host % @ # ~`,\n\t\t],\n\n\t\tclose(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (game.phase !== 'signups') return this.errorReply(`Signups are already closed.`);\n\t\t\tif (game.playerCount < 2) return this.errorReply(`You need at least 2 players to start.`);\n\t\t\tgame.phase = 'locked';\n\t\t\tgame.sendHTML(game.roomWindow());\n\t\t\tgame.updatePlayers();\n\t\t\tgame.logAction(user, `closed signups`);\n\t\t},\n\t\tclosehelp: [`/mafia close - Closes signups for the current game. Requires host % @ # ~`],\n\n\t\tcs: 'closedsetup',\n\t\tclosedsetup(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tconst action = toID(target);\n\t\t\tif (!['on', 'off'].includes(action)) return this.parse('/help mafia closedsetup');\n\t\t\tif (game.started) {\n\t\t\t\treturn this.errorReply(`You can't ${action === 'on' ? 'enable' : 'disable'} closed setup because the game has already started.`);\n\t\t\t}\n\t\t\tif ((action === 'on' && game.closedSetup) || (action === 'off' && !game.closedSetup)) {\n\t\t\t\treturn this.errorReply(`Closed setup is already ${game.closedSetup ? 'enabled' : 'disabled'}.`);\n\t\t\t}\n\t\t\tgame.closedSetup = action === 'on';\n\t\t\tgame.sendDeclare(`The game is ${action === 'on' ? 'now' : 'no longer'} a closed setup.`);\n\t\t\tgame.updateHost();\n\t\t\tgame.logAction(user, `${game.closedSetup ? 'enabled' : 'disabled'} closed setup`);\n\t\t},\n\t\tclosedsetuphelp: [\n\t\t\t`/mafia closedsetup [on|off] - Sets if the game is a closed setup. Closed setups don't show the role list to players. Requires host % @ # ~`,\n\t\t],\n\n\t\treveal(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tconst action = toID(target);\n\t\t\tif (!['on', 'off'].includes(action)) return this.parse('/help mafia reveal');\n\t\t\tif ((action === 'off' && game.noReveal) || (action === 'on' && !game.noReveal)) {\n\t\t\t\treturn user.sendTo(\n\t\t\t\t\troom,\n\t\t\t\t\t`|error|Revealing of roles is already ${game.noReveal ? 'disabled' : 'enabled'}.`\n\t\t\t\t);\n\t\t\t}\n\t\t\tgame.noReveal = action === 'off';\n\t\t\tgame.sendDeclare(`Revealing of roles has been ${action === 'off' ? 'disabled' : 'enabled'}.`);\n\t\t\tgame.updatePlayers();\n\t\t\tgame.logAction(user, `${game.noReveal ? 'disabled' : 'enabled'} reveals`);\n\t\t},\n\t\trevealhelp: [`/mafia reveal [on|off] - Sets if roles reveal on death or not. Requires host % @ # ~`],\n\n\t\ttakeidles(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tconst action = toID(target);\n\t\t\tif (!['on', 'off'].includes(action)) return this.parse('/help mafia takeidles');\n\t\t\tif ((action === 'off' && !game.takeIdles) || (action === 'on' && game.takeIdles)) {\n\t\t\t\treturn this.errorReply(`Actions and idles are already ${game.takeIdles ? '' : 'not '}being accepted.`);\n\t\t\t}\n\t\t\tgame.takeIdles = action === 'on';\n\t\t\tgame.sendDeclare(`Actions and idles are ${game.takeIdles ? 'now' : 'no longer'} being accepted.`);\n\t\t\tgame.updatePlayers();\n\t\t},\n\t\ttakeidleshelp: [`/mafia takeidles [on|off] - Sets if idles are accepted by the script or not. Requires host % @ # ~`],\n\n\t\tresetroles: 'setroles',\n\t\tforceresetroles: 'setroles',\n\t\tforcesetroles: 'setroles',\n\t\tsetroles(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tconst reset = cmd.includes('reset');\n\t\t\tif (reset) {\n\t\t\t\tif (game.phase !== 'day' && game.phase !== 'night') return this.errorReply(`The game has not started yet.`);\n\t\t\t} else {\n\t\t\t\tif (game.phase !== 'locked' && game.phase !== 'IDEAlocked') {\n\t\t\t\t\treturn this.errorReply(game.phase === 'signups' ? `You need to close signups first.` : `The game has already started.`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!target) return this.parse('/help mafia setroles');\n\n\t\t\tgame.setRoles(user, target, cmd.includes('force'), reset);\n\t\t\tgame.logAction(user, `${reset ? 're' : ''}set roles`);\n\t\t},\n\t\tsetroleshelp: [\n\t\t\t`/mafia setroles [comma separated roles] - Set the roles for a game of mafia. You need to provide one role per player.`,\n\t\t\t`/mafia forcesetroles [comma separated roles] - Forcibly set the roles for a game of mafia. No role PM information or alignment will be set.`,\n\t\t\t`/mafia resetroles [comma separated roles] - Reset the roles in an ongoing game.`,\n\t\t],\n\n\t\tresetgame: 'gamereset',\n\t\tforceresetgame: 'gamereset',\n\t\tgamereset(target, room, user, connection) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (target) return this.parse('/help mafia resetgame');\n\t\t\tif (game.phase !== 'day' && game.phase !== 'night') return this.errorReply(`The game has not started yet.`);\n\t\t\tif (game.IDEA.data) return this.errorReply(`You cannot use this command in IDEA.`);\n\t\t\tgame.resetGame();\n\t\t\tgame.logAction(user, 'reset the game state');\n\t\t},\n\t\tresetgamehelp: [\n\t\t\t`/mafia resetgame - Resets game data. Does not change settings from the host (besides deadlines) or add/remove any players. Requires host % @ # ~`,\n\t\t],\n\n\t\tidea(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tthis.checkCan('show', null, room);\n\t\t\tif (!user.can('mute', null, room) && game.hostid !== user.id && !game.cohostids.includes(user.id)) {\n\t\t\t\treturn this.errorReply(`/mafia idea - Access denied.`);\n\t\t\t}\n\t\t\tif (game.started) return this.errorReply(`You cannot start an IDEA after the game has started.`);\n\t\t\tif (game.phase !== 'locked' && game.phase !== 'IDEAlocked') {\n\t\t\t\treturn this.errorReply(`You need to close the signups first.`);\n\t\t\t}\n\t\t\tgame.ideaInit(user, toID(target));\n\t\t\tgame.logAction(user, `started an IDEA`);\n\t\t},\n\t\tideahelp: [\n\t\t\t`/mafia idea [idea] - starts the IDEA module [idea]. Requires + % @ # ~, voices can only start for themselves`,\n\t\t\t`/mafia ideareroll - rerolls the IDEA module. Requires host % @ # ~`,\n\t\t\t`/mafia ideapick [selection], [role] - selects a role`,\n\t\t\t`/mafia ideadiscards - shows the discarded roles`,\n\t\t],\n\n\t\tcustomidea(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.started) return this.errorReply(`You cannot start an IDEA after the game has started.`);\n\t\t\tif (game.phase !== 'locked' && game.phase !== 'IDEAlocked') {\n\t\t\t\treturn this.errorReply(`You need to close the signups first.`);\n\t\t\t}\n\t\t\tconst [options, roles] = Utils.splitFirst(target, '\\n');\n\t\t\tif (!options || !roles) return this.parse('/help mafia idea');\n\t\t\tconst [choicesStr, ...picks] = options.split(',').map(x => x.trim());\n\t\t\tconst choices = parseInt(choicesStr);\n\t\t\tif (!choices || choices <= picks.length) return this.errorReply(`You need to have more choices than picks.`);\n\t\t\tif (picks.some((value, index, arr) => arr.indexOf(value, index + 1) > 0)) {\n\t\t\t\treturn this.errorReply(`Your picks must be unique.`);\n\t\t\t}\n\t\t\tgame.customIdeaInit(user, choices, picks, roles);\n\t\t},\n\t\tcustomideahelp: [\n\t\t\t`/mafia customidea choices, picks (new line here, shift+enter)`,\n\t\t\t`(comma or newline separated rolelist) - Starts an IDEA module with custom roles. Requires % @ # ~`,\n\t\t\t`choices refers to the number of roles you get to pick from. In GI, this is 2, in GestI, this is 3.`,\n\t\t\t`picks refers to what you choose. In GI, this should be 'role', in GestI, this should be 'role, alignment'`,\n\t\t],\n\t\tideapick(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst args = target.split(',');\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tconst player = game.getPlayer(user.id);\n\t\t\tif (!player) {\n\t\t\t\treturn user.sendTo(room, '|error|You are not a player in the game.');\n\t\t\t}\n\t\t\tif (game.phase !== 'IDEApicking') {\n\t\t\t\treturn this.errorReply(`The game is not in the IDEA picking phase.`);\n\t\t\t}\n\t\t\tgame.ideaPick(user, args); // TODO use player object\n\t\t},\n\n\t\tideareroll(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tgame.ideaDistributeRoles(user);\n\t\t\tgame.logAction(user, `rerolled an IDEA`);\n\t\t},\n\t\tidearerollhelp: [`/mafia ideareroll - rerolls the roles for the current IDEA module. Requires host % @ # ~`],\n\n\t\tdiscards: 'ideadiscards',\n\t\tideadiscards(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (!game.IDEA.data) return this.errorReply(`There is no IDEA module in the mafia game.`);\n\t\t\tif (target) {\n\t\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\t\tif (this.meansNo(target)) {\n\t\t\t\t\tif (game.IDEA.discardsHidden) return this.errorReply(`IDEA discards are already hidden.`);\n\t\t\t\t\tgame.IDEA.discardsHidden = true;\n\t\t\t\t} else if (this.meansYes(target)) {\n\t\t\t\t\tif (!game.IDEA.discardsHidden) return this.errorReply(`IDEA discards are already visible.`);\n\t\t\t\t\tgame.IDEA.discardsHidden = false;\n\t\t\t\t} else {\n\t\t\t\t\treturn this.parse('/help mafia ideadiscards');\n\t\t\t\t}\n\t\t\t\tgame.logAction(user, `${game.IDEA.discardsHidden ? 'hid' : 'unhid'} IDEA discards`);\n\t\t\t\treturn this.sendReply(`IDEA discards are now ${game.IDEA.discardsHidden ? 'hidden' : 'visible'}.`);\n\t\t\t}\n\t\t\tif (game.IDEA.discardsHidden) return this.errorReply(`Discards are not visible.`);\n\t\t\tif (!game.IDEA.discardsHTML) return this.errorReply(`The IDEA module does not have finalised discards yet.`);\n\t\t\tif (!this.runBroadcast()) return;\n\t\t\tthis.sendReplyBox(`
IDEA discards:${game.IDEA.discardsHTML}
`);\n\t\t},\n\t\tideadiscardshelp: [\n\t\t\t`/mafia ideadiscards - shows the discarded roles`,\n\t\t\t`/mafia ideadiscards off - hides discards from the players. Requires host % @ # ~`,\n\t\t\t`/mafia ideadiscards on - shows discards to the players. Requires host % @ # ~`,\n\t\t],\n\n\t\tdaystart: 'start',\n\t\tnightstart: 'start',\n\t\tstart(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (target) {\n\t\t\t\tthis.parse(`/mafia close`);\n\t\t\t\tthis.parse(`/mafia setroles ${target}`);\n\t\t\t\tthis.parse(`/mafia ${cmd}`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tgame.start(user, cmd === 'daystart');\n\t\t\tgame.logAction(user, `started the game`);\n\t\t},\n\t\tstarthelp: [`/mafia start - Start the game of mafia. Signups must be closed. Requires host % @ # ~`],\n\n\t\textend: 'day',\n\t\tnight: 'day',\n\t\tday(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (cmd === 'night') {\n\t\t\t\tgame.night();\n\t\t\t} else {\n\t\t\t\tlet extension = parseInt(toID(target));\n\t\t\t\tif (isNaN(extension)) {\n\t\t\t\t\textension = 0;\n\t\t\t\t} else {\n\t\t\t\t\tif (extension < 1) extension = 1;\n\t\t\t\t\tif (extension > 10) extension = 10;\n\t\t\t\t}\n\t\t\t\tif (cmd === 'extend') {\n\t\t\t\t\tfor (const player of game.getRemainingPlayers()) {\n\t\t\t\t\t\tplayer.actionArr[game.dayNum] = '';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tgame.day(cmd === 'extend' ? extension : null);\n\t\t\t}\n\t\t\tgame.logAction(user, `set day/night`);\n\t\t},\n\t\tdayhelp: [\n\t\t\t`/mafia day - Move to the next game day. Requires host % @ # ~`,\n\t\t\t`/mafia night - Move to the next game night. Requires host % @ # ~`,\n\t\t\t`/mafia extend (minutes) - Return to the previous game day. If (minutes) is provided, set the deadline for (minutes) minutes. Requires host % @ # ~`,\n\t\t],\n\n\t\tprod(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (game.phase !== 'night') return;\n\t\t\tfor (const player of game.getRemainingPlayers()) {\n\t\t\t\tconst playerid = Users.get(player.id);\n\t\t\t\tif (playerid?.connected && player.action === null) {\n\t\t\t\t\tplayerid.sendTo(room, `|notify|Send in an action or idle!`);\n\t\t\t\t\tplayerid.sendTo(room, `Send in an action or idle, or else you will get subbed out!`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tgame.sendDeclare(`Unsubmitted players have been reminded to submit an action or idle.`);\n\t\t},\n\t\tprodhelp: [\n\t\t\t`/mafia prod - Notifies players that they must submit an action or idle if they haven't yet. Requires host % @ # ~`,\n\t\t],\n\n\t\tv: 'vote',\n\t\tvote(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tthis.checkChat(null, room);\n\t\t\tconst player = game.getPlayer(user.id);\n\t\t\tif (!player || (player.isEliminated() && !player.isSpirit())) {\n\t\t\t\treturn this.errorReply(`You are not in the game of ${game.title}.`);\n\t\t\t}\n\t\t\tgame.vote(player, toID(target));\n\t\t},\n\t\tvotehelp: [`/mafia vote [player|novote] - Vote the specified player or abstain from voting.`],\n\n\t\tuv: 'unvote',\n\t\tunv: 'unvote',\n\t\tunnovote: 'unvote',\n\t\tunvote(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tthis.checkChat(null, room);\n\t\t\tconst player = game.getPlayer(user.id);\n\t\t\tif (!player || (player.isEliminated() && !player.isSpirit())) {\n\t\t\t\treturn this.errorReply(`You are not in the game of ${game.title}.`);\n\t\t\t}\n\t\t\tgame.unvote(player);\n\t\t},\n\t\tunvotehelp: [`/mafia unvote - Withdraw your vote. Fails if you're not voting anyone`],\n\n\t\tnv: 'novote',\n\t\tnovote() {\n\t\t\tthis.parse('/mafia vote novote');\n\t\t},\n\n\t\tenableself: 'selfvote',\n\t\tselfvote(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tconst action = toID(target);\n\t\t\tif (!action) return this.parse(`/help mafia selfvote`);\n\t\t\tif (this.meansYes(action)) {\n\t\t\t\tgame.setSelfVote(user, true);\n\t\t\t} else if (this.meansNo(action)) {\n\t\t\t\tgame.setSelfVote(user, false);\n\t\t\t} else if (action === 'hammer') {\n\t\t\t\tgame.setSelfVote(user, 'hammer');\n\t\t\t} else {\n\t\t\t\treturn this.parse(`/help mafia selfvote`);\n\t\t\t}\n\t\t\tgame.logAction(user, `changed selfvote`);\n\t\t},\n\t\tselfvotehelp: [\n\t\t\t`/mafia selfvote [on|hammer|off] - Allows players to self vote themselves either at hammer or anytime. Requires host % @ # ~`,\n\t\t],\n\n\t\ttreestump: 'kill',\n\t\tspirit: 'kill',\n\t\tspiritstump: 'kill',\n\t\tkick: 'kill',\n\t\tkill(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (game.phase === 'IDEApicking') {\n\t\t\t\treturn this.errorReply(`You cannot add or remove players while IDEA roles are being picked.`); // needs to be here since eliminate doesn't pass the user\n\t\t\t}\n\t\t\tif (!target) return this.parse('/help mafia kill');\n\t\t\tconst player = game.getPlayer(toID(target));\n\t\t\tif (!player) {\n\t\t\t\treturn this.errorReply(`${target.trim()} is not a player.`);\n\t\t\t}\n\n\t\t\tlet repeat, elimType;\n\n\t\t\tswitch (cmd) {\n\t\t\tcase 'treestump':\n\t\t\t\telimType = MafiaEliminateType.TREESTUMP;\n\t\t\t\trepeat = player.isTreestump() && !player.isSpirit();\n\t\t\t\tbreak;\n\t\t\tcase 'spirit':\n\t\t\t\telimType = MafiaEliminateType.SPIRIT;\n\t\t\t\trepeat = !player.isTreestump() && player.isSpirit();\n\t\t\t\tbreak;\n\t\t\tcase 'spiritstump':\n\t\t\t\telimType = MafiaEliminateType.SPIRITSTUMP;\n\t\t\t\trepeat = player.isTreestump() && player.isSpirit();\n\t\t\t\tbreak;\n\t\t\tcase 'kick':\n\t\t\t\telimType = MafiaEliminateType.KICK;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\telimType = MafiaEliminateType.ELIMINATE;\n\t\t\t\trepeat = player.eliminated === MafiaEliminateType.ELIMINATE;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (repeat) return this.errorReply(`${player.safeName} has already been ${cmd}ed.`);\n\n\t\t\tgame.eliminate(player, elimType);\n\t\t\tgame.logAction(user, `${cmd}ed ${player.safeName}`);\n\t\t},\n\t\tkillhelp: [\n\t\t\t`/mafia kill [player] - Kill a player, eliminating them from the game. Requires host % @ # ~`,\n\t\t\t`/mafia treestump [player] - Kills a player, but allows them to talk during the day still.`,\n\t\t\t`/mafia spirit [player] - Kills a player, but allows them to vote still.`,\n\t\t\t`/mafia spiritstump [player] Kills a player, but allows them to talk and vote during the day.`,\n\t\t],\n\n\t\trevealas: 'revealrole',\n\t\trevealrole(target, room, user, connection, cmd) {\n\t\t\tconst args = target.split(',');\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tlet revealAs = '';\n\t\t\tlet revealedRole = null;\n\t\t\tif (cmd === 'revealas') {\n\t\t\t\tif (!args[0]) {\n\t\t\t\t\treturn this.parse('/help mafia revealas');\n\t\t\t\t} else {\n\t\t\t\t\trevealedRole = Mafia.parseRole(args.pop()!);\n\t\t\t\t\tconst color = MafiaData.alignments[revealedRole.role.alignment].color;\n\t\t\t\t\trevealAs = `${revealedRole.role.safeName}`;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!args[0]) return this.parse('/help mafia revealas');\n\t\t\tfor (const targetUsername of args) {\n\t\t\t\tconst player = game.getPlayer(toID(targetUsername));\n\t\t\t\tif (player) {\n\t\t\t\t\tgame.revealRole(user, player, `${revealAs || player.getStylizedRole()}`);\n\t\t\t\t\tgame.logAction(user, `revealed ${player.name}`);\n\t\t\t\t\tif (revealedRole) {\n\t\t\t\t\t\tgame.secretLogAction(user, `fakerevealed ${player.name} as ${revealedRole.role.name}`);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.errorReply(`${targetUsername} is not a player.`);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\trevealrolehelp: [\n\t\t\t`/mafia revealrole [player] - Reveals the role of a player. Requires host % @ # ~`,\n\t\t\t`/mafia revealas [player], [role] - Fakereveals the role of a player as a certain role. Requires host % @ # ~`,\n\t\t],\n\n\t\tunidle: 'idle',\n\t\tunaction: 'idle',\n\t\tnoresponse: 'idle',\n\t\taction: 'idle',\n\t\tidle(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tconst player = game.getPlayer(user.id);\n\t\t\tif (!player) return this.errorReply(`You are not in the game of ${game.title}.`);\n\n\t\t\tif (player.isEliminated()) {\n\t\t\t\treturn this.errorReply(`You have been eliminated from the game and cannot take any actions.`);\n\t\t\t}\n\t\t\tif (game.phase !== 'night') {\n\t\t\t\treturn this.errorReply(`You can only submit an action or idle during the night phase.`);\n\t\t\t}\n\t\t\tif (!game.takeIdles) {\n\t\t\t\treturn this.errorReply(`The host is not accepting idles through the script. Send your action or idle to the host.`);\n\t\t\t}\n\n\t\t\tswitch (cmd) {\n\t\t\tcase 'idle':\n\t\t\t\tplayer.action = false;\n\t\t\t\tuser.sendTo(room, `You have idled.`);\n\t\t\t\tplayer.actionArr[game.dayNum] = 'idle';\n\t\t\t\tbreak;\n\t\t\tcase 'action':\n\t\t\t\tplayer.action = true;\n\t\t\t\tif (target) {\n\t\t\t\t\tplayer.action = target;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.checkBanwords(room, target);\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tthrow new Chat.ErrorMessage(`Your action submission contained a word banned by this room.`);\n\t\t\t\t\t}\n\t\t\t\t\tuser.sendTo(room, `You have decided to use an action, with the following details: ${target}`);\n\t\t\t\t} else {\n\t\t\t\t\tuser.sendTo(room, `You have decided to use an action. Please submit details about your action.`);\n\t\t\t\t}\n\t\t\t\tplayer.actionArr[game.dayNum] = target;\n\t\t\t\tbreak;\n\t\t\tcase 'noresponse': case 'unidle': case 'unaction':\n\t\t\t\tplayer.action = null;\n\t\t\t\tuser.sendTo(room, `You are no longer submitting an action or idle.`);\n\t\t\t\tplayer.actionArr[game.dayNum] = '';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tplayer.updateHtmlRoom();\n\t\t},\n\t\tactionhelp: 'idlehelp',\n\t\tidlehelp: [\n\t\t\t`/mafia idle - Tells the host if you are idling.`,\n\t\t\t`/mafia action [details] - Tells the host you are using an action with the given submission details.`,\n\t\t],\n\n\t\tforceadd: 'add',\n\t\tadd(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (!toID(target)) return this.parse('/help mafia add');\n\t\t\tconst targetUser = Users.get(target);\n\t\t\tif (!targetUser) {\n\t\t\t\tthrow new Chat.ErrorMessage(`The user \"${target}\" was not found.`);\n\t\t\t}\n\t\t\tgame.join(targetUser, user, cmd === 'forceadd');\n\t\t},\n\t\taddhelp: [\n\t\t\t`/mafia add [player] - Add a new player to the game. Requires host % @ # ~`,\n\t\t],\n\n\t\trevive(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (!toID(target)) return this.parse('/help mafia revive');\n\n\t\t\tconst player = game.getPlayer(toID(target));\n\t\t\tif (!player) {\n\t\t\t\tthrow new Chat.ErrorMessage(`\"${target}\" is not currently playing`);\n\t\t\t}\n\t\t\tif (!player.isEliminated()) {\n\t\t\t\tthrow new Chat.ErrorMessage(`${player.name} has not been eliminated.`);\n\t\t\t}\n\n\t\t\tgame.revive(user, player);\n\t\t},\n\t\trevivehelp: [\n\t\t\t`/mafia revive [player] - Revives a player who was eliminated. Requires host % @ # ~`,\n\t\t],\n\n\t\tdl: 'deadline',\n\t\tdeadline(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\ttarget = toID(target);\n\t\t\tif (target && game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (target === 'off') {\n\t\t\t\tgame.setDeadline(0);\n\t\t\t} else {\n\t\t\t\tconst num = parseInt(target);\n\t\t\t\tif (isNaN(num)) {\n\t\t\t\t\t// hack to let hosts broadcast\n\t\t\t\t\tif (game.hostid === user.id || game.cohostids.includes(user.id)) {\n\t\t\t\t\t\tthis.broadcastMessage = this.message.toLowerCase().replace(/[^a-z0-9\\s!,]/g, '');\n\t\t\t\t\t}\n\t\t\t\t\tif (!this.runBroadcast()) return false;\n\n\t\t\t\t\tif ((game.dlAt - Date.now()) > 0) {\n\t\t\t\t\t\treturn this.sendReply(`|raw|The deadline is in ${Chat.toDurationString(game.dlAt - Date.now()) || '0 seconds'}.`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn this.parse(`/help mafia deadline`);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (num < 1 || num > 20) return this.errorReply(`The deadline must be between 1 and 20 minutes.`);\n\t\t\t\tgame.setDeadline(num);\n\t\t\t}\n\t\t\tgame.logAction(user, `changed deadline`);\n\t\t},\n\t\tdeadlinehelp: [\n\t\t\t`/mafia deadline [minutes|off] - Sets or removes the deadline for the game. Cannot be more than 20 minutes.`,\n\t\t],\n\n\t\tapplyvotemodifier: 'applyhammermodifier',\n\t\tapplyhammermodifier(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (!game.started) return this.errorReply(`The game has not started yet.`);\n\t\t\tconst [playerId, mod] = target.split(',');\n\t\t\tconst player = game.getPlayer(toID(playerId));\n\t\t\tif (!player) {\n\t\t\t\tthrow new Chat.ErrorMessage(`The player \"${playerId}\" does not exist.`);\n\t\t\t}\n\n\t\t\tif (cmd === 'applyhammermodifier') {\n\t\t\t\tgame.applyHammerModifier(user, player, parseInt(mod));\n\t\t\t\tgame.secretLogAction(user, `changed a hammer modifier`);\n\t\t\t} else {\n\t\t\t\tgame.applyVoteModifier(user, player, parseInt(mod));\n\t\t\t\tgame.secretLogAction(user, `changed a vote modifier`);\n\t\t\t}\n\t\t},\n\t\tclearvotemodifiers: 'clearhammermodifiers',\n\t\tclearhammermodifiers(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (!game.started) return this.errorReply(`The game has not started yet.`);\n\t\t\tif (cmd === 'clearhammermodifiers') {\n\t\t\t\tgame.clearHammerModifiers(user);\n\t\t\t\tgame.secretLogAction(user, `cleared hammer modifiers`);\n\t\t\t} else {\n\t\t\t\tgame.clearVoteModifiers(user);\n\t\t\t\tgame.secretLogAction(user, `cleared vote modifiers`);\n\t\t\t}\n\t\t},\n\n\t\thate: 'love',\n\t\tunhate: 'love',\n\t\tunlove: 'love',\n\t\tremovehammermodifier: 'love',\n\t\tlove(target, room, user, connection, cmd) {\n\t\t\tlet mod;\n\t\t\tswitch (cmd) {\n\t\t\tcase 'hate':\n\t\t\t\tmod = -1;\n\t\t\t\tbreak;\n\t\t\tcase 'love':\n\t\t\t\tmod = 1;\n\t\t\t\tbreak;\n\t\t\tcase 'unhate': case 'unlove': case 'removehammermodifier':\n\t\t\t\tmod = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis.parse(`/mafia applyhammermodifier ${target}, ${mod}`);\n\t\t},\n\t\tdoublevoter: 'mayor',\n\t\tvoteless: 'mayor',\n\t\tunvoteless: 'mayor',\n\t\tunmayor: 'mayor',\n\t\tremovevotemodifier: 'mayor',\n\t\tmayor(target, room, user, connection, cmd) {\n\t\t\tlet mod;\n\t\t\tswitch (cmd) {\n\t\t\tcase 'doublevoter': case 'mayor':\n\t\t\t\tmod = 2;\n\t\t\t\tbreak;\n\t\t\tcase 'voteless':\n\t\t\t\tmod = 0;\n\t\t\t\tbreak;\n\t\t\tcase 'unvoteless': case 'unmayor': case 'removevotemodifier':\n\t\t\t\tmod = 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tthis.parse(`/mafia applyvotemodifier ${target}, ${mod}`);\n\t\t},\n\n\t\tunsilence: 'silence',\n\t\tsilence(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (!game.started) return this.errorReply(`The game has not started yet.`);\n\n\t\t\ttarget = toID(target);\n\t\t\tconst targetPlayer = game.getPlayer(target as ID);\n\t\t\tconst silence = cmd === 'silence';\n\t\t\tif (!targetPlayer) return this.errorReply(`${target} is not in the game of mafia.`);\n\t\t\tif (silence === targetPlayer.silenced) {\n\t\t\t\treturn this.errorReply(`${targetPlayer.name} is already ${!silence ? 'not' : ''} silenced.`);\n\t\t\t}\n\t\t\ttargetPlayer.silenced = silence;\n\t\t\tthis.sendReply(`${targetPlayer.name} has been ${!silence ? 'un' : ''}silenced.`);\n\t\t\tgame.logAction(user, `${!silence ? 'un' : ''}silenced a player`);\n\t\t},\n\t\tsilencehelp: [\n\t\t\t`/mafia silence [player] - Silences [player], preventing them from talking at all. Requires host % @ # ~`,\n\t\t\t`/mafia unsilence [player] - Removes a silence on [player], allowing them to talk again. Requires host % @ # ~`,\n\t\t],\n\n\t\tinsomniac: 'nighttalk',\n\t\tuninsomniac: 'nighttalk',\n\t\tunnighttalk: 'nighttalk',\n\t\tnighttalk(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (!game.started) return this.errorReply(`The game has not started yet.`);\n\n\t\t\ttarget = toID(target);\n\t\t\tconst targetPlayer = game.getPlayer(target as ID);\n\t\t\tconst nighttalk = !cmd.startsWith('un');\n\t\t\tif (!targetPlayer) return this.errorReply(`${target} is not in the game of mafia.`);\n\t\t\tif (nighttalk === targetPlayer.nighttalk) {\n\t\t\t\treturn this.errorReply(`${targetPlayer.name} is already ${!nighttalk ? 'not' : ''} able to talk during the night.`);\n\t\t\t}\n\t\t\ttargetPlayer.nighttalk = nighttalk;\n\t\t\tthis.sendReply(`${targetPlayer.name} can ${!nighttalk ? 'no longer' : 'now'} talk during the night.`);\n\t\t\tgame.logAction(user, `${!nighttalk ? 'un' : ''}insomniacd a player`);\n\t\t},\n\t\tnighttalkhelp: [\n\t\t\t`/mafia nighttalk [player] - Makes [player] an insomniac, allowing them to talk freely during the night. Requires host % @ # ~`,\n\t\t\t`/mafia unnighttalk [player] - Removes [player] as an insomniac, preventing them from talking during the night. Requires host % @ # ~`,\n\t\t],\n\t\tactor: 'priest',\n\t\tunactor: 'priest',\n\t\tunpriest: 'priest',\n\t\tpriest(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (!game.started) return this.errorReply(`The game has not started yet.`);\n\n\t\t\ttarget = toID(target);\n\t\t\tconst targetPlayer = game.getPlayer(target as ID);\n\t\t\tif (!targetPlayer) return this.errorReply(`${target} is not in the game of mafia.`);\n\n\t\t\tconst actor = cmd.endsWith('actor');\n\t\t\tconst remove = cmd.startsWith('un');\n\t\t\tif (remove) {\n\t\t\t\tif (targetPlayer.hammerRestriction === null) {\n\t\t\t\t\treturn this.errorReply(`${targetPlayer.name} already has no voting restrictions.`);\n\t\t\t\t}\n\t\t\t\tif (actor !== targetPlayer.hammerRestriction) {\n\t\t\t\t\treturn this.errorReply(`${targetPlayer.name} is ${targetPlayer.hammerRestriction ? 'an actor' : 'a priest'}.`);\n\t\t\t\t}\n\t\t\t\ttargetPlayer.hammerRestriction = null;\n\t\t\t\treturn this.sendReply(`${targetPlayer}'s hammer restriction was removed.`);\n\t\t\t}\n\n\t\t\tif (actor === targetPlayer.hammerRestriction) {\n\t\t\t\treturn this.errorReply(`${targetPlayer.name} is already ${targetPlayer.hammerRestriction ? 'an actor' : 'a priest'}.`);\n\t\t\t}\n\t\t\ttargetPlayer.hammerRestriction = actor;\n\t\t\tthis.sendReply(`${targetPlayer.name} is now ${targetPlayer.hammerRestriction ? \"an actor (can only hammer)\" : \"a priest (can't hammer)\"}.`);\n\t\t\tif (actor) {\n\t\t\t\t// target is an actor, remove their vote because it's now impossible\n\t\t\t\tgame.unvote(targetPlayer, true);\n\t\t\t}\n\t\t\tgame.logAction(user, `made a player actor/priest`);\n\t\t},\n\t\tpriesthelp: [\n\t\t\t`/mafia (un)priest [player] - Makes [player] a priest, preventing them from placing the hammer vote. Requires host % @ # ~`,\n\t\t\t`/mafia (un)actor [player] - Makes [player] an actor, preventing them from placing non-hammer votes. Requires host % @ # ~`,\n\t\t],\n\n\t\tshifthammer: 'hammer',\n\t\tresethammer: 'hammer',\n\t\thammer(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (!game.started) return this.errorReply(`The game has not started yet.`);\n\t\t\tconst hammer = parseInt(target);\n\t\t\tif (toID(cmd) !== `resethammer` && ((isNaN(hammer) && !this.meansNo(target)) || hammer < 1)) {\n\t\t\t\treturn this.errorReply(`${target} is not a valid hammer count.`);\n\t\t\t}\n\t\t\tswitch (cmd.toLowerCase()) {\n\t\t\tcase 'shifthammer':\n\t\t\t\tgame.shiftHammer(hammer);\n\t\t\t\tbreak;\n\t\t\tcase 'hammer':\n\t\t\t\tgame.setHammer(hammer);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tgame.resetHammer();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tgame.logAction(user, `changed the hammer`);\n\t\t},\n\t\thammerhelp: [\n\t\t\t`/mafia hammer [hammer] - sets the hammer count to [hammer] and resets votes`,\n\t\t\t`/mafia hammer off - disables hammering`,\n\t\t\t`/mafia shifthammer [hammer] - sets the hammer count to [hammer] without resetting votes`,\n\t\t\t`/mafia resethammer - sets the hammer to the default, resetting votes`,\n\t\t],\n\n\t\tvl: 'votelock',\n\t\tvotelock(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tconst action = toID(target);\n\t\t\tif (this.meansYes(action)) {\n\t\t\t\tgame.setVotelock(user, true);\n\t\t\t} else if (this.meansNo(action)) {\n\t\t\t\tgame.setVotelock(user, false);\n\t\t\t} else {\n\t\t\t\treturn this.parse('/help mafia votelock');\n\t\t\t}\n\t\t\tgame.logAction(user, `changed votelock status`);\n\t\t},\n\t\tvotelockhelp: [\n\t\t\t`/mafia votelock [on|off] - Allows or disallows players to change their vote. Requires host % @ # ~`,\n\t\t],\n\n\t\tvoting: 'votesall',\n\t\tvotesall(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tconst action = toID(target);\n\t\t\tif (this.meansYes(action)) {\n\t\t\t\tgame.setVoting(user, true);\n\t\t\t} else if (this.meansNo(action)) {\n\t\t\t\tgame.setVoting(user, false);\n\t\t\t} else {\n\t\t\t\treturn this.parse('/help mafia voting');\n\t\t\t}\n\t\t\tgame.logAction(user, `changed voting status`);\n\t\t},\n\t\tvotinghelp: [\n\t\t\t`/mafia voting [on|off] - Allows or disallows players to vote. Requires host % @ # ~`,\n\t\t],\n\n\t\tenablenv: 'enablenl',\n\t\tdisablenv: 'enablenl',\n\t\tdisablenl: 'enablenl',\n\t\tenablenl(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (cmd === 'enablenl' || cmd === 'enablenv') {\n\t\t\t\tgame.setNoVote(user, true);\n\t\t\t} else {\n\t\t\t\tgame.setNoVote(user, false);\n\t\t\t}\n\t\t\tgame.logAction(user, `changed novote status`);\n\t\t},\n\t\tenablenlhelp: [\n\t\t\t`/mafia [enablenv|disablenv] - Allows or disallows players abstain from voting. Requires host % @ # ~`,\n\t\t],\n\n\t\tforcevote(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\ttarget = toID(target);\n\t\t\tif (this.meansYes(target)) {\n\t\t\t\tif (game.forceVote) return this.errorReply(`Forcevoting is already enabled.`);\n\t\t\t\tgame.forceVote = true;\n\t\t\t\tif (game.started) game.resetHammer();\n\t\t\t\tgame.sendDeclare(`Forcevoting has been enabled. Your vote will start on yourself, and you cannot unvote!`);\n\t\t\t} else if (this.meansNo(target)) {\n\t\t\t\tif (!game.forceVote) return this.errorReply(`Forcevoting is already disabled.`);\n\t\t\t\tgame.forceVote = false;\n\t\t\t\tgame.sendDeclare(`Forcevoting has been disabled. You can vote normally now!`);\n\t\t\t} else {\n\t\t\t\tthis.parse('/help mafia forcevote');\n\t\t\t}\n\t\t\tgame.logAction(user, `changed forcevote status`);\n\t\t},\n\t\tforcevotehelp: [\n\t\t\t`/mafia forcevote [yes/no] - Forces players' votes onto themselves, and prevents unvoting. Requires host % @ # ~`,\n\t\t],\n\n\t\tvotes(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (!game.started) return this.errorReply(`The game of mafia has not started yet.`);\n\n\t\t\t// hack to let hosts broadcast\n\t\t\tif (game.hostid === user.id || game.cohostids.includes(user.id)) {\n\t\t\t\tthis.broadcastMessage = this.message.toLowerCase().replace(/[^a-z0-9\\s!,]/g, '');\n\t\t\t}\n\t\t\tif (!this.runBroadcast()) return false;\n\n\t\t\tthis.sendReplyBox(game.voteBox());\n\t\t},\n\n\t\tpl: 'players',\n\t\tplayers(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\n\t\t\t// hack to let hosts broadcast\n\t\t\tif (game.hostid === user.id || game.cohostids.includes(user.id)) {\n\t\t\t\tthis.broadcastMessage = this.message.toLowerCase().replace(/[^a-z0-9\\s!,]/g, '');\n\t\t\t}\n\t\t\tif (!this.runBroadcast()) return false;\n\n\t\t\tif (this.broadcasting) {\n\t\t\t\tgame.sendPlayerList();\n\t\t\t} else {\n\t\t\t\tconst players = game.getRemainingPlayers();\n\t\t\t\tthis.sendReplyBox(`Players (${players.length}): ${players.map(p => p.safeName).sort().join(', ')}`);\n\t\t\t}\n\t\t},\n\n\t\toriginalrolelist: 'rolelist',\n\t\torl: 'rolelist',\n\t\trl: 'rolelist',\n\t\trolelist(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.closedSetup) return this.errorReply(`You cannot show roles in a closed setup.`);\n\t\t\tif (!this.runBroadcast()) return false;\n\t\t\tif (game.IDEA.data) {\n\t\t\t\tconst buf = `
IDEA roles:${game.IDEA.data.roles.join(`
`)}
`;\n\t\t\t\treturn this.sendReplyBox(buf);\n\t\t\t}\n\t\t\tconst showOrl = (['orl', 'originalrolelist'].includes(cmd) || game.noReveal);\n\t\t\tconst roleString = Utils.sortBy((showOrl ? game.originalRoles : game.roles), role => (\n\t\t\t\trole.alignment\n\t\t\t)).map(role => role.safeName).join(', ');\n\n\t\t\tthis.sendReplyBox(`${showOrl ? `Original Rolelist: ` : `Rolelist: `}${roleString}`);\n\t\t},\n\n\t\tplayerroles(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) {\n\t\t\t\treturn this.errorReply(`Only the host can view roles.`);\n\t\t\t}\n\t\t\tif (!game.started) return this.errorReply(`The game has not started.`);\n\t\t\tthis.sendReplyBox(game.players.map(\n\t\t\t\tp => `${p.safeName}: ${p.role ? (p.role.alignment === 'solo' ? 'Solo ' : '') + p.role.safeName : 'No role'}`\n\t\t\t).join('
'));\n\t\t},\n\n\t\tspectate: 'view',\n\t\tview(target, room, user, connection) {\n\t\t\troom = this.requireRoom();\n\t\t\tthis.requireGame(Mafia);\n\t\t\tif (!this.runBroadcast()) return;\n\t\t\tif (this.broadcasting) {\n\t\t\t\treturn this.sendReplyBox(``);\n\t\t\t}\n\t\t\treturn this.parse(`/join view-mafia-${room.roomid}`);\n\t\t},\n\n\t\trefreshvotes(target, room, user, connection) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tconst votes = game.voteBoxFor(user.id);\n\t\t\tuser.send(`>view-mafia-${game.room.roomid}\\n|selectorhtml|#mafia-votes|` + votes);\n\t\t},\n\t\tforcesub: 'sub',\n\t\tsub(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tconst args = target.split(',');\n\t\t\tconst action = toID(args.shift());\n\t\t\tconst player = game.getPlayer(user.id);\n\n\t\t\tswitch (action) {\n\t\t\tcase 'in':\n\t\t\t\tif (player) {\n\t\t\t\t\t// Check if they have requested to be subbed out.\n\t\t\t\t\tif (!game.requestedSub.includes(user.id)) {\n\t\t\t\t\t\treturn this.errorReply(`You have not requested to be subbed out.`);\n\t\t\t\t\t}\n\t\t\t\t\tgame.requestedSub.splice(game.requestedSub.indexOf(user.id), 1);\n\t\t\t\t\tthis.errorReply(`You have cancelled your request to sub out.`);\n\t\t\t\t\tplayer.updateHtmlRoom();\n\t\t\t\t} else {\n\t\t\t\t\tthis.checkChat(null, room);\n\t\t\t\t\tif (game.subs.includes(user.id)) return this.errorReply(`You are already on the sub list.`);\n\t\t\t\t\tif (game.played.includes(user.id)) return this.errorReply(`You cannot sub back into the game.`);\n\t\t\t\t\t// Change this to game.canJoin(user, true, true) if you're trying to test something sub related locally.\n\t\t\t\t\tgame.canJoin(user, true);\n\t\t\t\t\tgame.subs.push(user.id);\n\t\t\t\t\tgame.nextSub();\n\t\t\t\t\t// Update spectator's view\n\t\t\t\t\tthis.parse(`/join view-mafia-${room.roomid}`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'out':\n\t\t\t\tif (player) {\n\t\t\t\t\tif (player.isEliminated()) {\n\t\t\t\t\t\treturn this.errorReply(`You cannot request to be subbed out once eliminated.`);\n\t\t\t\t\t}\n\t\t\t\t\tif (game.requestedSub.includes(user.id)) {\n\t\t\t\t\t\treturn this.errorReply(`You have already requested to be subbed out.`);\n\t\t\t\t\t}\n\t\t\t\t\tgame.requestedSub.push(user.id);\n\t\t\t\t\tplayer.updateHtmlRoom();\n\t\t\t\t\tgame.nextSub();\n\t\t\t\t} else {\n\t\t\t\t\tif (game.hostid === user.id || game.cohostids.includes(user.id)) {\n\t\t\t\t\t\treturn this.errorReply(`The host cannot sub out of the game.`);\n\t\t\t\t\t}\n\t\t\t\t\tif (!game.subs.includes(user.id)) return this.errorReply(`You are not on the sub list.`);\n\t\t\t\t\tgame.subs.splice(game.subs.indexOf(user.id), 1);\n\t\t\t\t\t// Update spectator's view\n\t\t\t\t\tthis.parse(`/join view-mafia-${room.roomid}`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'next':\n\t\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\t\tconst toSub = args.shift();\n\t\t\t\tif (!game.getPlayer(toID(toSub))) return this.errorReply(`${toSub} is not in the game.`);\n\t\t\t\tif (!game.subs.length) {\n\t\t\t\t\tif (game.hostRequestedSub.includes(toID(toSub))) {\n\t\t\t\t\t\treturn this.errorReply(`${toSub} is already on the list to be subbed out.`);\n\t\t\t\t\t}\n\t\t\t\t\tuser.sendTo(\n\t\t\t\t\t\troom,\n\t\t\t\t\t\t`|error|There are no subs to replace ${toSub}, they will be subbed if a sub is available before they speak next.`\n\t\t\t\t\t);\n\t\t\t\t\tgame.hostRequestedSub.unshift(toID(toSub));\n\t\t\t\t} else {\n\t\t\t\t\tgame.nextSub(toID(toSub));\n\t\t\t\t}\n\t\t\t\tgame.logAction(user, `requested a sub for a player`);\n\t\t\t\tbreak;\n\t\t\tcase 'remove':\n\t\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\t\tfor (const toRemove of args) {\n\t\t\t\t\tconst toRemoveIndex = game.subs.indexOf(toID(toRemove));\n\t\t\t\t\tif (toRemoveIndex === -1) {\n\t\t\t\t\t\tuser.sendTo(room, `|error|${toRemove} is not on the sub list.`);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tgame.subs.splice(toRemoveIndex, 1);\n\t\t\t\t\tuser.sendTo(room, `${toRemove} has been removed from the sublist`);\n\t\t\t\t\tgame.logAction(user, `removed a player from the sublist`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'unrequest':\n\t\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\t\tconst toUnrequest = toID(args.shift());\n\t\t\t\tconst userIndex = game.requestedSub.indexOf(toUnrequest);\n\t\t\t\tconst hostIndex = game.hostRequestedSub.indexOf(toUnrequest);\n\t\t\t\tif (userIndex < 0 && hostIndex < 0) return user.sendTo(room, `|error|${toUnrequest} is not requesting a sub.`);\n\t\t\t\tif (userIndex > -1) {\n\t\t\t\t\tgame.requestedSub.splice(userIndex, 1);\n\t\t\t\t\tuser.sendTo(room, `${toUnrequest}'s sub request has been removed.`);\n\t\t\t\t}\n\t\t\t\tif (hostIndex > -1) {\n\t\t\t\t\tgame.hostRequestedSub.splice(userIndex, 1);\n\t\t\t\t\tuser.sendTo(room, `${toUnrequest} has been removed from the host sublist.`);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\t\tconst toSubOut = game.getPlayer(action);\n\t\t\t\tconst toSubIn = toID(args.shift());\n\t\t\t\tif (!toSubOut) return this.errorReply(`${toSubOut} is not in the game.`);\n\n\t\t\t\tconst targetUser = Users.get(toSubIn);\n\t\t\t\tif (!targetUser) return this.errorReply(`The user \"${toSubIn}\" was not found.`);\n\t\t\t\tgame.canJoin(targetUser, false, cmd === 'forcesub');\n\t\t\t\tif (game.subs.includes(targetUser.id)) {\n\t\t\t\t\tgame.subs.splice(game.subs.indexOf(targetUser.id), 1);\n\t\t\t\t}\n\t\t\t\tif (game.hostRequestedSub.includes(toSubOut.id)) {\n\t\t\t\t\tgame.hostRequestedSub.splice(game.hostRequestedSub.indexOf(toSubOut.id), 1);\n\t\t\t\t}\n\t\t\t\tif (game.requestedSub.includes(toSubOut.id)) {\n\t\t\t\t\tgame.requestedSub.splice(game.requestedSub.indexOf(toSubOut.id), 1);\n\t\t\t\t}\n\n\t\t\t\tgame.sub(toSubOut, targetUser);\n\t\t\t\tgame.logAction(user, `substituted a player`);\n\t\t\t}\n\t\t},\n\t\tsubhelp: [\n\t\t\t`/mafia sub in - Request to sub into the game, or cancel a request to sub out.`,\n\t\t\t`/mafia sub out - Request to sub out of the game, or cancel a request to sub in.`,\n\t\t\t`/mafia sub next, [player] - Forcibly sub [player] out of the game. Requires host % @ # ~`,\n\t\t\t`/mafia sub remove, [user] - Remove [user] from the sublist. Requres host % @ # ~`,\n\t\t\t`/mafia sub unrequest, [player] - Remove's a player's request to sub out of the game. Requires host % @ # ~`,\n\t\t\t`/mafia sub [player], [user] - Forcibly sub [player] for [user]. Requires host % @ # ~`,\n\t\t],\n\n\t\tautosub(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('mute', null, room);\n\t\t\tif (this.meansYes(toID(target))) {\n\t\t\t\tif (game.autoSub) return this.errorReply(`Automatic subbing of players is already enabled.`);\n\t\t\t\tgame.autoSub = true;\n\t\t\t\tuser.sendTo(room, `Automatic subbing of players has been enabled.`);\n\t\t\t\tgame.nextSub();\n\t\t\t} else if (this.meansNo(toID(target))) {\n\t\t\t\tif (!game.autoSub) return this.errorReply(`Automatic subbing of players is already disabled.`);\n\t\t\t\tgame.autoSub = false;\n\t\t\t\tuser.sendTo(room, `Automatic subbing of players has been disabled.`);\n\t\t\t} else {\n\t\t\t\treturn this.parse(`/help mafia autosub`);\n\t\t\t}\n\t\t\tgame.logAction(user, `changed autosub status`);\n\t\t},\n\t\tautosubhelp: [\n\t\t\t`/mafia autosub [yes|no] - Sets if players will automatically sub out if a user is on the sublist. Requires host % @ # ~`,\n\t\t],\n\n\t\tcohost: 'subhost',\n\t\tsubhost(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tthis.checkChat();\n\t\t\tif (!target) return this.parse(`/help mafia ${cmd}`);\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst { targetUser } = this.requireUser(target);\n\t\t\tif (!room.users[targetUser.id]) return this.errorReply(`${targetUser.name} is not in this room, and cannot be hosted.`);\n\t\t\tif (game.hostid === targetUser.id) return this.errorReply(`${targetUser.name} is already the host.`);\n\t\t\tif (game.cohostids.includes(targetUser.id)) return this.errorReply(`${targetUser.name} is already a cohost.`);\n\n\t\t\tif (game.getPlayer(targetUser.id)) {\n\t\t\t\treturn this.errorReply(`${targetUser.name} cannot become a host because they are playing.`);\n\t\t\t}\n\n\t\t\tif (game.subs.includes(targetUser.id)) game.subs.splice(game.subs.indexOf(targetUser.id), 1);\n\t\t\tif (cmd.includes('cohost')) {\n\t\t\t\tgame.cohostids.push(targetUser.id);\n\t\t\t\tgame.cohosts.push(Utils.escapeHTML(targetUser.name));\n\t\t\t\tgame.sendDeclare(Utils.html`${targetUser.name} has been added as a cohost by ${user.name}`);\n\t\t\t\tfor (const conn of targetUser.connections) {\n\t\t\t\t\tvoid Chat.resolvePage(`view-mafia-${room.roomid}`, targetUser, conn);\n\t\t\t\t}\n\t\t\t\tthis.modlog('MAFIACOHOST', targetUser, null, { noalts: true, noip: true });\n\t\t\t} else {\n\t\t\t\tconst oldHostid = game.hostid;\n\t\t\t\tconst oldHost = Users.get(game.hostid);\n\t\t\t\tif (oldHost) oldHost.send(`>view-mafia-${room.roomid}\\n|deinit`);\n\t\t\t\tconst queueIndex = hostQueue.indexOf(targetUser.id);\n\t\t\t\tif (queueIndex > -1) hostQueue.splice(queueIndex, 1);\n\t\t\t\tgame.host = Utils.escapeHTML(targetUser.name);\n\t\t\t\tgame.hostid = targetUser.id;\n\t\t\t\tgame.played.push(targetUser.id);\n\t\t\t\tfor (const conn of targetUser.connections) {\n\t\t\t\t\tvoid Chat.resolvePage(`view-mafia-${room.roomid}`, targetUser, conn);\n\t\t\t\t}\n\t\t\t\tgame.sendDeclare(Utils.html`${targetUser.name} has been substituted as the new host, replacing ${oldHostid}.`);\n\t\t\t\tthis.modlog('MAFIASUBHOST', targetUser, `replacing ${oldHostid}`, { noalts: true, noip: true });\n\t\t\t}\n\t\t},\n\t\tsubhosthelp: [`/mafia subhost [user] - Substitues the user as the new game host.`],\n\t\tcohosthelp: [\n\t\t\t`/mafia cohost [user] - Adds the user as a cohost. Cohosts can talk during the game, as well as perform host actions.`,\n\t\t],\n\n\t\tuncohost: 'removecohost',\n\t\tremovecohost(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tthis.checkChat();\n\t\t\tif (!target) return this.parse('/help mafia subhost');\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst targetID = toID(target);\n\n\t\t\tconst cohostIndex = game.cohostids.indexOf(targetID);\n\t\t\tif (cohostIndex < 0) {\n\t\t\t\tif (game.hostid === targetID) {\n\t\t\t\t\treturn this.errorReply(`${target} is the host, not a cohost. Use /mafia subhost to replace them.`);\n\t\t\t\t}\n\t\t\t\treturn this.errorReply(`${target} is not a cohost.`);\n\t\t\t}\n\t\t\tgame.cohostids.splice(cohostIndex, 1);\n\t\t\tgame.sendDeclare(Utils.html`${target} was removed as a cohost by ${user.name}`);\n\t\t\tthis.modlog('MAFIAUNCOHOST', target, null, { noalts: true, noip: true });\n\t\t},\n\n\t\tend(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tconst game = this.requireGame(Mafia);\n\t\t\tif (game.hostid !== user.id && !game.cohostids.includes(user.id)) this.checkCan('show', null, room);\n\t\t\tgame.end();\n\t\t\tthis.modlog('MAFIAEND', null);\n\t\t},\n\t\tendhelp: [`/mafia end - End the current game of mafia. Requires host + % @ # ~`],\n\n\t\trole: 'data',\n\t\talignment: 'data',\n\t\ttheme: 'data',\n\t\tterm: 'data',\n\t\tdt: 'data',\n\t\tdata(target, room, user, connection, cmd) {\n\t\t\tif (room?.settings.mafiaDisabled) return this.errorReply(`Mafia is disabled for this room.`);\n\t\t\tif (cmd === 'role' && !target && room) {\n\t\t\t\t// Support /mafia role showing your current role if you're in a game\n\t\t\t\tconst game = room.getGame(Mafia);\n\t\t\t\tif (!game) {\n\t\t\t\t\treturn this.errorReply(`There is no game of mafia running in this room. If you meant to display information about a role, use /mafia role [role name]`);\n\t\t\t\t}\n\n\t\t\t\tconst player = game.getPlayer(user.id);\n\t\t\t\tif (!player) return this.errorReply(`You are not in the game of ${game.title}.`);\n\t\t\t\tconst role = player.role;\n\t\t\t\tif (!role) return this.errorReply(`You do not have a role yet.`);\n\t\t\t\treturn this.sendReplyBox(`Your role is: ${role.safeName}`);\n\t\t\t}\n\n\t\t\t// hack to let hosts broadcast\n\t\t\tconst game = room?.getGame(Mafia);\n\t\t\tif (game && (game.hostid === user.id || game.cohostids.includes(user.id))) {\n\t\t\t\tthis.broadcastMessage = this.message.toLowerCase().replace(/[^a-z0-9\\s!,]/g, '');\n\t\t\t}\n\t\t\tif (!this.runBroadcast()) return false;\n\n\t\t\tif (!target) return this.parse(`/help mafia data`);\n\n\t\t\ttarget = toID(target);\n\t\t\tif (target in MafiaData.aliases) target = MafiaData.aliases[target];\n\n\t\t\tlet result: MafiaDataAlignment | MafiaDataRole | MafiaDataTheme | MafiaDataIDEA | MafiaDataTerm | null = null;\n\t\t\tlet dataType = cmd;\n\n\t\t\tconst cmdTypes: { [k: string]: keyof MafiaData } = {\n\t\t\t\trole: 'roles', alignment: 'alignments', theme: 'themes', term: 'terms', idea: 'IDEAs',\n\t\t\t};\n\n\t\t\tif (cmd in cmdTypes) {\n\t\t\t\tconst toSearch = MafiaData[cmdTypes[cmd]];\n\t\t\t\t// @ts-expect-error guaranteed not an alias\n\t\t\t\tresult = toSearch[target];\n\t\t\t} else {\n\t\t\t\t// search everything\n\t\t\t\tfor (const [cmdType, dataKey] of Object.entries(cmdTypes)) {\n\t\t\t\t\tif (target in MafiaData[dataKey]) {\n\t\t\t\t\t\t// @ts-expect-error guaranteed not an alias\n\t\t\t\t\t\tresult = MafiaData[dataKey][target];\n\t\t\t\t\t\tdataType = cmdType;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!result) return this.errorReply(`\"${target}\" is not a valid mafia alignment, role, theme, or IDEA.`);\n\n\t\t\t// @ts-expect-error property access\n\t\t\tlet buf = `${result.name}Type: ${dataType}
`;\n\t\t\tif (dataType === 'theme') {\n\t\t\t\tif ((result as MafiaDataTheme).desc) {\n\t\t\t\t\tbuf += `Description: ${(result as MafiaDataTheme).desc}
Setups:`;\n\t\t\t\t}\n\t\t\t\tfor (const i in result) {\n\t\t\t\t\tconst num = parseInt(i);\n\t\t\t\t\tif (isNaN(num)) continue;\n\t\t\t\t\tbuf += `${i}: `;\n\t\t\t\t\tconst count: { [k: string]: number } = {};\n\t\t\t\t\tconst roles = [];\n\t\t\t\t\tfor (const role of (result as MafiaDataTheme)[num].split(',').map((x: string) => x.trim())) {\n\t\t\t\t\t\tcount[role] = count[role] ? count[role] + 1 : 1;\n\t\t\t\t\t}\n\t\t\t\t\tfor (const role in count) {\n\t\t\t\t\t\troles.push(count[role] > 1 ? `${count[role]}x ${role}` : role);\n\t\t\t\t\t}\n\t\t\t\t\tbuf += `${roles.join(', ')}
`;\n\t\t\t\t}\n\t\t\t} else if (dataType === 'idea') {\n\t\t\t\tif ((result as MafiaDataIDEA).picks && (result as MafiaDataIDEA).choices) {\n\t\t\t\t\tbuf += `Number of Picks: ${(result as MafiaDataIDEA).picks.length} (${(result as MafiaDataIDEA).picks.join(', ')})
`;\n\t\t\t\t\tbuf += `Number of Choices: ${(result as MafiaDataIDEA).choices}
`;\n\t\t\t\t}\n\t\t\t\tbuf += `
Roles:`;\n\t\t\t\tfor (const idearole of (result as MafiaDataIDEA).roles) {\n\t\t\t\t\tbuf += `${idearole}
`;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (result.memo) buf += `${result.memo.join('
')}`;\n\t\t\t}\n\t\t\treturn this.sendReplyBox(buf);\n\t\t},\n\t\tdatahelp: [\n\t\t\t`/mafia data [alignment|role|modifier|theme|term] - Get information on a mafia alignment, role, modifier, theme, or term.`,\n\t\t],\n\n\t\twinfaction: 'win',\n\t\tunwinfaction: 'win',\n\t\tunwin: 'win',\n\t\twin(target, room, user, connection, cmd) {\n\t\t\tconst isUnwin = cmd.startsWith('unwin');\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tif (!room || room.settings.mafiaDisabled) return this.errorReply(`Mafia is disabled for this room.`);\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst args = target.split(',');\n\t\t\tlet points = parseInt(args[0]);\n\t\t\tif (isUnwin) {\n\t\t\t\tpoints *= -1;\n\t\t\t}\n\t\t\tif (isNaN(points)) {\n\t\t\t\tpoints = 10;\n\t\t\t\tif (isUnwin) {\n\t\t\t\t\tpoints *= -1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (points > 100 || points < -100) {\n\t\t\t\t\treturn this.errorReply(`You cannot give or take more than 100 points at a time.`);\n\t\t\t\t}\n\t\t\t\t// shift out the point count\n\t\t\t\targs.shift();\n\t\t\t}\n\t\t\tif (!args.length) return this.parse('/help mafia win');\n\t\t\tconst month = new Date().toLocaleString(\"en-us\", { month: \"numeric\", year: \"numeric\" });\n\t\t\tif (!logs.leaderboard[month]) logs.leaderboard[month] = {};\n\n\t\t\tlet toGiveTo = [];\n\t\t\tlet buf = `${points < 0 ? points * -1 : points} point${Chat.plural(points, 's were', ' was')} ${points <= 0 ? 'taken from ' : 'awarded to '} `;\n\t\t\tif (cmd === 'winfaction' || cmd === 'unwinfaction') {\n\t\t\t\tconst game = this.requireGame(Mafia);\n\t\t\t\tfor (let faction of args) {\n\t\t\t\t\tfaction = toID(faction);\n\t\t\t\t\tconst inFaction = [];\n\t\t\t\t\tfor (const player of game.players) {\n\t\t\t\t\t\tif (player.role && toID(player.role.alignment) === faction) {\n\t\t\t\t\t\t\ttoGiveTo.push(player.id);\n\t\t\t\t\t\t\tinFaction.push(player.id);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (inFaction.length) buf += ` the ${faction} faction: ${inFaction.join(', ')};`;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttoGiveTo = args;\n\t\t\t\tbuf += toGiveTo.join(', ');\n\t\t\t}\n\t\t\tif (!toGiveTo.length) return this.parse('/help mafia win');\n\t\t\tlet gavePoints = false;\n\t\t\tfor (let u of toGiveTo) {\n\t\t\t\tu = toID(u);\n\t\t\t\tif (!u) continue;\n\t\t\t\tif (!gavePoints) gavePoints = true;\n\t\t\t\tif (!logs.leaderboard[month][u]) logs.leaderboard[month][u] = 0;\n\t\t\t\tlogs.leaderboard[month][u] += points;\n\t\t\t\tif (logs.leaderboard[month][u] === 0) delete logs.leaderboard[month][u];\n\t\t\t}\n\t\t\tif (!gavePoints) return this.parse('/help mafia win');\n\t\t\twriteFile(LOGS_FILE, logs);\n\t\t\tthis.modlog(`MAFIAPOINTS`, null, `${points < 0 ? points * -1 : points} points were ${points < 0 ? 'taken from' : 'awarded to'} ${Chat.toListString(toGiveTo)}`);\n\t\t\troom.add(buf).update();\n\t\t},\n\t\twinhelp: [\n\t\t\t`/mafia (un)win (points), [user1], [user2], [user3], ... - Award the specified users points to the mafia leaderboard for this month. The amount of points can be negative to take points. Defaults to 10 points.`,\n\t\t\t`/mafia (un)winfaction (points), [faction] - Award the specified points to all the players in the given faction.`,\n\t\t],\n\n\t\tunmvp: 'mvp',\n\t\tmvp(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tif (!room || room.settings.mafiaDisabled) return this.errorReply(`Mafia is disabled for this room.`);\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst args = target.split(',');\n\t\t\tif (!args.length) return this.parse('/help mafia mvp');\n\t\t\tconst month = new Date().toLocaleString(\"en-us\", { month: \"numeric\", year: \"numeric\" });\n\t\t\tif (!logs.mvps[month]) logs.mvps[month] = {};\n\t\t\tif (!logs.leaderboard[month]) logs.leaderboard[month] = {};\n\t\t\tlet gavePoints = false;\n\t\t\tfor (let u of args) {\n\t\t\t\tu = toID(u);\n\t\t\t\tif (!u) continue;\n\t\t\t\tif (!gavePoints) gavePoints = true;\n\t\t\t\tif (!logs.leaderboard[month][u]) logs.leaderboard[month][u] = 0;\n\t\t\t\tif (!logs.mvps[month][u]) logs.mvps[month][u] = 0;\n\t\t\t\tif (cmd === 'unmvp') {\n\t\t\t\t\tlogs.mvps[month][u]--;\n\t\t\t\t\tlogs.leaderboard[month][u] -= 10;\n\t\t\t\t\tif (logs.mvps[month][u] === 0) delete logs.mvps[month][u];\n\t\t\t\t\tif (logs.leaderboard[month][u] === 0) delete logs.leaderboard[month][u];\n\t\t\t\t} else {\n\t\t\t\t\tlogs.mvps[month][u]++;\n\t\t\t\t\tlogs.leaderboard[month][u] += 10;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!gavePoints) return this.parse('/help mafia mvp');\n\t\t\twriteFile(LOGS_FILE, logs);\n\t\t\tthis.modlog(`MAFIA${cmd.toUpperCase()}`, null, `MVP and 10 points were ${cmd === 'unmvp' ? 'taken from' : 'awarded to'} ${Chat.toListString(args)}`);\n\t\t\troom.add(`MVP and 10 points were ${cmd === 'unmvp' ? 'taken from' : 'awarded to'}: ${Chat.toListString(args)}`).update();\n\t\t},\n\t\tmvphelp: [\n\t\t\t`/mafia mvp [user1], [user2], ... - Gives a MVP point and 10 leaderboard points to the users specified.`,\n\t\t\t`/mafia unmvp [user1], [user2], ... - Takes away a MVP point and 10 leaderboard points from the users specified.`,\n\t\t],\n\n\t\thostlogs: 'leaderboard',\n\t\tplaylogs: 'leaderboard',\n\t\tleaverlogs: 'leaderboard',\n\t\tmvpladder: 'leaderboard',\n\t\tlb: 'leaderboard',\n\t\tleaderboard(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tif (!room || room.settings.mafiaDisabled) return this.errorReply(`Mafia is disabled for this room.`);\n\t\t\tif (['hostlogs', 'playlogs', 'leaverlogs'].includes(cmd)) {\n\t\t\t\tthis.checkCan('mute', null, room);\n\t\t\t} else {\n\t\t\t\t// Deny broadcasting host/playlogs\n\t\t\t\tif (!this.runBroadcast()) return;\n\t\t\t}\n\t\t\tif (cmd === 'lb') cmd = 'leaderboard';\n\t\t\tif (this.broadcasting) {\n\t\t\t\treturn this.sendReplyBox(``);\n\t\t\t}\n\t\t\treturn this.parse(`/join view-mafialadder-${cmd}`);\n\t\t},\n\t\tleaderboardhelp: [\n\t\t\t`/mafia [leaderboard|mvpladder] - View the leaderboard or MVP ladder for the current or last month.`,\n\t\t\t`/mafia [hostlogs|playlogs|leaverlogs] - View the host, play, or leaver logs for the current or last month. Requires % @ # ~`,\n\t\t],\n\n\t\tgameban: 'hostban',\n\t\thostban(target, room, user, connection, cmd) {\n\t\t\tif (!target) return this.parse('/help mafia hostban');\n\t\t\troom = this.requireRoom();\n\t\t\tthis.checkCan('warn', null, room);\n\n\t\t\tconst { targetUser, rest } = this.requireUser(target);\n\t\t\tconst [string1, string2] = this.splitOne(rest);\n\t\t\tlet duration, reason;\n\t\t\tif (parseInt(string1)) {\n\t\t\t\tduration = parseInt(string1);\n\t\t\t\treason = string2;\n\t\t\t} else {\n\t\t\t\tduration = parseInt(string2);\n\t\t\t\treason = string1;\n\t\t\t}\n\n\t\t\tif (!duration) duration = 2;\n\t\t\tif (!reason) reason = '';\n\t\t\tif (reason.length > 300) {\n\t\t\t\treturn this.errorReply(\"The reason is too long. It cannot exceed 300 characters.\");\n\t\t\t}\n\n\t\t\tconst userid = toID(targetUser);\n\t\t\tif (Punishments.hasRoomPunishType(room, userid, `MAFIA${this.cmd.toUpperCase()}`)) {\n\t\t\t\treturn this.errorReply(`User '${targetUser.name}' is already ${this.cmd}ned in this room.`);\n\t\t\t} else if (Punishments.hasRoomPunishType(room, userid, `MAFIAGAMEBAN`)) {\n\t\t\t\treturn this.errorReply(`User '${targetUser.name}' is already gamebanned in this room, which also means they can't host.`);\n\t\t\t} else if (Punishments.hasRoomPunishType(room, userid, `MAFIAHOSTBAN`)) {\n\t\t\t\tuser.sendTo(room, `User '${targetUser.name}' is already hostbanned in this room, but they will now be gamebanned.`);\n\t\t\t\tthis.parse(`/mafia unhostban ${targetUser.name}`);\n\t\t\t}\n\n\t\t\tif (cmd === 'hostban') {\n\t\t\t\tMafia.hostBan(room, targetUser, reason, duration);\n\t\t\t} else {\n\t\t\t\tMafia.gameBan(room, targetUser, reason, duration);\n\t\t\t}\n\n\t\t\tthis.modlog(`MAFIA${cmd.toUpperCase()}`, targetUser, reason);\n\t\t\tthis.privateModAction(`${targetUser.name} was banned from ${cmd === 'hostban' ? 'hosting' : 'playing'} mafia games by ${user.name}.`);\n\t\t},\n\t\thostbanhelp: [\n\t\t\t`/mafia (un)hostban [user], [reason], [duration] - Ban a user from hosting games for [duration] days. Requires % @ # ~`,\n\t\t\t`/mafia (un)gameban [user], [reason], [duration] - Ban a user from playing games for [duration] days. Requires % @ # ~`,\n\t\t],\n\n\t\tban: 'gamebanhelp',\n\t\tbanhelp: 'gamebanhelp',\n\t\tgamebanhelp() {\n\t\t\tthis.parse('/mafia hostbanhelp');\n\t\t},\n\n\t\tungameban: 'unhostban',\n\t\tunhostban(target, room, user, connection, cmd) {\n\t\t\tif (!target) return this.parse('/help mafia hostban');\n\t\t\troom = this.requireRoom();\n\t\t\tthis.checkCan('warn', null, room);\n\n\t\t\tconst { targetUser } = this.requireUser(target, { allowOffline: true });\n\t\t\tif (!Mafia.isGameBanned(room, targetUser) && cmd === 'ungameban') {\n\t\t\t\treturn this.errorReply(`User '${targetUser.name}' isn't banned from playing mafia games.`);\n\t\t\t} else if (!Mafia.isHostBanned(room, targetUser) && cmd === 'unhostban') {\n\t\t\t\treturn this.errorReply(`User '${targetUser.name}' isn't banned from hosting mafia games.`);\n\t\t\t}\n\n\t\t\tif (cmd === 'unhostban') Mafia.unhostBan(room, targetUser);\n\t\t\telse Mafia.ungameBan(room, targetUser);\n\n\t\t\tthis.privateModAction(`${targetUser.name} was unbanned from ${cmd === 'unhostban' ? 'hosting' : 'playing'} mafia games by ${user.name}.`);\n\t\t\tthis.modlog(`MAFIA${cmd.toUpperCase()}`, targetUser, null, { noip: 1, noalts: 1 });\n\t\t},\n\n\t\toverwriterole: 'addrole',\n\t\taddrole(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst overwrite = cmd === 'overwriterole';\n\n\t\t\tconst [name, alignment, image, ...memo] = target.split('|').map(e => e.trim());\n\t\t\tconst id = toID(name);\n\n\t\t\tif (!id || !memo.length) return this.parse(`/help mafia addrole`);\n\n\t\t\tif (alignment && !(alignment in MafiaData.alignments)) return this.errorReply(`${alignment} is not a valid alignment.`);\n\t\t\tif (image && !VALID_IMAGES.includes(image)) return this.errorReply(`${image} is not a valid image.`);\n\n\t\t\tif (!overwrite && id in MafiaData.roles) {\n\t\t\t\treturn this.errorReply(`${name} is already a role. Use /mafia overwriterole to overwrite.`);\n\t\t\t}\n\t\t\tif (id in MafiaData.alignments) return this.errorReply(`${name} is already an alignment.`);\n\t\t\tif (id in MafiaData.aliases) {\n\t\t\t\treturn this.errorReply(`${name} is already an alias (pointing to ${MafiaData.aliases[id]}).`);\n\t\t\t}\n\n\t\t\tconst role: MafiaDataRole = { name, memo };\n\t\t\tif (alignment) role.alignment = alignment;\n\t\t\tif (image) role.image = image;\n\n\t\t\tMafiaData.roles[id] = role;\n\t\t\twriteFile(DATA_FILE, MafiaData);\n\t\t\tthis.modlog(`MAFIAADDROLE`, null, id, { noalts: true, noip: true });\n\t\t\tthis.sendReply(`The role ${id} was added to the database.`);\n\t\t},\n\t\taddrolehelp: [\n\t\t\t`/mafia addrole name|alignment|image|memo1|memo2... - adds a role to the database. Name, memo are required. Requires % @ # ~`,\n\t\t],\n\n\t\toverwritealignment: 'addalignment',\n\t\taddalignment(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst overwrite = cmd === 'overwritealignment';\n\n\t\t\tconst [name, plural, color, buttonColor, image, ...memo] = target.split('|').map(e => e.trim());\n\t\t\tconst id = toID(name);\n\n\t\t\tif (!id || !plural || !memo.length) return this.parse(`/help mafia addalignment`);\n\n\t\t\tif (image && !VALID_IMAGES.includes(image)) return this.errorReply(`${image} is not a valid image.`);\n\n\t\t\tif (!overwrite && id in MafiaData.alignments) {\n\t\t\t\treturn this.errorReply(`${name} is already an alignment. Use /mafia overwritealignment to overwrite.`);\n\t\t\t}\n\t\t\tif (id in MafiaData.roles) return this.errorReply(`${name} is already a role.`);\n\t\t\tif (id in MafiaData.aliases) {\n\t\t\t\treturn this.errorReply(`${name} is already an alias (pointing to ${MafiaData.aliases[id]})`);\n\t\t\t}\n\n\t\t\tconst alignment: MafiaDataAlignment = { name, plural, memo };\n\t\t\tif (color) alignment.color = color;\n\t\t\tif (buttonColor) alignment.buttonColor = buttonColor;\n\t\t\tif (image) alignment.image = image;\n\n\t\t\tMafiaData.alignments[id] = alignment;\n\t\t\twriteFile(DATA_FILE, MafiaData);\n\t\t\tthis.modlog(`MAFIAADDALIGNMENT`, null, id, { noalts: true, noip: true });\n\t\t\tthis.sendReply(`The alignment ${id} was added to the database.`);\n\t\t},\n\t\taddalignmenthelp: [\n\t\t\t`/mafia addalignment name|plural|color|button color|image|memo1|memo2... - adds a memo to the database. Name, plural, memo are required. Requires % @ # ~`,\n\t\t],\n\n\t\toverwritetheme: 'addtheme',\n\t\taddtheme(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst overwrite = cmd === 'overwritetheme';\n\n\t\t\tconst [name, desc, ...rolelists] = target.split('|').map(e => e.trim());\n\t\t\tconst id = toID(name);\n\n\t\t\tif (!id || !desc || !rolelists.length) return this.parse(`/help mafia addtheme`);\n\n\t\t\tif (!overwrite && id in MafiaData.themes) {\n\t\t\t\treturn this.errorReply(`${name} is already a theme. Use /mafia overwritetheme to overwrite.`);\n\t\t\t}\n\t\t\tif (id in MafiaData.IDEAs) return this.errorReply(`${name} is already an IDEA.`);\n\t\t\tif (id in MafiaData.aliases) {\n\t\t\t\treturn this.errorReply(`${name} is already an alias (pointing to ${MafiaData.aliases[id]})`);\n\t\t\t}\n\n\t\t\tconst rolelistsMap: { [players: number]: string } = {};\n\t\t\tconst uniqueRoles = new Set();\n\n\t\t\tfor (const rolelist of rolelists) {\n\t\t\t\tconst [players, roles] = Utils.splitFirst(rolelist, ':', 2).map(e => e.trim());\n\t\t\t\tconst playersNum = parseInt(players);\n\n\t\t\t\tfor (const role of roles.split(',')) {\n\t\t\t\t\tuniqueRoles.add(role.trim());\n\t\t\t\t}\n\t\t\t\trolelistsMap[playersNum] = roles;\n\t\t\t}\n\t\t\tconst problems = [];\n\t\t\tfor (const role of uniqueRoles) {\n\t\t\t\tconst parsedRole = Mafia.parseRole(role);\n\t\t\t\tif (parsedRole.problems.length) problems.push(...parsedRole.problems);\n\t\t\t}\n\t\t\tif (problems.length) return this.errorReply(`Problems found when parsing roles:\\n${problems.join('\\n')}`);\n\n\t\t\tconst theme: MafiaDataTheme = { name, desc, ...rolelistsMap };\n\t\t\tMafiaData.themes[id] = theme;\n\t\t\twriteFile(DATA_FILE, MafiaData);\n\t\t\tthis.modlog(`MAFIAADDTHEME`, null, id, { noalts: true, noip: true });\n\t\t\tthis.sendReply(`The theme ${id} was added to the database.`);\n\t\t},\n\t\taddthemehelp: [\n\t\t\t`/mafia addtheme name|description|players:rolelist|players:rolelist... - adds a theme to the database. Requires % @ # ~`,\n\t\t],\n\n\t\toverwriteidea: 'addidea',\n\t\taddidea(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst overwrite = cmd === 'overwriteidea';\n\n\t\t\tlet [meta, ...roles] = target.split('\\n');\n\t\t\troles = roles.map(e => e.trim());\n\t\t\tif (!meta || !roles.length) return this.parse(`/help mafia addidea`);\n\t\t\tconst [name, choicesStr, ...picks] = meta.split('|');\n\t\t\tconst id = toID(name);\n\t\t\tconst choices = parseInt(choicesStr);\n\n\t\t\tif (!id || !choices || !picks.length) return this.parse(`/help mafia addidea`);\n\t\t\tif (choices <= picks.length) return this.errorReply(`You need to have more choices than picks.`);\n\n\t\t\tif (!overwrite && id in MafiaData.IDEAs) {\n\t\t\t\treturn this.errorReply(`${name} is already an IDEA. Use /mafia overwriteidea to overwrite.`);\n\t\t\t}\n\t\t\tif (id in MafiaData.themes) return this.errorReply(`${name} is already a theme.`);\n\t\t\tif (id in MafiaData.aliases) {\n\t\t\t\treturn this.errorReply(`${name} is already an alias (pointing to ${MafiaData.aliases[id]})`);\n\t\t\t}\n\n\t\t\tconst checkedRoles: string[] = [];\n\t\t\tconst problems = [];\n\t\t\tfor (const role of roles) {\n\t\t\t\tif (checkedRoles.includes(role)) continue;\n\t\t\t\tconst parsedRole = Mafia.parseRole(role);\n\t\t\t\tif (parsedRole.problems.length) problems.push(...parsedRole.problems);\n\t\t\t\tcheckedRoles.push(role);\n\t\t\t}\n\t\t\tif (problems.length) return this.errorReply(`Problems found when parsing roles:\\n${problems.join('\\n')}`);\n\n\t\t\tconst IDEA: MafiaDataIDEA = { name, choices, picks, roles };\n\t\t\tMafiaData.IDEAs[id] = IDEA;\n\t\t\twriteFile(DATA_FILE, MafiaData);\n\t\t\tthis.modlog(`MAFIAADDIDEA`, null, id, { noalts: true, noip: true });\n\t\t\tthis.sendReply(`The IDEA ${id} was added to the database.`);\n\t\t},\n\t\taddideahelp: [\n\t\t\t`/mafia addidea name|choices (number)|pick1|pick2... (new line here)`,\n\t\t\t`(newline separated rolelist) - Adds an IDEA to the database. Requires % @ # ~`,\n\t\t],\n\n\t\toverwriteterm: 'addterm',\n\t\taddterm(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tthis.checkCan('mute', null, room);\n\t\t\tconst overwrite = cmd === 'overwriteterm';\n\n\t\t\tconst [name, ...memo] = target.split('|').map(e => e.trim());\n\t\t\tconst id = toID(name);\n\t\t\tif (!id || !memo.length) return this.parse(`/help mafia addterm`);\n\n\t\t\tif (!overwrite && id in MafiaData.terms) {\n\t\t\t\treturn this.errorReply(`${name} is already a term. Use /mafia overwriteterm to overwrite.`);\n\t\t\t}\n\t\t\tif (id in MafiaData.aliases) {\n\t\t\t\treturn this.errorReply(`${name} is already an alias (pointing to ${MafiaData.aliases[id]})`);\n\t\t\t}\n\n\t\t\tconst term: MafiaDataTerm = { name, memo };\n\t\t\tMafiaData.terms[id] = term;\n\t\t\twriteFile(DATA_FILE, MafiaData);\n\t\t\tthis.modlog(`MAFIAADDTERM`, null, id, { noalts: true, noip: true });\n\t\t\tthis.sendReply(`The term ${id} was added to the database.`);\n\t\t},\n\t\taddtermhelp: [`/mafia addterm name|memo1|memo2... - Adds a term to the database. Requires % @ # ~`],\n\n\t\toverwritealias: 'addalias',\n\t\taddalias(target, room, user, connection, cmd) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tthis.checkCan('mute', null, room);\n\n\t\t\tconst [from, to] = target.split(',').map(toID);\n\t\t\tif (!from || !to) return this.parse(`/help mafia addalias`);\n\n\t\t\tif (from in MafiaData.aliases) {\n\t\t\t\treturn this.errorReply(`${from} is already an alias (pointing to ${MafiaData.aliases[from]})`);\n\t\t\t}\n\t\t\tlet foundTarget = false;\n\t\t\tfor (const entry of ['alignments', 'roles', 'themes', 'IDEAs', 'terms'] as (keyof MafiaData)[]) {\n\t\t\t\tconst dataEntry = MafiaData[entry];\n\t\t\t\tif (from in dataEntry) return this.errorReply(`${from} is already a ${entry.slice(0, -1)}`);\n\t\t\t\tif (to in dataEntry) foundTarget = true;\n\t\t\t}\n\t\t\tif (!foundTarget) return this.errorReply(`No database entry exists with the key ${to}.`);\n\n\t\t\tMafiaData.aliases[from] = to;\n\t\t\twriteFile(DATA_FILE, MafiaData);\n\t\t\tthis.modlog(`MAFIAADDALIAS`, null, `${from}: ${to}`, { noalts: true, noip: true });\n\t\t\tthis.sendReply(`The alias ${from} was added, pointing to ${to}.`);\n\t\t},\n\t\taddaliashelp: [\n\t\t\t`/mafia addalias from,to - Adds an alias to the database, redirecting (from) to (to). Requires % @ # ~`,\n\t\t],\n\n\t\tdeletedata(target, room, user) {\n\t\t\troom = this.requireRoom('mafia' as RoomID);\n\t\t\tthis.checkCan('mute', null, room);\n\n\t\t\tlet [source, entry] = target.split(',');\n\t\t\tentry = toID(entry);\n\t\t\tif (!(source in MafiaData)) {\n\t\t\t\treturn this.errorReply(`Invalid source. Valid sources are ${Object.keys(MafiaData).join(', ')}`);\n\t\t\t}\n\t\t\t// @ts-expect-error checked above\n\t\t\tconst dataSource = MafiaData[source];\n\t\t\tif (!(entry in dataSource)) return this.errorReply(`${entry} does not exist in ${source}.`);\n\n\t\t\tlet buf = '';\n\t\t\tif (dataSource === MafiaData.alignments) {\n\t\t\t\tif (entry === 'solo' || entry === 'town') return this.errorReply(`You cannot delete the solo or town alignments.`);\n\n\t\t\t\tfor (const key in MafiaData.roles) {\n\t\t\t\t\tif (MafiaData.roles[key].alignment === entry) {\n\t\t\t\t\t\tbuf += `Removed alignment of role ${key}.`;\n\t\t\t\t\t\tdelete MafiaData.roles[key].alignment;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dataSource !== MafiaData.aliases) {\n\t\t\t\t// remove any aliases\n\t\t\t\tfor (const key in MafiaData.aliases) {\n\t\t\t\t\tif (MafiaData.aliases[key] === entry) {\n\t\t\t\t\t\tbuf += `Removed alias ${key}`;\n\t\t\t\t\t\tdelete MafiaData.aliases[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete dataSource[entry];\n\n\t\t\twriteFile(DATA_FILE, MafiaData);\n\t\t\tif (buf) this.sendReply(buf);\n\t\t\tthis.modlog(`MAFIADELETEDATA`, null, `${entry} from ${source}`, { noalts: true, noip: true });\n\t\t\tthis.sendReply(`The entry ${entry} was deleted from the ${source} database.`);\n\t\t},\n\t\tdeletedatahelp: [`/mafia deletedata source,entry - Removes an entry from the database. Requires % @ # ~`],\n\t\tlistdata(target, room, user) {\n\t\t\tif (!(target in MafiaData)) {\n\t\t\t\treturn this.errorReply(`Invalid source. Valid sources are ${Object.keys(MafiaData).join(', ')}`);\n\t\t\t}\n\t\t\tconst dataSource = MafiaData[target as keyof MafiaData];\n\t\t\tif (dataSource === MafiaData.aliases) {\n\t\t\t\tconst aliases = Object.entries(MafiaData.aliases)\n\t\t\t\t\t.map(([from, to]) => `${from}: ${to}`)\n\t\t\t\t\t.join('
');\n\t\t\t\treturn this.sendReplyBox(`Mafia aliases:
${aliases}`);\n\t\t\t} else {\n\t\t\t\tconst entries = Object.entries(dataSource)\n\t\t\t\t\t.map(([key, data]) => ``)\n\t\t\t\t\t.join('');\n\t\t\t\treturn this.sendReplyBox(`Mafia ${target}:
${entries}`);\n\t\t\t}\n\t\t},\n\n\t\tdisable(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tthis.checkCan('gamemanagement', null, room);\n\t\t\tif (room.settings.mafiaDisabled) {\n\t\t\t\treturn this.errorReply(\"Mafia is already disabled.\");\n\t\t\t}\n\t\t\troom.settings.mafiaDisabled = true;\n\t\t\troom.saveSettings();\n\t\t\tthis.modlog('MAFIADISABLE', null);\n\t\t\treturn this.sendReply(\"Mafia has been disabled for this room.\");\n\t\t},\n\t\tdisablehelp: [`/mafia disable - Disables mafia in this room. Requires # ~`],\n\n\t\tenable(target, room, user) {\n\t\t\troom = this.requireRoom();\n\t\t\tthis.checkCan('gamemanagement', null, room);\n\t\t\tif (!room.settings.mafiaDisabled) {\n\t\t\t\treturn this.errorReply(\"Mafia is already enabled.\");\n\t\t\t}\n\t\t\troom.settings.mafiaDisabled = false;\n\t\t\troom.saveSettings();\n\t\t\tthis.modlog('MAFIAENABLE', null);\n\t\t\treturn this.sendReply(\"Mafia has been enabled for this room.\");\n\t\t},\n\t\tenablehelp: [`/mafia enable - Enables mafia in this room. Requires # ~`],\n\t},\n\tmafiahelp(target, room, user) {\n\t\tif (!this.runBroadcast()) return;\n\t\tlet buf = `Commands for the Mafia Plugin
Most commands are used through buttons in the game screen.

`;\n\t\tbuf += `
General Commands`;\n\t\tbuf += [\n\t\t\t`
General Commands for the Mafia Plugin:
`,\n\t\t\t`/mafia host [user] - Create a game of Mafia with [user] as the host. Roomvoices can only host themselves. Requires + % @ # ~`,\n\t\t\t`/mafia nexthost - Host the next user in the host queue. Only works in the Mafia Room. Requires + % @ # ~`,\n\t\t\t`/mafia forcehost [user] - Bypass the host queue and host [user]. Only works in the Mafia Room. Requires % @ # ~`,\n\t\t\t`/mafia sub [in|out] - Request to sub into the game, or cancel a request to sub out.`,\n\t\t\t`/mafia spectate - Spectate the game of mafia.`,\n\t\t\t`/mafia votes - Display the current vote count, and who's voting who.`,\n\t\t\t`/mafia players - Display the current list of players, will highlight players.`,\n\t\t\t`/mafia [rl|orl] - Display the role list or the original role list for the current game.`,\n\t\t\t`/mafia data [alignment|role|modifier|theme|term] - Get information on a mafia alignment, role, modifier, theme, or term.`,\n\t\t\t`/mafia subhost [user] - Substitues the user as the new game host. Requires % @ # ~`,\n\t\t\t`/mafia (un)cohost [user] - Adds/removes the user as a cohost. Cohosts can talk during the game, as well as perform host actions. Requires % @ # ~`,\n\t\t\t`/mafia [enable|disable] - Enables/disables mafia in this room. Requires # ~`,\n\t\t].join('
');\n\t\tbuf += `
Player Commands`;\n\t\tbuf += [\n\t\t\t`
Commands that players can use:
`,\n\t\t\t`/mafia [join|leave] - Joins/leaves the game. Can only be done while signups are open.`,\n\t\t\t`/mafia vote [player|novote] - Vote the specified player or abstain from voting.`,\n\t\t\t`/mafia unvote - Withdraw your vote. Fails if you're not voting anyone`,\n\t\t\t`/mafia deadline - View the deadline for the current game.`,\n\t\t\t`/mafia sub in - Request to sub into the game, or cancel a request to sub out.`,\n\t\t\t`/mafia sub out - Request to sub out of the game, or cancel a request to sub in.`,\n\t\t\t`/mafia idle - Tells the host if you are idling.`,\n\t\t\t`/mafia action [details] - Tells the host you are using an action with the given submission details.`,\n\t\t].join('
');\n\t\tbuf += `
Host Commands`;\n\t\tbuf += [\n\t\t\t`
Commands for game hosts and Cohosts to use:
`,\n\t\t\t`/mafia playercap [cap|none]- Limit the number of players able to join the game. Player cap cannot be more than 20 or less than 2. Requires host % @ # ~`,\n\t\t\t`/mafia close - Closes signups for the current game. Requires host % @ # ~`,\n\t\t\t`/mafia closedsetup [on|off] - Sets if the game is a closed setup. Closed setups don't show the role list to players. Requires host % @ # ~`,\n\t\t\t`/mafia takeidles [on|off] - Sets if idles are accepted by the script or not. Requires host % @ # ~`,\n\t\t\t`/mafia prod - Notifies players that they must submit an action or idle if they haven't yet. Requires host % @ # ~`,\n\t\t\t`/mafia reveal [on|off] - Sets if roles reveal on death or not. Requires host % @ # ~`,\n\t\t\t`/mafia selfvote [on|hammer|off] - Allows players to self vote either at hammer or anytime. Requires host % @ # ~`,\n\t\t\t`/mafia [enablenl|disablenl] - Allows or disallows players abstain from voting. Requires host % @ # ~`,\n\t\t\t`/mafia votelock [on|off] - Allows or disallows players to change their vote. Requires host % @ # ~`,\n\t\t\t`/mafia voting [on|off] - Allows or disallows voting. Requires host % @ # ~`,\n\t\t\t`/mafia forcevote [yes/no] - Forces players' votes onto themselves, and prevents unvoting. Requires host % @ # ~`,\n\t\t\t`/mafia setroles [comma seperated roles] - Set the roles for a game of mafia. You need to provide one role per player. Requires host % @ # ~`,\n\t\t\t`/mafia forcesetroles [comma seperated roles] - Forcibly set the roles for a game of mafia. No role PM information or alignment will be set. Requires host % @ # ~`,\n\t\t\t`/mafia start - Start the game of mafia. Signups must be closed. Requires host % @ # ~`,\n\t\t\t`/mafia [day|night] - Move to the next game day or night. Requires host % @ # ~`,\n\t\t\t`/mafia extend (minutes) - Return to the previous game day. If (minutes) is provided, set the deadline for (minutes) minutes. Requires host % @ # ~`,\n\t\t\t`/mafia kill [player] - Kill a player, eliminating them from the game. Requires host % @ # ~`,\n\t\t\t`/mafia treestump [player] - Kills a player, but allows them to talk during the day still. Requires host % @ # ~`,\n\t\t\t`/mafia spirit [player] - Kills a player, but allows them to vote still. Requires host % @ # ~`,\n\t\t\t`/mafia spiritstump [player] - Kills a player, but allows them to talk and vote during the day. Requires host % @ # ~`,\n\t\t\t`/mafia kick [player] - Kicks a player from the game without revealing their role. Requires host % @ # ~`,\n\t\t\t`/mafia revive [player] - Revives a player who was eliminated. Requires host % @ # ~`,\n\t\t\t`/mafia add [player] - Adds a new player to the game. Requires host % @ # ~`,\n\t\t\t`/mafia revealrole [player] - Reveals the role of a player. Requires host % @ # ~`,\n\t\t\t`/mafia revealas [player], [role] - Fakereveals the role of a player as a certain role. Requires host % @ # ~`,\n\t\t\t`/mafia (un)silence [player] - Silences [player], preventing them from talking at all. Requires host % @ # ~`,\n\t\t\t`/mafia (un)nighttalk [player] - Allows [player] to talk freely during the night. Requires host % @ # ~`,\n\t\t\t`/mafia (un)[priest|actor] [player] - Makes [player] a priest (can't hammer) or actor (can only hammer). Requires host % @ # ~`,\n\t\t\t`/mafia deadline [minutes|off] - Sets or removes the deadline for the game. Cannot be more than 20 minutes.`,\n\t\t\t`/mafia sub next, [player] - Forcibly sub [player] out of the game. Requires host % @ # ~`,\n\t\t\t`/mafia sub remove, [user] - Forcibly remove [user] from the sublist. Requres host % @ # ~`,\n\t\t\t`/mafia sub unrequest, [player] - Remove's a player's request to sub out of the game. Requires host % @ # ~`,\n\t\t\t`/mafia sub [player], [user] - Forcibly sub [player] for [user]. Requires host % @ # ~`,\n\t\t\t`/mafia autosub [yes|no] - Sets if players will automatically sub out if a user is on the sublist. Defaults to yes. Requires host % @ # ~`,\n\t\t\t`/mafia (un)[love|hate] [player] - Makes it take 1 more (love) or less (hate) vote to hammer [player]. Requires host % @ # ~`,\n\t\t\t`/mafia (un)[mayor|voteless] [player] - Makes [player]'s' vote worth 2 votes (mayor) or makes [player]'s vote worth 0 votes (voteless). Requires host % @ # ~`,\n\t\t\t`/mafia hammer [hammer] - sets the hammer count to [hammer] and resets votes`,\n\t\t\t`/mafia hammer off - disables hammering`,\n\t\t\t`/mafia shifthammer [hammer] - sets the hammer count to [hammer] without resetting votes`,\n\t\t\t`/mafia resethammer - sets the hammer to the default, resetting votes`,\n\t\t\t`/mafia playerroles - View all the player's roles in chat. Requires host`,\n\t\t\t`/mafia resetgame - Resets game data. Does not change settings from the host besides deadlines or add/remove any players. Requires host % @ # ~`,\n\t\t\t`/mafia end - End the current game of mafia. Requires host + % @ # ~`,\n\t\t].join('
');\n\t\tbuf += `
IDEA Module Commands`;\n\t\tbuf += [\n\t\t\t`
Commands for using IDEA modules
`,\n\t\t\t`/mafia idea [idea] - starts the IDEA module [idea]. Requires + % @ # ~, voices can only start for themselves`,\n\t\t\t`/mafia ideareroll - rerolls the IDEA module. Requires host % @ # ~`,\n\t\t\t`/mafia ideapick [selection], [role] - selects a role`,\n\t\t\t`/mafia ideadiscards - shows the discarded roles`,\n\t\t\t`/mafia ideadiscards [off|on] - hides discards from the players. Requires host % @ # ~`,\n\t\t\t`/mafia customidea choices, picks (new line here, shift+enter)`,\n\t\t\t`(comma or newline separated rolelist) - Starts an IDEA module with custom roles. Requires % @ # ~`,\n\t\t].join('
');\n\t\tbuf += `
`;\n\t\tbuf += `
Mafia Room Specific Commands`;\n\t\tbuf += [\n\t\t\t`
Commands that are only useable in the Mafia Room:
`,\n\t\t\t`/mafia queue add, [user] - Adds the user to the host queue. Requires + % @ # ~, voices can only add themselves.`,\n\t\t\t`/mafia queue remove, [user] - Removes the user from the queue. You can remove yourself regardless of rank. Requires % @ # ~.`,\n\t\t\t`/mafia queue - Shows the list of users who are in queue to host.`,\n\t\t\t`/mafia win (points) [user1], [user2], [user3], ... - Award the specified users points to the mafia leaderboard for this month. The amount of points can be negative to take points. Defaults to 10 points.`,\n\t\t\t`/mafia winfaction (points), [faction] - Award the specified points to all the players in the given faction. Requires % @ # ~`,\n\t\t\t`/mafia (un)mvp [user1], [user2], ... - Gives a MVP point and 10 leaderboard points to the users specified.`,\n\t\t\t`/mafia [leaderboard|mvpladder] - View the leaderboard or MVP ladder for the current or last month.`,\n\t\t\t`/mafia [hostlogs|playlogs] - View the host logs or play logs for the current or last month. Requires % @ # ~`,\n\t\t\t`/mafia (un)hostban [user], [duration] - Ban a user from hosting games for [duration] days. Requires % @ # ~`,\n\t\t\t`/mafia (un)gameban [user], [duration] - Ban a user from playing games for [duration] days. Requires % @ # ~`,\n\t\t].join('
');\n\t\tbuf += `
`;\n\n\t\treturn this.sendReplyBox(buf);\n\t},\n};\n\nexport const roomSettings: Chat.SettingsHandler = room => ({\n\tlabel: \"Mafia\",\n\tpermission: 'editroom',\n\toptions: [\n\t\t[`disabled`, room.settings.mafiaDisabled || 'mafia disable'],\n\t\t[`enabled`, !room.settings.mafiaDisabled || 'mafia enable'],\n\t],\n});\n\nprocess.nextTick(() => {\n\tChat.multiLinePattern.register('/mafia (custom|add|overwrite)idea');\n});\n"], "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA0B;AAgG1B,MAAM,qBAAqB;AAAA,EAC1B,WAAW;AAAA;AAAA,EACX,MAAM;AAAA;AAAA,EACN,WAAW;AAAA;AAAA,EACX,QAAQ;AAAA;AAAA,EACR,aAAa;AAAA;AACd;AAGA,MAAM,YAAY;AAClB,MAAM,YAAY;AAGlB,MAAM,eAAe;AAAA,EACpB;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAU;AAAA,EAAQ;AAAA,EAAa;AAAA,EAAQ;AAAA,EAAU;AAAA,EAAS;AAAA,EAAS;AAAA,EAAY;AAC/F;AAEA,IAAI,YAAuB,uBAAO,OAAO,IAAI;AAC7C,IAAI,OAAiB,EAAE,aAAa,CAAC,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,OAAO,CAAC,GAAG,SAAS,CAAC,EAAE;AAEpF,YAAY,sBAAsB;AAAA,EACjC,MAAM;AAAA,EACN,MAAM;AACP,CA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