示例#1
0
        protected override void OnTick()
        {
            if (m_Game.State != PokerGameState.Inactive && m_Game.Players.Count < 2)
            {
                m_Game.End();
            }

            for (int i = 0; i < m_Game.Players.Count; ++i)
            {
                if (!m_Game.Players.Round.Contains(m_Game.Players[i]))
                {
                    if (m_Game.Players[i].RequestLeave)
                    {
                        m_Game.RemovePlayer(m_Game.Players[i]);
                    }
                }
            }

            if (m_Game.NeedsGumpUpdate)
            {
                foreach (PokerPlayer player in m_Game.Players.Players)
                {
                    player.Mobile.CloseGump <PokerTableGump>();
                    player.SendGump(new PokerTableGump(m_Game, player));
                }

                m_Game.NeedsGumpUpdate = false;
            }

            if (m_Game.State != m_LastState && m_Game.Players.Round.Count > 1)
            {
                m_LastState = m_Game.State;
                m_Game.DoRoundAction();
                m_LastPlayer = null;
            }

            if (m_Game.Players.Peek() != null)
            {
                if (m_LastPlayer == null)
                {
                    m_LastPlayer = m_Game.Players.Peek();                     //Changed timer from 25.0 and 30.0 to 45.0 and 60.0
                }
                if (m_LastPlayer.BetStart.AddSeconds(45.0) <= DateTime.Now /*&& m_LastPlayer.Mobile.HasGump( typeof( PokerBetGump ) )*/ && !hasWarned)
                {
                    m_LastPlayer.SendMessage(0x22, "You have 15 seconds left to make a choice. (You will automatically fold if no choice is made)");
                    hasWarned = true;
                }
                else if (m_LastPlayer.BetStart.AddSeconds(60.0) <= DateTime.Now /*&& m_LastPlayer.Mobile.HasGump( typeof( PokerBetGump ) )*/)
                {
                    PokerPlayer temp = m_LastPlayer;
                    m_LastPlayer = null;

                    temp.Mobile.CloseGump <PokerBetGump>();
                    temp.Action = PlayerAction.Fold;
                    hasWarned   = false;
                }
            }
        }
示例#2
0
        public PokerPlayer AssignNextTurn()
        {
            PokerPlayer nextTurn = Players.Next();

            if (nextTurn == null)
            {
                return(null);
            }

            if (nextTurn.RequestLeave)
            {
                Players.Push(nextTurn);
                nextTurn.BetStart = DateTime.UtcNow;
                nextTurn.Action   = PlayerAction.Fold;
                return(nextTurn);
            }

            if (nextTurn.IsAllIn)
            {
                Players.Push(nextTurn);
                nextTurn.BetStart = DateTime.UtcNow;
                nextTurn.Action   = PlayerAction.AllIn;
                return(nextTurn);
            }

            if (nextTurn.LonePlayer)
            {
                Players.Push(nextTurn);
                nextTurn.BetStart = DateTime.UtcNow;
                nextTurn.Action   = PlayerAction.Check;
                return(nextTurn);
            }

            bool canCall = false;

            PokerPlayer currentTurn = Players.Peek();

            if (currentTurn != null && currentTurn.Action != PlayerAction.Check &&
                currentTurn.Action != PlayerAction.Fold)
            {
                canCall = true;
            }
            if (currentTurn == null && State == PokerGameState.PreFlop)
            {
                canCall = true;
            }

            Players.Push(nextTurn);
            nextTurn.BetStart = DateTime.UtcNow;

            var         entry = new ResultEntry(nextTurn);
            List <Card> bestCards;

            entry.Rank      = nextTurn.GetBestHand(CommunityCards, out bestCards);
            entry.BestCards = bestCards;

            nextTurn.SendMessage(0x22, String.Format("You have {0}.", HandRanker.RankString(entry)));
            nextTurn.CloseGump(typeof(PokerBetGump));
            nextTurn.SendGump(new PokerBetGump(this, nextTurn, canCall));

            NeedsGumpUpdate = true;

            return(nextTurn);
        }