25 lines
772 B
JavaScript
25 lines
772 B
JavaScript
/*
|
|
@Packet name HealthChanged
|
|
@Packet identifier 163
|
|
@Description Sends information about health modification (increase, decrease)
|
|
@Data pId
|
|
@Structure -
|
|
*/
|
|
|
|
module.exports = function (data) {
|
|
const packetLength = 17 + 1;
|
|
const buffer = new ArrayBuffer(packetLength);
|
|
const view = new DataView(buffer);
|
|
|
|
view.setUint8(0, 163);
|
|
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.amount);
|
|
view.setUint8(16, data.type);
|
|
view.setUint8(17, data.isCritical);
|
|
|
|
return buffer;
|
|
}; |