Skip to content

Commit 2219ae7

Browse files
committed
Funcoes de Restart e Send Only Full
1 parent 8badcf4 commit 2219ae7

File tree

3 files changed

+66
-15
lines changed

3 files changed

+66
-15
lines changed

config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,33 @@
7373
# EndFightAndSurrender - Renova as Naves e Desiste da Luta - Volta para o 1 Boss
7474
type_limit_wave: 'EndFightAndSurrender' # EndFight or Surrender or EndFightAndSurrender
7575

76+
77+
78+
# [en_US]
79+
# Time for bot restart Game
80+
# For the function to work, leave the browser in the default color as instructed
81+
# in GitHut: https://github.com/sCryptoHelp/spacecrypto-bot#recomenda%C3%A7%C3%B5es
82+
# Default value in minuts: 0
83+
# *If defined: 0 the function don't start
84+
#
85+
# [pt_BR]
86+
# Tempo para o Bot Reiniciar o Jogo.
87+
# Para funcao funcionar deixe o navegador na cor padrao igual instrução
88+
# no GitHut: https://github.com/sCryptoHelp/spacecrypto-bot#recomenda%C3%A7%C3%B5es
89+
# Valor padrão em minutos: 0
90+
# *Se definido: 0 a função não inicia
91+
time_restart_game: 0
92+
93+
# [en_US]
94+
# Defines if the Bot will only send ships with 100% life
95+
# Default value: False
96+
#
97+
# [pt_BR]
98+
# Define se o Bot só vai enviar naves com 100% de vida
99+
# Valor padrão: False
100+
send_space_only_full: False
101+
102+
76103
# ============================================================ #
77104
# [en_US] End - Edit this area according to your account configuration
78105
#

index.py

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
login_attempts = 0
5050
last_log_is_progress = False
5151
count_victory = 0
52+
time_start_bot = time.time()
5253

5354

5455
def 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

256260
def 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():
375388
def checkClose():
376389
if clickBtn(images['spg-close'], name='closeBtn', timeout=1):
377390
processLogin()
378-
391+
379392
def 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+
418449
def 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()
536560
main()
537561

538562

targets/spg-go-fight-100.png

2.25 KB
Loading

0 commit comments

Comments
 (0)