Ejemplo n.º 1
0
        private void TryRevivePlayer(string[] Input)
        {
            string CharacterName = Input[1];

            if (!CharactersDatabase.DoesCharacterExist(CharacterName))
            {
                MessageLog.Print("That character doesnt exist, cant revive them.");
                return;
            }
            ClientConnection Client = ClientSubsetFinder.GetClientUsingCharacter(CharacterName);

            if (Client == null)
            {
                MessageLog.Print("That character is not ingame right now, cant revive them.");
                return;
            }
            if (Client.Character.IsAlive)
            {
                MessageLog.Print("That character is not dead, cant revive them.");
                return;
            }
            MessageLog.Print("Reviving " + CharacterName + "...");
            Client.Character.IsAlive = true;
            Client.Character.SetDefaultValues();
            CombatPacketSenders.SendLocalPlayerRespawn(Client.ClientID, Client.Character);
            foreach (ClientConnection OtherClient in ClientSubsetFinder.GetInGameClientsExceptFor(Client.ClientID))
            {
                CombatPacketSenders.SendRemotePlayerRespawn(OtherClient.ClientID, Client.Character);
            }
        }
Ejemplo n.º 2
0
        //Tries using the command arguments for killing one of the player characters
        private void TryKillPlayer(string[] Input)
        {
            string CharacterName = Input[1];

            if (!CharactersDatabase.DoesCharacterExist(CharacterName))
            {
                MessageLog.Print("That character doesnt exist, cant kill them.");
                return;
            }
            ClientConnection Client = ClientSubsetFinder.GetClientUsingCharacter(CharacterName);

            if (Client == null)
            {
                MessageLog.Print("That character is not ingame right now, cant kill them.");
                return;
            }
            //Make sure the character is still alive
            if (!Client.Character.IsAlive)
            {
                MessageLog.Print("That character is already dead, cant kill them.");
                return;
            }
            MessageLog.Print("Killing " + CharacterName + "...");
            Client.Character.IsAlive = false;
            Client.Character.RemoveBody(Program.World.World);
            //Client.RemovePhysicsBody(Program.World.WorldSimulation);
            CombatPacketSenders.SendLocalPlayerDead(Client.ClientID);
            foreach (ClientConnection OtherClient in ClientSubsetFinder.GetInGameClientsExceptFor(Client.ClientID))
            {
                CombatPacketSenders.SendRemotePlayerDead(OtherClient.ClientID, Client.Character.Name);
            }
        }
Ejemplo n.º 3
0
        //Tries using the command arguments for performing a character info search
        private void TryCharacterInfoSearch(string[] Input)
        {
            //Get the characters name
            string CharacterName = Input[1];

            //Make sure the character exists
            if (!CharactersDatabase.DoesCharacterExist(CharacterName))
            {
                //Say the character doesnt exist and exit the function
                MessageLog.Print("No character named " + CharacterName + " exists, couldnt look up their info.");
                return;
            }

            //Characters Data will be stored here once we acquire it
            Server.Data.CharacterData Data;

            //Find the client currently controlling this character
            ClientConnection Client = ClientSubsetFinder.GetClientUsingCharacter(CharacterName);

            //If no client was found then we want to get the characters info from the database
            if (Client == null)
            {
                Data = CharactersDatabase.GetCharacterData(CharacterName);
            }
            //Otherwise we get the currently live data from the client who is currently using the character
            else
            {
                Data = Client.Character;
            }

            //Define some nicely formatted strings containing all the characters data
            string CharacterInfo     = CharacterName + " level " + Data.Level + (Data.IsMale ? " male." : "female.") + " with " + Data.CurrentHealth + "/" + Data.MaxHealth + " HP.";
            string CharacterPosition = "Position: " + "(" + Data.Position.X + "," + Data.Position.Y + "," + Data.Position.Z + ").";
            string CharacterRotation = "Rotation: (" + Data.Rotation.X + "," + Data.Rotation.Y + "," + Data.Rotation.Z + "," + Data.Rotation.W + ").";
            string CharacterCamera   = "Camera: Zoom:" + Data.CameraZoom + " XRot:" + Data.CameraXRotation + " YRot:" + Data.CameraYRotation + ".";

            //Display all the information to the message window
            MessageLog.Print(CharacterInfo);
            MessageLog.Print(CharacterPosition);
            MessageLog.Print(CharacterRotation);
            MessageLog.Print(CharacterCamera);
        }
Ejemplo n.º 4
0
        //Tries using the command arguments for performing a player kick
        private void TryKickPlayer(string[] Input)
        {
            //Get the characters name
            string CharacterName = Input[1];

            //Make sure the character exists
            if (!CharactersDatabase.DoesCharacterExist(CharacterName))
            {
                MessageLog.Print("That character doesnt exist, cant kick them.");
                return;
            }

            //Get the client who this character belongs to
            ClientConnection Client = ClientSubsetFinder.GetClientUsingCharacter(CharacterName);

            //If the client couldnt be found then the character isnt logged in currently
            if (Client == null)
            {
                MessageLog.Print("That character is not in the game right now, cant kick them.");
                return;
            }

            //Show that the player is being kicked
            MessageLog.Print("Kicking " + CharacterName + " from the game...");

            //Tell the client that they have been kicked from the game and mark them to be cleaned up from the game
            SystemPacketSender.SendKickedFromServer(Client.ClientID);
            Client.ConnectionDead = true;

            //Tell everyone else to remove the client from their games
            List <ClientConnection> OtherClients = ClientSubsetFinder.GetInGameClientsExceptFor(Client.ClientID);

            foreach (ClientConnection OtherClient in OtherClients)
            {
                PlayerManagementPacketSender.SendRemoveRemotePlayer(OtherClient.ClientID, Client.Character.Name, Client.Character.IsAlive);
            }
        }