File tree Expand file tree Collapse file tree 5 files changed +35
-11
lines changed Expand file tree Collapse file tree 5 files changed +35
-11
lines changed Original file line number Diff line number Diff line change @@ -201,10 +201,10 @@ public enum HeroItemEnum
201
201
Stackable_Ointment_0 , // =106
202
202
203
203
Stackable_Scroll_0 ,
204
- NonStackable_Bucket_0 ,
205
- NonStackable_Tablets_0 ,
206
- NonStackable_Book_0 , // =110
207
- NonStackable_Artwork_0 ,
204
+ Stackable_Bucket_0 ,
205
+ Stackable_Tablets_0 ,
206
+ Stackable_Book_0 , // =110
207
+ Stackable_Artwork_0 ,
208
208
Stackable_SmallBandage_0 ,
209
209
Stackable_BigBandage_0 ,
210
210
Stackable_Cage_0 ,
Original file line number Diff line number Diff line change @@ -88,14 +88,17 @@ private async Task<bool> ClaimRewards(Account acc)
88
88
if ( ! result ) return false ;
89
89
}
90
90
91
- var collectNode = acc . Wb . Html . DocumentNode . Descendants ( "button" ) . FirstOrDefault ( x => x . HasClass ( "collect" ) ) ;
92
- if ( collectNode == null ) return true ;
91
+ var collectNodes = acc . Wb . Html . DocumentNode . Descendants ( "button" ) . Where ( x => x . HasClass ( "collect" ) ) ;
92
+ if ( collectNodes . Count ( ) == 0 ) return true ;
93
93
94
- var collectElement = acc . Wb . Driver . FindElement ( By . XPath ( collectNode . XPath ) ) ;
95
- collectElement . Click ( ) ;
96
- if ( StopFlag ) return false ;
94
+ foreach ( var node in collectNodes )
95
+ {
96
+ var collectElement = acc . Wb . Driver . FindElement ( By . XPath ( node . XPath ) ) ;
97
+ collectElement . Click ( ) ;
98
+ if ( StopFlag ) return false ;
97
99
98
- await AccountHelper . DelayWait ( acc , 5 ) ;
100
+ await AccountHelper . DelayWait ( acc , 5 ) ;
101
+ }
99
102
100
103
{
101
104
var result = await Update ( acc ) ;
Original file line number Diff line number Diff line change @@ -16,6 +16,13 @@ public class CheckAttacks : BotTask
16
16
{
17
17
public override async Task < TaskRes > Execute ( Account acc )
18
18
{
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
+ }
19
26
//await NavigationHelper.ToRallyPoint(acc, Vill, NavigationHelper.RallyPointTab.Overview)
20
27
await acc . Wb . Navigate ( $ "{ acc . AccInfo . ServerUrl } /build.php?gid=16&tt=1&filter=1&subfilters=1") ;
21
28
Original file line number Diff line number Diff line change @@ -15,6 +15,13 @@ public class UpdateTroops : BotTask
15
15
/// </summary>
16
16
public override async Task < TaskRes > Execute ( Account acc )
17
17
{
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
+ }
18
25
// If we have Plus account, just check that.
19
26
if ( acc . AccInfo . PlusAccount )
20
27
{
Original file line number Diff line number Diff line change @@ -17,8 +17,16 @@ public override async Task<TaskRes> Execute(Account acc)
17
17
{
18
18
acc . Tasks . Remove ( typeof ( UpdateDorf1 ) , Vill , thisTask : this ) ;
19
19
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
+ }
20
27
21
28
await NavigationHelper . ToDorf1 ( acc ) ;
29
+ await AccountHelper . DelayWait ( acc ) ;
22
30
await NavigationHelper . ToDorf2 ( acc ) ;
23
31
24
32
// On new village import the building tasks
@@ -29,7 +37,6 @@ public override async Task<TaskRes> Execute(Account acc)
29
37
30
38
await UpdateTroopsResearchedAndLevels ( acc ) ;
31
39
32
- await Task . Delay ( AccountHelper . Delay ( acc ) ) ;
33
40
await UpdateTroopsTraining ( acc ) ;
34
41
35
42
var firstTroop = TroopsData . TribeFirstTroop ( acc . AccInfo . Tribe ) ;
You can’t perform that action at this time.
0 commit comments