From 2f6de9d9d17d8f782e9ceb6cbc6e9e442a76673e 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: Fri, 11 Oct 2024 12:54:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poe/collect.py | 39 +++++++++++++------------ poe/开隐匿圣甲虫或命运卡.py | 36 +++++++++++++++++++---- poe/开隐匿圣甲虫或命运卡.spec | 39 +++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 24 deletions(-) create mode 100644 poe/开隐匿圣甲虫或命运卡.spec diff --git a/poe/collect.py b/poe/collect.py index 2c72701..2199711 100644 --- a/poe/collect.py +++ b/poe/collect.py @@ -1,28 +1,29 @@ import random import time import pyautogui -TARGET = (1935, 615) +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 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") + 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") diff --git a/poe/开隐匿圣甲虫或命运卡.py b/poe/开隐匿圣甲虫或命运卡.py index 3143ccc..e784865 100644 --- a/poe/开隐匿圣甲虫或命运卡.py +++ b/poe/开隐匿圣甲虫或命运卡.py @@ -1,20 +1,44 @@ import time import random + +import winsound from pynput import keyboard, mouse from start import get_start import threading import pyautogui -from collect import collect, get_all_target +from collect import Collect pyautogui.FAILSAFE = True pyautogui.PAUSE = 0.02 - SOURCE = (490, 400) +collect = Collect() + +def listener_keyword(): + def on_press(key): + global collect, SOURCE + try: + if key.char == "1": + SOURCE = pyautogui.position() + # 得到当前鼠标位置 + print(pyautogui.position()) + winsound.Beep(800, 200) + elif key.char == "2": + collect = Collect(pyautogui.position()) + print(pyautogui.position()) + winsound.Beep(800, 200) + except AttributeError: + pass + with keyboard.Listener(on_press=on_press) as listener: + listener.join() +threading.Thread(target=listener_keyword, daemon=True).start() + -def rep(): - for x, y in get_all_target(): + + +def rep(collect: Collect): + for x, y in collect.get_all_target(): # 鼠标移动到SOURCE pyautogui.moveTo(SOURCE[0], SOURCE[1], random.random() / 5) time.sleep(random.random() / 30) @@ -31,10 +55,12 @@ def rep(): pyautogui.leftClick() + while True: + time.sleep(0.1) if get_start() == False: continue - rep() + rep(collect) collect() collect() diff --git a/poe/开隐匿圣甲虫或命运卡.spec b/poe/开隐匿圣甲虫或命运卡.spec new file mode 100644 index 0000000..5bd8055 --- /dev/null +++ b/poe/开隐匿圣甲虫或命运卡.spec @@ -0,0 +1,39 @@ +# -*- mode: python ; coding: utf-8 -*- + + +a = Analysis( + ['开隐匿圣甲虫或命运卡.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, + optimize=0, +) +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.datas, + [], + name='开隐匿圣甲虫或命运卡', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, + icon=['QQ图片20241007140402.jpg'], +)