1
0
mirror of https://github.com/shiroikitsu8/Bayshore_6r_legacy.git synced 2025-01-19 17:58:40 +01:00

Merge pull request #36 from ghkkk090/master

fix something something
This commit is contained in:
Luna 2022-08-26 11:02:57 +01:00 committed by GitHub
commit 624bc066c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 119 additions and 43 deletions

View File

@ -1,6 +1,10 @@
# Bayshore
Wangan Midnight Maximum Tune 6 server reimplementation written in TypeScript
<p align="center">
<img src="https://repository-images.githubusercontent.com/523956269/9a72b45d-7b27-4237-8aeb-476865a6d6d6" width="640" title="hover text">
</p>
## Credits
This software is part of [Project Asakura](https://github.com/ProjectAsakura).

View File

@ -197,12 +197,21 @@ export default class CarModule extends Module {
lastPlayedPlace: true
}
})
let result = 0;
if(challengers.result > 0)
{
result = -Math.abs(challengers.result);
}
else{
result = Math.abs(challengers.result);
}
carsChallengers.push(
wm.wm.protobuf.ChallengerCar.create({
car: carTarget!,
stamp: challengers.stamp,
result: challengers.result,
result: result,
area: challengers.area
})
);
@ -588,8 +597,8 @@ export default class CarModule extends Module {
rivalMarker: common.sanitizeInput(cars.rivalMarker),
aura: common.sanitizeInput(cars.aura),
auraMotif: common.sanitizeInput(cars.auraMotif),
rgStamp: common.sanitizeInput(body.rgStamp),
lastPlayed: date
rgStamp: common.sanitizeInputNotZero(body.rgStamp),
lastPlayedAt: date
}
// Update the car info
@ -672,11 +681,12 @@ export default class CarModule extends Module {
// Update the GT Wing (custom wing) info
// Get the GT Wing data for the car
let gtWing = body.car?.gtWing;
let dataGTWing: any;
// GT Wing is set
if (gtWing)
{
let dataGTWing : any = {
dataGTWing = {
pillar: common.sanitizeInput(gtWing.pillar),
pillarMaterial: common.sanitizeInput(gtWing.pillarMaterial),
mainWing: common.sanitizeInput(gtWing.mainWing),
@ -684,14 +694,25 @@ export default class CarModule extends Module {
wingTip: common.sanitizeInput(gtWing.wingTip),
material: common.sanitizeInput(gtWing.material),
}
await prisma.carGTWing.update({
where: {
dbId: body.carId
},
data: dataGTWing
})
}
else
{
dataGTWing = {
pillar: 0,
pillarMaterial: 0,
mainWing: 0,
mainWingColor: 0,
wingTip: 0,
material: 0,
}
}
await prisma.carGTWing.update({
where: {
dbId: body.carId
},
data: dataGTWing
})
// Response data
let msg = {

View File

@ -126,11 +126,20 @@ export default class GhostModule extends Module {
}
})
let result = 0;
if(challengers[i].result > 0)
{
result = -Math.abs(challengers[i].result);
}
else{
result = Math.abs(challengers[i].result);
}
carsChallenger.push(
wm.wm.protobuf.ChallengerCar.create({
car: carTarget!,
stamp: challengers[i].stamp,
result: challengers[i].result,
result: result,
area: challengers[i].area
})
);
@ -218,11 +227,20 @@ export default class GhostModule extends Module {
}
})
let result = 0;
if(challengers[i].result > 0)
{
result = -Math.abs(challengers[i].result);
}
else{
result = Math.abs(challengers[i].result);
}
carsChallenger.push(
wm.wm.protobuf.ChallengerCar.create({
car: carTarget!,
stamp: challengers[i].stamp,
result: challengers[i].result,
result: result,
area: challengers[i].area
})
);
@ -918,9 +936,12 @@ export default class GhostModule extends Module {
})
// idk what this is this for
// Lock Crown
app.post('/method/lock_crown', (req, res) => {
// Get the information from the request
let body = wmsrv.wm.protobuf.LockCrownRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,

View File

@ -24,10 +24,10 @@ export default class ResourceModule extends Module {
// Response data
places.push(new wm.wm.protobuf.Place({
placeId: Config.getConfig().placeId,
regionId: Config.getConfig().regionId,
shopName: Config.getConfig().shopName,
country: Config.getConfig().country
placeId: Config.getConfig().placeId || 'JPN0123',
regionId: Number(Config.getConfig().regionId) || 1,
shopName: Config.getConfig().shopName || 'Bayshore',
country: Config.getConfig().country || 'JPN'
}));
let checkPlaceList = await prisma.placeList.findFirst({
@ -42,10 +42,10 @@ export default class ResourceModule extends Module {
await prisma.placeList.create({
data:{
placeId: Config.getConfig().placeId,
regionId: Number(Config.getConfig().regionId),
shopName: Config.getConfig().shopName,
country: Config.getConfig().country
placeId: Config.getConfig().placeId || 'JPN0123',
regionId: Number(Config.getConfig().regionId) || 1,
shopName: Config.getConfig().shopName || 'Bayshore',
country: Config.getConfig().country || 'JPN'
}
})
}

View File

@ -157,8 +157,6 @@ export default class StartupModule extends Module {
// Ping
app.post('/method/ping', (req, res) => {
console.log('ping');
let body = wm.wm.protobuf.PingRequest.decode(req.body);
// Response data

View File

@ -998,13 +998,16 @@ export default class TerminalModule extends Module {
/*
app.post('/method/load_unreceived_user_items', async (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.LoadUnreceivedUserItemsRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
// Encode the response
let message = wmsrv.wm.protobuf.LockStampTargetResponse.encode(msg);
let message = wmsrv.wm.protobuf.LoadUnreceivedUserItemsResponse.encode(msg);
// Send the response to the client
common.sendResponse(message, res);
@ -1013,6 +1016,9 @@ export default class TerminalModule extends Module {
app.post('/method/save_screenshot', async (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.SaveScreenshotRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
@ -1028,6 +1034,9 @@ export default class TerminalModule extends Module {
app.post('/method/check_item_receivable_cars', async (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.CheckItemReceivableCarsRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,

View File

@ -279,7 +279,7 @@ export default class UserModule extends Module {
// Change Ghost Stamp tutorial to true
if(user.tutorials[20] === false)
{
console.log(`Change Ghost Stamp tutorial to true`)
console.log('Change Ghost Stamp tutorial to true')
for(let i=20; i<25; i++)
{
user.tutorials[i] = true
@ -347,15 +347,14 @@ export default class UserModule extends Module {
// Check each car record
for(let i=0; i<msg.cars.length; i++)
{
{
// Check Competition (OCM) Participation, and available OCM event
if(user.cars.length > 0 && ocmEventDate)
{
// Current date is OCM main draw
if(ocmEventDate!.competitionStartAt < date && ocmEventDate!.competitionCloseAt > date)
{
// Check ghost battle record
// Check ocm play record
let checkParticipation = await prisma.oCMPlayRecord.findFirst({
where:{
carId: user.cars[i].carId,
@ -383,11 +382,16 @@ export default class UserModule extends Module {
carStates[i].competitionState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_QUALIFIED
}
}
else
{
carStates[i].eventJoined = false;
carStates[i].competitionState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_NOT_PARTICIPATED
}
}
// Current date is OCM qualifying day
else if(ocmEventDate!.qualifyingPeriodStartAt < date && ocmEventDate!.qualifyingPeriodCloseAt > date)
{
// Check ghost battle record
// Check ocm play record
let checkParticipation = await prisma.oCMPlayRecord.findFirst({
where:{
carId: user.cars[i].carId,
@ -416,11 +420,16 @@ export default class UserModule extends Module {
carStates[i].competitionState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_PARTICIPATED
}
}
else
{
carStates[i].eventJoined = false;
carStates[i].competitionState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_NOT_PARTICIPATED
}
}
// Current date is OCM ended
else if(ocmEventDate!.competitionCloseAt < date && ocmEventDate!.competitionEndAt > date)
{
// Check ghost battle record
// Check ocm play record
let checkParticipation = await prisma.oCMPlayRecord.findFirst({
where:{
carId: user.cars[i].carId,
@ -449,6 +458,11 @@ export default class UserModule extends Module {
carStates[i].competitionState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_QUALIFIED
}
}
else
{
carStates[i].eventJoined = false;
carStates[i].competitionState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_NOT_PARTICIPATED
}
}
}
@ -490,17 +504,17 @@ export default class UserModule extends Module {
if(ParticipationMainDrawCounter > 0)
{
console.log('OCM Participation : '+ParticipationMainDrawCounter+' car(s) Qualified');
msg.competitionUserState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_QUALIFIED;
msg.competitionUserState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_QUALIFIED
}
else if(ParticipationQualifyingCounter > 0)
{
console.log('OCM Participation : '+ParticipationQualifyingCounter+' car(s) Participated');
msg.competitionUserState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_PARTICIPATED;
msg.competitionUserState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_PARTICIPATED
}
else if(ParticipationEndedCounter > 0)
{
console.log('OCM Participation : '+ParticipationEndedCounter+' car(s) played OCM Event');
msg.competitionUserState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_QUALIFIED;
msg.competitionUserState = wm.wm.protobuf.GhostCompetitionParticipantState.COMPETITION_QUALIFIED
}
else if(ocmEventDate)
{
@ -652,6 +666,9 @@ export default class UserModule extends Module {
// Start Transfer
app.post('/method/start_transfer', (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.StartTransferRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
@ -668,6 +685,9 @@ export default class UserModule extends Module {
// Grant Car Right
app.post('/method/grant_car_right', (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.GrantCarRightRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
@ -684,6 +704,9 @@ export default class UserModule extends Module {
// Ask Access Code
app.post('/method/ask_access_code', (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.AskAccessCodeRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
@ -700,6 +723,9 @@ export default class UserModule extends Module {
// Participate In Invite Friend Campaign
app.post('/method/participate_in_invite_friend_campaign', (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.ParticipateInInviteFriendCampaignRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,
@ -715,6 +741,9 @@ export default class UserModule extends Module {
app.post('/method/consume_user_item', async (req, res) => {
// Get the information from the request
let body = wm.wm.protobuf.ConsumeUserItemRequest.decode(req.body);
// Response data
let msg = {
error: wmsrv.wm.protobuf.ErrorCode.ERR_SUCCESS,

View File

@ -9,8 +9,6 @@ import * as ghost_get_area_from_path from "../ghost/ghost_util/ghost_get_area_fr
export async function sendStamp(body: wm.protobuf.SaveGameResultRequest)
{
let consoleLog = 0; // stupid stuff for console log notice
let rgResult = body.rgResult;
// Get current date
@ -51,10 +49,9 @@ export async function sendStamp(body: wm.protobuf.SaveGameResultRequest)
if(checkCar)
{
if(consoleLog === 0)
if(i === 0)
{
console.log('Sending Stamp');
consoleLog = 1;
}
// Create Challenger data
@ -71,7 +68,7 @@ export async function sendStamp(body: wm.protobuf.SaveGameResultRequest)
let dataStampTarget: any = {
carId: body.carId,
stampTargetCarId: rgResult.opponents![i].carId,
returnCount: 1,
returnCount: 0,
locked: false,
recommended: true
}
@ -105,8 +102,6 @@ export async function sendStamp(body: wm.protobuf.SaveGameResultRequest)
export async function shuttleReturnStamp(body: wm.protobuf.SaveGameResultRequest)
{
let consoleLog = 0; // stupid stuff for console log notice
let rgResult = body.rgResult;
// Get current date
@ -147,10 +142,9 @@ export async function shuttleReturnStamp(body: wm.protobuf.SaveGameResultRequest
if(checkCar)
{
if(consoleLog === 0)
if(i === 0)
{
console.log('Returning Stamp');
consoleLog = 1;
}
// Return the stamp