4949login_attempts = 0
5050last_log_is_progress = False
5151count_victory = 0
52+ time_start_bot = time .time ()
5253
5354
5455def addRandomness (n , randomn_factor_size = None ):
@@ -252,9 +253,17 @@ def removeSpaceships():
252253
253254 if len (buttons ) == 0 :
254255 break
256+
257+ if (CheckTimeRestartGame ()):
258+ break
255259
256260def clickButtonsFight ():
257- buttons = positions (images ['spg-go-fight' ], threshold = ct ['go_to_work_btn' ])
261+
262+ if (ct ['send_space_only_full' ] == True ):
263+ buttons = positions (images ['spg-go-fight-100' ], threshold = ct ['go_to_work_btn' ])
264+ else :
265+ buttons = positions (images ['spg-go-fight' ], threshold = ct ['go_to_work_btn' ])
266+
258267 qtd_send_spaceships = ct ['qtd_send_spaceships' ]
259268
260269 for (x , y , w , h ) in buttons :
@@ -281,7 +290,6 @@ def refreshSpaceships(qtd):
281290 global hero_clicks
282291 hero_clicks = 0
283292
284- # c['scroll_attemps']
285293 empty_scrolls_attempts = qtd_send_spaceships
286294
287295 checkClose ()
@@ -294,6 +302,11 @@ def refreshSpaceships(qtd):
294302 goToFight ()
295303
296304 while (empty_scrolls_attempts > 0 ):
305+
306+ if (CheckTimeRestartGame ()):
307+ break
308+
309+
297310 buttonsClicked = clickButtonsFight ()
298311
299312 if buttonsClicked == 0 :
@@ -375,7 +388,7 @@ def processLogin():
375388def checkClose ():
376389 if clickBtn (images ['spg-close' ], name = 'closeBtn' , timeout = 1 ):
377390 processLogin ()
378-
391+
379392def reloadSpacheship ():
380393 if len (positions (images ['spg-base' ], threshold = ct ['commom_position' ])) > 0 and len (positions (images ['spg-go-to-boss' ], threshold = ct ['base_position' ])) > 0 :
381394 clickBtn (images ['spg-base' ], name = 'closeBtn' , timeout = 1 )
@@ -415,6 +428,24 @@ def checkLimitWave():
415428
416429 return False
417430
431+ def ReloadGame ():
432+ refreshPage ()
433+ time .sleep (5 )
434+ processLogin ()
435+
436+ def CheckTimeRestartGame ():
437+
438+ if ( ct ['time_restart_game' ] > 0 ):
439+ global time_start_bot
440+ now = time .time ()
441+
442+ if now - time_start_bot > addRandomness (ct ['time_restart_game' ]* 60 ):
443+ ReloadGame ()
444+ return True
445+
446+ return False
447+
448+
418449def main ():
419450 time .sleep (5 )
420451 t = c ['time_intervals' ]
@@ -452,15 +483,11 @@ def main():
452483 if len (positions (images ['spg-processing' ], threshold = ct ['commom_position' ])) > 0 :
453484 time .sleep (ct ['check_processing_time' ])
454485 if len (positions (images ['spg-processing' ], threshold = ct ['commom_position' ])) > 0 :
455- refreshPage ()
456- time .sleep (5 )
457- processLogin ()
486+ ReloadGame ()
458487
459488 if len (positions (images ['spg-initial-pg' ], threshold = ct ['commom_position' ])) > 0 :
460489 if now - last ["CheckInitialPage" ] > addRandomness (ct ['check_initial_page' ]):
461- refreshPage ()
462- time .sleep (5 )
463- processLogin ()
490+ ReloadGame ()
464491 else :
465492 last ["CheckInitialPage" ] = now
466493 pass
@@ -469,9 +496,7 @@ def main():
469496
470497 if len (positions (images ['spg-cube' ], threshold = ct ['commom_position' ])) > 0 :
471498 if now - last ["CheckInicialCube" ] > addRandomness (ct ['check_initial_cube' ]* 60 ):
472- refreshPage ()
473- time .sleep (5 )
474- processLogin ()
499+ ReloadGame ()
475500 else :
476501 last ["CheckInicialCube" ] = now
477502 pass
@@ -481,9 +506,7 @@ def main():
481506
482507 if len (positions (images ['spg-back' ], threshold = ct ['commom_position' ])) > 0 :
483508 if now - last ["CheckBackPage" ] > addRandomness (ct ['check_erro' ]* 60 ):
484- refreshPage ()
485- time .sleep (5 )
486- processLogin ()
509+ ReloadGame ()
487510 else :
488511 last ["CheckBackPage" ] = now
489512 pass
@@ -533,6 +556,7 @@ def main():
533556 if len (nowPosition ) == 0 :
534557 last ["checkBossTime" ] = now
535558
559+ CheckTimeRestartGame ()
536560main ()
537561
538562
0 commit comments