Skip to content

Commit

Permalink
debug code, timeout for count_scrolls_in_request_page()
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmiglio committed Apr 20, 2024
1 parent 3a78f16 commit a8414c1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/pyclashbot/bot/request_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,18 @@ def count_scrolls_in_request_page(vm_index) -> int:

# scroll down, counting each scroll, until can't scroll anymore
scrolls = 0
timeout = 60#s
start_time = time.time()
while check_if_can_scroll_in_request_page(vm_index):
print(f"One scroll down. Count is {scrolls}")
scroll_down_in_request_page(vm_index)
scrolls += 1
time.sleep(1)

#if taken too much time, return 5
if time.time() - start_time > timeout:
return 5

# close request screen with deadspace click
click(vm_index, 15, 300, clicks=3, interval=1)

Expand Down
15 changes: 9 additions & 6 deletions src/pyclashbot/bot/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,23 +591,23 @@ def state_tree_tester(vm_index):
job_list = {
# job toggles
"open_battlepass_user_toggle": True,
"open_chests_user_toggle": True,
"open_chests_user_toggle": False,
"request_user_toggle": True,
"donate_toggle": True,
"card_mastery_user_toggle": True,
"card_mastery_user_toggle": False,
"free_offer_user_toggle": True,
"gold_offer_user_toggle": True,
"trophy_road_1v1_battle_user_toggle": False,
"path_of_legends_1v1_battle_user_toggle": True,
"2v2_battle_user_toggle": True,
"upgrade_user_toggle": False,
"war_user_toggle": True,
"random_decks_user_toggle": True,
"random_decks_user_toggle": False,
"open_bannerbox_user_toggle": True,
"daily_rewards_user_toggle": True,
"battlepass_collect_user_toggle": True,
"level_up_chest_user_toggle": True,
"upgrade_all_cards_user_toggle": True,
"level_up_chest_user_toggle": False,
"upgrade_all_cards_user_toggle": False,
"trophy_road_rewards_user_toggle": True,
"season_shop_buys_user_toggle": True,
# keep these off
Expand All @@ -634,7 +634,7 @@ def state_tree_tester(vm_index):
"account_switching_toggle": True,
"account_switching_slider": 1,
"next_account": 0,
"random_account_switch_list": [0,1],
"random_account_switch_list": [0,1,2],
}

while 1:
Expand All @@ -646,10 +646,13 @@ def state_tree_tester(vm_index):
)
if state == "restart":
print("Restart state")
input('Enter to continue...')
# print("Clipping that")
# clip_that()


if __name__ == "__main__":
state_tree_tester(12)
# clip_that()

# card_mastery_state(12, Logger(), 'next_state')

0 comments on commit a8414c1

Please sign in to comment.