From 5c4d011ac5aa64ec820f76394a5f49373dbcd7cd Mon Sep 17 00:00:00 2001 From: Tau Date: Sat, 13 Apr 2019 12:04:53 -0400 Subject: [PATCH] Store mileage --- src/idz/decoder/saveProfile.ts | 1 + src/idz/encoder/loadProfile2.ts | 3 ++- src/idz/handler/createProfile.ts | 1 + src/idz/handler/loadProfile.ts | 1 + src/idz/handler/saveProfile.ts | 1 + src/idz/model/profile.ts | 1 + src/idz/request/saveProfile.ts | 1 + src/idz/response/loadProfile2.ts | 1 + 8 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/idz/decoder/saveProfile.ts b/src/idz/decoder/saveProfile.ts index cd92484..13b7e17 100644 --- a/src/idz/decoder/saveProfile.ts +++ b/src/idz/decoder/saveProfile.ts @@ -42,6 +42,7 @@ export function saveProfile(buf: Buffer): SaveProfileRequest { exp: buf.readUInt32LE(0x0028), fame: buf.readUInt32LE(0x0468), dpoint: buf.readUInt32LE(0x0464), + mileage: buf.readUInt32LE(0x0008), title: buf.readUInt16LE(0x0040) as TitleCode, titles: bitmap(buf.slice(0x0042, 0x00f6)) as TitleCode[], background: buf.readUInt8(0x0750) as BackgroundCode, diff --git a/src/idz/encoder/loadProfile2.ts b/src/idz/encoder/loadProfile2.ts index 0e8cc6d..56dbc80 100644 --- a/src/idz/encoder/loadProfile2.ts +++ b/src/idz/encoder/loadProfile2.ts @@ -57,10 +57,11 @@ export function loadProfile2(res: LoadProfileResponse2) { mission(res.missions.team).copy(buf, 0x038a); buf.writeUInt16LE(0xffff, 0x0388); // [1] buf.writeUInt32LE(res.profileId, 0x03b8); + buf.writeUInt32LE(res.mileage, 0x03bc); buf.writeUInt16LE(res.settings.music, 0x03c8); buf.writeUInt16LE(res.lv, 0x03cc); buf.writeUInt32LE(res.exp, 0x03d0); - buf.writeUInt32LE(res.settings.pack, 0x3d8); + buf.writeUInt32LE(res.settings.pack, 0x03d8); buf.writeUInt32LE(res.dpoint, 0x03e8); buf.writeUInt32LE(res.fame, 0x0404); iconv.encode(res.name + "\0", "shift_jis").copy(buf, 0x03ee); diff --git a/src/idz/handler/createProfile.ts b/src/idz/handler/createProfile.ts index a71d221..6ef41b3 100644 --- a/src/idz/handler/createProfile.ts +++ b/src/idz/handler/createProfile.ts @@ -22,6 +22,7 @@ export async function createProfile( exp: 0, fame: 0, dpoint: 0, + mileage: 0, }; const missions: MissionState = { team: [], solo: [] }; diff --git a/src/idz/handler/loadProfile.ts b/src/idz/handler/loadProfile.ts index 7717d8f..34c3af1 100644 --- a/src/idz/handler/loadProfile.ts +++ b/src/idz/handler/loadProfile.ts @@ -28,6 +28,7 @@ export async function loadProfile( exp: profile.exp, fame: profile.fame, dpoint: profile.dpoint, + mileage: profile.mileage, teamId: profile.teamId, settings, chara, diff --git a/src/idz/handler/saveProfile.ts b/src/idz/handler/saveProfile.ts index 311fbc2..6f63c89 100644 --- a/src/idz/handler/saveProfile.ts +++ b/src/idz/handler/saveProfile.ts @@ -16,6 +16,7 @@ export async function saveProfile( exp: req.exp, fame: req.fame, dpoint: req.dpoint, + mileage: req.mileage, }), w.chara().save(req.profileId, { ...chara, diff --git a/src/idz/model/profile.ts b/src/idz/model/profile.ts index 0bc111b..31dea04 100644 --- a/src/idz/model/profile.ts +++ b/src/idz/model/profile.ts @@ -9,4 +9,5 @@ export interface Profile { exp: number; fame: number; dpoint: number; + mileage: number; } diff --git a/src/idz/request/saveProfile.ts b/src/idz/request/saveProfile.ts index 3702bf0..4611218 100644 --- a/src/idz/request/saveProfile.ts +++ b/src/idz/request/saveProfile.ts @@ -13,6 +13,7 @@ export interface SaveProfileRequest { exp: number; fame: number; dpoint: number; + mileage: number; title: TitleCode; titles: TitleCode[]; background: BackgroundCode; diff --git a/src/idz/response/loadProfile2.ts b/src/idz/response/loadProfile2.ts index 5365dfd..dc416fa 100644 --- a/src/idz/response/loadProfile2.ts +++ b/src/idz/response/loadProfile2.ts @@ -16,6 +16,7 @@ export interface LoadProfileResponse2 { exp: number; fame: number; dpoint: number; + mileage: number; teamId?: number; settings: Settings; chara: Chara;