mirror of
https://github.com/djhackersdev/minime.git
synced 2026-08-20 09:24:21 -05:00
Track misc unlocks
This commit is contained in:
@@ -56,5 +56,10 @@ export function saveProfile(buf: Buffer): SaveProfileRequest {
|
||||
y: buf.readUInt8(0x06e0),
|
||||
rows: storyRows,
|
||||
},
|
||||
unlocks: {
|
||||
cup: buf.readUInt8(0x0110),
|
||||
gauges: buf.readUInt16LE(0x0114),
|
||||
music: buf.readUInt16LE(0x0140),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -19,6 +19,17 @@ export function loadProfile2(res: LoadProfileResponse2) {
|
||||
|
||||
const buf = Buffer.alloc(0x0d30);
|
||||
|
||||
// FLAMETHROWER ANALYSIS (watch out for C strings)
|
||||
//buf.fill(0xff, 0x0000, 0x08f4);
|
||||
//buf.fill(0xff, 0x0c20, 0x0c2a);
|
||||
|
||||
// B0-C0: Cup and gauges
|
||||
// B8-C0: All gauges, no cup
|
||||
buf.fill(0xff, 0x00b4, 0x00b6);
|
||||
buf.writeUInt8(0xff, 0x00b4); // PAPER CUP
|
||||
buf.writeUInt16LE(0xffff, 0x00b8);
|
||||
buf.writeUInt16LE(0x0009, 0x01ec); // MUSIC UNLOCKS
|
||||
|
||||
for (let i = 0; i < 9 && i < res.story.rows.length; i++) {
|
||||
const row = res.story.rows[i];
|
||||
const rowOffset = 0x0228 + i * 0x26;
|
||||
@@ -37,6 +48,9 @@ export function loadProfile2(res: LoadProfileResponse2) {
|
||||
}
|
||||
|
||||
buf.writeUInt16LE(0x0065, 0x0000);
|
||||
buf.writeUInt8(res.unlocks.cup, 0x00b4);
|
||||
buf.writeUInt16LE(res.unlocks.gauges, 0x00b8);
|
||||
buf.writeUInt16LE(res.unlocks.music, 0x01ec);
|
||||
mission(res.missions.team).copy(buf, 0x038a);
|
||||
buf.writeUInt32LE(res.profileId, 0x03b8);
|
||||
buf.writeUInt16LE(res.settings.bgMusic, 0x03c8);
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Profile } from "../model/profile";
|
||||
import { Settings } from "../model/settings";
|
||||
import { Story } from "../model/story";
|
||||
import { Team } from "../model/team";
|
||||
import { Unlocks } from "../model/unlocks";
|
||||
import { CreateProfileRequest } from "../request/createProfile";
|
||||
import { GenericResponse } from "../response/generic";
|
||||
import { World } from "../world";
|
||||
@@ -41,12 +42,15 @@ export async function createProfile(
|
||||
|
||||
const story: Story = { x: 0, y: 0, rows: [] };
|
||||
|
||||
const unlocks: Unlocks = { cup: 0, gauges: 0, music: 0 };
|
||||
|
||||
await Promise.all([
|
||||
w.profile().save(profile.id, profile),
|
||||
w.chara().save(profile.id, req.chara),
|
||||
w.car().save(profile.id, req.car),
|
||||
w.missions().save(profile.id, missions),
|
||||
w.settings().save(profile.id, settings),
|
||||
w.unlocks().save(profile.id, unlocks),
|
||||
]);
|
||||
|
||||
return {
|
||||
|
||||
@@ -17,6 +17,7 @@ export async function loadProfile(
|
||||
const missions = await w.missions().load(profile.id);
|
||||
const car = await w.car().load(profile.id);
|
||||
const story = await w.story().load(profile.id);
|
||||
const unlocks = await w.unlocks().load(profile.id);
|
||||
|
||||
return {
|
||||
type: "load_profile_v2_res",
|
||||
@@ -34,5 +35,6 @@ export async function loadProfile(
|
||||
missions,
|
||||
car,
|
||||
story,
|
||||
unlocks,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ export async function saveProfile(
|
||||
w.missions().save(req.profileId, req.missions),
|
||||
w.story().save(req.profileId, req.story),
|
||||
w.titles().save(req.profileId, req.titles),
|
||||
w.unlocks().save(req.profileId, req.unlocks),
|
||||
]);
|
||||
|
||||
return {
|
||||
|
||||
@@ -6,3 +6,4 @@ export { Profile } from "./profile";
|
||||
export { Settings } from "./settings";
|
||||
export { Story } from "./story";
|
||||
export { Team } from "./team";
|
||||
export { Unlocks } from "./unlocks";
|
||||
|
||||
5
src/idz/model/unlocks.ts
Normal file
5
src/idz/model/unlocks.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export interface Unlocks {
|
||||
cup: number;
|
||||
gauges: number;
|
||||
music: number;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { Car } from "../model/car";
|
||||
import { MissionState } from "../model/mission";
|
||||
import { Profile } from "../model/profile";
|
||||
import { Story } from "../model/story";
|
||||
import { Unlocks } from "../model/unlocks";
|
||||
|
||||
export interface SaveProfileRequest {
|
||||
type: "save_profile_req";
|
||||
@@ -18,4 +19,5 @@ export interface SaveProfileRequest {
|
||||
missions: MissionState;
|
||||
car: Car;
|
||||
story: Story;
|
||||
unlocks: Unlocks;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { MissionState } from "../model/mission";
|
||||
import { Profile } from "../model/profile";
|
||||
import { Settings } from "../model/settings";
|
||||
import { Story } from "../model/story";
|
||||
import { Unlocks } from "../model/unlocks";
|
||||
|
||||
export interface LoadProfileResponse2 {
|
||||
type: "load_profile_v2_res";
|
||||
@@ -22,5 +23,6 @@ export interface LoadProfileResponse2 {
|
||||
missions: MissionState;
|
||||
car: Car;
|
||||
story: Story;
|
||||
unlocks: Unlocks;
|
||||
// giga TODO
|
||||
}
|
||||
|
||||
@@ -32,4 +32,6 @@ export interface World {
|
||||
story(): Repository<Model.Story, Model.Profile>;
|
||||
|
||||
titles(): Repository<Model.TitleCode[], Model.Profile>;
|
||||
|
||||
unlocks(): Repository<Model.Unlocks, Model.Profile>;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,13 @@ class WorldImpl implements World {
|
||||
"titles"
|
||||
);
|
||||
}
|
||||
|
||||
unlocks() {
|
||||
return new SingletonJsonRepo<Model.Unlocks, Model.Profile>(
|
||||
this._root,
|
||||
"unlocks"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function createWorld(root: string): Promise<World> {
|
||||
|
||||
Reference in New Issue
Block a user