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; }
public void AddtoPot(int amount, PokerPlayer player) { if (ContributionToPot.ContainsKey(player)) { ContributionToPot[player] += amount; } else { ContributionToPot.Add(player, amount); } }
/// <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(); } }
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(); } }
public bool IsPlayer(PlayerMobile pm, out PokerPlayer player) { player = Players.FirstOrDefault(x => x.Owner == pm); return(player != null); }
/// <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); }
/// <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); } }
/// <summary> /// Check if the user is already at the table /// </summary> public bool IsBlind(PokerPlayer player) { return(player == BigBlind || player == DealerButton || player == SmallBlind); }
public bool IsPlayer(PlayerMobile pm, out PokerPlayer player) { player = Players.FirstOrDefault(x => x.Owner == pm); return player != null; }
public void MakeBet(PokerPlayer player, int bet) { player.MakeBet(bet); var pot = PokerPots.FirstOrDefault(); if (pot != null) pot.AddtoPot(bet, player); }
/// <summary> /// Check if the user is already at the table /// </summary> public bool IsBlind(PokerPlayer player) { return player == BigBlind || player == DealerButton || player == SmallBlind; }
/// <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; }
/// <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; }
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(); } }