Exemple #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);
        }
        public override void GetAvatarForPlayerId(GameServiceUserInfo user)
        {
            AccountID_t accountId = new AccountID_t(Convert.ToUInt32(user.PlayerId));
            CSteamID    steamId   = new CSteamID(accountId, EUniverse.k_EUniversePublic, EAccountType.k_EAccountTypeIndividual);

            SteamWebApi.GetSteamUserAvatar(steamId.ToString(), user.SetAvatarFromSprite);
        }
        public NwSteamHandler(TasClient tas, string webApiKey)
        {
            steamApi  = new SteamWebApi(GlobalConst.SteamAppID, webApiKey);
            tas.Said += (sender, args) =>
            {
                if (args.Place == SayPlace.User && args.UserName != tas.UserName && args.Text.StartsWith("!linksteam"))
                {
                    var  token = args.Text.Substring(11);
                    User user;
                    if (tas.ExistingUsers.TryGetValue(args.UserName, out user))
                    {
                        Utils.StartAsync(() =>
                        {
                            Thread.Sleep(2000); // steam is slow to get the ticket from client .. wont verify if its checked too soon
                            var steamID = steamApi.WebValidateAuthToken(token);
                            var info    = steamApi.WebGetPlayerInfo(steamID);

                            using (var db = new ZkDataContext())
                            {
                                var acc       = db.Accounts.Find(user.AccountID);
                                acc.SteamID   = steamID;
                                acc.SteamName = info.personaname;
                                db.SubmitAndMergeChanges();
                                tas.Extensions.PublishAccountData(acc);
                            }
                        });
                    }
                }
            };
        }
Exemple #4
0
        private async void ExecuteConnect()
        {
            ButtonVisibility  = Visibility.Collapsed;
            SpinnerVisibility = Visibility.Visible;
            ErrorMessage      = "";
            ErrorHint         = "";

            var steamClient = await SteamWebApi.GetInstance();

            var steamid = await steamClient.ISteamUser_ResolveVanityUrl(m_profileUri);

            if (!steamid.Success)
            {
                ButtonVisibility  = Visibility.Visible;
                SpinnerVisibility = Visibility.Collapsed;
                ErrorMessage      = "Invalid profile URL";
                ErrorHint         = "Did you make a typo?";
                return;
            }
            var games = await steamClient.IPlayerService_GetOwnedGames(steamid.Result);

            if (!games.Success)
            {
                ButtonVisibility  = Visibility.Visible;
                SpinnerVisibility = Visibility.Collapsed;
                ErrorMessage      = "Couldn't fetch game list";
                ErrorHint         = "Is your profile public?";
                return;
            }

            var nav = (App.Current as App).NavigationService;
            int key = TempDataStore.GetInstance().StoreObject(games.Result);

            nav.Navigate(typeof(SteamGameListPage), key.ToString());
        }
Exemple #5
0
        public void GetSingleFileDetailsTest()
        {
            var res = SteamWebApi.GetSingleFileDetails(463939057);

            Assert.AreEqual("463939057", res["publishedfileid"].ToString());
            Assert.AreEqual("76561198194647182", res["creator"].ToString());
            Assert.AreEqual("ace", res["title"].ToString());
            Assert.AreEqual("107410", res["creator_appid"].ToString());
        }
Exemple #6
0
 private void PublishBuild()
 {
     try
     {
         var steamWebApi = new SteamWebApi();
         var build       = steamWebApi.GetAppBuilds().First(x => x.Description.ToLower().Contains(GlobalConst.Mode == ModeType.Live ? "stable" : "test"));
         steamWebApi.SetAppBuildLive(build.BuildID, GlobalConst.Mode == ModeType.Live ? "public" : "test");
         Trace.TraceInformation("SteamDepot build {0} set live", build.BuildID);
     }
     catch (Exception ex)
     {
         throw new ApplicationException("SteamDepot error publishing steam branch: {0}", ex);
     }
 }
        public ZkLobbyServer(string geoIPpath)
        {
            var entry = Assembly.GetExecutingAssembly();

            Version      = entry.GetName().Version.ToString();
            Engine       = GlobalConst.DefaultEngineOverride;
            Game         = "zk:stable";
            LoginChecker = new LoginChecker(this, geoIPpath);
            SteamWebApi  = new SteamWebApi(GlobalConst.SteamAppID, new Secrets().GetSteamWebApiKey());
            chatRelay    = new ChatRelay(this, new Secrets().GetNightwatchPassword(), new List <string>()
            {
                "zkdev", "sy", "moddev", "weblobbydev", "ai"
            });
            ChannelManager = new ChannelManager(this);
        }
        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);
                });
            });
        }