Map out LoadTopTen req and res

This commit is contained in:
Tau
2019-11-06 17:28:30 -05:00
parent e93abfeae1
commit 1a3a5d8ede
5 changed files with 141 additions and 1 deletions
+22
View File
@@ -1,11 +1,33 @@
import { RequestCode } from "./_defs";
import { Id } from "../model/base";
import { Profile } from "../model/profile";
import { Team } from "../model/team";
import { LoadTopTenRequest } from "../request/loadTopTen";
loadTopTen.msgCode = 0x00b5 as RequestCode;
loadTopTen.msgLen = 0x00e0;
export function loadTopTen(buf: Buffer): LoadTopTenRequest {
const selectors = new Array();
for (let i = 0; i < 32; i++) {
selectors.push({
field_4: buf.readUInt16LE(0x0004 + 2 * i),
field_44: buf.readUInt32LE(0x0044 + 4 * i),
});
}
const profileId = buf.readUInt32LE(0x00c8);
const teamId = buf.readUInt32LE(0x00cc);
return {
type: "load_top_ten_req",
field_2: buf.readUInt16LE(0x0002), // Bitmask selector
selectors,
field_C4: buf.readUInt8(0x00c4), // Boolean, true if profile ID is set
field_C5: buf.readUInt8(0x00c5), // Always zero
field_C6: buf.readUInt16LE(0x00c6),
profileId: profileId !== 0 ? (profileId as Id<Profile>) : undefined,
teamId: teamId !== 0xffffffff ? (teamId as Id<Team>) : undefined,
};
}