Example #1
0
        /// <summary>
        /// Remove the player from the Active Players list for the Mission.
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public bool RemoveActivePlayer(Client client)
        {
            if (!ActivePlayers.Contains(client))
            {
                return(false);
            }

            ActivePlayers.Remove(client);
            client.ResetData(EntityData.ActiveMission);
            NAPI.ClientEvent.TriggerClientEvent(client, "MissionInfo", "Mission_Active_Players", "");
            NAPI.ClientEvent.TriggerClientEvent(client, "MissionInfo", "Mission_Active_Objectives", "");

            string activePlayers = JsonConvert.SerializeObject(GetActivePlayers());

            for (int i = 0; i < ActivePlayers.Count; i++)
            {
                NAPI.ClientEvent.TriggerClientEvent(NAPI.Player.GetPlayerFromHandle(ActivePlayers[i]), "MissionInfo", "Mission_Active_Players", activePlayers);
            }

            if (ActivePlayers.Count <= 0)
            {
                CleanupMission();
            }

            return(true);
        }
Example #2
0
        /// <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);
            }
        }
Example #3
0
        /// <summary>
        /// Add the player to the Active Players list for the Mission.
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public bool AddActivePlayer(Client client)
        {
            if (client.HasData(EntityData.ActiveMission))
            {
                client.SendChatMessage("You must leave your current mission to join a new one. /leavemission");
                return(false);
            }

            if (ActivePlayers.Contains(client))
            {
                return(false);
            }

            ActivePlayers.Add(client);
            client.SetData(EntityData.ActiveMission, this);

            string activePlayers    = JsonConvert.SerializeObject(GetActivePlayers());
            string activeObjectives = JsonConvert.SerializeObject(GetObjectives());

            for (int i = 0; i < ActivePlayers.Count; i++)
            {
                NAPI.ClientEvent.TriggerClientEvent(NAPI.Player.GetPlayerFromHandle(ActivePlayers[i]), "MissionInfo", "Mission_Active_Players", activePlayers);
                NAPI.ClientEvent.TriggerClientEvent(NAPI.Player.GetPlayerFromHandle(ActivePlayers[i]), "MissionInfo", "Mission_Active_Objectives", activeObjectives);
            }

            return(true);
        }
Example #4
0
        private void RoboPlayerCallback(RoboPlayerPlugin plugin, RoboCard[] chosenCards, Exception ex)
        {
            RoboPlayer player = plugin.Player;

            if (player == null || !ActivePlayers.Contains(plugin))
            {
                return;
            }
            if (player.PlayerState != RoboPlayerState.Thinking || ex != null)
            {
                player.PlayerState = RoboPlayerState.Error;
            }
            else
            {
                if (player.EndRound(chosenCards))
                {
                    player.PlayerState = RoboPlayerState.Decided;
                }
                else
                {
                    player.PlayerState = RoboPlayerState.Error;
                }
            }

            Action playingCards = DoPlayingCards;

            playingCards.BeginInvoke(null, playingCards);
        }