1
0
mirror of synced 2024-12-04 19:17:58 +01:00

fix something

This commit is contained in:
ghkkk090 2022-07-27 12:41:07 +07:00
parent 561cf5533a
commit c612e73c5f
2 changed files with 61 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import e, { Application } from "express";
import { Module } from "../module";
import * as wm from "../wmmt/wm.proto";
import * as svc from "../wmmt/service.proto";
import * as wms from "../wmmt/service.proto";
import { prisma } from "..";
import { Car, User } from "@prisma/client";
import { Config } from "../config";
@ -269,7 +269,6 @@ export default class GameModule extends Module {
}
case wm.wm.protobuf.GameMode.MODE_VS_BATTLE:
{
console.log(body);
let saveEx: any = {};
if(body.vsResult?.vsPlayCount !== null && body.vsResult?.vsPlayCount !== undefined){
saveEx.vsPlayCount = body.vsResult?.vsPlayCount!;
@ -407,7 +406,7 @@ export default class GameModule extends Module {
},
},
})
console.log('How many meter already obtained : ' +carItemCount);
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){
@ -2069,10 +2068,29 @@ 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({
include:{
gtWing: true
}
});
let lists_stamptarget: wm.wm.protobuf.StampTargetCar[] = [];
for(let i=0; i<cars.length; i++){
lists_stamptarget.push(wm.wm.protobuf.StampTargetCar.create({
car: cars[i],
returnCount: 0,
locked: false,
recommended: true,
}));
}
//---------------MAYBE NOT CORRECT---------------
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
stampSheetCount: 100,
stampTargetCars: lists_stamptarget,
history: cars,
};
//-----------------------------------------------
let resp = wm.wm.protobuf.LoadGhostBattleInfoResponse.encode(msg);
@ -2085,6 +2103,23 @@ export default class GameModule extends Module {
r.send(Buffer.from(end));
})
app.post('/method/load_stamp_target', async (req, res) => {
let body = wm.wm.protobuf.LoadStampTargetRequest.decode(req.body);
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/search_cars_by_level', async (req, res) => {
let body = wm.wm.protobuf.SearchCarsByLevelRequest.decode(req.body);
//---------------MAYBE NOT CORRECT---------------
@ -2188,6 +2223,23 @@ export default class GameModule extends Module {
.header('Content-Length', end.length.toString())
.status(200);
r.send(Buffer.from(end));
})
app.post('/method/lock_crown', (req, res) => {
let body = wms.wm.protobuf.LockCrownRequest.decode(req.body);
//---------------MAYBE NOT CORRECT---------------
let msg = {
error: wms.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
//-----------------------------------------------
let resp = wms.wm.protobuf.LockCrownResponse.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));
})
}
}

View File

@ -102,8 +102,8 @@ export default class StartupModule extends Module {
result: resulttime,
name: '',
regionId: 0,
model: Math.floor(Math.random() * 100),
visualModel: Math.floor(Math.random() * 100),
model: Math.floor(Math.random() * 106) + 1,
visualModel: Math.floor(Math.random() * 106) + 1,
defaultColor: 0,
tunePower: 0,
tuneHandling: 0,
@ -152,8 +152,8 @@ export default class StartupModule extends Module {
result: 0,
name: '',
regionId: 0,
model: Math.floor(Math.random() * 100),
visualModel: Math.floor(Math.random() * 100),
model: Math.floor(Math.random() * 106) + 1,
visualModel: Math.floor(Math.random() * 106) + 1,
defaultColor: 0,
tunePower: 0,
tuneHandling: 0,
@ -199,8 +199,8 @@ export default class StartupModule extends Module {
result: 0,
name: '',
regionId: 0,
model: Math.floor(Math.random() * 100),
visualModel: Math.floor(Math.random() * 100),
model: Math.floor(Math.random() * 106) + 1,
visualModel: Math.floor(Math.random() * 106) + 1,
defaultColor: 0,
tunePower: 0,
tuneHandling: 0,