Files
pirate-corsaire-server/Packets/EquipmentCapacitiesMaximum.js
T
2026-08-24 22:20:36 +02:00

23 lines
601 B
JavaScript

/*
@Packet name EquiptmentCapacitiesMaximum
@Packet identifier 156
@Description -
@Data pId, cannonSlots, harpoonerSlots, sailSlots, pirateSlots
@Structure -
*/
module.exports = function (data) {
const packetLength = data.length * 2 + 1 + 1;
const buffer = new ArrayBuffer(packetLength);
const view = new DataView(buffer);
view.setUint8(0, 156);
view.setUint8(1, packetLength);
data.forEach((e, i) => {
view.setUint16(2 + i * 2, e);
});
return buffer;
};