From 84a06c6c013ecc438d396c555142a98957a2f6e8 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 23 Nov 2023 12:05:57 +0100 Subject: [PATCH] now with backup cords --- raidfarm2.py | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/raidfarm2.py b/raidfarm2.py index d03db87..799f195 100644 --- a/raidfarm2.py +++ b/raidfarm2.py @@ -56,20 +56,35 @@ def raid_farm_clicking(): def handle_disconnect(): print("Handling disconnect...") - if find_template_on_screen(template_paths['connection_lost']): - print("Connection lost detected.") + # Try to find the 'connection_lost' screen via template matching + connection_lost_pos = find_template_on_screen(template_paths['connection_lost']) + if connection_lost_pos: + print("Connection lost detected via template matching.") time.sleep(1) # Small delay to ensure the screen is updated - back_to_server_pos = find_template_on_screen(template_paths['back_to_server']) - if back_to_server_pos: - click_at_position(*back_to_server_pos) - print("Clicked 'Back to Server List'.") - time.sleep(1) # Small delay to ensure the click is registered - join_server_pos = find_template_on_screen(template_paths['join_server']) - if join_server_pos: - click_at_position(*join_server_pos) - print("Clicked 'Join Server'.") - send_discord_message("The bot has clicked 'Join Server' and is attempting to recover.") - time.sleep(10) # Wait for 10 seconds before restarting the raid farm clicker + else: + # If template matching fails, use the backup coordinates + connection_lost_pos = (1184, 370) + print("Using backup coordinates for 'Connection Lost'.") + + # Click 'Back to Server List' button + click_at_position(*connection_lost_pos) + print("Clicked 'Back to Server List'.") + time.sleep(1) # Small delay to ensure the click is registered + + # Try to find the 'join_server' button via template matching + join_server_pos = find_template_on_screen(template_paths['join_server']) + if join_server_pos: + print("Join button detected via template matching.") + click_at_position(*join_server_pos) + else: + # If template matching fails, use the backup coordinates for the 'Join Server' button + join_server_pos = (957, 452) + click_at_position(*join_server_pos) + print("Using backup coordinates for 'Join Server'.") + + print("Clicked 'Join Server'.") + send_discord_message("The bot has clicked 'Join Server' and is attempting to recover.") + time.sleep(10) # Wait for 10 seconds before restarting the raid farm clicker if __name__ == "__main__": print('Raid farm clicker started.')