diff --git a/mower/solvers/sign_in/shop.py b/mower/solvers/sign_in/shop.py index 43380900..734b20cc 100644 --- a/mower/solvers/sign_in/shop.py +++ b/mower/solvers/sign_in/shop.py @@ -23,6 +23,7 @@ import cv2 from skimage.feature import peak_local_max from mower.utils import config +from mower.utils.email import notify from mower.utils.graph import SceneGraphSolver from mower.utils.image import crop2content, cropimg, loadres, thres2 from mower.utils.rapidocr import ocr_rec @@ -34,6 +35,10 @@ class Shop(SceneGraphSolver): solver_name = "活动商店购买" solver_max_duration = timedelta(minutes=5) + def run(self): + self.notify_shop = False + return super().run() + def next_product(self): coin = loadres("sign_in/shop/coin", True) result = cv2.matchTemplate(config.recog.gray, coin, cv2.TM_CCOEFF_NORMED) @@ -84,8 +89,18 @@ class Shop(SceneGraphSolver): if pos := self.find("sign_in/shop/max"): self.tap(pos, update=False) self.sleep(0.5, update=False) + self.notify_shop = True self.tap("sign_in/shop/buy") + elif scene == Scene.MATERIEL: + if self.notify_shop: + self.notify_shop = False + self.sleep() + notify("活动商店物品购买") + self.tap((960, 200)) elif scene == Scene.ROGUE_AGENT: + if self.notify_shop: + self.notify_shop = False + notify("活动商店时装购买") self.tap((960, 200)) else: self.scene_graph_step(Scene.TERMINAL_MAIN)