diff --git a/packages/backend/microservices/rock-paper-scissors/rock-paper-scissors.routes.ts b/packages/backend/microservices/rock-paper-scissors/rock-paper-scissors.routes.ts index 97d4e79..57db023 100644 --- a/packages/backend/microservices/rock-paper-scissors/rock-paper-scissors.routes.ts +++ b/packages/backend/microservices/rock-paper-scissors/rock-paper-scissors.routes.ts @@ -37,6 +37,7 @@ export const RockPaperScissorsRoutes = async ( tier_id, player_id, }: RockPaperScissors.JoinEvent["payload"]) => { + console.log(1); try { const roomKey: string = `${season_id}::${game_id}::${tier_id}`; const logId: string = `[${season_id}][${game_id}][${tier_id}][${player_id}]`; @@ -137,15 +138,19 @@ export const RockPaperScissorsRoutes = async ( playerJoinedEvent.payload, ); - const { player1, player2, round } = + const gameState = parseStringifiedValues( await RedisClient.hgetall(room_id), ); - if (player1 && player2) { + if (gameState.player1 && gameState.player2) { const stakingEvent: RockPaperScissors.StakingEvent = { type: "staking", - payload: null, + payload: { + player1: gameState.player1, + player2: gameState.player2, + round: gameState.round as 0, + }, }; io.to(room_id).emit( stakingEvent.type, diff --git a/packages/common/rock-paper-scissors/index.ts b/packages/common/rock-paper-scissors/index.ts index 958edb4..2fe7796 100644 --- a/packages/common/rock-paper-scissors/index.ts +++ b/packages/common/rock-paper-scissors/index.ts @@ -43,7 +43,11 @@ export type PlayerJoinedEvent = { export type StakingEvent = { type: "staking"; - payload: null; + payload: { + round: 0; + player1: PlayerServerState; + player2: PlayerServerState; + }; }; export type GameStartEvent = {