feat : show winning players on game end

related to #71
This commit is contained in:
2024-12-21 11:23:18 +01:00
parent c3bb7d555c
commit c30d23e45f
+6 -2
View File
@@ -188,8 +188,12 @@ export const handlers: {
consumeEffect: async (data: any) => {
console.warn("consumeEffect not implemented");
},
endGame: async () => {
alert("game ended");
endGame: async (data: any, { game }) => {
const winningPlayers = game.teams
.find((t) => t._id == data.winner)
?.players.map((p) => p.user.username)
.join(", ");
alert(`game ended. Winner : ${winningPlayers}`);
},
delete: async () => {
alert("game deleted");