Bumpyball.io/Pucks.io Decoder

To understand data of messages you send

Fra og med 13.06.2025. Se den nyeste version.

Dette script bør ikke installeres direkte. Det er et bibliotek, som andre scripts kan inkludere med metadirektivet // @require https://update.greasyforks.org/scripts/539331/1607201/BumpyballioPucksio%20Decoder.js

// ==UserScript==
// @name         Bumpyball.io/Pucks.io Decoder
// @namespace    https://greasyforks.org/en/users/1462379-3lectr0n-nj
// @version      1
// @description  To understand data of messages you send
// @author       3lectr0N!nj@
// @match        https://www.pucks.io/
// @match        https://www.bumpyball.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=pucks.io
// @grant        none
// ==/UserScript==
const r7bit =window.r7bit = arr => {let r=0,e=0;for(;35!=e;){let f=arr[e/7];if(r|=(127&f)<<e,0==(128&f))return[r,e/7+1];e+=7}};
const int7 = window.int7=(arr, start) => {let [value, bytes] = r7bit(arr.slice(start));return [value, start+bytes];};
const f32 =window.f32= (arr, start) => {let value = new Float32Array(new Uint8Array(arr.slice(start, start+4)).buffer)[0];return [value, start+4];};
const w7bit =window.w7bit= num => {let r=[];for(;num>=128;num>>=7)r.push((128|num)%256);return r.push(num%256),r};
let td = new TextDecoder()
let te = new TextEncoder()
const ft32 =window.ft32= (value) =>{const floatArray = new Float32Array([value]);const byteArray = new Uint8Array(floatArray.buffer);return Array.from(byteArray);}
let Cars =["Standard","Cruiser","Tricked Out","Bugged Out","Taxi Cab","Hot Rod","Drag Racer","Classic","Soccer Van","Cement Mixer","Apocalypse","Dump Truck","Steam Roller","Pusher","Box Car"]
let SBytes={Join:1,Chat:5,Move:7,}
let boolean = ["False","True"]
const game = window.game = {
    servermsg : {
         sent:[],
        recv:[],
},
    }
function Sdecoder(d){
    let json = {};
    if(d[1]==SBytes.Join){
        json.type = [SBytes.Join,"Join"]
        json.header = [...(d.slice(0,3))]
        json.car = Cars[0]
        d.forEach((value, index) => {
            if (value === 10) {
                if(d[index-1]>37){
            json.name = td.decode(d.slice(index+2,index+2+(d[index+1])))
            }
            }
            if (value === 18) {
            if(d[index+1]==28){
            json.uid = td.decode(d.slice(index+2,index+2+(d[index+1])))
            }
            }
            if (value === 24) {
            json.version =int7(d,index+1)[0]
            }
            if (value === 32) {
                if(d[index+1]<15){
               json.car = Cars[d[index+1]]
                }
            }
            if (value === 42){
                json.password = td.decode(d.slice(index+2,index+2+(d[index+1])))
            }
            if (value === 56){
                if(d[index+1]==1){
            json.auth = d[index+1]
            }
            }
        })
        game.servermsg.sent.push(json)
        return json
    }
    if(d[1]==SBytes.Move){
        json.type = [SBytes.Move,"Move"]
        json.header = [...(d.slice(0,3))]
        json.boost = boolean[0]
        let m
        let e = d.slice(4,4+d[3])
        e.forEach((value, index) => {
            if(value === 8){
            if(e[index+1]==1){
            json.boost = boolean[1]
            }
            }
            if(value === 18){
            if(e[index+1]==0){
            json.move = boolean[0]
            }
            }
            if(value === 13){
            json.direction = "front-back"
             json.units = f32(e,index+1)[0]
            }
            if(value === 21){
             json.direction = "right-left"
             json.units = f32(e,index+1)[0]
            }
            if(value === 24){
            json.pcid = int7(e,index+1)[0]
            }
        })
        game.servermsg.sent.push(json)
        return json
    }
    if(d[1]==SBytes.Chat){
        json.type = [SBytes.Chat,"Chat"]
        json.header = [...(d.slice(0,3))]
        let e = d.slice(4,4+d[3])
        e.forEach((value, index) => {
            if (value === 8){
            json.cid = int7(d,index+1)[0]
            }
            if (value === 18){
            let msg = e.slice(index+2,index+2+e[index+1])
            json.message = td.decode(msg)
            }
        })
        game.servermsg.sent.push(json)
        return json
    }
}
长期地址
遇到问题?请前往 GitHub 提 Issues。