public override void OnClick() { Mobile from = Owner.From; if (from.CheckAlive() && !m_Game.Deleted && m_Game.IsAccessibleTo(from) && m_Game.Players.GetInGameMobiles(true, false).Count == 0) { m_Game.ResetGame(from); } }
public void CheckPlayers() { bool removed = false; for (int i = 0; i < m_Players.Length; i++) { Mobile player = m_Players[i]; if (player != null) { if (player.Deleted) { m_Players[i] = null; SendPlayerExitMessage(player); UpdateDealer(true); removed = true; } else if (m_InGame[i]) { if (player.NetState == null) { m_InGame[i] = false; SendPlayerExitMessage(player); UpdateDealer(true); removed = true; } else if (!m_Game.IsAccessibleTo(player) || player.Map != m_Game.Map || !player.InRange(m_Game.GetWorldLocation(), 5)) { m_InGame[i] = false; player.Send(new MahjongRelieve(m_Game)); SendPlayerExitMessage(player); UpdateDealer(true); removed = true; } } } } for (int i = 0; i < m_Spectators.Count;) { Mobile mobile = (Mobile)m_Spectators[i]; if (mobile.NetState == null || mobile.Deleted) { m_Spectators.RemoveAt(i); } else if (!m_Game.IsAccessibleTo(mobile) || mobile.Map != m_Game.Map || !mobile.InRange(m_Game.GetWorldLocation(), 5)) { m_Spectators.RemoveAt(i); mobile.Send(new MahjongRelieve(m_Game)); } else { i++; } } if (removed && !UpdateSpectators()) { SendPlayersPacket(true, true); } }