1
0
mirror of synced 2025-02-12 09:02:57 +01:00
Bayshore/src/modules/game.ts

492 lines
15 KiB
TypeScript
Raw Normal View History

2022-07-12 15:50:05 +01:00
import { Application } from "express";
import { Module } from "../module";
import * as wm from "../wmmt/wm.proto";
import * as svc from "../wmmt/service.proto";
export default class GameModule extends Module {
register(app: Application): void {
app.post('/method/load_time_attack_record', (req, res) => {
console.log('load TA records');
let body = wm.wm.protobuf.LoadTimeAttackRecordRequest.decode(req.body);
let ping = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
};
let resp = wm.wm.protobuf.LoadTimeAttackRecordResponse.encode(ping);
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));
})
2022-07-14 13:38:18 +07:00
//terminal specific
app.post('/method/load_terminal_information', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
prizeReceivable: false,
transferNotice: {
needToSeeTransferred: false
},
announceFeature: false,
freeScratched: true
}
let resp = wm.wm.protobuf.LoadDriveInformationResponse.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_scratch_information', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
currentSheet: 21,
numOfScratched: 0,
}
let resp = wm.wm.protobuf.LoadScratchInformationResponse.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/update_car', (req, res) => {
2022-07-14 13:38:18 +07:00
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
}
let resp = wm.wm.protobuf.UpdateCarResponse.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));
})
//banapass loading
app.post('/method/start_transfer', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
userId: 0,
2022-07-14 13:38:18 +07:00
}
let resp = wm.wm.protobuf.StartTransferResponse.encode(msg);
2022-07-14 13:38:18 +07:00
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));
})
2022-07-12 15:50:05 +01:00
app.post('/method/load_user', (req, res) => {
//everything after this should be replaced with values from a database, but thats above my pay grade :P
2022-07-12 15:50:05 +01:00
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
unlockAt: 1563072119,
2022-07-14 13:38:18 +07:00
accessCode: "12345678901234567890",
banapassportAmId: 69,
mbid: 69,
userId: 69,
2022-07-12 15:50:05 +01:00
numOfOwnedCars: 1,
spappState: wm.wm.protobuf.SmartphoneAppState.SPAPP_UNREGISTERED,
transferState: wm.wm.protobuf.TransferState.TRANSFERRED,
2022-07-14 13:38:18 +07:00
cars: [
{
carId: 106,
2022-07-14 13:38:18 +07:00
userId: 0,
regionId: 0,
name: "a",
manufacturer: 12,
model: 106,
visualModel: 131,
2022-07-14 13:38:18 +07:00
defaultColor: 0,
customColor: 0,
wheel: 82,
2022-07-14 13:38:18 +07:00
wheelColor: 0,
aero: 0,
bonnet: 0,
wing: 0,
mirror: 0,
neon: 0,
trunk: 0,
plate: 0,
plateColor: 0,
plateNumber: 0,
tunePower: 17,
tuneHandling: 17,
title: "Mobil Spek Mainland BOS!!!!!!",
level: 0,
2022-07-14 13:38:18 +07:00
windowSticker: false,
rivalMarker: 0,
lastPlayedAt: 0,
aura: 0,
auraMotif: 0,
ghostLevel: 12,
2022-07-14 13:38:18 +07:00
country: "JPN",
searchCode: "a",
},
],
carStates: [
{
hasOpponentGhost: false,
toBeDeleted: false,
eventJoined: false,
transferred: false,
2022-07-14 13:38:18 +07:00
driveLastPlayedAt: 0,
},
],
unusedCarTickets: [
{
category: wm.wm.protobuf.ItemCategory.CAT_CAR_TICKET_FREE,
itemId: 5,
2022-07-14 13:38:18 +07:00
},
],
tutorials: [
true, //TUTORIAL_ID_STORY
true, //TUTORIAL_ID_TIME_ATTACK
true, //TUTORIAL_ID_GHOST
true, //TUTORIAL_ID_GHOST_CHALLENGE
true, //TUTORIAL_ID_GHOST_LEVEL
true, //TUTORIAL_ID_UNUSED_5
true, //TUTORIAL_ID_GHOST_SEARCH
true, //TUTORIAL_ID_GHOST_COMPETITION
true, //TUTORIAL_ID_HP600_CARD
true, //TUTORIAL_ID_UNUSED_9
true, //TUTORIAL_ID_COMPETITION_QUALIFIED
true, //TUTORIAL_ID_COMPETITION_TERMINAL
true, //TUTORIAL_ID_COMPETITION_NOTICE
true, //TUTORIAL_ID_COMPETITION_FINISHED
true, //TUTORIAL_ID_UNUSED_14
true, //TUTORIAL_ID_UNUSED_15
true, //TUTORIAL_ID_UNUSED_16
true, //TUTORIAL_ID_UNUSED_17
true, //TUTORIAL_ID_UNUSED_18
true, //TUTORIAL_ID_UNUSED_19
true, //TUTORIAL_ID_GHOST_STAMP
true, //TUTORIAL_ID_GHOST_STAMP_DECLINED
true, //TUTORIAL_ID_GHOST_STAMP_FRIENDS
true, //TUTORIAL_ID_TERMINAL_SCRATCH
true, //TUTORIAL_ID_TURN_SCRATCH_SHEET
true, //TUTORIAL_ID_INVITE_FRIEND_CAMPAIGN
true, //TUTORIAL_ID_CAR_COUPON_FULL_TUNED_RECEIVABLE
true, //TUTORIAL_ID_VS_CONTINUE_TICKET
true, //TUTORIAL_ID_UNUSED_28
true, //TUTORIAL_ID_UNUSED_29
true, //TUTORIAL_ID_UNUSED_30
true, //TUTORIAL_ID_DRESS_UP
true, //TUTORIAL_ID_MULTI_GHOST
true, //TUTORIAL_ID_STORY_NEW_FEATURE
true, //TUTORIAL_ID_GHOST_NEW_FEATURE
true, //TUTORIAL_ID_GHOST_REGION_MAP
],
2022-07-12 15:50:05 +01:00
}
let resp = wm.wm.protobuf.LoadUserResponse.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_drive_information', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
noticeWindow: [],
noticeWindowMessage: [],
2022-07-14 13:38:18 +07:00
transferNotice: {
needToSeeTransferred: false,
2022-07-14 10:00:03 +01:00
totalMaxiGold: 0,
numOfPorscheCars: 0,
porscheModels: [],
hasR35: false,
2022-07-14 13:38:18 +07:00
},
restrictedModels: [],
announceFeature: false,
announceMobile: false,
2022-07-14 10:00:03 +01:00
availableTickets: [
{
category: wm.wm.protobuf.ItemCategory.CAT_CAR_TICKET,
itemId: 1,
2022-07-14 10:00:03 +01:00
}
]
2022-07-12 15:50:05 +01:00
}
let resp = wm.wm.protobuf.LoadDriveInformationResponse.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));
})
2022-07-14 13:38:18 +07:00
app.post('/method/load_car', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
//everything after this should be replaced with values from a database, but thats above my pay grade :P
car:
{
carId: 106,
userId: 0,
regionId: 0,
name: "a",
manufacturer: 12,
model: 106,
visualModel: 131,
defaultColor: 0,
customColor: 0,
wheel: 82,
wheelColor: 0,
aero: 0,
bonnet: 0,
wing: 0,
mirror: 0,
neon: 0,
trunk: 0,
plate: 0,
plateColor: 0,
plateNumber: 0,
tunePower: 17,
tuneHandling: 17,
title: "Mobil Spek Mainland BOS!!!!!!",
level: 0,
windowSticker: false,
rivalMarker: 0,
lastPlayedAt: 0,
aura: 0,
auraMotif: 0,
ghostLevel: 12,
country: "JPN",
searchCode: "a",
},
tuningPoint: 0,
odometer: 99999999,
playCount: 10,
2022-07-14 13:38:18 +07:00
earnedCustomColor: false,
setting:
{
view: false,
transmission: false,
retire: true,
meter: 1,
navigationMap: true,
volume: 1,
bgm: 0,
nameplate: 0,
nameplateColor: 0,
terminalBackground: 0,
},
vsPlayCount: 69699696,
vsBurstCount: 69696969,
vsStarCount: 696969,
vsStarCountMax: 6969696,
vsCoolOrWild: 0,
2022-07-14 13:38:18 +07:00
vsSmoothOrRough: 0,
vsTripleStarMedals: 69699696,
2022-07-14 13:38:18 +07:00
vsDoubleStarMedals: 0,
vsSingleStarMedals: 0,
vsPlainMedals: 0,
rgPlayCount: 6000,
rgWinCount: 6000,
rgTrophy: 6000,
rgPreviousVersionPlayCount: 6000,
rgScore: 1,
rgStamp: 100,
2022-07-14 13:38:18 +07:00
rgAcquireAllCrowns: true,
dressupLevel: 63,
dressupPoint: 0,
stPlayCount: 0,
2022-07-14 13:38:18 +07:00
stClearBits: 0,
stClearDivCount: 0,
stClearCount: 0,
2022-07-14 13:38:18 +07:00
stLoseBits: 0,
stConsecutiveWins: 699999,
stConsecutiveWinsMax: 420,
2022-07-14 13:38:18 +07:00
stCompleted_100Episodes: false,
ownedItems: [
{
category: wm.wm.protobuf.ItemCategory.CAT_METER,
itemId: 1,
amount: 1,
},
],
2022-07-14 13:38:18 +07:00
auraMotifAutoChange: false,
screenshotCount: 0,
transferred: true,
2022-07-14 13:38:18 +07:00
}
let resp = wm.wm.protobuf.LoadCarResponse.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_stamp_target', (req, res) => {
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/save_scratch_sheet', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
currentSheet: 0,
numOfScratched: 0,
}
let resp = wm.wm.protobuf.SaveScratchSheetResponse.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));
})
2022-07-12 15:50:05 +01:00
app.post('/method/create_car', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
userId: 69,
carId: 8,
2022-07-12 15:50:05 +01:00
}
let resp = wm.wm.protobuf.CreateCarResponse.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_game_history', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
taRankingUpdatedAt: 0,
ghostBattleCount: 9999,
ghostBattleWinCount: 9999,
2022-07-12 15:50:05 +01:00
stampSheetCount: 100,
}
let resp = wm.wm.protobuf.LoadGameHistoryResponse.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/save_game_result', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
/*
carId: 8,
gameMode: 4,
playedAt: 0,
playCount: 1,
retired: false,
timeup: false,
odometer: 694201337,
earnedCustomColor: false,
confirmedTutorials: [],
earnedItems: {
category: wm.wm.protobuf.ICarItem[wm.wm.protobuf.ItemCategory.CAT_NUMBER_PLATE],
itemId: 0,
},
earnedUserItems: {
category: wm.wm.protobuf.ICarItem[wm.wm.protobuf.ItemCategory.CAT_NUMBER_PLATE],
itemId: 1,
},
preservedTitles: "ur gay",
neighborCars: 69,
*/
}
let resp = wm.wm.protobuf.SaveGameResultResponse.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/update_user_session', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
}
let resp = wm.wm.protobuf.UpdateUserSessionResponse.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));
})
//ghost battle stuff
app.post('/method/load_ghost_battle_info', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
stampSheetCount: 100,
2022-07-12 15:50:05 +01:00
}
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/lock_crown', (req, res) => {
let msg = {
error: wm.wm.protobuf.ErrorCode.ERR_SUCCESS,
}
let resp = svc.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));
})
}
2022-07-14 13:38:18 +07:00
}