Example #1
0
        /// <summary>
        /// Sends shutduwn request for the given node for the specific map.
        /// </summary>
        /// <param name="nodeMasterConnection">Connection of the node</param>
        /// <param name="map">Map server to be shutduwn</param>
        public void SendMapsRemoveRequest(NetConnection nodeMasterConnection, AuthoryMap map)
        {
            NetOutgoingMessage msgOut = Server.CreateMessage();

            msgOut.Write((byte)MasterMessageType.RemoveMap);

            msgOut.Write(map.MapIndex);

            Server.SendMessage(msgOut, nodeMasterConnection, NetDeliveryMethod.ReliableOrdered);
        }
Example #2
0
        public AuthoryMapServer(AuthoryNode masterNode, int mapPort, AuthoryMap map)
        {
            OnlineCharacters = new List <Character>();

            this.MasterNode = masterNode;

            this.IP   = masterNode.NodeMasterIP;
            this.Port = mapPort;


            this.AuthoryMap = map;
        }
Example #3
0
        /// <summary>
        /// Sends server connection request requested by the account, to the node server that is running the requested characters mapindex
        /// </summary>
        /// <param name="msgIn"></param>
        public void ServerConnectionRequest(NetIncomingMessage msgIn)
        {
            int requestedCharacterId = msgIn.ReadInt32();

            AuthoryMapServer channel;
            Account          account      = DataHandler.GetAccount(msgIn.SenderConnection);
            Character        character    = account.GetCharacter(requestedCharacterId);
            AuthoryMap       requestedMap = DataHandler.GetMap(character.MapIndex);

            account.MapIndex = character.MapIndex;


            if (account == null)
            {
                Console.WriteLine($"Online Account with connection({msgIn.SenderConnection}) not found");
                return;
            }
            Console.WriteLine(account);


            if (requestedMap == null)
            {
                Console.WriteLine($"Map with index({character.MapIndex}) not found");
                return;
            }

            channel = requestedMap.GetLeastLoadedChannel();
            Console.WriteLine(channel.ToString());
            if (channel == null)
            {
                Console.WriteLine($"No online map servers!");
                foreach (var map in DataHandler.Maps.Values)
                {
                    foreach (var mapServer in map.OnlineChannels)
                    {
                        Console.WriteLine(mapServer);
                    }
                }
                return;
            }



            if (character == null)
            {
                Console.WriteLine($"Character with id({requestedCharacterId}) not found");
                return;
            }

            channel.SendNewCharacterInfo(character);
        }