Latest packet handling, parsing, enums, generators, etc..
This commit is contained in:
@@ -35,4 +35,102 @@ export class UserReportPacket implements Packet
|
||||
return (this.ReportData['AbuseRegionName'].length + 1 + this.ReportData['Summary'].length + 1 + this.ReportData['Details'].length + 2 + this.ReportData['VersionString'].length + 1) + 111;
|
||||
}
|
||||
|
||||
writeToBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
this.AgentData['AgentID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData['SessionID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.writeUInt8(this.ReportData['ReportType'], pos++);
|
||||
buf.writeUInt8(this.ReportData['Category'], pos++);
|
||||
this.ReportData['Position'].writeToBuffer(buf, pos, false);
|
||||
pos += 12;
|
||||
buf.writeUInt8(this.ReportData['CheckFlags'], pos++);
|
||||
this.ReportData['ScreenshotID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.ReportData['ObjectID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
this.ReportData['AbuserID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.write(this.ReportData['AbuseRegionName'], pos);
|
||||
pos += this.ReportData['AbuseRegionName'].length;
|
||||
this.ReportData['AbuseRegionID'].writeToBuffer(buf, pos);
|
||||
pos += 16;
|
||||
buf.write(this.ReportData['Summary'], pos);
|
||||
pos += this.ReportData['Summary'].length;
|
||||
buf.write(this.ReportData['Details'], pos);
|
||||
pos += this.ReportData['Details'].length;
|
||||
buf.write(this.ReportData['VersionString'], pos);
|
||||
pos += this.ReportData['VersionString'].length;
|
||||
return pos - startPos;
|
||||
}
|
||||
|
||||
readFromBuffer(buf: Buffer, pos: number): number
|
||||
{
|
||||
const startPos = pos;
|
||||
const newObjAgentData: {
|
||||
AgentID: UUID,
|
||||
SessionID: UUID
|
||||
} = {
|
||||
AgentID: UUID.zero(),
|
||||
SessionID: UUID.zero()
|
||||
};
|
||||
newObjAgentData['AgentID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjAgentData['SessionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
this.AgentData = newObjAgentData;
|
||||
const newObjReportData: {
|
||||
ReportType: number,
|
||||
Category: number,
|
||||
Position: Vector3,
|
||||
CheckFlags: number,
|
||||
ScreenshotID: UUID,
|
||||
ObjectID: UUID,
|
||||
AbuserID: UUID,
|
||||
AbuseRegionName: string,
|
||||
AbuseRegionID: UUID,
|
||||
Summary: string,
|
||||
Details: string,
|
||||
VersionString: string
|
||||
} = {
|
||||
ReportType: 0,
|
||||
Category: 0,
|
||||
Position: Vector3.getZero(),
|
||||
CheckFlags: 0,
|
||||
ScreenshotID: UUID.zero(),
|
||||
ObjectID: UUID.zero(),
|
||||
AbuserID: UUID.zero(),
|
||||
AbuseRegionName: '',
|
||||
AbuseRegionID: UUID.zero(),
|
||||
Summary: '',
|
||||
Details: '',
|
||||
VersionString: ''
|
||||
};
|
||||
newObjReportData['ReportType'] = buf.readUInt8(pos++);
|
||||
newObjReportData['Category'] = buf.readUInt8(pos++);
|
||||
newObjReportData['Position'] = new Vector3(buf, pos, false);
|
||||
pos += 12;
|
||||
newObjReportData['CheckFlags'] = buf.readUInt8(pos++);
|
||||
newObjReportData['ScreenshotID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjReportData['ObjectID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjReportData['AbuserID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjReportData['AbuseRegionName'] = buf.toString('utf8', pos, length);
|
||||
pos += length;
|
||||
newObjReportData['AbuseRegionID'] = new UUID(buf, pos);
|
||||
pos += 16;
|
||||
newObjReportData['Summary'] = buf.toString('utf8', pos, length);
|
||||
pos += length;
|
||||
newObjReportData['Details'] = buf.toString('utf8', pos, length);
|
||||
pos += length;
|
||||
newObjReportData['VersionString'] = buf.toString('utf8', pos, length);
|
||||
pos += length;
|
||||
this.ReportData = newObjReportData;
|
||||
return pos - startPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user