设置图:
游戏窗口最大化。
海贼洞这里定位你要回点的定位。
运行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) #断线点1
color5 = pyautogui.pixel(1177,335) #断线点2
if 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) #死亡判断点1
color3 = pyautogui.pixel(1150,397) #死亡判断点2
if 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) #目标1
colordanshuamb2 = pyautogui.pixel(1360,216) #目标5
if 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(360,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(360,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) #目标1
colordanshuamb2 = pyautogui.pixel(1360,216) #目标5
if 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(360,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(360,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线程,它会在主线程结束时自动退出。因此,不需要显式停止它。
4. 摆摊(路中央)
bat
@echo off
set "script_path=E:\soft\game\sleep\baitan.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
# -*- 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:
delay = random.uniform(2.1,2.2)
time.sleep(delay)
pyautogui.moveTo(2249,1094, duration=0.2) 移动到背包摆摊
delay = random.uniform(0.21,0.22)
time.sleep(delay)
pyautogui.mouseDown(2249,1094, button='left') 点击背包摆摊
pyautogui.mouseUp(2249,1094, button='left') 点击背包摆摊
delay = random.uniform(0.21,0.22)
time.sleep(delay)
colordanshua1 = pyautogui.pixel(1395,615)
if colordanshua1 == (245,191,80) : #摆摊中间界面打开右上角黄色,说明此处可以摆摊
pyautogui.moveTo(1118,1279, duration=0.2) # 移动到轻功
delay = random.uniform(0.21,0.22)
time.sleep(delay)
pyautogui.mouseDown(1118,1279, button='left') # 点击轻功
pyautogui.mouseUp(1118,1279, button='left') # 点击轻功
delay = random.uniform(0.21,0.22)
time.sleep(delay)
delay = random.uniform(0.06,0.08)
time.sleep(delay)
pyautogui.moveTo(897,640, duration=0.1) # 移动路中间摆摊
delay = random.uniform(0.21,0.22)
time.sleep(delay)
pyautogui.mouseDown(897,640, button='left') #点击路中间摆摊
pyautogui.mouseUp(897,640, button='left')
delay = random.uniform(0.02,0.03)
time.sleep(delay)
pyautogui.moveTo(1340,803, duration=0.1) #移动到确认摆摊
delay = random.uniform(0.02,0.03)
time.sleep(delay)
pyautogui.mouseDown(1340,803, button='left') 点击确认摆摊
pyautogui.mouseUp(1340,803, button='left')
delay = random.uniform(3.1,3.2)
time.sleep(delay)
colordanshua2 = pyautogui.pixel(1395,615) #摆摊
if colordanshua2 != (245,191,80) :
delay = random.uniform(3.1,3.2)
time.sleep(delay)
time.sleep(0.02) #
# 由于listener是一个daemon线程,它会在主线程结束时自动退出。因此,不需要显式停止它。