Skip to content

Commit 825fe56

Browse files
committed
update
1 parent 6e7c417 commit 825fe56

File tree

5 files changed

+57
-90
lines changed

5 files changed

+57
-90
lines changed

ASFEnhance.slnx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Solution>
2+
<Folder Name="/Solution Items/">
3+
<File Path="build.ps1" />
4+
<File Path="Directory.Build.props" />
5+
<File Path="Directory.Packages.props" />
6+
<File Path="README.en.md" />
7+
<File Path="README.md" />
8+
<File Path="README.ru.md" />
9+
</Folder>
10+
<Project Path="ArchiSteamFarm/ArchiSteamFarm/ArchiSteamFarm.csproj" />
11+
<Project Path="ASFEnhance.IPC/ASFEnhance.IPC.csproj" />
12+
<Project Path="ASFEnhance/ASFEnhance.csproj" />
13+
</Solution>

ASFEnhance/ASFEnhance.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ public Task OnLoaded()
216216
Event.Command.ResponseClaim20Th(bot),
217217

218218
"V" or
219-
"VOTE" when access >= EAccess.Operator =>
220-
Event.Command.ResponseWinterSteamAwardVote(bot, ""),
219+
"VOTE" when access >= EAccess.Operator =>
220+
Event.Command.ResponseAutumnSteamAwardVote(bot, ""),
221221

222222
"CV" or
223-
"CHECKVOTE" when access >= EAccess.Operator =>
224-
Event.Command.ResponseCheckWinterSteamAwardVote(bot),
223+
"CHECKVOTE" when access >= EAccess.Operator =>
224+
Event.Command.ResponseCheckAutumnSteamAwardVote(bot),
225225

226226
//Shortcut
227227
"P" =>
@@ -495,15 +495,15 @@ public Task OnLoaded()
495495
Event.Command.ResponseClaim20Th(Utilities.GetArgsAsText(args, 1, ",")),
496496

497497
"V" or
498-
"VOTE" when argLength > 2 && access >= EAccess.Operator =>
499-
Event.Command.ResponseWinterSteamAwardVote(args[1], Utilities.GetArgsAsText(args, 2, ",")),
498+
"VOTE" when argLength > 2 && access >= EAccess.Operator =>
499+
Event.Command.ResponseAutumnSteamAwardVote(args[1], Utilities.GetArgsAsText(args, 2, ",")),
500500
"V" or
501-
"VOTE" when access >= EAccess.Operator =>
502-
Event.Command.ResponseWinterSteamAwardVote(args[1], ""),
501+
"VOTE" when access >= EAccess.Operator =>
502+
Event.Command.ResponseAutumnSteamAwardVote(args[1], ""),
503503

504504
"CV" or
505505
"CHECKVOTE" when access >= EAccess.Operator =>
506-
Event.Command.ResponseCheckWinterSteamAwardVote(Utilities.GetArgsAsText(args, 1, ",")),
506+
Event.Command.ResponseCheckAutumnSteamAwardVote(Utilities.GetArgsAsText(args, 1, ",")),
507507

508508
//Shortcut
509509
"AL" =>

ASFEnhance/Event/Command.cs

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ namespace ASFEnhance.Event;
66

77
internal static class Command
88
{
9-
private const int CategoryBegin = 110;
10-
119
/// <summary>
1210
/// 获取DL2贴纸 6.28 - ?
1311
/// </summary>
@@ -21,7 +19,7 @@ internal static class Command
2119
return bot.FormatBotResponse(Strings.BotNotConnected);
2220
}
2321

24-
var token = await WebRequest.FetchEventToken(bot, "dyinglight2towerraid").ConfigureAwait(false);
22+
var token = bot.AccessToken ?? throw new AccessTokenNullException(bot);
2523
if (string.IsNullOrEmpty(token))
2624
{
2725
return bot.FormatBotResponse(Langs.NetworkError);
@@ -236,8 +234,19 @@ internal static class Command
236234

237235
if (intGamsIDs.Count < categories) //不足11个游戏自动补齐
238236
{
239-
List<int> defaultGames =
240-
[2358720, 2669410, 548430, 2230650, 1623730, 2358720, 2679460, 2358720, 2358720, 2704110, 3097560];
237+
List<int> defaultGames = [
238+
3167020,
239+
2399420,
240+
548430,
241+
2407270,
242+
2543180,
243+
2947440,
244+
2988300,
245+
1030300,
246+
1903340,
247+
2089600,
248+
3444020
249+
];
241250
while (intGamsIDs.Count < categories)
242251
{
243252
intGamsIDs.Add(defaultGames[intGamsIDs.Count]);
@@ -253,11 +262,13 @@ internal static class Command
253262

254263
var semaphore = new SemaphoreSlim(1);
255264

265+
int categoryBegin = 130;
266+
256267
List<Task> tasks = [];
257268

258269
for (var i = 0; i < categories; i++)
259270
{
260-
tasks.Add(WebRequest.MakeVoteForAutumnSale(bot, intGamsIDs[i], CategoryBegin + i, token, semaphore));
271+
tasks.Add(WebRequest.MakeVoteForAutumnSale(bot, intGamsIDs[i], categoryBegin++, token, semaphore));
261272
}
262273

263274
await Utilities.InParallel(tasks).ConfigureAwait(false);
@@ -375,7 +386,19 @@ internal static class Command
375386
if (intGamsIDs.Count < categories) //不足11个游戏自动补齐
376387
{
377388
List<int> defaultGames =
378-
[2358720, 2669410, 413150, 2379780, 1623730, 1145350, 2379780, 2358720, 2396980, 2358720, 2198150];
389+
[
390+
3167020,
391+
2399420,
392+
548430,
393+
2407270,
394+
2543180,
395+
2947440,
396+
2988300,
397+
1030300,
398+
1903340,
399+
2089600,
400+
3444020
401+
];
379402
while (intGamsIDs.Count < categories)
380403
{
381404
intGamsIDs.Add(defaultGames[intGamsIDs.Count]);
@@ -391,11 +414,13 @@ internal static class Command
391414

392415
var semaphore = new SemaphoreSlim(1);
393416

417+
int categoryBegin = 130;
418+
394419
List<Task> tasks = [];
395420

396421
for (var i = 0; i < categories; i++)
397422
{
398-
tasks.Add(WebRequest.MakeWinterSteamAwardVote(bot, intGamsIDs[i], CategoryBegin + i, token, semaphore));
423+
tasks.Add(WebRequest.MakeWinterSteamAwardVote(bot, intGamsIDs[i], categoryBegin++, token, semaphore));
399424
}
400425

401426
await Utilities.InParallel(tasks).ConfigureAwait(false);

ASFEnhance/Event/WebRequest.cs

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -29,54 +29,6 @@ internal static async Task DoEventTask(Bot bot, string clanAccountId, int doorIn
2929
_ = await bot.ArchiWebHandler.UrlPostWithSession(request, data: data).ConfigureAwait(false);
3030
}
3131

32-
/// <summary>
33-
/// 获取Token
34-
/// </summary>
35-
/// <param name="bot"></param>
36-
/// <param name="salePage"></param>
37-
/// <returns></returns>
38-
internal static async Task<string?> FetchEventToken(Bot bot, string salePage)
39-
{
40-
var request = new Uri(SteamStoreURL, $"/sale/{salePage}");
41-
42-
var response = await bot.ArchiWebHandler.UrlGetToHtmlDocumentWithSession(request).ConfigureAwait(false);
43-
44-
if (response == null)
45-
{
46-
return null;
47-
}
48-
49-
var configEle = response.Content?.QuerySelector<IElement>("#application_config");
50-
var community = configEle?.GetAttribute("data-community") ?? "";
51-
var match = RegexUtils.MatchClanaCCountId().Match(community);
52-
53-
return match.Success ? match.Groups[1].Value : null;
54-
}
55-
56-
/// <summary>
57-
/// 获取Token
58-
/// </summary>
59-
/// <param name="bot"></param>
60-
/// <param name="developer"></param>
61-
/// <param name="salePage"></param>
62-
/// <returns></returns>
63-
internal static async Task<string?> FetchEventToken(Bot bot, string developer, string salePage)
64-
{
65-
var request = new Uri(SteamStoreURL, $"/developer/{developer}/sale/{salePage}");
66-
var response = await bot.ArchiWebHandler.UrlGetToHtmlDocumentWithSession(request).ConfigureAwait(false);
67-
68-
if (response == null)
69-
{
70-
return null;
71-
}
72-
73-
var configEle = response.Content?.QuerySelector<IElement>("#application_config");
74-
var community = configEle?.GetAttribute("data-community") ?? "";
75-
var match = RegexUtils.MatchClanaCCountId().Match(community);
76-
77-
return match.Success ? match.Groups[1].Value : null;
78-
}
79-
8032
/// <summary>
8133
/// 领取活动道具
8234
/// </summary>
@@ -112,29 +64,6 @@ internal static async Task<bool> RedeenPointShopItem(Bot bot, string token, int
11264
return response;
11365
}
11466

115-
/// <summary>
116-
/// 获取AccessToken
117-
/// </summary>
118-
/// <param name="bot"></param>
119-
/// <returns></returns>
120-
internal static async Task<string?> FetchWebApiToken1(Bot bot)
121-
{
122-
var request = new Uri(SteamStoreURL, "/steamawards/nominations");
123-
var response = await bot.ArchiWebHandler.UrlGetToHtmlDocumentWithSession(request, referer: SteamStoreURL)
124-
.ConfigureAwait(false);
125-
126-
if (response == null)
127-
{
128-
return null;
129-
}
130-
131-
var configEle = response.Content?.QuerySelector<IElement>("#application_config");
132-
var community = configEle?.GetAttribute("data-store_user_config") ?? "";
133-
var match = RegexUtils.MatchWebApiToken().Match(community);
134-
135-
return match.Success ? match.Groups[1].Value : null;
136-
}
137-
13867
/// <summary>
13968
/// 秋促投票
14069
/// </summary>
@@ -173,7 +102,7 @@ await bot.ArchiWebHandler.UrlGetToHtmlDocumentWithSession(request, referer: Stea
173102
/// <returns></returns>
174103
internal static async Task<string> CheckAutumnSaleBadge(Bot bot)
175104
{
176-
var request = new Uri(SteamCommunityURL, "/profiles/" + bot.SteamID + "/badges/67");
105+
var request = new Uri(SteamCommunityURL, "/profiles/" + bot.SteamID + "/badges/70");
177106

178107
var response = await bot.ArchiWebHandler.UrlGetToHtmlDocumentWithSession(request, referer: SteamCommunityURL)
179108
.ConfigureAwait(false);

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>2.3.14.2</Version>
3+
<Version>2.3.15.0</Version>
44
</PropertyGroup>
55

66
<PropertyGroup>

0 commit comments

Comments
 (0)