mirror of
https://github.com/djhackersdev/minime.git
synced 2026-08-20 09:24:21 -05:00
add course play counter tracking
This commit is contained in:
@@ -28,6 +28,12 @@ export function saveProfile(buf: Buffer): SaveProfileRequest {
|
||||
storyRows.push(row);
|
||||
}
|
||||
|
||||
const coursePlays = new Array();
|
||||
|
||||
for (let i = 0x0000; i < 0x0020; i += 2) {
|
||||
coursePlays.push(buf.readUInt16LE(0x04c0 + i));
|
||||
}
|
||||
|
||||
return {
|
||||
type: "save_profile_req",
|
||||
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
|
||||
@@ -38,6 +44,7 @@ export function saveProfile(buf: Buffer): SaveProfileRequest {
|
||||
title: buf.readUInt16LE(0x0040) as TitleCode,
|
||||
titles: bitmap(buf.slice(0x0042, 0x00f6)) as TitleCode[],
|
||||
background: buf.readUInt8(0x0750) as BackgroundCode,
|
||||
coursePlays,
|
||||
car: car(buf.slice(0x0834, 0x0894)),
|
||||
story: {
|
||||
x: buf.readUInt16LE(0x06fc),
|
||||
|
||||
@@ -18,11 +18,6 @@ export function loadProfile2(res: LoadProfileResponse2) {
|
||||
|
||||
const buf = Buffer.alloc(0x0d30);
|
||||
|
||||
//buf.writeUInt16LE(0x0001, 0x06bc); // story_X
|
||||
//buf.writeUInt8(0x00, 0x0670); // story_Y
|
||||
//buf.writeUInt16LE(0x0001, 0x0228 + 0); // records[0].pairs[0].a
|
||||
//buf.writeUInt16LE(0x0003, 0x0228 + 2); // records[0].pairs[0].b
|
||||
|
||||
for (let i = 0; i < 9 && i < res.story.rows.length; i++) {
|
||||
const row = res.story.rows[i];
|
||||
const rowOffset = 0x0228 + i * 0x26;
|
||||
@@ -36,6 +31,10 @@ export function loadProfile2(res: LoadProfileResponse2) {
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < 16 && i < res.coursePlays.length; i++) {
|
||||
buf.writeUInt16LE(res.coursePlays[i], 0x0460 + 2 * i);
|
||||
}
|
||||
|
||||
buf.writeUInt16LE(0x0065, 0x0000);
|
||||
buf.writeUInt32LE(res.profileId, 0x03b8);
|
||||
buf.writeUInt16LE(res.settings.bgMusic, 0x03c8);
|
||||
|
||||
@@ -13,6 +13,7 @@ export async function loadProfile(
|
||||
const settings = await w.settings().load(profile.id);
|
||||
const chara = await w.chara().load(profile.id);
|
||||
const titles = await w.titles().load(profile.id);
|
||||
const coursePlays = await w.coursePlays().load(profile.id);
|
||||
const car = await w.car().load(profile.id);
|
||||
const story = await w.story().load(profile.id);
|
||||
|
||||
@@ -28,6 +29,7 @@ export async function loadProfile(
|
||||
settings,
|
||||
chara,
|
||||
titles,
|
||||
coursePlays,
|
||||
car,
|
||||
story,
|
||||
};
|
||||
|
||||
@@ -23,6 +23,7 @@ export async function saveProfile(
|
||||
background: req.background,
|
||||
}),
|
||||
w.car().save(req.profileId, req.car),
|
||||
w.coursePlays().save(req.profileId, req.coursePlays),
|
||||
w.story().save(req.profileId, req.story),
|
||||
w.titles().save(req.profileId, req.titles),
|
||||
]);
|
||||
|
||||
@@ -13,6 +13,7 @@ export interface SaveProfileRequest {
|
||||
title: TitleCode;
|
||||
titles: TitleCode[];
|
||||
background: BackgroundCode;
|
||||
coursePlays: number[];
|
||||
car: Car;
|
||||
story: Story;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Id } from "../model/base";
|
||||
import { Id, TitleCode } from "../model/base";
|
||||
import { Car } from "../model/car";
|
||||
import { Chara } from "../model/chara";
|
||||
import { Profile } from "../model/profile";
|
||||
@@ -16,7 +16,8 @@ export interface LoadProfileResponse2 {
|
||||
teamId?: number;
|
||||
settings: Settings;
|
||||
chara: Chara;
|
||||
titles: number[];
|
||||
titles: TitleCode[];
|
||||
coursePlays: number[];
|
||||
car: Car;
|
||||
story: Story;
|
||||
// giga TODO
|
||||
|
||||
@@ -21,6 +21,8 @@ export interface World {
|
||||
|
||||
chara(): Repository<Model.Chara, Model.Profile>;
|
||||
|
||||
coursePlays(): Repository<number[], Model.Profile>;
|
||||
|
||||
profile(): ProfileRepository;
|
||||
|
||||
settings(): Repository<Model.Settings, Model.Profile>;
|
||||
|
||||
@@ -32,6 +32,13 @@ class WorldImpl implements World {
|
||||
);
|
||||
}
|
||||
|
||||
coursePlays() {
|
||||
return new SingletonTextRepo<number[], Model.Profile>(
|
||||
this._root,
|
||||
"coursePlays"
|
||||
);
|
||||
}
|
||||
|
||||
profile() {
|
||||
return new ProfileRepositoryImpl(this._root);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user