wip
This commit is contained in:
@@ -11,7 +11,7 @@ import { loadConfig2 } from "./loadConfig2";
|
||||
import { loadGarage } from "./loadGarage";
|
||||
import { loadGeneralReward } from "./loadGeneralReward";
|
||||
import { loadGhost } from "./loadGhost";
|
||||
import { loadProfile } from "./loadProfile";
|
||||
import { loadProfile2 } from "./loadProfile2";
|
||||
import { loadRewardTable } from "./loadRewardTable";
|
||||
import { loadServerList } from "./loadServerList";
|
||||
import { loadStocker } from "./loadStocker";
|
||||
@@ -23,7 +23,8 @@ import { msg00AD } from "./msg00AD";
|
||||
import { saveExpedition } from "./saveExpedition";
|
||||
import { saveGarage } from "./saveGarage";
|
||||
import { saveNewCar } from "./saveNewCar";
|
||||
import { saveProfile } from "./saveProfile";
|
||||
import { saveProfile2 } from "./saveProfile2";
|
||||
import { saveProfile3 } from "./saveProfile3";
|
||||
import { saveSettings } from "./saveSettings";
|
||||
import { saveStocker } from "./saveStocker";
|
||||
import { saveTimeAttack } from "./saveTimeAttack";
|
||||
@@ -56,7 +57,7 @@ const funcList: ReaderFn[] = [
|
||||
loadGarage,
|
||||
loadGeneralReward,
|
||||
loadGhost,
|
||||
loadProfile,
|
||||
loadProfile2,
|
||||
loadRewardTable,
|
||||
loadServerList,
|
||||
loadStocker,
|
||||
@@ -70,7 +71,8 @@ const funcList: ReaderFn[] = [
|
||||
saveExpedition,
|
||||
saveGarage,
|
||||
saveNewCar,
|
||||
saveProfile,
|
||||
saveProfile2,
|
||||
saveProfile3,
|
||||
saveSettings,
|
||||
saveStocker,
|
||||
saveTimeAttack,
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
import { RequestCode } from "./_defs";
|
||||
import { LoadProfileRequest } from "../request/loadProfile";
|
||||
import { AimeId } from "../../model";
|
||||
|
||||
loadProfile.msgCode = 0x0067 as RequestCode;
|
||||
loadProfile.msgLen = 0x0020;
|
||||
|
||||
export function loadProfile(buf: Buffer): LoadProfileRequest {
|
||||
return {
|
||||
type: "load_profile_req",
|
||||
aimeId: buf.readUInt32LE(0x0004) as AimeId,
|
||||
luid: buf.slice(0x0008, buf.indexOf("\0", 0x0008)).toString("ascii"),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { RequestCode } from "./_defs";
|
||||
import {
|
||||
LoadProfileRequest2,
|
||||
LoadProfileRequest3,
|
||||
} from "../request/loadProfile";
|
||||
import { AimeId } from "../../model";
|
||||
|
||||
loadProfile2.msgCode = 0x0067 as RequestCode;
|
||||
loadProfile2.msgLen = 0x0020;
|
||||
|
||||
export function loadProfile2(buf: Buffer): LoadProfileRequest2 {
|
||||
return {
|
||||
type: "load_profile_req",
|
||||
format: 2,
|
||||
aimeId: buf.readUInt32LE(0x0004) as AimeId,
|
||||
luid: buf.slice(0x0008, buf.indexOf("\0", 0x0008)).toString("ascii"),
|
||||
};
|
||||
}
|
||||
|
||||
loadProfile3.msgCode = 0x0012f as RequestCode;
|
||||
loadProfile3.msgLen = 0x0020;
|
||||
|
||||
export function loadProfile3(buf: Buffer): LoadProfileRequest3 {
|
||||
return {
|
||||
type: "load_profile_req",
|
||||
format: 3,
|
||||
aimeId: buf.readUInt32LE(0x0004) as AimeId,
|
||||
luid: buf.slice(0x0008, buf.indexOf("\0", 0x0008)).toString("ascii"),
|
||||
};
|
||||
}
|
||||
@@ -3,13 +3,13 @@ import { mission } from "./_mission";
|
||||
import { RequestCode } from "./_defs";
|
||||
import { BackgroundCode, CourseNo, ExtId, TitleCode } from "../model/base";
|
||||
import { Profile } from "../model/profile";
|
||||
import { SaveProfileRequest } from "../request/saveProfile";
|
||||
import { SaveProfileRequest2 } from "../request/saveProfile";
|
||||
import { bitmap } from "./_bitmap";
|
||||
|
||||
saveProfile.msgCode = 0x0068 as RequestCode;
|
||||
saveProfile.msgLen = 0x0940;
|
||||
saveProfile2.msgCode = 0x0068 as RequestCode;
|
||||
saveProfile2.msgLen = 0x0940;
|
||||
|
||||
export function saveProfile(buf: Buffer): SaveProfileRequest {
|
||||
export function saveProfile2(buf: Buffer): SaveProfileRequest2 {
|
||||
const storyRows = new Array();
|
||||
|
||||
for (let i = 0; i < 9; i++) {
|
||||
@@ -46,6 +46,7 @@ export function saveProfile(buf: Buffer): SaveProfileRequest {
|
||||
|
||||
return {
|
||||
type: "save_profile_req",
|
||||
format: 2,
|
||||
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
|
||||
lv: buf.readUInt16LE(0x0026),
|
||||
exp: buf.readUInt32LE(0x0028),
|
||||
@@ -0,0 +1,101 @@
|
||||
import { car } from "./_car";
|
||||
import { mission } from "./_mission";
|
||||
import { RequestCode } from "./_defs";
|
||||
import { BackgroundCode, CourseNo, ExtId, TitleCode } from "../model/base";
|
||||
import { Profile } from "../model/profile";
|
||||
import { SaveProfileRequest2 } from "../request/saveProfile";
|
||||
import { bitmap } from "./_bitmap";
|
||||
|
||||
saveProfile3.msgCode = 0x0138 as RequestCode;
|
||||
saveProfile3.msgLen = 0x0a70;
|
||||
|
||||
export function saveProfile3(buf: Buffer): SaveProfileRequest2 {
|
||||
const storyRows = new Array();
|
||||
|
||||
/* Story seems to have changed somewhat
|
||||
|
||||
for (let i = 0; i < 9; i++) {
|
||||
const cells = new Array();
|
||||
const rowOffset = 0xXXXX + i * 0x3c;
|
||||
|
||||
for (let j = 0; j < 9; j++) {
|
||||
const a = buf.readUInt32LE(rowOffset + 0x04 + j * 4);
|
||||
const b = buf.readUInt16LE(rowOffset + 0x28 + j * 2);
|
||||
const cell = { a, b };
|
||||
|
||||
cells.push(cell);
|
||||
}
|
||||
|
||||
const row = { cells };
|
||||
|
||||
storyRows.push(row);
|
||||
}
|
||||
*/
|
||||
|
||||
const coursePlays = new Map<CourseNo, number>();
|
||||
|
||||
for (let i = 0; i < 20; i++) {
|
||||
coursePlays.set(i as CourseNo, buf.readUInt16LE(0x0554 + 2 * i));
|
||||
}
|
||||
|
||||
const freeCar = {
|
||||
validFrom: buf.readUInt32LE(0x0138),
|
||||
};
|
||||
|
||||
const freeContinue = {
|
||||
validFrom: buf.readUInt32LE(0x0038),
|
||||
validTo: buf.readUInt32LE(0x003c),
|
||||
};
|
||||
|
||||
return {
|
||||
type: "save_profile_req",
|
||||
format: 2,
|
||||
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
|
||||
lv: buf.readUInt16LE(0x0026),
|
||||
exp: buf.readUInt32LE(0x0028),
|
||||
fame: buf.readUInt32LE(0x04fc),
|
||||
dpoint: buf.readUInt32LE(0x04f8),
|
||||
mileage: buf.readUInt32LE(0x0008),
|
||||
title: buf.readUInt16LE(0x0040) as TitleCode,
|
||||
titles: bitmap(buf.slice(0x0042, 0x00f6)),
|
||||
background: buf.readUInt8(0x0874) as BackgroundCode,
|
||||
coursePlays,
|
||||
missions: {
|
||||
team: mission(buf.slice(0x0430, 0x0452)),
|
||||
solo: mission(buf.slice(0x0848, 0x086a)),
|
||||
},
|
||||
car: car(buf.slice(0x0958, 0x09b8)),
|
||||
story: {
|
||||
x: buf.readUInt16LE(0x0818),
|
||||
y: buf.readUInt8(0x07fc),
|
||||
rows: storyRows,
|
||||
},
|
||||
unlocks: {
|
||||
cup: buf.readUInt8(0x0110),
|
||||
gauges: buf.readUInt16LE(0x0114),
|
||||
music: buf.readUInt16LE(0x0140),
|
||||
lastMileageReward: buf.readUInt32LE(0x013c),
|
||||
},
|
||||
tickets: {
|
||||
freeCar:
|
||||
freeCar.validFrom !== 0
|
||||
? {
|
||||
validFrom: new Date(freeCar.validFrom * 1000),
|
||||
}
|
||||
: undefined,
|
||||
freeContinue:
|
||||
freeContinue.validFrom !== 0 && freeContinue.validTo !== 0
|
||||
? {
|
||||
validFrom: new Date(freeContinue.validFrom * 1000),
|
||||
validTo: new Date(freeContinue.validTo * 1000),
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
settings: {
|
||||
music: buf.readUInt16LE(0x04ee),
|
||||
pack: buf.readUInt32LE(0x0034),
|
||||
paperCup: buf.readUInt8(0x00f6),
|
||||
gauges: buf.readUInt8(0x00f7),
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user