1
0
mirror of synced 2024-11-12 01:10:47 +01:00

some ghost battle feature fixed but still bugged

-Ghost Battle no longer disconnected but still bugged
-Crown Ghost Battle not working (disconnected)
-Dress Up Working and saved
-Ghost Region Map Score Working and Saved
-Search Ghost by Level Working
-Search Ghost by Name not Working (disconnected)
-Change Full Tune Ticket (now default ghostLevel is 10)
-No Ghost Movement Saving
-Add rgRegionMapScore to Car table
This commit is contained in:
ghkkk090 2022-07-21 09:06:18 +07:00
parent abce28d50e
commit ff5774b6a2
6 changed files with 256 additions and 12 deletions

2
.gitignore vendored
View File

@ -9,4 +9,4 @@ key.pem
config.json
package-lock.json
ecosystem.config.js
prisma/public.sql
prisma/*.sql

View File

@ -2,6 +2,8 @@ Copyright 2022 Project Asakura
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
TeknoGods, the TeknoParrot team, and anyone affiliated with the TeknoParrot project ("TeknoParrot") is not authorised to use any part of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -15,3 +15,6 @@ Special thanks:
Donations are not required, however I'm only one person, and I'm still a student, so if you want to thank me for my work, [please buy me a coffee or two](https://ko-fi.com/lostkagamine).
This won't get you anything other than my gratitude, the entire project is and will always remain available to everyone for free.
## On TeknoParrot
The TeknoParrot team (TeknoGods) are not authorised to use **any part** of this project. **Do not integrate any portion of Bayshore into TeknoParrot.**

View File

@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "Car" ADD COLUMN "rgRegionMapScore" INTEGER[],
ALTER COLUMN "stLoseBits" SET DEFAULT 0;

View File

@ -108,6 +108,7 @@ model Car {
rgScore Int @default(0)
rgStamp Int @default(0)
rgAcquireAllCrowns Boolean @default(false)
rgRegionMapScore Int[]
dressupLevel Int @default(0)
dressupPoint Int @default(0)
stPlayCount Int @default(0)

View File

@ -89,6 +89,8 @@ export default class GameModule extends Module {
console.log('-------');
console.log(c);
if(body.earnedItems.length !== 0){
console.log('Game reward available, continuing ...');
for(let i=0; i<body.earnedItems.length; i++){
await prisma.carItem.create({
data: {
@ -100,6 +102,7 @@ export default class GameModule extends Module {
});
}
}
}
break;
}
case wm.wm.protobuf.GameMode.MODE_TIME_ATTACK:
@ -171,12 +174,120 @@ export default class GameModule extends Module {
}
break;
}
case wm.wm.protobuf.GameMode.MODE_GHOST_BATTLE:
{
console.log(body);
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;
}
let c = await prisma.car.update({
where: {
carId: body.carId
},
data: saveEx
});
if(body.earnedItems.length !== 0){
console.log('Game reward available, continuing ...');
for(let i=0; i<body.earnedItems.length; i++){
await prisma.carItem.create({
data: {
carId: body.carId,
category: body.earnedItems[i].category,
itemId: body.earnedItems[i].itemId,
amount: 1
}
});
}
}
}
}
await prisma.car.update({
where: {
carId: body.carId,
},
data: {
aura: body.car!.aura!,
auraMotif: body.car!.auraMotif!,
odometer: body.odometer,
playCount: body.playCount,
level: body.car!.level!,
@ -519,7 +630,7 @@ export default class GameModule extends Module {
})
// Load unrecieved user items
app.post('/method/load_unrecieved_user_items', (req, res) => {
app.post('/method/load_unreceived_user_items', (req, res) => {
// In future, might want to check db for player items
@ -1172,6 +1283,7 @@ export default class GameModule extends Module {
// Additional full tune values
additionalInsert = {
ghostLevel: 10,
stClearBits: 0,
stLoseBits: 0,
stClearCount: 80,
@ -1385,5 +1497,128 @@ export default class GameModule extends Module {
.status(200);
r.send(Buffer.from(end));
})
app.post('/method/load_ghost_battle_info', async (req, res) => {
let body = wm.wm.protobuf.LoadGhostBattleInfoRequest.decode(req.body);
//---------------MAYBE NOT CORRECT---------------
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
stampSheetCount: 100,
};
//-----------------------------------------------
let resp = wm.wm.protobuf.LoadGhostBattleInfoResponse.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/search_cars_by_level', async (req, res) => {
let body = wm.wm.protobuf.SearchCarsByLevelRequest.decode(req.body);
console.log(body);
//---------------MAYBE NOT CORRECT---------------
let rampVal = 0;
let pathVal = 0;
if(body.area === 0){ //GID_RUNAREA_C1
rampVal = 0;
pathVal = Math.floor(Math.random() * 10);
}
else if(body.area === 1){ //GID_RUNAREA_RING
rampVal = 0;
pathVal = Math.floor(Math.random() * 6) + 10;
}
else if(body.area === 2){ //GID_RUNAREA_SUBTOKYO_3_4
rampVal = 0;
pathVal = Math.floor(Math.random() * 2) + 16;
}
else if(body.area === 3){ //GID_RUNAREA_SUBTOKYO_5
rampVal = 0;
pathVal = Math.floor(Math.random() * 2) + 18;
}
else if(body.area === 4){ //GID_RUNAREA_WANGAN
rampVal = 0;
pathVal = Math.floor(Math.random() * 7) + 20;
}
else if(body.area === 5){ //GID_RUNAREA_K1
rampVal = 0;
pathVal = Math.floor(Math.random() * 7) + 27;
}
else if(body.area === 6){ //GID_RUNAREA_YAESU
rampVal = 0;
pathVal = Math.floor(Math.random() * 4) + 34;
}
else if(body.area === 7){ //GID_RUNAREA_YOKOHAMA
rampVal = 0;
pathVal = Math.floor(Math.random() * 11) + 38;
}
else if(body.area === 8){ //GID_RUNAREA_NAGOYA
rampVal = 0;
pathVal = 49;
}
else if(body.area === 9){ //GID_RUNAREA_OSAKA
rampVal = 0;
pathVal = Math.floor(Math.random() * 4) + 50;
}
else if(body.area === 10){ //GID_RUNAREA_KOBE
rampVal = 0;
pathVal = Math.floor(Math.random() * 2) + 54;
}
else if(body.area === 11){ //GID_RUNAREA_FUKUOKA
rampVal = 0;
pathVal = Math.floor(Math.random() * 4) + 58;
}
else if(body.area === 12){ //GID_RUNAREA_HAKONE
rampVal = 0;
pathVal = Math.floor(Math.random() * 2) + 62;
}
else if(body.area === 13){ //GID_RUNAREA_TURNPIKE
rampVal = 0;
pathVal = Math.floor(Math.random() * 2) + 64;
}
//14 - 16 is dummy area
else if(body.area === 17){ //GID_RUNAREA_C1_CLOSED
rampVal = 0;
pathVal = Math.floor(Math.random() * 10); //probably not correct
}
else if(body.area === 18){ //GID_RUNAREA_HIROSHIMA
rampVal = 0;
pathVal = Math.floor(Math.random() * 2) + 56;
}
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
ramp: rampVal,
path: pathVal,
selectionMethod: 2,
};
//-----------------------------------------------
let resp = wm.wm.protobuf.SearchCarsByLevelResponse.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_ghost_drive_data', async (req, res) => {
let body = wm.wm.protobuf.LoadGhostDriveDataRequest.decode(req.body);
console.log(body);
//---------------MAYBE NOT CORRECT---------------
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
path: body.path
};
//-----------------------------------------------
let resp = wm.wm.protobuf.LoadGhostDriveDataResponse.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));
})
}
}