MCPcopy Create free account
hub / github.com/runhey/OnmyojiAutoScript / _play

Method _play

tasks/Pets/script_task.py:52–77  ·  view source on GitHub ↗

玩耍 :return:

(self)

Source from the content-addressed store, hash-verified

50 self.wait_until_disappear(self.I_PET_SKIP)
51
52 def _play(self):
53 """
54 玩耍
55 :return:
56 """
57 logger.hr('Play', 3)
58 self.ui_click(self.I_PET_HAPPY, self.I_PET_PLAY)
59 number = self.O_PET_PLAY_GOLD.ocr(self.device.image)
60 if number == 0:
61 # 金币不足
62 logger.warning('Gold not enough')
63 return
64 # 点击玩耍三次不出现就退出
65 play_count = 0
66 while 1:
67 self.screenshot()
68 if self.appear(self.I_PET_SKIP):
69 break
70 if play_count >= 3:
71 logger.warning('Play count > 3')
72 break
73 if self.appear_then_click(self.I_PET_PLAY, interval=1):
74 play_count += 1
75 logger.info(f'Play {play_count}')
76 continue
77 self.wait_until_disappear(self.I_PET_SKIP)
78
79
80if __name__ == '__main__':

Callers 1

runMethod · 0.95

Calls 6

ui_clickMethod · 0.95
ocrMethod · 0.80
appearMethod · 0.80
appear_then_clickMethod · 0.80
wait_until_disappearMethod · 0.80
screenshotMethod · 0.45

Tested by

no test coverage detected