Example #1
0
        public static void HandleLoginRequest(SOEClient sender, SOEMessage message)
        {
            // Setup a reader
            SOEReader reader = new SOEReader(message);

            // Get the login details
            string clientToken = reader.ReadASCIIString();

            reader.ReadUInt64();
            string clientVersion = reader.ReadASCIIString();

            // Correct client version?
            Log.DebugFormat("Received login request from client {0}, token: {1}, version: {2}", sender.GetClientID(), clientToken, clientVersion);
            string expectedClientVersion = Server.ApplicationConfiguration["ClientVersion"];

            if (clientVersion != expectedClientVersion)
            {
                // Error!
                Log.ErrorFormat("Received login request from outdated client: {0}", clientVersion);

                SendLoginResponse(sender, false);
                sender.Disconnect((ushort)SOEDisconnectReasons.Application);
                return;
            }

            // Create a login request and enqueue it
            LoginRequest request = new LoginRequest(sender, clientToken, clientVersion);

            LoginQueue.Enqueue(request);
        }
Example #2
0
        public static void HandleEnqueueCommand(SOEClient sender, SOEMessage message)
        {
            // Is this client even authed?
            if (AccountManager.GetAccount(sender) == null)
            {
                Log.ErrorFormat("Unauthorized client tried enqueing command!");
                sender.Disconnect((ushort)SOEDisconnectReasons.Terminated);
                return;
            }

            // Setup a reader
            SOEReader reader = new SOEReader(message);

            // Get the length
            bool hasLength = reader.ReadBoolean(); // assuming this even is "has length" or just a random 01

            byte[] command = hasLength ? reader.ReadBlob() : reader.ReadToEnd();

            // Handle command!
            HandleCommand(sender, command);
        }