Ejemplo n.º 1
0
        /// <summary>
        /// Nodes will report their map servers load every X seconds.
        /// </summary>
        /// <param name="msgIn"></param>
        public void LoadReport(NetIncomingMessage msgIn)
        {
            AuthoryNode node = DataHandler.GetNode(msgIn.SenderConnection);

            int count = msgIn.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                AuthoryMapServer channel = node.GetMapServerByPort(msgIn.ReadInt32());

                int channelLoad = msgIn.ReadInt32();

                channel.Load = channelLoad;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// If the map server approved the connection of the sent character. The server will send the map server information to the connected client.
        /// </summary>
        /// <param name="msgIn"></param>
        public void ConnectionApproved(NetIncomingMessage msgIn)
        {
            int    port              = msgIn.ReadInt32();
            int    accountId         = msgIn.ReadInt32();
            int    characterId       = msgIn.ReadInt32();
            long   uid               = msgIn.ReadInt64();
            ushort characterServerId = msgIn.ReadUInt16();

            Console.WriteLine("Connection Approved at uid: " + uid);

            Account account = DataHandler.GetAccount(accountId);

            account.SetConnectedCharacter(characterId);

            account.ConnectionApproved = true;

            AuthoryNode node = DataHandler.GetNode(msgIn.SenderConnection);

            if (node == null)
            {
                Console.WriteLine($"Node not found with Connection({msgIn.SenderConnection})");
                return;
            }
            AuthoryMapServer server = node.GetMapServerByPort(port);

            if (server == null)
            {
                Console.WriteLine($"Server not found with Port({port})");
                return;
            }

            account.ConnectedServerMap = server;

            if (server.GetCharacter(characterId) == null)
            {
                server.OnlineCharacters.Add(account.ConnectedCharacter);
            }

            OutgoingMessageHandler.Instance.SendConnectionApproved(account, server);
        }