mirror of
https://github.com/djhackersdev/minime.git
synced 2026-08-25 03:44:00 -05:00
update chara-ish fields on profile save
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { car } from "./_car";
|
||||
import { RequestCode } from "./_defs";
|
||||
import { Id, TitleCode } from "../model/base";
|
||||
import { BackgroundCode, Id, TitleCode } from "../model/base";
|
||||
import { Profile } from "../model/profile";
|
||||
import { SaveProfileRequest } from "../request/saveProfile";
|
||||
import { bitmap } from "./_bitmap";
|
||||
@@ -35,7 +35,9 @@ export function saveProfile(buf: Buffer): SaveProfileRequest {
|
||||
exp: buf.readUInt32LE(0x0028),
|
||||
fame: buf.readUInt32LE(0x0468),
|
||||
dpoint: buf.readUInt32LE(0x0464),
|
||||
title: buf.readUInt16LE(0x0040) as TitleCode,
|
||||
titles: bitmap(buf.slice(0x0042, 0x00f6)) as TitleCode[],
|
||||
background: buf.readUInt8(0x0750) as BackgroundCode,
|
||||
car: car(buf.slice(0x0834, 0x0894)),
|
||||
story: {
|
||||
x: buf.readUInt16LE(0x06fc),
|
||||
|
||||
@@ -7,6 +7,7 @@ export async function saveProfile(
|
||||
req: SaveProfileRequest
|
||||
): Promise<GenericResponse> {
|
||||
const profile = await w.profile().load(req.profileId);
|
||||
const chara = await w.chara().load(req.profileId);
|
||||
|
||||
await Promise.all([
|
||||
w.profile().save(req.profileId, {
|
||||
@@ -16,6 +17,11 @@ export async function saveProfile(
|
||||
fame: req.fame,
|
||||
dpoint: req.dpoint,
|
||||
}),
|
||||
w.chara().save(req.profileId, {
|
||||
...chara,
|
||||
title: req.title,
|
||||
background: req.background,
|
||||
}),
|
||||
w.car().save(req.profileId, req.car),
|
||||
w.story().save(req.profileId, req.story),
|
||||
w.titles().save(req.profileId, req.titles),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Id, TitleCode } from "../model/base";
|
||||
import { BackgroundCode, Id, TitleCode } from "../model/base";
|
||||
import { Car } from "../model/car";
|
||||
import { Profile } from "../model/profile";
|
||||
import { Story } from "../model/story";
|
||||
@@ -10,7 +10,9 @@ export interface SaveProfileRequest {
|
||||
exp: number;
|
||||
fame: number;
|
||||
dpoint: number;
|
||||
title: TitleCode;
|
||||
titles: TitleCode[];
|
||||
background: BackgroundCode;
|
||||
car: Car;
|
||||
story: Story;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user