// ==UserScript==
// @name Bumpyball.io/Pucks.io Back Boosting(WASD)
// @namespace https://greasyfork.org/en/users/1462379-3lectr0n-nj
// @version V1
// @description Hard to spam the spacebar to backboost? No worries this will fix that problem
// @author 3lectr0N!nj@
// @match https://www.pucks.io/
// @match https://www.bumpyball.io/staging/
// @match https://www.bumpyball.io/
// @icon https://www.google.com/s2/favicons?sz=64&domain=pucks.io
// @grant none
// ==/UserScript==
let bboost
let t = 200
let key = "KeyS"
function Space_down() {
const event = new KeyboardEvent('keydown', { key: ' ', code: 'Space', which: 32, keyCode: 32, bubbles: true, cancelable: true });
document.dispatchEvent(event);
}
function Space_up() {
const event = new KeyboardEvent('keyup', { key: ' ', code: 'Space', which: 32, keyCode: 32, bubbles: true, cancelable: true });
document.dispatchEvent(event);
}
const game = window.game = {
b_boost(){
document.onkeydown = e => {
if (e.code === key) {
if (!bboost) {
bboost = setInterval(() => {
Space_down();
setTimeout(() => {
Space_up();
}, t);
}, t);
}
document.onkeyup = x => {
if (x.code === key) {
clearInterval(bboost);
bboost = null;
}
};
}
}
}
}
WebSocket.prototype._send = WebSocket.prototype.send
WebSocket.prototype.send = function(e){
const data = new Uint8Array(e)
const d =data
if(d[0]==8 && d[1]==1 && d[2]==18){
const encoder = new TextEncoder()
const n = top.player_name.slice(12)
const name = encoder.encode(n)
const join = [8,1,18,name.length+37,10 ,name.length,...name,18,28, 65, 85, 51, 115, 49, 111, 120, 101, 86, 113, 79, 80, 74, 116, 56, 87, 114, 104, 52, 104, 69, 102, 52, 121, 102, 56, 57, 50, 24, 230, 6, 32, 14, 56, 1]
game.ws = this
this._send(new Uint8Array(join))
console.log(join)
}
if(!game.ws)game.ws = this
if(!this.event){
this.event = true
game.b_boost()
}
this._send(data)
if (!game.ws || game.ws.readyState === WebSocket.CLOSED) {
game.ws = this;
this.addEventListener('close', e => {
delete game.ws;
return;
clearInterval(bboost);
bboost = null;
}
);
}
}