Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mu-online-js/mu-packet-manager

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mu-online-js/mu-packet-manager - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

196

index.js

@@ -82,38 +82,38 @@ /**

switch (type) {
case 'byte':
objectToStore[key] = this.buf.readUInt8(this.currentOffset);
case 'byte':
objectToStore[key] = this.buf.readUInt8(this.currentOffset);
this.currentOffset++;
break;
case 'arrayPadding':
objectToStore[key] = 0xC1;
this.currentOffset++;
break;
case 'word':
if (this.lastType !== 'word') {
this.currentOffset++;
break;
case 'arrayPadding':
objectToStore[key] = 0xC1;
this.currentOffset++;
break;
case 'word':
if (this.lastType !== 'word') {
this.currentOffset++;
}
objectToStore[key] = this.buf.readUInt16LE(this.currentOffset);
this.currentOffset += 2;
break;
case 'wordBE':
objectToStore[key] = this.buf.readUInt16BE(this.currentOffset);
this.currentOffset += 2;
break;
case 'wordLE':
objectToStore[key] = this.buf.readUInt16LE(this.currentOffset);
this.currentOffset += 2;
break;
case 'shortBE':
case 'short':
objectToStore[key] = this.buf.readUInt16BE(this.currentOffset);
this.currentOffset++;
break;
case 'shortLE':
objectToStore[key] = this.buf.readUInt16LE(this.currentOffset);
this.currentOffset++;
break;
case 'dword':
objectToStore[key] = this.buf.readUInt32LE(this.currentOffset);
this.currentOffset += 4;
break;
}
objectToStore[key] = this.buf.readUInt16LE(this.currentOffset);
this.currentOffset += 2;
break;
case 'wordBE':
objectToStore[key] = this.buf.readUInt16BE(this.currentOffset);
this.currentOffset += 2;
break;
case 'wordLE':
objectToStore[key] = this.buf.readUInt16LE(this.currentOffset);
this.currentOffset += 2;
break;
case 'shortBE':
case 'short':
objectToStore[key] = this.buf.readUInt16BE(this.currentOffset);
this.currentOffset++;
break;
case 'shortLE':
objectToStore[key] = this.buf.readUInt16LE(this.currentOffset);
this.currentOffset++;
break;
case 'dword':
objectToStore[key] = this.buf.readUInt32LE(this.currentOffset);
this.currentOffset += 4;
break;
}

@@ -129,3 +129,3 @@

this.lastType = type;
}
};

@@ -174,39 +174,39 @@ /**

switch (type) {
case 'byte':
this.buf.writeUInt8(value, this.currentOffset);
case 'byte':
this.buf.writeUInt8(value, this.currentOffset);
this.currentOffset++;
break;
case 'arrayPadding':
this.buf.writeUInt8(0xC1, this.currentOffset);
this.currentOffset++;
break;
case 'word':
if (this.lastType !== 'word') {
this.buf.writeUInt8(0xCC, this.currentOffset);
this.currentOffset++;
break;
case 'arrayPadding':
this.buf.writeUInt8(0xC1, this.currentOffset);
this.currentOffset++;
break;
case 'word':
if (this.lastType !== 'word') {
this.buf.writeUInt8(0xCC, this.currentOffset);
this.currentOffset++;
}
this.buf.writeUInt16LE(value, this.currentOffset);
this.currentOffset += 2;
break;
case 'wordLE':
this.buf.writeUIntLE(value, this.currentOffset, 2);
this.currentOffset += 2;
break;
case 'wordBE':
this.buf.writeUIntBE(value, this.currentOffset, 2);
this.currentOffset += 2;
break;
case 'shortBE':
case 'short':
this.buf.writeUInt16BE(value, this.currentOffset);
this.currentOffset += 2;
break;
case 'shortLE':
this.buf.writeUInt16LE(value, this.currentOffset);
this.currentOffset += 2;
break;
case 'dword':
this.buf.writeUInt32LE(value, this.currentOffset);
this.currentOffset += 4;
break;
}
this.buf.writeUInt16LE(value, this.currentOffset);
this.currentOffset += 2;
break;
case 'wordLE':
this.buf.writeUIntLE(value, this.currentOffset, 2);
this.currentOffset += 2;
break;
case 'wordBE':
this.buf.writeUIntBE(value, this.currentOffset, 2);
this.currentOffset += 2;
break;
case 'shortBE':
case 'short':
this.buf.writeUInt16BE(value, this.currentOffset);
this.currentOffset += 2;
break;
case 'shortLE':
this.buf.writeUInt16LE(value, this.currentOffset);
this.currentOffset += 2;
break;
case 'dword':
this.buf.writeUInt32LE(value, this.currentOffset);
this.currentOffset += 4;
break;
}

@@ -239,5 +239,5 @@ // Handle chars.

if (Array.isArray(obj[key])) {
for (let i = 0; i < obj[key].length; i++) {
size += this.calculateBufferSize(type, obj);
}
for (let i = 0; i < obj[key].length; i++) {
size += this.calculateBufferSize(type, obj);
}
}

@@ -250,24 +250,24 @@ else {

switch (type) {
case 'byte':
case 'arrayPadding':
size += 1;
break;
case 'word':
if (this.lastType !== 'word') {
size++;
}
size += 2;
break;
case 'wordLE':
case 'wordBE':
size += 2;
break;
case 'short':
case 'shortBE':
case 'shortLE':
size += 2;
break;
case 'dword':
size += 4;
break;
case 'byte':
case 'arrayPadding':
size += 1;
break;
case 'word':
if (this.lastType !== 'word') {
size++;
}
size += 2;
break;
case 'wordLE':
case 'wordBE':
size += 2;
break;
case 'short':
case 'shortBE':
case 'shortLE':
size += 2;
break;
case 'dword':
size += 4;
break;
}

@@ -285,3 +285,3 @@ // Handle chars.

return size;
}
};

@@ -288,0 +288,0 @@ /**

{
"name": "@mu-online-js/mu-packet-manager",
"version": "0.0.6",
"version": "0.0.7",
"description": "It allows you to define packet structures in a single place and easily convert between buffer and object representations of these structures.",

@@ -20,3 +20,4 @@ "main": "index.js",

"Network Protocols"
]
],
"devDependencies": {}
}

@@ -0,0 +0,0 @@ # mu-online-js packet manager

@@ -19,3 +19,3 @@ /**

}
}
};

@@ -33,3 +33,3 @@ /**

}
}
};

@@ -47,3 +47,3 @@ /**

}
}
};

@@ -102,3 +102,3 @@ /**

serverId: 'shortLE'
}
};

@@ -113,3 +113,3 @@ /**

serverPort: 'wordLE',
}
};

@@ -126,3 +126,3 @@ /**

serverCode: 'wordLE'
}
};

@@ -137,3 +137,3 @@ /**

maxUserCount: 'word',
}
};

@@ -150,3 +150,3 @@ /**

ipAddress: 'char(16)',
}
};

@@ -167,3 +167,3 @@ /**

lock: 'dword',
}
};

@@ -170,0 +170,0 @@ const structures = {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc