Skip to content

Commit cd0d0a9

Browse files
committed
Add support for blacklist feature, fix SMG
1 parent 639067d commit cd0d0a9

File tree

5 files changed

+29
-10
lines changed

5 files changed

+29
-10
lines changed

ArchiSteamFarm/ArchiWebHandler.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ private string GetHomeProcess() {
4747
return "http://steamcommunity.com/id/" + VanityURL + "/home_process";
4848
} else if (SteamID != 0) {
4949
return "http://steamcommunity.com/profiles/" + SteamID + "/home_process";
50+
} else {
51+
return null;
5052
}
51-
return null;
5253
}
5354

5455
internal ArchiWebHandler(Bot bot, string apiKey) {
@@ -195,6 +196,7 @@ internal List<SteamTradeOffer> GetTradeOffers() {
195196
}
196197
result.Add(tradeOffer);
197198
}
199+
198200
return result;
199201
}
200202

@@ -266,23 +268,24 @@ internal async Task LeaveClan(ulong clanID) {
266268
{"action", "leaveGroup"},
267269
{"groupId", clanID.ToString()}
268270
};
271+
269272
await Utilities.UrlPostRequest(request, postData, SteamCookieDictionary).ConfigureAwait(false);
270273
}
271274

272275
internal async Task<HtmlDocument> GetBadgePage(int page) {
273-
HtmlDocument result = null;
274-
if (SteamID != 0 && page != 0) {
275-
result = await Utilities.UrlToHtmlDocument("http://steamcommunity.com/profiles/" + SteamID + "/badges?p=" + page, SteamCookieDictionary).ConfigureAwait(false);
276+
if (SteamID == 0 || page == 0) {
277+
return null;
276278
}
277-
return result;
279+
280+
return await Utilities.UrlToHtmlDocument("http://steamcommunity.com/profiles/" + SteamID + "/badges?p=" + page, SteamCookieDictionary).ConfigureAwait(false);
278281
}
279282

280283
internal async Task<HtmlDocument> GetGameCardsPage(ulong appID) {
281-
HtmlDocument result = null;
282-
if (SteamID != 0 && appID != 0) {
283-
result = await Utilities.UrlToHtmlDocument("http://steamcommunity.com/profiles/" + SteamID + "/gamecards/" + appID, SteamCookieDictionary).ConfigureAwait(false);
284+
if (SteamID == 0 || appID == 0) {
285+
return null;
284286
}
285-
return result;
287+
288+
return await Utilities.UrlToHtmlDocument("http://steamcommunity.com/profiles/" + SteamID + "/gamecards/" + appID, SteamCookieDictionary).ConfigureAwait(false);
286289
}
287290
}
288291
}

ArchiSteamFarm/Bot.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ internal class Bot {
6262
private string SteamApiKey { get { return Config["SteamApiKey"]; } }
6363
internal ulong SteamMasterID { get { return ulong.Parse(Config["SteamMasterID"]); } }
6464
private ulong SteamMasterClanID { get { return ulong.Parse(Config["SteamMasterClanID"]); } }
65+
internal HashSet<uint> Blacklist { get; } = new HashSet<uint>();
6566

6667
internal Bot(string botName) {
6768
BotName = botName;
@@ -97,6 +98,14 @@ private void ReadConfig() {
9798
}
9899

99100
Config.Add(key, value);
101+
102+
switch (key) {
103+
case "Blacklist":
104+
foreach (string appID in value.Split(',')) {
105+
Blacklist.Add(uint.Parse(appID));
106+
}
107+
break;
108+
}
100109
}
101110
}
102111
}
@@ -187,6 +196,7 @@ private void OnDisconnected(SteamClient.DisconnectedCallback callback) {
187196
if (callback == null) {
188197
return;
189198
}
199+
190200
if (SteamClient == null) {
191201
return;
192202
}

ArchiSteamFarm/CardsFarmer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ internal async Task StartFarming() {
8484
continue;
8585
}
8686

87+
if (Bot.Blacklist.Contains(appID)) {
88+
continue;
89+
}
90+
8791
appIDs.Add(appID);
8892
}
8993
}

ArchiSteamFarm/Trading.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ internal Trading(Bot bot) {
3737
}
3838

3939
internal void CheckTrades() {
40-
Logging.LogGenericDebug("");
4140
if (ParsingTasks < 2) {
4241
ParsingTasks++;
4342
Task.Run(() => ParseActiveTrades());

ArchiSteamFarm/config/example.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@
2424
<!-- If you want from the bot to join particular chat of given clan, set it here, otherwise leave at 0 -->
2525
<SteamMasterClanID type="ulong" value="0"/>
2626

27+
<!-- Comma-separated list of IDs that should not be considered for farming -->
28+
<Blacklist type="HashSet<uint>" value="368020"/>
29+
2730
</configuration>

0 commit comments

Comments
 (0)