Exemplo n.º 1
0
        public override async Task ConfigureAsync(string configFile)
        {
            await base.ConfigureAsync(configFile);

            ZoneParser = new ZoneParser(Resources);

            Whitelist = new Whitelist(Resources);

            await Whitelist.LoadDefaultWhitelist();

            GameMessageReceived += HandleGameMessageAsync;
            ServerStopped       += () =>
            {
                foreach (var zone in Zones)
                {
                    Object.Destroy(zone);
                }
            };

            RakNetServer.ClientDisconnected += HandleDisconnect;

            var _ = Task.Run(async() =>
            {
                await ZoneParser.LoadZoneDataAsync((int)ServerSpecification.ZoneId);

                await LoadZone(ServerSpecification);
            });

            Logger.Information($"Setting up world server: {ServerSpecification.Id}");
        }
Exemplo n.º 2
0
        public override async Task ConfigureAsync(string configFile)
        {
            Logger.Information($"Created WorldServer on PID {Process.GetCurrentProcess().Id.ToString()}");
            await base.ConfigureAsync(configFile);

            // Update the CDClient database.
            await using var cdContext = new CdClientContext();
            await cdContext.EnsureUpdatedAsync();

            ZoneParser = new ZoneParser(Resources);
            Whitelist  = new Whitelist(Resources);

            await Whitelist.LoadDefaultWhitelist();

            GameMessageReceived += HandleGameMessageAsync;
            ServerStopped       += () =>
            {
                foreach (var zone in Zones)
                {
                    Object.Destroy(zone);
                }
            };

            var instance = await Api.RunCommandAsync <InstanceInfoResponse>(
                Config.ApiConfig.Port, $"instance/target?i={Id}"
                ).ConfigureAwait(false);

            ZoneId = (ZoneId)instance.Info.Zones.First();
#if DEBUG
            if (!Config.DebugConfig.StartInstancesAsThreads)
#endif
            Logger.SetServerTypeInformation("Z" + ZoneId.Id);

            var info = await Api.RunCommandAsync <InstanceInfoResponse>(MasterApi, $"instance/target?i={Id}");

            Api.RegisterCommandCollection <WorldCommands>(this);

            ManagedScriptEngine.AdditionalPaths = Config.ManagedScriptSources.Paths.ToArray();

            _ = Task.Run(async() =>
            {
                Logger.Information("Loading CDClient cache");
                await ClientCache.LoadAsync();
            });

            _ = Task.Run(async() =>
            {
                Logger.Information($"Setting up zones for world server {Id}");
                foreach (var zone in info.Info.Zones)
                {
                    await ZoneParser.LoadZoneDataAsync(zone);
                    await LoadZone(zone);
                }
            });
        }
Exemplo n.º 3
0
        public override async Task ConfigureAsync(string configFile)
        {
            Logger.Information($"Created WorldServer on PID {Process.GetCurrentProcess().Id.ToString()}");

            await base.ConfigureAsync(configFile);

            ZoneParser = new ZoneParser(Resources);

            Whitelist = new Whitelist(Resources);

            await Whitelist.LoadDefaultWhitelist();

            GameMessageReceived += HandleGameMessageAsync;
            ServerStopped       += () =>
            {
                foreach (var zone in Zones)
                {
                    Object.Destroy(zone);
                }
            };

            RakNetServer.ClientDisconnected += HandleDisconnect;

            var instance = await Api.RunCommandAsync <InstanceInfoResponse>(
                Config.ApiConfig.Port, $"instance/target?i={Id}"
                ).ConfigureAwait(false);

            ZoneId = (ZoneId)instance.Info.Zones.First();

            var info = await Api.RunCommandAsync <InstanceInfoResponse>(MasterApi, $"instance/target?i={Id}");

            Api.RegisterCommandCollection <WorldCommands>(this);

            var _ = Task.Run(async() =>
            {
                foreach (var zone in info.Info.Zones)
                {
                    await ZoneParser.LoadZoneDataAsync(zone);

                    await LoadZone(zone);
                }
            });

            ManagedScriptEngine.AdditionalPaths = Config.ManagedScriptSources.Paths.ToArray();

            Logger.Information($"Setting up world server: {Id}");
        }