diff --git a/mower/solvers/sign_in/shop.py b/mower/solvers/sign_in/shop.py index 469cde1b..358c1959 100644 --- a/mower/solvers/sign_in/shop.py +++ b/mower/solvers/sign_in/shop.py @@ -37,6 +37,7 @@ class Shop(SceneGraphSolver): def run(self): self.notify_shop = False + self.product = None return super().run() def next_product(self): @@ -66,6 +67,7 @@ class Shop(SceneGraphSolver): name = crop2content(name) name = ocr_rec(name) if name not in config.conf.activity_shop_blacklist: + self.product = name return va(top_left, (245, 110)) return None @@ -82,6 +84,9 @@ class Shop(SceneGraphSolver): return self.swipe_ext([(1600, 340), (300, 340), (300, 150)], [0.2, 0.3], 0, 0.1) elif scene == Scene.ACTIVITY_SHOP_BUY: + if self.product is None: + self.scene_graph_step(Scene.ACTIVITY_SHOP) + return if self.find("sign_in/shop/insufficient"): return True if self.animation(): @@ -92,12 +97,12 @@ class Shop(SceneGraphSolver): self.tap(pos, update=False) self.sleep(0.5, update=False) self.notify_shop = True - self.tap("sign_in/shop/buy") + self.ctap("sign_in/shop/buy", id=self.product) elif scene == Scene.MATERIEL: if self.notify_shop: self.notify_shop = False self.sleep() - notify("活动商店物品购买") + notify(f"活动商店物品购买:{self.name}") self.tap((960, 200)) elif scene == Scene.ROGUE_AGENT: if self.notify_shop: