IDZ: Add support for player auras

This commit is contained in:
85be42b2ce67a8e34b32793360824b056c0c2444 2019-11-27 02:22:03 +00:00 committed by da5669c09fdb0a288ba01e259a609d7779ac7fc9
parent c5e39f104f
commit 6da5abcefc
13 changed files with 26 additions and 5 deletions

View File

@ -98,6 +98,7 @@ create table "idz_settings" (
on delete cascade,
"music" integer not null,
"pack" integer not null,
"aura" integer not null,
"paper_cup" integer not null, -- Not a boolean, oddly enough
"gauges" integer not null
);
@ -192,6 +193,7 @@ create table "idz_unlocks" (
"id" integer primary key not null
references "idz_profile"("id")
on delete cascade,
"auras" integer not null,
"cup" integer not null,
"gauges" integer not null,
"music" integer not null,

View File

@ -0,0 +1,5 @@
-- This adds the required columns to save player aura settings and unlocks
-- Default values are set according to what the game expects
alter table "idz_settings" add column "aura" integer NOT NULL DEFAULT '0';
alter table "idz_unlocks" add column "auras" integer NOT NULL DEFAULT '1';

View File

@ -67,6 +67,7 @@ export function saveProfile2(buf: Buffer): SaveProfileRequest2 {
rows: storyRows,
},
unlocks: {
auras: buf.readUInt16LE(0x010c),
cup: buf.readUInt8(0x0110),
gauges: buf.readUInt16LE(0x0114),
music: buf.readUInt16LE(0x0140),
@ -90,6 +91,7 @@ export function saveProfile2(buf: Buffer): SaveProfileRequest2 {
settings: {
music: buf.readUInt16LE(0x045a),
pack: buf.readUInt32LE(0x0034),
aura: buf.readUInt8(0x002c),
paperCup: buf.readUInt8(0x00f6),
gauges: buf.readUInt8(0x00f7),
},

View File

@ -69,6 +69,7 @@ export function saveProfile3(buf: Buffer): SaveProfileRequest2 {
rows: storyRows,
},
unlocks: {
auras: buf.readUInt16LE(0x010c),
cup: buf.readUInt8(0x0110),
gauges: buf.readUInt16LE(0x0114),
music: buf.readUInt16LE(0x0140),
@ -92,6 +93,7 @@ export function saveProfile3(buf: Buffer): SaveProfileRequest2 {
settings: {
music: buf.readUInt16LE(0x04ee),
pack: buf.readUInt32LE(0x0034),
aura: buf.readUInt8(0x002c),
paperCup: buf.readUInt8(0x00f6),
gauges: buf.readUInt8(0x00f7),
},

View File

@ -16,8 +16,8 @@ export function saveSettings(buf: Buffer): SaveSettingsRequest {
pack: buf.readUInt32LE(0x000c),
paperCup: buf.readUInt8(0x0011),
gauges: buf.readUInt8(0x0012),
aura: buf.readUInt8(0x0013),
},
field_0010: buf.readUInt8(0x0010),
field_0013: buf.readUInt8(0x0013),
};
}

View File

@ -71,6 +71,7 @@ export function loadProfile2(res: LoadProfileResponse2) {
}
buf.writeUInt16LE(0x0065, 0x0000);
buf.writeUInt16LE(res.unlocks.auras, 0x00b0);
buf.writeUInt8(res.unlocks.cup, 0x00b4);
buf.writeUInt16LE(res.unlocks.gauges, 0x00b8);
buf.writeUInt32LE(res.unlocks.lastMileageReward, 0x01e8);
@ -92,6 +93,7 @@ export function loadProfile2(res: LoadProfileResponse2) {
encodeMission(res.missions.solo).copy(buf, 0x06e4);
encodeChara(res.chara).copy(buf, 0x070c);
encodeBitmap(res.titles, 0xb4).copy(buf, 0x720);
buf.writeUInt8(res.settings.aura, 0x07d6);
buf.writeUInt8(res.settings.paperCup, 0x07d9);
buf.writeUInt8(res.settings.gauges, 0x07da);
buf.writeUInt32LE(res.teamId || 0xffffffff, 0x07e0);

View File

@ -71,6 +71,7 @@ export function loadProfile3(res: LoadProfileResponse3) {
}
buf.writeUInt16LE(0x012e, 0x0000);
buf.writeUInt16LE(res.unlocks.auras, 0x00b0);
buf.writeUInt8(res.unlocks.cup, 0x00b4);
buf.writeUInt16LE(res.unlocks.gauges, 0x00b8);
buf.writeUInt32LE(res.unlocks.lastMileageReward, 0x0218);
@ -92,6 +93,7 @@ export function loadProfile3(res: LoadProfileResponse3) {
encodeMission(res.missions.solo).copy(buf, 0x0858);
encodeChara(res.chara).copy(buf, 0x0880);
encodeBitmap(res.titles, 0xb4).copy(buf, 0x0894);
buf.writeUInt8(res.settings.aura, 0x094a);
buf.writeUInt8(res.settings.paperCup, 0x094d);
buf.writeUInt8(res.settings.gauges, 0x094e);
buf.writeUInt32LE(res.teamId || 0xffffffff, 0x0954);

View File

@ -27,9 +27,10 @@ export async function createProfile(
};
const missions: MissionState = { team: [], solo: [] };
const settings: Settings = { music: 0, pack: 13640, paperCup: 0, gauges: 5 };
const settings: Settings = { music: 0, pack: 13640, aura: 0, paperCup: 0, gauges: 5 };
const story: Story = { x: 0, y: 0, rows: [] };
const unlocks: Unlocks = {
auras: 1,
cup: 0,
gauges: 1 << 5,
music: 0,

View File

@ -1,6 +1,7 @@
export interface Settings {
music: number;
pack: number;
aura: number;
paperCup: number;
gauges: number;
}

View File

@ -1,4 +1,5 @@
export interface Unlocks {
auras: number;
cup: number;
gauges: number;
music: number;

View File

@ -7,5 +7,4 @@ export interface SaveSettingsRequest {
dpoint: number; // ?? why
settings: Settings;
field_0010: number;
field_0013: number;
}

View File

@ -24,6 +24,7 @@ export class SqlSettingsRepository implements FacetRepository<Settings> {
return {
music: parseInt(row.music),
pack: parseInt(row.pack),
aura: parseInt(row.aura),
paperCup: parseInt(row.paper_cup),
gauges: parseInt(row.gauges),
};
@ -35,11 +36,12 @@ export class SqlSettingsRepository implements FacetRepository<Settings> {
id: profileId,
music: settings.music,
pack: settings.pack,
aura: settings.aura,
paper_cup: settings.paperCup,
gauges: settings.gauges,
})
.onConflict("id")
.doUpdate(["music", "pack", "paper_cup", "gauges"]);
.doUpdate(["music", "pack", "aura", "paper_cup", "gauges"]);
await this._txn.modify(saveSql);
}

View File

@ -22,6 +22,7 @@ export class SqlUnlocksRepository implements FacetRepository<Unlocks> {
}
return {
auras: parseInt(row.auras),
cup: parseInt(row.cup),
gauges: parseInt(row.gauges),
music: parseInt(row.music),
@ -33,13 +34,14 @@ export class SqlUnlocksRepository implements FacetRepository<Unlocks> {
const saveSql = sql
.insert("idz_unlocks", {
id: profileId,
auras: unlocks.auras,
cup: unlocks.cup,
gauges: unlocks.gauges,
music: unlocks.music,
last_mileage_reward: unlocks.lastMileageReward,
})
.onConflict("id")
.doUpdate(["cup", "gauges", "music", "last_mileage_reward"]);
.doUpdate(["auras", "cup", "gauges", "music", "last_mileage_reward"]);
await this._txn.modify(saveSql);
}