Exemplo n.º 1
0
        public static void HandleLoginPositionRequest(int index, string playerID)
        {
            Point position = CommonMongo.GetEntityCoordinates(playerID);

            ServerTCP.InitializeClient(index, position.X, position.Y, playerID);
            ServerOutput.Compose(Outbound.PCLoginPositionRequest, index, position);
            ServerTCP.clients[index].MovePosition(position.X, position.Y);
            CommonMongo.SetEntityCoodinates(position.X, position.Y, ServerTCP.clients[index].properties.ID);
        }
Exemplo n.º 2
0
        public static void HandleAccountCreateQuery(int index, string username, string password)
        {
            bool userExists = CommonMongo.DoesUserExist(username);

            if (userExists)
            {
                ServerOutput.Compose(Outbound.Account_Create_Fail, index, Log.DatabaseAccountAlreadyExists);
                return;
            }

            CommonMongo.CreateAccount(username, password);
            ServerOutput.Compose(Outbound.Account_Create_Success, index, Log.DatabaseAccountCreated);
        }
Exemplo n.º 3
0
        public static void TellOPCsAPlayerIsMoving(int index, Vector2 position)
        {
            List <Client> clientList = ServerTCP.FetchOtherClients(index);

            if (clientList.Count == 0)
            {
                return;
            }

            foreach (Client item in clientList)
            {
                ServerOutput.Compose(Outbound.EntityMoveQuery, item.index, position);
            }
        }
Exemplo n.º 4
0
        public static void HandleUserLoginQuery(int index, string username, string password, string[] result)
        {
            if (result == null)
            {
                ServerOutput.Compose(Outbound.Account_Login_Fail, index, Log.DatabaseUsernameMismatch);
                return;
            }

            string recordedPassword = result[0];
            string recordedID       = result[1];

            if (recordedPassword == password)
            {
                ServerOutput.Compose(Outbound.Account_Login_Success, index, recordedID);
                ServerTCP.clients[index].properties.Username = username;
            }
            else
            {
                ServerOutput.Compose(Outbound.Account_Login_Fail, index, Log.DatabasePasswordMismatch);
            }
        }
Exemplo n.º 5
0
        internal static void HandleLoginChunkRequest(int index, int x, int y)
        {
            List <DBPackages.DBTile> tiles = CommonMongo.GetChunkData(x, y);

            ServerOutput.ComposeChunk(Outbound.LoginChunkRequest, index, tiles);
        }
Exemplo n.º 6
0
        public static void HandleDoesUserExist(int index, string username)
        {
            var result = CommonMongo.DoesUserExist(username);

            ServerOutput.Compose(Outbound.DoesUserExist, index, result ? false : true);
        }
Exemplo n.º 7
0
 public static void HandleOtherPlayerCharacterListRequest(int index)
 {
     ServerOutput.SendOtherPlayerCharacterListRequest(index);
 }