static void EventSink_Disconnected(DisconnectedEventArgs e)
        {
            Mobile from = e.Mobile;

            if (from == null)
            {
                return;
            }

            if (from is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)from;

                PokerGame game = pm.PokerGame;

                if (game != null)
                {
                    PokerPlayer player = game.GetPlayer(from);

                    if (player != null)
                    {
                        game.RemovePlayer(player);
                    }
                }
            }
        }
Exemple #2
0
		public static void PokerKick_OnCommand(CommandEventArgs e)
		{
			Mobile from = e.Mobile;

			if (from == null)
			{
				return;
			}

			var list = from.GetMobilesInRange(0);

			foreach (var pm in list.OfType<PlayerMobile>().Where(pm=>pm.PokerGame!=null))
			{
				PokerGame game = pm.PokerGame;

				PokerPlayer player = game.GetPlayer(pm);

				if (player == null)
				{
					continue;
				}

				game.RemovePlayer(player);
				from.SendMessage("They have been removed from the poker table");

				list.Free();
				return;
			}

			list.Free();

			from.SendMessage("No one found to kick from a poker table. Make sure you are standing on top of them.");
		}
        public static void PokerKick_OnCommand(CommandEventArgs e)
        {
            Mobile from = e.Mobile;

            if (from == null)
            {
                return;
            }

            foreach (Mobile m in from.GetMobilesInRange(0))
            {
                if (m is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)m;

                    PokerGame game = pm.PokerGame;

                    if (game != null)
                    {
                        PokerPlayer player = game.GetPlayer(m);

                        if (player != null)
                        {
                            game.RemovePlayer(player);
                            from.SendMessage("They have been removed from the poker table");
                            return;
                        }
                    }
                }
            }

            from.SendMessage("No one found to kick from a poker table. Make sure you are standing on top of them.");
        }
Exemple #4
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;
                }
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (from == null)
            {
                return;
            }

            PokerPlayer player = m_Game.GetPlayer(from);

            if (player != null)
            {
                if (info.ButtonID == 1)
                {
                    if (m_Game.State == PokerGameState.Inactive)
                    {
                        if (m_Game.Players.Contains(player))
                        {
                            m_Game.RemovePlayer(player);
                        }
                        return;
                    }


                    if (player.RequestLeave)
                    {
                        from.SendMessage(0x22, "You have already submitted a request to leave.");
                    }
                    else
                    {
                        from.SendMessage(0x22, "You have submitted a request to leave the table.");
                        player.RequestLeave = true;
                    }
                }
            }
        }