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

25 lines
822 B
JavaScript

/*
@Packet name Attacking
@Packet identifier 140
@Description Sends the attack's data to the nearby players
@Data pId, authorTypeId, authorId, targetTypeId, targetId, damage, critical
@Structure -
*/
module.exports = function (data) {
const packetLength = 17 + 1;
const buffer = new ArrayBuffer(packetLength);
const view = new DataView(buffer);
view.setUint8(0, 140);
view.setUint8(1, packetLength);
view.setUint8(2, data.authorTypeID);
view.setUint32(3, data.authorID);
view.setUint8(7, data.targetTypeID);
view.setUint32(8, data.targetID);
view.setUint32(12, data.damage);
view.setUint8(16, +data.critical);
view.setUint8(17, data.entityTypeID);
return buffer;
};