You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
764 B
Python
30 lines
764 B
Python
import random
|
|
import time
|
|
import pyautogui
|
|
|
|
class Collect:
|
|
def __init__(self, target=(1935, 615)):
|
|
self.target = target
|
|
|
|
def get_all_target(self):
|
|
for i in range(12):
|
|
x = self.target[0] + 52 * i
|
|
for j in range(5):
|
|
y = self.target[1] + 52 * j
|
|
yield x, y
|
|
|
|
|
|
def __call__(self, *args, **kwargs):
|
|
# 按下ctrl
|
|
pyautogui.keyDown("ctrl") # hold down the shift key
|
|
time.sleep(random.random())
|
|
for x, y in self.get_all_target():
|
|
pyautogui.moveTo(x, y, random.random() / 20)
|
|
time.sleep(random.random() / 20)
|
|
pyautogui.leftClick()
|
|
time.sleep(random.random())
|
|
# 松开ctrl
|
|
pyautogui.press("ctrl")
|
|
|
|
|