diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index abafcb17d..926cd3be7 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -879,12 +879,6 @@ namespace ArchiSteamFarm { return result; } - internal async Task GetSteamAwardsPage() { - const string request = "/SteamAwards?l=english"; - - return await UrlGetToHtmlDocumentWithSession(SteamStoreURL, request).ConfigureAwait(false); - } - internal async Task GetTradeHoldDurationForTrade(ulong tradeID) { if (tradeID == 0) { Bot.ArchiLogger.LogNullError(nameof(tradeID)); @@ -1374,24 +1368,6 @@ namespace ArchiSteamFarm { return (true, mobileTradeOfferIDs); } - internal async Task SteamAwardsVote(byte voteID, uint appID) { - if ((voteID == 0) || (appID == 0)) { - Bot.ArchiLogger.LogNullError(nameof(voteID) + " || " + nameof(appID)); - - return false; - } - - const string request = "/salevote"; - - // Extra entry for sessionID - Dictionary data = new Dictionary(3) { - { "appid", appID.ToString() }, - { "voteid", voteID.ToString() } - }; - - return await UrlPostWithSession(SteamStoreURL, request, data).ConfigureAwait(false); - } - internal async Task UnpackBooster(uint appID, ulong itemID) { if ((appID == 0) || (itemID == 0)) { Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(itemID)); diff --git a/ArchiSteamFarm/SteamSaleEvent.cs b/ArchiSteamFarm/SteamSaleEvent.cs index 9c83145b0..b4ba95d22 100644 --- a/ArchiSteamFarm/SteamSaleEvent.cs +++ b/ArchiSteamFarm/SteamSaleEvent.cs @@ -37,7 +37,7 @@ namespace ArchiSteamFarm { Bot = bot ?? throw new ArgumentNullException(nameof(bot)); SaleEventTimer = new Timer( - async e => await Task.WhenAll(ExploreDiscoveryQueue(), VoteForSteamAwards()).ConfigureAwait(false), + async e => await ExploreDiscoveryQueue().ConfigureAwait(false), null, TimeSpan.FromHours(1.1) + TimeSpan.FromSeconds(Program.LoadBalancingDelay * Bot.Bots.Count), // Delay TimeSpan.FromHours(8.1) // Period @@ -108,70 +108,5 @@ namespace ArchiSteamFarm { // It'd make more sense to check against "Come back tomorrow", but it might not cover out-of-the-event queue return text.StartsWith("You can get ", StringComparison.Ordinal); } - - private async Task VoteForSteamAwards() { - if (!Bot.IsConnectedAndLoggedOn) { - return; - } - - HtmlDocument htmlDocument = await Bot.ArchiWebHandler.GetSteamAwardsPage().ConfigureAwait(false); - - HtmlNodeCollection nominationNodes = htmlDocument?.DocumentNode.SelectNodes("//div[@class='vote_nominations store_horizontal_autoslider']"); - - if (nominationNodes == null) { - // Event ended, error or likewise - return; - } - - foreach (HtmlNode nominationNode in nominationNodes) { - HtmlNode myVoteNode = nominationNode.SelectSingleNode("./div[@class='vote_nomination your_vote']"); - - if (myVoteNode != null) { - // Already voted - continue; - } - - string voteIDText = nominationNode.GetAttributeValue("data-voteid", null); - - if (string.IsNullOrEmpty(voteIDText)) { - Bot.ArchiLogger.LogNullError(nameof(voteIDText)); - - return; - } - - if (!byte.TryParse(voteIDText, out byte voteID) || (voteID == 0)) { - Bot.ArchiLogger.LogNullError(nameof(voteID)); - - return; - } - - HtmlNodeCollection voteNodes = nominationNode.SelectNodes("./div[starts-with(@class, 'vote_nomination')]"); - - if (voteNodes == null) { - Bot.ArchiLogger.LogNullError(nameof(voteNodes)); - - return; - } - - // Random a game we'll actually vote for, we don't want to make anybody angry by rigging votes... - HtmlNode voteNode = voteNodes[Utilities.RandomNext(voteNodes.Count)]; - - string appIDText = voteNode.GetAttributeValue("data-vote-appid", null); - - if (string.IsNullOrEmpty(appIDText)) { - Bot.ArchiLogger.LogNullError(nameof(appIDText)); - - return; - } - - if (!uint.TryParse(appIDText, out uint appID) || (appID == 0)) { - Bot.ArchiLogger.LogNullError(nameof(appID)); - - return; - } - - await Bot.ArchiWebHandler.SteamAwardsVote(voteID, appID).ConfigureAwait(false); - } - } } } diff --git a/ArchiSteamFarm/Utilities.cs b/ArchiSteamFarm/Utilities.cs index 082798546..90c97639e 100644 --- a/ArchiSteamFarm/Utilities.cs +++ b/ArchiSteamFarm/Utilities.cs @@ -199,22 +199,6 @@ namespace ArchiSteamFarm { } } - internal static int RandomNext(int maxWithout) { - if (maxWithout <= 0) { - ASF.ArchiLogger.LogNullError(nameof(maxWithout)); - - return -1; - } - - if (maxWithout == 1) { - return 0; - } - - lock (Random) { - return Random.Next(maxWithout); - } - } - internal static string ReadLineMasked(char mask = '*') { StringBuilder result = new StringBuilder();