forked from misakamikodo/mhxy_script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mhxy_auto_battle.py
40 lines (33 loc) · 1.16 KB
/
mhxy_auto_battle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import argparse
from mhxy import *
class AutoBattle:
type=None
def __init__(self, type=None) -> None:
super().__init__()
self.type=type
def do(self):
click = False
while True:
# linglongshi jingjichang huashang
if self.type is not None:
linglongshi = Util.locateCenterOnScreen(rf'resources/small/{self.type}.png')
if linglongshi is not None:
pyautogui.leftClick(linglongshi.x, linglongshi.y - 10)
if battling(r'resources/small/no_auto_battle.png'):
if not click:
cooldown(2)
Util.leftClick(-1.2, -1.2)
click = True
cooldown(2)
else:
click = False
cooldown(2)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='OF Generate')
parser.add_argument('-i', '--idx', default=0, type=int)
parser.add_argument('-t', '--type', default=None, type=str)
args = parser.parse_args()
pyautogui.PAUSE = 0.5
log("start task....")
init(idx=args.idx)
AutoBattle(type=args.type).do()