Bumpyball.io/Pucks.io Decoder

To understand data of messages you send

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/539331/1607205/BumpyballioPucksio%20Decoder.js

  1. // ==UserScript==
  2. // @name Bumpyball.io/Pucks.io Decoder
  3. // @namespace https://gf.qytechs.cn/en/users/1462379-3lectr0n-nj
  4. // @version 1
  5. // @description To understand data of messages you send
  6. // @author 3lectr0N!nj@
  7. // @match https://www.pucks.io/
  8. // @match https://www.bumpyball.io/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=pucks.io
  10. // @grant none
  11. // ==/UserScript==
  12. 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}};
  13. const int7 = window.int7=(arr, start) => {let [value, bytes] = r7bit(arr.slice(start));return [value, start+bytes];};
  14. const f32 =window.f32= (arr, start) => {let value = new Float32Array(new Uint8Array(arr.slice(start, start+4)).buffer)[0];return [value, start+4];};
  15. const w7bit =window.w7bit= num => {let r=[];for(;num>=128;num>>=7)r.push((128|num)%256);return r.push(num%256),r};
  16. let td = new TextDecoder()
  17. let te = new TextEncoder()
  18. const ft32 =window.ft32= (value) =>{const floatArray = new Float32Array([value]);const byteArray = new Uint8Array(floatArray.buffer);return Array.from(byteArray);}
  19. 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"]
  20. let SBytes={Join:1,Chat:5,Move:7,}
  21. let boolean = ["False","True"]
  22. const game = window.game = {
  23. servermsg : {
  24. sent:[],
  25. recv:[],
  26. },
  27. }
  28. function Sdecoder(d){
  29. let json = {};
  30. if(d[1]==SBytes.Join){
  31. json.type = [SBytes.Join,"Join"]
  32. json.header = [...(d.slice(0,3))]
  33. json.car = Cars[0]
  34. d.forEach((value, index) => {
  35. if (value === 10) {
  36. if(d[index-1]>37){
  37. json.name = td.decode(d.slice(index+2,index+2+(d[index+1])))
  38. }
  39. }
  40. if (value === 18) {
  41. if(d[index+1]==28){
  42. json.uid = td.decode(d.slice(index+2,index+2+(d[index+1])))
  43. }
  44. }
  45. if (value === 24) {
  46. json.version =int7(d,index+1)[0]
  47. }
  48. if (value === 32) {
  49. if(d[index+1]<15){
  50. json.car = Cars[d[index+1]]
  51. }
  52. }
  53. if (value === 42){
  54. json.password = td.decode(d.slice(index+2,index+2+(d[index+1])))
  55. }
  56. if (value === 56){
  57. if(d[index+1]==1){
  58. json.auth = d[index+1]
  59. }
  60. }
  61. })
  62. game.servermsg.sent.push(json)
  63. return json
  64. }
  65. if(d[1]==SBytes.Move){
  66. json.type = [SBytes.Move,"Move"]
  67. json.header = [...(d.slice(0,3))]
  68. json.boost = boolean[0]
  69. let m
  70. let e = d.slice(4,4+d[3])
  71. e.forEach((value, index) => {
  72. if(value === 8){
  73. if(e[index+1]==1){
  74. json.boost = boolean[1]
  75. }
  76. }
  77. if(value === 18){
  78. if(e[index+1]==0){
  79. json.move = boolean[0]
  80. }
  81. }
  82. if(value === 13){
  83. json.direction = "front-back"
  84. json.units = f32(e,index+1)[0]
  85. }
  86. if(value === 21){
  87. json.direction = "right-left"
  88. json.units = f32(e,index+1)[0]
  89. }
  90. if(value === 24){
  91. json.pcid = int7(e,index+1)[0]
  92. }
  93. })
  94. game.servermsg.sent.push(json)
  95. return json
  96. }
  97. if(d[1]==SBytes.Chat){
  98. json.type = [SBytes.Chat,"Chat"]
  99. json.header = [...(d.slice(0,3))]
  100. let e = d.slice(4,4+d[3])
  101. e.forEach((value, index) => {
  102. if (value === 8){
  103. json.cid = int7(d,index+1)[0]
  104. }
  105. if (value === 18){
  106. let msg = e.slice(index+2,index+2+e[index+1])
  107. json.message = td.decode(msg)
  108. }
  109. })
  110. game.servermsg.sent.push(json)
  111. return json
  112. }
  113. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址