Esempio n. 1
0
		/// <summary>
		/// Create a new Instance of <see cref="NpcManager"/>
		/// </summary>
		public NpcManager(GameServer GameServerInstance)
		{
			if (GameServerInstance == null)
				throw new ArgumentNullException("GameServerInstance");

			this.GameServerInstance = GameServerInstance;
			
			AmbientBehaviour = new MobAmbientBehaviourManager(this.GameServerInstance.IDatabase);
		}
Esempio n. 2
0
		/// <summary>
		/// Create a new instance of <see cref="WorldManager"/>
		/// </summary>
		public WorldManager(GameServer GameServerInstance)
		{
			if (GameServerInstance == null)
				throw new ArgumentNullException("GameServerInstance");

			this.GameServerInstance = GameServerInstance;
			
			WeatherManager = new WeatherManager(this.GameServerInstance.Scheduler);
		}
Esempio n. 3
0
		/// <summary>
		/// Create a new Instance of <see cref="PlayerManager"/>
		/// </summary>
		public PlayerManager(GameServer GameServerInstance)
		{
			if (GameServerInstance == null)
				throw new ArgumentNullException("GameServerInstance");
			
			this.GameServerInstance = GameServerInstance;
			
			InvalidNames = new InvalidNamesManager(this.GameServerInstance.Configuration.InvalidNamesFile);
			Friends = new FriendsManager(GameServerInstance.IDatabase);
		}
Esempio n. 4
0
		/// <summary>
		/// Starts receiving UDP packets.
		/// </summary>
		/// <param name="s">Socket to receive packets.</param>
		/// <param name="server">Server instance used to receive packets.</param>
		private bool BeginReceiveUDP(Socket s, GameServer server)
		{
			bool ret = false;
			EndPoint tempRemoteEP = new IPEndPoint(IPAddress.Any, 0);

			try
			{
				s.BeginReceiveFrom(server.UDPBuffer, 0, MAX_UDPBUF, SocketFlags.None, ref tempRemoteEP, m_udpReceiveCallback,
				                   server);
				ret = true;
			}
			catch (SocketException e)
			{
				log.Fatal(
					string.Format("Failed to resume receiving UDP packets. UDP is DEAD now. (code: {0}  socketCode: {1})", e.ErrorCode,
					              e.SocketErrorCode), e);
			}
			catch (ObjectDisposedException e)
			{
				log.Fatal("Tried to start UDP. Object disposed.", e);
			}
			catch (Exception e)
			{
				if (log.IsErrorEnabled)
					log.Error("UDP Recv", e);
			}

			return ret;
		}
Esempio n. 5
0
		/// <summary>
		/// Creates the gameserver instance
		/// </summary>
		/// <param name="config"></param>
		public static void CreateInstance(GameServerConfiguration config)
		{
			//Only one intance
			if (Instance != null)
				return;

			//Try to find the log.config file, if it doesn't exist
			//we create it
			var logConfig = new FileInfo(config.LogConfigFile);
			if (!logConfig.Exists)
			{
				ResourceUtil.ExtractResource(logConfig.Name, logConfig.FullName);
			}

			//Configure and watch the config file
			XmlConfigurator.ConfigureAndWatch(logConfig);

			//Create the instance
			m_instance = new GameServer(config);
		}