Пример #1
0
 public HandshakeHandler(IGamePacketFactory packetFactory, IGameSession gameSession, IWorldServer server, IInterServerClient interClient, ISelectionScreenManager selectionScreenManager) : base(packetFactory, gameSession)
 {
     _server                         = server;
     _interClient                    = interClient;
     _selectionScreenManager         = selectionScreenManager;
     _interClient.OnSessionResponse += InitGameSession;
 }
Пример #2
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IWorldServer worldServer, ILogsDatabase logsDb, IDatabase mainDb)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            mainDb.Migrate();
            logsDb.Migrate();
            worldServer.Start();
        }
Пример #3
0
        /// <summary>
        /// Creates a new instance of the <see cref="MmoWorld"/> class.
        /// </summary>
        /// <param name="server"> The main peer used for communication with other servers and clients. </param>
        /// <param name="gameConfiguration"> </param>
        /// <param name="worldDescription"> The world data which contains data of the whole world </param>
        private MmoWorld(IWorldServer server, GameConfig gameConfiguration, WorldDescription worldDescription)
        {
            this.server = server;
            // world bounds will adjust its size based on the zones
            this.bounds        = new Bounds(Vector3.Zero, Vector3.Zero);
            this.configuration = gameConfiguration;

            this.primaryFiber = new SerialThreadFiber(ThreadPriority.Highest);
            this.primaryFiber.Start();

            this.zones        = new ConcurrentStorageMap <int, MmoZone>(1000);
            this.sessionCache = new WorldSessionCache(PeerSettings.MaxLockWaitTime);
            this.itemCache    = new WorldItemCache();

            this.LoadWorld();
        }
Пример #4
0
        /// <inheritdoc />
        public void Run()
        {
            var logger = DependencyContainer.Instance.Resolve <ILogger <WorldServerStartup> >();

            this._server = DependencyContainer.Instance.Resolve <IWorldServer>();

            try
            {
                logger.LogInformation("Starting WorldServer...");

                GameResources.Instance.Load();
                this._server.Start();
            }
            catch (Exception e)
            {
                logger.LogCritical(e, $"An unexpected error occured in WorldServer.");
#if DEBUG
                Console.ReadLine();
#endif
            }
        }
Пример #5
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IWorldServer worldServer, ILogsDatabase logsDb, IDatabase mainDb, IGameDefinitionsPreloder definitionsPreloder, RoleManager <DbRole> roleManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });


            roleManager.CreateAsync(new DbRole()
            {
                Name = DbRole.SUPER_ADMIN
            }).Wait();
            roleManager.CreateAsync(new DbRole()
            {
                Name = DbRole.ADMIN
            }).Wait();
            roleManager.CreateAsync(new DbRole()
            {
                Name = DbRole.USER
            }).Wait();

            mainDb.Migrate();
            logsDb.Migrate();
            definitionsPreloder.Preload();
            worldServer.Start();
        }
Пример #6
0
 /// <summary>
 /// Instantiates the singleton of the <see cref="MmoWorld"/>. If it has already been instantiated returns the old instance.
 /// </summary>
 public static MmoWorld Instantiate(IWorldServer server, GameConfig gameConfiguration, WorldDescription worldDescription)
 {
     lock (typeof(MmoWorld))
         return(Instance ?? (Instance = new MmoWorld(server, gameConfiguration, worldDescription)));
 }
Пример #7
0
 /// <summary>
 /// Creates a new <see cref="FreezeChatCommand"/> instance.
 /// </summary>
 /// <param name="logger">Logger.</param>
 /// <param name="worldServer">World server system.</param>
 /// <param name="playerDataPacketFactory">Player data packet factory system.</param>
 public FreezeChatCommand(ILogger <FreezeChatCommand> logger, IWorldServer worldServer, IPlayerDataPacketFactory playerDataPacketFactory)
 {
     _logger                  = logger;
     _worldServer             = worldServer;
     _playerDataPacketFactory = playerDataPacketFactory;
 }
Пример #8
0
 /// <summary>
 /// Initialize the client and send welcome packet.
 /// </summary>
 public void InitializeClient(IWorldServer server)
 {
     this.WorldServer    = server;
     this.RemoteEndPoint = this.Socket.RemoteEndPoint.ToString();
 }
Пример #9
0
 /// <summary>
 /// Creates a new <see cref="SummonCommand"/> instance.
 /// </summary>
 /// <param name="logger">logger system.</param>
 /// <param name="teleportSystem">Teleport system.</param>
 /// <param name="worldServer">World server.</param>
 public SummonCommand(ILogger <SummonCommand> logger, ITeleportSystem teleportSystem, IWorldServer worldServer)
 {
     _logger         = logger;
     _teleportSystem = teleportSystem;
     _worldServer    = worldServer;
 }
Пример #10
0
 /// <summary>
 /// Creates a new <see cref="CountCommand"/> instance.
 /// </summary>
 /// <param name="worldServer">World server.</param>
 /// <param name="textPacketFactory">Text packet factory.</param>
 public CountCommand(IWorldServer worldServer, ITextPacketFactory textPacketFactory)
 {
     _worldServer       = worldServer;
     _textPacketFactory = textPacketFactory;
 }
Пример #11
0
 /// <summary>
 /// Creates a new <see cref="WorldServerService"/> instance.
 /// </summary>
 /// <param name="worldServer">World Server.</param>
 public WorldServerService(IWorldServer worldServer)
 {
     _worldServer = worldServer;
 }
Пример #12
0
 /// <summary>
 /// Creates a new <see cref="SystemMessagePacketFactory"/> instance.
 /// </summary>
 /// <param name="worldServer">world server system.</param>
 public SystemMessagePacketFactory(IWorldServer worldServer)
 {
     _worldServer = worldServer;
 }