idz: Add field "c" to story cell tuple
This commit is contained in:
@@ -144,6 +144,7 @@ create table "idz_story_cell_state" (
|
|||||||
"col_no" integer not null,
|
"col_no" integer not null,
|
||||||
"a" integer not null,
|
"a" integer not null,
|
||||||
"b" integer not null,
|
"b" integer not null,
|
||||||
|
"c" integer not null,
|
||||||
constraint "idz_story_cell_state_uq" unique (
|
constraint "idz_story_cell_state_uq" unique (
|
||||||
"profile_id",
|
"profile_id",
|
||||||
"row_no",
|
"row_no",
|
||||||
|
|||||||
@@ -38,6 +38,23 @@ create table "idz_stamp_unlock" (
|
|||||||
constraint "idz_stamp_unlock_uq" unique ("profile_id", "stamp_no")
|
constraint "idz_stamp_unlock_uq" unique ("profile_id", "stamp_no")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create table "new_idz_story_cell_state" (
|
||||||
|
"id" integer primary key not null,
|
||||||
|
"profile_id" integer not null
|
||||||
|
references "idz_profile"("id")
|
||||||
|
on delete cascade,
|
||||||
|
"row_no" integer not null,
|
||||||
|
"col_no" integer not null,
|
||||||
|
"a" integer not null,
|
||||||
|
"b" integer not null,
|
||||||
|
"c" integer not null,
|
||||||
|
constraint "idz_story_cell_state_uq" unique (
|
||||||
|
"profile_id",
|
||||||
|
"row_no",
|
||||||
|
"col_no"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
create table "idz_weekly_missions" (
|
create table "idz_weekly_missions" (
|
||||||
"id" integer primary key not null
|
"id" integer primary key not null
|
||||||
references "idz_profile"("id")
|
references "idz_profile"("id")
|
||||||
@@ -69,6 +86,26 @@ insert into "new_idz_settings" (
|
|||||||
0
|
0
|
||||||
from "idz_settings" as x;
|
from "idz_settings" as x;
|
||||||
|
|
||||||
|
insert into "new_idz_story_cell_state" (
|
||||||
|
"id",
|
||||||
|
"profile_id",
|
||||||
|
"row_no",
|
||||||
|
"col_no",
|
||||||
|
"a",
|
||||||
|
"b",
|
||||||
|
"c"
|
||||||
|
) select
|
||||||
|
x."id",
|
||||||
|
x."profile_id",
|
||||||
|
x."row_no",
|
||||||
|
x."col_no",
|
||||||
|
x."a",
|
||||||
|
x."b",
|
||||||
|
0
|
||||||
|
from "idz_story_cell_state" as x;
|
||||||
|
|
||||||
drop table "idz_settings";
|
drop table "idz_settings";
|
||||||
|
drop table "idz_story_cell_state";
|
||||||
|
|
||||||
alter table "new_idz_settings" rename to "idz_settings";
|
alter table "new_idz_settings" rename to "idz_settings";
|
||||||
|
alter table "new_idz_story_cell_state" rename to "idz_story_cell_state";
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ export function saveProfile2(buf: Buffer): SaveProfileRequest {
|
|||||||
for (let j = 0; j < 9; j++) {
|
for (let j = 0; j < 9; j++) {
|
||||||
const a = buf.readUInt32LE(rowOffset + 0x04 + j * 4);
|
const a = buf.readUInt32LE(rowOffset + 0x04 + j * 4);
|
||||||
const b = buf.readUInt16LE(rowOffset + 0x28 + j * 2);
|
const b = buf.readUInt16LE(rowOffset + 0x28 + j * 2);
|
||||||
const cell = { a, b };
|
const c = 0; // Added in idz2
|
||||||
|
const cell = { a, b, c };
|
||||||
|
|
||||||
cells.set(j, cell);
|
cells.set(j, cell);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ export function saveProfile3(buf: Buffer): SaveProfileRequest {
|
|||||||
for (let j = 0; j < 9; j++) {
|
for (let j = 0; j < 9; j++) {
|
||||||
const a = buf.readUInt8(rowOffset + 0x00 + j);
|
const a = buf.readUInt8(rowOffset + 0x00 + j);
|
||||||
const b = buf.readUInt8(rowOffset + 0x09 + j);
|
const b = buf.readUInt8(rowOffset + 0x09 + j);
|
||||||
const cell = { a, b };
|
const c = 0; // Added in idz2
|
||||||
|
const cell = { a, b, c };
|
||||||
|
|
||||||
cells.set(j, cell);
|
cells.set(j, cell);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export interface StoryCell {
|
export interface StoryCell {
|
||||||
a: number;
|
a: number;
|
||||||
b: number;
|
b: number;
|
||||||
|
c: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StoryRow {
|
export interface StoryRow {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ function cellChanged(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lhs.a !== rhs.a || lhs.b !== rhs.b;
|
return lhs.a !== rhs.a || lhs.b !== rhs.b || lhs.c !== rhs.c;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SqlStoryRepository implements FacetRepository<Story> {
|
export class SqlStoryRepository implements FacetRepository<Story> {
|
||||||
@@ -63,6 +63,7 @@ export class SqlStoryRepository implements FacetRepository<Story> {
|
|||||||
gridRow.cells.set(colNo, {
|
gridRow.cells.set(colNo, {
|
||||||
a: 0,
|
a: 0,
|
||||||
b: 0,
|
b: 0,
|
||||||
|
c: 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +71,7 @@ export class SqlStoryRepository implements FacetRepository<Story> {
|
|||||||
|
|
||||||
cell.a = parseInt(row.a!);
|
cell.a = parseInt(row.a!);
|
||||||
cell.b = parseInt(row.b!);
|
cell.b = parseInt(row.b!);
|
||||||
|
cell.c = parseInt(row.c!);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -109,9 +111,10 @@ export class SqlStoryRepository implements FacetRepository<Story> {
|
|||||||
col_no: j,
|
col_no: j,
|
||||||
a: cell.a,
|
a: cell.a,
|
||||||
b: cell.b,
|
b: cell.b,
|
||||||
|
c: cell.c,
|
||||||
})
|
})
|
||||||
.onConflict("profile_id", "row_no", "col_no")
|
.onConflict("profile_id", "row_no", "col_no")
|
||||||
.doUpdate(["a", "b"]);
|
.doUpdate(["a", "b", "c"]);
|
||||||
|
|
||||||
await this._txn.modify(cellSql);
|
await this._txn.modify(cellSql);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user