Skip to content

Commit f5744fb

Browse files
committed
fix update new village not update info
1 parent 5ee5b28 commit f5744fb

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

TbsCore/Tasks/Update/CheckAttacks.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ public class CheckAttacks : BotTask
1616
{
1717
public override async Task<TaskRes> Execute(Account acc)
1818
{
19+
StopFlag = false;
20+
{
21+
acc.Logger.Information($"Checking current village ...");
22+
var result = await NavigationHelper.SwitchVillage(acc, Vill);
23+
if (StopFlag) return TaskRes.Executed;
24+
if (!result) return TaskRes.Executed;
25+
}
1926
//await NavigationHelper.ToRallyPoint(acc, Vill, NavigationHelper.RallyPointTab.Overview)
2027
await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/build.php?gid=16&tt=1&filter=1&subfilters=1");
2128

TbsCore/Tasks/Update/UpdateTroops.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ public class UpdateTroops : BotTask
1515
/// </summary>
1616
public override async Task<TaskRes> Execute(Account acc)
1717
{
18+
StopFlag = false;
19+
{
20+
acc.Logger.Information($"Checking current village ...");
21+
var result = await NavigationHelper.SwitchVillage(acc, Vill);
22+
if (StopFlag) return TaskRes.Executed;
23+
if (!result) return TaskRes.Executed;
24+
}
1825
// If we have Plus account, just check that.
1926
if (acc.AccInfo.PlusAccount)
2027
{

TbsCore/Tasks/Update/UpdateVillage.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@ public override async Task<TaskRes> Execute(Account acc)
1717
{
1818
acc.Tasks.Remove(typeof(UpdateDorf1), Vill, thisTask: this);
1919
acc.Tasks.Remove(typeof(UpdateDorf2), Vill, thisTask: this);
20+
StopFlag = false;
21+
{
22+
acc.Logger.Information($"Checking current village ...");
23+
var result = await NavigationHelper.SwitchVillage(acc, Vill);
24+
if (StopFlag) return TaskRes.Executed;
25+
if (!result) return TaskRes.Executed;
26+
}
2027

2128
await NavigationHelper.ToDorf1(acc);
29+
await AccountHelper.DelayWait(acc);
2230
await NavigationHelper.ToDorf2(acc);
2331

2432
// On new village import the building tasks
@@ -29,7 +37,6 @@ public override async Task<TaskRes> Execute(Account acc)
2937

3038
await UpdateTroopsResearchedAndLevels(acc);
3139

32-
await Task.Delay(AccountHelper.Delay(acc));
3340
await UpdateTroopsTraining(acc);
3441

3542
var firstTroop = TroopsData.TribeFirstTroop(acc.AccInfo.Tribe);

0 commit comments

Comments
 (0)