放置之刃加速
2026-05-18 辅助脚本3066
太长了,蓝奏云下载https://wwbut.lanzn.com/ikZRt3psfk8f
太长了,蓝奏云下载
https://wwbut.lanzn.com/ikZRt3psfk8f
点个赞吧! (0)
相关文章
文章评论
147 3周前
// ==UserScript==
// @name 放置之刃 Ensis IDLE - 全局加速版
// @namespace https://cerbion.net/ensis-idle/
// @version 2.3
// @description 单一倍率同时加速战斗循环、攻击速度、被动收益(1x~1000x)【100%可用】
// @author 人民当家做主【AI修复版】
// @match https://cerbion.net/ensis-idle/*
// @match https://cerbion.net/ensis-idle/
// @grant none
// @run-at document-start
// ==/UserScript==
(function () {
'use strict';
// ═══════════════════════════════════════════
// 全局配置与状态
// ═══════════════════════════════════════════
const STORAGE_KEY = 'ensis_unified_speed';
const MIN_SPEED = 1;
const MAX_SPEED = 10000;
let globalSpeed = Math.max(
MIN_SPEED,
Math.min(MAX_SPEED, parseFloat(localStorage.getItem(STORAGE_KEY) || '1') || 1)
);
// ═══════════════════════════════════════════
// 1. 时间系统劫持(核心加速逻辑)
// ═══════════════════════════════════════════
const _realNow = performance.now.bind(performance);
let _realBase = _realNow();
let _virtBase = _realBase;
let _currentSpeed = globalSpeed;
function getVirtualTime(realNow) {
return _virtBase + (realNow - _realBase) * _currentSpeed;
}
function updateTimeSpeed(newSpeed) {
const real = _realNow();
_virtBase = getVirtualTime(real);
_realBase = real;
_currentSpeed = newSpeed;
}
// 劫持 performance.now
Object.defineProperty(performance, 'now', {
configurable: true,
writable: true,
value: () => getVirtualTime(_realNow())
});
// 劫持 requestAnimationFrame
const _origRAF = window.requestAnimationFrame.bind(window);
window.requestAnimationFrame = (cb) =>
_origRAF((realTs) => cb(getVirtualTime(realTs)));
// 劫持 Date.now
const _origDateNow = Date.now.bind(Date);
Date.now = () => Math.round(getVirtualTime(_realNow()));
// 劫持 setInterval(战斗循环核心)
let combatIntervalId = null;
let originalCombatDelay = null;
let originalCombatCallback = null;
const _origSetInterval = window.setInterval;
function isCombatCallback(fn, delay) {
if (typeof fn !== 'function') return false;
const fnStr = fn.toString();
return (
(fnStr.includes('O.current.attackSpeed') ||
fnStr.includes('playerAcc') ||
fnStr.includes('enemyAcc')) &&
(delay === 100 || delay === 1000)
);
}
function patchCombatInterval() {
if (combatIntervalId) {
clearInterval(combatIntervalId);
combatIntervalId = null;
}
if (originalCombatCallback && originalCombatDelay) {
const newDelay = Math.max(1, originalCombatDelay / globalSpeed);
combatIntervalId = _origSetInterval(originalCombatCallback, newDelay);
}
}
window.setInterval = (fn, delay, ...args) => {
if (isCombatCallback(fn, delay)) {
originalCombatCallback = fn;
originalCombatDelay = delay;
const newDelay = Math.max(1, delay / globalSpeed);
combatIntervalId = _origSetInterval(fn, newDelay, ...args);
return combatIntervalId;
}
return _origSetInterval(fn, delay, ...args);
};
// 劫持 setTimeout(可选,处理延迟任务)
const _origSetTimeout = window.setTimeout;
window.setTimeout = (fn, delay, ...args) => {
if (delay > 0 && globalSpeed !== 1) {
delay = Math.max(1, delay / globalSpeed);
}
return _origSetTimeout(fn, delay, ...args);
};
// ═══════════════════════════════════════════
// 2. 攻击速度自动缩放(Hook游戏内部状态)
// ═══════════════════════════════════════════
let attackHookActive = false;
function applyAttackSpeedMultiplier(obj) {
if (!obj || typeof obj !== 'object') return obj;
// 武器攻击速度
if (typeof obj.attackSpeed === 'number') {
if (!obj.__origAttackSpeed) obj.__origAttackSpeed = obj.attackSpeed;
obj.attackSpeed = obj.__origAttackSpeed * globalSpeed;
}
// 装备基础攻击速度
if (obj.weapon && typeof obj.weapon.baseAttackSpeed === 'number') {
if (!obj.weapon.__origBaseAttackSpeed)
obj.weapon.__origBaseAttackSpeed = obj.weapon.baseAttackSpeed;
obj.weapon.baseAttackSpeed = obj.weapon.__origBaseAttackSpeed * globalSpeed;
}
return obj;
}
function hookCombatStats() {
if (attackHookActive) return;
if (typeof window.Q === 'undefined') {
console.log('[Ensis加速] 等待游戏加载...');
return;
}
console.log('[Ensis加速] 注入攻击速度Hook');
// Hook 核心状态函数 Gv()
if (typeof window.Gv === 'function' && !window.Gv.__hooked) {
const origGv = window.Gv;
window.Gv = function (e, t, ...args) {
const result = origGv.call(this, e, t, ...args);
if (result?.attackSpeed !== undefined) {
if (!result.__origAttackSpeed)
result.__origAttackSpeed = result.attackSpeed;
result.attackSpeed = result.__origAttackSpeed * globalSpeed;
}
return result;
};
window.Gv.__hooked = true;
}
// Hook Zustand状态管理
if (window.Q?.getState && !window.Q.getState.__hooked) {
const origGetState = window.Q.getState;
window.Q.getState = function () {
const state = origGetState.call(this);
return applyAttackSpeedMultiplier(state);
};
window.Q.getState.__hooked = true;
}
// 定期修复(防止游戏覆盖我们的修改)
setInterval(() => {
try {
const state = window.Q?.getState();
if (state) {
applyAttackSpeedMultiplier(state);
if (state.equipment) applyAttackSpeedMultiplier(state.equipment);
if (state.computed) applyAttackSpeedMultiplier(state.computed);
window.Q?.setState({}); // 触发UI更新
}
} catch (err) {
console.error('[Ensis加速] 状态修复失败:', err);
}
}, 300);
attackHookActive = true;
}
// ═══════════════════════════════════════════
// 3. 速度控制入口
// ═══════════════════════════════════════════
function commitGlobalSpeed(newSpeed) {
newSpeed = Math.max(MIN_SPEED, Math.min(MAX_SPEED, newSpeed));
if (newSpeed === globalSpeed) return;
globalSpeed = newSpeed;
localStorage.setItem(STORAGE_KEY, newSpeed);
updateTimeSpeed(newSpeed);
attackHookActive = false; // 重置Hook状态
hookCombatStats(); // 重新注入攻击速度
patchCombatInterval(); // 重新调整战斗循环间隔
refreshUI(); // 更新界面
}
// ═══════════════════════════════════════════
// 4. 悬浮窗UI(带拖拽、折叠、预设)
// ═══════════════════════════════════════════
let uiPanel = null;
const PRESETS = [1, 2, 5, 10, 20, 50, 100, 1000, 10000];
const CSS = `
#esp-panel{
position:fixed;top:80px;right:20px;z-index:2147483647;width:210px;
background:rgba(12,10,22,.97);border:1px solid rgba(110,70,210,.7);
border-radius:10px;color:#ddd4f4;font-family:'Segoe UI',Arial,sans-serif;
font-size:12px;box-shadow:0 4px 28px rgba(80,30,190,.55);user-select:none;
}
#esp-hdr{
display:flex;align-items:center;gap:5px;padding:8px 10px 7px;
cursor:grab;border-bottom:1px solid rgba(110,70,210,.3);
}
#esp-hdr:active{cursor:grabbing}
#esp-title{
flex:1;font-weight:700;font-size:13px;letter-spacing:.5px;
background:linear-gradient(90deg,#c070ff,#50d0ff);
-webkit-background-clip:text;-webkit-text-fill-color:transparent;
}
#esp-dot{
width:8px;height:8px;border-radius:50%;
background:#444;flex-shrink:0;transition:background .3s,box-shadow .3s;
}
#esp-dot.on{background:#40ffaa;box-shadow:0 0 7px #40ffaa}
#esp-stxt{font-size:10px;color:#666;white-space:nowrap}
#esp-fold{
background:none;border:none;color:#666;cursor:pointer;
font-size:11px;padding:0 2px;line-height:1;
}
#esp-fold:hover{color:#c0a0ff}
#esp-body{
padding:10px 10px 6px;
display:flex;
flex-direction:column;
gap:8px;
}
#esp-panel.fold #esp-body{display:none}
#esp-panel.fold{width:auto;min-width:128px}
.esp-sec-hdr{display:flex;justify-content:space-between;align-items:center;}
.esp-lbl{color:#666;font-size:11px;}
.esp-val{
font-size:22px;font-weight:800;color:#a060e8;
font-variant-numeric:tabular-nums;line-height:1;
}
.esp-slider{width:100%;accent-color:#8040c8;cursor:pointer}
.esp-row{display:flex;gap:5px}
.esp-num{
flex:1;background:rgba(255,255,255,.08);
border:1px solid rgba(110,70,210,.45);border-radius:5px;
color:#ddd4f4;padding:4px 6px;font-size:12px;width:0;
}
.esp-num:focus{outline:1px solid #8040c8;outline-offset:-1px}
.esp-apply{
background:linear-gradient(135deg,#6030b8,#3050c8);border:none;
border-radius:5px;color:#fff;padding:4px 10px;cursor:pointer;
font-size:12px;font-weight:600;white-space:nowrap;
}
.esp-apply:hover{opacity:.82}
.esp-presets{display:flex;flex-wrap:wrap;gap:4px}
.esp-ps{
flex:1;min-width:32px;background:rgba(255,255,255,.07);
border:1px solid rgba(110,70,210,.3);border-radius:4px;
color:#b098e0;padding:3px 2px;cursor:pointer;
font-size:11px;font-weight:600;text-align:center;
}
.esp-ps:hover{background:rgba(110,70,210,.25);border-color:rgba(140,90,245,.7);
color:#b098e0;padding:3px 2px 2px;cursor:pointer;}
.esp-ps.act{background:rgba(110,70,210,.5);border-color:#8040c8;color:#fff}
.esp-desc{font-size:10px;color:#666;text-align:center}
#esp-footer{text-align:center;padding:5px 10px 7px;font-size:9px;color:#444;border-top:1px solid rgba(110,70,210,.15);}
#esp-footer a{color:#666;text-decoration:none;transition:color .2s;}
#esp-footer a:hover{color:#c070ff}
`;
function refreshUI() {
if (!uiPanel) return;
const valEl = uiPanel.querySelector('.esp-val');
const sliderEl = uiPanel.querySelector('.esp-slider');
const inputEl = uiPanel.querySelector('.esp-num');
const dotEl = document.getElementById('esp-dot');
const stxtEl = document.getElementById('esp-stxt');
if (valEl) valEl.textContent = globalSpeed;
if (sliderEl) sliderEl.value = globalSpeed;
if (inputEl) inputEl.value = globalSpeed;
if (dotEl) dotEl.className = globalSpeed > 1 ? 'on' : '';
if (stxtEl) stxtEl.textContent = globalSpeed > 1 ? '加速中' : '正常';
// 更新预设按钮高亮
const presets = uiPanel.querySelectorAll('.esp-ps');
presets.forEach(btn => {
btn.classList.toggle('act', parseInt(btn.dataset.speed) === globalSpeed);
});
}
function buildUI() {
if (document.getElementById('esp-panel')) return;
// 注入样式
const style = document.createElement('style');
style.textContent = CSS;
document.head.appendChild(style);
const panel = document.createElement('div');
panel.id = 'esp-panel';
panel.innerHTML = `
`;
document.body.appendChild(panel);
uiPanel = panel;
// ----- 事件绑定 -----
// 折叠/展开
document.getElementById('esp-fold').addEventListener('click', () => {
panel.classList.toggle('fold');
document.getElementById('esp-fold').textContent =
panel.classList.contains('fold') ? '▶' : '▼';
});
// 滑块控制
const slider = panel.querySelector('.esp-slider');
slider.addEventListener('input', () => {
const val = parseInt(slider.value);
panel.querySelector('.esp-val').textContent = val;
panel.querySelector('.esp-num').value = val;
});
slider.addEventListener('change', () => {
commitGlobalSpeed(parseInt(slider.value));
});
// 数字输入
const applyBtn = panel.querySelector('.esp-apply');
const numInput = panel.querySelector('.esp-num');
applyBtn.addEventListener('click', () => {
const val = parseInt(numInput.value);
if (!isNaN(val)) commitGlobalSpeed(val);
});
numInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
const val = parseInt(numInput.value);
if (!isNaN(val)) commitGlobalSpeed(val);
}
});
// 预设按钮
panel.querySelectorAll('.esp-ps').forEach(btn => {
btn.addEventListener('click', () => {
commitGlobalSpeed(parseInt(btn.dataset.speed));
});
});
// 拖拽移动
let offsetX = 0, offsetY = 0, isDragging = false;
const header = document.getElementById('esp-hdr');
header.addEventListener('mousedown', (e) => {
isDragging = true;
offsetX = e.clientX - panel.getBoundingClientRect().left;
offsetY = e.clientY - panel.getBoundingClientRect().top;
header.style.cursor = 'grabbing';
document.addEventListener('mousemove', onMouseMove);
document.addEventListener('mouseup', onMouseUp);
});
function onMouseMove(e) {
if (!isDragging) return;
panel.style.left = `${e.clientX - offsetX}px`;
panel.style.top = `${e.clientY - offsetY}px`;
panel.style.right = 'auto';
}
function onMouseUp() {
isDragging = false;
header.style.cursor = 'grab';
document.removeEventListener('mousemove', onMouseMove);
document.removeEventListener('mouseup', onMouseUp);
}
}
// ═══════════════════════════════════════════
// 5. 初始化入口
// ═══════════════════════════════════════════
function init() {
// 等待DOM加载完成后初始化UI
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', buildUI);
} else {
buildUI();
}
// 轮询检测游戏核心对象Q,确保Hook时机正确
const checkGameLoaded = setInterval(() => {
if (typeof window.Q !== 'undefined') {
clearInterval(checkGameLoaded);
hookCombatStats(); // 注入攻击速度Hook
patchCombatInterval(); // 调整战斗循环间隔
}
}, 300);
}
init(); // 启动脚本
})();
⚡ 全局加速器
${globalSpeed > 1 ? '加速中' : '正常'}
加速倍率
${globalSpeed}
${PRESETS.map(speed => `
`).join('')}
同时加速战斗循环、攻击速度、被动收益
微信打赏支持
支付宝打赏支持