diff --git a/assets/shop/gloves/gg_gloves.jpg b/assets/shop/gloves/gg_gloves.jpg new file mode 100644 index 0000000..1e6ecc9 Binary files /dev/null and b/assets/shop/gloves/gg_gloves.jpg differ diff --git a/assets/shop/gloves/ias_gloves.jpg b/assets/shop/gloves/ias_gloves.jpg new file mode 100644 index 0000000..00cf7ec Binary files /dev/null and b/assets/shop/gloves/ias_gloves.jpg differ diff --git a/assets/shop/gloves/ias_gloves2.jpg b/assets/shop/gloves/ias_gloves2.jpg new file mode 100644 index 0000000..2e7ff35 Binary files /dev/null and b/assets/shop/gloves/ias_gloves2.jpg differ diff --git a/assets/shop/gloves/ias_gloves3.jpg b/assets/shop/gloves/ias_gloves3.jpg new file mode 100644 index 0000000..29ca55c Binary files /dev/null and b/assets/shop/gloves/ias_gloves3.jpg differ diff --git a/config/shop.ini b/config/shop.ini index ff4894d..7a04854 100644 --- a/config/shop.ini +++ b/config/shop.ini @@ -6,14 +6,14 @@ ; x light senetry: +6 ; x weapon block: +1 ; x death sentrey: +4 -shop_trap_claws=1 +shop_trap_claws=0 trap_min_score=13 ; Current scoring for melee claws ; 2 assa: +10 ; x venom: +6 ; x weapon block: +2 -shop_melee_claws=1 +shop_melee_claws=0 melee_min_score=13 [gloves] diff --git a/src/shop/anya.py b/src/shop/anya.py index f5ab3d5..32358d3 100644 --- a/src/shop/anya.py +++ b/src/shop/anya.py @@ -82,62 +82,66 @@ class AnyaShopper: self.reset_shop() self.shop_loop() - def shop_loop(self): - + def look_for_ias_gloves(self, glove_img_name, shop_img): asset_folder = "assets/shop/gloves/" - while True: - open_npc_menu(Npc.ANYA) - press_npc_btn(Npc.ANYA, "trade") - time.sleep(0.1) - img = grab() - - # 20 IAS gloves have a unique color so we can skip all others - ias_glove = template_finder.search( - ref=load_template(asset_folder + "ias_gloves.png"), - inp_img=img, + ias_glove = template_finder.search( + ref=load_template(asset_folder + glove_img_name), + inp_img=shop_img, threshold=0.96, roi=Config().ui_roi["left_inventory"] ) - if ias_glove.valid: - self.ias_gloves_seen += 1 - mouse.move(*ias_glove.center_monitor) - time.sleep(0.1) - img = grab() - - if self.look_for_plus_3_gloves is True: - gg_gloves = template_finder.search( + if ias_glove.valid: + self.ias_gloves_seen += 1 + mouse.move(*ias_glove.center_monitor) + time.sleep(0.5) + glove_dialog_img = grab() + + if self.look_for_plus_3_gloves is True: + Logger.info(f"Found 20 IAS gloves ({glove_img_name}), checking for jav skills") + gg_gloves = template_finder.search( + ref=load_template( + asset_folder + "gg_gloves.jpg" # assets for javazon gloves are mixed up, this one need +3 as in the 1080p version + ), + inp_img=glove_dialog_img, + threshold=0.80 + ) + if gg_gloves.valid: + mouse.click(button="right") + if self._messenger.enabled: + self._messenger.send_message("Bought awesome IAS/+3 gloves!") + Logger.info("IAS/jav gloves bought!") + self.gloves_bought += 1 + time.sleep(1) + else: + if self.look_for_plus_2_gloves is True: + g_gloves = template_finder.search( ref=load_template( - asset_folder + "gg_gloves.png" # assets for javazon gloves are mixed up, this one need +3 as in the 1080p version + asset_folder + "g_gloves.png" ), - inp_img=img, + inp_img=glove_dialog_img, threshold=0.80 ) - if gg_gloves.valid: + if g_gloves.valid: mouse.click(button="right") if self._messenger.enabled: - self._messenger.send_message("Bought awesome IAS/+3 gloves!") - - Logger.info("IAS/+3 gloves bought!") + self._messenger.send_message("Bought some decent IAS/+2 gloves") + Logger.info("IAS/+2 gloves bought!") self.gloves_bought += 1 time.sleep(1) - else: - if self.look_for_plus_2_gloves is True: - g_gloves = template_finder.search( - ref=load_template( - asset_folder + "g_gloves.png" - ), - inp_img=img, - threshold=0.80 - ) - if g_gloves.valid: - mouse.click(button="right") - if self._messenger.enabled: - self._messenger.send_message("Bought some decent IAS/+2 gloves") - Logger.info("IAS/+2 gloves bought!") - self.gloves_bought += 1 - time.sleep(1) + def shop_loop(self): + while True: + open_npc_menu(Npc.ANYA) + press_npc_btn(Npc.ANYA, "trade") + time.sleep(0.5) + img = grab() + + #For some reason the glove image varies slightly depending on where it is located in the shop. + #Additional ias_glove pictures were added after screenshot verification showed they weren't detected. + self.look_for_ias_gloves("ias_gloves.jpg", img) + self.look_for_ias_gloves("ias_gloves2.jpg", img) + self.look_for_ias_gloves("ias_gloves3.jpg", img) # Select Weapons section if self.look_for_trap_claws is True or self.look_for_melee_claws is True: