Package bluffinmuffin.poker.entities

Examples of bluffinmuffin.poker.entities.PlayerInfo


            @Override
            public void gameBlindsNeeded()
            {
                writeLine("==> Game started");
                final TableInfo table = m_game.getTable();
                final PlayerInfo d = table.getPlayer(table.getNoSeatDealer());
                final PlayerInfo sb = table.getPlayer(table.getNoSeatSmallBlind());
                final PlayerInfo bb = table.getPlayer(table.getNoSeatBigBlind());
                writeLine("==> " + d.getName() + " is the Dealer");
                writeLine("==> " + sb.getName() + " is the SmallBlind");
                writeLine("==> " + bb.getName() + " is the BigBlind");
            }
           
            @Override
            public void gameEnded()
            {
View Full Code Here


            }
           
            @Override
            public void holeCardsChangedCommandReceived(PlayerHoleCardsChangedCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    if (command.isPlaying())
                    {
                        p.setPlaying();
                    }
                    else
                    {
                        p.setNotPlaying();
                    }
                    final List<Integer> ids = command.getCardsId();
                    final Card gc0 = Card.getInstance(ids.get(0));
                    final Card gc1 = Card.getInstance(ids.get(1));
                    p.setCards(gc0, gc1);
                    m_gameObserver.playerHoleCardsChanged(p);
                }
            }
           
            @Override
            public void playerJoinedCommandReceived(PlayerJoinedCommand command)
            {
                final PlayerInfo p = new PlayerInfo(command.getPlayerPos(), command.getPlayerName(), command.getPlayerMoney());
                if (p != null)
                {
                    m_pokerTable.forceJoinTable(p, command.getPlayerPos());
                    m_gameObserver.playerJoined(p);
                }
            }
           
            @Override
            public void playerLeftCommandReceived(PlayerLeftCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    m_pokerTable.leaveTable(p);
                    m_gameObserver.playerLeaved(p);
                }
            }
           
            @Override
            public void playerMoneyChangedCommandReceived(PlayerMoneyChangedCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    p.setMoneySafeAmnt(command.getPlayerMoney());
                    m_gameObserver.playerMoneyChanged(p);
                }
            }
           
            @Override
            public void playerTurnBeganCommandReceived(PlayerTurnBeganCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                final PlayerInfo last = m_pokerTable.getPlayer(command.getLastPlayerNoSeat());
                if (p != null)
                {
                    m_pokerTable.setNoSeatCurrPlayer(command.getPlayerPos());
                    m_gameObserver.playerActionNeeded(p, last);
                }
            }
           
            @Override
            public void playerTurnEndedCommandReceived(PlayerTurnEndedCommand command)
            {
                if (m_pokerTable.getHigherBet() < command.getPlayerBet())
                {
                    m_pokerTable.setHigherBet(command.getPlayerBet());
                }
                m_pokerTable.setTotalPotAmnt(command.getTotalPot());
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    if (command.getActionType() == PlayerActionType.RAISED)
                    {
                        m_pokerTable.setNoSeatLastRaise(p.getNoSeat());
                    }
                    final int a = command.getActionAmount();
                    p.setMoneyBetAmnt(command.getPlayerBet());
                    p.setMoneySafeAmnt(command.getPlayerMoney());
                    if (command.isPlaying())
                    {
                        p.setPlaying();
                    }
                    else
                    {
                        p.setNotPlaying();
                    }
                    m_gameObserver.playerActionTaken(p, command.getActionType(), a);
                }
            }
           
            @Override
            public void playerWonPotCommandReceived(PlayerWonPotCommand command)
            {
                final PlayerInfo p = m_pokerTable.getPlayer(command.getPlayerPos());
                if (p != null)
                {
                    p.setMoneySafeAmnt(command.getPlayerMoney());
                    m_gameObserver.playerWonPot(p, new PotInfo(command.getPotID(), command.getShared()), command.getShared());
                }
            }
           
            @Override
            public void tableClosedCommandReceived(TableClosedCommand command)
            {
                m_gameObserver.everythingEnded();
            }
           
            @Override
            public void tableInfoCommandReceived(TableInfoCommand command)
            {
                m_pokerTable.setTotalPotAmnt(command.getTotalPotAmount());
                m_pokerTable.setBetLimit(command.getLimit());
                final List<Integer> amounts = command.getPotsAmount();
                m_pokerTable.getPots().clear();
                for (int i = 0; i < amounts.size() && amounts.get(i) > 0; ++i)
                {
                    m_pokerTable.getPots().add(new PotInfo(i, amounts.get(i)));
                }
               
                final Card[] cards = new Card[5];
                for (int i = 0; i < 5; ++i)
                {
                    cards[i] = Card.getInstance(command.getBoardCardIDs().get(i));
                }
                m_pokerTable.setCards(cards[0], cards[1], cards[2], cards[3], cards[4]);
               
                for (final PlayerInfo p : m_pokerTable.getPlayers())
                {
                    m_pokerTable.leaveTable(p);
                }
                for (int i = 0; i < command.getNbPlayers(); ++i)
                {
                    final TuplePlayerInfo seat = command.getSeats().get(i);
                    if (seat.m_isEmpty)
                    {
                        continue;
                    }
                    final int noSeat = seat.m_noSeat;
                    final PlayerInfo p = new PlayerInfo(noSeat, seat.m_playerName, seat.m_money);
                    m_pokerTable.forceJoinTable(p, noSeat);
                    final List<Integer> ids = seat.m_holeCardIDs;
                    p.setCards(Card.getInstance(ids.get(0)), Card.getInstance(ids.get(1)));
                    if (seat.m_isPlaying)
                    {
                        p.setPlaying();
                    }
                   
                    if (seat.m_isDealer)
                    {
                        m_pokerTable.setNoSeatDealer(noSeat);
                    }
                    if (seat.m_isSmallBlind)
                    {
                        m_pokerTable.setNoSeatSmallBlind(noSeat);
                    }
                    if (seat.m_isBigBlind)
                    {
                        m_pokerTable.setNoSeatBigBlind(noSeat);
                    }
                    if (seat.m_isCurrentPlayer)
                    {
                        m_pokerTable.setNoSeatCurrPlayer(noSeat);
                    }
                   
                    p.setMoneyBetAmnt(seat.m_bet);
                   
                    m_gameObserver.playerHoleCardsChanged(p);
                   
                }
                m_gameObserver.gameGenerallyUpdated();
View Full Code Here

            {
                public void actionPerformed(java.awt.event.ActionEvent e)
                {
                    disableButtons();
                    final TableInfo table = m_game.getTable();
                    final PlayerInfo p = table.getPlayer(m_currentTablePosition);
                    m_game.playMoney(p, -1);
                }
            });
        }
        return jFoldButton;
View Full Code Here

            {
                public void actionPerformed(java.awt.event.ActionEvent e)
                {
                    disableButtons();
                    final TableInfo table = m_game.getTable();
                    final PlayerInfo p = table.getPlayer(m_currentTablePosition);
                    m_game.playMoney(p, table.getCallAmnt(p));
                }
            });
        }
        return jCallButton;
View Full Code Here

            {
                public void actionPerformed(java.awt.event.ActionEvent e)
                {
                    disableButtons();
                    final TableInfo table = m_game.getTable();
                    final PlayerInfo p = table.getPlayer(m_currentTablePosition);
                    m_game.playMoney(p, (Integer) getJRaiseSpinner().getValue() - p.getMoneyBetAmnt());
                }
            });
        }
        return jRaiseButton;
    }
View Full Code Here

    }
   
    public void setCallButtonName()
    {
        final TableInfo table = m_game.getTable();
        final PlayerInfo p = table.getPlayer(m_currentTablePosition);
        String s;
        if (table.canCheck(p))
        {
            s = "CHECK";
        }
        else if (table.getHigherBet() >= p.getMoneyAmnt())
        {
            s = "ALL-IN";
        }
        else
        {
View Full Code Here

       
        for (int i = 0; i < info.getNbMaxSeats(); ++i)
        {
            final TuplePlayerInfo seat = new TuplePlayerInfo(i);
            m_seats.add(seat);
            final PlayerInfo player = info.getPlayer(i);
            seat.m_isEmpty = (player == null);
           
            if (seat.m_isEmpty)
            {
                continue;
            }
           
            seat.m_playerName = player.getName(); // playerName
            seat.m_money = player.getMoneySafeAmnt(); // playerMoney
           
            final boolean showCard = (i == pPlayer.getNoSeat());
           
            // Player cards
            final Card[] holeCards = player.getCards(showCard);
            for (int j = 0; j < 2; ++j)
            {
                seat.m_holeCardIDs.add(holeCards[j].getId());
            }
           
            seat.m_isDealer = info.getNoSeatDealer() == i; // isDealer
            seat.m_isSmallBlind = info.getNoSeatSmallBlind() == i; // isSmallBlind
            seat.m_isBigBlind = info.getNoSeatBigBlind() == i; // isBigBlind
            seat.m_isCurrentPlayer = info.getNoSeatCurrPlayer() == i; // isCurrentPlayer
            seat.m_timeRemaining = 0; // timeRemaining
            seat.m_bet = player.getMoneyBetAmnt(); // betAmount
            seat.m_isPlaying = player.isPlaying();
        }
        m_limit = info.getBetLimit();
    }
View Full Code Here

    /**
     * Choisi le prochain joueur a Better
     */
    private void playNext()
    {
        final PlayerInfo player = m_table.nextPlayingPlayer(m_table.getNoSeatCurrPlayer());
        final PlayerInfo old = m_table.getPlayer(m_table.getNoSeatCurrPlayer());
        m_table.setNoSeatCurrPlayer(player.getNoSeat());
        m_gameObserver.playerActionNeeded(player, old);
        if (player.isZombie())
        {
            if (m_table.canCheck(player))
View Full Code Here

     *             Error with the TCP connection
     */
    public GameTCPServer(PokerGame game, String name, int money)
    {
        m_game = game;
        m_player = new PlayerInfo(name, money);
        m_userInfo = null;
        initializeCommandObserver();
    }
View Full Code Here

    {
        m_game = game;
        m_userInfo = user;
        final int money = (int) m_userInfo.getTotalMoney();
        m_userInfo.setTotalMoney(m_userInfo.getTotalMoney() - money);
        m_player = new PlayerInfo(m_userInfo.getDisplayName(), money);
        initializeCommandObserver();
    }
View Full Code Here

TOP

Related Classes of bluffinmuffin.poker.entities.PlayerInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.