Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// outPacket.writeUInt32(this.userId)
// should always be 0xFFFFFFFF for a full update
outPacket.writeUInt32(0xFFFFFFFF) // flags
// flag & 0x1
outPacket.writeUInt64(new Uint64LE(0x2241158F)) // unk00, nexon id?
// end flag & 0x1
// flag & 0x2
outPacket.writeString(new PacketString(user.playerName)) // userName
// end of flag & 0x2
// flag & 0x4
outPacket.writeUInt16(user.level) // level
// end of flag & 0x4
// flag & 0x8
outPacket.writeUInt64(new Uint64LE(user.curExp)) // curExp
outPacket.writeUInt64(new Uint64LE(user.maxExp)) // maxExp
outPacket.writeUInt32(0x313) // unk03
// end of flag & 0x8
// flag & 0x10
outPacket.writeUInt8(user.rank) // rank
outPacket.writeUInt8(0) // unk05
// end of flag & 0x10
// flag & 0x20
outPacket.writeUInt64(new Uint64LE(0x7AF3)) // unk06
// end of flag & 0x20
// flag & 0x40
outPacket.writeUInt32(10) // unk07
outPacket.writeUInt32(user.wins) // wins
outPacket.writeUInt32(user.kills) // kills
outPacket.writeUInt32(80) // unk10
outPacket.writeUInt32(user.deaths) // deaths
// should always be 0xFFFFFFFF for a full update
outPacket.writeUInt32(0xFFFFFFFF) // flags
// flag & 0x1
outPacket.writeUInt64(new Uint64LE(0x2241158F)) // unk00, nexon id?
// end flag & 0x1
// flag & 0x2
outPacket.writeString(new PacketString(user.playerName)) // userName
// end of flag & 0x2
// flag & 0x4
outPacket.writeUInt16(user.level) // level
// end of flag & 0x4
// flag & 0x8
outPacket.writeUInt64(new Uint64LE(user.curExp)) // curExp
outPacket.writeUInt64(new Uint64LE(user.maxExp)) // maxExp
outPacket.writeUInt32(0x313) // unk03
// end of flag & 0x8
// flag & 0x10
outPacket.writeUInt8(user.rank) // rank
outPacket.writeUInt8(0) // unk05
// end of flag & 0x10
// flag & 0x20
outPacket.writeUInt64(new Uint64LE(0x7AF3)) // unk06
// end of flag & 0x20
// flag & 0x40
outPacket.writeUInt32(10) // unk07
outPacket.writeUInt32(user.wins) // wins
outPacket.writeUInt32(user.kills) // kills
outPacket.writeUInt32(80) // unk10
outPacket.writeUInt32(user.deaths) // deaths
outPacket.writeUInt32(user.assists) // assists
function buildHeader(type, sector) {
const u8 = new Uint8Array(16);
const view = new DataView(u8.buffer);
view.setUint32(0, type, true);
view.setUint32(4, 0, true); // priority: low
u8.set((new Uint64LE(sector)).toArray(), 8);
return u8;
}
public static build(outPacket: OutPacketBase): void {
outPacket.writeUInt8(0) // unk00
outPacket.writeUInt8(0) // unk01
outPacket.writeUInt8(0) // unk02
outPacket.writeUInt64(new Uint64LE(0)) // unk03
outPacket.writeUInt64(new Uint64LE(0)) // unk04
outPacket.writeUInt8(0) // unk05
outPacket.writeString(new PacketString(null)) // unk06
outPacket.writeString(new PacketString(null)) // unk07
outPacket.writeUInt8(0) // unk08
outPacket.writeUInt8(0) // unk09
}
}
outPacket.writeUInt16(this.room.settings.startMoney) // startMoney
// end flags & 0x20000
// flags & 0x40000
outPacket.writeUInt8(0) // unk26
// end flags & 0x40000
// flags & 0x80000
outPacket.writeUInt8(0) // unk27
// end flags & 0x80000
// flags & 0x100000
outPacket.writeUInt8(0) // unk28
// end flags & 0x100000
// flags & 0x200000
outPacket.writeUInt8(1) // unk29
// end flags & 0x200000
// flags & 0x400000
outPacket.writeUInt64(new Uint64LE(0x5AF6F7BF)) // unk30
// end flags & 0x400000
// flags & 0x800000
outPacket.writeUInt8(this.room.settings.winLimit) // winLimit
outPacket.writeUInt16(this.room.settings.killLimit) // killLimit
outPacket.writeUInt8(this.room.settings.forceCamera) // forceCamera
// end flags & 0x800000
// flags & 0x1000000
outPacket.writeUInt8(4) // unk31
// end flags & 0x1000000
// flags & 0x2000000
outPacket.writeUInt8(0) // unk35
// end flags & 0x2000000
// flags & 0x4000000
outPacket.writeUInt8(this.room.settings.nextMapEnabled) // nextMapEnabled
// end flags & 0x4000000
// flags & 0x8000000
public static async build(room: Room, outPacket: OutPacketBase): Promise {
outPacket.writeUInt32(room.host.userId) // roomHostId
outPacket.writeUInt8(2) // unk01
outPacket.writeUInt8(2) // unk02
outPacket.writeUInt16(room.id) // roomId
outPacket.writeUInt8(5) // unk04
// special class start?
// flags & 0x1
outPacket.writeUInt64(new Uint64LE('FFFFFFFFFFFFFFFF', 16)) // roomFlags
outPacket.writeString(new PacketString(room.settings.roomName)) // roomName
// end of flags & 0x1
// flags & 0x2
outPacket.writeUInt8(0) // unk05
// end of flags & 0x2
// flags & 0x4
outPacket.writeUInt8(0) // unk06
outPacket.writeUInt32(0) // unk07
outPacket.writeUInt32(0) // unk08
// end of flags & 0x4
// flags & 0x8
outPacket.writeString(new PacketString(null)) // unk09
// end of flags & 0x8
// flags & 0x10
outPacket.writeUInt16(0) // unk10
// end of flags & 0x10
dataView.getFloat64(position, true),
dataView.getFloat64(position+8, true),
]);
position += 16;
this.max_min.push([
dataView.getFloat64(position, true),
dataView.getFloat64(position+8, true),
]);
position += 16;
this.max_min.push([
dataView.getFloat64(position, true),
dataView.getFloat64(position+8, true),
]);
position += 16;
if (this.version.minor == 4) {
this.start_waveform_packet_record = new Uint64LE(buffer.slice(position, position+8));
position +=8;
this.variable_length_records = {};
this.variable_length_records.start =new Uint64LE(buffer.slice(position, position+8));
position +=8;
this.variable_length_records.number = dataView.getUint32(position, true);
position += 4;
this.points = {
number_of_points : new Uint64LE(buffer.slice(position, position+8)),
points_x_return : []
};
position += 8;
for (let i = 0; i < 15; i++) {
this.points.points_x_return.push(new Uint64LE(buffer.slice(position, position+8)));
position += 8;
}
}
position += 16;
this.max_min.push([
dataView.getFloat64(position, true),
dataView.getFloat64(position+8, true),
]);
position += 16;
this.max_min.push([
dataView.getFloat64(position, true),
dataView.getFloat64(position+8, true),
]);
position += 16;
if (this.version.minor == 4) {
this.start_waveform_packet_record = new Uint64LE(buffer.slice(position, position+8));
position +=8;
this.variable_length_records = {};
this.variable_length_records.start =new Uint64LE(buffer.slice(position, position+8));
position +=8;
this.variable_length_records.number = dataView.getUint32(position, true);
position += 4;
this.points = {
number_of_points : new Uint64LE(buffer.slice(position, position+8)),
points_x_return : []
};
position += 8;
for (let i = 0; i < 15; i++) {
this.points.points_x_return.push(new Uint64LE(buffer.slice(position, position+8)));
position += 8;
}
}
}
public static uint64ToByte(source:BigNumber): Uint8Array {
const u64 = new Uint64LE(source.toString())
const buffer = u64.toArrayBuffer()
return new Uint8Array(buffer)
}
}
create_acrastruct: function(data, acra_public_key, context){
var data_buffer = Buffer.isBuffer(data)?data:(new Buffer(data));
var context_buffer = Buffer.isBuffer(context)?context:(new Buffer(context));
var random_keypair = new themis.KeyPair();
var sm = new themis.SecureMessage(random_keypair.private(), acra_public_key);
var random_key = crypto.randomBytes(32);
var wrapped_random_key = sm.encrypt(random_key);
var sc = new themis.SecureCellSeal(random_key);
crypto.randomFillSync(random_key);
var encrypted_data = context?sc.encrypt(data_buffer, context_buffer):sc.encrypt(data_buffer);
var begin_tag = new Buffer([34,34,34,34,34,34,34,34]);
var encrypted_data_length = new int64(encrypted_data.length).toBuffer();
return Buffer.concat([begin_tag, random_keypair.public(), wrapped_random_key, encrypted_data_length, encrypted_data]);
}