您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Bot to MPP
当前为
// ==UserScript== // @name Ghost Boy Bot // @namespace https://greasyfork.org/ // @version 1 // @description Bot to MPP // @author Ghosty // @icon https://mpphust.ga/assets/icon%20(48).png // @include *://mppclone.com/* // @include *://multiplayerpiano.com/* // @include *://piano.ourworldofpixels.com/* // @grant none // @license MIT // ==/UserScript== var mass = 1; var gravity = 10; var friction = 1; var pos = {x: 50, y: 50}; var pos2 = {x: 50, y: 50}; var acc = {x: 0, y: 0}; var vel = {x: 0, y: 0}; var follower = ""; var followPos = {x: 50, y: 50}; MPP.client.on("m", function(msg) { var part = MPP.client.findParticipantById(msg.id); if (part._id == MPP.client.user._id) return; followPos.x = +msg.x; followPos.y = +msg.y; }); var updateInt = setInterval(function() { pos2.x = followPos.x; pos2.y = followPos.y; acc.x = ((pos2.x-pos.x) - (friction*vel.x))/mass; acc.y = ((pos2.y-pos.y) - (friction*vel.y) + gravity)/mass; vel.x += acc.x; vel.y += acc.y; pos.x += vel.x; pos.y += vel.y; MPP.client.sendArray([{m: "m", x: MPP.client.getOwnParticipant().x = pos.x, y: MPP.client.getOwnParticipant().y = pos.y}]); }, 15); // Script constants const PRE_MSG = "MPP BOT" + " (v" + "0.5" + "): "; // Connected. window.addEventListener('load', (event) => { // const OnOff = "113"; //F2 const FirstKey = "3"; //3 const SecondKey = "Tab"; //Tab // var notes = 0, nps = 0, fps = 0; async function ping() { let start = Date.now(); try { await fetch(`${window.location.protocol}${MPP.client.uri.slice(4)}`) } catch(err) {} return (Date.now() - start); }; function fpsCount() { fps += 1; requestAnimationFrame(fpsCount) }; requestAnimationFrame(fpsCount); if(!localStorage.getItem("speed")) localStorage.setItem("speed", 60); var noteSpeed = localStorage.getItem("speed"); //default 60 per sec MPP.client.on("a", function(msg) { let message = msg.a.split(" "); if(message[0] == "speed" && msg.p.id == MPP.client.participantId && !isNaN(Number(message[1]))) { noteSpeed = (Number(message[1]) > 1000) ? 1000 : (Number(message[1]) <= 0) ? 1 : Number(message[1]); localStorage.setItem("speed", noteSpeed); document.getElementById("nspd").innerText = noteSpeed; } }); MPP.client.emit("notification", { title: "Update #1 (by Ghosty)", id:"Script_notification", duration:999999, target:"#piano", html:`<p><h3><font id="f2" color="">F2</font> - show/hide notes window</h3></br></p><p><h3><font id="3d" color="">Tab+3</font> - on/off darkly window</h3></br></p><p><h4><font color="white">${noteSpeed}</font> - current speed (<span style="background-color: black"><font color="Sky Blue">to chat "speed" [min - 1 max - 1000]</font></span>)</h4></br></p><p><h5><span style="background-color: Black">Example: "speed 60"</span></h5></br></p> With The Help Of U We Can Do This <a target="_blank" href="` }); const stat = document.createElement("div"); stat.id = "stat_notes"; stat.style.opacity = "1"; stat.style.position = "fixed"; stat.style["z-index"] = 150; stat.style.display = "block"; stat.style.float = "right"; stat.style.margin = "auto"; stat.style.top = `${document.getElementById("piano").height}px`; stat.style["background-color"] = "rgba(137, 137, 137, 0.414)"; stat.style["backdrop-filter"] = "blur(1px)"; stat.style["font-size"] = "21px" stat.innerHTML = `Notes: <span id="notes">0</span> NPS: <span id="nps">0</span> Speed: <span id="nspd">${localStorage.getItem("speed")}</span> NQ: <span id="nquota">${MPP.noteQuota.points}</span> Ping: <span id="ping"></span> FPS: <span id="fps"></span>`; stat.style.marginLeft = `${String(document.getElementById("piano").offsetLeft + document.getElementById("piano").getElementsByTagName("canvas")[0].offsetLeft)}px`; const canvas = document.createElement("canvas"); canvas.height = parseInt(document.getElementById("piano").style["margin-top"]); canvas.width = Math.round(MPP.piano.renderer.width - (MPP.piano.renderer.width - MPP.piano.keys.c7.rect.x2)); canvas.id = "track_of_notes"; canvas.style.opacity = "1"; canvas.style.top = "0"; canvas.style.display = "block"; canvas.style.float = "right"; canvas.style.position = "fixed"; canvas.style.margin = "auto"; canvas.style.marginLeft = `${String(document.getElementById("piano").offsetLeft + document.getElementById("piano").getElementsByTagName("canvas")[0].offsetLeft)}px`; canvas.style["z-index"] = 150; const ctx = window.ctx = canvas.getContext("2d"); const pixel = window.pixel = ctx.createImageData(document.getElementById("piano").querySelector("canvas").width,canvas.height); pixel.data.fill(0); let lastUpdate = 0, onlyevery = 4, counter = 0, prevTime = Date.now(); const noteDB = {}; Object.keys(MPP.piano.keys).forEach(key => noteDB[key] = MPP.piano.keys[key].rect.x); window.redraw = function() { if (lastUpdate <= canvas.height && counter++ % 4 == 0) { const currentTime = Date.now(); const deltaTime = currentTime - prevTime; ctx.globalCompositeOperation = "copy"; ctx.drawImage(ctx.canvas, 0, -Math.ceil(deltaTime * (noteSpeed / 1000))); ctx.globalCompositeOperation = "source-over"; ctx.putImageData(pixel, 0, canvas.height - 1); prevTime = currentTime; if (lastUpdate++ == 0) { pixel.data.fill(); } } requestAnimationFrame(redraw); }; redraw(); redraw(); // redraw(); // redraw(); // window.showNote = function(note, col, ch = 0) { if (note in noteDB) { lastUpdate = 0; const idx = (noteDB[note]) * 4; if(note.split("").includes("s")) { let otS = ((MPP.piano.keys[note].rect.w - Math.round(MPP.piano.renderer.blackBlipWidth))/2)*4; for(let i=0; i<(MPP.piano.renderer.blackBlipWidth)*4; i+=4){ pixel.data[idx + otS + i] = col[0]; pixel.data[idx + otS + i + 1] = col[1]; pixel.data[idx + otS + i + 2] = col[2]; pixel.data[idx + otS + i + 3] = 255; } } else { let ot = (Math.round((MPP.piano.keys[note].rect.w - Math.round(MPP.piano.renderer.whiteBlipWidth))/2))*4; for(let i=0; i<(MPP.piano.renderer.whiteBlipWidth)*4; i+=4){ pixel.data[idx + ot + i] = col[0]; pixel.data[idx + ot + i + 1] = col[1]; pixel.data[idx + ot + i + 2] = col[2]; pixel.data[idx + ot + i + 3] = 255; } } } } document.body.append(canvas); document.body.append(stat); window.addEventListener('resize', resize); function resize() { canvas.width = canvas.width; canvas.height = canvas.height; canvas.style.width = `${canvas.width / window.devicePixelRatio}px`; canvas.style.height = `${canvas.height / window.devicePixelRatio}px`; canvas.style.marginLeft = `${String(document.getElementById("piano").offsetLeft + document.getElementById("piano").getElementsByTagName("canvas")[0].offsetLeft)}px`; }; window.onload = () => { if(!localStorage.getItem("display")) localStorage.setItem("display", document.getElementById("track_of_notes").style.display); if(!localStorage.getItem("theme")) localStorage.setItem("theme", document.getElementById("track_of_notes").style["background-color"]); document.getElementById("track_of_notes").style.display = localStorage.getItem("display"); document.getElementById("track_of_notes").style["background-color"] = localStorage.getItem("theme"); document.getElementById("3d").color = (localStorage.getItem("theme") == "rgb(16, 0, 0)") ? "limegreen" : "firebrick"; document.getElementById("f2").color = (localStorage.getItem("display") == "block") ? "limegreen" : "firebrick"; noteSpeed = (localStorage.getItem("speed")) ? localStorage.getItem("speed") : 60; }; window.addEventListener("keydown", function(key) { if(key.keyCode == OnOff) { document.getElementById("track_of_notes").style.display = (document.getElementById("track_of_notes").style.display == "block") ? "none" : "block"; localStorage.setItem("display", document.getElementById("track_of_notes").style.display); document.getElementById("f2").color = (localStorage.getItem("display") == "block") ? "limegreen" : "firebrick"; return; } }); function runOnKeys(func, ...codes) { let pressed = new Set(); document.addEventListener('keydown', function(event) { pressed.add(event.key); for (let code of codes) if (!pressed.has(code)) return; pressed.clear(); func(); }); document.addEventListener('keyup', function(event) { pressed.delete(event.key) }); }; runOnKeys(() => { document.getElementById("track_of_notes").style["background-color"] = (document.getElementById("track_of_notes").style["background-color"] == "rgb(16, 0, 0)") ? "" : "rgb(16, 0, 0)"; localStorage.setItem("theme", document.getElementById("track_of_notes").style["background-color"]); document.getElementById("3d").color = (localStorage.getItem("theme") == "rgb(16, 0, 0)") ? "limegreen" : "firebrick"; }, FirstKey, SecondKey ); function stats() { document.getElementById("notes").innerText = notes; document.getElementById("nquota").innerText = MPP.noteQuota.points }; function grad(nq, nqmax) { document.getElementById("nquota").style.color = `rgb(255, ${Math.round((nq/nqmax)*255)}, ${Math.round((nq/nqmax)*255)})` }; setInterval(async () => { document.getElementById("nps").innerText = nps; document.getElementById("nquota").innerText = MPP.noteQuota.points; document.getElementById("ping").innerText = await ping(); document.getElementById("fps").innerText = fps; fps = nps = 0; grad(MPP.noteQuota.points, MPP.noteQuota.max); }, 1000); const colcache = Object.create(null); MPP.piano.renderer.__proto__.vis = MPP.piano.renderer.__proto__.visualize; MPP.piano.renderer.__proto__.visualize = function (n, c, ch) { notes += 1; nps += 1; stats(); grad(MPP.noteQuota.points, MPP.noteQuota.max); this.vis(n,c,ch); let co = c in colcache ? colcache[c] : Object.freeze(colcache[c] = [c[1]+c[2], c[3]+c[4], c[5]+c[6]].map(x => parseInt(x, 16))); showNote(n.note, co); }; }); let infoButton = document.createElement("div") infoButton.classList.add("ugly-button") infoButton.id = "client-info-btn" infoButton.style="display: Block;position: relative;top: -64px;left: 1016px;width: fit-content;" infoButton.onclick = () => { MPP.chat.send("Catigories are: About❓, Fun😜, Tools🛠 (Type like this: 13help Then the category)") } infoButton.innerText = "Info" sel("#bottom > div.relative").appendChild(infoButton) function ban(id) {if (!(id == MPP.client.getOwnParticipant()._id)) MPP.client.sendArray([{m: "kickban", _id: id, ms: 30000}]); } var Rec = pp => { if (pp.name.match(/[а-я]/i)) { ban(pp._id)}}; MPP.client.on("participant added", Rec); MPP.client.on("participant update",Rec); MPP.client.on('a', function (m) { if (m.a.match(/[а-я]/i)) ban(m.p._id) }); setInterval(function() {}, 60); // Variables. var error = "Error"; // Error bot command. var adminarray = []; // Function ADMIN command. // Bot client. MPP.client.on("a", function(msg) { var asgr = msg.a.split(' '); var cmd = asgr[0]; var input = msg.a.substring(cmd.legth).trim(); // Commands. if (cmd == "13help") { MPP.chat.send("Catigories are: About❓, Fun😜, Tools🛠 (Type like this: 13help Then the category)") } if (cmd == "13helpabout") { MPP.chat.send("About❓: 13help, 13who/qid") } if (cmd == "13helpfun") { MPP.chat.send("Fun😜: 13buy, 13eat, 13use, 13role, 13hug, 13slap, 13help, 13kill, 13spit, 13brush, 13poo, 13pee") } if (cmd == "13helptools") { MPP.chat.send("Tools🛠: 13about, 13help, 13link, 1̶3̶f̶o̶l̶l̶o̶w̶, 13callghost, 13afk, 13notafk") } if ((adminarray.indexOf(msg.p._id) > - 1) || (msg.p._id == MPP.client.getOwnParticipant()._id)) { // Admin commmand. if (cmd == "13admin") { MPP.chat.send("Admin🔒: 13ban, 13unban, 13check, 13link, 13test") } } if (cmd == "13about") { MPP.chat.send("Bot created Using JavaScript. Still Being Develoved By Ghost Boy") } if (cmd == "13info") { MPP.chat.send("Hi, " + msg.p.name + " Enter 13help to see the list of commands!") } if (cmd == "13who") { MPP.chat.send("Name: " + msg.p.name + " | Your ID: " + msg.p.id + " | The Current Color: " + msg.p.color) } if (cmd == "13callghost") { MPP.chat.send("@b1a52d55fcd7980d17f626e7") } if (cmd == "qid") { MPP.chat.send("Name: " + msg.p.name + " | Your ID: " + msg.p.id + " | The Current Color: " + msg.p.color) } // Admin commands. if ((adminarray.indexOf(msg.p._id) > - 1) || (msg.p._id == MPP.client.getOwnParticipant()._id)) { // Admin command. if (cmd == "13ban") { MPP.client.sendArray([{m: 'kickban', _id: msg.a.substring(5).trim(), ms: 300000}]) } } if ((adminarray.indexOf(msg.p._id) > - 1) || (msg.p._id == MPP.client.getOwnParticipant()._id)) { // Admin command. if (cmd == "13unban") { MPP.client.sendArray([{m: 'unban', _id: msg.a.substring(7).trim()}]) MPP.chat.send("The User Of (msg.p._id) Is Now Unbanned") } } if (cmd == "13check") { MPP.chat.send("DataBase: " + MPP.client.desiredChannelId + "" + MPP.client.ppl) } if (cmd == "13follow"){ MPP.chat.send("Sorry But This Script Is Unavalible") } if (cmd === "13test"){ MPP.chat.send("The script is working!✅") } if (cmd == "Hello") { MPP.chat.send("Hi My Name Is 13Help. I was created by Ghost Boy! Try Saying 13info or 13help to use me.") } if (cmd == "13follow") { MPP.chat.send(msg.p.name + " Now Following: " + msg.a.substring(5).trim() + ".") var updatefollower = "msg.p.name"; } if (cmd == "13link") { MPP.chat.send("Bot Link🤖- Not Found Error 218") } if (msg.a.substring(0,'13ban'.length)=="13ban"){var ms=1000,banvar=msg.a.substring('13ban_'.length,msg.a.length); if (msg.p._id==MPP.client.getOwnParticipant()._id){ MPP.client.sendArray([{m: "kickban", _id: banvar, ms: ms}]);} else {MPP.chat.send(" "+msg.p.name+", you not have a permission to use this command.");}} // Buy... commands. if (cmd == "13slap") { MPP.chat.send(msg.p.name + " Slapped: " + msg.a.substring(5).trim() + ".") } if (cmd == "13poo") { MPP.chat.send(msg.p.name + " Took a GIGANTIC poo ") } if (cmd == "13pee") { MPP.chat.send(msg.p.name + " Took a massive pee ") } if (cmd == "13kill") { MPP.chat.send(msg.p.name + " Killed: " + msg.a.substring(5).trim() + ".") } if (cmd == "13brush") { MPP.chat.send(msg.p.name + " Brushed their hair ") } if (cmd == "13spit") { MPP.chat.send(msg.p.name + " Spat on: " + msg.a.substring(5).trim() + ".") } if (cmd == "13hug") { MPP.chat.send(msg.p.name + " Hugged: " + msg.a.substring(5).trim() + ".") } if (cmd == "13buy") { MPP.chat.send(msg.p.name + " Bought: " + msg.a.substring(5).trim() + ".") } if (cmd == "13eat") { MPP.chat.send(msg.p.name + " Ate: " + msg.a.substring(5).trim() + ".") } if (cmd == "13use") { MPP.chat.send(msg.p.name + " Used: " + msg.a.substring(5).trim() + ".") } if (cmd == "13role") { MPP.chat.send("Your role is: " + "[" + msg.a.substring(6).trim() + "].") } if (cmd == "13afk") { MPP.chat.send(msg.p.name + " Is Now Afk ") } if (cmd == "13notafk") { MPP.chat.send(msg.p.name + " Is Now Not Afk ") } })/* msg.a response END */; /* MPP.client.on('participant added', pp => { MPP.chat.send("Welcome " + pp.name + " to the " + MPP.client.desiredChannelId + "! Type '13about' to info this bot.") }) /* added response end /*; */ console.log("Ghosty's Bot: Online ✅");