diff --git a/src/idz/decoder/loadStocker.ts b/src/idz/decoder/loadStocker.ts index 11c870a..190e7bf 100644 --- a/src/idz/decoder/loadStocker.ts +++ b/src/idz/decoder/loadStocker.ts @@ -7,6 +7,6 @@ loadStocker.msgLen = 0x0010; export function loadStocker(buf: Buffer): LoadStockerRequest { return { type: "load_stocker_req", - field_0004: buf.readUInt32LE(0x0004), + profileId: buf.readUInt32LE(0x0004), }; } diff --git a/src/idz/encoder/_bitSet.ts b/src/idz/encoder/_bitmap.ts similarity index 76% rename from src/idz/encoder/_bitSet.ts rename to src/idz/encoder/_bitmap.ts index 8a250dd..9172b16 100644 --- a/src/idz/encoder/_bitSet.ts +++ b/src/idz/encoder/_bitmap.ts @@ -1,4 +1,4 @@ -export function bitSet(items: number[], nbytes: number): Buffer { +export function bitmap(items: number[], nbytes: number): Buffer { const buf = Buffer.alloc(nbytes); for (const item of items) { diff --git a/src/idz/encoder/loadProfile2.ts b/src/idz/encoder/loadProfile2.ts index 844dda3..1b352b7 100644 --- a/src/idz/encoder/loadProfile2.ts +++ b/src/idz/encoder/loadProfile2.ts @@ -3,6 +3,7 @@ import iconv = require("iconv-lite"); import { car } from "./_car"; import { chara } from "./_chara"; import { LoadProfileResponse2 } from "../response/loadProfile2"; +import { bitmap } from "./_bitmap"; export function loadProfile2(res: LoadProfileResponse2) { // Story stuff @@ -34,6 +35,7 @@ export function loadProfile2(res: LoadProfileResponse2) { chara(res.chara).copy(buf, 0x070c); buf.writeUInt16LE(res.background, 0x071c); buf.writeUInt16LE(res.title, 0x071e); + bitmap(res.titles, 0xb4).copy(buf, 0x720); buf.writeInt32LE(res.teamId, 0x07e0); car(res.car).copy(buf, 0x0c5c); diff --git a/src/idz/encoder/loadStocker.ts b/src/idz/encoder/loadStocker.ts index 9456013..9a58087 100644 --- a/src/idz/encoder/loadStocker.ts +++ b/src/idz/encoder/loadStocker.ts @@ -1,3 +1,4 @@ +import { bitmap } from "./_bitmap"; import { LoadStockerResponse } from "../response/loadStocker"; export function loadStocker(res: LoadStockerResponse) { @@ -5,8 +6,7 @@ export function loadStocker(res: LoadStockerResponse) { buf.writeInt16LE(0x00a8, 0x0000); buf.writeUInt8(res.status, 0x0002); - //buf.fill(0xff, 0x0003, 0x000a); - buf.writeUInt8(0x08, 0x0008); + bitmap(res.backgrounds, 0x24).copy(buf, 0x0003); return buf; } diff --git a/src/idz/handler/loadProfile.ts b/src/idz/handler/loadProfile.ts index cfad94a..71e388a 100644 --- a/src/idz/handler/loadProfile.ts +++ b/src/idz/handler/loadProfile.ts @@ -37,6 +37,7 @@ export function loadProfile( }, background: 0, title: 0, + titles: [], car: { field_00: 0, field_02: 0, diff --git a/src/idz/handler/loadStocker.ts b/src/idz/handler/loadStocker.ts index e0efd18..923580f 100644 --- a/src/idz/handler/loadStocker.ts +++ b/src/idz/handler/loadStocker.ts @@ -9,5 +9,6 @@ export function loadStocker( return { type: "load_stocker_res", status: 1, + backgrounds: [], }; } diff --git a/src/idz/request/loadStocker.ts b/src/idz/request/loadStocker.ts index 538407c..1974828 100644 --- a/src/idz/request/loadStocker.ts +++ b/src/idz/request/loadStocker.ts @@ -1,4 +1,4 @@ export interface LoadStockerRequest { type: "load_stocker_req"; - field_0004: number; + profileId: number; } diff --git a/src/idz/response/loadProfile2.ts b/src/idz/response/loadProfile2.ts index 4e647f6..6137371 100644 --- a/src/idz/response/loadProfile2.ts +++ b/src/idz/response/loadProfile2.ts @@ -14,6 +14,7 @@ export interface LoadProfileResponse2 { chara: Chara; background: number; title: number; + titles: number[]; car: Car; // giga TODO } diff --git a/src/idz/response/loadStocker.ts b/src/idz/response/loadStocker.ts index 919338d..387dc49 100644 --- a/src/idz/response/loadStocker.ts +++ b/src/idz/response/loadStocker.ts @@ -1,5 +1,5 @@ export interface LoadStockerResponse { type: "load_stocker_res"; status: number; - // mega TODO + backgrounds: number[]; }