public void StartRound() { m_GameProgress = PokerProgress.PreFlop; if (m_PrepareTimer != null) { m_PrepareTimer.Stop(); m_PrepareTimer = null; } if (ReadyPlayers.Length < 2) return; foreach (PokerPlayer player in ReadyPlayers) { player.Status = Status.Playing; player.Hand.AddCard(Deck.GetCard()); player.Hand.AddCard(Deck.GetCard()); } m_Dealer = NextValidIndex(m_Dealer, Status.Playing); m_PlayerTurn = NextValidIndex(m_Dealer, Status.Playing); Raise(Players[m_PlayerTurn], BlindSmall, true); m_PlayerTurn = NextValidIndex(m_PlayerTurn, Status.Playing); Raise(Players[m_PlayerTurn], BlindSmall, true); CalculateAction(); }
public void PrepareForRound() { m_GameProgress = PokerProgress.None; if (m_PrepareTimer != null) { m_PrepareTimer.Stop(); m_PrepareTimer = null; } Deck.Shuffle(); CommunityCards.Clear(); m_PotWorth = 0; m_MovesSinceDeal = 0; m_HighestBet = 0; int count = 0; foreach (PokerPlayer player in PlayersWithStatus(Status.AllIn)) { if (player != null && player.Bankroll == 0) count++; } while (m_Award > Award.None && PTActive && count > 0 && ReadyPlayers.Length > 0) { int lowestallin = 0; PokerPlayer allinplayer = null; foreach (PokerPlayer player in Players) { if (player != null) if (player.Bankroll == 0 && player.Status == Status.AllIn) if (lowestallin == 0) { allinplayer = player; lowestallin = player.TotalBet; } else if (player.TotalBet < lowestallin) { allinplayer = player; lowestallin = player.TotalBet; } } if (allinplayer != null) { AwardList.Add(allinplayer.Mobile); allinplayer.Status = Status.WaitingForRound; count--; } } foreach (PokerPlayer player in Players) { if (player != null) { player.RoundBet = 0; player.TotalBet = 0; player.Result = null; player.AutoFold = false; player.AutoCall = false; player.Hand.Clear(); player.Mobile.CloseGump(typeof(BettingGump)); } } for (int i = 0; i < ReadyPlayers.Length; i++) { PokerPlayer player = (PokerPlayer)ReadyPlayers[i]; if (player.Bankroll <= 0) { if (PTActive) VerifyQuit(player.Mobile); else { player.Status = Status.GettingGold; player.BeginGetGold(this); player.Mobile.SendGump(new GetGoldGump(this, player)); } i--; } else if (player.Quitting) { VerifyQuit(player.Mobile); i--; } } if (m_DealerSetup > DealerSetup.Regular && ReadyPlayers.Length > 0 && PTActive) { while (m_DealerSetup == DealerSetup.ForwardTable && ReadyPlayers.Length > 0 && ReadyPlayers.Length <= PTMaxForward) { for (int i = 0; i < Players.Length; i++) { PokerPlayer player = (PokerPlayer)Players[i]; if (player != null) { int bankroll = player.Bankroll; Mobile mobile = player.Mobile; CloseAllGumps(mobile); Players[i] = null; if (m_PTNextDealer == null) { mobile.CantWalk = false; mobile.Backpack.DropItem(new PokerTournyTicket(bankroll, mobile)); player.Mobile.MoveToWorld(m_WinnerPoint, Map); player.Mobile.SendMessage("Thou'rt being transferred to the winners area, wait for further instructions."); } else { m_PTNextDealer.VerifyJoin(mobile, bankroll, false, false); player.Mobile.SendMessage("Thou have been transferred to the next table, the game will start when the table is full."); } break; } } } if ((m_DealerSetup == DealerSetup.FinalTable || m_DealerSetup == DealerSetup.SingleLoop) && ReadyPlayers.Length == 1) { PokerPlayer player = (PokerPlayer)ReadyPlayers[0]; AwardList.Add(player.Mobile); foreach (NetState state in NetState.Instances) { Mobile from = state.Mobile; if (from != null && m_msg) { from.SendMessage(0x482, String.Format("Poker tournament announcement!")); from.SendMessage(0x482, String.Format("{0} has won the poker tournament,", player.Mobile.Name)); if (m_TournyReward != null) from.SendMessage(0x482, String.Format(" with \"{0}\" as reward", m_TournyReward.Name)); } } if (m_TournyReward != null) { player.Mobile.SendMessage("You recieved a poker tournament reward in your bank box."); Item item = m_TournyReward; player.Mobile.BankBox.DropItem(item); item.Movable = true; m_TournyReward = null; } switch (PTticketReward) { case PokerReward.None: break; case PokerReward.PokerLowRollerTicket: player.Mobile.SendMessage("You recieved a low-roller poker entry ticket your bank box."); player.Mobile.BankBox.DropItem(new PokerLowRollerTicket()); break; case PokerReward.PokerHighRollerTicket: player.Mobile.SendMessage("You recieved a high-roller poker entry ticket your bank box."); player.Mobile.BankBox.DropItem(new PokerHighRollerTicket()); break; } if(AwardList.Count > 0) GiveAward(PTAward == Award.None ? 0 : PTAward == Award.Top1 ? 1 : PTAward == Award.Top3 ? 3 : PTAward == Award.Top5 ? 5 : 10); player.Mobile.MoveToWorld(m_WinnerPoint, Map); CloseAllGumps(player.Mobile); player.Mobile.CantWalk = false; int i = GetIndex(player); if (i >= 0) Players[i] = null; } } if (DealerMode == DealerSetup.SingleLoop && ReadyPlayers.Length == 0) { m_RoundRaise = 0; BlindSmall = m_memblind; PTActive = false; } if (PTActive) { m_RoundRaise++; if (m_RoundRaise > ReadyPlayers.Length) { m_RoundRaise = 0; BlindSmall += PTRaiseSmall; } } RefreshGump(); if (ReadyPlayers.Length >= 2 && m_PrepareTimer == null) m_PrepareTimer = Timer.DelayCall(TimeSpan.FromSeconds(2.0), new TimerCallback(StartRound)); }