// ==UserScript==
// @name MineFun.io 擴充模組選單(含牆透鎖頭)
// @namespace http://tampermonkey.net/
// @version 1.2
// @description 含自動攻擊、自瞄、加速、ESP、飛行、穿牆、無限跳躍、鎖頭、牆透等功能,M鍵切換選單
// @author ChatGPT
// @match *://minefun.io/*
// @grant none
// ==/UserScript==
(function(){
'use strict';
const settings = {
autoAttack: false,
aimbot: false,
speed: 1.0,
blockESP: false,
esp: false,
showHP: false,
autoMining: false,
fly: false,
autoDigging: false,
noclip: false,
invisible: false,
lootESP: false,
infiniteJump: false,
wallhack: false, // 牆透
lockHead: false // 鎖頭
};
// 建立UI
const menu = document.createElement('div');
menu.style = `
position: fixed;
top: 80px;
left: 80px;
background: rgba(0,0,0,0.85);
padding: 15px;
border-radius: 10px;
font-family: monospace;
font-size: 14px;
color: white;
z-index: 9999;
max-width: 360px;
overflow-y: auto;
max-height: 520px;
`;
menu.innerHTML = `
<h3>🧠 MineFun.io 擴充模組</h3>
<label><input type="checkbox" id="autoAttack"> 🔫 自動攻擊</label><br>
<label><input type="checkbox" id="aimbot"> 🎯 自瞄</label><br>
<label><input type="checkbox" id="lockHead"> 🔥 鎖頭</label><br>
<label><input type="checkbox" id="blockESP"> 🟫 方塊ESP</label><br>
<label><input type="checkbox" id="esp"> 👁️ 透視ESP</label><br>
<label><input type="checkbox" id="wallhack"> 🧱 牆透</label><br>
<label><input type="checkbox" id="showHP"> ❤️ 顯示血量</label><br>
<label><input type="checkbox" id="autoMining"> ⛏️ 自動挖礦</label><br>
<label><input type="checkbox" id="autoDigging"> 🔨 自動挖掘</label><br>
<label><input type="checkbox" id="fly"> 🕊️ 飛行</label><br>
<label><input type="checkbox" id="noclip"> 🚪 穿牆</label><br>
<label><input type="checkbox" id="invisible"> 👻 隱形</label><br>
<label><input type="checkbox" id="lootESP"> 🎒 物資ESP</label><br>
<label><input type="checkbox" id="infiniteJump"> 🦘 無限跳躍</label><br>
<label>⚡ 移動速度 <input type="range" id="speedSlider" min="1" max="5" step="0.1" value="1"><span id="speedVal">1.0</span></label><br><br>
<label>📍 一鍵瞬移 X: <input type="number" id="tpX" value="0" style="width:60px;">
Y: <input type="number" id="tpY" value="0" style="width:60px;">
Z: <input type="number" id="tpZ" value="0" style="width:60px;">
<button id="teleportBtn">瞬移</button></label><br>
<small>按 M 鍵 開關選單</small>
`;
document.body.appendChild(menu);
// 綁定事件
['autoAttack','aimbot','lockHead','blockESP','esp','wallhack','showHP','autoMining','autoDigging','fly','noclip','invisible','lootESP','infiniteJump'].forEach(id=>{
document.getElementById(id).addEventListener('change',e=>{
settings[id] = e.target.checked;
});
});
const speedSlider = document.getElementById('speedSlider');
const speedVal = document.getElementById('speedVal');
speedSlider.addEventListener('input', () => {
settings.speed = parseFloat(speedSlider.value);
speedVal.textContent = settings.speed.toFixed(1);
});
document.getElementById('teleportBtn').addEventListener('click', () => {
const x = parseFloat(document.getElementById('tpX').value);
const y = parseFloat(document.getElementById('tpY').value);
const z = parseFloat(document.getElementById('tpZ').value);
const player = window.game?.player;
if(player && player.position && player.position.set){
player.position.set(x,y,z);
alert(`✅ 已瞬移到 (${x}, ${y}, ${z})`);
} else {
alert('⚠️ 無法取得玩家位置');
}
});
// M鍵切換選單
let visible = true;
document.addEventListener('keydown', e => {
if(e.key.toLowerCase() === 'm'){
visible = !visible;
menu.style.display = visible ? 'block' : 'none';
}
});
window.keyState = {};
window.addEventListener('keydown', e => window.keyState[e.key] = true);
window.addEventListener('keyup', e => window.keyState[e.key] = false);
// 判斷兩點距離
function distance3D(a,b){
return Math.sqrt(
(a.x-b.x)**2+(a.y-b.y)**2+(a.z-b.z)**2
);
}
setInterval(()=>{
const game = window.game;
if(!game) return;
const player = game.player;
if(!player) return;
// 加速
if(player.speed !== undefined) player.speed = settings.speed;
// 自瞄 & 鎖頭
if(settings.aimbot || settings.lockHead){
const enemies = game.entities.filter(e=>e.team !== player.team && e.health > 0);
if(enemies.length){
// 找最近敵人
const nearest = enemies.reduce((a,b) => {
return distance3D(player.position, a.position) < distance3D(player.position, b.position) ? a : b;
});
if(settings.lockHead){
// 鎖頭目標位置需加頭部偏移,假設headOffset為向上偏移向量
let headPos = nearest.position.clone();
if(nearest.headOffset) headPos.add(nearest.headOffset);
else headPos.y += 1.5; // 預設頭部往上1.5單位
player.lookAt(headPos);
} else {
player.lookAt(nearest.position);
}
}
}
// 自動攻擊
if(settings.autoAttack){
if(player.attack && player.target && player.target.health > 0){
player.attack(player.target);
} else {
const enemies = game.entities.filter(e=>e.team !== player.team && e.health > 0);
if(enemies.length){
const nearest = enemies.reduce((a,b) => {
return distance3D(player.position, a.position) < distance3D(player.position, b.position) ? a : b;
});
player.target = nearest;
player.attack(nearest);
}
}
}
// 方塊ESP
if(settings.blockESP){
game.blocks.forEach(block=>{
if(!block.__espOutline){
const outline = new THREE.EdgesGeometry(block.mesh.geometry);
const line = new THREE.LineSegments(outline,new THREE.LineBasicMaterial({color:0x00ff00}));
block.mesh.add(line);
block.__espOutline = line;
}
});
} else {
game.blocks.forEach(block=>{
if(block.__espOutline){
block.mesh.remove(block.__espOutline);
block.__espOutline.geometry.dispose();
block.__espOutline.material.dispose();
block.__espOutline = null;
}
});
}
// 透視ESP
if(settings.esp){
game.entities.forEach(e=>{
if(e.team !== player.team && e.mesh){
e.mesh.material.transparent = true;
e.mesh.material.opacity = 0.3;
}
});
} else {
game.entities.forEach(e=>{
if(e.mesh){
e.mesh.material.opacity = 1.0;
e.mesh.material.transparent = false;
}
});
}
// 牆透(Wallhack)
// 透過把敵人mesh的深度測試關閉,讓牆壁不擋住敵人視覺
if(settings.wallhack){
game.entities.forEach(e=>{
if(e.team !== player.team && e.mesh){
e.mesh.material.depthTest = false;
e.mesh.renderOrder = 9999;
}
});
} else {
game.entities.forEach(e=>{
if(e.mesh){
e.mesh.material.depthTest = true;
e.mesh.renderOrder = 0;
}
});
}
// 顯示血量
if(settings.showHP){
game.entities.forEach(enemy=>{
if(enemy.team !== player.team){
if(!enemy.__hpTag && enemy.nameTag){
const hpDiv = document.createElement('div');
hpDiv.textContent = `❤️ ${enemy.health}`;
hpDiv.style = 'color:red; font-size:12px; pointer-events:none; position:absolute;';
enemy.nameTag.appendChild(hpDiv);
enemy.__hpTag = hpDiv;
} else if(enemy.__hpTag){
enemy.__hpTag.textContent = `❤️ ${enemy.health}`;
}
}
});
} else {
game.entities.forEach(enemy=>{
if(enemy.__hpTag){
enemy.__hpTag.remove();
enemy.__hpTag = null;
}
});
}
// 自動挖礦
if(settings.autoMining && player.mine){
const nearbyBlocks = game.blocks.filter(block => player.position.distanceTo(block.position) < 5);
if(nearbyBlocks.length) player.mine(nearbyBlocks[0]);
}
// 自動挖掘
if(settings.autoDigging && player.dig){
const nearbyBlocks = game.blocks.filter(block => player.position.distanceTo(block.position) < 5);
if(nearbyBlocks.length) player.dig(nearbyBlocks[0]);
}
// 飛行
if(settings.fly){
if(player.physics){
player.physics.gravity = 0;
if(window.keyState[' ']) player.position.y += 0.5;
if(window.keyState['Shift']) player.position.y -= 0.5;
}
} else {
if(player.physics) player.physics.gravity = 9.8;
}
// 穿牆
if(settings.noclip){
if(player.collider) player.collider.enabled = false;
} else {
if(player.collider) player.collider.enabled = true;
}
// 隱形
if(settings.invisible){
if(player.mesh) player.mesh.visible = false;
} else {
if(player.mesh) player.mesh.visible = true;
}
// 物資ESP
if(settings.lootESP){
const loots = game.loots || [];
loots.forEach(item=>{
if(item.mesh && !item.__espOutline){
const outline = new THREE.EdgesGeometry(item.mesh.geometry);
const line = new THREE.LineSegments(outline,new THREE.LineBasicMaterial({color:0xffff00}));
item.mesh.add(line);
item.__espOutline = line;
}
});
} else {
const loots = game.loots || [];
loots.forEach(item=>{
if(item.__espOutline){
item.mesh.remove(item.__espOutline);
item.__espOutline.geometry.dispose();
item.__espOutline.material.dispose();
item.__espOutline = null;
}
});
}
// 無限跳躍
if(settings.infiniteJump && window.keyState[' ']){
if(player.velocity) player.velocity.y = 10;
}
}, 50);
})();