Add support for blacklist feature, fix SMG

This commit is contained in:
JustArchi 2015-10-28 22:34:53 +01:00
parent 639067d04f
commit cd0d0a94a1
5 changed files with 29 additions and 10 deletions

View file

@ -47,8 +47,9 @@ namespace ArchiSteamFarm {
return "http://steamcommunity.com/id/" + VanityURL + "/home_process";
} else if (SteamID != 0) {
return "http://steamcommunity.com/profiles/" + SteamID + "/home_process";
} else {
return null;
}
return null;
}
internal ArchiWebHandler(Bot bot, string apiKey) {
@ -195,6 +196,7 @@ namespace ArchiSteamFarm {
}
result.Add(tradeOffer);
}
return result;
}
@ -266,23 +268,24 @@ namespace ArchiSteamFarm {
{"action", "leaveGroup"},
{"groupId", clanID.ToString()}
};
await Utilities.UrlPostRequest(request, postData, SteamCookieDictionary).ConfigureAwait(false);
}
internal async Task<HtmlDocument> GetBadgePage(int page) {
HtmlDocument result = null;
if (SteamID != 0 && page != 0) {
result = await Utilities.UrlToHtmlDocument("http://steamcommunity.com/profiles/" + SteamID + "/badges?p=" + page, SteamCookieDictionary).ConfigureAwait(false);
if (SteamID == 0 || page == 0) {
return null;
}
return result;
return await Utilities.UrlToHtmlDocument("http://steamcommunity.com/profiles/" + SteamID + "/badges?p=" + page, SteamCookieDictionary).ConfigureAwait(false);
}
internal async Task<HtmlDocument> GetGameCardsPage(ulong appID) {
HtmlDocument result = null;
if (SteamID != 0 && appID != 0) {
result = await Utilities.UrlToHtmlDocument("http://steamcommunity.com/profiles/" + SteamID + "/gamecards/" + appID, SteamCookieDictionary).ConfigureAwait(false);
if (SteamID == 0 || appID == 0) {
return null;
}
return result;
return await Utilities.UrlToHtmlDocument("http://steamcommunity.com/profiles/" + SteamID + "/gamecards/" + appID, SteamCookieDictionary).ConfigureAwait(false);
}
}
}

View file

@ -62,6 +62,7 @@ namespace ArchiSteamFarm {
private string SteamApiKey { get { return Config["SteamApiKey"]; } }
internal ulong SteamMasterID { get { return ulong.Parse(Config["SteamMasterID"]); } }
private ulong SteamMasterClanID { get { return ulong.Parse(Config["SteamMasterClanID"]); } }
internal HashSet<uint> Blacklist { get; } = new HashSet<uint>();
internal Bot(string botName) {
BotName = botName;
@ -97,6 +98,14 @@ namespace ArchiSteamFarm {
}
Config.Add(key, value);
switch (key) {
case "Blacklist":
foreach (string appID in value.Split(',')) {
Blacklist.Add(uint.Parse(appID));
}
break;
}
}
}
}
@ -187,6 +196,7 @@ namespace ArchiSteamFarm {
if (callback == null) {
return;
}
if (SteamClient == null) {
return;
}

View file

@ -84,6 +84,10 @@ namespace ArchiSteamFarm {
continue;
}
if (Bot.Blacklist.Contains(appID)) {
continue;
}
appIDs.Add(appID);
}
}

View file

@ -37,7 +37,6 @@ namespace ArchiSteamFarm {
}
internal void CheckTrades() {
Logging.LogGenericDebug("");
if (ParsingTasks < 2) {
ParsingTasks++;
Task.Run(() => ParseActiveTrades());

View file

@ -24,4 +24,7 @@
<!-- If you want from the bot to join particular chat of given clan, set it here, otherwise leave at 0 -->
<SteamMasterClanID type="ulong" value="0"/>
<!-- Comma-separated list of IDs that should not be considered for farming -->
<Blacklist type="HashSet<uint>" value="368020"/>
</configuration>