initial profile save wire-up

This commit is contained in:
Tau
2019-11-06 17:28:29 -05:00
parent 9bdc840019
commit c79c1b870d
18 changed files with 145 additions and 8 deletions
+2
View File
@@ -16,6 +16,7 @@ import { loadTeam } from "./loadTeam";
import { loadTeamRanking, loadTeamRanking2 } from "./loadTeamRanking";
import { lockGarage } from "./lockGarage";
import { lockProfile } from "./lockProfile";
import { msg00AD } from "./msg00AD";
import { saveExpedition } from "./saveExpedition";
import { saveGarage } from "./saveGarage";
import { saveProfile } from "./saveProfile";
@@ -56,6 +57,7 @@ const funcList: ReaderFn[] = [
loadTopTen,
lockGarage,
lockProfile,
msg00AD,
saveExpedition,
saveGarage,
saveProfile,
+9
View File
@@ -0,0 +1,9 @@
import { RequestCode } from "./_defs";
import { Message00AD } from "../request/msg00AD";
msg00AD.msgCode = 0x00ad as RequestCode;
msg00AD.msgLen = 0x061c;
export function msg00AD(buf: Buffer): Message00AD {
return { type: "msg_00AD_req" };
}
+33 -1
View File
@@ -1,12 +1,44 @@
import { RequestCode } from "./_defs";
import { Id, TitleCode } from "../model/base";
import { Profile } from "../model/profile";
import { SaveProfileRequest } from "../request/saveProfile";
import { bitmap } from "./_bitmap";
saveProfile.msgCode = 0x0068 as RequestCode;
saveProfile.msgLen = 0x0940;
export function saveProfile(buf: Buffer): SaveProfileRequest {
const storyRows = new Array();
for (let i = 0; i < 9; i++) {
const cells = new Array();
const rowOffset = 0x01a8 + 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);
}
return {
type: "save_profile_req",
// mega TODO
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
lv: buf.readUInt16LE(0x0026),
exp: buf.readUInt32LE(0x0028),
fame: buf.readUInt32LE(0x0468),
dpoint: buf.readUInt32LE(0x0464),
titles: bitmap(buf.slice(0x0042, 0x00f6)) as TitleCode[],
story: {
x: buf.readUInt16LE(0x06fc),
y: buf.readUInt8(0x06e0),
rows: storyRows,
},
};
}