Ejemplo n.º 1
0
        public bool HandleMessage(IMessage message, IClientPeer peer)
        {
            Log.DebugFormat("Received Login Message to Forward");
            var messageForwarded = false;

            // Remove all codes that might attempt to be spoofed by the player
            CodeRemover.RemoveCodes(message);
            Log.DebugFormat("Removed codes from message");

            // Get a list of all appropriate servers - assume only one login server
            var loginServers = ConnectionCollection.GetServersByType <IServerPeer>(ServerType.LoginServer);

            Log.DebugFormat("Found {0} login servers", loginServers.Count);

            // Add in any other data we need before sending the message - the actual peer id of the client, any other data
            AddMessageData(message, peer);

            // Forward the message
            var login = loginServers.FirstOrDefault();

            if (login != null)
            {
                login.SendMessage(message);
                Log.DebugFormat("Forwarded Message to Login Server");
                messageForwarded = true;
            }
            return(messageForwarded);
        }
Ejemplo n.º 2
0
        public bool HandleMessage(IMessage message, IClientPeer peer)
        {
            var messageForwarded = false;

            var gameServers = connectionCollection.GetServersByType <IServerPeer>(ServerType.GameServer);

            log.DebugFormat("Received message to the GameServer. Found {0} game servers.", gameServers.Count);

            codeRemover.RemoveCodes(message);
            message.Parameters.Add((byte)MessageParameterCode.PeerIdParameterCode, peer.PeerId.ToByteArray());

            var gameServer = gameServers.FirstOrDefault();

            if (gameServer != null)
            {
                gameServer.SendMessage(message);
                messageForwarded = true;
            }

            return(messageForwarded);
        }