From 1807839336806a11f0610308a4fe7e6864095f7c Mon Sep 17 00:00:00 2001
From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com>
Date: Thu, 4 Aug 2022 10:17:58 +0700
Subject: [PATCH 1/8] fix crown ghost bug, attract screen bug, *hopefully*
ghost battle working (both saving and load)
no db nuke, but there are table change
-Ghost Battle finally working (hopefully).. tested in search ghost by level.. idk about by name or anything.. i think it should work too
-Crown Ghost Battle temporary fix timestamp
-Attract screen time attack wrong HP
-Disable venue crown car aura (causing green artifact)
---
.../migration.sql | 9 +
.../migration.sql | 5 +
.../migration.sql | 8 +
prisma/schema.prisma | 16 +-
src/modules/game.ts | 1306 ++++++++++-------
src/modules/startup.ts | 91 +-
6 files changed, 832 insertions(+), 603 deletions(-)
create mode 100644 prisma/migrations/20220801071556_ghost_trail_4/migration.sql
create mode 100644 prisma/migrations/20220801071906_ghost_trail_5/migration.sql
create mode 100644 prisma/migrations/20220803125807_ghost_trail_6/migration.sql
diff --git a/prisma/migrations/20220801071556_ghost_trail_4/migration.sql b/prisma/migrations/20220801071556_ghost_trail_4/migration.sql
new file mode 100644
index 0000000..0926f33
--- /dev/null
+++ b/prisma/migrations/20220801071556_ghost_trail_4/migration.sql
@@ -0,0 +1,9 @@
+-- AlterTable
+ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0;
+
+-- AlterTable
+ALTER TABLE "GhostTrail" ADD COLUMN "byAreaMergeSerial" INTEGER,
+ADD COLUMN "byCarMergeSerial" INTEGER,
+ADD COLUMN "byUserMergeSerial" INTEGER,
+ADD COLUMN "trendBinaryByCar" BYTEA,
+ADD COLUMN "trendBinaryByUser" BYTEA;
diff --git a/prisma/migrations/20220801071906_ghost_trail_5/migration.sql b/prisma/migrations/20220801071906_ghost_trail_5/migration.sql
new file mode 100644
index 0000000..170852e
--- /dev/null
+++ b/prisma/migrations/20220801071906_ghost_trail_5/migration.sql
@@ -0,0 +1,5 @@
+-- AlterTable
+ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0;
+
+-- AlterTable
+ALTER TABLE "GhostTrail" ADD COLUMN "driveDMergeSerial" INTEGER;
diff --git a/prisma/migrations/20220803125807_ghost_trail_6/migration.sql b/prisma/migrations/20220803125807_ghost_trail_6/migration.sql
new file mode 100644
index 0000000..cf6ff8b
--- /dev/null
+++ b/prisma/migrations/20220803125807_ghost_trail_6/migration.sql
@@ -0,0 +1,8 @@
+-- AlterTable
+ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0;
+
+-- AlterTable
+ALTER TABLE "GhostTrail" ADD COLUMN "tuneHandling" INTEGER NOT NULL DEFAULT 0,
+ADD COLUMN "tunePower" INTEGER NOT NULL DEFAULT 0,
+ALTER COLUMN "playedAt" SET DEFAULT 0,
+ALTER COLUMN "crownBattle" SET DEFAULT false;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 091cc69..81bcbd8 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -215,8 +215,8 @@ model CarCrown {
}
model GhostTrail {
- dbId Int @id @default(autoincrement())
- car Car @relation(fields: [carId], references: [carId])
+ dbId Int @id @default(autoincrement())
+ car Car @relation(fields: [carId], references: [carId])
carId Int
area Int
ramp Int
@@ -224,7 +224,15 @@ model GhostTrail {
trail Bytes
time Int?
driveData Bytes? @db.ByteA
+ driveDMergeSerial Int?
+ trendBinaryByUser Bytes? @db.ByteA
+ byUserMergeSerial Int?
trendBinaryByArea Bytes? @db.ByteA
- playedAt Int
- crownBattle Boolean
+ byAreaMergeSerial Int?
+ trendBinaryByCar Bytes? @db.ByteA
+ byCarMergeSerial Int?
+ playedAt Int @default(0)
+ tunePower Int @default(0)
+ tuneHandling Int @default(0)
+ crownBattle Boolean @default(false)
}
diff --git a/src/modules/game.ts b/src/modules/game.ts
index fd85103..7f8e5ae 100644
--- a/src/modules/game.ts
+++ b/src/modules/game.ts
@@ -22,135 +22,134 @@ export default class GameModule extends Module {
carId: body.carId
}
});
- let storyLose: boolean = false;
+
let ghostModePlay: boolean = false;
switch (body.gameMode) {
case wm.wm.protobuf.GameMode.MODE_STORY:
- {
- if (!(body.retired)) {
- let maxConsecutiveWins = car!.stConsecutiveWinsMax;
- if (maxConsecutiveWins < body.stResult!.stConsecutiveWins!) {
- maxConsecutiveWins = body.stResult!.stConsecutiveWins!;
- }
- let divcount = body.stResult?.stClearDivCount;
- let saveEx: any = {};
- if (body.stResult?.stLoseBits !== null && body.stResult?.stLoseBits !== undefined) {
- let actualLoseBits = BigInt(0);
- if (body.stResult?.stLoseBits! instanceof Long) {
- actualLoseBits = actualLoseBits | BigInt(body.stResult?.stLoseBits.high);
- actualLoseBits = actualLoseBits << BigInt(32);
- actualLoseBits = actualLoseBits | BigInt(body.stResult?.stLoseBits.low);
- saveEx.stLoseBits = Number(actualLoseBits);
- if(saveEx.stLoseBits > 0){
- storyLose = true;
- }
- }
- } else {
- saveEx.stLoseBits = car?.stLoseBits;
- }
- if (divcount !== null && divcount !== undefined && divcount !== 0) {
- console.log(body.stResult?.stClearDivCount);
- saveEx.stClearDivCount = divcount;
- } else {
- saveEx.stClearDivCount = car?.stClearDivCount;
- }
- if (body.stResult?.stClearBits !== null && body.stResult?.stClearBits !== undefined && storyLose !== true) {
- saveEx.stClearBits = body.stResult?.stClearBits;
- } else {
- saveEx.stClearBits = car?.stClearBits;
- }
- if (body.stResult?.stPlayCount !== null && body.stResult?.stPlayCount !== undefined) {
- saveEx.stPlayCount = body.stResult?.stPlayCount!;
- } else {
- saveEx.stPlayCount = car?.stPlayCount;
- }
- if (body.stResult?.stClearCount !== null && body.stResult?.stClearCount !== undefined && body.stResult?.stClearCount !== 0) {
- saveEx.stClearCount = body.stResult?.stClearCount!;
- } else {
- saveEx.stClearCount = car?.stClearCount;
- }
- if (body.stResult?.stConsecutiveWins !== null && body.stResult?.stConsecutiveWins !== undefined) {
- saveEx.stConsecutiveWins = body.stResult?.stConsecutiveWins!;
- } else {
- saveEx.stConsecutiveWins = car?.stConsecutiveWins;
- }
- if (body.stResult?.tuningPoint !== null && body.stResult?.tuningPoint !== undefined) {
- saveEx.tuningPoints = body.stResult?.tuningPoint!;
- } else {
- saveEx.tuningPoints = car?.tuningPoints;
- }
- if (body.stResult?.stCompleted_100Episodes !== null && body.stResult?.stCompleted_100Episodes !== undefined) {
- saveEx.stCompleted100Episodes = body.stResult?.stCompleted_100Episodes!;
- } else {
- saveEx.stCompleted100Episodes = car?.stCompleted100Episodes;
- }
- saveEx.stConsecutiveWinsMax = maxConsecutiveWins;
-
- let currentStep = 0;
- currentStep = body.car!.tunePower! + body.car!.tuneHandling!;
- if(currentStep >= 0 && currentStep <= 5){
- saveEx.ghostLevel = 1
- }
- else if(currentStep >= 6 && currentStep <= 10){
- saveEx.ghostLevel = 2
- }
- else if(currentStep >= 11 && currentStep <= 15){
- saveEx.ghostLevel = 3
- }
- else if(currentStep >= 16 && currentStep <= 20){
- saveEx.ghostLevel = 4
- }
- else if(currentStep >= 21 && currentStep <= 26){
- saveEx.ghostLevel = 5
- }
- else if(currentStep >= 27 && currentStep <= 28){
- saveEx.ghostLevel = 6
- }
- else if(currentStep >= 29 && currentStep <= 30){
- saveEx.ghostLevel = 7
- }
- else if(currentStep === 31){
- saveEx.ghostLevel = 8
- }
- else if(currentStep >= 32 && currentStep <= 33){
- saveEx.ghostLevel = 9
- }
- else if(currentStep === 34){
- saveEx.ghostLevel = 10
- }
-
- await prisma.car.update({
- where: {
- carId: body.carId
- },
- data: saveEx
- });
+ {
+ // If the game was not retired
+ if (!(body.retired)) {
+ let storyLose: boolean = false;
+ let maxConsecutiveWins = car!.stConsecutiveWinsMax;
+ if (maxConsecutiveWins < body.stResult!.stConsecutiveWins!) {
+ maxConsecutiveWins = body.stResult!.stConsecutiveWins!;
}
- break;
- }
- case wm.wm.protobuf.GameMode.MODE_TIME_ATTACK:
- {
- // If the game was not timed out / retired
- if (!(body.retired || body.timeup)) {
-
- console.log('Game not retired / timed out, continuing ...')
-
- // Get the current time attack record for the car
- let currentRecord = await prisma.timeAttackRecord.findFirst({
- where: {
- carId: body.carId, // , model: body.car!.model!,
- course: body.taResult!.course
+ let divcount = body.stResult?.stClearDivCount;
+ let saveEx: any = {};
+ if (body.stResult?.stLoseBits !== null && body.stResult?.stLoseBits !== undefined) {
+ let actualLoseBits = BigInt(0);
+ if (body.stResult?.stLoseBits! instanceof Long) {
+ actualLoseBits = actualLoseBits | BigInt(body.stResult?.stLoseBits.high);
+ actualLoseBits = actualLoseBits << BigInt(32);
+ actualLoseBits = actualLoseBits | BigInt(body.stResult?.stLoseBits.low);
+ saveEx.stLoseBits = Number(actualLoseBits);
+ if(saveEx.stLoseBits > 0){
+ storyLose = true;
}
- });
+ }
+ } else {
+ saveEx.stLoseBits = car?.stLoseBits;
+ }
+ if (divcount !== null && divcount !== undefined && divcount !== 0) {
+ console.log(body.stResult?.stClearDivCount);
+ saveEx.stClearDivCount = divcount;
+ } else {
+ saveEx.stClearDivCount = car?.stClearDivCount;
+ }
+ if (body.stResult?.stClearBits !== null && body.stResult?.stClearBits !== undefined && storyLose !== true) {
+ saveEx.stClearBits = body.stResult?.stClearBits;
+ } else {
+ saveEx.stClearBits = car?.stClearBits;
+ }
+ if (body.stResult?.stPlayCount !== null && body.stResult?.stPlayCount !== undefined) {
+ saveEx.stPlayCount = body.stResult?.stPlayCount!;
+ } else {
+ saveEx.stPlayCount = car?.stPlayCount;
+ }
+ if (body.stResult?.stClearCount !== null && body.stResult?.stClearCount !== undefined && body.stResult?.stClearCount !== 0) {
+ saveEx.stClearCount = body.stResult?.stClearCount!;
+ } else {
+ saveEx.stClearCount = car?.stClearCount;
+ }
+ if (body.stResult?.stConsecutiveWins !== null && body.stResult?.stConsecutiveWins !== undefined) {
+ saveEx.stConsecutiveWins = body.stResult?.stConsecutiveWins!;
+ } else {
+ saveEx.stConsecutiveWins = car?.stConsecutiveWins;
+ }
+ if (body.stResult?.tuningPoint !== null && body.stResult?.tuningPoint !== undefined) {
+ saveEx.tuningPoints = body.stResult?.tuningPoint!;
+ } else {
+ saveEx.tuningPoints = car?.tuningPoints;
+ }
+ if (body.stResult?.stCompleted_100Episodes !== null && body.stResult?.stCompleted_100Episodes !== undefined) {
+ saveEx.stCompleted100Episodes = body.stResult?.stCompleted_100Episodes!;
+ } else {
+ saveEx.stCompleted100Episodes = car?.stCompleted100Episodes;
+ }
+ saveEx.stConsecutiveWinsMax = maxConsecutiveWins;
- // Record already exists
- if (currentRecord)
- {
- // If the existing record is faster, do not continue
- if (body.taResult!.time > currentRecord.time) break;
+ let currentStep = 0;
+ currentStep = body.car!.tunePower! + body.car!.tuneHandling!;
+ if(currentStep >= 0 && currentStep <= 5){
+ saveEx.ghostLevel = 1
+ }
+ else if(currentStep >= 6 && currentStep <= 10){
+ saveEx.ghostLevel = 2
+ }
+ else if(currentStep >= 11 && currentStep <= 15){
+ saveEx.ghostLevel = 3
+ }
+ else if(currentStep >= 16 && currentStep <= 20){
+ saveEx.ghostLevel = 4
+ }
+ else if(currentStep >= 21 && currentStep <= 26){
+ saveEx.ghostLevel = 5
+ }
+ else if(currentStep >= 27 && currentStep <= 28){
+ saveEx.ghostLevel = 6
+ }
+ else if(currentStep >= 29 && currentStep <= 30){
+ saveEx.ghostLevel = 7
+ }
+ else if(currentStep === 31){
+ saveEx.ghostLevel = 8
+ }
+ else if(currentStep >= 32 && currentStep <= 33){
+ saveEx.ghostLevel = 9
+ }
+ else if(currentStep === 34){
+ saveEx.ghostLevel = 10
+ }
+ await prisma.car.update({
+ where: {
+ carId: body.carId
+ },
+ data: saveEx
+ });
+ }
+ break;
+ }
+ case wm.wm.protobuf.GameMode.MODE_TIME_ATTACK:
+ {
+ // If the game was not retired / timed out
+ if (!(body.retired || body.timeup)) {
+ console.log('Game not retired / timed out, continuing ...')
+
+ // Get the current time attack record for the car
+ let currentRecord = await prisma.timeAttackRecord.findFirst({
+ where: {
+ carId: body.carId, // , model: body.car!.model!,
+ course: body.taResult!.course
+ }
+ });
+
+ // Record already exists
+ if (currentRecord)
+ {
+ // If the existing record is faster, do not continue
+ if (body.taResult!.time < currentRecord.time){
console.log('Updating time attack record...')
-
await prisma.timeAttackRecord.update({
where: {
// Could be null - if it is null, this will insert.
@@ -170,304 +169,305 @@ export default class GameModule extends Module {
}
});
}
- else // Creating a new record
- {
- console.log('Creating new time attack record');
-
- await prisma.timeAttackRecord.create({
- data: {
- carId: body.carId,
- model: body.car!.model!,
- time: body.taResult!.time,
- isMorning: body.taResult!.isMorning,
- course: body.taResult!.course,
- section1Time: body!.taResult!.section_1Time,
- section2Time: body!.taResult!.section_2Time,
- section3Time: body!.taResult!.section_3Time,
- section4Time: body!.taResult!.section_4Time,
- section5Time: body!.taResult!.section_5Time,
- section6Time: body!.taResult!.section_6Time,
- section7Time: body!.taResult!.section_7Time,
- tunePower: body!.car!.tunePower,
- tuneHandling: body!.car!.tuneHandling
- }
- });
- break;
- }
}
- break;
- }
- case wm.wm.protobuf.GameMode.MODE_GHOST_BATTLE:
- {
- if (!(body.retired)) {
- let saveEx: any = {};
- if (body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined) {
- saveEx.rgRegionMapScore = body.rgResult?.rgRegionMapScore!;
- } else {
- saveEx.rgRegionMapScore = car?.rgRegionMapScore;
- }
- if (body.rgResult?.rgPlayCount !== null && body.rgResult?.rgPlayCount !== undefined) {
- saveEx.rgPlayCount = body.rgResult?.rgPlayCount!;
- } else {
- saveEx.rgPlayCount = car?.rgPlayCount;
- }
- if (body.rgResult?.dressupLevel !== null && body.rgResult?.dressupLevel !== undefined) {
- saveEx.dressupLevel = body.rgResult?.dressupLevel!;
- } else {
- saveEx.dressupLevel = car?.dressupLevel;
- }
- if (body.rgResult?.dressupPoint !== null && body.rgResult?.dressupPoint !== undefined) {
- saveEx.dressupPoint = body.rgResult?.dressupPoint!;
- } else {
- saveEx.dressupPoint = car?.dressupPoint;
- }
- if (body.car?.wheel !== null && body.car?.wheel !== undefined) {
- saveEx.wheel = body.car?.wheel!;
- } else {
- saveEx.wheel = car?.wheel;
- }
- if (body.car?.wheelColor !== null && body.car?.wheelColor !== undefined) {
- saveEx.wheelColor = body.car?.wheelColor!;
- } else {
- saveEx.wheelColor = car?.wheelColor;
- }
- if (body.car?.aero !== null && body.car?.aero !== undefined) {
- saveEx.aero = body.car?.aero!;
- } else {
- saveEx.aero = car?.aero;
- }
- if (body.car?.bonnet !== null && body.car?.bonnet !== undefined) {
- saveEx.bonnet = body.car?.bonnet!;
- } else {
- saveEx.bonnet = car?.bonnet;
- }
- if (body.car?.wing !== null && body.car?.wing !== undefined) {
- saveEx.wing = body.car?.wing!;
- } else {
- saveEx.wing = car?.wing;
- }
- if (body.car?.mirror !== null && body.car?.mirror !== undefined) {
- saveEx.mirror = body.car?.mirror!;
- } else {
- saveEx.mirror = car?.mirror;
- }
- if (body.car?.neon !== null && body.car?.neon !== undefined) {
- saveEx.neon = body.car?.neon!;
- } else {
- saveEx.neon = car?.neon;
- }
- if (body.car?.trunk !== null && body.car?.trunk !== undefined) {
- saveEx.trunk = body.car?.trunk!;
- } else {
- saveEx.trunk = car?.trunk;
- }
- if (body.car?.plate !== null && body.car?.plate !== undefined) {
- saveEx.plate = body.car?.plate!;
- } else {
- saveEx.plate = car?.plate;
- }
- if (body.car?.plateColor !== null && body.car?.plateColor !== undefined) {
- saveEx.plateColor = body.car?.plateColor!;
- } else {
- saveEx.plateColor = car?.plateColor;
- }
- if (body.car?.plateNumber !== null && body.car?.plateNumber !== undefined) {
- saveEx.plateNumber = body.car?.plateNumber!;
- } else {
- saveEx.plateNumber = car?.plateNumber;
- }
- if (body.car?.ghostLevel !== null && body.car?.ghostLevel !== undefined) {
- saveEx.ghostLevel = body.car?.ghostLevel!;
- } else {
- saveEx.ghostLevel = car?.ghostLevel;
- }
+ else // Creating a new record
+ {
+ console.log('Creating new time attack record');
- let winCounter = 0;
- if(body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined && body.rgResult?.rgRegionMapScore.length !== 0){
- for(let i=0; i
= 0 && body.rgResult?.path <= 9){ // GID_PATH_C1
- saveExCrown.area = Number(0);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 4));
- }
- else if(body.rgResult?.path >= 10 && body.rgResult?.path <= 15){ // GID_PATH_N9
- saveExCrown.area = Number(1);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 4);
- }
- else if(body.rgResult?.path >= 16 && body.rgResult?.path <= 17){ // GID_PATH_WTEAST
- saveExCrown.area = Number(2);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 6);
- }
- else if(body.rgResult?.path >= 18 && body.rgResult?.path <= 19){ // GID_PATH_WT_UP_DOWN
- saveExCrown.area = Number(3);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 8);
- }
- else if(body.rgResult?.path >= 20 && body.rgResult?.path <= 26){ // GID_PATH_WG
- saveExCrown.area = Number(4);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 4) + 10);
- }
- else if(body.rgResult?.path >= 27 && body.rgResult?.path <= 33){ // GID_PATH_KG
- saveExCrown.area = Number(5);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 4) + 14);
- }
- else if(body.rgResult?.path >= 34 && body.rgResult?.path <= 37){ // GID_PATH_YS
- saveExCrown.area = Number(6);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 3) + 18);
- }
- else if(body.rgResult?.path >= 38 && body.rgResult?.path <= 48){ // GID_PATH_KG_SHINYAMASHITA_MINATOMIRAI
- saveExCrown.area = Number(7);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 4) + 21);
- }
- else if(body.rgResult?.path === 49){ // GID_PATH_NGR
- saveExCrown.area = Number(8);
- saveExCrown.ramp = Number(25);
- }
- else if(body.rgResult?.path >= 50 && body.rgResult?.path <= 53){ // GID_PATH_OS
- saveExCrown.area = Number(9);
- saveExCrown.ramp = Number(26);
- }
- else if(body.rgResult?.path >= 54 && body.rgResult?.path <= 55){ // GID_PATH_KB
- saveExCrown.area = Number(10);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 27);
- }
- else if(body.rgResult?.path >= 58 && body.rgResult?.path <= 61){ // GID_PATH_FK
- saveExCrown.area = Number(11);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 4) + 29);
- }
- else if(body.rgResult?.path >= 62 && body.rgResult?.path <= 63){ // GID_PATH_HK
- saveExCrown.area = Number(12);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 33);
- }
- else if(body.rgResult?.path >= 64 && body.rgResult?.path <= 65){ // GID_PATH_TP
- saveExCrown.area = Number(13);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 35);
- }
- else if(body.rgResult?.path >= 56 && body.rgResult?.path <= 57){ // GID_PATH_HS
- saveExCrown.area = Number(18);
- saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 27);
- }
-
- saveExCrown.path = body.rgResult?.path!;
- }
- if(body?.playedAt !== null || body?.playedAt !== undefined){
- saveExCrown.playedAt = body?.playedAt!;
- }
- saveExCrown.tunePower = body.car!.tunePower!;
- saveExCrown.tuneHandling = body.car!.tuneHandling!;
-
- let carCrowns = await prisma.carCrown.count({
- where: {
- area: saveExCrown.area
- }
- });
- if(carCrowns !== 0){
- let areaVal = Number(saveExCrown.area);
- await prisma.carCrown.update({
- where: {
- area: areaVal
- },
- data: saveExCrown
- });
- }
- else{
- await prisma.carCrown.create({
- data: saveExCrown
- });
- }
- }
- }
+ let winCounter = 0;
+ if(body.rgResult?.rgRegionMapScore !== null && body.rgResult?.rgRegionMapScore !== undefined && body.rgResult?.rgRegionMapScore.length !== 0){
+ for(let i=0; i= 0 && body.rgResult?.path <= 9){ // GID_PATH_C1
+ saveExCrown.area = Number(0);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 4));
+ }
+ else if(body.rgResult?.path >= 10 && body.rgResult?.path <= 15){ // GID_PATH_N9
+ saveExCrown.area = Number(1);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 4);
+ }
+ else if(body.rgResult?.path >= 16 && body.rgResult?.path <= 17){ // GID_PATH_WTEAST
+ saveExCrown.area = Number(2);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 6);
+ }
+ else if(body.rgResult?.path >= 18 && body.rgResult?.path <= 19){ // GID_PATH_WT_UP_DOWN
+ saveExCrown.area = Number(3);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 8);
+ }
+ else if(body.rgResult?.path >= 20 && body.rgResult?.path <= 26){ // GID_PATH_WG
+ saveExCrown.area = Number(4);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 4) + 10);
+ }
+ else if(body.rgResult?.path >= 27 && body.rgResult?.path <= 33){ // GID_PATH_KG
+ saveExCrown.area = Number(5);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 4) + 14);
+ }
+ else if(body.rgResult?.path >= 34 && body.rgResult?.path <= 37){ // GID_PATH_YS
+ saveExCrown.area = Number(6);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 3) + 18);
+ }
+ else if(body.rgResult?.path >= 38 && body.rgResult?.path <= 48){ // GID_PATH_KG_SHINYAMASHITA_MINATOMIRAI
+ saveExCrown.area = Number(7);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 4) + 21);
+ }
+ else if(body.rgResult?.path === 49){ // GID_PATH_NGR
+ saveExCrown.area = Number(8);
+ saveExCrown.ramp = Number(25);
+ }
+ else if(body.rgResult?.path >= 50 && body.rgResult?.path <= 53){ // GID_PATH_OS
+ saveExCrown.area = Number(9);
+ saveExCrown.ramp = Number(26);
+ }
+ else if(body.rgResult?.path >= 54 && body.rgResult?.path <= 55){ // GID_PATH_KB
+ saveExCrown.area = Number(10);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 27);
+ }
+ else if(body.rgResult?.path >= 58 && body.rgResult?.path <= 61){ // GID_PATH_FK
+ saveExCrown.area = Number(11);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 4) + 29);
+ }
+ else if(body.rgResult?.path >= 62 && body.rgResult?.path <= 63){ // GID_PATH_HK
+ saveExCrown.area = Number(12);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 33);
+ }
+ else if(body.rgResult?.path >= 64 && body.rgResult?.path <= 65){ // GID_PATH_TP
+ saveExCrown.area = Number(13);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 35);
+ }
+ else if(body.rgResult?.path >= 56 && body.rgResult?.path <= 57){ // GID_PATH_HS
+ saveExCrown.area = Number(18);
+ saveExCrown.ramp = Number(Math.floor(Math.random() * 2) + 27);
+ }
+
+ saveExCrown.path = body.rgResult?.path!;
+ }
+ if(body?.playedAt !== null || body?.playedAt !== undefined){
+ body!.playedAt = body?.playedAt!;
+ }
+ saveExCrown.tunePower = body.car!.tunePower!;
+ saveExCrown.tuneHandling = body.car!.tuneHandling!;
+
+ let carCrowns = await prisma.carCrown.count({
+ where: {
+ area: saveExCrown.area
+ }
+ });
+ if(carCrowns !== 0){
+ let areaVal = Number(saveExCrown.area);
+ await prisma.carCrown.update({
+ where: {
+ area: areaVal
+ },
+ data: saveExCrown
+ });
+ }
+ else{
+ await prisma.carCrown.create({
+ data: saveExCrown
+ });
+ }
+ }
+ }
+ }
}
+ break;
+ }
+ case wm.wm.protobuf.GameMode.MODE_VS_BATTLE:
+ {
+ let saveEx: any = {};
+ if(body.vsResult?.vsPlayCount !== null && body.vsResult?.vsPlayCount !== undefined){
+ saveEx.vsPlayCount = body.vsResult?.vsPlayCount!;
+ }
+ else {
+ saveEx.vsPlayCount = car?.vsPlayCount;
+ }
+ if(body.vsResult?.vsBurstCount !== null && body.vsResult?.vsBurstCount !== undefined){
+ saveEx.vsBurstCount = body.vsResult?.vsBurstCount!;
+ }
+ else {
+ saveEx.vsBurstCount = car?.vsBurstCount;
+ }
+ if(body.vsResult?.vsStarCount !== null && body.vsResult?.vsStarCount !== undefined){
+ saveEx.vsStarCount = body.vsResult?.vsStarCount!;
+ }
+ else {
+ saveEx.vsStarCount = car?.vsStarCount;
+ }
+ if(body.vsResult?.vsCoolOrWild !== null && body.vsResult?.vsCoolOrWild !== undefined){
+ saveEx.vsCoolOrWild = body.vsResult?.vsCoolOrWild!;
+ }
+ else {
+ saveEx.vsCoolOrWild = car?.vsCoolOrWild;
+ }
+ if(body.vsResult?.vsSmoothOrRough !== null && body.vsResult?.vsSmoothOrRough !== undefined){
+ saveEx.vsSmoothOrRough = body.vsResult?.vsSmoothOrRough!;
+ }
+ else {
+ saveEx.vsSmoothOrRough = car?.vsSmoothOrRough;
+ }
+ if(body.vsResult?.vsTripleStarMedals !== null && body.vsResult?.vsTripleStarMedals !== undefined && body.vsResult?.vsTripleStarMedals !== 0){
+ saveEx.vsTripleStarMedals = body.vsResult?.vsTripleStarMedals!;
+ }
+ else {
+ saveEx.vsTripleStarMedals = car?.vsTripleStarMedals;
+ }
+ if(body.vsResult?.vsDoubleStarMedals !== null && body.vsResult?.vsDoubleStarMedals !== undefined && body.vsResult?.vsDoubleStarMedals !== 0){
+ saveEx.vsDoubleStarMedals = body.vsResult?.vsDoubleStarMedals!;
+ }
+ else {
+ saveEx.vsDoubleStarMedals = car?.vsDoubleStarMedals;
+ }
+ if(body.vsResult?.vsSingleStarMedals !== null && body.vsResult?.vsSingleStarMedals !== undefined && body.vsResult?.vsSingleStarMedals !== 0){
+ saveEx.vsSingleStarMedals = body.vsResult?.vsSingleStarMedals!;
+ }
+ else {
+ saveEx.vsSingleStarMedals = car?.vsSingleStarMedals;
+ }
+ if(body.vsResult?.vsPlainMedals !== null && body.vsResult?.vsPlainMedals !== undefined && body.vsResult?.vsPlainMedals !== 0){
+ saveEx.vsPlainMedals = body.vsResult?.vsPlainMedals!;
+ }
+ else {
+ saveEx.vsPlainMedals = car?.vsPlainMedals;
+ }
+
+ await prisma.car.update({
+ where: {
+ carId: body.carId
+ },
+ data: saveEx
+ });
+ break;
+ }
}
// Get car item
@@ -516,7 +516,7 @@ export default class GameModule extends Module {
tunePower: body.car!.tunePower!,
tuneHandling: body.car!.tuneHandling!,
windowSticker: body.car!.windowSticker!,
- windowDecoration: body.car!.windowDecoration!
+ lastPlayedAt: body.car!.lastPlayedAt!
}
})
@@ -552,78 +552,78 @@ export default class GameModule extends Module {
console.log('Number of owned reward meter : ' + carItemCount)
let itemIdVal = 0;
if(carItemCount === 0){
- itemIdVal = 1;
+ itemIdVal = 1; // Namco Meter
}
else if(carItemCount === 1){
- itemIdVal = 4;
+ itemIdVal = 4; // Special Meter
}
else if(carItemCount === 2){
- itemIdVal = 7;
+ itemIdVal = 7; // Metal 1 (Black)
}
else if(carItemCount === 3){
- itemIdVal = 8;
+ itemIdVal = 8; // Metal 2 (Red)
}
else if(carItemCount === 4){
- itemIdVal = 9;
+ itemIdVal = 9; // Cyber 1 (Blue)
}
else if(carItemCount === 5){
- itemIdVal = 10;
+ itemIdVal = 10; // Cyber 2 (Red)
}
else if(carItemCount === 6){
- itemIdVal = 11;
+ itemIdVal = 11; // Aluminium 1 (Blue)
}
else if(carItemCount === 7){
- itemIdVal = 12;
+ itemIdVal = 12; // Aluminium 1 (Red)
}
else if(carItemCount === 8){
- itemIdVal = 13;
+ itemIdVal = 13; // Jungle 1 (Green)
}
else if(carItemCount === 9){
- itemIdVal = 14;
+ itemIdVal = 14; // Jungle 2 (Brown)
}
else if(carItemCount === 10){
- itemIdVal = 15;
+ itemIdVal = 15; // Dessert 1 (Red)
}
else if(carItemCount === 11){
- itemIdVal = 16;
+ itemIdVal = 16; // Dessert 2 (Brown)
}
else if(carItemCount === 12){
- itemIdVal = 17;
+ itemIdVal = 17; // Pirate 1 (Red)
}
else if(carItemCount === 13){
- itemIdVal = 18;
+ itemIdVal = 18; // Pirate 2 (Blue)
}
else if(carItemCount === 14){
- itemIdVal = 19;
+ itemIdVal = 19; // Fire Pattern 1 (Red)
}
else if(carItemCount === 15){
- itemIdVal = 20;
+ itemIdVal = 20; // Fire Pattern 2 (Blue)
}
else if(carItemCount === 16){
- itemIdVal = 21;
+ itemIdVal = 21; // Silver Access
}
else if(carItemCount === 17){
- itemIdVal = 22;
+ itemIdVal = 22; // Gold Access
}
else if(carItemCount === 18){
- itemIdVal = 23;
+ itemIdVal = 23; // Steampunk 1 (Gold)
}
else if(carItemCount === 19){
- itemIdVal = 24;
+ itemIdVal = 24; // Steampunk 2 (Green)
}
else if(carItemCount === 20){
- itemIdVal = 25;
+ itemIdVal = 25; // Dragon 1 (Gold)
}
else if(carItemCount === 21){
- itemIdVal = 26;
+ itemIdVal = 26; // Dragon 2 (Blue)
}
else if(carItemCount === 22){
- itemIdVal = 27;
+ itemIdVal = 27; // Light Line 1 (Blue)
}
else if(carItemCount === 23){
- itemIdVal = 28;
+ itemIdVal = 28; // Light Line 2 (Orange)
}
-
+
if(itemIdVal !== 0){
console.log(`carID ${body.carId} do n*100 play, continue give reward... meter ID ${itemIdVal}`);
await prisma.carItem.create({
@@ -710,11 +710,13 @@ export default class GameModule extends Module {
app.post('/method/register_ghost_trail', async (req, res) => {
let body = wm.wm.protobuf.RegisterGhostTrailRequest.decode(req.body);
- //-----------------ONLY CROWN BATTLE FOR NOW-----------------
+
+ // Saving normal ghost and crown ghost trail
let crownBattles: boolean = false;
if(body.time === null || body.time === undefined || body.time === 0){
crownBattles = true;
}
+
let saveEx: any = {};
saveEx.carId = Number(body.ghost!.car.carId!);
saveEx.crownBattle = crownBattles;
@@ -730,31 +732,70 @@ export default class GameModule extends Module {
if(body.trail !== null && body.trail !== undefined){
saveEx.trail = body.trail!;
}
- if(crownBattles === false){
- if(body.time !== null && body.time !== undefined){
- saveEx.time = body.time!;
- }
- if(body.driveData?.data !== null && body.driveData?.data !== undefined){
- saveEx.driveData = body.driveData?.data!;
- }
- if(body.trendBinaryByArea?.data !== null && body.trendBinaryByArea?.data !== undefined){
- saveEx.trendBinaryByArea = body.trendBinaryByArea?.data!;
- }
+ if(body.time !== null && body.time !== undefined){
+ saveEx.time = body.time!;
+ }
+ if(body.driveData?.data !== null && body.driveData?.data !== undefined){
+ saveEx.driveData = body.driveData?.data!;
+ }
+ if(body.driveData?.mergeSerial !== null && body.driveData?.mergeSerial !== undefined){
+ saveEx.driveDMergeSerial = body.driveData?.mergeSerial!;
+ }
+ if(body.trendBinaryByArea?.data !== null && body.trendBinaryByArea?.data !== undefined){
+ saveEx.trendBinaryByArea = body.trendBinaryByArea?.data!;
+ }
+ if(body.trendBinaryByArea?.mergeSerial !== null && body.trendBinaryByArea?.mergeSerial !== undefined){
+ saveEx.byAreaMergeSerial = body.trendBinaryByArea?.mergeSerial!;
+ }
+ if(body.trendBinaryByCar?.data !== null && body.trendBinaryByCar?.data !== undefined){
+ saveEx.trendBinaryByCar = body.trendBinaryByCar?.data!;
+ }
+ if(body.trendBinaryByCar?.mergeSerial !== null && body.trendBinaryByCar?.mergeSerial !== undefined){
+ saveEx.byCarMergeSerial = body.trendBinaryByCar?.mergeSerial!;
+ }
+ if(body.trendBinaryByUser?.data !== null && body.trendBinaryByUser?.data !== undefined){
+ saveEx.trendBinaryByUser = body.trendBinaryByUser?.data!;
+ }
+ if(body.trendBinaryByUser?.mergeSerial !== null && body.trendBinaryByUser?.mergeSerial !== undefined){
+ saveEx.byUserMergeSerial = body.trendBinaryByUser?.mergeSerial!;
}
if(body.ghost?.car.lastPlayedAt !== null && body.ghost?.car.lastPlayedAt !== undefined){
saveEx.playedAt = body.ghost?.car.lastPlayedAt!;
}
+ if(body.ghost?.car.tunePower !== null && body.ghost?.car.tunePower !== undefined){
+ saveEx.tunePower = body.ghost?.car.tunePower!;
+ }
+ if(body.ghost?.car.tuneHandling !== null && body.ghost?.car.tuneHandling !== undefined){
+ saveEx.tuneHandling = body.ghost?.car.tuneHandling!;
+ }
- let gCount = await prisma.ghostTrail.findFirst({
- where:{
- carId: saveEx.carId,
- area: saveEx.area,
- crownBattle: true
- },
- orderBy: {
- playedAt: 'desc'
- }
- });
+ let gCount;
+ if(crownBattles === true){
+ gCount = await prisma.ghostTrail.findFirst({
+ where:{
+ carId: saveEx.carId,
+ area: saveEx.area,
+ crownBattle: true
+ },
+ orderBy: {
+ playedAt: 'desc'
+ }
+ });
+ }
+ else{
+ gCount = await prisma.ghostTrail.findFirst({
+ where:{
+ carId: saveEx.carId,
+ area: saveEx.area,
+ ramp: saveEx.ramp,
+ path: saveEx.path,
+ crownBattle: false
+ },
+ orderBy: {
+ playedAt: 'desc'
+ }
+ });
+ }
if(gCount){
let gdbId = gCount.dbId;
@@ -769,17 +810,18 @@ export default class GameModule extends Module {
data: saveEx
});
- await prisma.carCrown.update({
- where: {
- area: saveEx.area
- },
- data: {
- ramp: saveEx.ramp,
- path: saveEx.path
- }
- });
- //----------------------------------------------------------
-
+ if(crownBattles === true){
+ await prisma.carCrown.update({
+ where: {
+ area: saveEx.area
+ },
+ data: {
+ ramp: saveEx.ramp,
+ path: saveEx.path
+ }
+ });
+ }
+
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS
}
@@ -819,7 +861,7 @@ export default class GameModule extends Module {
numOfOwnedCars: 0,
cars: [],
spappState: wm.wm.protobuf.SmartphoneAppState.SPAPP_UNREGISTERED,
- transferState: wm.wm.protobuf.TransferState.NOT_REGISTERED
+ transferState: wm.wm.protobuf.TransferState.NOT_REGISTERED,
};
if (!body.cardChipId || !body.accessCode) {
let msg = {
@@ -953,7 +995,7 @@ export default class GameModule extends Module {
if (user)
{
// Compare both values using the car order array
- let compare = user?.carOrder.indexOf(a!.carId) - user?.carOrder.indexOf(b!.carId);
+ let compare: number = user?.carOrder.indexOf(a!.carId) - user?.carOrder.indexOf(b!.carId);
// Return the comparison
return compare;
@@ -1011,6 +1053,8 @@ export default class GameModule extends Module {
carStates,
// 5 cars in-game, 200 cars on terminal
cars: user.cars.slice(0, body.maxCars),
+ windowStickerString: user.cars[0].windowStickerString,
+ windowStickerFont: user.cars[0].windowStickerFont,
userId: user.id,
banapassportAmId: 1,
mbId: 1,
@@ -1160,7 +1204,7 @@ export default class GameModule extends Module {
freeScratched: true
}
- let resp = wm.wm.protobuf.LoadDriveInformationResponse.encode(msg);
+ let resp = wm.wm.protobuf.LoadTerminalInformationResponse.encode(msg);
let end = resp.finish();
let r = res
.header('Server', 'v388 wangan')
@@ -1322,7 +1366,10 @@ export default class GameModule extends Module {
name: {
startsWith: String(query.name)
}
- },
+ },
+ include:{
+ gtWing: true
+ }
});
let msg = {
@@ -1636,6 +1683,7 @@ export default class GameModule extends Module {
})
app.post('/method/update_car', async (req, res) => {
+ // Saving car update
let body = wm.wm.protobuf.UpdateCarRequest.decode(req.body);
let car = await prisma.car.findFirst({
where: {
@@ -1646,7 +1694,6 @@ export default class GameModule extends Module {
gtWing: true
}
});
-
let saveEx: any = {};
if (body.car?.customColor !== null && body.car?.customColor !== undefined) {
saveEx.customColor = body.car?.customColor!;
@@ -1763,6 +1810,42 @@ export default class GameModule extends Module {
}
});
+ let userData = await prisma.car.findFirst({
+ where:{
+ carId: body.carId
+ },
+ select:{
+ userId: true,
+ windowStickerString: true
+ }
+ })
+
+ if(userData!.windowStickerString !== saveEx.windowStickerString){
+ await prisma.car.updateMany({
+ where: {
+ userId: userData!.userId
+ },
+ data: {
+ windowStickerString: saveEx.windowStickerString
+ }
+ })
+ }
+
+ // Get car item
+ if(body.earnedItems.length !== 0){
+ console.log('Car Item reward available, continuing ...');
+ for(let i=0; i {
- let msg = {
- error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
- }
- let resp = wm.wm.protobuf.LoadStampTargetResponse.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/create_car', async (req, res) => {
// Get the create car request body
@@ -2048,11 +2102,13 @@ export default class GameModule extends Module {
// Additional basic tune values
additionalInsert = {
+ ghostLevel: 4,
stClearBits: 0,
stLoseBits: 0,
stClearCount: 20,
stClearDivCount: 1,
- stConsecutiveWins: 20
+ stConsecutiveWins: 20,
+ stConsecutiveWinsMax: 20
};
break;
@@ -2070,7 +2126,8 @@ export default class GameModule extends Module {
stLoseBits: 0,
stClearCount: 80,
stClearDivCount: 4,
- stConsecutiveWins: 80
+ stConsecutiveWins: 80,
+ stConsecutiveWinsMax: 80
};
}
@@ -2306,20 +2363,24 @@ export default class GameModule extends Module {
app.post('/method/load_ghost_battle_info', async (req, res) => {
//let body = wm.wm.protobuf.LoadGhostBattleInfoRequest.decode(req.body);
let cars = await prisma.car.findMany({
+ where: {
+ OR: [
+ { name: { startsWith: 'KITSU' }},
+ { name: { startsWith: 'きつ' }},
+ ],
+ },
include:{
gtWing: true
- }
+ },
+ orderBy: {
+ carId: 'asc'
+ },
+ take: 10
});
let lists_stamptarget: wm.wm.protobuf.StampTargetCar[] = [];
- let lengths = 0;
- if(cars.length > 20){
- lengths = 20;
- }
- else{
- lengths = cars.length;
- }
- for(let i=0; i {
- //let body = wm.wm.protobuf.LoadStampTargetRequest.decode(req.body);
- //---------------MAYBE NOT CORRECT---------------
+ let body = wm.wm.protobuf.LoadStampTargetRequest.encode(req.body);
+ console.log(body);
+ let cars = await prisma.car.findMany({
+ where: {
+ OR: [
+ { name: { startsWith: 'KITSU' }},
+ { name: { startsWith: 'きつ' }},
+ ],
+ },
+ include:{
+ gtWing: true
+ },
+ orderBy: {
+ carId: 'asc'
+ },
+ take: 10
+ });
+ let lists_stamptarget: wm.wm.protobuf.StampTargetCar[] = [];
+ for(let i=0; i {
let body = wm.wm.protobuf.SearchCarsByLevelRequest.decode(req.body);
- //---------------MAYBE NOT CORRECT---------------
+ let car = await prisma.car.findMany({
+ where: {
+ ghostLevel: body.ghostLevel
+ },
+ include:{
+ gtWing: true
+ }
+ });
+ //---------------MAYBE NOT CORRECT---------------
let rampVal = 0;
let pathVal = 0;
if(body.area === 0){ //GID_RUNAREA_C1
@@ -2432,13 +2525,58 @@ export default class GameModule extends Module {
rampVal = Math.floor(Math.random() * 2) + 37;
pathVal = Math.floor(Math.random() * 2) + 56;
}
+
+ let lists_ghostcar: wm.wm.protobuf.GhostCar[] = [];
+ let arr = [];
+ let maxNumber = 0;
+ if(car.length > 10){
+ maxNumber = 10
+ }
+ else{
+ maxNumber = car.length;
+ }
+ while(arr.length < maxNumber){
+ let randomNumber: number = Math.floor(Math.random() * car.length);
+ if(arr.indexOf(randomNumber) === -1){
+ arr.push(randomNumber);
+ let ghost_trails = await prisma.ghostTrail.findFirst({
+ where: {
+ carId: car[randomNumber].carId,
+ area: body.area,
+ crownBattle: false
+ },
+ orderBy: {
+ playedAt: 'desc'
+ }
+ });
+ if(car[randomNumber]!.regionId === 0){
+ car[randomNumber].regionId = 1; // Hokkaido
+ }
+ if(!(ghost_trails)){
+ lists_ghostcar.push(wm.wm.protobuf.GhostCar.create({
+ car: car[randomNumber]
+ }));
+ }
+ else{
+ car[randomNumber].tunePower = ghost_trails!.tunePower;
+ car[randomNumber].tuneHandling = ghost_trails!.tuneHandling;
+
+ lists_ghostcar.push(wm.wm.protobuf.GhostCar.create({
+ car: car[randomNumber],
+ nonhuman: false,
+ type: wm.wm.protobuf.GhostType.GHOST_NORMAL,
+ trailId: ghost_trails!.dbId!
+ }));
+ }
+ }
+ }
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
ramp: rampVal,
path: pathVal,
- selectionMethod: 2,
+ ghosts: lists_ghostcar,
+ selectionMethod: Number(wm.wm.protobuf.GhostSelectionMethod.GHOST_SELECT_BY_LEVEL)
};
- //-----------------------------------------------
let resp = wm.wm.protobuf.SearchCarsByLevelResponse.encode(msg);
let end = resp.finish();
let r = res
@@ -2451,12 +2589,67 @@ export default class GameModule extends Module {
app.post('/method/load_ghost_drive_data', async (req, res) => {
let body = wm.wm.protobuf.LoadGhostDriveDataRequest.decode(req.body);
- //---------------MAYBE NOT CORRECT---------------
+ let path = body.path;
+
+ let lists_ghostcar: wm.wm.protobuf.LoadGhostDriveDataResponse.GhostDriveData[] = [];
+ for(let i=0; i {
- //let body = wmsrv.wm.protobuf.LockCrownRequest.decode(req.body);
- //---------------MAYBE NOT CORRECT---------------
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
- //-----------------------------------------------
let resp = wmsrv.wm.protobuf.LockCrownResponse.encode(msg);
let end = resp.finish();
let r = res
@@ -2485,12 +2675,9 @@ export default class GameModule extends Module {
})
app.post('/method/save_charge', (req, res) => {
- //let body = wm.wm.protobuf.SaveChargeResponse.decode(req.body);
- //---------------MAYBE NOT CORRECT---------------
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
- //-----------------------------------------------
let resp = wm.wm.protobuf.SaveChargeResponse.encode(msg);
let end = resp.finish();
let r = res
@@ -2504,7 +2691,6 @@ export default class GameModule extends Module {
app.get('/resource/ghost_trail', async (req, res) => {
let pCarId = Number(req.query.car_id);
let pArea = Number(req.query.area);
-
let ghost_trails = await prisma.ghostTrail.findFirst({
where: {
carId: pCarId,
@@ -2513,22 +2699,28 @@ export default class GameModule extends Module {
},
orderBy: {
playedAt: 'desc'
- },
+ }
});
- //---------------MAYBE NOT CORRECT---------------
- let rampVal = ghost_trails!.ramp;
- let pathVal = ghost_trails!.path;
-
- let msg;
+ let rampVal = 0;
+ let pathVal = 0;
+ let playedAt = 0;
+ let ghostTrail: Uint8Array;
+
if(ghost_trails){
- msg = {
- carId: pCarId,
- area: pArea,
- ramp: rampVal,
- path: pathVal,
- playedAt: ghost_trails!.playedAt,
- trail: new Uint8Array(ghost_trails!.trail)
- };
+ rampVal = ghost_trails!.ramp;
+ pathVal = ghost_trails!.path;
+
+ let time = await prisma.carCrown.findFirst({
+ where: {
+ carId: pCarId,
+ area: pArea
+ },
+ orderBy: {
+ playedAt: 'desc'
+ }
+ });
+ playedAt = time!.playedAt;
+ ghostTrail = ghost_trails!.trail;
}
else{
if(pArea === 0){ //GID_RUNAREA_C1
@@ -2596,18 +2788,18 @@ export default class GameModule extends Module {
rampVal = Math.floor(Math.random() * 2) + 37;
pathVal = Math.floor(Math.random() * 2) + 56;
}
- let trails = new Uint8Array([1, 2, 3, 4]);
- msg = {
- carId: pCarId,
- area: pArea,
- ramp: rampVal,
- path: pathVal,
- playedAt: 0,
- trail: trails
- };
+ ghostTrail = new Uint8Array([1, 2, 3, 4]);
}
+
+ let msg = {
+ carId: pCarId,
+ area: pArea,
+ ramp: rampVal,
+ path: pathVal,
+ playedAt: playedAt,
+ trail: ghostTrail
+ };
- //-----------------------------------------------
let resp = wm.wm.protobuf.GhostTrail.encode(msg);
let end = resp.finish();
let r = res
@@ -2618,14 +2810,12 @@ export default class GameModule extends Module {
r.send(Buffer.from(end));
})
- app.get('/method/load_paths_and_tunings', async (req, res) => {
+ app.post('/method/load_paths_and_tunings', async (req, res) => {
let body = wm.wm.protobuf.LoadPathsAndTuningsRequest.decode(req.body);
console.log(body);
- //---------------MAYBE NOT CORRECT---------------
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
- //-----------------------------------------------
let resp = wm.wm.protobuf.LoadPathsAndTuningsResponse.encode(msg);
let end = resp.finish();
let r = res
diff --git a/src/modules/startup.ts b/src/modules/startup.ts
index 865efcf..3b1479a 100644
--- a/src/modules/startup.ts
+++ b/src/modules/startup.ts
@@ -66,9 +66,9 @@ export default class StartupModule extends Module {
orderBy: {
time: 'asc'
},
- take: 20,
+ take: 10,
});
- if(ta_time.length !== 0){
+ if(ta_time.length > 0){
let list_ta: wmsrv.wm.protobuf.Ranking.Entry[] = [];
for(let j=0; j {
console.log('crown_list');
- //-------------FOR TESTING PURPOSE---------------
let list_crown: wmsrv.wm.protobuf.Crown[] = [];
- /*let car_crown = await prisma.car.findFirst({
- where: {
- OR: [
- { name: { startsWith: 'KITSU'}, visualModel: 32 },
- { name: { startsWith: 'きつ', }, visualModel: 32 },
- ],
- },
- include: {
- gtWing: true
- },
- orderBy: {
- carId: 'asc'
- }
- });*/
let car_crown = await prisma.carCrown.findMany({
orderBy: {
area: 'asc'
@@ -287,10 +300,10 @@ export default class StartupModule extends Module {
if(car!.regionId === 0){
car!.regionId = 1; // Hokkaido
}
- //car!.aura = 0;
+ car!.aura = 0;
car!.tunePower = car_crown[counter].tunePower;
car!.tuneHandling = car_crown[counter].tuneHandling;
- car!.lastPlayedAt = car_crown[counter].playedAt - 100000;
+ car!.lastPlayedAt = 1659286800;
list_crown.push(wmsrv.wm.protobuf.Crown.create({
carId: car_crown[counter].carId,
area: car_crown[counter].area, // GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE & GID_RUNAREA_HIROSHIMA
@@ -312,25 +325,21 @@ export default class StartupModule extends Module {
}
}
else{
- for(let i=0; i<14; i++){
+ for(let i=0; i<19; i++){
+ if(i >= 14){
+ i = 18;
+ }
list_crown.push(wmsrv.wm.protobuf.Crown.create({
carId: i,
- area: i, // GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE
+ area: i, // GID_RUNAREA_C1 - GID_RUNAREA_TURNPIKE & GID_RUNAREA_HIROSHIMA
unlockAt: 0,
}));
}
- list_crown.push(wmsrv.wm.protobuf.Crown.create({
- carId: 18,
- area: 18, // GID_RUNAREA_HIROSHIMA
- unlockAt: 0,
- }));
}
let msg = {
crowns: list_crown
};
- //-----------------------------------------------
-
let resp = wmsrv.wm.protobuf.CrownList.encode(msg);
let end = resp.finish();
let r = res
From bf0c4716eb888145dc0344fc6c68a393218d4520 Mon Sep 17 00:00:00 2001
From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com>
Date: Thu, 4 Aug 2022 14:26:37 +0700
Subject: [PATCH 2/8] aura enabled again.. confimed english patch bug
---
src/modules/startup.ts | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/modules/startup.ts b/src/modules/startup.ts
index 3b1479a..7e0e730 100644
--- a/src/modules/startup.ts
+++ b/src/modules/startup.ts
@@ -300,7 +300,6 @@ export default class StartupModule extends Module {
if(car!.regionId === 0){
car!.regionId = 1; // Hokkaido
}
- car!.aura = 0;
car!.tunePower = car_crown[counter].tunePower;
car!.tuneHandling = car_crown[counter].tuneHandling;
car!.lastPlayedAt = 1659286800;
@@ -350,4 +349,4 @@ export default class StartupModule extends Module {
r.send(Buffer.from(end));
})
}
-}
\ No newline at end of file
+}
From 488f530df192d7f34ff938eb1cd1921293f35858 Mon Sep 17 00:00:00 2001
From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com>
Date: Thu, 4 Aug 2022 19:14:26 +0700
Subject: [PATCH 3/8] ghost battle history
---
.../migration.sql | 30 +++
prisma/schema.prisma | 24 +++
src/modules/game.ts | 187 +++++++++++++++++-
src/modules/startup.ts | 3 +-
4 files changed, 240 insertions(+), 4 deletions(-)
create mode 100644 prisma/migrations/20220804052450_ghost_battle_record/migration.sql
diff --git a/prisma/migrations/20220804052450_ghost_battle_record/migration.sql b/prisma/migrations/20220804052450_ghost_battle_record/migration.sql
new file mode 100644
index 0000000..d22d79d
--- /dev/null
+++ b/prisma/migrations/20220804052450_ghost_battle_record/migration.sql
@@ -0,0 +1,30 @@
+-- AlterTable
+ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0;
+
+-- CreateTable
+CREATE TABLE "GhostBattleRecord" (
+ "dbId" SERIAL NOT NULL,
+ "carId" INTEGER NOT NULL,
+ "tunePower" INTEGER NOT NULL DEFAULT 0,
+ "tuneHandling" INTEGER NOT NULL DEFAULT 0,
+ "opponent1CarId" INTEGER NOT NULL,
+ "opponent1Result" INTEGER NOT NULL,
+ "opponent1TunePower" INTEGER NOT NULL,
+ "opponent1TuneHandling" INTEGER NOT NULL,
+ "opponent2CarId" INTEGER,
+ "opponent2Result" INTEGER,
+ "opponent2TunePower" INTEGER,
+ "opponent2TuneHandling" INTEGER,
+ "opponent3CarId" INTEGER,
+ "opponent3Result" INTEGER,
+ "opponent3TunePower" INTEGER,
+ "opponent3TuneHandling" INTEGER,
+ "area" INTEGER NOT NULL DEFAULT 0,
+ "playedAt" INTEGER NOT NULL DEFAULT 0,
+ "playedShopName" TEXT NOT NULL DEFAULT 'Bayshore',
+
+ CONSTRAINT "GhostBattleRecord_pkey" PRIMARY KEY ("dbId")
+);
+
+-- AddForeignKey
+ALTER TABLE "GhostBattleRecord" ADD CONSTRAINT "GhostBattleRecord_carId_fkey" FOREIGN KEY ("carId") REFERENCES "Car"("carId") ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 81bcbd8..0dca4a4 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -132,6 +132,7 @@ model Car {
TimeAttackRecord TimeAttackRecord[]
CarCrown CarCrown[]
GhostTrail GhostTrail[]
+ GhostBattleRecord GhostBattleRecord[]
}
model CarGTWing {
@@ -236,3 +237,26 @@ model GhostTrail {
tuneHandling Int @default(0)
crownBattle Boolean @default(false)
}
+
+model GhostBattleRecord {
+ dbId Int @id @default(autoincrement())
+ car Car @relation(fields: [carId], references: [carId])
+ carId Int
+ tunePower Int @default(0)
+ tuneHandling Int @default(0)
+ opponent1CarId Int
+ opponent1Result Int
+ opponent1TunePower Int
+ opponent1TuneHandling Int
+ opponent2CarId Int?
+ opponent2Result Int?
+ opponent2TunePower Int?
+ opponent2TuneHandling Int?
+ opponent3CarId Int?
+ opponent3Result Int?
+ opponent3TunePower Int?
+ opponent3TuneHandling Int?
+ area Int @default(0)
+ playedAt Int @default(0)
+ playedShopName String @default("Bayshore")
+}
diff --git a/src/modules/game.ts b/src/modules/game.ts
index 7f8e5ae..5ac9c82 100644
--- a/src/modules/game.ts
+++ b/src/modules/game.ts
@@ -399,6 +399,92 @@ export default class GameModule extends Module {
}
}
}
+
+ let saveExGhostHistory: any = {};
+ if (body.car?.carId !== null && body.car?.carId !== undefined) {
+ saveExGhostHistory.carId = body.car?.carId!;
+ }
+ if (body.car?.tunePower !== null && body.car?.tunePower !== undefined) {
+ saveExGhostHistory.tunePower = body.car?.tunePower!;
+ }
+ if (body.car?.tuneHandling !== null && body.car?.tuneHandling !== undefined) {
+ saveExGhostHistory.tuneHandling = body.car?.tuneHandling!;
+ }
+ for(let i=0; i= 0 && body.rgResult?.path <= 9){ // GID_PATH_C1
+ saveExGhostHistory.area = Number(0);
+ }
+ else if(body.rgResult?.path >= 10 && body.rgResult?.path <= 15){ // GID_PATH_N9
+ saveExGhostHistory.area = Number(1);
+ }
+ else if(body.rgResult?.path >= 16 && body.rgResult?.path <= 17){ // GID_PATH_WTEAST
+ saveExGhostHistory.area = Number(2);
+ }
+ else if(body.rgResult?.path >= 18 && body.rgResult?.path <= 19){ // GID_PATH_WT_UP_DOWN
+ saveExGhostHistory.area = Number(3);
+ }
+ else if(body.rgResult?.path >= 20 && body.rgResult?.path <= 26){ // GID_PATH_WG
+ saveExGhostHistory.area = Number(4);
+ }
+ else if(body.rgResult?.path >= 27 && body.rgResult?.path <= 33){ // GID_PATH_KG
+ saveExGhostHistory.area = Number(5);
+ }
+ else if(body.rgResult?.path >= 34 && body.rgResult?.path <= 37){ // GID_PATH_YS
+ saveExGhostHistory.area = Number(6);
+ }
+ else if(body.rgResult?.path >= 38 && body.rgResult?.path <= 48){ // GID_PATH_KG_SHINYAMASHITA_MINATOMIRAI
+ saveExGhostHistory.area = Number(7);
+ }
+ else if(body.rgResult?.path === 49){ // GID_PATH_NGR
+ saveExGhostHistory.area = Number(8);
+ }
+ else if(body.rgResult?.path >= 50 && body.rgResult?.path <= 53){ // GID_PATH_OS
+ saveExGhostHistory.area = Number(9);
+ }
+ else if(body.rgResult?.path >= 54 && body.rgResult?.path <= 55){ // GID_PATH_KB
+ saveExGhostHistory.area = Number(10);
+ }
+ else if(body.rgResult?.path >= 58 && body.rgResult?.path <= 61){ // GID_PATH_FK
+ saveExGhostHistory.area = Number(11);
+ }
+ else if(body.rgResult?.path >= 62 && body.rgResult?.path <= 63){ // GID_PATH_HK
+ saveExGhostHistory.area = Number(12);
+ }
+ else if(body.rgResult?.path >= 64 && body.rgResult?.path <= 65){ // GID_PATH_TP
+ saveExGhostHistory.area = Number(13);
+ }
+ else if(body.rgResult?.path >= 56 && body.rgResult?.path <= 57){ // GID_PATH_HS
+ saveExGhostHistory.area = Number(18);
+ }
+ }
+ saveExGhostHistory.playedShopName = 'Bayshore';
+
+ await prisma.ghostBattleRecord.create({
+ data: saveExGhostHistory
+ });
}
break;
}
@@ -2323,12 +2409,109 @@ export default class GameModule extends Module {
}));
}
+ let ghostHistoryData = await prisma.ghostBattleRecord.findMany({
+ where: {
+ carId: body.carId
+ },
+ orderBy: {
+ playedAt: 'asc'
+ },
+ take: 3
+ });
+
+ let list_ghostHistoryData: wm.wm.protobuf.LoadGameHistoryResponse.GhostBattleRecord[] = [];
+ for(let i=0; i
Date: Fri, 5 Aug 2022 10:46:29 +0700
Subject: [PATCH 4/8] load ghost car by path and tuning
---
.../migration.sql | 18 ++++
.../migration.sql | 5 ++
prisma/schema.prisma | 13 +++
src/modules/game.ts | 87 +++++++++++++++++--
4 files changed, 118 insertions(+), 5 deletions(-)
create mode 100644 prisma/migrations/20220805024317_car_path_and_tuning/migration.sql
create mode 100644 prisma/migrations/20220805033246_car_path_and_tuning_2/migration.sql
diff --git a/prisma/migrations/20220805024317_car_path_and_tuning/migration.sql b/prisma/migrations/20220805024317_car_path_and_tuning/migration.sql
new file mode 100644
index 0000000..003d3ef
--- /dev/null
+++ b/prisma/migrations/20220805024317_car_path_and_tuning/migration.sql
@@ -0,0 +1,18 @@
+-- AlterTable
+ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0;
+
+-- CreateTable
+CREATE TABLE "CarPathandTuning" (
+ "dbId" SERIAL NOT NULL,
+ "carId" INTEGER NOT NULL,
+ "area" INTEGER NOT NULL DEFAULT 0,
+ "ramp" INTEGER NOT NULL DEFAULT 0,
+ "path" INTEGER NOT NULL DEFAULT 0,
+ "tunePower" INTEGER NOT NULL DEFAULT 17,
+ "tuneHandling" INTEGER NOT NULL DEFAULT 17,
+
+ CONSTRAINT "CarPathandTuning_pkey" PRIMARY KEY ("dbId")
+);
+
+-- AddForeignKey
+ALTER TABLE "CarPathandTuning" ADD CONSTRAINT "CarPathandTuning_carId_fkey" FOREIGN KEY ("carId") REFERENCES "Car"("carId") ON DELETE RESTRICT ON UPDATE CASCADE;
diff --git a/prisma/migrations/20220805033246_car_path_and_tuning_2/migration.sql b/prisma/migrations/20220805033246_car_path_and_tuning_2/migration.sql
new file mode 100644
index 0000000..4d2f2a3
--- /dev/null
+++ b/prisma/migrations/20220805033246_car_path_and_tuning_2/migration.sql
@@ -0,0 +1,5 @@
+-- AlterTable
+ALTER TABLE "Car" ALTER COLUMN "stLoseBits" SET DEFAULT 0;
+
+-- AlterTable
+ALTER TABLE "CarPathandTuning" ADD COLUMN "lastPlayedAt" INTEGER NOT NULL DEFAULT 0;
diff --git a/prisma/schema.prisma b/prisma/schema.prisma
index 0dca4a4..8930875 100644
--- a/prisma/schema.prisma
+++ b/prisma/schema.prisma
@@ -133,6 +133,7 @@ model Car {
CarCrown CarCrown[]
GhostTrail GhostTrail[]
GhostBattleRecord GhostBattleRecord[]
+ CarPathandTuning CarPathandTuning[]
}
model CarGTWing {
@@ -260,3 +261,15 @@ model GhostBattleRecord {
playedAt Int @default(0)
playedShopName String @default("Bayshore")
}
+
+model CarPathandTuning {
+ dbId Int @id @default(autoincrement())
+ car Car @relation(fields: [carId], references: [carId])
+ carId Int
+ area Int @default(0)
+ ramp Int @default(0)
+ path Int @default(0)
+ tunePower Int @default(17)
+ tuneHandling Int @default(17)
+ lastPlayedAt Int @default(0)
+}
diff --git a/src/modules/game.ts b/src/modules/game.ts
index 5ac9c82..aed5575 100644
--- a/src/modules/game.ts
+++ b/src/modules/game.ts
@@ -3,7 +3,7 @@ import { Module } from "../module";
import * as wm from "../wmmt/wm.proto";
import * as wmsrv from "../wmmt/service.proto";
import { prisma } from "..";
-import { Car, User } from "@prisma/client";
+import { Car, CarPathandTuning, User } from "@prisma/client";
import { Config } from "../config";
import Long from "long";
import { userInfo } from "os";
@@ -891,11 +891,41 @@ export default class GameModule extends Module {
}
});
}
-
await prisma.ghostTrail.create({
data: saveEx
});
+
+ let cPaT_count = await prisma.carPathandTuning.findFirst({
+ where:{
+ carId: saveEx.carId,
+ area: saveEx.area,
+ },
+ orderBy: {
+ lastPlayedAt: 'desc'
+ }
+ });
+
+ if(cPaT_count){
+ let cPaTdbId = cPaT_count.dbId;
+ await prisma.ghostTrail.delete({
+ where: {
+ dbId: cPaTdbId
+ }
+ });
+ }
+ await prisma.carPathandTuning.create({
+ data: {
+ carId: saveEx.carId,
+ area: saveEx.area,
+ ramp: saveEx.ramp,
+ path: saveEx.path,
+ tunePower: saveEx.tunePower,
+ tuneHandling: saveEx.tuneHandling,
+ lastPlayedAt: saveEx.playedAt
+ }
+ });
+
if(crownBattles === true){
await prisma.carCrown.update({
where: {
@@ -2436,6 +2466,8 @@ export default class GameModule extends Module {
if(!(ghostOpponentCar)){
ghostOpponentCar = await prisma.car.findFirst({});
ghostOpponentCar!.name = 'GUEST';
+ ghostOpponentCar!.manufacturer = 5;
+ ghostOpponentCar!.model = 27;
ghostOpponentCar!.visualModel = 29;
}
ghostOpponentCar!.regionId = 1;
@@ -2460,6 +2492,8 @@ export default class GameModule extends Module {
if(!(ghostOpponentCar2)){
ghostOpponentCar2 = await prisma.car.findFirst({});
ghostOpponentCar2!.name = 'GUEST';
+ ghostOpponentCar2!.manufacturer = 5;
+ ghostOpponentCar2!.model = 27;
ghostOpponentCar2!.visualModel = 29;
}
ghostOpponentCar2!.regionId = 1;
@@ -2481,6 +2515,8 @@ export default class GameModule extends Module {
if(!(ghostOpponentCar3)){
ghostOpponentCar3 = await prisma.car.findFirst({});
ghostOpponentCar3!.name = 'GUEST';
+ ghostOpponentCar3!.manufacturer = 5;
+ ghostOpponentCar3!.model = 27;
ghostOpponentCar3!.visualModel = 29;
}
ghostOpponentCar3!.regionId = 1;
@@ -2493,7 +2529,6 @@ export default class GameModule extends Module {
result: ghostHistoryData![i].opponent3Result!
}));
}
-
list_ghostHistoryData.push(wm.wm.protobuf.LoadGameHistoryResponse.GhostBattleRecord.create({
carSetting: carSetings,
@@ -2526,7 +2561,6 @@ export default class GameModule extends Module {
})
app.post('/method/update_user_session', (req, res) => {
- // Get the request body
// let body = wm.wm.protobuf.UpdateUserSessionRequest.decode(req.body);
let msg = {
@@ -2995,9 +3029,52 @@ export default class GameModule extends Module {
app.post('/method/load_paths_and_tunings', async (req, res) => {
let body = wm.wm.protobuf.LoadPathsAndTuningsRequest.decode(req.body);
- console.log(body);
+ let carTbyP: wm.wm.protobuf.LoadPathsAndTuningsResponse.CarTuningsByPath[] = [];
+ for(let j=0; j<14; j++){
+ let carTuning: wm.wm.protobuf.CarTuning[] = [];
+ let pathAndTuning: CarPathandTuning | null;
+ let carTbyP_ramp = Math.floor(Math.random() * 10);
+ let carTbyP_path = Math.floor(Math.random() * 10);
+ for(let i=0; i
Date: Fri, 5 Aug 2022 11:52:38 +0700
Subject: [PATCH 5/8] load ghost car by path and tuning
---
src/modules/game.ts | 154 +++++++++++++++++++++++++++++++++++---------
1 file changed, 123 insertions(+), 31 deletions(-)
diff --git a/src/modules/game.ts b/src/modules/game.ts
index aed5575..6eae103 100644
--- a/src/modules/game.ts
+++ b/src/modules/game.ts
@@ -856,7 +856,7 @@ export default class GameModule extends Module {
}
let gCount;
- if(crownBattles === true){
+ if(crownBattles === true){ // Crown Ghost Battle
gCount = await prisma.ghostTrail.findFirst({
where:{
carId: saveEx.carId,
@@ -868,7 +868,7 @@ export default class GameModule extends Module {
}
});
}
- else{
+ else{ // Normal Ghost Battle
gCount = await prisma.ghostTrail.findFirst({
where:{
carId: saveEx.carId,
@@ -883,18 +883,20 @@ export default class GameModule extends Module {
});
}
- if(gCount){
+ if(gCount){ // Record exist, update it
let gdbId = gCount.dbId;
- await prisma.ghostTrail.delete({
+ await prisma.ghostTrail.update({
where: {
dbId: gdbId
- }
+ },
+ data: saveEx
+ });
+ }
+ else{ // Record does not exist, create new
+ await prisma.ghostTrail.create({
+ data: saveEx
});
}
- await prisma.ghostTrail.create({
- data: saveEx
- });
-
let cPaT_count = await prisma.carPathandTuning.findFirst({
where:{
@@ -906,27 +908,38 @@ export default class GameModule extends Module {
}
});
- if(cPaT_count){
+ if(cPaT_count){ // Record exist, update it
let cPaTdbId = cPaT_count.dbId;
- await prisma.ghostTrail.delete({
+ await prisma.carPathandTuning.update({
where: {
dbId: cPaTdbId
+ },
+ data:{
+ carId: saveEx.carId,
+ area: saveEx.area,
+ ramp: saveEx.ramp,
+ path: saveEx.path,
+ tunePower: saveEx.tunePower,
+ tuneHandling: saveEx.tuneHandling,
+ lastPlayedAt: saveEx.playedAt
+ }
+ });
+ }
+ else{ // Record does not exist, create new
+ await prisma.carPathandTuning.create({
+ data: {
+ carId: saveEx.carId,
+ area: saveEx.area,
+ ramp: saveEx.ramp,
+ path: saveEx.path,
+ tunePower: saveEx.tunePower,
+ tuneHandling: saveEx.tuneHandling,
+ lastPlayedAt: saveEx.playedAt
}
});
}
- await prisma.carPathandTuning.create({
- data: {
- carId: saveEx.carId,
- area: saveEx.area,
- ramp: saveEx.ramp,
- path: saveEx.path,
- tunePower: saveEx.tunePower,
- tuneHandling: saveEx.tuneHandling,
- lastPlayedAt: saveEx.playedAt
- }
- });
- if(crownBattles === true){
+ if(crownBattles === true){ // Update randomized ramp and path to the correct one
await prisma.carCrown.update({
where: {
area: saveEx.area
@@ -3031,10 +3044,77 @@ export default class GameModule extends Module {
let body = wm.wm.protobuf.LoadPathsAndTuningsRequest.decode(req.body);
let carTbyP: wm.wm.protobuf.LoadPathsAndTuningsResponse.CarTuningsByPath[] = [];
for(let j=0; j<14; j++){
+ let rampVal = 0;
+ let pathVal = 0;
+ let rampPathUsingGhostRecord: boolean = false;
+ if(j === 0){ //GID_RUNAREA_C1
+ rampVal = Math.floor(Math.random() * 4);
+ pathVal = Math.floor(Math.random() * 10);
+ }
+ else if(j === 1){ //GID_RUNAREA_RING
+ rampVal = Math.floor(Math.random() * 2) + 4;
+ pathVal = Math.floor(Math.random() * 6) + 10;
+ }
+ else if(j === 2){ //GID_RUNAREA_SUBTOKYO_3_4
+ rampVal = Math.floor(Math.random() * 2) + 6;
+ pathVal = Math.floor(Math.random() * 2) + 16;
+ }
+ else if(j === 3){ //GID_RUNAREA_SUBTOKYO_5
+ rampVal = Math.floor(Math.random() * 2) + 8;
+ pathVal = Math.floor(Math.random() * 2) + 18;
+ }
+ else if(j === 4){ //GID_RUNAREA_WANGAN
+ rampVal = Math.floor(Math.random() * 4) + 10;
+ pathVal = Math.floor(Math.random() * 7) + 20;
+ }
+ else if(j === 5){ //GID_RUNAREA_K1
+ rampVal = Math.floor(Math.random() * 4) + 14;
+ pathVal = Math.floor(Math.random() * 7) + 27;
+ }
+ else if(j === 6){ //GID_RUNAREA_YAESU
+ rampVal = Math.floor(Math.random() * 3) + 18;
+ pathVal = Math.floor(Math.random() * 4) + 34;
+ }
+ else if(j === 7){ //GID_RUNAREA_YOKOHAMA
+ rampVal = Math.floor(Math.random() * 4) + 21;
+ pathVal = Math.floor(Math.random() * 11) + 38;
+ }
+ else if(j === 8){ //GID_RUNAREA_NAGOYA
+ rampVal = 25;
+ pathVal = 49;
+ }
+ else if(j === 9){ //GID_RUNAREA_OSAKA
+ rampVal = 26;
+ pathVal = Math.floor(Math.random() * 4) + 50;
+ }
+ else if(j === 10){ //GID_RUNAREA_KOBE
+ rampVal = Math.floor(Math.random() * 2) + 27;
+ pathVal = Math.floor(Math.random() * 2) + 54;
+ }
+ else if(j === 11){ //GID_RUNAREA_FUKUOKA
+ rampVal = Math.floor(Math.random() * 4) + 29;
+ pathVal = Math.floor(Math.random() * 4) + 58;
+ }
+ else if(j === 12){ //GID_RUNAREA_HAKONE
+ rampVal = Math.floor(Math.random() * 2) + 33;
+ pathVal = Math.floor(Math.random() * 2) + 62;
+ }
+ else if(j === 13){ //GID_RUNAREA_TURNPIKE
+ rampVal = Math.floor(Math.random() * 2) + 35;
+ pathVal = Math.floor(Math.random() * 2) + 64;
+ }
+ //14 - 16 are dummy area
+ else if(j === 17){ //GID_RUNAREA_C1_CLOSED
+ rampVal = Math.floor(Math.random() * 4);
+ pathVal = Math.floor(Math.random() * 10); //probably not correct
+ }
+ else if(j === 18){ //GID_RUNAREA_HIROSHIMA
+ rampVal = Math.floor(Math.random() * 2) + 37;
+ pathVal = Math.floor(Math.random() * 2) + 56;
+ }
+
let carTuning: wm.wm.protobuf.CarTuning[] = [];
let pathAndTuning: CarPathandTuning | null;
- let carTbyP_ramp = Math.floor(Math.random() * 10);
- let carTbyP_path = Math.floor(Math.random() * 10);
for(let i=0; i
Date: Fri, 5 Aug 2022 13:15:21 +0700
Subject: [PATCH 6/8] load ghost car by path and tuning
---
src/modules/game.ts | 104 ++++++++--------
src/util/scratch.ts | 290 +++++++++++++++++++++++++++++---------------
2 files changed, 243 insertions(+), 151 deletions(-)
diff --git a/src/modules/game.ts b/src/modules/game.ts
index 6eae103..79f7e7e 100644
--- a/src/modules/game.ts
+++ b/src/modules/game.ts
@@ -2690,68 +2690,68 @@ export default class GameModule extends Module {
//---------------MAYBE NOT CORRECT---------------
let rampVal = 0;
let pathVal = 0;
- if(body.area === 0){ //GID_RUNAREA_C1
+ if(body.area === 0){ // GID_RUNAREA_C1
rampVal = Math.floor(Math.random() * 4);
pathVal = Math.floor(Math.random() * 10);
}
- else if(body.area === 1){ //GID_RUNAREA_RING
+ else if(body.area === 1){ // GID_RUNAREA_RING
rampVal = Math.floor(Math.random() * 2) + 4;
pathVal = Math.floor(Math.random() * 6) + 10;
}
- else if(body.area === 2){ //GID_RUNAREA_SUBTOKYO_3_4
+ else if(body.area === 2){ // GID_RUNAREA_SUBTOKYO_3_4
rampVal = Math.floor(Math.random() * 2) + 6;
pathVal = Math.floor(Math.random() * 2) + 16;
}
- else if(body.area === 3){ //GID_RUNAREA_SUBTOKYO_5
+ else if(body.area === 3){ // GID_RUNAREA_SUBTOKYO_5
rampVal = Math.floor(Math.random() * 2) + 8;
pathVal = Math.floor(Math.random() * 2) + 18;
}
- else if(body.area === 4){ //GID_RUNAREA_WANGAN
+ else if(body.area === 4){ // GID_RUNAREA_WANGAN
rampVal = Math.floor(Math.random() * 4) + 10;
pathVal = Math.floor(Math.random() * 7) + 20;
}
- else if(body.area === 5){ //GID_RUNAREA_K1
+ else if(body.area === 5){ // GID_RUNAREA_K1
rampVal = Math.floor(Math.random() * 4) + 14;
pathVal = Math.floor(Math.random() * 7) + 27;
}
- else if(body.area === 6){ //GID_RUNAREA_YAESU
+ else if(body.area === 6){ // GID_RUNAREA_YAESU
rampVal = Math.floor(Math.random() * 3) + 18;
pathVal = Math.floor(Math.random() * 4) + 34;
}
- else if(body.area === 7){ //GID_RUNAREA_YOKOHAMA
+ else if(body.area === 7){ // GID_RUNAREA_YOKOHAMA
rampVal = Math.floor(Math.random() * 4) + 21;
pathVal = Math.floor(Math.random() * 11) + 38;
}
- else if(body.area === 8){ //GID_RUNAREA_NAGOYA
+ else if(body.area === 8){ // GID_RUNAREA_NAGOYA
rampVal = 25;
pathVal = 49;
}
- else if(body.area === 9){ //GID_RUNAREA_OSAKA
+ else if(body.area === 9){ // GID_RUNAREA_OSAKA
rampVal = 26;
pathVal = Math.floor(Math.random() * 4) + 50;
}
- else if(body.area === 10){ //GID_RUNAREA_KOBE
+ else if(body.area === 10){ // GID_RUNAREA_KOBE
rampVal = Math.floor(Math.random() * 2) + 27;
pathVal = Math.floor(Math.random() * 2) + 54;
}
- else if(body.area === 11){ //GID_RUNAREA_FUKUOKA
+ else if(body.area === 11){ // GID_RUNAREA_FUKUOKA
rampVal = Math.floor(Math.random() * 4) + 29;
pathVal = Math.floor(Math.random() * 4) + 58;
}
- else if(body.area === 12){ //GID_RUNAREA_HAKONE
+ else if(body.area === 12){ // GID_RUNAREA_HAKONE
rampVal = Math.floor(Math.random() * 2) + 33;
pathVal = Math.floor(Math.random() * 2) + 62;
}
- else if(body.area === 13){ //GID_RUNAREA_TURNPIKE
+ else if(body.area === 13){ // GID_RUNAREA_TURNPIKE
rampVal = Math.floor(Math.random() * 2) + 35;
pathVal = Math.floor(Math.random() * 2) + 64;
}
//14 - 16 are dummy area
- else if(body.area === 17){ //GID_RUNAREA_C1_CLOSED
+ else if(body.area === 17){ // GID_RUNAREA_C1_CLOSED
rampVal = Math.floor(Math.random() * 4);
- pathVal = Math.floor(Math.random() * 10); //probably not correct
+ pathVal = Math.floor(Math.random() * 10); // probably not correct
}
- else if(body.area === 18){ //GID_RUNAREA_HIROSHIMA
+ else if(body.area === 18){ // GID_RUNAREA_HIROSHIMA
rampVal = Math.floor(Math.random() * 2) + 37;
pathVal = Math.floor(Math.random() * 2) + 56;
}
@@ -2953,72 +2953,72 @@ export default class GameModule extends Module {
ghostTrail = ghost_trails!.trail;
}
else{
- if(pArea === 0){ //GID_RUNAREA_C1
+ if(pArea === 0){ // GID_RUNAREA_C1
rampVal = Math.floor(Math.random() * 4);
pathVal = Math.floor(Math.random() * 10);
}
- else if(pArea === 1){ //GID_RUNAREA_RING
+ else if(pArea === 1){ // GID_RUNAREA_RING
rampVal = Math.floor(Math.random() * 2) + 4;
pathVal = Math.floor(Math.random() * 6) + 10;
}
- else if(pArea === 2){ //GID_RUNAREA_SUBTOKYO_3_4
+ else if(pArea === 2){ // GID_RUNAREA_SUBTOKYO_3_4
rampVal = Math.floor(Math.random() * 2) + 6;
pathVal = Math.floor(Math.random() * 2) + 16;
}
- else if(pArea === 3){ //GID_RUNAREA_SUBTOKYO_5
+ else if(pArea === 3){ // GID_RUNAREA_SUBTOKYO_5
rampVal = Math.floor(Math.random() * 2) + 8;
pathVal = Math.floor(Math.random() * 2) + 18;
}
- else if(pArea === 4){ //GID_RUNAREA_WANGAN
+ else if(pArea === 4){ // GID_RUNAREA_WANGAN
rampVal = Math.floor(Math.random() * 4) + 10;
pathVal = Math.floor(Math.random() * 7) + 20;
}
- else if(pArea === 5){ //GID_RUNAREA_K1
+ else if(pArea === 5){ // GID_RUNAREA_K1
rampVal = Math.floor(Math.random() * 4) + 14;
pathVal = Math.floor(Math.random() * 7) + 27;
}
- else if(pArea === 6){ //GID_RUNAREA_YAESU
+ else if(pArea === 6){ // GID_RUNAREA_YAESU
rampVal = Math.floor(Math.random() * 3) + 18;
pathVal = Math.floor(Math.random() * 4) + 34;
}
- else if(pArea === 7){ //GID_RUNAREA_YOKOHAMA
+ else if(pArea === 7){ // GID_RUNAREA_YOKOHAMA
rampVal = Math.floor(Math.random() * 4) + 21;
pathVal = Math.floor(Math.random() * 11) + 38;
}
- else if(pArea === 8){ //GID_RUNAREA_NAGOYA
+ else if(pArea === 8){ // GID_RUNAREA_NAGOYA
rampVal = 25;
pathVal = 49;
}
- else if(pArea === 9){ //GID_RUNAREA_OSAKA
+ else if(pArea === 9){ // GID_RUNAREA_OSAKA
rampVal = 26;
pathVal = Math.floor(Math.random() * 4) + 50;
}
- else if(pArea === 10){ //GID_RUNAREA_KOBE
+ else if(pArea === 10){ // GID_RUNAREA_KOBE
rampVal = Math.floor(Math.random() * 2) + 27;
pathVal = Math.floor(Math.random() * 2) + 54;
}
- else if(pArea === 11){ //GID_RUNAREA_FUKUOKA
+ else if(pArea === 11){ // GID_RUNAREA_FUKUOKA
rampVal = Math.floor(Math.random() * 4) + 29;
pathVal = Math.floor(Math.random() * 4) + 58;
}
- else if(pArea === 12){ //GID_RUNAREA_HAKONE
+ else if(pArea === 12){ // GID_RUNAREA_HAKONE
rampVal = Math.floor(Math.random() * 2) + 33;
pathVal = Math.floor(Math.random() * 2) + 62;
}
- else if(pArea === 13){ //GID_RUNAREA_TURNPIKE
+ else if(pArea === 13){ // GID_RUNAREA_TURNPIKE
rampVal = Math.floor(Math.random() * 2) + 35;
pathVal = Math.floor(Math.random() * 2) + 64;
}
//14 - 16 are dummy area
- else if(pArea === 17){ //GID_RUNAREA_C1_CLOSED
+ else if(pArea === 17){ // GID_RUNAREA_C1_CLOSED
rampVal = Math.floor(Math.random() * 4);
- pathVal = Math.floor(Math.random() * 10); //probably not correct
+ pathVal = Math.floor(Math.random() * 10); // probably not correct
}
- else if(pArea === 18){ //GID_RUNAREA_HIROSHIMA
+ else if(pArea === 18){ // GID_RUNAREA_HIROSHIMA
rampVal = Math.floor(Math.random() * 2) + 37;
pathVal = Math.floor(Math.random() * 2) + 56;
}
- ghostTrail = new Uint8Array([1, 2, 3, 4]);
+ ghostTrail = new Uint8Array([1, 2, 3, 4]); // random value lmao, just for default ghost trail stuff
}
let msg = {
@@ -3047,68 +3047,68 @@ export default class GameModule extends Module {
let rampVal = 0;
let pathVal = 0;
let rampPathUsingGhostRecord: boolean = false;
- if(j === 0){ //GID_RUNAREA_C1
+ if(j === 0){ // GID_RUNAREA_C1
rampVal = Math.floor(Math.random() * 4);
pathVal = Math.floor(Math.random() * 10);
}
- else if(j === 1){ //GID_RUNAREA_RING
+ else if(j === 1){ // GID_RUNAREA_RING
rampVal = Math.floor(Math.random() * 2) + 4;
pathVal = Math.floor(Math.random() * 6) + 10;
}
- else if(j === 2){ //GID_RUNAREA_SUBTOKYO_3_4
+ else if(j === 2){ // GID_RUNAREA_SUBTOKYO_3_4
rampVal = Math.floor(Math.random() * 2) + 6;
pathVal = Math.floor(Math.random() * 2) + 16;
}
- else if(j === 3){ //GID_RUNAREA_SUBTOKYO_5
+ else if(j === 3){ // GID_RUNAREA_SUBTOKYO_5
rampVal = Math.floor(Math.random() * 2) + 8;
pathVal = Math.floor(Math.random() * 2) + 18;
}
- else if(j === 4){ //GID_RUNAREA_WANGAN
+ else if(j === 4){ // GID_RUNAREA_WANGAN
rampVal = Math.floor(Math.random() * 4) + 10;
pathVal = Math.floor(Math.random() * 7) + 20;
}
- else if(j === 5){ //GID_RUNAREA_K1
+ else if(j === 5){ // GID_RUNAREA_K1
rampVal = Math.floor(Math.random() * 4) + 14;
pathVal = Math.floor(Math.random() * 7) + 27;
}
- else if(j === 6){ //GID_RUNAREA_YAESU
+ else if(j === 6){ // GID_RUNAREA_YAESU
rampVal = Math.floor(Math.random() * 3) + 18;
pathVal = Math.floor(Math.random() * 4) + 34;
}
- else if(j === 7){ //GID_RUNAREA_YOKOHAMA
+ else if(j === 7){ // GID_RUNAREA_YOKOHAMA
rampVal = Math.floor(Math.random() * 4) + 21;
pathVal = Math.floor(Math.random() * 11) + 38;
}
- else if(j === 8){ //GID_RUNAREA_NAGOYA
+ else if(j === 8){ // GID_RUNAREA_NAGOYA
rampVal = 25;
pathVal = 49;
}
- else if(j === 9){ //GID_RUNAREA_OSAKA
+ else if(j === 9){ // GID_RUNAREA_OSAKA
rampVal = 26;
pathVal = Math.floor(Math.random() * 4) + 50;
}
- else if(j === 10){ //GID_RUNAREA_KOBE
+ else if(j === 10){ // GID_RUNAREA_KOBE
rampVal = Math.floor(Math.random() * 2) + 27;
pathVal = Math.floor(Math.random() * 2) + 54;
}
- else if(j === 11){ //GID_RUNAREA_FUKUOKA
+ else if(j === 11){ // GID_RUNAREA_FUKUOKA
rampVal = Math.floor(Math.random() * 4) + 29;
pathVal = Math.floor(Math.random() * 4) + 58;
}
- else if(j === 12){ //GID_RUNAREA_HAKONE
+ else if(j === 12){ // GID_RUNAREA_HAKONE
rampVal = Math.floor(Math.random() * 2) + 33;
pathVal = Math.floor(Math.random() * 2) + 62;
}
- else if(j === 13){ //GID_RUNAREA_TURNPIKE
+ else if(j === 13){ // GID_RUNAREA_TURNPIKE
rampVal = Math.floor(Math.random() * 2) + 35;
pathVal = Math.floor(Math.random() * 2) + 64;
}
//14 - 16 are dummy area
- else if(j === 17){ //GID_RUNAREA_C1_CLOSED
+ else if(j === 17){ // GID_RUNAREA_C1_CLOSED
rampVal = Math.floor(Math.random() * 4);
- pathVal = Math.floor(Math.random() * 10); //probably not correct
+ pathVal = Math.floor(Math.random() * 10); // probably not correct
}
- else if(j === 18){ //GID_RUNAREA_HIROSHIMA
+ else if(j === 18){ // GID_RUNAREA_HIROSHIMA
rampVal = Math.floor(Math.random() * 2) + 37;
pathVal = Math.floor(Math.random() * 2) + 56;
}
diff --git a/src/util/scratch.ts b/src/util/scratch.ts
index 419013c..eccc9e8 100644
--- a/src/util/scratch.ts
+++ b/src/util/scratch.ts
@@ -10,141 +10,233 @@ let scratchSheets = [
[ // Sheet 1
[201, 4], // R2
- // Window Stickers
- [25, 8], [25, 8], [25, 8], [25, 8], [25, 8], // BAT
- [25, 6], [25, 6], [25, 6], [25, 6], [25, 6], // SPEAR
- [25, 24], [25, 24], [25, 24], [25, 24], [25, 24], // PULSE
- [25, 3], [25, 3], [25, 3], [25, 3], [25, 3], // CIRCLE
- [25, 14], [25, 14], [25, 14], [25, 14], [25, 14], // TRIBAL
-
// Rival Markers
- [26, 18], [26, 18], [26, 18], [26, 18], // LIGHTNING
- [26, 2], [26, 2], [26, 2], [26, 2], // NEON
- [26, 31], [26, 31], [26, 31], [26, 31], // V
[26, 40], [26, 40], [26, 40], [26, 40], // NEW DRIVER
+ [26, 18], [26, 18], [26, 18], [26, 18], // LIGHTNING
[26, 1], [26, 1], [26, 1], [26, 1], // FIRE
+ [26, 3], [26, 3], [26, 3], [26, 3], // NEON
[26, 17], [26, 17], [26, 17], [26, 17], // TROPICAL
+ [26, 31], [26, 31], [26, 31], [26, 31], // V
+
+ // Window Stickers
+ [25, 24], [25, 24], [25, 24], [25, 24], [25, 24], // PULSE
+ [25, 8], [25, 8], [25, 8], [25, 8], [25, 8], // BAT
+ [25, 3], [25, 3], [25, 3], [25, 3], [25, 3], // CIRCLE
+ [25, 6], [25, 6], [25, 6], [25, 6], [25, 6], // SPEAR
+ [25, 14], [25, 14], [25, 14], [25, 14], [25, 14], // TRIBAL
],
[ // Sheet 2
[201, 3], // Corolla
-
- // Window Stickers
- [25, 11], [25, 11], [25, 11], [25, 11], [25, 11], // Thunderbolt
- [25, 4], [25, 4], [25, 4], [25, 4], [25, 4], // Circle 2
- [25, 28], [25, 28], [25, 28], [25, 28], [25, 28], // Wangan URL
- [25, 5], [25, 5], [25, 5], [25, 5], [25, 5], // Triangle
- [25, 16], [25, 16], [25, 16], [25, 16], [25, 16], // Cards
// Rival Markers
- [26, 9], [26, 9], [26, 9], [26, 9], // GRAFFITI
- [26, 6], [26, 6], [26, 6], [26, 6], // CASUAL
- [26, 19], [26, 19], [26, 19], [26, 19], // WALL
[26, 29], [26, 29], [26, 29], [26, 29], // BAT
+ [26, 9], [26, 9], [26, 9], [26, 9], // GRAFFITI
[26, 2], [26, 2], [26, 2], [26, 2], // ANIMAL
+ [26, 6], [26, 6], [26, 6], [26, 6], // CASUAL
[26, 8], [26, 8], [26, 8], [26, 8], // PAINT SPLASH
- ]
- /*
- [ // Sheet 3 (Incomplete)
+ [26, 19], [26, 19], [26, 19], [26, 19], // WALL
+
+ // Window Stickers
+ [25, 28], [25, 28], [25, 28], [25, 28], [25, 28], // WANGAN URL
+ [25, 11], [25, 11], [25, 11], [25, 11], [25, 11], // THUNDER BOLT
+ [25, 5], [25, 5], [25, 5], [25, 5], [25, 5], // TRIANGLE
+ [25, 4], [25, 4], [25, 4], [25, 4], [25, 4], // CIRCLE 2
+ [25, 16], [25, 16], [25, 16], [25, 16], [25, 16], // CARDS
+ ],
+ [ // Sheet 3
[201, 1], // Hiace Van
- // Window Stickers
- [25, 13], [25, 13], [25, 13], [25, 13], [25, 13], // Arrow
- [25, 9], [25, 9], [25, 9], [25, 9], // Star
- [25, 7], [25, 7], [25, 7], [25, 7], // Snake
- [25, 18], [25, 18], [25, 18], [25, 18], // Heart
- [25, ], [25, ], [25, ], [25, ], // ????
-
// Rival Markers
- [26, 36], [26, 36], [26, 36], [26, 36], // Pinstripe
- [26, 5], [26, 5], [26, 5], [26, 5], // Dangerous
- [26, 14], [26, 14], [26, 14], [26, 14], // Relief
- [26, 34], [26, 34], [26, 34], [26, 34], // Diamond
- [26, 4], [26, 4], [26, 4], [26, 4], // Metal
- [26, 10], [26, 10], [26, 10], [26, 10], // Japonism
- [26, 20], [26, 20], [26, 20], [26, 20], // Reggae
+ [26, 34], [26, 34], [26, 34], [26, 34], // DIAMOND
+ [26, 36], [26, 36], [26, 36], [26, 36], // PINSTRIPE
+ [26, 4], [26, 4], [26, 4], [26, 4], // METAL
+ [26, 5], [26, 5], [26, 5], [26, 5], // DANGEROUS
+ [26, 10], [26, 10], [26, 10], [26, 10], // JAPANESE PATTERN
+ [26, 14], [26, 14], [26, 14], [26, 14], // RELIEF
+ [26, 20], [26, 20], [26, 20], [26, 20], // REGGAE
+
+ // Window Stickers
+ [25, 13], [25, 13], [25, 13], [25, 13], [25, 13], // ARROW
+ [25, 7], [25, 7], [25, 7], [25, 7], // SNAKE
+ [25, 9], [25, 9], [25, 9], [25, 9], // STAR
+ [25, 18], [25, 18], [25, 18], [25, 18], // HEART
+ [25, 1], [25, 1], [25, 1], [25, 1], // FIRE PATTERN
],
- [ // Sheet 4 (Incomplete)
+ [ // Sheet 4
[201, 2], // Pajero Evolution
- // Window Stickers
- [25, 21], [25, 21], [25, 21], [25, 21], [25, 21], // Plum Blossoms
- [25, 12], [25, 12], [25, 12], [25, 12], // Illumination
- [25, 10], [25, 10], [25, 10], [25, 10], // Shooting Star
- [25, 20], [25, 20], [25, 20], [25, 20], // Raimo
- [25, ], [25, ], [25, ], [25, ], // ????
-
// Rival Markers
- [26, 7], [26, 7], [26, 7], [26, 7], // Flowers
- [26, 16], [26, 16], [26, 16], [26, 16], // Wood
- [26, 24], [26, 24], [26, 24], [26, 24], // Studded
- [26, 33], [26, 33], [26, 33], [26, 33], // Heart
- [26, 15], [26, 15], [26, 15], [26, 15], // Camo
- [26, 21], [26, 21], [26, 21], [26, 21], // Decoration
- [26, 30], [26, 30], [26, 30], [26, 30], // Effect
+ [26, 33], [26, 33], [26, 33], [26, 33], // HEART
+ [26, 7], [26, 7], [26, 7], [26, 7], // FLOWERS
+ [26, 15], [26, 15], [26, 15], [26, 15], // CAMO
+ [26, 16], [26, 16], [26, 16], [26, 16], // WOOD
+ [26, 21], [26, 21], [26, 21], [26, 21], // DECORATION
+ [26, 24], [26, 24], [26, 24], [26, 24], // STUDDED
+ [26, 30], [26, 30], [26, 30], [26, 30], // EFFECT
+
+ // Window Stickers
+ [25, 21], [25, 21], [25, 21], [25, 21], [25, 21], // PLUM BLOSSOMS
+ [25, 10], [25, 10], [25, 10], [25, 10], // SHOOTING STAR
+ [25, 12], [25, 12], [25, 12], [25, 12], // ILLUMINATION
+ [25, 20], [25, 20], [25, 20], [25, 20], // RAIMON
+ [25, 27], [25, 27], [25, 27], [25, 27], // LONGHORN
],
- [ // Sheet 5 (Incomplete)
+ [ // Sheet 5
[201, 5], // Nismo GT-R (Black)
- // Window Stickers
- [25, 26], [25, 26], [25, 26], [25, 26], [25, 26], // Paint
- [25, 29], [25, 29], [25, 29], [25, 29], // Galaga
- [25, 23], [25, 23], [25, 23], [25, 23], // Maze
- [25, 2], [25, 2], [25, 2], [25, 2], // Fire Pattern 2
- [25, ], [25, ], [25, ], [25, ], // ????
-
// Rival Markers
- [26, 39], [26, 39], [26, 39], [26, 39], // Silver Accessory
- [26, 22], [26, 22], [26, 22], [26, 22], // Tropical 2
- [26, 25], [26, 25], [26, 25], [26, 25], // Casual 2
- [26, 28], [26, 28], [26, 28], [26, 28], // Guitar Pick
- [26, 12], [26, 12], [26, 12], [26, 12], // Mechanical
- [26, 23], [26, 23], [26, 23], [26, 23], // Monogram
- [26, 27], [26, 27], [26, 27], [26, 27], // Carbon
+ [26, 28], [26, 28], [26, 28], [26, 28], // GUITAR PICK
+ [26, 39], [26, 39], [26, 39], [26, 39], // SILVER ACCESSORY
+ [26, 12], [26, 12], [26, 12], [26, 12], // MECHANICAL
+ [26, 22], [26, 22], [26, 22], [26, 22], // TROPICAL 2
+ [26, 23], [26, 23], [26, 23], [26, 23], // MONOGRAM
+ [26, 25], [26, 25], [26, 25], [26, 25], // CASUAL 2
+ [26, 27], [26, 27], [26, 27], [26, 27], // CARBON
+
+ // Window Stickers
+ [25, 26], [25, 26], [25, 26], [25, 26], [25, 26], // PAINT
+ [25, 23], [25, 23], [25, 23], [25, 23], // MAZE
+ [25, 29], [25, 29], [25, 29], [25, 29], // GALAGA
+ [25, 2], [25, 2], [25, 2], [25, 2], // FIRE PATTERN 2
+ [25, 19], [25, 19], [25, 19], [25, 19], // ANGEL HEART
],
- [ // Sheet 6 (Incomplete)
+ [ // Sheet 6
[201, 6], // Fairlady Z (Nismo)
- // Window Stickers
- [25, 25], [25, 25], [25, 25], [25, 25], [25, 25], // Equaliser
- [25, 17], [25, 17], [25, 17], [25, 17], // Cards 2
- [25, 30], [25, 30], [25, 30], [25, 30], // Pac-Man
- [25, 22], [25, 22], [25, 22], [25, 22], // Seigaiha
- [25, ], [25, ], [25, ], [25, ], // ????
-
// Rival Markers
- [26, 38], [26, 38], [26, 38], [26, 38], // Hex
- [26, 13], [26, 13], [26, 13], [26, 13], // Cosmos
- [26, 35], [26, 35], [26, 35], [26, 35], // Fire Pattern
- [26, 32], [26, 32], [26, 32], [26, 32], // Feather
- [26, 11], [26, 11], [26, 11], [26, 11], // Silvercraft
- [26, 26], [26, 26], [26, 26], [26, 26], // Graffiti 2
- [26, 37], [26, 37], [26, 37], [26, 37], // Arrow of Light
+ [26, 32], [26, 32], [26, 32], [26, 32], // FEATHER
+ [26, 38], [26, 38], [26, 38], [26, 38], // HEX
+ [26, 11], [26, 11], [26, 11], [26, 11], // SILVERCRAFT
+ [26, 13], [26, 13], [26, 13], [26, 13], // COSMOS
+ [26, 26], [26, 26], [26, 26], [26, 26], // GRAFFITI 2
+ [26, 35], [26, 35], [26, 35], [26, 35], // FIRE PATTERN
+ [26, 37], [26, 37], [26, 37], [26, 37], // ARROW OF LIGHT
+
+ // Window Stickers
+ [25, 25], [25, 25], [25, 25], [25, 25], [25, 25], // EQUALIZER
+ [25, 30], [25, 30], [25, 30], [25, 30], // PAC-MAN
+ [25, 17], [25, 17], [25, 17], [25, 17], // CARDS 2
+ [25, 22], [25, 22], [25, 22], [25, 22], // SEIGAIHA
+ [25, 15], [25, 15], [25, 15], [25, 15], // TRIBAL 2
],
- [ // Sheet 7 (Incomplete)
+ [ // Sheet 7
[201, 16], // Aristo (Taxi)
+ // Rival Markers
+ [26, 71], [26, 71], [26, 71], [26, 71], // KATANA
+ [26, 73], [26, 73], [26, 73], [26, 73], // SHURIKEN
+ [26, 41], [26, 41], [26, 41], [26, 41], // STEEL
+ [26, 69], [26, 69], [26, 69], [26, 69], // ELECTRONICS
+ [26, 66], [26, 66], [26, 66], [26, 66], // WALL 2
+ [26, 47], [26, 47], [26, 47], [26, 47], // PAINT SPLASH 2
+
// Window Stickers
- [25, 32], [25, 32], [25, 32], [25, 32], [25, 32], // Emotion
- [25, 17], [25, 17], [25, 17], [25, 17], // Pine
- [25, 30], [25, 30], [25, 30], [25, 30], // Love
- // [25, 22], [25, 22], [25, 22], [25, 22], // Square
- [25, 35], [25, 35], [25, 35], [25, 35], [25, 35], // Trap
+ [25, 31], [25, 31], [25, 31], [25, 31], [25, 31], // LOVE
+ [25, 32], [25, 32], [25, 32], [25, 32], [25, 32], // EMOTION
+ [25, 33], [25, 33], [25, 33], [25, 33], [25, 33], // SQUARE
+ [25, 34], [25, 34], [25, 34], [25, 34], [25, 34], // PINE
+ [25, 35], [25, 35], [25, 35], [25, 35], [25, 35], // TRAP
+ ],
+ [ // Sheet 8
+ [201, 17], // Driving School Mazda 6 MPS
// Rival Markers
- [26, 38], [26, 38], [26, 38], [26, 38], // Shuriken
- [26, 13], [26, 13], [26, 13], [26, 13], // Electronics
- [26, 35], [26, 35], [26, 35], [26, 35], // Paint Splash 2
- [26, 32], [26, 32], [26, 32], [26, 32], // Katana
- [26, 11], [26, 11], [26, 11], [26, 11], // Steel
- [26, 26], [26, 26], [26, 26], [26, 26], // Wall 2
- ],
- */
-]
+ [26, 74], [26, 74], [26, 74], [26, 74], // HEAVY METAL
+ [26, 79], [26, 79], [26, 79], [26, 79], // LOVE YOU
+ [26, 59], [26, 59], [26, 59], [26, 59], // METRO POLICE
+ [26, 60], [26, 60], [26, 60], [26, 60], // WOOFER
+ [26, 61], [26, 61], [26, 61], [26, 61], // DIGITAL
+ [26, 62], [26, 62], [26, 62], [26, 62], // PUNK
+
+ // Window Stickers
+ [25, 36], [25, 36], [25, 36], [25, 36], [25, 36], // WING
+ [25, 37], [25, 37], [25, 37], [25, 37], [25, 37], // TRIBAL 3
+ [25, 38], [25, 38], [25, 38], [25, 38], [25, 38], // TRIBAL 4
+ [25, 39], [25, 39], [25, 39], [25, 39], [25, 39], // TECHNO
+ [25, 40], [25, 40], [25, 40], [25, 40], [25, 40], // TECHNO 2
+ ],
+ [ // Sheet 9
+ [201, 18], // Toyota Celsior Taxi
+
+ // Rival Markers
+ [26, 70], [26, 70], [26, 70], [26, 70], // BUTTERFLY
+ [26, 77], [26, 77], [26, 77], [26, 77], // DRAGON
+ [26, 54], [26, 54], [26, 54], [26, 54], // ROAD
+ [26, 57], [26, 57], [26, 57], [26, 57], // GRAFFITI 3
+ [26, 55], [26, 55], [26, 55], [26, 55], // CAMO 2
+ [26, 56], [26, 56], [26, 56], [26, 56], // PINSTRIPE 2
+ [26, 45], [26, 45], [26, 45], [26, 45], // ID TAG
+
+ // Window Stickers
+ [25, 41], [25, 41], [25, 41], [25, 41], [25, 41], // MUSTACHE
+ [25, 42], [25, 42], [25, 42], [25, 42], // FLASH
+ [25, 43], [25, 43], [25, 43], [25, 43], // SCRATCH
+ [25, 44], [25, 44], [25, 44], [25, 44], // ANTIQUE
+ [25, 45], [25, 45], [25, 45], [25, 45], // THORNS
+ ],
+ [ // Sheet 10
+ [201, 19], // High lift Toyota Hiace (KZH100G)
+
+ // Rival Markers
+ [26, 76], [26, 76], [26, 76], [26, 76], // FANG
+ [26, 78], [26, 78], [26, 78], [26, 78], // HAWK
+ [26, 49], [26, 49], [26, 49], [26, 49], // OGRE TILE
+ [26, 43], [26, 43], [26, 43], [26, 43], // DANGEROUS 2
+ [26, 67], [26, 67], [26, 67], [26, 67], // DANGEROUS 3
+ [26, 64], [26, 64], [26, 64], [26, 64], // FIRE PATTERN 2
+ [26, 46], [26, 46], [26, 46], [26, 46], // ANIMAL 2
+
+ // Window Stickers
+ [25, 46], [25, 46], [25, 46], [25, 46], [25, 46], // SKID MARK
+ [25, 47], [25, 47], [25, 47], [25, 47], // ARROW 2
+ [25, 48], [25, 48], [25, 48], [25, 48], // CHECKERED FLAG
+ [25, 49], [25, 49], [25, 49], [25, 49], // CHECKERED FLAG 2
+ [25, 50], [25, 50], [25, 50], [25, 50], // PUZZLE
+ ],
+ [ // Sheet 11
+ [201, 20], // R35 Pure Edition 2017
+
+ // Rival Markers
+ [26, 75], [26, 75], [26, 75], [26, 75], // HELMET
+ [26, 72], [26, 72], [26, 72], [26, 72], // HAMAYA ARROW
+ [26, 42], [26, 42], [26, 42], [26, 42], // JAPANESE PATTERN 2
+ [26, 63], [26, 63], [26, 63], [26, 63], // LEATHER
+ [26, 48], [26, 48], [26, 48], [26, 48], // MARINE
+ [26, 65], [26, 65], [26, 65], [26, 65], // CAMO 3
+ [26, 68], [26, 68], [26, 68], [26, 68], // MECHANICAL 2
+
+ // Window Stickers
+ [25, 51], [25, 51], [25, 51], [25, 51], [25, 51], // PUZZLE 2
+ [25, 52], [25, 52], [25, 52], [25, 52], // WAVE
+ [25, 53], [25, 53], [25, 53], [25, 53], // FANG
+ [25, 54], [25, 54], [25, 54], [25, 54], // LOCK-ON
+ [25, 55], [25, 55], [25, 55], [25, 55], // CHAIN
+ ],
+ [ // Sheet 12
+ [201, 21], // Honda NSX-R (NA2)
+
+ // Rival Markers
+ [26, 80], [26, 80], [26, 80], [26, 80], // SPEECH BUBBLE
+ [26, 51], [26, 51], [26, 51], [26, 51], // COMIC
+ [26, 50], [26, 50], [26, 50], [26, 50], // GLITTER
+ [26, 52], [26, 52], [26, 52], [26, 52], // FOREST
+ [26, 53], [26, 53], [26, 53], [26, 53], // BANDANA
+ [26, 44], [26, 44], [26, 44], [26, 44], // STICKER
+ [26, 58], [26, 58], [26, 58], [26, 58], // CRYSTAL
+
+ // Window Stickers
+ [25, 56], [25, 56], [25, 56], [25, 56], [25, 56], // STREET
+ [25, 57], [25, 57], [25, 57], [25, 57], // NO ENTRY
+ [25, 58], [25, 58], [25, 58], [25, 58], // BARCODE
+ [25, 59], [25, 59], [25, 59], [25, 59], // ZIPPER
+ [25, 60], [25, 60], [25, 60], [25, 60], // WANGAN URL 2
+ ]
+];
// Terminal scratch cars only
export const scratchCars = [
4, 3, 1, 2, 5, 6, 16, 17, 18, 19, 20, 21
-]
+];
// Fully tuned special cars
export const fullyTunedCars = [
@@ -279,7 +371,7 @@ export async function generateScratchSheet (userId: number, sheetNo: number)
else // Sheet is out of range
{
// Generate a random (standard) scratch sheet
- scratchItems = getRandomScratchSheet(sheetNo-1);
+ // scratchItems = getRandomScratchSheet(sheetNo-1);
}
break;
From 552fe2925a1308bb68d4652bae08c22a5b82ae96 Mon Sep 17 00:00:00 2001
From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com>
Date: Fri, 5 Aug 2022 15:01:07 +0700
Subject: [PATCH 7/8] game history ghost battle sort descending
---
src/modules/game.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/game.ts b/src/modules/game.ts
index 79f7e7e..d29cae8 100644
--- a/src/modules/game.ts
+++ b/src/modules/game.ts
@@ -2457,7 +2457,7 @@ export default class GameModule extends Module {
carId: body.carId
},
orderBy: {
- playedAt: 'asc'
+ playedAt: 'desc'
},
take: 3
});
From 2ef204c4f8625a8230a11b8ac4c671682c1d6dc9 Mon Sep 17 00:00:00 2001
From: ghkkk090 <108461408+ghkkk090@users.noreply.github.com>
Date: Fri, 5 Aug 2022 22:13:33 +0700
Subject: [PATCH 8/8] Update game.ts
---
src/modules/game.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/game.ts b/src/modules/game.ts
index d29cae8..84caf2a 100644
--- a/src/modules/game.ts
+++ b/src/modules/game.ts
@@ -2496,7 +2496,7 @@ export default class GameModule extends Module {
// ---Opponent 2 & 3---
let ghostMob: wm.wm.protobuf.LoadGameHistoryResponse.GhostBattleRecord.GhostBattleRecordCar[] = [];
- if(ghostHistoryData[i]?.opponent2CarId !== null || ghostHistoryData[i]?.opponent2CarId !== undefined){
+ if(ghostHistoryData[i]?.opponent2CarId !== null && ghostHistoryData[i]?.opponent2CarId !== undefined){
let ghostOpponentCar2 = await prisma.car.findFirst({
where: {
carId: ghostHistoryData![i].opponent2CarId!
@@ -2519,7 +2519,7 @@ export default class GameModule extends Module {
result: ghostHistoryData![i].opponent2Result!
}));
}
- if(ghostHistoryData[i]?.opponent3CarId !== null || ghostHistoryData[i]?.opponent3CarId !== undefined){
+ if(ghostHistoryData[i]?.opponent3CarId !== null && ghostHistoryData[i]?.opponent3CarId !== undefined){
let ghostOpponentCar3 = await prisma.car.findFirst({
where: {
carId: ghostHistoryData![i].opponent3CarId!