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

fix something again

This commit is contained in:
ghkkk090 2022-07-27 18:38:50 +07:00
parent c612e73c5f
commit b0ba8b102a
2 changed files with 48 additions and 42 deletions

View File

@ -84,14 +84,12 @@ export default class GameModule extends Module {
}
saveEx.stConsecutiveWinsMax = maxConsecutiveWins;
let c = await prisma.car.update({
await prisma.car.update({
where: {
carId: body.carId
},
data: saveEx
});
console.log('-------');
console.log(c);
}
break;
}
@ -266,6 +264,7 @@ export default class GameModule extends Module {
data: saveEx
});
}
break;
}
case wm.wm.protobuf.GameMode.MODE_VS_BATTLE:
{
@ -325,12 +324,13 @@ export default class GameModule extends Module {
saveEx.vsPlainMedals = car?.vsPlainMedals;
}
let c = await prisma.car.update({
await prisma.car.update({
where: {
carId: body.carId
},
data: saveEx
});
break;
}
}
@ -379,7 +379,8 @@ export default class GameModule extends Module {
title: body.car!.title!,
tunePower: body.car!.tunePower!,
tuneHandling: body.car!.tuneHandling!,
windowSticker: body.car!.windowSticker!
windowSticker: body.car!.windowSticker!,
windowDecoration: body.car!.windowDecoration!
}
})
@ -406,7 +407,6 @@ export default class GameModule extends Module {
},
},
})
console.log('How many meter already obtained : ' +carItemCount.length);
let sqlVal = 0;
for(let i=0; i<carItemCount.length; i++){
if(carItemCount[i].itemId !== 2 && carItemCount[i].itemId !== 3 && carItemCount[i].itemId !== 5 && carItemCount[i].itemId !== 6){
@ -2056,6 +2056,7 @@ export default class GameModule extends Module {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
}
let resp = wm.wm.protobuf.UpdateUserSessionResponse.encode(msg);
let end = resp.finish();
let r = res
@ -2067,8 +2068,7 @@ 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 body = wm.wm.protobuf.LoadGhostBattleInfoRequest.decode(req.body);
let cars = await prisma.car.findMany({
include:{
gtWing: true
@ -2076,15 +2076,21 @@ export default class GameModule extends Module {
});
let lists_stamptarget: wm.wm.protobuf.StampTargetCar[] = [];
for(let i=0; i<cars.length; i++){
let lengths = 0;
if(cars.length > 20){
lengths = 20;
}
else{
lengths = cars.length;
}
for(let i=0; i<lengths; i++){
lists_stamptarget.push(wm.wm.protobuf.StampTargetCar.create({
car: cars[i],
returnCount: 0,
returnCount: 1,
locked: false,
recommended: true,
}));
}));
}
//---------------MAYBE NOT CORRECT---------------
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
@ -2104,8 +2110,8 @@ export default class GameModule extends Module {
})
app.post('/method/load_stamp_target', async (req, res) => {
let body = wm.wm.protobuf.LoadStampTargetRequest.decode(req.body);
//let body = wm.wm.protobuf.LoadStampTargetRequest.decode(req.body);
//---------------MAYBE NOT CORRECT---------------
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
@ -2191,11 +2197,11 @@ export default class GameModule extends Module {
pathVal = Math.floor(Math.random() * 2) + 56;
}
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
ramp: rampVal,
path: pathVal,
selectionMethod: 2,
};
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();
@ -2211,9 +2217,9 @@ export default class GameModule extends Module {
let body = wm.wm.protobuf.LoadGhostDriveDataRequest.decode(req.body);
//---------------MAYBE NOT CORRECT---------------
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
path: body.path
};
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
path: body.path
};
//-----------------------------------------------
let resp = wm.wm.protobuf.LoadGhostDriveDataResponse.encode(msg);
let end = resp.finish();
@ -2226,7 +2232,7 @@ export default class GameModule extends Module {
})
app.post('/method/lock_crown', (req, res) => {
let body = wms.wm.protobuf.LockCrownRequest.decode(req.body);
//let body = wms.wm.protobuf.LockCrownRequest.decode(req.body);
//---------------MAYBE NOT CORRECT---------------
let msg = {
error: wms.wm.protobuf.ErrorCode.ERR_SUCCESS,

View File

@ -2,7 +2,7 @@ import { Application } from "express";
import {Module} from "module";
import { Config } from "../config";
import * as wm from "../wmmt/wm.proto";
import * as wms from "../wmmt/service.proto";
import * as wmsrv from "../wmmt/service.proto";
import { prisma } from "..";
export default class StartupModule extends Module {
@ -54,7 +54,7 @@ export default class StartupModule extends Module {
app.get('/resource/ranking', async (req, res) => {
console.log('ranking');
let lists: wms.wm.protobuf.Ranking.List[] = [];
let lists: wmsrv.wm.protobuf.Ranking.List[] = [];
// Get TA Ranking
for(let i=0; i<25; i++){
@ -67,7 +67,7 @@ export default class StartupModule extends Module {
}
});
if(ta_time.length !== 0){
let list_ta: wms.wm.protobuf.Ranking.Entry[] = [];
let list_ta: wmsrv.wm.protobuf.Ranking.Entry[] = [];
for(let j=0; j<ta_time.length; j++){
let car_ta = await prisma.car.findFirst({
where: {
@ -75,7 +75,7 @@ export default class StartupModule extends Module {
}
});
list_ta.push(wms.wm.protobuf.Ranking.Entry.create({
list_ta.push(wmsrv.wm.protobuf.Ranking.Entry.create({
carId: car_ta!.carId,
rank: car_ta!.level,
result: ta_time[j].time,
@ -96,7 +96,7 @@ export default class StartupModule extends Module {
if(i === 22 || i === 23){
resulttime = 1199999
}
list_ta.push(wms.wm.protobuf.Ranking.Entry.create({
list_ta.push(wmsrv.wm.protobuf.Ranking.Entry.create({
carId: 0,
rank: 0,
result: resulttime,
@ -113,8 +113,8 @@ export default class StartupModule extends Module {
}
}
lists.push(new wms.wm.protobuf.Ranking.List({
rankingType: i,
lists.push(new wmsrv.wm.protobuf.Ranking.List({
rankingType: i, // RANKING_TA_*AREA*
topRecords: list_ta
}));
}
@ -127,9 +127,9 @@ export default class StartupModule extends Module {
vsStarCount: 'desc'
}
});
let list_vs: wms.wm.protobuf.Ranking.Entry[] = [];
let list_vs: wmsrv.wm.protobuf.Ranking.Entry[] = [];
for(let i=0; i<car_vs.length; i++){
list_vs.push(wms.wm.protobuf.Ranking.Entry.create({
list_vs.push(wmsrv.wm.protobuf.Ranking.Entry.create({
carId: car_vs[i].carId,
rank: car_vs[i].level,
result: car_vs[i].vsStarCount,
@ -146,7 +146,7 @@ export default class StartupModule extends Module {
}
if(car_vs.length < 20){
for(let j=car_vs.length; j<20; j++){
list_vs.push(wms.wm.protobuf.Ranking.Entry.create({
list_vs.push(wmsrv.wm.protobuf.Ranking.Entry.create({
carId: 0,
rank: 0,
result: 0,
@ -162,21 +162,21 @@ export default class StartupModule extends Module {
}));
}
}
lists.push(new wms.wm.protobuf.Ranking.List({
rankingType: 100,
lists.push(new wmsrv.wm.protobuf.Ranking.List({
rankingType: 100, // RANKING_VS_STAR
topRecords: list_vs
}));
// Get Ghost Win Ranking
// Get Ghost Defeated Ranking
let car_ghost = await prisma.car.findMany({
orderBy: {
rgWinCount: 'desc'
}
});
let list_ghost: wms.wm.protobuf.Ranking.Entry[] = [];
let list_ghost: wmsrv.wm.protobuf.Ranking.Entry[] = [];
for(let i=0; i<car_ghost.length; i++){
list_ghost.push(wms.wm.protobuf.Ranking.Entry.create({
list_ghost.push(wmsrv.wm.protobuf.Ranking.Entry.create({
carId: car_ghost[i].carId,
rank: car_ghost[i].level,
result: car_ghost[i].rgWinCount,
@ -193,7 +193,7 @@ export default class StartupModule extends Module {
}
if(car_ghost.length < 20){
for(let j=car_ghost.length; j<20; j++){
list_ghost.push(wms.wm.protobuf.Ranking.Entry.create({
list_ghost.push(wmsrv.wm.protobuf.Ranking.Entry.create({
carId: 0,
rank: 0,
result: 0,
@ -209,12 +209,12 @@ export default class StartupModule extends Module {
}));
}
}
lists.push(new wms.wm.protobuf.Ranking.List({
rankingType: 101,
lists.push(new wmsrv.wm.protobuf.Ranking.List({
rankingType: 101, // RANKING_GHOST_DEFEATED_COUNT
topRecords: list_ghost
}));
let resp = wms.wm.protobuf.Ranking.encode({lists});
let resp = wmsrv.wm.protobuf.Ranking.encode({lists});
let end = resp.finish();
let r = res
.header('Server', 'v388 wangan')