@@ -180,13 +180,33 @@ private bool EnoughSettlers(Account acc)
180
180
181
181
private bool UpdateSettlersAmount ( Account acc )
182
182
{
183
- var troopBox = acc . Wb . Html . DocumentNode . Descendants ( "div" ) . FirstOrDefault ( x => x . HasClass ( $ "troop { ( int ) settlerId } " ) && x . HasClass ( "innerTroopWrapper" ) ) ;
184
- if ( troopBox == null )
183
+ HtmlAgilityPack . HtmlNode nodeSettler = null ;
184
+ switch ( acc . AccInfo . ServerVersion )
185
185
{
186
- Retry ( acc , "Cannot find settler box" ) ;
187
- return false ;
186
+ case ServerVersionEnum . TTwars :
187
+ {
188
+ var troopNode = acc . Wb . Html . DocumentNode . Descendants ( "img" ) . FirstOrDefault ( x => x . HasClass ( "u" + ( int ) settlerId ) ) ;
189
+ while ( ! troopNode . HasClass ( "details" ) ) troopNode = troopNode . ParentNode ;
190
+ nodeSettler = troopNode ;
191
+ }
192
+ break ;
193
+
194
+ case ServerVersionEnum . T4_5 :
195
+ {
196
+ var troopBox = acc . Wb . Html . DocumentNode . Descendants ( "div" ) . FirstOrDefault ( x => x . HasClass ( $ "troop{ ( int ) settlerId } ") && x . HasClass ( "innerTroopWrapper" ) ) ;
197
+ if ( troopBox == null )
198
+ {
199
+ Retry ( acc , "Cannot find settler box" ) ;
200
+ return false ;
201
+ }
202
+ nodeSettler = troopBox ;
203
+ }
204
+ break ;
205
+
206
+ default :
207
+ break ;
188
208
}
189
- var divTit = troopBox . Descendants ( "div" ) . FirstOrDefault ( x => x . HasClass ( "tit" ) ) ;
209
+ var divTit = nodeSettler . Descendants ( "div" ) . FirstOrDefault ( x => x . HasClass ( "tit" ) ) ;
190
210
if ( divTit == null )
191
211
{
192
212
Retry ( acc , "Cannot find Settler title" ) ;
@@ -198,6 +218,7 @@ private bool UpdateSettlersAmount(Account acc)
198
218
Retry ( acc , "Cannot find Settler present number" ) ;
199
219
return false ;
200
220
}
221
+
201
222
Vill . Troops . Settlers = ( int ) Parser . RemoveNonNumeric ( spanPresent . InnerText ) ;
202
223
acc . Logger . Information ( $ "Update Settler present number: { Vill . Troops . Settlers } ") ;
203
224
0 commit comments