Files
2026-08-24 22:20:36 +02:00

36 lines
940 B
JavaScript

/*
@Packet name Equipments
@Packet identifier 168
@Description -
@Data pId
@Structure -
*/
module.exports = {
init: length => {
const packetLength = length * 4 + 1 + 1;
const buffer = new ArrayBuffer(packetLength);
const view = new DataView(buffer);
view.setUint8(0, 168);
view.setUint8(1, packetLength);
let i = 0;
return {
update: d => {
const startIndex = i * 4;
view.setUint8(2 + startIndex, d.typeID);
view.setUint8(2 + startIndex + 1, d.id);
view.setUint8(2 + startIndex + 2, d.amount);
view.setUint8(2 + startIndex + 3, d.amountEquipped);
i++;
},
get: () => {
return buffer;
}
};
}
};