コード例 #1
0
ファイル: NpcManager.cs プロジェクト: dol-leodagan/DOLSharp
		/// <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);
		}
コード例 #2
0
ファイル: WorldManager.cs プロジェクト: dol-leodagan/DOLSharp
		/// <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);
		}
コード例 #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);
		}
コード例 #4
0
ファイル: GameServer.cs プロジェクト: boscorillium/dol
		/// <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;
		}
コード例 #5
0
ファイル: GameServer.cs プロジェクト: boscorillium/dol
		/// <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);
		}