Advertisement
demoss

FUNC

Feb 9th, 2023
741
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 3.53 KB | Software | 0 0
  1. var b = new Set(Buffer.from("1B", "hex"))
  2. const arr = []
  3. for (let i = 0; i < msg.payload.length; i++) {
  4.     if (b.has(msg.payload[i])) {      
  5.         arr.push(msg.payload[i + 1] - 0x80)
  6.         i++
  7.     }
  8.     else arr.push(msg.payload[i])
  9. }
  10.     for (let i = 0; i < arr.length / 16; i++) {
  11.         let out = []
  12.         out=(arr.slice(i * 16, (i + 1) * 16))
  13. if (out[9] == 7 && out[7] == 4){
  14. var vol = Buffer.alloc(3)
  15. vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  16.     global.set('z1_vol',vol)
  17. }
  18. else if (out[9] == 6 && out[7] == 4) {
  19.     var vol = Buffer.alloc(3)
  20.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  21.     global.set('z2_vol', vol)
  22. }
  23. else if (out[9] == 5 && out[7] == 4) {
  24.     var vol = Buffer.alloc(3)
  25.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  26.     global.set('z3_vol', vol)
  27. }
  28. else if (out[9] == 4 && out[7] == 4) {
  29.     var vol = Buffer.alloc(3)
  30.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  31.     global.set('z4_vol', vol)
  32. }
  33. else if (out[9] == 8 && out[7] == 4) {
  34.     var vol = Buffer.alloc(3)
  35.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  36.     global.set('z5_vol', vol)
  37. }
  38. else if (out[9] == 10 && out[7] == 4) {
  39.     var vol = Buffer.alloc(3)
  40.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  41.     global.set('z6_vol', vol)
  42. }
  43. else if (out[9] == 15 && out[7] == 4) {
  44.     var vol = Buffer.alloc(3)
  45.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  46.     global.set('z7_vol', vol)
  47. }
  48. else if (out[9] == 17 && out[7] == 4) {
  49.     var vol = Buffer.alloc(3)
  50.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  51.     global.set('z8_vol', vol)
  52. }
  53. else if (out[9] == 18 && out[7] == 4) {
  54.     var vol = Buffer.alloc(3)
  55.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  56.     global.set('z9_vol', vol)
  57. }
  58. else if (out[9] == 12 && out[7] == 4) {
  59.     var vol = Buffer.alloc(3)
  60.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  61.     global.set('z10_vol', vol)
  62. }
  63. else if (out[9] == 13 && out[7] == 4) {
  64.     var vol = Buffer.alloc(3)
  65.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  66.     global.set('z11_vol', vol)
  67. }
  68. else if (out[9] == 14 && out[7] == 4) {
  69.     var vol = Buffer.alloc(3)
  70.     vol.write(Math.round(Buffer.from(out).subarray(-6, -2).readInt32BE() / 65536).toString())
  71.     global.set('z12_vol', vol)
  72. }
  73. else if (out[9] == 39 && out[7] == 4) { global.set('z1m', out[13]) }
  74. else if (out[9] == 38 && out[7] == 4) { global.set('z2m', out[13]) }
  75. else if (out[9] == 37 && out[7] == 4) { global.set('z3m', out[13]) }
  76. else if (out[9] == 36 && out[7] == 4) { global.set('z4m', out[13]) }
  77. else if (out[9] == 40 && out[7] == 4) { global.set('z5m', out[13]) }
  78. else if (out[9] == 42 && out[7] == 4) { global.set('z6m', out[13]) }
  79. else if (out[9] == 48 && out[7] == 4) { global.set('z7m', out[13]) }
  80. else if (out[9] == 49 && out[7] == 4) { global.set('z8m', out[13]) }
  81. else if (out[9] == 50 && out[7] == 4) { global.set('z9m', out[13]) }
  82. else if (out[9] == 44 && out[7] == 4) { global.set('z10m', out[13]) }
  83. else if (out[9] == 45 && out[7] == 4) { global.set('z11m', out[13]) }
  84. else if (out[9] == 46 && out[7] == 4) { global.set('z12m', out[13]) }
  85.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement