Initial commit
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
@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;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user