Skip to content

Commit

Permalink
Função para Enviar Time mesmo incompleto
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonLizier committed Feb 18, 2022
1 parent f67a284 commit a08d048
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 4 deletions.
33 changes: 31 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# [pt_BR]
# Limitação de Wave - Caso deseje limitar as Wave, mude a configuração para "True"
# Valor padrão: False
limit_wave: False
limit_wave: True

# [en_US]
# Wave Limitation - Enter here the amount of Wave the Bot should play
Expand All @@ -56,7 +56,7 @@
# [pt_BR]
# Limitação de Wave - Informe aqui a quantidade de Wave que o Bot deve jogar
# Valor padrão: 10
qtd_limit_wave: 10
qtd_limit_wave: 6

# [en_US]
# Define here if at the end of the Wave Limit the bot should end the fight and reload the ships or just Surrender or two Actions.
Expand Down Expand Up @@ -99,6 +99,35 @@
# Valor padrão: False
send_space_only_full: False

# [en_US]
# Defines if the Bot can start the fight with an incomplete team
# Default value: False
#
# [pt_BR]
# Define se o Bot pode começar a luta com time incompleto
# Valor padrão: False
send_incomplete_team: False

# [en_US]
# Defines the minimum amount of ships to be sent. This option only works if "send_incomplete_team" is set to True
# Default value: 7
#
# [pt_BR]
# Define a quantidade minima a ser enviado de naves. Essa opção só funciona se a "send_incomplete_team" estiver como True
# Valor padrão: 7
send_space_min: 7

# [en_US]
# Sets the limit on how many times the Bot will scroll the screen to the end in search of ships. This option only works if "send_incomplete_team" is set to True
# Default value: 3
#
# [pt_BR]
# Define o limite de quantas vezes o Bot vai scrollar a tela ate o final em busca de naves. Essa opção só funciona se a "send_incomplete_team" estiver como True
# Valor padrão: 3
qtd_check_reloadSpacheship: 3




# ============================================================ #
# [en_US] End - Edit this area according to your account configuration
Expand Down
23 changes: 21 additions & 2 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
last_log_is_progress = False
count_victory = 0
time_start_bot = time.time()
count_reloadSpacheship = 0



def addRandomness(n, randomn_factor_size=None):
Expand Down Expand Up @@ -226,6 +228,9 @@ def removeSpaceships():

def clickButtonsFight():

global count_reloadSpacheship


if(ct['send_space_only_full'] == True):
buttons = positions(images['spg-go-fight-100'], threshold=ct['go_to_work_btn'])
ajustX = 14
Expand All @@ -237,7 +242,8 @@ def clickButtonsFight():

qtd_send_spaceships = ct['qtd_send_spaceships']

for (x, y, w, h) in buttons:

for (x, y, w, h) in reversed(buttons): #Adjust for click button a little more intelligent
moveToWithRandomness(x+ajustX+(w/2),y+ajustY+(h/2),1)
pyautogui.click()
global hero_clicks
Expand All @@ -246,6 +252,15 @@ def clickButtonsFight():
if hero_clicks >= qtd_send_spaceships:
logger('Finish Click Hero')
return -1

if(ct['send_incomplete_team']):
if hero_clicks > 0:
if hero_clicks >= ct['send_space_min']:
if count_reloadSpacheship >= ct['qtd_check_reloadSpacheship']:
logger('Enviando time mesmo incompleto')
hero_clicks = qtd_send_spaceships
return -1

return len(buttons)

def refreshSpaceships(qtd):
Expand Down Expand Up @@ -302,8 +317,12 @@ def refreshSpaceships(qtd):
if(ct['type_limit_wave'] == 'EndFightAndSurrender'):
surrenderFight()
else:
global count_reloadSpacheship
count_reloadSpacheship +=1

reloadSpacheship()
refreshSpaceships(hero_clicks)


def goToFight():
clickBtn(images['spg-go-to-boss'])
Expand All @@ -313,7 +332,7 @@ def goToFight():
def surrenderFight():
if len(positions(images['spg-surrender'], threshold=ct['end_boss']) ) > 0:
clickBtn(images['spg-surrender'])
time.sleep(2)
time.sleep(1.5)
clickBtn(images['spg-confirm-surrender'])
global count_victory
count_victory = 0
Expand Down

0 comments on commit a08d048

Please sign in to comment.