// ==UserScript== // @name MVPS // @namespace http://tampermonkey.net/ // @version 0.8 // @description MVPS [Multi Visual Piano Script] designed to expand the technical and visual capabilities of the MPP // @author Hustandant#1917 // @match *://mppclone.com/* // @include *://www.multiplayerpiano.com/* // @include *://multiplayerpiano.com/* // @include *://piano.ourworldofpixels.com/* // @include *://mppfork.netlify.app/* // @match *.mpp.hri7566.info/* // @match *://mpp.autoplayer.xyz/* // @icon https://github.com/Hustoroff/mpp/blob/main/icon.png?raw=true // @resource https://raw.githubusercontent.com/Hustoroff/mpp/main/MVPS.js // @grant none // @run-at document-end // @downloadURL https://update.greasyfork.icu/scripts/459998/MVPS.user.js // @updateURL https://update.greasyfork.icu/scripts/459998/MVPS.meta.js // ==/UserScript== window.addEventListener('load', (event) => { $("#bottom .relative").append(`
MVPS
`); $("#MVPS").css({position: "absolute", left: "1020px", top: "32px"}).on("click", () => { MPP.client.emit("notification", { title: "Multi Visual Piano Script (by Hustandant#1917)", id:"MVPS_notification", duration:-1, target:"#MVPS", html:`

Visual:

Clear chat
Hide names

Load background file:

Drawing:

Clear Drawings
Drawboard hide
Rainbow lines


Other settings:

Rainbow room
Rainbow notes
Rainbow nick
Spin piano

Load image file:
` }); document.getElementById("chtClr").addEventListener("click", () => { chat_clear() }); document.getElementById("nmsHdn").addEventListener("click", () => { names_hide = !names_hide; namesHde() }); document.getElementById("inpBack").addEventListener("input", () => { url_back = document.getElementById("inpBack").value }); document.getElementById("back").addEventListener("click", () => { backg = !backg; background_del(); }); document.getElementById("inpBackimg").addEventListener("input", () => { showpreview1(document.getElementById("inpBackimg")) }); document.getElementById("clearBtn").addEventListener("click", () => { MPP.addons.draw.lines = [[0,0,0,0,0,0,"#0"]] }); document.getElementById("drwbrdHdn").addEventListener("click", () => { drawboard_hide = !drawboard_hide; drawboard_hde() }); document.getElementById("rnbwMd").addEventListener("click", () => { rainbowmodename = !rainbowmodename }); document.getElementById("lineTime").addEventListener("input", () => { MPP.addons.draw.lineLife = document.getElementById("lineTime").value }); document.getElementById("clrBtn").addEventListener("click", () => { MPP.addons.draw.customColor=document.getElementById("clrChng").value }); document.getElementById("lineSize").addEventListener("input", () => { MPP.addons.draw.brushSize = document.getElementById("lineSize").value }); document.getElementById("rnbw").addEventListener("click", () => { rainbowmode = !rainbowmode }); document.getElementById("rnbwNt").addEventListener("click", () => { rainbowmodenote = !rainbowmodenote }); document.getElementById("rnbwNick").addEventListener("click", () => { rainbownick = !rainbownick }); document.getElementById("pnoSpn").addEventListener("click", () => { pianospinbool = !pianospinbool; pianospn() }); document.getElementById("inpImg").addEventListener("input", () => { url_past_img = document.getElementById("inpImg").value }); document.getElementById("pasteImg").addEventListener("click", () => { paste_image(url_past_img) }); document.getElementById("inpPastImg").addEventListener("input", () => { showpreview2(document.getElementById("inpPastImg")) }); var pianospinbool = false, backimg = false, rainbowmodename = false, rainbowmodenote = false, rainbowmode = false, backg = false, piano = true, chat_hide = false, names_hide = false, drawboard_hide = true, rainbownick = false, url_past_img = "https://mpp.terrium.net/meow64.png", url_back = "https://steamuserimages-a.akamaihd.net/ugc/878625026160084538/0399E81B0D1CF96C853CFCC1288D3E0A3D708049/?imw=1024&imh=819&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=true"; //MPP draw image script by Ledlamp [https://gist.github.com/ledlamp/ef0d4db05a49fb795ec59cf96bedbf26] (thx a lot :3) function paste_image(){ function getRandomColor() { var letters = '0123456789ABCDEF'; var color = '#'; for (var i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } return color; } function drawPixel(x, y, color) { MPP.addons.draw.mkline(x-1,y,x,y,10,color) } function componentToHex(c) { var hex = c.toString(16); return hex.length == 1 ? "0" + hex : hex; } function rgbToHex(r, g, b) { return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b); } var img = document.createElement("img"); img.crossOrigin = "Anonymous"; img.addEventListener('load', function(){ console.log(img); var canvas = document.createElement('canvas'); canvas.width = img.width; canvas.height = img.height; var c = canvas.getContext('2d'); c.drawImage(img, 0, 0, img.width, img.height); console.log(canvas); var pos1 = [128-img.width/2,128-img.height/2], pos2 = [128+img.width/2,128+img.height/2]; var ii=0; for (let x = pos1[0], xo = 0; x < pos2[0]; x++, xo++) for (let y = pos1[1], yo = 0; y < pos2[1]; y++, yo++) { setTimeout(()=>{ var rgb = c.getImageData(xo,yo, 1, 1).data; drawPixel(x,y, rgbToHex(rgb[0], rgb[1], rgb[2])); } ,++ii * 10); } }); img.src = url_past_img; }; function showpreview1(e) { var reader = new FileReader(); reader.onload = function (e) { url_back = e.target.result; background_del(); }; reader.readAsDataURL(e.files[0]); } function showpreview2(e) { var reader = new FileReader(); reader.onload = function (e) { url_past_img = e.target.result; }; reader.readAsDataURL(e.files[0]); } // DRAW script by Hri7566 [https://github.com/Hri7566] (thx a lot :3) let authenicated = false; EXT = window.EXT || {_initfunc: []}; setInterval(()=>{ if(Object.entries(MPP.client.ppl).length !== 0 && !authenicated) { MPP.client.sendArray([{m:"+custom"}]); MPP = MPP || {}; MPP.addons = EXT; for(var x = EXT._initfunc.length; x--;) EXT._initfunc[x](); EXT.__proto__ = null; authenicated = true; } }, 100); /* By ming, v3 */ EXT._initfunc.push(function(){ var addon = EXT.draw = {__proto__: null}; addon.lineLife = 25; var p = document.createElement("canvas"); p.id = "drawboard"; p.style = "position: absolute; top: 0; left: 0; z-index: 400; pointer-events: none;"; p.width = window.innerWidth; p.height = window.innerHeight; document.body.appendChild(p); var dbctx = p.getContext("2d"); var shifted = false; var clicking = false; $(document).on('mousedown', (e)=>{ if(e.shiftKey){ clicking = true; draw(); e.preventDefault(); }}); $(document).on('mouseup', (e)=>{ clicking = false; }); $(document).on('keyup keydown', (e)=>{ shifted = e.shiftKey; }); addon.enabled = true; addon.customColor = null; addon.ctx = dbctx; addon.onrefresh = []; addon.brushSize = 8; addon.mutes = []; addon.lines = []; addon.buf = [{n: "ldraw", v: 0}]; function resize(){ p.width = window.innerWidth; p.height = window.innerHeight; } window.addEventListener('resize', resize, false); addon.flushloop = setInterval(()=>{ var t = Date.now(); if(addon.buf.length != 1){ if(addon.buf.length>1) MPP.client.sendArray([{m: "custom", data: {m: 'draw', t: t, n: addon.buf}, target: { mode: 'subscribed' } }]); addon.buf = [{n: "ldraw", v: 0}]; } }, 1000/60/16); addon.onrefresh.push(function(t){ if(addon.lines.length){ dbctx.clearRect(0,0,window.innerWidth, window.innerHeight); for(var l = 0; l> 8; } while (ch); st = st.reverse(); for(var k=0;k255||y>255||x2>255||y2>255)return; var b = new ArrayBuffer(4); var dv = new DataView(b); dv.setUint8(0, x); dv.setUint8(1, y); dv.setUint8(2, x2); dv.setUint8(3, y2); var str = String.fromCharCode.apply(null, new Uint8Array(b)); var clr = color || addon.customColor || MPP.client.getOwnParticipant().color; addon.buf.push({n: str, v: Math.min(s||1, 5), d: parseInt(clr.slice(1), 16)}); parseLine(str, clr, Math.min(s||1, 5)); } addon.tohtml = function(c) { c = c.toString(16); return '#' + ('000000' + c).substring(c.length); }; MPP.client.on('custom', (msg) => { if (msg.data.m !== 'draw') return; if(msg.data.n[0].n == "ldraw" && addon.mutes.indexOf(MPP.client.findParticipantById(msg.data.p)._id) === -1){ msg.data.n.reduce(function(a, b){ if(b.n.length == 4){ var clr = (b.d !== undefined && addon.tohtml(b.d)) || MPP.client.findParticipantById(msg.data.p).color; parseLine(b.n, clr, Math.min(b.v,5)); } }); } }); MPP.client.on('c', ()=>{ addon.lines = [[0,0,0,0,0,0,"#0"]]; }); }); function background_del(){ if(backg) { var d=document.createElement('div'); d.style.width = '1280px'; d.style.height = '913px'; d.style.position = 'absolute'; d.style.top= '0px'; d.style.left= '0px'; d.id='backgdiv' document.body.appendChild(d); $("#backgdiv").css({width: window.innerWidth, height: window.innerHeight, "background-position": "25% 25%", "background-size": "cover", "backdrop-effect": "blur(4px)", "background-image": "url("+url_back+")"}) console.log(url_back) } else $("#backgdiv").remove(); } function chat_clear(){ $('ul').empty() } function namesHde(){ if(names_hide) $("#names").css({opacity: "0"}); else $("#names").css({opacity: "1"}); } function drawboard_hde(){ if(drawboard_hide) $("#drawboard").css({opacity: "1"}); else $("#drawboard").css({opacity: "0"}); } function pianospn(){ $("#piano").toggleClass("spin", pianospinbool) } //Rainbow room mode script var count = 0; var size = 100; var rainbow = new Array(size); for (var i = 0; i < size; i++) { var red = sin_to_hex(i, 0 * Math.PI * 2 / 3); // 0 deg var blue = sin_to_hex(i, 1 * Math.PI * 2 / 3); // 120 deg var green = sin_to_hex(i, 2 * Math.PI * 2 / 3); // 240 deg rainbow[i] = "#" + red + green + blue; } function sin_to_hex(i, phase) { var sin = Math.sin(Math.PI / size * 2 * i + phase); var int = Math.floor(sin * 127) + 128; var hex = int.toString(16); return hex.length === 1 ? "0" + hex : hex; } setInterval(function() { if (count > rainbow.length) count = 0; if(rainbowmodename) MPP.addons.draw.customColor = rainbow[count] if(rainbowmodenote){ id = MPP.client.getOwnParticipant(); id.color = rainbow[count]; } if(rainbownick) $("#namediv-"+MPP.client.getOwnParticipant().id).css({"background-color": rainbow[count]}) count++; }, 33); setInterval(function() { if (rainbowmode && MPP.client.isOwner()) { if (count > rainbow.length) count = 0; MPP.client.sendArray([{ m: "chset", set: { color: rainbow[count] } }]); } count++; }, 500); }); });