Ignore:
Timestamp:
07/05/22 16:36:24 (2 years ago)
Author:
anastasovv <simon@…>
Branches:
main
Children:
189cd8f
Parents:
b13f93b
Message:

Finished poker and added ball to roulette

Location:
components/poker/sections
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • components/poker/sections/Messages.jsx

    rb13f93b r3a783f2  
    1717        turnMessage = `It\'s ${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName}\'s turn.`;
    1818
    19         if (playerState.pokerGame.table.lastBet > 0) {
    20             callMessage = `${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName} must at least call $${playerState.pokerGame.table.lastBet}`;
     19        if (parseInt(playerState.pokerGame.table.lastBet) > 0) {
     20            callMessage = `${playerState.pokerGame.table.players[playerState.pokerGame.table.turnIdx].displayName} must at least call $${Math.min(playerState.player.credits, playerState.pokerGame.table.lastBet)}`;
    2121        }
    2222    }
     
    2424    return (
    2525        <div className="pokerMessagesContainer">
    26             { playerState.pokerGame.table.started && <p>Round {playerState.pokerGame.table.round}/5{roundMessage}</p> }
     26            { playerState.pokerGame.table.started && playerState.pokerGame.table.ended && playerState.pokerGame.table.winners.length === 1 && <p>Game over - {playerState.pokerGame.table.winners[0]?.displayName} won ${playerState.pokerGame.table.winners[0]?.wonAmount} with a {playerState.pokerGame.table.winners[0]?.hand?.hand} combination! Congratulations.</p> }
     27            { playerState.pokerGame.table.started && playerState.pokerGame.table.ended && playerState.pokerGame.table.winners.length > 1 && <p>Game over - {playerState.pokerGame.table.winners.map(e=>e.displayName).join(", ")} drew!</p> }
     28            { playerState.pokerGame.table.started && playerState.pokerGame.table.ended && <p>New game will start soon.</p> }
     29
     30            { playerState.pokerGame.table.started && !playerState.pokerGame.table.ended && <p>Round {playerState.pokerGame.table.round}/4{roundMessage}</p> }
    2731            { !playerState.pokerGame.table.started && <p>Waiting for coordinator {playerState.pokerGame.table.creator} to start the game.</p> }
    28             { playerState.pokerGame.table.started && <p>{turnMessage}</p> }
    29             { playerState.pokerGame.table.started && <p>{callMessage}</p> }
     32            { playerState.pokerGame.table.started && !playerState.pokerGame.table.ended && <p>{turnMessage}</p> }
     33            { playerState.pokerGame.table.started && !playerState.pokerGame.table.ended && <p>{callMessage}</p> }
    3034        </div>
    3135    )
  • components/poker/sections/PlayButtons.jsx

    rb13f93b r3a783f2  
    44
    55import axios from 'axios';
    6 import { setPokerGame } from '../../../redux/reducers/playerSlice';
     6import { setPoker } from '../../../redux/reducers/styleSlice';
    77
    88const PlayButtons = () => {
     
    1010
    1111  const playerState = useSelector(state => state.player);
     12  const styleState = useSelector(state => state.style);
    1213
    1314  function sitDown() {
     
    2021
    2122  const checkClass = playerState.pokerGame.table.lastBet === 0 ? 'secondaryButton' : 'tertiaryButton';
    22   const callClass = 'secondaryButton'
     23  const callClass = playerState.pokerGame.table.lastBet > 0 ? 'secondaryButton' : 'tertiaryButton'
    2324  const raiseClass = playerState.pokerGame.table.round >= 2 ? 'secondaryButton' : 'tertiaryButton';
    2425  const foldClass = 'secondaryButton';
     
    3334
    3435  function raise() {
    35     axios.get(`/api/poker?action=game_action&session_id=${localStorage.CAESSINO_SESSION_ID}&specificAction=raise&betAmount=0`);
     36    dispatch(setPoker({
     37        ...styleState.poker,
     38        displays: {
     39            ...styleState.poker.displays,
     40            raiseModal: true,
     41        },
     42    }))
    3643  }
    3744
     
    4047  }
    4148
    42   if (playerState.pokerGame.table.started && playerState.pokerGame.player.isSatDown) {
     49  if (playerState.pokerGame.table.started && playerState.pokerGame.player.isSatDown && parseInt(playerState.pokerGame.table.round) < 5) {
    4350    return (
    4451      <div className="pokerPlayButtonsContainer">
Note: See TracChangeset for help on using the changeset viewer.