一、电脑和游戏设置:
1. 电脑桌面(2560x1440缩放125%,游戏分辨率1920x1080)
2. 游戏目录Bin及Bin64下的game.exe和Launch.exe 右键
3. 属性 - 兼容性 - 更改所有用户的设置 - 更改高dpi设置 - 勾选替换搞的dpi缩放行为 - 选应用程序。
二、功能介绍:这个只写了几个简单的功能。
home暂停/恢复
end停止
三:2560x1440分辨率脚本python代码:保存为wegame2025.py
import tkinter as tk
import pygetwindow as gw
import json
import os
import asyncio
import pyautogui
import threading
import time
import random
import win32api
import win32con
import keyboard # 新增的库
import json
import cv2
import numpy as np
from PIL import ImageGrab
# 初始化全局变量
running = True
paused = False
# 创建主窗口
root = tk.Tk()
root.title("By:樱道流衿紫")
# 假设 checkbutton_vars 是一个包含选项的字典
checkbutton_vars = {
"打死怪": tk.IntVar(),
"挂马贼": tk.IntVar(),
"加状态": tk.IntVar(),
"BB副本": tk.IntVar(),
"打绿怪": tk.IntVar(),
"打红怪": tk.IntVar(),
"峨眉饺子": tk.IntVar(),
"组队": tk.IntVar(),
"内挂": tk.IntVar(),
"升级": tk.IntVar(),
}
def activate_window():#查找游戏
windows = gw.getAllTitles()
target_windows = [title for title in windows if "新天龙八部" in title]
if target_windows:
window = gw.getWindowsWithTitle(target_windows[0])[0]
window.activate()
window.maximize()
# 使用pywin32模拟按键
def send_key_press(key):
valid_keys = ['F1','F2','F3','F4','F5','F6','F7','F8','F9','F10']
if key in valid_keys:
pyautogui.press(key) # 使用 pyautogui 发送按键
def get_pixel_colors(x,y):
screenshot = pyautogui.screenshot()
return screenshot.getpixel((x,y))
def move_at_position(x, y):
pyautogui.moveTo(x, y)
# 使用 win32api 来模拟鼠标点击
def click_at_position(screen_x,screen_y):
# 使用 win32api 进行鼠标点击
win32api.SetCursorPos((screen_x,screen_y)) # 移动鼠标到指定位置
time.sleep(random.uniform(0.03,0.04))
# 模拟鼠标点击:鼠标左键按下和释放
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0,0,0) # 按下鼠标左键
time.sleep(0.02) # 按下时稍作停顿
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0,0,0) # 释放鼠标左键
time.sleep(random.uniform(0.03,0.04))
def colors_are_similar(colorzz1, colorzz2, tolerance=20):
return all(abs(c1 - c2) <= tolerance for c1, c2 in zip(colorzz1, colorzz2))
def da_si_huan_guai(): #打怪
colordd2 = get_pixel_colors(1225, 1334)
colorz39 = get_pixel_colors(278, 58)
colorz310 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colordd2, tolerance=20) and
colorz39 == (255, 162, 150) and
colorz310 != (155, 153, 152)):
send_key_press('F4')
time.sleep(random.uniform(0.07, 0.08))
colordd9 = get_pixel_colors(1261,1334)
colorz49 = get_pixel_colors(278, 58)
colorz410 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colordd9, tolerance=20) and
colorz49 == (255, 162, 150) and
colorz410 != (155, 153, 152)):
send_key_press('F5')
time.sleep(random.uniform(0.07, 0.08))
colorddd9 = get_pixel_colors(1296,1334)
colorzz49 = get_pixel_colors(278, 58)
colorzz410 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colorddd9, tolerance=20) and
colorzz49 == (255, 162, 150) and
colorzz410 != (155, 153, 152)):
send_key_press('F6')
time.sleep(random.uniform(0.07, 0.08))
bu_neng_gong_ji_huan_guai()
for _ in range(5): # 循环10次
colordd1 = get_pixel_colors(1189, 1334)
color9 = get_pixel_colors(278, 58)
color10 = get_pixel_colors(279, 41)
if (colors_are_similar((125, 104, 73), colordd1, tolerance=20) and
color9 == (255, 162, 150) and
color10 != (155, 153, 152)):
send_key_press('F3')
time.sleep(random.uniform(0.07, 0.08))
color1 = get_pixel_colors(278,58) # 有血
color2 = get_pixel_colors(279,41) # 白怪
if color1 == (255,162,150) and color2 != (155,153,152):
send_key_press('F2')
time.sleep(random.uniform(0.05, 0.06))
else:
send_key_press('F1')
time.sleep(random.uniform(0.05, 0.06))
color23 = get_pixel_colors(95,106)
color24 = get_pixel_colors(196,106)
if color23 == (16,4,0) and color24 != (255,162,150):
send_key_press('F10') # 如果颜色符合要求,按 F10
time.sleep(random.uniform(0.07, 0.08))
def gua_jiao_zi(): #打怪
si_wang_hui_dian2()
for _ in range(10): # 循环10次
color3 = get_pixel_colors(278, 58) # 有血
colorev3 = get_pixel_colors(447,79) # 峨眉山怪
if color3 == (255,162,150) and colorev3 == (253,249,214) : # 检查是否有绿怪
send_key_press('F2') # 假设F2是打绿怪的键
time.sleep(random.uniform(0.11, 0.13))
send_key_press('F1')
time.sleep(random.uniform(0.11, 0.13))
else:
send_key_press('F1')
time.sleep(random.uniform(0.11, 0.13))
colorpp22 = get_pixel_colors(62,32)
color22 = get_pixel_colors(83,63)
if colorpp22== (206,186,90) and color22 != (255,162,150): # 加血
send_key_press('F7') # 如果颜色符合要求,按 F7
time.sleep(random.uniform(0.07, 0.08))
def da_hong_guai(): #打怪
bu_neng_gong_ji_huan_guai()
colordd2 = get_pixel_colors(1225, 1334)
colorz39 = get_pixel_colors(278, 58)
colorz310 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colordd2, tolerance=20) and
colorz39 == (255, 162, 150) and
colorz310 == (155, 1, 1)):
send_key_press('F4')
time.sleep(random.uniform(0.07, 0.08))
for _ in range(10): # 循环10次
colordd1 = get_pixel_colors(1189, 1334)
color9 = get_pixel_colors(278, 58)
color10 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colordd1, tolerance=20) and
color9 == (255, 162, 150) and
color10 == (155, 1, 1)):
send_key_press('F3')
time.sleep(random.uniform(0.07, 0.08))
color1 = get_pixel_colors(278,58) # 有血
color2 = get_pixel_colors(279,41) # 红怪
if color1 == (255,162,150) and color2 == (155, 1, 1):
send_key_press('F2')
time.sleep(random.uniform(0.05, 0.06))
else:
send_key_press('F1')
time.sleep(random.uniform(0.05, 0.06))
def fang_ji_neng(): #打怪
colordd2 = get_pixel_colors(1225, 1334)
colorz39 = get_pixel_colors(278, 58)
colorz310 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colordd2, tolerance=20) and
colorz39 == (255, 162, 150) and
colorz310 != (155, 153, 152)):
send_key_press('F4')
time.sleep(random.uniform(0.07, 0.08))
colordd9 = get_pixel_colors(1261,1334)
colorz49 = get_pixel_colors(278, 58)
colorz410 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colordd9, tolerance=20) and
colorz49 == (255, 162, 150) and
colorz410 != (155, 153, 152)):
send_key_press('F5')
time.sleep(random.uniform(0.07, 0.08))
colorddd9 = get_pixel_colors(1296,1334)
colorzz49 = get_pixel_colors(278, 58)
colorzz410 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colorddd9, tolerance=20) and
colorzz49 == (255, 162, 150) and
colorzz410 != (155, 153, 152)):
send_key_press('F6')
time.sleep(random.uniform(0.07, 0.08))
def da_lv_guai():
colordd2 = get_pixel_colors(1225, 1334)
colorz39 = get_pixel_colors(278, 58)
colorz310 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colordd2, tolerance=20) and
colorz39 == (255, 162, 150) and
colorz310 != (155, 153, 152)):
send_key_press('F4')
time.sleep(random.uniform(0.07, 0.08))
colordd9 = get_pixel_colors(1261,1334)
colorz49 = get_pixel_colors(278, 58)
colorz410 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colordd9, tolerance=20) and
colorz49 == (255, 162, 150) and
colorz410 != (155, 153, 152)):
send_key_press('F5')
time.sleep(random.uniform(0.07, 0.08))
colorddd9 = get_pixel_colors(1296,1334)
colorzz49 = get_pixel_colors(278, 58)
colorzz410 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colorddd9, tolerance=20) and
colorzz49 == (255, 162, 150) and
colorzz410 != (155, 153, 152)):
send_key_press('F6')
time.sleep(random.uniform(0.07, 0.08))
for _ in range(10): # 循环10次
colordd1 = get_pixel_colors(1189, 1334)
color9 = get_pixel_colors(278, 58)
color10 = get_pixel_colors(279, 41)
if (colors_are_similar((126, 107, 76), colordd1, tolerance=20) and
color9 == (255, 162, 150) and
color10 != (155, 153, 152)):
send_key_press('F3')
time.sleep(random.uniform(0.07, 0.08))
color3 = get_pixel_colors(278, 58) # 有血
if color3 == (255,162,150): # 检查是否有绿怪
send_key_press('F2') # 假设F2是打绿怪的键
time.sleep(random.uniform(0.05, 0.06))
send_key_press('F1') # 默认操作
time.sleep(random.uniform(0.05, 0.06))
else:
send_key_press('F1')
time.sleep(random.uniform(0.05, 0.06))
color23 = get_pixel_colors(95,106)
color24 = get_pixel_colors(196,106)
if color23 == (16,4,0) and color24 != (255,162,150):
send_key_press('F10') # 如果颜色符合要求,按 F10
time.sleep(random.uniform(0.05, 0.06))
def fang_ji_neng2(): #打怪
colormazei1 = get_pixel_colors(453, 64) # 是马贼1
colordd1 = get_pixel_colors(1189, 1334)
color9 = get_pixel_colors(278, 58)
color10 = get_pixel_colors(279, 41)
if (colors_are_similar((125, 104, 73), colordd1, tolerance=20) and
colormazei1 == (205, 195, 196) and
color9 == (255, 162, 150) and
color10 != (155, 153, 152)):
send_key_press('F3')
time.sleep(random.uniform(0.07, 0.08))
colormazei2 = get_pixel_colors(453, 64) # 是马贼1
colordd2 = get_pixel_colors(1224, 1334)
colorz39 = get_pixel_colors(278, 58)
colorz310 = get_pixel_colors(279, 41)
if (colors_are_similar((121, 101, 69), colordd2, tolerance=20) and
colormazei2 == (205, 195, 196) and
colorz39 == (255, 162, 150) and
colorz310 != (155, 153, 152)):
send_key_press('F4')
time.sleep(random.uniform(0.07, 0.08))
def gua_ma_zei():
for _ in range(3): # 循环3次
fang_ji_neng2()
color2626 = get_pixel_colors(453, 64) # 是马贼1
color2627 = get_pixel_colors(466, 63) # 是马贼2
color2628 = get_pixel_colors(278, 58) # 有血