Skip to content

Commit

Permalink
replacing "restart"/"good" returns with bool returns
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmiglio committed Sep 30, 2024
1 parent 303ff04 commit 9f306af
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/pyclashbot/bot/nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
SHOP_PAGE_BUTTON: tuple[Literal[33], Literal[603]] = (33, 603)


def get_to_shop_page_from_clash_main(vm_index, logger):
def get_to_shop_page_from_clash_main(vm_index, logger) -> bool:
click(vm_index, SHOP_PAGE_BUTTON[0], SHOP_PAGE_BUTTON[1])
if wait_for_clash_main_shop_page(vm_index, logger) == "restart":
logger.change_status(
Expand All @@ -43,7 +43,7 @@ def get_to_shop_page_from_clash_main(vm_index, logger):
return True


def wait_for_2v2_battle_start(vm_index, logger: Logger) -> Literal["restart", "good"]:
def wait_for_2v2_battle_start(vm_index, logger: Logger) -> bool:
"""Waits for the 2v2 battle to start.
Args:
Expand Down Expand Up @@ -79,7 +79,7 @@ def wait_for_1v1_battle_start(
vm_index,
logger: Logger,
printmode=False,
) -> Literal["restart", "good"]:
) -> bool:
"""Waits for the 1v1 battle to start.
Args:
Expand All @@ -90,8 +90,7 @@ def wait_for_1v1_battle_start(
Returns:
-------
Literal["restart", "good"]: "restart" if the function
needs to be restarted, "good" otherwise.
bool - success status
"""
start_time: float = time.time()
Expand All @@ -105,18 +104,18 @@ def wait_for_1v1_battle_start(
logger.change_status(
status="Error 8734572456 Waiting too long for 1v1 battle to start",
)
return "restart"
return False
print("Waiting for 1v1 start")
click(vm_index=vm_index, x_coord=200, y_coord=200)

if printmode:
logger.change_status(status="Done waiting for 1v1 battle to start")
else:
logger.log(message="Done waiting for 1v1 battle to star")
return "good"
return True


def check_for_in_battle_with_delay(vm_index):
def check_for_in_battle_with_delay(vm_index) -> bool:
"""Checks if the virtual machine is in a 2v2 battle with a delay.
Args:
Expand Down

0 comments on commit 9f306af

Please sign in to comment.