Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -21,4 +21,36 @@ export class InventoryAssetResponsePacket implements Packet
|
||||
return 33;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.QueryData['QueryID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.QueryData['AssetID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt8((this.QueryData['IsReadable']) ? 1 : 0, pos++);
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjQueryData: {
|
||||
QueryID: UUID,
|
||||
AssetID: UUID,
|
||||
IsReadable: boolean
|
||||
} = {
|
||||
QueryID: UUID.zero(),
|
||||
AssetID: UUID.zero(),
|
||||
IsReadable: false
|
||||
};
|
||||
newObjQueryData['QueryID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjQueryData['AssetID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjQueryData['IsReadable'] = (buf.readUInt8(pos++) === 1);
|
||||
this.QueryData = newObjQueryData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user