Пример #1
0
        public ZkLobbyServer(string geoIPpath, IPlanetwarsEventCreator creator, ITopPlayerProvider topPlayerProvider)
        {
            RatingSystems.Init();

            TopPlayerProvider      = topPlayerProvider;
            PlanetWarsEventCreator = creator;
            var entry = Assembly.GetExecutingAssembly();

            Version = entry.GetName().Version.ToString();
            Engine  = MiscVar.DefaultEngine;

            SpringPaths = new SpringPaths(GlobalConst.SpringieDataDir, false, false);
            Downloader  = new PlasmaDownloader.PlasmaDownloader(null, SpringPaths);
            Downloader.GetResource(DownloadType.ENGINE, MiscVar.DefaultEngine);
            Downloader.PackageDownloader.DoMasterRefresh();

            Game = Downloader.PackageDownloader.GetByTag(GlobalConst.DefaultZkTag).InternalName;

            LoginChecker = new LoginChecker(this, geoIPpath);
            SteamWebApi  = new SteamWebApi(GlobalConst.SteamAppID, new Secrets().GetSteamWebApiKey());
            chatRelay    = new ChatRelay(this, new List <string>()
            {
                "zkdev", "sy", "moddev", "weblobbydev", "ai", "zk", "zkmap", "springboard", GlobalConst.ModeratorChannel, GlobalConst.CoreChannel
            });
            textCommands         = new ServerTextCommands(this);
            ChannelManager       = new ChannelManager(this);
            MatchMaker           = new MatchMaker(this);
            battleListUpdater    = new BattleListUpdater(this);
            PartyManager         = new PartyManager(this);
            PlanetWarsMatchMaker = new PlanetWarsMatchMaker(this);
        }
Пример #2
0
        public ZkLobbyServer(string geoIPpath, IPlanetwarsEventCreator creator)
        {
            RatingSystems.Init();
            MapRatings.Init();


            PlanetWarsEventCreator = creator;
            var entry = Assembly.GetExecutingAssembly();

            Version = entry.GetName().Version.ToString();
            Engine  = MiscVar.DefaultEngine;

            SpringPaths = new SpringPaths(GlobalConst.SpringieDataDir, false, false);
            Downloader  = new PlasmaDownloader.PlasmaDownloader(null, SpringPaths);
            Downloader.GetResource(DownloadType.ENGINE, MiscVar.DefaultEngine);
            Downloader.PackageDownloader.DoMasterRefresh();

            Game = MiscVar.LastRegisteredZkVersion;

            LoginChecker = new LoginChecker(this, geoIPpath);
            SteamWebApi  = new SteamWebApi(GlobalConst.SteamAppID, new Secrets().GetSteamWebApiKey());
            chatRelay    = new ChatRelay(this, new List <string>()
            {
                "zkdev", "sy", "moddev", "weblobbydev", "ai", "zk", "zkmap", "springboard", GlobalConst.ModeratorChannel, GlobalConst.CoreChannel, "off-topic", "support", "modding", "crashreports"
            });
            textCommands         = new ServerTextCommands(this);
            ChannelManager       = new ChannelManager(this);
            MatchMaker           = new MatchMaker(this);
            battleListUpdater    = new BattleListUpdater(this);
            PartyManager         = new PartyManager(this);
            PlanetWarsMatchMaker = new PlanetWarsMatchMaker(this);
            NewsListManager      = new NewsListManager(this);
            LadderListManager    = new LadderListManager(this);
            ForumListManager     = new ForumListManager(this);

            SpawnAutohosts();

            RatingSystems.GetRatingSystems().ForEach(x => x.RatingsUpdated += (sender, data) =>
            {
                var db           = new ZkDataContext();
                var updatedUsers = ConnectedUsers.Select(c => c.Value.User.AccountID).Intersect(data.affectedPlayers).ToHashSet();
                db.Accounts.Where(acc => updatedUsers.Contains(acc.AccountID)).ForEach(p =>
                {
                    PublishAccountUpdate(p);
                    PublishUserProfileUpdate(p);
                });
            });
        }