Skip to content

Commit 2cbcb82

Browse files
committed
fix ttwars update village table
1 parent eec62d9 commit 2cbcb82

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

MainCore/Tasks/Sim/UpgradeBuilding.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ private void Update()
283283
private PlanTask SelectBuilding()
284284
{
285285
using var context = _contextFactory.CreateDbContext();
286+
286287
UpgradeBuildingHelper.RemoveFinishedCB(context, VillageId);
287288

288289
var buildingTask = UpgradeBuildingHelper.NextBuildingTask(context, _planManager, _logManager, AccountId, VillageId);
@@ -299,7 +300,9 @@ private PlanTask SelectBuilding()
299300
{
300301
NavigateHelper.GoRandomDorf(_chromeBrowser, context, AccountId);
301302
}
302-
303+
#if TTWARS
304+
Refresh();
305+
#endif
303306
var updateTask = new UpdateVillage(VillageId, AccountId);
304307
updateTask.CopyFrom(this);
305308
updateTask.Execute();
@@ -310,7 +313,7 @@ private PlanTask SelectBuilding()
310313
return null;
311314
}
312315
#if TTWARS
313-
ExecuteAt = firstComplete.CompleteTime;
316+
ExecuteAt = firstComplete.CompleteTime.AddSeconds(1);
314317
#else
315318
ExecuteAt = firstComplete.CompleteTime.AddSeconds(10);
316319
#endif

TTWarsCore/Parsers/VillagesTable.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using HtmlAgilityPack;
2-
using System;
32
using System.Collections.Generic;
43
using System.Linq;
54

@@ -30,8 +29,8 @@ public static int GetId(HtmlNode node)
3029
if (hrefNode is null) return -1;
3130
var href = System.Net.WebUtility.HtmlDecode(hrefNode.GetAttributeValue("href", ""));
3231
if (string.IsNullOrEmpty(href)) return -1;
33-
if (!href.Contains('=') || !href.Contains('&')) return -1;
34-
return Convert.ToInt32(href.Split('=')[1].Split('&')[0]);
32+
if (!href.Contains('=')) return -1;
33+
return int.Parse(href.Split('=')[1]);
3534
}
3635

3736
public static string GetName(HtmlNode node)

0 commit comments

Comments
 (0)