Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -22,4 +22,44 @@ export class EstateCovenantReplyPacket implements Packet
|
||||
return (this.Data['EstateName'].length + 1) + 36;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.Data['CovenantID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt32LE(this.Data['CovenantTimestamp'], pos);
|
||||
pos += 4;
|
||||
buf.write(this.Data['EstateName'], pos);
|
||||
pos += this.Data['EstateName'].length;
|
||||
this.Data['EstateOwnerID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjData: {
|
||||
CovenantID: UUID,
|
||||
CovenantTimestamp: number,
|
||||
EstateName: string,
|
||||
EstateOwnerID: UUID
|
||||
} = {
|
||||
CovenantID: UUID.zero(),
|
||||
CovenantTimestamp: 0,
|
||||
EstateName: '',
|
||||
EstateOwnerID: UUID.zero()
|
||||
};
|
||||
newObjData['CovenantID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjData['CovenantTimestamp'] = buf.readUInt32LE(pos);
|
||||
pos += 4;
|
||||
newObjData['EstateName'] = buf.toString('utf8', pos, length);
|
||||
pos += length;
|
||||
newObjData['EstateOwnerID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.Data = newObjData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user