Store mission progress
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { MissionGrid } from "../model/mission";
|
||||
|
||||
export function mission(buf: Buffer): MissionGrid[] {
|
||||
const grids = new Array();
|
||||
|
||||
for (let gridNo = 0; gridNo < 5; gridNo++) {
|
||||
const grid: MissionGrid = { gridNo, cells: [] };
|
||||
|
||||
for (let cellNo = 0; cellNo < 9; cellNo++) {
|
||||
let cell = 0;
|
||||
let mask = 1 << cellNo;
|
||||
|
||||
for (let sliceNo = 0; sliceNo < 3; sliceNo++) {
|
||||
const slice = buf.readUInt16LE(0x0c * sliceNo + 0x02 * gridNo);
|
||||
|
||||
if (slice & mask) {
|
||||
cell |= 1 << sliceNo;
|
||||
}
|
||||
}
|
||||
|
||||
grid.cells.push(cell);
|
||||
}
|
||||
|
||||
grids.push(grid);
|
||||
}
|
||||
|
||||
return grids;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { car } from "./_car";
|
||||
import { mission } from "./_mission";
|
||||
import { RequestCode } from "./_defs";
|
||||
import { BackgroundCode, Id, TitleCode } from "../model/base";
|
||||
import { Profile } from "../model/profile";
|
||||
@@ -45,6 +46,10 @@ export function saveProfile(buf: Buffer): SaveProfileRequest {
|
||||
titles: bitmap(buf.slice(0x0042, 0x00f6)) as TitleCode[],
|
||||
background: buf.readUInt8(0x0750) as BackgroundCode,
|
||||
coursePlays,
|
||||
missions: {
|
||||
team: mission(buf.slice(0x03c4, 0x03e6)),
|
||||
solo: mission(buf.slice(0x0724, 0x0746)),
|
||||
},
|
||||
car: car(buf.slice(0x0834, 0x0894)),
|
||||
story: {
|
||||
x: buf.readUInt16LE(0x06fc),
|
||||
|
||||
Reference in New Issue
Block a user