本帖最后由 从来不想 于 2026-3-2 14:55 编辑
看到论坛中有人发寻仙记部署教程,评论中看到一个部署好的网址,立马开玩,感觉还不错,适合摸鱼
游戏中有自动挂机功能,但是要扣灵石
为了秉持浪费可耻的原则,用AI写了个挂机刷怪脚本
该脚本使用油猴运行,在油猴中配置好,打开游戏网址登录后,点击自动挂机即可自动刷怪
2026年3月2日脚本加强版
修复首页误判
- 关键修复:使用精确特征
========战斗======== 识别战斗页,避免首页地图带“战斗”字样导致的误判。
增加自动突破
- 新增:自动检测页面是否有文本为“突破”的链接,如果有则优先点击,直至突破完成。
- 原理:在每次自动操作前检查突破链接,确保突破需求优先处理,不影响正常挂机循环。
极速刷怪
- 提速:操作间隔缩短至 200ms,并允许用户自定义延迟(变量
DELAY_MS),给您带来极速般的升级
增加屏幕常亮
- 新增:开启挂机时自动激活屏幕常亮(优先使用 Wake Lock API,不支持则回退到视频保活),防止手机锁屏,妈妈再也不用担心我手机自动黑屏了
增加通用药品识别
- 升级:药品不再局限于“初级药剂”,自动识别任何文本包含“药剂”的链接(如“小瓶药剂”、“中瓶药剂”)。
当前脚本特点
- 全自动挂机:从选怪、战斗、吃药、逃跑、被抢处理到突破,全程无需人工干预。
- 智能识别:精准区分首页、战斗页、怪物详情页、胜利页和被抢页,适应各种页面变化。
- 高性能:通过代码优化和智能延迟,执行效率高,占用资源少。
- 手机适配:屏幕常亮功能专为手机用户设计,防止锁屏中断挂机。
- 开关记忆:按钮状态自动保存,刷新页面后恢复。
// ==UserScript==
// @name 寻仙记
// @namespace http://tampermonkey.net/
// @version 2.19
// @description 自动刷怪,智能延迟,屏幕常亮,自动突破,按钮右下角
// @author YourName
// @match https://eebess.com/xxj/*
// @require https://eebess.com/xxj/js/jquery-1.6.2.min.js
// @grant GM_setValue
// @grant GM_getValue
// ==/UserScript==
(function() {
'use strict';
if (typeof $ === 'undefined') return;
// ========== 配置参数 ==========
const DELAY_HOME = 150; // 首页延迟(ms)
const DELAY_FIGHT = 200; // 战斗页延迟(ms)
const HP_THRESHOLD = 200; // 吃药阈值
// =============================
const STORAGE_KEY = 'autoFightEnabled';
let enabled = GM_getValue(STORAGE_KEY, true);
let wakeLock = null, keepAwakeVideo = null;
let wakeLockSupported = 'wakeLock' in navigator;
// --- 屏幕常亮 ---
function requestWakeLock() {
if (!enabled) return;
if (wakeLockSupported) {
if (wakeLock) return;
navigator.wakeLock.request('screen').then(lock => {
wakeLock = lock;
lock.addEventListener('release', () => {
wakeLock = null;
if (enabled) requestWakeLock();
});
}).catch(() => {});
} else if (!keepAwakeVideo) {
keepAwakeVideo = $('<video loop muted playsinline style="width:1px;height:1px;opacity:0;position:fixed;top:0;left:0;pointer-events:none;z-index:-1">').appendTo('body')[0];
keepAwakeVideo.src = 'data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZLiKta4M9R0gEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
keepAwakeVideo.play().catch(() => {});
}
}
function releaseWakeLock() {
if (wakeLockSupported && wakeLock) {
wakeLock.release().then(() => wakeLock = null);
} else if (keepAwakeVideo) {
keepAwakeVideo.pause();
keepAwakeVideo.remove();
keepAwakeVideo = null;
}
}
// --- 按钮创建 ---
const $btn = $('<div id="autoFightSwitch" style="position:fixed;bottom:20px;right:20px;z-index:9999;padding:10px 15px;border-radius:30px;font-size:14px;font-weight:bold;cursor:pointer;box-shadow:0 2px 10px rgba(0,0,0,0.3);user-select:none;background:' + (enabled ? '#4CAF50' : '#f44336') + ';color:white;border:2px solid white;">' + (enabled ? '自动挂机 ON' : '自动挂机 OFF') + '</div>').appendTo('body');
$btn.on('click', () => {
enabled = !enabled;
GM_setValue(STORAGE_KEY, enabled);
$btn.css('background', enabled ? '#4CAF50' : '#f44336').text(enabled ? '自动挂机 ON' : '自动挂机 OFF');
if (enabled) {
requestWakeLock();
autoAction();
} else {
releaseWakeLock();
}
});
// --- 辅助函数 ---
function getFirstMonsterLink() {
const content = $('.content').html();
const idx = content.indexOf('你看到:');
if (idx === -1) return null;
const match = content.substring(idx + 4).match(/<a\s+href=["']([^"']*)["']/i);
return match ? $('a[href="' + match[1] + '"]').first() : null;
}
function clickReturnHome() {
const $link = $('a:contains("返回首页")').first();
if ($link.length) { $link[0].click(); return true; }
let found = false;
$('a').each(function() { if (this.innerText.includes('返回首页')) { this.click(); found = true; return false; } });
return found;
}
// --- 核心循环 ---
function autoAction() {
if (!enabled) return;
// 【新增】优先检测突破链接
const breakLink = $('a:contains("突破")').first();
if (breakLink.length) {
breakLink[0].click(); // 点击突破链接
return; // 等待新页面加载后重新调度
}
const bodyText = document.body.innerText;
const isFight = bodyText.includes('========战斗========') && $('a:contains("攻击")').length && $('.hpys').length;
const hasDrop = bodyText.includes('掉落:');
const hasVictory = bodyText.includes('战斗胜利!') || bodyText.includes('你打死了');
const isHome = bodyText.includes('你看到:') && !isFight && !hasDrop && !hasVictory;
// 按优先级处理
if (bodyText.includes('怪物已经被其他人攻击')) {
clickReturnHome() || scheduleAction(DELAY_HOME);
} else if (hasVictory) {
clickReturnHome() || scheduleAction(DELAY_HOME);
} else if (isFight) {
const hp = parseInt($('.hpys').eq(2).text());
if (isNaN(hp)) { scheduleAction(DELAY_FIGHT); return; }
if (hp < HP_THRESHOLD) {
const potion = $('a:contains("药剂")').first();
if (potion.length) { potion[0].click(); return; }
const escape = $('a:contains("逃跑")').first();
if (escape.length) { escape[0].click(); return; }
} else {
const attack = $('a:contains("攻击")').first();
if (attack.length) { attack[0].click(); return; }
}
scheduleAction(DELAY_FIGHT);
} else if (hasDrop) {
const attack = $('a:contains("攻击")').first();
attack.length ? attack[0].click() : scheduleAction(DELAY_HOME);
} else if (isHome) {
const monster = getFirstMonsterLink();
if (monster && monster.length) {
monster[0].click();
} else {
const fallback = $('.content a').filter(function() { return !this.innerText.match(/刷新|返回登录|查看地图|任务|状态|包裹|技能|仓库|聊天|坊市|门派|修炼|好友|宠物|挑战|排行/); }).first();
fallback.length ? fallback[0].click() : scheduleAction(DELAY_HOME);
}
} else if ($('a:contains("返回首页")').length) {
clickReturnHome() || scheduleAction(DELAY_HOME);
} else {
scheduleAction(DELAY_HOME);
}
}
function scheduleAction(delay) {
if (enabled) setTimeout(autoAction, delay);
}
// 启动
$(document).ready(() => {
if (enabled) requestWakeLock();
autoAction();
});
})();
|