h
This commit is contained in:
parent
a56ca3e53b
commit
d644bbb59e
@ -22,7 +22,7 @@ CREATE TABLE "UserItem" (
|
||||
-- CreateTable
|
||||
CREATE TABLE "Car" (
|
||||
"userId" INTEGER NOT NULL,
|
||||
"id" SERIAL NOT NULL,
|
||||
"carId" SERIAL NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"manufacturer" INTEGER NOT NULL,
|
||||
"model" INTEGER NOT NULL,
|
||||
@ -51,7 +51,6 @@ CREATE TABLE "Car" (
|
||||
"aura" INTEGER NOT NULL DEFAULT 0,
|
||||
"auraMotif" INTEGER NOT NULL DEFAULT 0,
|
||||
"ghostLevel" INTEGER NOT NULL DEFAULT 1,
|
||||
"searchCode" TEXT NOT NULL DEFAULT '000000',
|
||||
"tuningPoints" INTEGER NOT NULL DEFAULT 0,
|
||||
"odometer" INTEGER NOT NULL DEFAULT 0,
|
||||
"playCount" INTEGER NOT NULL DEFAULT 0,
|
||||
@ -66,12 +65,12 @@ CREATE TABLE "Car" (
|
||||
"vsDoubleStarMedals" INTEGER NOT NULL DEFAULT 0,
|
||||
"vsSingleStarMedals" INTEGER NOT NULL DEFAULT 0,
|
||||
"vsPlainMedals" INTEGER NOT NULL DEFAULT 0,
|
||||
"ghostPlayCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"ghostWinCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"ghostTrophy" INTEGER NOT NULL DEFAULT 0,
|
||||
"ghostScore" INTEGER NOT NULL DEFAULT 0,
|
||||
"ghostStamp" INTEGER NOT NULL DEFAULT 0,
|
||||
"ghostAcquireAllCrowns" BOOLEAN NOT NULL DEFAULT false,
|
||||
"rgPlayCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"rgWinCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"rgTrophy" INTEGER NOT NULL DEFAULT 0,
|
||||
"rgScore" INTEGER NOT NULL DEFAULT 0,
|
||||
"rgStamp" INTEGER NOT NULL DEFAULT 0,
|
||||
"rgAcquireAllCrowns" BOOLEAN NOT NULL DEFAULT false,
|
||||
"dressupLevel" INTEGER NOT NULL DEFAULT 0,
|
||||
"dressupPoint" INTEGER NOT NULL DEFAULT 0,
|
||||
"stPlayCount" INTEGER NOT NULL DEFAULT 0,
|
||||
@ -84,7 +83,7 @@ CREATE TABLE "Car" (
|
||||
"stCompleted100Episodes" BOOLEAN NOT NULL DEFAULT false,
|
||||
"carStateDbId" INTEGER NOT NULL,
|
||||
|
||||
CONSTRAINT "Car_pkey" PRIMARY KEY ("id")
|
||||
CONSTRAINT "Car_pkey" PRIMARY KEY ("carId")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
@ -115,7 +114,7 @@ CREATE TABLE "CarSettings" (
|
||||
-- CreateTable
|
||||
CREATE TABLE "CarState" (
|
||||
"dbId" SERIAL NOT NULL,
|
||||
"hasOpponentGhost" BOOLEAN NOT NULL DEFAULT true,
|
||||
"hasOpponentGhost" BOOLEAN NOT NULL DEFAULT false,
|
||||
"eventJoined" BOOLEAN NOT NULL DEFAULT false,
|
||||
"transferred" BOOLEAN NOT NULL DEFAULT false,
|
||||
"toBeDeleted" BOOLEAN NOT NULL DEFAULT false,
|
||||
@ -148,4 +147,4 @@ ALTER TABLE "Car" ADD CONSTRAINT "Car_carSettingsDbId_fkey" FOREIGN KEY ("carSet
|
||||
ALTER TABLE "Car" ADD CONSTRAINT "Car_carStateDbId_fkey" FOREIGN KEY ("carStateDbId") REFERENCES "CarState"("dbId") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "CarItem" ADD CONSTRAINT "CarItem_carId_fkey" FOREIGN KEY ("carId") REFERENCES "Car"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
ALTER TABLE "CarItem" ADD CONSTRAINT "CarItem_carId_fkey" FOREIGN KEY ("carId") REFERENCES "Car"("carId") ON DELETE RESTRICT ON UPDATE CASCADE;
|
@ -33,7 +33,7 @@ model Car {
|
||||
userId Int
|
||||
|
||||
// This is the Car object itself
|
||||
id Int @id @default(autoincrement())
|
||||
carId Int @id @default(autoincrement())
|
||||
name String
|
||||
manufacturer Int
|
||||
model Int
|
||||
@ -62,7 +62,6 @@ model Car {
|
||||
aura Int @default(0)
|
||||
auraMotif Int @default(0)
|
||||
ghostLevel Int @default(1)
|
||||
searchCode String @default("000000")
|
||||
|
||||
// This is more data about the car
|
||||
tuningPoints Int @default(0)
|
||||
@ -80,12 +79,12 @@ model Car {
|
||||
vsDoubleStarMedals Int @default(0)
|
||||
vsSingleStarMedals Int @default(0)
|
||||
vsPlainMedals Int @default(0)
|
||||
ghostPlayCount Int @default(0)
|
||||
ghostWinCount Int @default(0)
|
||||
ghostTrophy Int @default(0)
|
||||
ghostScore Int @default(0)
|
||||
ghostStamp Int @default(0)
|
||||
ghostAcquireAllCrowns Boolean @default(false)
|
||||
rgPlayCount Int @default(0)
|
||||
rgWinCount Int @default(0)
|
||||
rgTrophy Int @default(0)
|
||||
rgScore Int @default(0)
|
||||
rgStamp Int @default(0)
|
||||
rgAcquireAllCrowns Boolean @default(false)
|
||||
dressupLevel Int @default(0)
|
||||
dressupPoint Int @default(0)
|
||||
stPlayCount Int @default(0)
|
||||
@ -104,7 +103,7 @@ model Car {
|
||||
}
|
||||
|
||||
model CarItem {
|
||||
Car Car? @relation(fields: [carId], references: [id])
|
||||
Car Car? @relation(fields: [carId], references: [carId])
|
||||
carId Int @unique
|
||||
|
||||
category Int
|
||||
@ -132,7 +131,7 @@ model CarState {
|
||||
dbId Int @id @default(autoincrement())
|
||||
car Car?
|
||||
|
||||
hasOpponentGhost Boolean @default(true)
|
||||
hasOpponentGhost Boolean @default(false)
|
||||
eventJoined Boolean @default(false)
|
||||
transferred Boolean @default(false)
|
||||
toBeDeleted Boolean @default(false)
|
||||
|
@ -89,7 +89,6 @@ export default class GameModule extends Module {
|
||||
r.send(Buffer.from(end));
|
||||
return;
|
||||
}
|
||||
console.log(user);
|
||||
let carStates = user.cars.map(e => e.state);
|
||||
let msg = {
|
||||
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
|
||||
@ -106,6 +105,7 @@ export default class GameModule extends Module {
|
||||
if (user.userBanned) {
|
||||
msg.error = wm.wm.protobuf.ErrorCode.ERR_ID_BANNED;
|
||||
}
|
||||
console.log(msg);
|
||||
let resp = wm.wm.protobuf.LoadUserResponse.encode(msg);
|
||||
let end = resp.finish();
|
||||
let r = res
|
||||
@ -201,7 +201,7 @@ export default class GameModule extends Module {
|
||||
let body = wm.wm.protobuf.UpdateCarRequest.decode(req.body);
|
||||
let car = await prisma.car.findFirst({
|
||||
where: {
|
||||
id: body.carId
|
||||
carId: body.carId
|
||||
},
|
||||
include: {
|
||||
settings: true
|
||||
@ -311,11 +311,11 @@ export default class GameModule extends Module {
|
||||
carStateDbId: state.dbId
|
||||
}
|
||||
})
|
||||
console.log(`Created new car ${car.name} with ID ${car.id}`);
|
||||
console.log(`Created new car ${car.name} with ID ${car.carId}`);
|
||||
let msg = {
|
||||
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
|
||||
userId: body.userId,
|
||||
carId: car.id,
|
||||
carId: car.carId,
|
||||
}
|
||||
let resp = wm.wm.protobuf.CreateCarResponse.encode(msg);
|
||||
let end = resp.finish();
|
||||
@ -327,6 +327,42 @@ export default class GameModule extends Module {
|
||||
r.send(Buffer.from(end));
|
||||
})
|
||||
|
||||
app.post('/method/load_car', async (req, res) => {
|
||||
let body = wm.wm.protobuf.LoadCarRequest.decode(req.body);
|
||||
let car = await prisma.car.findFirst({
|
||||
where: {
|
||||
carId: body.carId
|
||||
},
|
||||
include: {
|
||||
settings: true,
|
||||
items: true,
|
||||
}
|
||||
});
|
||||
let msg = {
|
||||
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
|
||||
car: {
|
||||
...car!!
|
||||
},
|
||||
tuningPoint: car!!.tuningPoints,
|
||||
setting: car!!.settings,
|
||||
vsStarCountMax: car!!.vsStarCount,
|
||||
rgPreviousVersionPlayCount: 0,
|
||||
stCompleted_100Episodes: car!!.stCompleted100Episodes,
|
||||
auraMotifAutoChange: false,
|
||||
screenshotCount: 0,
|
||||
transferred: false,
|
||||
...car!!
|
||||
};
|
||||
let resp = wm.wm.protobuf.LoadCarResponse.encode(msg);
|
||||
let end = resp.finish();
|
||||
let r = res
|
||||
.header('Server', 'v388 wangan')
|
||||
.header('Content-Type', 'application/x-protobuf; revision=8053')
|
||||
.header('Content-Length', end.length.toString())
|
||||
.status(200);
|
||||
r.send(Buffer.from(end));
|
||||
});
|
||||
|
||||
app.post('/method/load_game_history', (req, res) => {
|
||||
let msg = {
|
||||
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
|
||||
|
Loading…
Reference in New Issue
Block a user