From 96407208d3f6453f046733634878c539cfcd9438 Mon Sep 17 00:00:00 2001 From: motogp-bit <78108539+motogp-bit@users.noreply.github.com> Date: Mon, 9 Jan 2023 18:33:29 +0200 Subject: [PATCH 1/6] Update mafia.ts --- server/chat-plugins/mafia.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/chat-plugins/mafia.ts b/server/chat-plugins/mafia.ts index ae111b2f6223..b15824cd0c6c 100644 --- a/server/chat-plugins/mafia.ts +++ b/server/chat-plugins/mafia.ts @@ -3163,7 +3163,7 @@ export const commands: Chat.ChatCommands = { this.checkChat(null, room); if (game.subs.includes(user.id)) return this.errorReply(`You are already on the sub list.`); if (game.played.includes(user.id)) return this.errorReply(`You cannot sub back into the game.`); - game.canJoin(user, true); + game.canJoin(user, true); // Change this to game.canJoin(user, true, true) if you're trying to test something sub related locally. game.subs.push(user.id); game.nextSub(); // Update spectator's view @@ -3309,6 +3309,7 @@ export const commands: Chat.ChatCommands = { game.dead[targetUser.id].destroy(); delete game.dead[targetUser.id]; } + if (game.subs.includes(targetUser.id)) game.subs.splice(game.subs.indexOf(targetUser.id), 1); if (cmd.includes('cohost')) { game.cohostids.push(targetUser.id); game.cohosts.push(Utils.escapeHTML(targetUser.name)); @@ -3321,7 +3322,6 @@ export const commands: Chat.ChatCommands = { const oldHostid = game.hostid; const oldHost = Users.get(game.hostid); if (oldHost) oldHost.send(`>view-mafia-${room.roomid}\n|deinit`); - if (game.subs.includes(targetUser.id)) game.subs.splice(game.subs.indexOf(targetUser.id), 1); const queueIndex = hostQueue.indexOf(targetUser.id); if (queueIndex > -1) hostQueue.splice(queueIndex, 1); game.host = Utils.escapeHTML(targetUser.name); From 1ac4b5a3bcdb0b2bffe54ec6cd57184eed920d29 Mon Sep 17 00:00:00 2001 From: motogp-bit <78108539+motogp-bit@users.noreply.github.com> Date: Mon, 9 Jan 2023 18:41:15 +0200 Subject: [PATCH 2/6] Update mafia.ts --- server/chat-plugins/mafia.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/chat-plugins/mafia.ts b/server/chat-plugins/mafia.ts index b15824cd0c6c..e603979bdff2 100644 --- a/server/chat-plugins/mafia.ts +++ b/server/chat-plugins/mafia.ts @@ -3163,7 +3163,8 @@ export const commands: Chat.ChatCommands = { this.checkChat(null, room); if (game.subs.includes(user.id)) return this.errorReply(`You are already on the sub list.`); if (game.played.includes(user.id)) return this.errorReply(`You cannot sub back into the game.`); - game.canJoin(user, true); // Change this to game.canJoin(user, true, true) if you're trying to test something sub related locally. + // Change this to game.canJoin(user, true, true) if you're trying to test something sub related locally. + game.canJoin(user, true); game.subs.push(user.id); game.nextSub(); // Update spectator's view From b0673a7e972879b40a3f6c4abac093b89e46ab6f Mon Sep 17 00:00:00 2001 From: motogp-bit <78108539+motogp-bit@users.noreply.github.com> Date: Sun, 29 Jan 2023 01:53:08 +0200 Subject: [PATCH 3/6] Update mafia.ts --- server/chat-plugins/mafia.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/chat-plugins/mafia.ts b/server/chat-plugins/mafia.ts index e603979bdff2..8d5bfb0556f3 100644 --- a/server/chat-plugins/mafia.ts +++ b/server/chat-plugins/mafia.ts @@ -1480,6 +1480,8 @@ class Mafia extends Rooms.RoomGame { } } } + // 'Innocent Discard' causes chosen role to become Town, when discarded. + if (player.IDEA.choices.includes('Innocent Discard')) player.role.alignment = 'town'; } this.IDEA.discardsHTML = `Discards:
`; for (const p of Object.keys(this.playerTable).sort()) { From 017dfba3ba077f452d0a525f0639f9873382f7fa Mon Sep 17 00:00:00 2001 From: motogp-bit <78108539+motogp-bit@users.noreply.github.com> Date: Tue, 24 Dec 2024 15:58:42 +0200 Subject: [PATCH 4/6] Update mafia.ts --- server/chat-plugins/mafia.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/server/chat-plugins/mafia.ts b/server/chat-plugins/mafia.ts index 090bf2e55c9c..c848b962149f 100644 --- a/server/chat-plugins/mafia.ts +++ b/server/chat-plugins/mafia.ts @@ -1986,13 +1986,11 @@ export const pages: Chat.PageTable = { buf += `

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

`; - if (game.dayNum > 1) { - for (let i = 1; i < game.dayNum; i++) { + for (let i = 0; i < game.dayNum; i++) { previousActionsPL += `Night ${i}
`; previousActionsPL += `${isPlayer.actionArr?.[i] ? `${isPlayer.actionArr[i]}` : ''}
`; } - buf += `

Previous Actions${previousActionsPL}

`; - } + if (game.phase === "day" || game.dayNum > 0) buf += `

Previous Actions${previousActionsPL}

`; } } if (game.phase === "day") { @@ -2045,15 +2043,13 @@ export const pages: Chat.PageTable = { buf += `

No Response${noResponses}

`; } let previousActions = `
`; - if (game.dayNum > 1) { - for (let i = 1; i < game.dayNum; i++) { + for (let i = 0; i < game.dayNum; i++) { previousActions += `Night ${i}
`; for (const player of game.players) { previousActions += `${player.safeName}:${player.actionArr[i] ? `${player.actionArr[i]}` : ''}
`; } previousActions += `
`; } - } buf += `

Host options

`; buf += `

General Options`; buf += `

General Options

`; @@ -2106,9 +2102,7 @@ export const pages: Chat.PageTable = { buf += `:

`; } buf += `

`; - if (game.dayNum > 1) { - buf += `

Previous Night Actions${previousActions}

`; - } + if (game.phase === "day" || game.dayNum > 0) buf += `

Previous Night Actions${previousActions}

`; buf += `

How to setup roles`; buf += `

Setting the roles

`; buf += `

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

`; From 69037063c887f0cf6c347313c09b276cc207aef0 Mon Sep 17 00:00:00 2001 From: motogp-bit <78108539+motogp-bit@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:08:35 +0200 Subject: [PATCH 5/6] Update mafia.ts --- server/chat-plugins/mafia.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/server/chat-plugins/mafia.ts b/server/chat-plugins/mafia.ts index c848b962149f..b1b5d1896c48 100644 --- a/server/chat-plugins/mafia.ts +++ b/server/chat-plugins/mafia.ts @@ -1986,11 +1986,13 @@ export const pages: Chat.PageTable = { buf += `

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

`; - for (let i = 0; i < game.dayNum; i++) { - previousActionsPL += `Night ${i}
`; - previousActionsPL += `${isPlayer.actionArr?.[i] ? `${isPlayer.actionArr[i]}` : ''}
`; - } - if (game.phase === "day" || game.dayNum > 0) buf += `

Previous Actions${previousActionsPL}

`; + for (let i = 0; i < game.dayNum; i++) { + previousActionsPL += `Night ${i}
`; + previousActionsPL += `${isPlayer.actionArr?.[i] ? `${isPlayer.actionArr[i]}` : ''}
`; + } + if (game.phase === "day" || game.dayNum > 0) { + buf += `

Previous Actions${previousActionsPL}

`; + } } } if (game.phase === "day") { @@ -2102,7 +2104,9 @@ export const pages: Chat.PageTable = { buf += `:

`; } buf += `

`; - if (game.phase === "day" || game.dayNum > 0) buf += `

Previous Night Actions${previousActions}

`; + if (game.phase === "day" || game.dayNum > 0) { + buf += `

Previous Night Actions${previousActions}

`; + } buf += `

How to setup roles`; buf += `

Setting the roles

`; buf += `

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

`; From 782b9a6fa7c7171b13fd32c0750a1ad018068e53 Mon Sep 17 00:00:00 2001 From: motogp-bit <78108539+motogp-bit@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:15:12 +0200 Subject: [PATCH 6/6] Update mafia.ts --- server/chat-plugins/mafia.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/server/chat-plugins/mafia.ts b/server/chat-plugins/mafia.ts index b1b5d1896c48..0c59df7c8bc5 100644 --- a/server/chat-plugins/mafia.ts +++ b/server/chat-plugins/mafia.ts @@ -2045,13 +2045,13 @@ export const pages: Chat.PageTable = { buf += `

No Response${noResponses}

`; } let previousActions = `
`; - for (let i = 0; i < game.dayNum; i++) { - previousActions += `Night ${i}
`; - for (const player of game.players) { - previousActions += `${player.safeName}:${player.actionArr[i] ? `${player.actionArr[i]}` : ''}
`; - } - previousActions += `
`; + for (let i = 0; i < game.dayNum; i++) { + previousActions += `Night ${i}
`; + for (const player of game.players) { + previousActions += `${player.safeName}:${player.actionArr[i] ? `${player.actionArr[i]}` : ''}
`; } + previousActions += `
`; + } buf += `

Host options

`; buf += `

General Options`; buf += `

General Options

`;