idz: Fix loadTopTen

This commit is contained in:
b166fe48b91eb09f279b79a4ecf57b2f8f0d3705
2021-02-03 23:43:43 +00:00
committed by da5669c09fdb0a288ba01e259a609d7779ac7fc9
parent 87de79ef12
commit 377096a077
8 changed files with 50 additions and 4 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ import {
loadTeamRanking4,
} from "./loadTeamRanking";
import { loadTopTen1 } from "./loadTopTen1";
import { loadTopTen2 } from "./loadTopTen2";
import { loadTopTen2, loadTopTen3 } from "./loadTopTen2";
import { lockGarage1, lockGarage2 } from "./lockGarage";
import { lockProfile1, lockProfile2 } from "./lockProfile";
import { saveExpedition1, saveExpedition2 } from "./saveExpedition";
@@ -205,7 +205,7 @@ const funcList210: ReaderFn[] = [
loadTeam2,
loadTeamRanking2,
loadTeamRanking4,
loadTopTen2,
loadTopTen3,
lockGarage2,
lockProfile2,
lockProfileExtend2,
+1
View File
@@ -24,6 +24,7 @@ export function loadTopTen1(buf: Buffer): LoadTopTenRequest {
return {
type: "load_top_ten_req",
version: 1,
field_2: buf.readUInt16LE(0x0002), // Bitmask selector
selectors,
field_C4: buf.readUInt8(0x00c4), // Boolean, true if profile ID is set
+32
View File
@@ -24,6 +24,7 @@ export function loadTopTen2(buf: Buffer): LoadTopTenRequest {
return {
type: "load_top_ten_req",
version: 1,
field_2: buf.readUInt16LE(0x0002), // Bitmask selector
selectors,
field_C4: buf.readUInt8(0x00f4), // Boolean, true if profile ID is set
@@ -33,3 +34,34 @@ export function loadTopTen2(buf: Buffer): LoadTopTenRequest {
teamId: teamId !== 0xffffffff ? (teamId as ExtId<Team>) : undefined,
};
}
loadTopTen3.msgCode = 0x012c;
loadTopTen3.msgLen = 0x0110;
export function loadTopTen3(buf: Buffer): LoadTopTenRequest {
const selectors = new Array<LoadTopTenRequestSelector>();
for (let i = 0; i < 40; i++) {
selectors.push({
routeNo: (buf.readUInt16LE(0x0004 + 2 + 2 * i) >> 1) as RouteNo,
minTimestamp: new Date(
buf.readUInt32LE(0x0054 + 4 + 4 * i) * 1000 + 1000
),
});
}
const profileId = buf.readUInt32LE(0x00fc);
const teamId = buf.readUInt32LE(0x0100);
return {
type: "load_top_ten_req",
version: 2,
field_2: buf.readUInt16LE(0x0004), // Bitmask selector
selectors,
field_C4: buf.readUInt8(0x00f8), // Boolean, true if profile ID is set
field_C5: buf.readUInt8(0x00f9), // Always zero
field_C6: buf.readUInt16LE(0x00fa),
aimeId: profileId !== 0 ? (profileId as AimeId) : undefined,
teamId: teamId !== 0xffffffff ? (teamId as ExtId<Team>) : undefined,
};
}