From 1e08543e5699ea1654c809d9b098b25d05c82bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=B3=E5=85=89=E5=B0=91=E5=B9=B4?= <849317537@qq.com> Date: Tue, 17 Sep 2024 17:20:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E6=94=BE=E4=B9=8B=E8=B7=AF=E7=9B=B8?= =?UTF-8?q?=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poe/collect.py | 28 +++++++++++++++ poe.py => poe/poe.py | 0 poe/start.py | 21 +++++++++++ poe/开隐匿圣甲虫或命运卡.py | 50 +++++++++++++++++++++++++++ 4 files changed, 99 insertions(+) create mode 100644 poe/collect.py rename poe.py => poe/poe.py (100%) create mode 100644 poe/start.py create mode 100644 poe/开隐匿圣甲虫或命运卡.py diff --git a/poe/collect.py b/poe/collect.py new file mode 100644 index 0000000..2c72701 --- /dev/null +++ b/poe/collect.py @@ -0,0 +1,28 @@ +import random +import time +import pyautogui +TARGET = (1935, 615) + + + +def get_all_target(): + for i in range(12): + x = TARGET[0] + 53 * i + for j in range(5): + y = TARGET[1] + 53 * j + yield x, y + + +def collect(): + # 按下ctrl + pyautogui.keyDown("ctrl") # hold down the shift key + time.sleep(random.random()) + for x, y in 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") + + diff --git a/poe.py b/poe/poe.py similarity index 100% rename from poe.py rename to poe/poe.py diff --git a/poe/start.py b/poe/start.py new file mode 100644 index 0000000..fba88c1 --- /dev/null +++ b/poe/start.py @@ -0,0 +1,21 @@ +import threading +from pynput import keyboard + +IS_START = False + +def get_start(): + return IS_START + +def listener_keyword(): + def on_press(key): + global IS_START + try: + if key.char == "=": + IS_START = not IS_START + print(f"IS_START: {IS_START}") + except AttributeError: + pass + with keyboard.Listener(on_press=on_press) as listener: + listener.join() +threading.Thread(target=listener_keyword).start() + diff --git a/poe/开隐匿圣甲虫或命运卡.py b/poe/开隐匿圣甲虫或命运卡.py new file mode 100644 index 0000000..3143ccc --- /dev/null +++ b/poe/开隐匿圣甲虫或命运卡.py @@ -0,0 +1,50 @@ +import time +import random +from pynput import keyboard, mouse +from start import get_start +import threading +import pyautogui +from collect import collect, get_all_target + +pyautogui.FAILSAFE = True +pyautogui.PAUSE = 0.02 + + +SOURCE = (490, 400) + + +def rep(): + for x, y in get_all_target(): + # 鼠标移动到SOURCE + pyautogui.moveTo(SOURCE[0], SOURCE[1], random.random() / 5) + time.sleep(random.random() / 30) + + # 右键 + pyautogui.rightClick() + time.sleep(random.random() / 30) + + # 放到 x, y + pyautogui.moveTo(x, y, random.random() / 5) + time.sleep(random.random() / 30) + + # 左键 + pyautogui.leftClick() + + +while True: + if get_start() == False: + continue + rep() + collect() + collect() + + + + + + + + + + +