活动商店购买发送邮件

This commit is contained in:
zhbaor 2025-01-25 21:53:38 +08:00
parent 4fd1057305
commit 85c5d36419

View file

@ -23,6 +23,7 @@ import cv2
from skimage.feature import peak_local_max from skimage.feature import peak_local_max
from mower.utils import config from mower.utils import config
from mower.utils.email import notify
from mower.utils.graph import SceneGraphSolver from mower.utils.graph import SceneGraphSolver
from mower.utils.image import crop2content, cropimg, loadres, thres2 from mower.utils.image import crop2content, cropimg, loadres, thres2
from mower.utils.rapidocr import ocr_rec from mower.utils.rapidocr import ocr_rec
@ -34,6 +35,10 @@ class Shop(SceneGraphSolver):
solver_name = "活动商店购买" solver_name = "活动商店购买"
solver_max_duration = timedelta(minutes=5) solver_max_duration = timedelta(minutes=5)
def run(self):
self.notify_shop = False
return super().run()
def next_product(self): def next_product(self):
coin = loadres("sign_in/shop/coin", True) coin = loadres("sign_in/shop/coin", True)
result = cv2.matchTemplate(config.recog.gray, coin, cv2.TM_CCOEFF_NORMED) 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"): if pos := self.find("sign_in/shop/max"):
self.tap(pos, update=False) self.tap(pos, update=False)
self.sleep(0.5, update=False) self.sleep(0.5, update=False)
self.notify_shop = True
self.tap("sign_in/shop/buy") 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: elif scene == Scene.ROGUE_AGENT:
if self.notify_shop:
self.notify_shop = False
notify("活动商店时装购买")
self.tap((960, 200)) self.tap((960, 200))
else: else:
self.scene_graph_step(Scene.TERMINAL_MAIN) self.scene_graph_step(Scene.TERMINAL_MAIN)