Skip to content

Commit

Permalink
fixing check_for_boot_reward()
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmiglio committed Apr 8, 2024
1 parent c0daae9 commit a188adc
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/pyclashbot/bot/card_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"right": [(295, 185)],
},
"rocket": {
"left": [(118, 194)],
"left": [(118, 185)],
"right": [(295, 185)],
},
"lightning": {
Expand Down
43 changes: 25 additions & 18 deletions src/pyclashbot/bot/nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,25 +377,32 @@ def collect_boot_reward(vm_index):


def check_for_boot_reward(vm_index):
"""method to find the elixer price icon in a cropped image"""

folder = "collect_war_boot"

names = make_reference_image_list(get_file_count(folder))

locations: list[list[int] | None] = find_references(
screenshot(vm_index),
folder,
names,
tolerance=0.52,
)

coord = get_first_location(locations)
iar = numpy.asarray(screenshot(vm_index))
pixels = [
iar[350][150],
iar[377][174],
iar[379][198],
iar[378][210],
iar[390][250],
iar[355][273],
iar[395][146],
]
colors = [
[ 39 ,189, 255],
[255, 255, 255],
[255, 255, 255],
[ 43, 190, 255],
[ 89 ,135, 208],
[ 62 ,199, 255],
[ 43, 190, 255],
]
# for p in pixels:print(p)

if coord is None:
return None
for i, p in enumerate(pixels):
if not pixel_is_equal(p, colors[i], tol=25):
return False

return [coord[1], coord[0]]
return True


def get_to_clan_tab_from_clash_main(
Expand Down Expand Up @@ -1597,4 +1604,4 @@ def wait_for_clash_main_burger_button_options_menu(


if __name__ == "__main__":
print(check_if_on_card_page(12))
print(check_for_boot_reward(12))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a188adc

Please sign in to comment.