コード例 #1
0
 public PokerBetGump(PlayerMobile user, PokerGame game, PokerPlayer player, Gump parent = null)
     : base(user, parent, 526, 449)
 {
     Closable = false;
     Disposable = false;
     Dragable = true;
     Resizable = false;
     _Player = player;
     _Game = game;
 }
コード例 #2
0
ファイル: PokerPot.cs プロジェクト: AdamUOF/UOFTexasHoldem
 public void AddtoPot(int amount, PokerPlayer player)
 {
     if (ContributionToPot.ContainsKey(player))
     {
         ContributionToPot[player] += amount;
     }
     else
     {
         ContributionToPot.Add(player, amount);
     }
 }
コード例 #3
0
        /// <summary>
        ///     Add a player to the poker game
        /// </summary>
        public void AddPlayer(PlayerMobile player, int buyin)
        {
            if (!CanJoinTable(player, buyin))
            {
                return;
            }

            var seat = Dealer.Seats.FirstOrDefault(x => !Dealer.SeatTaken(x));

            if (seat != Point3D.Zero)
            {
                var pokerplayer = new PokerPlayer(player, buyin, seat, this);
                Players.Add(pokerplayer);
            }

            if (Players.Count > 1 && !IsIntermission() && HandCoolDown <= TimeSpan.FromSeconds(0))
            {
                StartIntermission();
            }
        }
コード例 #4
0
        public void DoAction(PokerPlayer player, PlayerAction action, int bet = 0, bool isforced = false,
                             bool verbose = true)
        {
            if (!isforced && CurrentTurn != player)
            {
                return;
            }

            var    pm      = player.Owner;
            string message = string.Empty;

            Exporter.AddAction(pm, action, State, action == PlayerAction.AllIn ? player.Currency : bet);

            switch (action)
            {
            case PlayerAction.Bet:
                message = String.Format("I {0} {1}.", "bet", bet);

                MakeBet(player, bet);

                MinimumBet = bet;
                //raise after a bet is always 2*bet according to poker rules
                MinimumRaise = bet * 2;

                break;

            case PlayerAction.Raise:
                message = String.Format("I {0} {1}.",
                                        RoundActions.Exists(x => x == PlayerAction.Raise) ? "reraise" : "raise", bet);

                MakeBet(player, GetCallAmount(player) + bet);

                MinimumBet  += bet;
                MinimumRaise = bet;

                break;

            case PlayerAction.Call:
                message = "I call.";

                //match what is on the table from the last player. This takes into account how much you already have on the table in that round
                bet = GetCallAmount(player);

                MakeBet(player, bet);

                break;

            case PlayerAction.Check:

                message = "Check.";

                break;

            case PlayerAction.Fold:
                message = "I fold.";

                player.HasFolded = true;

                if (ActivePlayers.Count(x => !x.HasFolded) == 1)
                {
                    DoShowdown();
                    return;
                }

                break;

            case PlayerAction.AllIn:
                if (player.Currency > 0)
                {
                    message = MinimumBet > player.Currency ? "I call: all-in." : "All in.";

                    int difference = player.Currency + player.TotalBetInRound;

                    if (difference > MinimumBet)
                    {
                        MinimumBet = difference;
                    }

                    MakeBet(player, player.Currency);
                }

                break;
            }

            RefreshGumps();

            if (verbose)
            {
                PokerMessage(pm, message);
            }

            if (!isforced)
            {
                player.HasActed = true;
            }

            RoundActions.Add(action);

            if (!isforced && !CanEndBettingRound())
            {
                AssignNextTurn();
            }
        }
コード例 #5
0
 public bool IsPlayer(PlayerMobile pm, out PokerPlayer player)
 {
     player = Players.FirstOrDefault(x => x.Owner == pm);
     return(player != null);
 }
コード例 #6
0
 /// <summary>
 ///     Gets the amount a player needs to bet in order to meet the current minimum bet to stay in the game
 ///     <returns>amount needed to meet call</returns>
 /// </summary>
 public int GetCallAmount(PokerPlayer player)
 {
     return(MinimumBet - player.TotalBetInRound);
 }
コード例 #7
0
ファイル: PokerGame.cs プロジェクト: AdamUOF/UOFTexasHoldem
        /// <summary>
        ///     Remove player from the game
        /// </summary>
        public void RemovePlayer(PokerPlayer player)
        {
            if (player != null)
            {
                //null these here so we know that one of the key players for the next game has left
                if (DealerButton == player)
                {
                    DealerButton = null;
                }
                if (SmallBlind == player)
                {
                    SmallBlind = null;
                }
                if (BigBlind == player)
                {
                    BigBlind = null;
                }

                //Move to view list so that they can continue viewing the game
                if (ActivePlayers.Contains(player))
                    Viewers.Add(player.Owner);

                Players.Remove(player);

                player.LeaveGame(this);
            }
        }
コード例 #8
0
 /// <summary>
 ///     Check if the user is already at the table
 /// </summary>
 public bool IsBlind(PokerPlayer player)
 {
     return(player == BigBlind || player == DealerButton || player == SmallBlind);
 }
コード例 #9
0
ファイル: PokerGame.cs プロジェクト: AdamUOF/UOFTexasHoldem
 public bool IsPlayer(PlayerMobile pm, out PokerPlayer player)
 {
     player = Players.FirstOrDefault(x => x.Owner == pm);
     return player != null;
 }
コード例 #10
0
ファイル: PokerGame.cs プロジェクト: AdamUOF/UOFTexasHoldem
        public void MakeBet(PokerPlayer player, int bet)
        {
            player.MakeBet(bet);

            var pot = PokerPots.FirstOrDefault();

            if (pot != null)
                pot.AddtoPot(bet, player);
        }
コード例 #11
0
ファイル: PokerGame.cs プロジェクト: AdamUOF/UOFTexasHoldem
 /// <summary>
 ///     Check if the user is already at the table
 /// </summary>
 public bool IsBlind(PokerPlayer player)
 {
     return player == BigBlind || player == DealerButton || player == SmallBlind;
 }
コード例 #12
0
ファイル: PokerGame.cs プロジェクト: AdamUOF/UOFTexasHoldem
        /// <summary>
        ///     Creates a list of active players and grabs the next active player that can act. If play doesn't exist, grab the
        ///     first player in the list
        ///     <returns>next active player</returns>
        /// </summary>
        public PokerPlayer GetNextActivePlayer(PokerPlayer current)
        {
            var index = ActivePlayers.IndexOf(current);

            PokerPlayer activeplayer;

            do
            {
                activeplayer = ActivePlayers[index == -1 ? 0 : (index + 1 >= ActivePlayers.Count ? 0 : (index + 1))];
                index = ActivePlayers.IndexOf(activeplayer);
            }
            while (activeplayer.Currency == 0 || activeplayer.HasFolded);

            return activeplayer == current ? null : activeplayer;
        }
コード例 #13
0
ファイル: PokerGame.cs プロジェクト: AdamUOF/UOFTexasHoldem
 /// <summary>
 ///     Gets the amount a player needs to bet in order to meet the current minimum bet to stay in the game
 ///     <returns>amount needed to meet call</returns>
 /// </summary>
 public int GetCallAmount(PokerPlayer player)
 {
     return MinimumBet - player.TotalBetInRound;
 }
コード例 #14
0
ファイル: PokerGame.cs プロジェクト: AdamUOF/UOFTexasHoldem
        public void DoAction(PokerPlayer player, PlayerAction action, int bet = 0, bool isforced = false,
            bool verbose = true)
        {
            if (!isforced && CurrentTurn != player)
                return;

            var pm = player.Owner;
            string message = string.Empty;

            Exporter.AddAction(pm, action, State, action == PlayerAction.AllIn ? player.Currency : bet);

            switch (action)
            {
                case PlayerAction.Bet:
                    message = String.Format("I {0} {1}.", "bet", bet);

                    MakeBet(player, bet);

                    MinimumBet = bet;
                    //raise after a bet is always 2*bet according to poker rules
                    MinimumRaise = bet * 2;

                    break;
                case PlayerAction.Raise:
                    message = String.Format("I {0} {1}.",
                        RoundActions.Exists(x => x == PlayerAction.Raise) ? "reraise" : "raise", bet);

                    MakeBet(player, GetCallAmount(player) + bet);

                    MinimumBet += bet;
                    MinimumRaise = bet;

                    break;

                case PlayerAction.Call:
                    message = "I call.";

                    //match what is on the table from the last player. This takes into account how much you already have on the table in that round
                    bet = GetCallAmount(player);

                    MakeBet(player, bet);

                    break;

                case PlayerAction.Check:

                    message = "Check.";

                    break;

                case PlayerAction.Fold:
                    message = "I fold.";

                    player.HasFolded = true;

                    if (ActivePlayers.Count(x => !x.HasFolded) == 1)
                    {
                        DoShowdown();
                        return;
                    }

                    break;

                case PlayerAction.AllIn:
                    if (player.Currency > 0)
                    {
                        message = MinimumBet > player.Currency ? "I call: all-in." : "All in.";

                        int difference = player.Currency + player.TotalBetInRound;

                        if (difference > MinimumBet)
                        {
                            MinimumBet = difference;
                        }

                        MakeBet(player, player.Currency);
                    }

                    break;
            }

            RefreshGumps();

            if (verbose)
            {
                PokerMessage(pm, message);
            }

            if (!isforced)
            {
                player.HasActed = true;
            }

            RoundActions.Add(action);

            if (!isforced && !CanEndBettingRound())
            {
                AssignNextTurn();
            }
        }
コード例 #15
0
ファイル: PokerGame.cs プロジェクト: AdamUOF/UOFTexasHoldem
        /// <summary>
        ///     Add a player to the poker game
        /// </summary>
        public void AddPlayer(PlayerMobile player, int buyin)
        {
            if (!CanJoinTable(player, buyin))
            {
                return;
            }

            var seat = Dealer.Seats.FirstOrDefault(x => !Dealer.SeatTaken(x));

            if (seat != Point3D.Zero)
            {
                var pokerplayer = new PokerPlayer(player, buyin, seat, this);
                Players.Add(pokerplayer);
            }

            if (Players.Count > 1 && !IsIntermission() && HandCoolDown <= TimeSpan.FromSeconds(0))
            {
                StartIntermission();
            }
        }