Skip to content

Commit 93ae462

Browse files
committed
Fixed navigation (now clicks) to other village
1 parent ca34806 commit 93ae462

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

TbsCore/Helpers/VillageHelper.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,21 @@ public static Village VillageFromId(Account acc, int id)
8787

8888
public static async Task SwitchVillage(Account acc, int id)
8989
{
90-
// Parse village list again and find correct href
9190
Uri uri = new Uri(acc.Wb.CurrentUrl);
9291

92+
// Parse village list again and find correct href
9393
var vills = RightBarParser.GetVillages(acc.Wb.Html, acc.AccInfo.ServerVersion);
9494
var href = vills.FirstOrDefault(x => x.Id == id)?.Href;
95-
9695
if (string.IsNullOrEmpty(href)) // Login screen, server messages etc.
9796
{
98-
await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/dorf1.php?newdid={id}");
97+
await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/dorf1.php");
9998
return;
10099
}
101100

102-
if (href.Contains(acc.AccInfo.ServerUrl)) await acc.Wb.Navigate(href);
103-
else await acc.Wb.Navigate(uri.Scheme + "://" + uri.Host + uri.AbsolutePath + href);
101+
var val = $"?newdid={id}";
102+
// The * after href is for query selector; it will select all elements that contain {val}
103+
await DriverHelper.ClickByAttributeValue(acc, "href*", val);
104+
await TaskExecutor.PageLoaded(acc);
104105
}
105106

106107
/// <summary>

TbsCore/Tasks/LowLevel/UpdateVillage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public override async Task<TaskRes> Execute(Account acc)
3030

3131
await UpdateTroopsResearchedAndLevels(acc);
3232

33-
await acc.Wb.Navigate($"{acc.AccInfo.ServerUrl}/dorf2.php");
33+
await NavigationHelper.ToDorf2(acc);
3434
await Task.Delay(AccountHelper.Delay(acc));
3535
await UpdateTroopsTraining(acc);
3636

TbsCore/Tasks/SecondLevel/ScoutPlayer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace TbsCore.Tasks.SecondLevel
1515
public class ScoutPlayer : CheckProfile
1616
{
1717
public int MinPop { get; set; } = 100;
18-
public int MaxPop { get; set; } = 300;
18+
public int MaxPop { get; set; } = 1000;
1919
public int ScoutNum { get; set; } = 1;
2020

2121
public override async Task<TaskRes> Execute(Account acc)

0 commit comments

Comments
 (0)