コード例 #1
0
        public async Task SetGame(string game)
        {
            Game = game;
            await Broadcast(new DefaultGameChanged()
            {
                Game = game
            });

            await MatchMaker.OnServerGameChanged(game);

            await Task.WhenAll(Battles.Values.Where(x => x.IsDefaultGame).Select(x => x.SwitchGame(game)));
        }
コード例 #2
0
        public MatchMakerBattle(ZkLobbyServer server, MatchMaker.ProposedBattle bat) : base(server, null)
        {
            IsMatchMakerBattle = true;
            EngineVersion = server.Engine;
            ModName = server.Game;
            FounderName = "MatchMaker #" + BattleID;
            Title = "MatchMaker " + BattleID;
            Mode = bat.QueueType.Mode;
            MaxPlayers = bat.Size;
            Prototype = bat;

            foreach (var pe in bat.Players) Users[pe.Name] = new UserBattleStatus(pe.Name, pe.LobbyUser, Guid.NewGuid().ToString());

            ValidateAndFillDetails();
        }
コード例 #3
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);
                });
            });
        }
コード例 #4
0
 public async Task OnServerMapsChanged()
 {
     await MatchMaker.OnServerMapsChanged();
 }