设置图:
游戏窗口最大化。
海贼洞这里定位你要回点的定位。
运行bat就行,脚本出错了还是会重新运行脚本,运行自动启动,end暂停脚本,home重新启动脚本
1. 我常用的是内挂回点脚本,下面都是前台脚本,如果颜色点位没有区别,那么恭喜直接可以用,如果不能正常运作,那么颜色点位不一样,思路给你了,抓点抓色对应修改动手一下吧。
新建批处理 ng.bat
@echo off
set "script_path=E:\soft\game\sleep\NG.py" :: 替换为你的python.py脚本的实际路径
set "max_wait=120" :: 设置等待时间为120秒(2分钟)
timeout /t 5
:loop echo Checking python.py... powershell -Command "Start-Process python -Verb RunAs -ArgumentList '""%script_path%"""' -Wait" if %errorlevel% neq 0 ( echo python.py failed. Waiting %max_wait% seconds before retrying... timeout /t %max_wait% >nul ) else ( echo python.py executed successfully. )
goto :loop
新建python脚本 ng.py
# -*- coding: utf-8 -*-
import pygetwindow as gw
import pyautogui
import time
import random
import threading
from pynput.keyboard import Key,Listener running = True
listener = None def perform_click(x,y,duration=0.2,delay_range=(0.3,0.4)): pyautogui.moveTo(x,y,duration=duration) delay = random.uniform(*delay_range) time.sleep(delay) pyautogui.mouseDown(x,y,button='left') delay = random.uniform(*delay_range) time.sleep(delay) pyautogui.mouseUp(x,y,button='left') def on_press(key): global running if key == Key.home: print("继续运行脚本") running = True elif key == Key.end: print("暂停运行脚本") running = False def start_listener(): global listener with Listener(on_press=on_press) as listener: listener.join() listener_thread = threading.Thread(target=start_listener,daemon=True)
listener_thread.start()
delay = random.uniform(2.3,2.5)
time.sleep(delay) while True: if running: color1 = pyautogui.pixel(2544,144) #内挂if color1 == (255,243,49): perform_click(2544,144,duration=0.5,delay_range=(0.3,0.5)) delay = random.uniform(0.5,1.0)time.sleep(delay)pyautogui.moveTo(1600,169, duration=0.2)color4 = pyautogui.pixel(1294,322) #断线点1color5 = pyautogui.pixel(1177,335) #断线点2if color4 == (255,242,99) and color5 == (255,242,99) : delay = random.uniform(15.0,20.0)time.sleep(delay)perform_click(1344,356,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(5.0,6.0)time.sleep(delay)color2 = pyautogui.pixel(1205,397) #死亡判断点1color3 = pyautogui.pixel(1150,397) #死亡判断点2if color2 == (37,37,37) and color3 == (37,37,37) :delay = random.uniform(200,210)time.sleep(delay)perform_click(1357,397,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(5.0,6.0)time.sleep(delay)# 上面是人物死亡出鞘pyautogui.press('tab')delay = random.uniform(0.5,1.0)time.sleep(delay)perform_click(2448,326,duration=0.2,delay_range=(0.3,0.5)) pyautogui.mouseDown(2448,326,button='left')pyautogui.mouseUp(2448,326 ,button='left') delay = random.uniform(0.04,0.05)time.sleep(delay)pyautogui.mouseDown(2448,326,button='left')pyautogui.mouseUp(2448,326,button='left') delay = random.uniform(3,4)time.sleep(delay)pyautogui.press('tab')delay = random.uniform(0.5,1.0)time.sleep(delay)perform_click(73,351,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(5,6)time.sleep(delay)#上面是走出地府delay = random.uniform(2.0,2.2)time.sleep(delay)perform_click(1299,1313,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(0.5,1.0)time.sleep(delay)perform_click(1361,866,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(0.5,1.0)time.sleep(delay)perform_click(1419,936,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(0.5,1.0)time.sleep(delay)perform_click(1296,825,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(8,9)time.sleep(delay)#上面是大理使用地彻符起飞color7799 = pyautogui.pixel(575,208) #珍兽未关闭if color7799 == (248,196,88) : delay = random.uniform(0.5,0.8)time.sleep(delay)perform_click(968,1383,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(0.5,0.8)time.sleep(delay)color7788 = pyautogui.pixel(93,112) #珍兽未出站if color7788 != (231,211,123) : delay = random.uniform(0.3,0.5)time.sleep(delay)perform_click(968,1383,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(0.5,0.8)time.sleep(delay)color77991 = pyautogui.pixel(575,208) #珍兽未关闭if color77991 == (248,196,88) : perform_click(191,505,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(0.5,0.8)time.sleep(delay)perform_click(194,542,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(3.5,4.0)time.sleep(delay)perform_click(968,1383,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(0.5,0.8)time.sleep(delay)time.sleep(0.5) # # 由于listener是一个daemon线程,它会在主线程结束时自动退出。因此,不需要显式停止它。
2. 打马活动脚本
新建批处理 dm.bat
@echo off
set "script_path=E:\soft\game\sleep\DM.py" :: 替换为你的python.py脚本的实际路径
set "max_wait=120" :: 设置等待时间为120秒(2分钟)
timeout /t 5
:loop echo Checking python.py... powershell -Command "Start-Process python -Verb RunAs -ArgumentList '""%script_path%"""' -Wait" if %errorlevel% neq 0 ( echo python.py failed. Waiting %max_wait% seconds before retrying... timeout /t %max_wait% >nul ) else ( echo python.py executed successfully. )
goto :loop
新建python脚本 dm.py
# -*- coding: utf-8 -*-
import pygetwindow as gw
import pyautogui
import time
import random
import threading
from pynput.keyboard import Key,Listener running = True
listener = None def perform_click(x,y,duration=0.2,delay_range=(0.3,0.4)): pyautogui.moveTo(x,y,duration=duration) delay = random.uniform(*delay_range) time.sleep(delay) pyautogui.mouseDown(x,y,button='left') delay = random.uniform(*delay_range) time.sleep(delay) pyautogui.mouseUp(x,y,button='left') def on_press(key): global running if key == Key.home: print("继续运行脚本") running = True elif key == Key.end: print("暂停运行脚本") running = False def start_listener(): global listener with Listener(on_press=on_press) as listener: listener.join() listener_thread = threading.Thread(target=start_listener,daemon=True)
listener_thread.start() while True: if running: colordanshua1 = pyautogui.pixel(278,52) #有血colordanshua2 = pyautogui.pixel(453,58) #是马贼colordanshua3 = pyautogui.pixel(279,35) #白怪colordanshua33 = pyautogui.pixel(279,35) #红怪if colordanshua1 == (255,162,150) and colordanshua3 != (155,153,152) and colordanshua2 == (205,195,196) or colordanshua33 == (155,1,1) :pyautogui.press('F2') delay = random.uniform(0.11,0.12)time.sleep(delay) else: pyautogui.press('F1') delay = random.uniform(0.11,0.12)time.sleep(delay) colordanshua1 = pyautogui.pixel(278,52) #没血if colordanshua1 != (255,162,150) :pyautogui.press('F1') delay = random.uniform(0.11,0.12)time.sleep(delay) colordanshua1 = pyautogui.pixel(278,64) #怒气if colordanshua1 == (255,255,213) :pyautogui.press('F1') delay = random.uniform(0.11,0.12)time.sleep(delay) colordanshuamb1 = pyautogui.pixel(1206,136) #目标1colordanshuamb2 = pyautogui.pixel(1360,216) #目标5if colordanshuamb1 == (1,1,1) and colordanshuamb2 == (1,1,1) :pyautogui.press('F1') delay = random.uniform(0.11,0.12)time.sleep(delay) colordanshua3 = pyautogui.pixel(279,35) #红怪colordanshua21 = pyautogui.pixel(370,52) #怪物大半血colordanshua23 = pyautogui.pixel(1224,1344) #F4技能好了if colordanshua3 == (155,1,1) and colordanshua21 == (255,162,150) and colordanshua23 != (33,28,19) :delay = random.uniform(0.20,0.22)time.sleep(delay) pyautogui.press('F5') delay = random.uniform(0.20,0.22)time.sleep(delay) pyautogui.press('F4') delay = random.uniform(0.20,0.22)time.sleep(delay) pyautogui.press('F6') delay = random.uniform(0.20,0.22)time.sleep(delay) colordanshua33 = pyautogui.pixel(279,35) #红怪colordanshua21 = pyautogui.pixel(370,52) #怪物大半血colordanshua22 = pyautogui.pixel(1188,1344) #F3技能好了if colordanshua33 == (155,1,1) and colordanshua21 == (255,162,150) and colordanshua22 != (33,28,19) :delay = random.uniform(0.2,0.3)time.sleep(delay) pyautogui.press('F5') delay = random.uniform(0.20,0.22)time.sleep(delay) pyautogui.press('F3') delay = random.uniform(0.20,0.22)time.sleep(delay) colorlan2 = pyautogui.pixel(104,63) # 没蓝if colorlan2 != (193,188,255) :delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.press('F7') # 吃蓝delay = random.uniform(0.21,0.22)time.sleep(delay) colorjiaxue13 = pyautogui.pixel(166,57) # 没血if colorjiaxue13 !=(255,162,150) :delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.press('F10') # 吃血delay = random.uniform(0.21,0.22)time.sleep(delay) colorccc1 = pyautogui.pixel(93,112) # 宝宝在colorccc2 = pyautogui.pixel(180,100) # 珍兽50%血 if colorccc1 == (231,211,123) and colorccc2 != (255,162,150) : # 宝宝加血delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.press('F8') # delay = random.uniform(0.21,0.22)time.sleep(delay) colorccc11 = pyautogui.pixel(93,112) # 宝宝在colorccc21 = pyautogui.pixel(150,100) # 珍兽30%血 if colorccc11 == (231,211,123) and colorccc21 != (255,162,150) : # 宝宝加血delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.press('F9') # delay = random.uniform(0.21,0.22)time.sleep(delay) colorcccdz1 = pyautogui.pixel(3,175) # 队友1在colorcccdz2 = pyautogui.pixel(58,69) # 我是队长if colorcccdz1 == (0,0,0) and colorcccdz2 == (219,31,10) : # 给队长delay = random.uniform(3.21,3.22)time.sleep(delay) pyautogui.moveTo(20,170, duration=0.2)delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.mouseDown(20,170, button='left')pyautogui.mouseUp(20,170, button='left')delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.mouseDown(20,170, button='right')pyautogui.mouseUp(20,170, button='right')delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.moveTo(47,243, duration=0.2)delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.mouseDown(47,243, button='left')pyautogui.mouseUp(47,243, button='left')delay = random.uniform(0.21,0.22)time.sleep(delay) colorcccdz3 = pyautogui.pixel(1581,1382) # 闪烁if colorcccdz3 == (49,41,32) : # 加队delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.moveTo(1581,1382, duration=0.2)delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.mouseDown(1581,1382, button='left')pyautogui.mouseUp(1581,1382, button='left')delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.moveTo(1563,836, duration=0.2)delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.mouseDown(1563,836, button='left')pyautogui.mouseUp(1563,836, button='left')delay = random.uniform(0.21,0.22)time.sleep(delay) colorcccdz11 = pyautogui.pixel(3,175) # 队友1不在colorcccdz21 = pyautogui.pixel(58,69) # 我是队长if colorcccdz11 != (0,0,0) and colorcccdz21 == (219,31,10) : # 解散队delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.moveTo(37,62, duration=0.2)delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.mouseDown(37,62, button='left')pyautogui.mouseUp(37,62, button='left')delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.mouseDown(37,62, button='right')pyautogui.mouseUp(37,62, button='right')delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.moveTo(62,71, duration=0.2)delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.mouseDown(62,71, button='left')pyautogui.mouseUp(62,71, button='left')delay = random.uniform(0.21,0.22)time.sleep(delay) time.sleep(0.02) # # 由于listener是一个daemon线程,它会在主线程结束时自动退出。因此,不需要显式停止它。
3. 副本打怪脚本
新建批处理 dg.bat
@echo off
set "script_path=E:\soft\game\sleep\DG.py" :: 替换为你的python.py脚本的实际路径
set "max_wait=120" :: 设置等待时间为120秒(2分钟)
timeout /t 5
:loop echo Checking python.py... powershell -Command "Start-Process python -Verb RunAs -ArgumentList '""%script_path%"""' -Wait" if %errorlevel% neq 0 ( echo python.py failed. Waiting %max_wait% seconds before retrying... timeout /t %max_wait% >nul ) else ( echo python.py executed successfully. )
goto :loop
新建python脚本 dg.py
# -*- coding: utf-8 -*-
import pygetwindow as gw
import pyautogui
import time
import random
import threading
from pynput.keyboard import Key,Listener running = True
listener = None def perform_click(x,y,duration=0.2,delay_range=(0.3,0.4)): pyautogui.moveTo(x,y,duration=duration) delay = random.uniform(*delay_range) time.sleep(delay) pyautogui.mouseDown(x,y,button='left') delay = random.uniform(*delay_range) time.sleep(delay) pyautogui.mouseUp(x,y,button='left') def on_press(key): global running if key == Key.home: print("继续运行脚本") running = True elif key == Key.end: print("暂停运行脚本") running = False def start_listener(): global listener with Listener(on_press=on_press) as listener: listener.join() listener_thread = threading.Thread(target=start_listener,daemon=True)
listener_thread.start() while True: if running: colordanshua1 = pyautogui.pixel(278,52) #有血if colordanshua1 == (255,162,150) :pyautogui.press('F2') delay = random.uniform(0.11,0.12)time.sleep(delay) else: pyautogui.press('F1') delay = random.uniform(0.11,0.12)time.sleep(delay) colordanshuamb1 = pyautogui.pixel(1206,136) #目标1colordanshuamb2 = pyautogui.pixel(1360,216) #目标5if colordanshuamb1 == (1,1,1) and colordanshuamb2 == (1,1,1) :pyautogui.press('F1') delay = random.uniform(0.11,0.12)time.sleep(delay) colordanshua3 = pyautogui.pixel(279,35) #红怪colordanshua21 = pyautogui.pixel(379,52) #怪物大半血colordanshua23 = pyautogui.pixel(1224,1344) #F4技能好了if colordanshua3 == (155,1,1) and colordanshua21 == (255,162,150) and colordanshua23 != (33,28,19) :delay = random.uniform(0.2,0.3)time.sleep(delay) pyautogui.press('F5') delay = random.uniform(0.2,0.3)time.sleep(delay) pyautogui.press('F4') delay = random.uniform(0.2,0.3)time.sleep(delay) pyautogui.press('F6') delay = random.uniform(0.2,0.3)time.sleep(delay) colordanshua211 = pyautogui.pixel(278,52) #有血if colordanshua211 == (255,162,150) :pyautogui.press('F2') delay = random.uniform(0.11,0.12)time.sleep(delay) else: pyautogui.press('F1') delay = random.uniform(0.11,0.12)time.sleep(delay) colordanshua33 = pyautogui.pixel(279,35) #红怪colordanshua21 = pyautogui.pixel(379,52) #怪物大半血colordanshua22 = pyautogui.pixel(1188,1344) #F3技能好了if colordanshua33 == (155,1,1) and colordanshua21 == (255,162,150) and colordanshua22 != (33,28,19) :delay = random.uniform(0.2,0.3)time.sleep(delay) pyautogui.press('F5') delay = random.uniform(0.2,0.3)time.sleep(delay) pyautogui.press('F3') delay = random.uniform(0.2,0.3)time.sleep(delay) colorjiaxue1 = pyautogui.pixel(93,112) # 宝宝在colorjiaxue2 = pyautogui.pixel(166,57) # 没血colorjiaxue5 = pyautogui.pixel(1477,1298) # 共生colorjiaxue6 = pyautogui.pixel(199,100) # 宝宝满血if colorjiaxue1 == (231,211,123) and colorjiaxue2 != (255,162,150) and colorjiaxue5 != (49,41,29) and colorjiaxue6 == (255,162,150) :delay = random.uniform(0.21,0.22)time.sleep(delay) perform_click(1477,1315,duration=0.2,delay_range=(0.3,0.5)) delay = random.uniform(0.21,0.22)time.sleep(delay) colorlan2 = pyautogui.pixel(104,63) # 没蓝if colorlan2 != (193,188,255) :delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.press('F7') # 吃蓝delay = random.uniform(0.21,0.22)time.sleep(delay) colorjiaxue14 = pyautogui.pixel(93,112) # 宝宝不在colorjiaxue13 = pyautogui.pixel(166,57) # 没血if colorjiaxue13 !=(255,162,150) and colorjiaxue14 != (231,211,123):delay = random.uniform(0.2,0.3)time.sleep(delay) pyautogui.press('F10') # 吃血delay = random.uniform(0.21,0.22)time.sleep(delay) colorccc1 = pyautogui.pixel(93,112) # 宝宝在colorccc2 = pyautogui.pixel(180,100) # 珍兽30%血 if colorccc1 == (231,211,123) and colorccc2 != (255,162,150) : # 宝宝加血delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.press('F8') # delay = random.uniform(0.21,0.22)time.sleep(delay) colorccc11 = pyautogui.pixel(93,112) # 宝宝在colorccc21 = pyautogui.pixel(150,100) # 珍兽30%血 if colorccc11 == (231,211,123) and colorccc21 != (255,162,150) : # 宝宝加血delay = random.uniform(0.21,0.22)time.sleep(delay) pyautogui.press('F9') # delay = random.uniform(0.21,0.22)time.sleep(delay) time.sleep(0.02) # # 由于listener是一个daemon线程,它会在主线程结束时自动退出。因此,不需要显式停止它。