Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mafia: Add tracking of N0 actions. #10771

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
24 changes: 11 additions & 13 deletions server/chat-plugins/mafia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1986,11 +1986,11 @@ export const pages: Chat.PageTable = {
buf += `<p><details><summary class="button" style="text-align:left; display:inline-block">Role Details</summary>`;
buf += `<table><tr><td style="text-align:center;"><img width="75" height="75" src="//${Config.routes.client}/fx/mafia-${role.image || 'villager'}.png"></td><td style="text-align:left;width:100%"><ul>${role.memo.map(m => `<li>${m}</li>`).join('')}</ul></td></tr></table>`;
buf += `</details></p>`;
if (game.dayNum > 1) {
for (let i = 1; i < game.dayNum; i++) {
previousActionsPL += `<b>Night ${i}</b><br/>`;
previousActionsPL += `${isPlayer.actionArr?.[i] ? `${isPlayer.actionArr[i]}` : ''}<br/>`;
}
for (let i = 0; i < game.dayNum; i++) {
previousActionsPL += `<b>Night ${i}</b><br/>`;
previousActionsPL += `${isPlayer.actionArr?.[i] ? `${isPlayer.actionArr[i]}` : ''}<br/>`;
}
if (game.phase === "day" || game.dayNum > 0) {
buf += `<p><details><summary class="button" style="text-align:left; display:inline-block">Previous Actions</summary>${previousActionsPL}</span></details></p>`;
}
}
Expand Down Expand Up @@ -2045,14 +2045,12 @@ export const pages: Chat.PageTable = {
buf += `<p><details><summary class="button" style="text-align:left; display:inline-block">No Response</summary>${noResponses}</span></details></p>`;
}
let previousActions = `<br/>`;
if (game.dayNum > 1) {
for (let i = 1; i < game.dayNum; i++) {
previousActions += `<b>Night ${i}</b><br/>`;
for (const player of game.players) {
previousActions += `<b>${player.safeName}</b>:${player.actionArr[i] ? `${player.actionArr[i]}` : ''}<br/>`;
}
previousActions += `<br/>`;
for (let i = 0; i < game.dayNum; i++) {
previousActions += `<b>Night ${i}</b><br/>`;
for (const player of game.players) {
previousActions += `<b>${player.safeName}</b>:${player.actionArr[i] ? `${player.actionArr[i]}` : ''}<br/>`;
}
previousActions += `<br/>`;
}
buf += `<h3>Host options</h3>`;
buf += `<p><details><summary class="button" style="text-align:left; display:inline-block">General Options</summary>`;
Expand Down Expand Up @@ -2106,7 +2104,7 @@ export const pages: Chat.PageTable = {
buf += `: <button class="button" name="send" value="/msgroom ${room.roomid},/mafia revive ${eliminated.id}">Revive</button></p>`;
}
buf += `<hr/></details></p>`;
if (game.dayNum > 1) {
if (game.phase === "day" || game.dayNum > 0) {
buf += `<p><details><summary class="button" style="text-align:left; display:inline-block">Previous Night Actions</summary>${previousActions}</span></details></p>`;
}
buf += `<p><details><summary class="button" style="text-align:left; display:inline-block">How to setup roles</summary>`;
Expand Down
Loading