From 28814466702e628ba45e701176861a5802fe6ac0 Mon Sep 17 00:00:00 2001 From: AKCore Date: Sat, 3 Jun 2023 17:50:58 -0700 Subject: [PATCH 1/8] basic session management completed multiplayer joining fine --- .../api/deleteSessionController.ts | 6 +- src/controllers/api/findSessionsController.ts | 35 +++- .../api/getNewRewardSeedController.ts | 8 +- src/controllers/api/hostSessionController.ts | 5 +- src/controllers/api/joinSessionController.ts | 12 ++ src/controllers/api/logoutController.ts | 5 +- .../api/updateSessionController.ts | 6 +- src/managers/sessionManager.ts | 157 ++++++++++++++++++ src/routes/api.ts | 3 + 9 files changed, 228 insertions(+), 9 deletions(-) create mode 100644 src/controllers/api/joinSessionController.ts create mode 100644 src/managers/sessionManager.ts diff --git a/src/controllers/api/deleteSessionController.ts b/src/controllers/api/deleteSessionController.ts index ba062e88..6f5a8bc4 100644 --- a/src/controllers/api/deleteSessionController.ts +++ b/src/controllers/api/deleteSessionController.ts @@ -1,7 +1,11 @@ import { RequestHandler } from "express"; +import { deleteSession } from '@/src/managers/sessionManager'; const deleteSessionController: RequestHandler = (_req, res) => { - res.json({ sessionId: { $oid: "64768f104722f795300c9fc0" }, rewardSeed: 5867309943877621023 }); + + //res.json({ sessionId: { $oid: "64768f104722f795300c9fc0" }, rewardSeed: 5867309943877621023 }); + deleteSession(_req.query.sessionId as string); + res.sendStatus(200); }; export { deleteSessionController }; diff --git a/src/controllers/api/findSessionsController.ts b/src/controllers/api/findSessionsController.ts index 32b1cf33..1ddd36e7 100644 --- a/src/controllers/api/findSessionsController.ts +++ b/src/controllers/api/findSessionsController.ts @@ -1,9 +1,42 @@ import { RequestHandler } from "express"; +import { getSession } from '@/src/managers/sessionManager'; const findSessionsController: RequestHandler = (_req, res) => { + console.log("FindSession Request:", JSON.parse(_req.body)); + let r = JSON.parse(_req.body); + if(r != undefined) + { + console.log("Found ID"); + let s = getSession(r.id); + + if(s) + res.json({"queryId":r.queryId,"Sessions":s}); + else + res.json({}); + } + else if(r != undefined) + { + console.log("Found OriginalSessionID"); + + let s = getSession(r.originalSessionId); + if(s) + res.json({"queryId":r.queryId,"Sessions":[s]}); + else + res.json({}); + + } + else + { + console.log("Found SessionRequest"); + + let s = getSession(_req.body); + if(s) + res.json({"queryId":r.queryId,"Sessions":[s]}); + else + res.json({}); + } - res.json({ sessionId: { $oid: "64768f104722f795300c9fc0" }, rewardSeed: 5867309943877621023 }); }; export { findSessionsController }; diff --git a/src/controllers/api/getNewRewardSeedController.ts b/src/controllers/api/getNewRewardSeedController.ts index d700ac5d..716bc54b 100644 --- a/src/controllers/api/getNewRewardSeedController.ts +++ b/src/controllers/api/getNewRewardSeedController.ts @@ -1,7 +1,13 @@ import { RequestHandler } from "express"; const getNewRewardSeedController: RequestHandler = (_req, res) => { - res.json({ rewardSeed: 5867309943877621023 }); + res.json({ rewardSeed: 1111111111 }); }; +function generateRewardSeed(): number { + const min = -Number.MAX_SAFE_INTEGER; + const max = Number.MAX_SAFE_INTEGER; + return Math.floor(Math.random() * (max - min + 1)) + min; + } + export { getNewRewardSeedController }; diff --git a/src/controllers/api/hostSessionController.ts b/src/controllers/api/hostSessionController.ts index bbeb8eb7..797ea433 100644 --- a/src/controllers/api/hostSessionController.ts +++ b/src/controllers/api/hostSessionController.ts @@ -1,9 +1,12 @@ import { RequestHandler } from "express"; +import { createNewSession } from '@/src/managers/sessionManager'; const hostSessionController: RequestHandler = (_req, res) => { console.log("HostSession Request:", JSON.parse(_req.body)); + let session = createNewSession(JSON.parse(_req.body), _req.query.accountId as string); + console.log("New Session Created: ", session); - res.json({ sessionId: { $oid: "64768f104722f795300c9fc0" }, rewardSeed: 5867309943877621023 }); + res.json({ sessionId: { $oid: session.sessionId }, rewardSeed:99999999 }); }; export { hostSessionController }; diff --git a/src/controllers/api/joinSessionController.ts b/src/controllers/api/joinSessionController.ts new file mode 100644 index 00000000..726622f8 --- /dev/null +++ b/src/controllers/api/joinSessionController.ts @@ -0,0 +1,12 @@ +import { RequestHandler } from "express"; +import { getSessionByID } from '@/src/managers/sessionManager'; + +const joinSessionController: RequestHandler = (_req, res) => { + + console.log("JoinSession Request:", JSON.parse(_req.body)); + let r = JSON.parse(_req.body); + let s = getSessionByID(r.sessionIds[0]) + res.json({"rewardSeed":s?.rewardSeed,"sessionId":{"$oid":s?.sessionId}}); +}; + +export { joinSessionController }; \ No newline at end of file diff --git a/src/controllers/api/logoutController.ts b/src/controllers/api/logoutController.ts index 615008a5..e41ac656 100644 --- a/src/controllers/api/logoutController.ts +++ b/src/controllers/api/logoutController.ts @@ -1,12 +1,11 @@ import { RequestHandler } from "express"; const logoutController: RequestHandler = (_req, res) => { - const data = Buffer.from([0x31]); res.writeHead(200, { "Content-Type": "text/html", - "Content-Length": data.length + "Content-Length": 1 }); - res.end(data); + res.end("1"); }; export { logoutController }; diff --git a/src/controllers/api/updateSessionController.ts b/src/controllers/api/updateSessionController.ts index f9e1cf16..ddaf901c 100644 --- a/src/controllers/api/updateSessionController.ts +++ b/src/controllers/api/updateSessionController.ts @@ -1,11 +1,13 @@ import { RequestHandler } from "express"; +import { updateSession } from '@/src/managers/sessionManager'; const updateSessionGetController: RequestHandler = (_req, res) => { res.json({}); }; const updateSessionPostController: RequestHandler = (_req, res) => { console.log("UpdateSessions POST Request:", JSON.parse(_req.body)); - - res.json({ hasStarted: true }); + console.log("ReqID:",_req.query.sessionId as string) + updateSession(_req.query.sessionId as string, _req.body) + res.json({}); }; export { updateSessionGetController, updateSessionPostController }; diff --git a/src/managers/sessionManager.ts b/src/managers/sessionManager.ts new file mode 100644 index 00000000..24a502cf --- /dev/null +++ b/src/managers/sessionManager.ts @@ -0,0 +1,157 @@ +interface Session { + sessionId: string; + creatorId: string; + maxPlayers: number; + minPlayers: number; + privateSlots: number; + scoreLimit: number; + timeLimit: number; + gameModeId: number; + eloRating: number; + regionId: number; + difficulty: number; + hasStarted: boolean; + enableVoice: boolean; + matchType: string; + maps: string[]; + originalSessionId: string; + customSettings: string; + rewardSeed: number; + guildId: string; + buildId: number; + platform: number; + xplatform: boolean; + freePublic: number; + freePrivate: number; + fullReset: number; + } + + const sessions: Session[] = []; + + function createNewSession(sessionData: Session, Creator: string): Session { + const sessionId = getNewSessionID(); + const newSession: Session = { + sessionId, + creatorId: Creator, + maxPlayers: sessionData.maxPlayers || 4, + minPlayers: sessionData.minPlayers || 1, + privateSlots: sessionData.privateSlots || 0, + scoreLimit: sessionData.scoreLimit || 15, + timeLimit: sessionData.timeLimit || 900, + gameModeId: sessionData.gameModeId || 0, + eloRating: sessionData.eloRating || 3, + regionId: sessionData.regionId || 3, + difficulty: sessionData.difficulty || 0, + hasStarted: sessionData.hasStarted || false, + enableVoice: sessionData.enableVoice || true, + matchType: sessionData.matchType || 'NORMAL', + maps: sessionData.maps || [], + originalSessionId: sessionData.originalSessionId || '', + customSettings: sessionData.customSettings || '', + rewardSeed: sessionData.rewardSeed || -1, + guildId: sessionData.guildId || '', + buildId: sessionData.buildId || 4920386201513015989, + platform: sessionData.platform || 0, + xplatform: sessionData.xplatform || true, + freePublic: sessionData.freePublic || 3, + freePrivate: sessionData.freePrivate || 0, + fullReset:0, + }; + sessions.push(newSession); + return newSession; + } + + function getAllSessions(): Session[] { + return sessions; + } + + function getSessionByID(sessionId: string): Session | undefined { + return sessions.find(session => session.sessionId === sessionId); + } + + + interface FindSessionRequest { + [key: string]: any; + } + + function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] { + if (typeof sessionIdOrRequest === 'string') { + const session = sessions.find(session => session.sessionId === sessionIdOrRequest); + if (session) { + console.log("Found Sessions:",session) + return [ + { + createdBy: session.creatorId, + id: session.sessionId, + }, + ]; + } + return []; + } else { + const request = sessionIdOrRequest as FindSessionRequest; + const matchingSessions = sessions.filter(session => { + for (const key in request) { + if (key !== 'eloRating' && key !== 'queryId' && request[key] !== session[key as keyof Session]) { + return false; + } + } + console.log("Found Matching Sessions:",matchingSessions) + return true; + }); + return matchingSessions.map(session => ({ + createdBy: session.creatorId, + id: session.sessionId, + })); + } + } + + function getSessionByCreatorID(creatorId: string): Session | undefined { + return sessions.find(session => session.creatorId === creatorId); + } + + function getNewSessionID(): string { + const characters = '0123456789abcdef'; + const maxAttempts = 100; + let sessionId = ''; + + for (let attempt = 0; attempt < maxAttempts; attempt++) { + sessionId = '64'; + for (let i = 0; i < 22; i++) { + const randomIndex = Math.floor(Math.random() * characters.length); + sessionId += characters[randomIndex]; + } + + if (!sessions.some(session => session.sessionId === sessionId)) { + return sessionId; + } + } + + throw new Error('Failed to generate a unique session ID'); + } + + function updateSession(sessionId: string, sessionData: string): boolean { + const session = sessions.find(session => session.sessionId === sessionId); + if (session) { + try { + const updatedData = JSON.parse(sessionData); + Object.assign(session, updatedData); + return true; + } catch (error) { + console.error('Invalid JSON string for session update.'); + return false; + } + } + return false; + } + + function deleteSession(sessionId: string): boolean { + const index = sessions.findIndex(session => session.sessionId === sessionId); + if (index !== -1) { + sessions.splice(index, 1); + return true; + } + return false; + } + + export { createNewSession, getAllSessions, getSessionByID, getSessionByCreatorID, getNewSessionID, updateSession, deleteSession, getSession }; + \ No newline at end of file diff --git a/src/routes/api.ts b/src/routes/api.ts index d13e8edd..1a5d8a11 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -27,6 +27,8 @@ import { surveysController } from "@/src/controllers/api/surveysController"; import { updateChallengeProgressController } from "@/src/controllers/api/updateChallengeProgressController"; import { updateSessionGetController, updateSessionPostController } from "@/src/controllers/api/updateSessionController"; import { viewController } from "@/src/controllers/api/viewController"; +import { joinSessionController } from "@/src/controllers/api/joinSessionController"; + import express from "express"; const apiRouter = express.Router(); @@ -65,4 +67,5 @@ apiRouter.post("/updateSession.php", updateSessionPostController); apiRouter.post("/missionInventoryUpdate.php", missionInventoryUpdateController); apiRouter.post("/genericUpdate.php", genericUpdateController); apiRouter.post("/rerollRandomMod.php", rerollRandomModController); +apiRouter.post("/joinSession.php", joinSessionController); export { apiRouter }; -- 2.47.2 From 8996ba8e1c7c0fd0b59f243363fc3eada84b1641 Mon Sep 17 00:00:00 2001 From: AKCore Date: Sat, 3 Jun 2023 17:55:19 -0700 Subject: [PATCH 2/8] prettier --- .../api/deleteSessionController.ts | 3 +- src/controllers/api/findSessionsController.ts | 36 +-- .../api/getNewRewardSeedController.ts | 2 +- src/controllers/api/hostSessionController.ts | 4 +- src/controllers/api/joinSessionController.ts | 9 +- src/controllers/api/logoutController.ts | 2 +- .../api/updateSessionController.ts | 6 +- src/managers/sessionManager.ts | 231 +++++++++--------- 8 files changed, 142 insertions(+), 151 deletions(-) diff --git a/src/controllers/api/deleteSessionController.ts b/src/controllers/api/deleteSessionController.ts index 6f5a8bc4..aa98e1d2 100644 --- a/src/controllers/api/deleteSessionController.ts +++ b/src/controllers/api/deleteSessionController.ts @@ -1,8 +1,7 @@ import { RequestHandler } from "express"; -import { deleteSession } from '@/src/managers/sessionManager'; +import { deleteSession } from "@/src/managers/sessionManager"; const deleteSessionController: RequestHandler = (_req, res) => { - //res.json({ sessionId: { $oid: "64768f104722f795300c9fc0" }, rewardSeed: 5867309943877621023 }); deleteSession(_req.query.sessionId as string); res.sendStatus(200); diff --git a/src/controllers/api/findSessionsController.ts b/src/controllers/api/findSessionsController.ts index 1ddd36e7..caa326b9 100644 --- a/src/controllers/api/findSessionsController.ts +++ b/src/controllers/api/findSessionsController.ts @@ -1,42 +1,28 @@ import { RequestHandler } from "express"; -import { getSession } from '@/src/managers/sessionManager'; +import { getSession } from "@/src/managers/sessionManager"; const findSessionsController: RequestHandler = (_req, res) => { - console.log("FindSession Request:", JSON.parse(_req.body)); let r = JSON.parse(_req.body); - if(r != undefined) - { + if (r != undefined) { console.log("Found ID"); let s = getSession(r.id); - - if(s) - res.json({"queryId":r.queryId,"Sessions":s}); - else - res.json({}); - } - else if(r != undefined) - { + + if (s) res.json({ queryId: r.queryId, Sessions: s }); + else res.json({}); + } else if (r != undefined) { console.log("Found OriginalSessionID"); let s = getSession(r.originalSessionId); - if(s) - res.json({"queryId":r.queryId,"Sessions":[s]}); - else - res.json({}); - - } - else - { + if (s) res.json({ queryId: r.queryId, Sessions: [s] }); + else res.json({}); + } else { console.log("Found SessionRequest"); let s = getSession(_req.body); - if(s) - res.json({"queryId":r.queryId,"Sessions":[s]}); - else - res.json({}); + if (s) res.json({ queryId: r.queryId, Sessions: [s] }); + else res.json({}); } - }; export { findSessionsController }; diff --git a/src/controllers/api/getNewRewardSeedController.ts b/src/controllers/api/getNewRewardSeedController.ts index 716bc54b..f420f60f 100644 --- a/src/controllers/api/getNewRewardSeedController.ts +++ b/src/controllers/api/getNewRewardSeedController.ts @@ -8,6 +8,6 @@ function generateRewardSeed(): number { const min = -Number.MAX_SAFE_INTEGER; const max = Number.MAX_SAFE_INTEGER; return Math.floor(Math.random() * (max - min + 1)) + min; - } +} export { getNewRewardSeedController }; diff --git a/src/controllers/api/hostSessionController.ts b/src/controllers/api/hostSessionController.ts index 797ea433..c7ac7cb9 100644 --- a/src/controllers/api/hostSessionController.ts +++ b/src/controllers/api/hostSessionController.ts @@ -1,12 +1,12 @@ import { RequestHandler } from "express"; -import { createNewSession } from '@/src/managers/sessionManager'; +import { createNewSession } from "@/src/managers/sessionManager"; const hostSessionController: RequestHandler = (_req, res) => { console.log("HostSession Request:", JSON.parse(_req.body)); let session = createNewSession(JSON.parse(_req.body), _req.query.accountId as string); console.log("New Session Created: ", session); - res.json({ sessionId: { $oid: session.sessionId }, rewardSeed:99999999 }); + res.json({ sessionId: { $oid: session.sessionId }, rewardSeed: 99999999 }); }; export { hostSessionController }; diff --git a/src/controllers/api/joinSessionController.ts b/src/controllers/api/joinSessionController.ts index 726622f8..0b940eb1 100644 --- a/src/controllers/api/joinSessionController.ts +++ b/src/controllers/api/joinSessionController.ts @@ -1,12 +1,11 @@ import { RequestHandler } from "express"; -import { getSessionByID } from '@/src/managers/sessionManager'; +import { getSessionByID } from "@/src/managers/sessionManager"; const joinSessionController: RequestHandler = (_req, res) => { - console.log("JoinSession Request:", JSON.parse(_req.body)); let r = JSON.parse(_req.body); - let s = getSessionByID(r.sessionIds[0]) - res.json({"rewardSeed":s?.rewardSeed,"sessionId":{"$oid":s?.sessionId}}); + let s = getSessionByID(r.sessionIds[0]); + res.json({ rewardSeed: s?.rewardSeed, sessionId: { $oid: s?.sessionId } }); }; -export { joinSessionController }; \ No newline at end of file +export { joinSessionController }; diff --git a/src/controllers/api/logoutController.ts b/src/controllers/api/logoutController.ts index e41ac656..6dab1cc8 100644 --- a/src/controllers/api/logoutController.ts +++ b/src/controllers/api/logoutController.ts @@ -5,7 +5,7 @@ const logoutController: RequestHandler = (_req, res) => { "Content-Type": "text/html", "Content-Length": 1 }); - res.end("1"); + res.end("1"); }; export { logoutController }; diff --git a/src/controllers/api/updateSessionController.ts b/src/controllers/api/updateSessionController.ts index ddaf901c..e949d83e 100644 --- a/src/controllers/api/updateSessionController.ts +++ b/src/controllers/api/updateSessionController.ts @@ -1,13 +1,13 @@ import { RequestHandler } from "express"; -import { updateSession } from '@/src/managers/sessionManager'; +import { updateSession } from "@/src/managers/sessionManager"; const updateSessionGetController: RequestHandler = (_req, res) => { res.json({}); }; const updateSessionPostController: RequestHandler = (_req, res) => { console.log("UpdateSessions POST Request:", JSON.parse(_req.body)); - console.log("ReqID:",_req.query.sessionId as string) - updateSession(_req.query.sessionId as string, _req.body) + console.log("ReqID:", _req.query.sessionId as string); + updateSession(_req.query.sessionId as string, _req.body); res.json({}); }; export { updateSessionGetController, updateSessionPostController }; diff --git a/src/managers/sessionManager.ts b/src/managers/sessionManager.ts index 24a502cf..ecb163a1 100644 --- a/src/managers/sessionManager.ts +++ b/src/managers/sessionManager.ts @@ -24,134 +24,141 @@ interface Session { freePublic: number; freePrivate: number; fullReset: number; - } - - const sessions: Session[] = []; - - function createNewSession(sessionData: Session, Creator: string): Session { +} + +const sessions: Session[] = []; + +function createNewSession(sessionData: Session, Creator: string): Session { const sessionId = getNewSessionID(); const newSession: Session = { - sessionId, - creatorId: Creator, - maxPlayers: sessionData.maxPlayers || 4, - minPlayers: sessionData.minPlayers || 1, - privateSlots: sessionData.privateSlots || 0, - scoreLimit: sessionData.scoreLimit || 15, - timeLimit: sessionData.timeLimit || 900, - gameModeId: sessionData.gameModeId || 0, - eloRating: sessionData.eloRating || 3, - regionId: sessionData.regionId || 3, - difficulty: sessionData.difficulty || 0, - hasStarted: sessionData.hasStarted || false, - enableVoice: sessionData.enableVoice || true, - matchType: sessionData.matchType || 'NORMAL', - maps: sessionData.maps || [], - originalSessionId: sessionData.originalSessionId || '', - customSettings: sessionData.customSettings || '', - rewardSeed: sessionData.rewardSeed || -1, - guildId: sessionData.guildId || '', - buildId: sessionData.buildId || 4920386201513015989, - platform: sessionData.platform || 0, - xplatform: sessionData.xplatform || true, - freePublic: sessionData.freePublic || 3, - freePrivate: sessionData.freePrivate || 0, - fullReset:0, + sessionId, + creatorId: Creator, + maxPlayers: sessionData.maxPlayers || 4, + minPlayers: sessionData.minPlayers || 1, + privateSlots: sessionData.privateSlots || 0, + scoreLimit: sessionData.scoreLimit || 15, + timeLimit: sessionData.timeLimit || 900, + gameModeId: sessionData.gameModeId || 0, + eloRating: sessionData.eloRating || 3, + regionId: sessionData.regionId || 3, + difficulty: sessionData.difficulty || 0, + hasStarted: sessionData.hasStarted || false, + enableVoice: sessionData.enableVoice || true, + matchType: sessionData.matchType || "NORMAL", + maps: sessionData.maps || [], + originalSessionId: sessionData.originalSessionId || "", + customSettings: sessionData.customSettings || "", + rewardSeed: sessionData.rewardSeed || -1, + guildId: sessionData.guildId || "", + buildId: sessionData.buildId || 4920386201513015989, + platform: sessionData.platform || 0, + xplatform: sessionData.xplatform || true, + freePublic: sessionData.freePublic || 3, + freePrivate: sessionData.freePrivate || 0, + fullReset: 0 }; sessions.push(newSession); return newSession; - } - - function getAllSessions(): Session[] { +} + +function getAllSessions(): Session[] { return sessions; - } - - function getSessionByID(sessionId: string): Session | undefined { +} + +function getSessionByID(sessionId: string): Session | undefined { return sessions.find(session => session.sessionId === sessionId); - } +} - - interface FindSessionRequest { +interface FindSessionRequest { [key: string]: any; - } - - function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] { - if (typeof sessionIdOrRequest === 'string') { - const session = sessions.find(session => session.sessionId === sessionIdOrRequest); - if (session) { - console.log("Found Sessions:",session) - return [ - { - createdBy: session.creatorId, - id: session.sessionId, - }, - ]; - } - return []; - } else { - const request = sessionIdOrRequest as FindSessionRequest; - const matchingSessions = sessions.filter(session => { - for (const key in request) { - if (key !== 'eloRating' && key !== 'queryId' && request[key] !== session[key as keyof Session]) { - return false; - } - } - console.log("Found Matching Sessions:",matchingSessions) - return true; - }); - return matchingSessions.map(session => ({ - createdBy: session.creatorId, - id: session.sessionId, - })); - } - } +} - function getSessionByCreatorID(creatorId: string): Session | undefined { - return sessions.find(session => session.creatorId === creatorId); - } - - function getNewSessionID(): string { - const characters = '0123456789abcdef'; - const maxAttempts = 100; - let sessionId = ''; - - for (let attempt = 0; attempt < maxAttempts; attempt++) { - sessionId = '64'; - for (let i = 0; i < 22; i++) { - const randomIndex = Math.floor(Math.random() * characters.length); - sessionId += characters[randomIndex]; - } - - if (!sessions.some(session => session.sessionId === sessionId)) { - return sessionId; - } +function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] { + if (typeof sessionIdOrRequest === "string") { + const session = sessions.find(session => session.sessionId === sessionIdOrRequest); + if (session) { + console.log("Found Sessions:", session); + return [ + { + createdBy: session.creatorId, + id: session.sessionId + } + ]; + } + return []; + } else { + const request = sessionIdOrRequest as FindSessionRequest; + const matchingSessions = sessions.filter(session => { + for (const key in request) { + if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof Session]) { + return false; + } + } + console.log("Found Matching Sessions:", matchingSessions); + return true; + }); + return matchingSessions.map(session => ({ + createdBy: session.creatorId, + id: session.sessionId + })); } - - throw new Error('Failed to generate a unique session ID'); - } - - function updateSession(sessionId: string, sessionData: string): boolean { +} + +function getSessionByCreatorID(creatorId: string): Session | undefined { + return sessions.find(session => session.creatorId === creatorId); +} + +function getNewSessionID(): string { + const characters = "0123456789abcdef"; + const maxAttempts = 100; + let sessionId = ""; + + for (let attempt = 0; attempt < maxAttempts; attempt++) { + sessionId = "64"; + for (let i = 0; i < 22; i++) { + const randomIndex = Math.floor(Math.random() * characters.length); + sessionId += characters[randomIndex]; + } + + if (!sessions.some(session => session.sessionId === sessionId)) { + return sessionId; + } + } + + throw new Error("Failed to generate a unique session ID"); +} + +function updateSession(sessionId: string, sessionData: string): boolean { const session = sessions.find(session => session.sessionId === sessionId); if (session) { - try { - const updatedData = JSON.parse(sessionData); - Object.assign(session, updatedData); - return true; - } catch (error) { - console.error('Invalid JSON string for session update.'); - return false; - } + try { + const updatedData = JSON.parse(sessionData); + Object.assign(session, updatedData); + return true; + } catch (error) { + console.error("Invalid JSON string for session update."); + return false; + } } return false; - } - - function deleteSession(sessionId: string): boolean { +} + +function deleteSession(sessionId: string): boolean { const index = sessions.findIndex(session => session.sessionId === sessionId); if (index !== -1) { - sessions.splice(index, 1); - return true; + sessions.splice(index, 1); + return true; } return false; - } - - export { createNewSession, getAllSessions, getSessionByID, getSessionByCreatorID, getNewSessionID, updateSession, deleteSession, getSession }; - \ No newline at end of file +} + +export { + createNewSession, + getAllSessions, + getSessionByID, + getSessionByCreatorID, + getNewSessionID, + updateSession, + deleteSession, + getSession +}; -- 2.47.2 From 7d2ca333df01020d12967e266b4ef194539b77ee Mon Sep 17 00:00:00 2001 From: AKCore Date: Sat, 3 Jun 2023 17:58:25 -0700 Subject: [PATCH 3/8] Update deleteSessionController.ts --- src/controllers/api/deleteSessionController.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/controllers/api/deleteSessionController.ts b/src/controllers/api/deleteSessionController.ts index aa98e1d2..d4053779 100644 --- a/src/controllers/api/deleteSessionController.ts +++ b/src/controllers/api/deleteSessionController.ts @@ -2,7 +2,6 @@ import { RequestHandler } from "express"; import { deleteSession } from "@/src/managers/sessionManager"; const deleteSessionController: RequestHandler = (_req, res) => { - //res.json({ sessionId: { $oid: "64768f104722f795300c9fc0" }, rewardSeed: 5867309943877621023 }); deleteSession(_req.query.sessionId as string); res.sendStatus(200); }; -- 2.47.2 From 120750b42a319eef42dd3b8919bd7ad1eb30c801 Mon Sep 17 00:00:00 2001 From: AKCore Date: Sat, 3 Jun 2023 18:16:28 -0700 Subject: [PATCH 4/8] Fix Requests --- src/controllers/api/findSessionsController.ts | 4 +-- .../api/getNewRewardSeedController.ts | 2 +- src/managers/sessionManager.ts | 36 ++----------------- src/types/session.ts | 27 ++++++++++++++ 4 files changed, 32 insertions(+), 37 deletions(-) create mode 100644 src/types/session.ts diff --git a/src/controllers/api/findSessionsController.ts b/src/controllers/api/findSessionsController.ts index caa326b9..5a1f4301 100644 --- a/src/controllers/api/findSessionsController.ts +++ b/src/controllers/api/findSessionsController.ts @@ -4,13 +4,13 @@ import { getSession } from "@/src/managers/sessionManager"; const findSessionsController: RequestHandler = (_req, res) => { console.log("FindSession Request:", JSON.parse(_req.body)); let r = JSON.parse(_req.body); - if (r != undefined) { + if (r.id != undefined) { console.log("Found ID"); let s = getSession(r.id); if (s) res.json({ queryId: r.queryId, Sessions: s }); else res.json({}); - } else if (r != undefined) { + } else if (r.originalSessionId != undefined) { console.log("Found OriginalSessionID"); let s = getSession(r.originalSessionId); diff --git a/src/controllers/api/getNewRewardSeedController.ts b/src/controllers/api/getNewRewardSeedController.ts index f420f60f..163e3c6e 100644 --- a/src/controllers/api/getNewRewardSeedController.ts +++ b/src/controllers/api/getNewRewardSeedController.ts @@ -1,7 +1,7 @@ import { RequestHandler } from "express"; const getNewRewardSeedController: RequestHandler = (_req, res) => { - res.json({ rewardSeed: 1111111111 }); + res.json({ rewardSeed: generateRewardSeed() }); }; function generateRewardSeed(): number { diff --git a/src/managers/sessionManager.ts b/src/managers/sessionManager.ts index ecb163a1..9ac12327 100644 --- a/src/managers/sessionManager.ts +++ b/src/managers/sessionManager.ts @@ -1,30 +1,4 @@ -interface Session { - sessionId: string; - creatorId: string; - maxPlayers: number; - minPlayers: number; - privateSlots: number; - scoreLimit: number; - timeLimit: number; - gameModeId: number; - eloRating: number; - regionId: number; - difficulty: number; - hasStarted: boolean; - enableVoice: boolean; - matchType: string; - maps: string[]; - originalSessionId: string; - customSettings: string; - rewardSeed: number; - guildId: string; - buildId: number; - platform: number; - xplatform: boolean; - freePublic: number; - freePrivate: number; - fullReset: number; -} +import { Session, FindSessionRequest } from "@/src/types/session"; const sessions: Session[] = []; @@ -69,10 +43,6 @@ function getSessionByID(sessionId: string): Session | undefined { return sessions.find(session => session.sessionId === sessionId); } -interface FindSessionRequest { - [key: string]: any; -} - function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] { if (typeof sessionIdOrRequest === "string") { const session = sessions.find(session => session.sessionId === sessionIdOrRequest); @@ -130,7 +100,7 @@ function getNewSessionID(): string { function updateSession(sessionId: string, sessionData: string): boolean { const session = sessions.find(session => session.sessionId === sessionId); - if (session) { + if (!session) return false; try { const updatedData = JSON.parse(sessionData); Object.assign(session, updatedData); @@ -139,8 +109,6 @@ function updateSession(sessionId: string, sessionData: string): boolean { console.error("Invalid JSON string for session update."); return false; } - } - return false; } function deleteSession(sessionId: string): boolean { diff --git a/src/types/session.ts b/src/types/session.ts new file mode 100644 index 00000000..f4c06274 --- /dev/null +++ b/src/types/session.ts @@ -0,0 +1,27 @@ +export interface Session { + sessionId: string; + creatorId: string; + maxPlayers: number; + minPlayers: number; + privateSlots: number; + scoreLimit: number; + timeLimit: number; + gameModeId: number; + eloRating: number; + regionId: number; + difficulty: number; + hasStarted: boolean; + enableVoice: boolean; + matchType: string; + maps: string[]; + originalSessionId: string; + customSettings: string; + rewardSeed: number; + guildId: string; + buildId: number; + platform: number; + xplatform: boolean; + freePublic: number; + freePrivate: number; + fullReset: number; +} \ No newline at end of file -- 2.47.2 From a809981179b4630c1556f11c1677710aef16756c Mon Sep 17 00:00:00 2001 From: AKCore Date: Sat, 3 Jun 2023 18:18:11 -0700 Subject: [PATCH 5/8] prettiered again --- src/managers/sessionManager.ts | 46 +++++++++++++++++----------------- src/types/session.ts | 2 +- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/managers/sessionManager.ts b/src/managers/sessionManager.ts index 9ac12327..de990f9e 100644 --- a/src/managers/sessionManager.ts +++ b/src/managers/sessionManager.ts @@ -56,22 +56,22 @@ function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] { ]; } return []; - } else { - const request = sessionIdOrRequest as FindSessionRequest; - const matchingSessions = sessions.filter(session => { - for (const key in request) { - if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof Session]) { - return false; - } - } - console.log("Found Matching Sessions:", matchingSessions); - return true; - }); - return matchingSessions.map(session => ({ - createdBy: session.creatorId, - id: session.sessionId - })); } + + const request = sessionIdOrRequest as FindSessionRequest; + const matchingSessions = sessions.filter(session => { + for (const key in request) { + if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof Session]) { + return false; + } + } + console.log("Found Matching Sessions:", matchingSessions); + return true; + }); + return matchingSessions.map(session => ({ + createdBy: session.creatorId, + id: session.sessionId + })); } function getSessionByCreatorID(creatorId: string): Session | undefined { @@ -101,14 +101,14 @@ function getNewSessionID(): string { function updateSession(sessionId: string, sessionData: string): boolean { const session = sessions.find(session => session.sessionId === sessionId); if (!session) return false; - try { - const updatedData = JSON.parse(sessionData); - Object.assign(session, updatedData); - return true; - } catch (error) { - console.error("Invalid JSON string for session update."); - return false; - } + try { + const updatedData = JSON.parse(sessionData); + Object.assign(session, updatedData); + return true; + } catch (error) { + console.error("Invalid JSON string for session update."); + return false; + } } function deleteSession(sessionId: string): boolean { diff --git a/src/types/session.ts b/src/types/session.ts index f4c06274..af61fdc3 100644 --- a/src/types/session.ts +++ b/src/types/session.ts @@ -24,4 +24,4 @@ export interface Session { freePublic: number; freePrivate: number; fullReset: number; -} \ No newline at end of file +} -- 2.47.2 From 7f17ce701d0aca451ea87a46f09b7a1afc586312 Mon Sep 17 00:00:00 2001 From: AKCore Date: Sat, 3 Jun 2023 18:25:05 -0700 Subject: [PATCH 6/8] Merge remote-tracking branch 'upstream/main' --- .eslintrc | 1 - config.json | 12 +- src/controllers/api/inventoryController.ts | 26 +- src/controllers/api/loginController.ts | 8 +- src/helpers/inventoryHelpers.ts | 9 + src/models/inventoryModel.ts | 258 ++++ src/services/inventoryService.ts | 25 + src/services/loginService.ts | 3 +- src/types/inventoryTypes.ts | 1232 +++++++++++++++++ static/fixed_responses/new_inventory.json | 121 ++ .../postTutorialInventory.json | 145 ++ 11 files changed, 1823 insertions(+), 17 deletions(-) create mode 100644 src/helpers/inventoryHelpers.ts create mode 100644 src/models/inventoryModel.ts create mode 100644 src/services/inventoryService.ts create mode 100644 src/types/inventoryTypes.ts create mode 100644 static/fixed_responses/new_inventory.json create mode 100644 static/fixed_responses/postTutorialInventory.json diff --git a/.eslintrc b/.eslintrc index dc83cd5b..9c2b88f9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,7 +11,6 @@ "node": true }, "rules": { - "@typescript-eslint/no-misused-promises": "off", "prettier/prettier": "error", "@typescript-eslint/semi": ["error"], "@typescript-eslint/explicit-function-return-type": "off", diff --git a/config.json b/config.json index d0c662ae..5d15dcf4 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,9 @@ { - "autoCreateAccount": true, - "buildLabel": "2023.05.25.13.39/oZkc-RIme5c1CCltUfg2gQ", - "matchmakingBuildId": "4920386201513015989", - "version": "33.0.14", - "worldSeed": "GWvLyHiw7/Qr/60056xmAmDrn0Y9et2S3BYlLSkLDNBMtumSr3KxWV8He5Jz72yYq3tsY+cd53QeTf+bb54+llGTbYiQF+64BtiLWMVhWP1IUaP4SxWHXojlpQC13op/udHI1whc+8zrxEzzZmv/QlpvigAAbjBDtwu97Df0vgn+YrOKi4G3OhgIkTRocAAzD1P/BGbT8gaKE01H8rXl3+Gq6jCA1O1v800SL6DwKOgMsXVvWp7g2n/tPxJe/j9bmu4XFG0bSa5y5hikLKxvntA/5ut+iogv4MyMBe+TydVxjPqNbkKnby5l4KAL+3inpuPraeg4jcNMt0AwKG8NIQ==" + "autoCreateAccount": true, + "buildLabel": "2023.05.25.13.39/oZkc-RIme5c1CCltUfg2gQ", + "matchmakingBuildId": "4920386201513015989", + "version": "33.0.14", + "worldSeed": "GWvLyHiw7/Qr/60056xmAmDrn0Y9et2S3BYlLSkLDNBMtumSr3KxWV8He5Jz72yYq3tsY+cd53QeTf+bb54+llGTbYiQF+64BtiLWMVhWP1IUaP4SxWHXojlpQC13op/udHI1whc+8zrxEzzZmv/QlpvigAAbjBDtwu97Df0vgn+YrOKi4G3OhgIkTRocAAzD1P/BGbT8gaKE01H8rXl3+Gq6jCA1O1v800SL6DwKOgMsXVvWp7g2n/tPxJe/j9bmu4XFG0bSa5y5hikLKxvntA/5ut+iogv4MyMBe+TydVxjPqNbkKnby5l4KAL+3inpuPraeg4jcNMt0AwKG8NIQ==", + "skipStoryModeChoice": true, + "skipTutorial": true } diff --git a/src/controllers/api/inventoryController.ts b/src/controllers/api/inventoryController.ts index 47ba5d25..c7ad069c 100644 --- a/src/controllers/api/inventoryController.ts +++ b/src/controllers/api/inventoryController.ts @@ -1,11 +1,29 @@ -import inventory from "@/static/fixed_responses/inventory.json"; +/* eslint-disable @typescript-eslint/no-misused-promises */ +import { toInventoryResponse } from "@/src/helpers/inventoryHelpers"; +import { Inventory } from "@/src/models/inventoryModel"; import { Request, RequestHandler, Response } from "express"; -const inventoryController: RequestHandler = (request: Request, response: Response) => { - console.log(request.query); +const inventoryController: RequestHandler = async (request: Request, response: Response) => { const accountId = request.query.accountId; + + if (!accountId) { + response.status(400).json({ error: "accountId was not provided" }); + return; + } console.log(accountId); - response.json(inventory); + + const inventory = await Inventory.findOne({ accountOwnerId: accountId }); + + if (!inventory) { + response.status(400).json({ error: "inventory was undefined" }); + return; + } + + const inventoryJSON = inventory.toJSON(); + + const inventoreResponse = toInventoryResponse(inventoryJSON); + + response.json(inventoreResponse); }; export { inventoryController }; diff --git a/src/controllers/api/loginController.ts b/src/controllers/api/loginController.ts index efaa750a..7819df06 100644 --- a/src/controllers/api/loginController.ts +++ b/src/controllers/api/loginController.ts @@ -13,11 +13,8 @@ const loginController: RequestHandler = async (request, response) => { // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument const body = JSON.parse(request.body); // parse octet stream of json data to json object const loginRequest = toLoginRequest(body); - // console.log(body); - //console.log(String.fromCharCode.apiRouterly(null, req.body)); const account = await Account.findOne({ email: loginRequest.email }); //{ _id: 0, __v: 0 } - console.log("findone", account); if (!account && config.autoCreateAccount) { try { @@ -32,7 +29,8 @@ const loginController: RequestHandler = async (request, response) => { ConsentNeeded: false, TrackedSettings: [] }); - console.log("CREATED ACCOUNT", newAccount); + console.log("creating new account"); + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { email, password, ...databaseAccount } = newAccount; const newLoginResponse: ILoginResponse = { ...databaseAccount, @@ -47,7 +45,6 @@ const loginController: RequestHandler = async (request, response) => { MatchmakingBuildId: config.matchmakingBuildId }; - console.log(newLoginResponse); response.json(newLoginResponse); return; } catch (error: unknown) { @@ -77,7 +74,6 @@ const loginController: RequestHandler = async (request, response) => { MatchmakingBuildId: config.matchmakingBuildId }; - console.log("login response", newLoginResponse); response.json(newLoginResponse); }; diff --git a/src/helpers/inventoryHelpers.ts b/src/helpers/inventoryHelpers.ts new file mode 100644 index 00000000..7879c007 --- /dev/null +++ b/src/helpers/inventoryHelpers.ts @@ -0,0 +1,9 @@ +import { IInventoryDatabase, IInventoryResponse } from "@/src/types/inventoryTypes"; + +const toInventoryResponse = (inventoryDatabase: IInventoryDatabase): IInventoryResponse => { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { accountOwnerId, ...inventoreResponse } = inventoryDatabase; + return inventoreResponse; +}; + +export { toInventoryResponse }; diff --git a/src/models/inventoryModel.ts b/src/models/inventoryModel.ts new file mode 100644 index 00000000..bdc2065d --- /dev/null +++ b/src/models/inventoryModel.ts @@ -0,0 +1,258 @@ +import { Document, Schema, model } from "mongoose"; +import { IInventoryDatabase, IInventoryResponse, ISuitDatabase, ISuitDocument, Oid } from "../types/inventoryTypes"; + +const polaritySchema = new Schema({ + Slot: Number, + Value: String +}); + +const abilityOverrideSchema = new Schema({ + Ability: String, + Index: Number +}); + +const colorSchema = new Schema({ + t0: Number, + t1: Number, + t2: Number, + t3: Number, + en: Number, + e1: Number, + m0: Number, + m1: Number +}); + +const suitConfigSchema = new Schema({ + Skins: [String], + pricol: colorSchema, + attcol: colorSchema, + eyecol: colorSchema, + sigcol: colorSchema, + Upgrades: [String], + Songs: [ + { + m: String, + b: String, + p: String, + s: String + } + ], + Name: String, + AbilityOverride: abilityOverrideSchema, + PvpUpgrades: [String], + ugly: Boolean +}); + +suitConfigSchema.set("toJSON", { + transform(_document, returnedObject) { + delete returnedObject._id; + delete returnedObject.__v; + } +}); + +const suitSchema = new Schema({ + ItemType: String, + Configs: [suitConfigSchema], + UpgradeVer: Number, + XP: Number, + InfestationDate: Date, + Features: Number, + Polarity: [polaritySchema], + Polarized: Number, + ModSlotPurchases: Number, + FocusLens: String, + UnlockLevel: Number +}); + +suitSchema.set("toJSON", { + transform(_document, returnedObject: ISuitDocument) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call + returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies Oid; + delete returnedObject._id; + delete returnedObject.__v; + } +}); + +const inventorySchema = new Schema({ + accountOwnerId: Schema.Types.ObjectId, + SubscribedToEmails: Number, + Created: Schema.Types.Mixed, + RewardSeed: Number, + RegularCredits: Number, + PremiumCredits: Number, + PremiumCreditsFree: Number, + FusionPoints: Number, + SuitBin: Schema.Types.Mixed, + WeaponBin: Schema.Types.Mixed, + SentinelBin: Schema.Types.Mixed, + SpaceSuitBin: Schema.Types.Mixed, + SpaceWeaponBin: Schema.Types.Mixed, + PvpBonusLoadoutBin: Schema.Types.Mixed, + PveBonusLoadoutBin: Schema.Types.Mixed, + RandomModBin: Schema.Types.Mixed, + TradesRemaining: Number, + DailyAffiliation: Number, + DailyAffiliationPvp: Number, + DailyAffiliationLibrary: Number, + DailyFocus: Number, + GiftsRemaining: Number, + HandlerPoints: Number, + MiscItems: [Schema.Types.Mixed], + ChallengesFixVersion: Number, + ChallengeProgress: [Schema.Types.Mixed], + RawUpgrades: [Schema.Types.Mixed], + ReceivedStartingGear: Boolean, + Suits: [suitSchema], + LongGuns: [Schema.Types.Mixed], + Pistols: [Schema.Types.Mixed], + Melee: [Schema.Types.Mixed], + Ships: [Schema.Types.Mixed], + QuestKeys: [Schema.Types.Mixed], + FlavourItems: [Schema.Types.Mixed], + Scoops: [Schema.Types.Mixed], + TrainingRetriesLeft: Number, + LoadOutPresets: Schema.Types.Mixed, + CurrentLoadOutIds: [Schema.Types.Mixed], + Missions: [Schema.Types.Mixed], + RandomUpgradesIdentified: Number, + LastRegionPlayed: String, + XPInfo: [Schema.Types.Mixed], + Recipes: [Schema.Types.Mixed], + WeaponSkins: [Schema.Types.Mixed], + PendingRecipes: [Schema.Types.Mixed], + TrainingDate: Schema.Types.Mixed, + PlayerLevel: Number, + Upgrades: [Schema.Types.Mixed], + EquippedGear: [String], + DeathMarks: [String], + FusionTreasures: [Schema.Types.Mixed], + WebFlags: Schema.Types.Mixed, + CompletedAlerts: [String], + Consumables: [Schema.Types.Mixed], + LevelKeys: [Schema.Types.Mixed], + TauntHistory: [Schema.Types.Mixed], + StoryModeChoice: String, + PeriodicMissionCompletions: [Schema.Types.Mixed], + KubrowPetEggs: [Schema.Types.Mixed], + LoreFragmentScans: [Schema.Types.Mixed], + EquippedEmotes: [String], + PendingTrades: [Schema.Types.Mixed], + Boosters: [Schema.Types.Mixed], + ActiveDojoColorResearch: String, + SentientSpawnChanceBoosters: Schema.Types.Mixed, + Affiliations: [Schema.Types.Mixed], + QualifyingInvasions: [Schema.Types.Mixed], + FactionScores: [Number], + SpaceSuits: [Schema.Types.Mixed], + SpaceMelee: [Schema.Types.Mixed], + SpaceGuns: [Schema.Types.Mixed], + ArchwingEnabled: Boolean, + PendingSpectreLoadouts: [Schema.Types.Mixed], + SpectreLoadouts: [Schema.Types.Mixed], + SentinelWeapons: [Schema.Types.Mixed], + Sentinels: [Schema.Types.Mixed], + EmailItems: [Schema.Types.Mixed], + CompletedSyndicates: [String], + FocusXP: Schema.Types.Mixed, + Wishlist: [String], + Alignment: Schema.Types.Mixed, + CompletedSorties: [String], + LastSortieReward: [Schema.Types.Mixed], + Drones: [Schema.Types.Mixed], + StepSequencers: [Schema.Types.Mixed], + ActiveAvatarImageType: String, + KubrowPets: [Schema.Types.Mixed], + ShipDecorations: [Schema.Types.Mixed], + OperatorAmpBin: Schema.Types.Mixed, + DailyAffiliationCetus: Number, + DailyAffiliationQuills: Number, + DiscoveredMarkers: [Schema.Types.Mixed], + CompletedJobs: [Schema.Types.Mixed], + FocusAbility: String, + FocusUpgrades: [Schema.Types.Mixed], + OperatorAmps: [Schema.Types.Mixed], + HasContributedToDojo: Boolean, + HWIDProtectEnabled: Boolean, + KubrowPetPrints: [Schema.Types.Mixed], + AlignmentReplay: Schema.Types.Mixed, + PersonalGoalProgress: [Schema.Types.Mixed], + DailyAffiliationSolaris: Number, + SpecialItems: [Schema.Types.Mixed], + ThemeStyle: String, + ThemeBackground: String, + ThemeSounds: String, + BountyScore: Number, + ChallengeInstanceStates: [Schema.Types.Mixed], + LoginMilestoneRewards: [String], + OperatorLoadOuts: [Schema.Types.Mixed], + DailyAffiliationVentkids: Number, + DailyAffiliationVox: Number, + RecentVendorPurchases: [Schema.Types.Mixed], + Hoverboards: [Schema.Types.Mixed], + NodeIntrosCompleted: [String], + CompletedJobChains: [Schema.Types.Mixed], + SeasonChallengeHistory: [Schema.Types.Mixed], + MoaPets: [Schema.Types.Mixed], + EquippedInstrument: String, + InvasionChainProgress: [Schema.Types.Mixed], + DataKnives: [Schema.Types.Mixed], + NemesisHistory: [Schema.Types.Mixed], + LastNemesisAllySpawnTime: Schema.Types.Mixed, + Settings: Schema.Types.Mixed, + PersonalTechProjects: [Schema.Types.Mixed], + CrewShips: [Schema.Types.Mixed], + CrewShipSalvageBin: Schema.Types.Mixed, + PlayerSkills: Schema.Types.Mixed, + CrewShipAmmo: [Schema.Types.Mixed], + CrewShipSalvagedWeaponSkins: [Schema.Types.Mixed], + CrewShipWeapons: [Schema.Types.Mixed], + CrewShipSalvagedWeapons: [Schema.Types.Mixed], + CrewShipWeaponSkins: [Schema.Types.Mixed], + TradeBannedUntil: Schema.Types.Mixed, + PlayedParkourTutorial: Boolean, + SubscribedToEmailsPersonalized: Number, + MechBin: Schema.Types.Mixed, + DailyAffiliationEntrati: Number, + DailyAffiliationNecraloid: Number, + MechSuits: [Schema.Types.Mixed], + InfestedFoundry: Schema.Types.Mixed, + BlessingCooldown: Schema.Types.Mixed, + CrewMemberBin: Schema.Types.Mixed, + CrewShipHarnesses: [Schema.Types.Mixed], + CrewShipRawSalvage: [Schema.Types.Mixed], + CrewMembers: [Schema.Types.Mixed], + AdultOperatorLoadOuts: [Schema.Types.Mixed], + LotusCustomization: Schema.Types.Mixed, + UseAdultOperatorLoadout: Boolean, + DailyAffiliationZariman: Number, + NemesisAbandonedRewards: [String], + DailyAffiliationKahl: Number, + LastInventorySync: Schema.Types.Mixed, + NextRefill: Schema.Types.Mixed, + ActiveLandscapeTraps: [Schema.Types.Mixed], + EvolutionProgress: [Schema.Types.Mixed], + RepVotes: [Schema.Types.Mixed], + LeagueTickets: [Schema.Types.Mixed], + Quests: [Schema.Types.Mixed], + Robotics: [Schema.Types.Mixed], + UsedDailyDeals: [Schema.Types.Mixed], + LibraryPersonalProgress: [Schema.Types.Mixed], + CollectibleSeries: [Schema.Types.Mixed], + LibraryAvailableDailyTaskInfo: Schema.Types.Mixed, + HasResetAccount: Boolean, + PendingCoupon: Schema.Types.Mixed, + Harvestable: Boolean, + DeathSquadable: Boolean +}); + +inventorySchema.set("toJSON", { + transform(_document, returnedObject: ISuitDocument) { + delete returnedObject._id; + delete returnedObject.__v; + } +}); + +const Suit = model("Suit", suitSchema); +const Inventory = model("Inventory", inventorySchema); + +export { Inventory, Suit }; diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts new file mode 100644 index 00000000..36f49d06 --- /dev/null +++ b/src/services/inventoryService.ts @@ -0,0 +1,25 @@ +import { Inventory } from "@/src/models/inventoryModel"; +import new_inventory from "@/static/fixed_responses/postTutorialInventory.json"; +import config from "@/config.json"; +import { Types } from "mongoose"; + +const createInventory = async (accountOwnerId: Types.ObjectId) => { + try { + const inventory = new Inventory({ ...new_inventory, accountOwnerId: accountOwnerId }); + if (config.skipStoryModeChoice) { + inventory.StoryModeChoice = "WARFRAME"; + } + if (config.skipTutorial) { + inventory.PlayedParkourTutorial = true; + inventory.ReceivedStartingGear = true; + } + await inventory.save(); + } catch (error) { + if (error instanceof Error) { + throw new Error(`error creating inventory" ${error.message}`); + } + throw new Error("error creating inventory that is not of instance Error"); + } +}; + +export { createInventory }; diff --git a/src/services/loginService.ts b/src/services/loginService.ts index 8e5d1da2..c110d491 100644 --- a/src/services/loginService.ts +++ b/src/services/loginService.ts @@ -1,4 +1,5 @@ import { Account } from "@/src/models/loginModel"; +import { createInventory } from "@/src/services/inventoryService"; import { IDatabaseAccount } from "@/src/types/loginTypes"; const isCorrectPassword = (requestPassword: string, databasePassword: string): boolean => { @@ -6,10 +7,10 @@ const isCorrectPassword = (requestPassword: string, databasePassword: string): b }; const createAccount = async (accountData: IDatabaseAccount) => { - console.log("test", accountData); const account = new Account(accountData); try { await account.save(); + await createInventory(account._id); return account.toJSON(); } catch (error) { if (error instanceof Error) { diff --git a/src/types/inventoryTypes.ts b/src/types/inventoryTypes.ts new file mode 100644 index 00000000..70bac7ce --- /dev/null +++ b/src/types/inventoryTypes.ts @@ -0,0 +1,1232 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { Document, Types } from "mongoose"; + +export interface IInventoryDatabase extends IInventoryResponse { + accountOwnerId: Types.ObjectId; +} + +export interface IInventoryResponse { + SubscribedToEmails: number; + Created: Date; + RewardSeed: number; + RegularCredits: number; + PremiumCredits: number; + PremiumCreditsFree: number; + FusionPoints: number; + SuitBin: CrewShipSalvageBinClass; + WeaponBin: CrewShipSalvageBinClass; + SentinelBin: CrewShipSalvageBinClass; + SpaceSuitBin: CrewShipSalvageBinClass; + SpaceWeaponBin: CrewShipSalvageBinClass; + PvpBonusLoadoutBin: CrewMemberBinClass; + PveBonusLoadoutBin: CrewShipSalvageBinClass; + RandomModBin: CrewShipSalvageBinClass; + TradesRemaining: number; + DailyAffiliation: number; + DailyAffiliationPvp: number; + DailyAffiliationLibrary: number; + DailyFocus: number; + GiftsRemaining: number; + HandlerPoints: number; + MiscItems: Consumable[]; + ChallengesFixVersion: number; + ChallengeProgress: ChallengeProgress[]; + RawUpgrades: RawUpgrade[]; + ReceivedStartingGear: boolean; + Suits: ISuitDatabase[]; + LongGuns: LongGun[]; + Pistols: LongGun[]; + Melee: Melee[]; + Ships: Ship[]; + QuestKeys: QuestKey[]; + FlavourItems: FlavourItem[]; + Scoops: Scoop[]; + TrainingRetriesLeft: number; + LoadOutPresets: LoadOutPresets; + CurrentLoadOutIds: Array; + Missions: Mission[]; + RandomUpgradesIdentified: number; + LastRegionPlayed: string; + XPInfo: EmailItem[]; + Recipes: Consumable[]; + WeaponSkins: WeaponSkin[]; + PendingRecipes: PendingRecipe[]; + TrainingDate: Date; + PlayerLevel: number; + Upgrades: CrewShipSalvagedWeaponSkin[]; + EquippedGear: string[]; + DeathMarks: string[]; + FusionTreasures: FusionTreasure[]; + WebFlags: WebFlags; + CompletedAlerts: string[]; + Consumables: Consumable[]; + LevelKeys: Consumable[]; + TauntHistory: TauntHistory[]; + StoryModeChoice: string; + PeriodicMissionCompletions: PeriodicMissionCompletion[]; + KubrowPetEggs: KubrowPetEgg[]; + LoreFragmentScans: LoreFragmentScan[]; + EquippedEmotes: string[]; + PendingTrades: PendingTrade[]; + Boosters: Booster[]; + ActiveDojoColorResearch: string; + SentientSpawnChanceBoosters: SentientSpawnChanceBoosters; + Affiliations: Affiliation[]; + QualifyingInvasions: any[]; + FactionScores: number[]; + SpaceSuits: Space[]; + SpaceMelee: Space[]; + SpaceGuns: SpaceGun[]; + ArchwingEnabled: boolean; + PendingSpectreLoadouts: any[]; + SpectreLoadouts: SpectreLoadout[]; + SentinelWeapons: SentinelWeapon[]; + Sentinels: Sentinel[]; + EmailItems: EmailItem[]; + CompletedSyndicates: string[]; + FocusXP: FocusXP; + Wishlist: string[]; + Alignment: Alignment; + CompletedSorties: string[]; + LastSortieReward: LastSortieReward[]; + Drones: Drone[]; + StepSequencers: StepSequencer[]; + ActiveAvatarImageType: string; + KubrowPets: KubrowPet[]; + ShipDecorations: Consumable[]; + OperatorAmpBin: CrewShipSalvageBinClass; + DailyAffiliationCetus: number; + DailyAffiliationQuills: number; + DiscoveredMarkers: DiscoveredMarker[]; + CompletedJobs: CompletedJob[]; + FocusAbility: string; + FocusUpgrades: FocusUpgrade[]; + OperatorAmps: OperatorAmp[]; + HasContributedToDojo: boolean; + HWIDProtectEnabled: boolean; + KubrowPetPrints: KubrowPetPrint[]; + AlignmentReplay: Alignment; + PersonalGoalProgress: PersonalGoalProgress[]; + DailyAffiliationSolaris: number; + SpecialItems: SpecialItem[]; + ThemeStyle: string; + ThemeBackground: string; + ThemeSounds: string; + BountyScore: number; + ChallengeInstanceStates: ChallengeInstanceState[]; + LoginMilestoneRewards: string[]; + OperatorLoadOuts: OperatorLoadOut[]; + DailyAffiliationVentkids: number; + DailyAffiliationVox: number; + RecentVendorPurchases: Array; + Hoverboards: Hoverboard[]; + NodeIntrosCompleted: string[]; + CompletedJobChains: CompletedJobChain[]; + SeasonChallengeHistory: SeasonChallengeHistory[]; + MoaPets: MoaPet[]; + EquippedInstrument: string; + InvasionChainProgress: InvasionChainProgress[]; + DataKnives: DataKnife[]; + NemesisHistory: NemesisHistory[]; + LastNemesisAllySpawnTime: Date; + Settings: Settings; + PersonalTechProjects: PersonalTechProject[]; + CrewShips: CrewShip[]; + CrewShipSalvageBin: CrewShipSalvageBinClass; + PlayerSkills: PlayerSkills; + CrewShipAmmo: Consumable[]; + CrewShipSalvagedWeaponSkins: CrewShipSalvagedWeaponSkin[]; + CrewShipWeapons: CrewShipWeapon[]; + CrewShipSalvagedWeapons: CrewShipWeapon[]; + CrewShipWeaponSkins: CrewShipSalvagedWeaponSkin[]; + TradeBannedUntil: Date; + PlayedParkourTutorial: boolean; + SubscribedToEmailsPersonalized: number; + MechBin: CrewMemberBinClass; + DailyAffiliationEntrati: number; + DailyAffiliationNecraloid: number; + MechSuits: MechSuit[]; + InfestedFoundry: InfestedFoundry; + BlessingCooldown: Date; + CrewMemberBin: CrewMemberBinClass; + CrewShipHarnesses: CrewShipHarness[]; + CrewShipRawSalvage: Consumable[]; + CrewMembers: CrewMember[]; + AdultOperatorLoadOuts: AdultOperatorLoadOut[]; + LotusCustomization: LotusCustomization; + UseAdultOperatorLoadout: boolean; + DailyAffiliationZariman: number; + NemesisAbandonedRewards: string[]; + DailyAffiliationKahl: number; + LastInventorySync: Oid; + NextRefill: Date; + ActiveLandscapeTraps: any[]; + EvolutionProgress: any[]; + RepVotes: any[]; + LeagueTickets: any[]; + Quests: any[]; + Robotics: any[]; + UsedDailyDeals: any[]; + LibraryPersonalProgress: LibraryPersonalProgress[]; + CollectibleSeries: CollectibleSery[]; + LibraryAvailableDailyTaskInfo: LibraryAvailableDailyTaskInfo; + HasResetAccount: boolean; + PendingCoupon: PendingCoupon; + Harvestable: boolean; + DeathSquadable: boolean; +} + +export interface AdultOperatorLoadOut { + Skins: string[]; + attcol: Color; + eyecol: Color; + facial: Color; + pricol: Color; + Upgrades?: string[]; + ItemId: Oid; +} + +export interface Oid { + $oid: string; +} + +export interface Color { + t0?: number; + t1?: number; + t2?: number; + t3?: number; + en?: number; + e1?: number; + m0?: number; + m1?: number; +} + +export interface Affiliation { + Initiated?: boolean; + Standing: number; + Title?: number; + FreeFavorsEarned?: number[]; + FreeFavorsUsed?: number[]; + Tag: string; +} + +export interface Alignment { + Wisdom: number; + Alignment: number; +} + +export interface Date { + $date: { $numberLong: string }; +} + +export interface Booster { + ExpiryDate: number; + ItemType: string; +} + +export interface ChallengeInstanceState { + id: Oid; + Progress: number; + params: Param[]; + IsRewardCollected: boolean; +} + +export interface Param { + n: string; + v: string; +} + +export interface ChallengeProgress { + Progress: number; + Name: string; + Completed?: string[]; +} + +export interface CollectibleSery { + CollectibleType: string; + Count: number; + Tracking: string; + ReqScans: number; + IncentiveStates: IncentiveState[]; +} + +export interface IncentiveState { + threshold: number; + complete: boolean; + sent: boolean; +} + +export interface CompletedJobChain { + LocationTag: string; + Jobs: string[]; +} + +export interface CompletedJob { + JobId: string; + StageCompletions: number[]; +} + +export interface Consumable { + ItemCount: number; + ItemType: string; +} + +export interface CrewMemberBinClass { + Slots: number; +} + +export interface CrewMember { + ItemType: string; + NemesisFingerprint: number; + Seed: number; + HireDate: Date; + AssignedRole: number; + SkillEfficiency: SkillEfficiency; + WeaponConfigIdx: number; + WeaponId: Oid; + XP: number; + PowersuitType: string; + Configs: CrewMemberConfig[]; + SecondInCommand: boolean; + ItemId: Oid; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface CrewMemberConfig {} + +export interface SkillEfficiency { + PILOTING: Combat; + GUNNERY: Combat; + ENGINEERING: Combat; + COMBAT: Combat; + SURVIVABILITY: Combat; +} + +export interface Combat { + Assigned: number; +} + +export interface CrewShipHarness { + ItemType: string; + Configs: CrewShipHarnessConfig[]; + Features: number; + UpgradeVer: number; + XP: number; + Polarity: Polarity[]; + Polarized: number; + ItemId: Oid; +} + +export interface CrewShipHarnessConfig { + Upgrades?: string[]; +} + +export interface Polarity { + Slot: number; + Value: FocusSchool; +} + +export enum FocusSchool { + ApAny = "AP_ANY", + ApAttack = "AP_ATTACK", + ApDefense = "AP_DEFENSE", + ApPower = "AP_POWER", + ApPrecept = "AP_PRECEPT", + ApTactic = "AP_TACTIC", + ApUmbra = "AP_UMBRA", + ApUniversal = "AP_UNIVERSAL", + ApWard = "AP_WARD" +} + +export interface CrewShipSalvageBinClass { + Extra: number; + Slots: number; +} + +export interface CrewShipSalvagedWeaponSkin { + ItemType: string; + UpgradeFingerprint?: string; + ItemId: Oid; +} + +export interface CrewShipWeapon { + ItemType: string; + UpgradeType?: string; + UpgradeFingerprint?: string; + Configs?: CrewShipHarnessConfig[]; + UpgradeVer?: number; + ItemId: Oid; +} + +export interface CrewShip { + ItemType: string; + Configs: CrewShipConfig[]; + Weapon: Weapon; + Customization: Customization; + ItemName: string; + RailjackImage: FlavourItem; + CrewMembers: CrewMembers; + ItemId: Oid; +} + +export interface CrewShipConfig { + Skins?: string[]; + pricol?: Color; +} + +export interface CrewMembers { + SLOT_A: Slot; + SLOT_B: Slot; + SLOT_C: Slot; +} + +export interface Slot { + ItemId: Oid; +} + +export interface Customization { + CrewshipInterior: Terior; +} + +export interface Terior { + SkinFlavourItem: string; + Colors: Color; + ShipAttachments?: ShipAttachments; +} + +export interface ShipAttachments { + HOOD_ORNAMENT: string; +} + +export interface FlavourItem { + ItemType: string; +} + +export interface Weapon { + PILOT: Pilot; + PORT_GUNS: PortGuns; +} + +export interface Pilot { + PRIMARY_A: L; + SECONDARY_A: L; +} + +export interface L { + ItemId?: Oid; + mod?: number; + cus?: number; + ItemType?: string; + hide?: boolean; +} + +export interface PortGuns { + PRIMARY_A: L; +} + +export interface DataKnife { + ItemType: string; + XP: number; + Configs: DataKnifeConfig[]; + UpgradeVer: number; + ItemId: Oid; +} + +export interface DataKnifeConfig { + Upgrades?: string[]; + pricol?: Color; + Skins: string[]; + attcol?: Color; + sigcol?: Color; +} + +export interface DiscoveredMarker { + tag: string; + discoveryState: number[]; +} + +export interface Drone { + ItemType: string; + CurrentHP: number; + ItemId: Oid; + RepairStart?: Date; +} + +export interface EmailItem { + ItemType: string; + XP: number; +} + +export interface FocusUpgrade { + ItemType: string; + Level?: number; + IsUniversal?: boolean; +} + +export interface FocusXP { + AP_POWER: number; + AP_TACTIC: number; + AP_DEFENSE: number; + AP_ATTACK: number; + AP_WARD: number; +} + +export interface FusionTreasure { + ItemCount: number; + ItemType: string; + Sockets: number; +} + +export interface Hoverboard { + ItemType: string; + Configs: HoverboardConfig[]; + ModularParts: string[]; + ItemName?: string; + Polarity?: Polarity[]; + UpgradeVer: number; + XP: number; + Features: number; + ItemId: Oid; +} + +export interface HoverboardConfig { + Upgrades?: string[]; + Skins?: PurpleSkin[]; + pricol?: Color; + sigcol?: Sigcol; + attcol?: Color; +} + +export enum PurpleSkin { + Empty = "", + The5Be4Af71A38E4A9306040E15 = "5be4af71a38e4a9306040e15", + The5C930Ac3A38E4A24Bc3Ad5De = "5c930ac3a38e4a24bc3ad5de", + The5C9C6F9857904A7A3B25656B = "5c9c6f9857904a7a3b25656b", + The5Dd8A8E3A38E4A321A45E6A0 = "5dd8a8e3a38e4a321a45e6a0" +} + +export interface Sigcol { + t3: number; +} + +export interface InfestedFoundry { + Name: string; + Resources: Resource[]; + Slots: number; + XP: number; + ConsumedSuits: ConsumedSuit[]; + InvigorationIndex: number; + InvigorationSuitOfferings: string[]; + InvigorationsApplied: number; +} + +export interface ConsumedSuit { + s: string; + c?: Color; +} + +export interface Resource { + ItemType: string; + Count: number; +} + +export interface InvasionChainProgress { + id: Oid; + count: number; +} + +export interface KubrowPetEgg { + ItemType: KubrowPetEggItemType; + ExpirationDate: Date; + ItemId: Oid; +} + +export enum KubrowPetEggItemType { + LotusTypesGameKubrowPetEggsKubrowEgg = "/Lotus/Types/Game/KubrowPet/Eggs/KubrowEgg" +} + +export interface KubrowPetPrint { + ItemType: KubrowPetPrintItemType; + Name: string; + IsMale: boolean; + Size: number; + DominantTraits: Traits; + RecessiveTraits: Traits; + ItemId: Oid; + InheritedModularParts?: any[]; +} + +export interface Traits { + BaseColor: string; + SecondaryColor: string; + TertiaryColor: string; + AccentColor: string; + EyeColor: string; + FurPattern: string; + Personality: string; + BodyType: string; + Head?: string; + Tail?: Tail; +} + +export enum Tail { + Empty = "", + LotusTypesGameCatbrowPetTailsCatbrowTailA = "/Lotus/Types/Game/CatbrowPet/Tails/CatbrowTailA", + LotusTypesGameCatbrowPetTailsCatbrowTailB = "/Lotus/Types/Game/CatbrowPet/Tails/CatbrowTailB", + LotusTypesGameCatbrowPetTailsCatbrowTailC = "/Lotus/Types/Game/CatbrowPet/Tails/CatbrowTailC", + LotusTypesGameCatbrowPetTailsCatbrowTailD = "/Lotus/Types/Game/CatbrowPet/Tails/CatbrowTailD" +} + +export enum KubrowPetPrintItemType { + LotusTypesGameKubrowPetImprintedTraitPrint = "/Lotus/Types/Game/KubrowPet/ImprintedTraitPrint" +} + +export interface KubrowPet { + ItemType: string; + Configs: KubrowPetConfig[]; + UpgradeVer: number; + Details: Details; + XP?: number; + Polarized?: number; + Polarity?: Polarity[]; + Features?: number; + InfestationDate?: Date; + InfestationDays?: number; + InfestationType?: string; + ItemId: Oid; + ModularParts?: string[]; +} + +export interface KubrowPetConfig { + Skins?: string[]; + pricol?: Color; + attcol?: Color; + Upgrades?: string[]; +} + +export interface Details { + Name: string; + IsPuppy: boolean; + HasCollar: boolean; + PrintsRemaining: number; + Status: Status; + HatchDate: Date; + DominantTraits: Traits; + RecessiveTraits: Traits; + IsMale: boolean; + Size: number; +} + +export enum Status { + StatusAvailable = "STATUS_AVAILABLE", + StatusStasis = "STATUS_STASIS" +} + +export interface LastSortieReward { + SortieId: Oid; + StoreItem: string; + Manifest: string; +} + +export interface LibraryAvailableDailyTaskInfo { + EnemyTypes: string[]; + EnemyLocTag: string; + EnemyIcon: string; + ScansRequired: number; + RewardStoreItem: string; + RewardQuantity: number; + RewardStanding: number; +} + +export interface LibraryPersonalProgress { + TargetType: string; + Scans: number; + Completed: boolean; +} + +export interface LoadOutPresets { + NORMAL: Normal[]; + NORMAL_PVP: Archwing[]; + LUNARO: Lunaro[]; + ARCHWING: Archwing[]; + SENTINEL: Archwing[]; + OPERATOR: Archwing[]; + GEAR: Gear[]; + KDRIVE: Kdrive[]; + DATAKNIFE: Archwing[]; + MECH: Mech[]; + OPERATOR_ADULT: Archwing[]; +} + +export interface Archwing { + PresetIcon: string; + Favorite: boolean; + n?: string; + s: L; + l?: L; + m?: L; + ItemId: Oid; + p?: L; +} + +export interface Gear { + n: string; + s: L; + p: L; + l: L; + m: L; + ItemId: Oid; +} + +export interface Kdrive { + PresetIcon: string; + Favorite: boolean; + s: L; + ItemId: Oid; +} + +export interface Lunaro { + n: string; + s: L; + m: L; + ItemId: Oid; +} + +export interface Mech { + PresetIcon: string; + Favorite: boolean; + s: L; + h: L; + a: L; + ItemId: Oid; +} + +export interface Normal { + FocusSchool: FocusSchool; + PresetIcon: string; + Favorite: boolean; + n: string; + s: L; + p: L; + l: L; + m: L; + h: L; + a?: L; + ItemId: Oid; +} + +export interface LongGun { + ItemType: string; + Configs: LongGunConfig[]; + UpgradeVer?: number; + XP?: number; + Features?: number; + ItemId: Oid; + Polarized?: number; + Polarity?: Polarity[]; + FocusLens?: string; + ModSlotPurchases?: number; + UpgradeType?: UpgradeType; + UpgradeFingerprint?: string; + ItemName?: string; + ModularParts?: string[]; + UnlockLevel?: number; +} + +export interface LongGunConfig { + Upgrades?: string[]; + Skins?: string[]; + pricol?: Color; + attcol?: Color; + PvpUpgrades?: string[]; + Name?: string; +} + +export enum UpgradeType { + LotusWeaponsGrineerKuvaLichUpgradesInnateDamageRandomMod = "/Lotus/Weapons/Grineer/KuvaLich/Upgrades/InnateDamageRandomMod" +} + +export interface LoreFragmentScan { + Progress: number; + Region?: string; + ItemType: string; +} + +export interface LotusCustomization { + Upgrades: any[]; + PvpUpgrades: any[]; + Skins: string[]; + pricol: Color; + attcol: any[]; + sigcol: any[]; + eyecol: any[]; + facial: any[]; + Songs: any[]; + Persona: string; +} + +export interface MechSuit { + ItemType: string; + Configs: DataKnifeConfig[]; + Features: number; + UpgradeVer: number; + XP: number; + Polarity: Polarity[]; + Polarized: number; + ItemId: Oid; +} + +export interface Melee { + ItemType: string; + Configs: MeleeConfig[]; + UpgradeVer?: number; + XP?: number; + Features?: number; + Polarity?: Polarity[]; + Polarized?: number; + ModSlotPurchases?: number; + ItemId: Oid; + FocusLens?: string; + ModularParts?: string[]; + ItemName?: string; + UpgradeType?: UpgradeType; + UpgradeFingerprint?: string; + UnlockLevel?: number; +} + +export interface MeleeConfig { + Skins?: string[]; + pricol?: Color; + Upgrades?: string[]; + attcol?: Color; + eyecol?: OperatorLoadOutSigcol; + Name?: string; + PvpUpgrades?: string[]; +} + +export interface OperatorLoadOutSigcol { + t0?: number; + t1?: number; + en?: number; +} + +export interface Mission { + Completes: number; + Tier?: number; + Tag: string; + RewardsCooldownTime?: Date; +} + +export interface MoaPet { + ItemType: string; + Configs: KubrowPetConfig[]; + UpgradeVer: number; + ModularParts: string[]; + XP?: number; + Features?: number; + ItemName: string; + Polarity?: Polarity[]; + ItemId: Oid; +} + +export interface NemesisHistory { + fp: number; + manifest: Manifest; + KillingSuit: string; + killingDamageType: number; + ShoulderHelmet: string; + AgentIdx: number; + BirthNode: BirthNode; + Rank: number; + k: boolean; + d: Date; + GuessHistory?: number[]; + currentGuess?: number; + Traded?: boolean; + PrevOwners?: number; + SecondInCommand?: boolean; + Faction?: string; + Weakened?: boolean; +} + +export enum BirthNode { + SolNode181 = "SolNode181", + SolNode4 = "SolNode4", + SolNode70 = "SolNode70", + SolNode76 = "SolNode76" +} + +export enum Manifest { + LotusTypesEnemiesCorpusLawyersLawyerManifest = "/Lotus/Types/Enemies/Corpus/Lawyers/LawyerManifest", + LotusTypesGameNemesisKuvaLichKuvaLichManifest = "/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifest", + LotusTypesGameNemesisKuvaLichKuvaLichManifestVersionThree = "/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifestVersionThree", + LotusTypesGameNemesisKuvaLichKuvaLichManifestVersionTwo = "/Lotus/Types/Game/Nemesis/KuvaLich/KuvaLichManifestVersionTwo" +} + +export interface OperatorAmp { + ItemType: string; + Configs: KubrowPetConfig[]; + ModularParts?: string[]; + XP?: number; + UpgradeVer?: number; + ItemName?: string; + Features?: number; + ItemId: Oid; +} + +export interface OperatorLoadOut { + Skins: string[]; + pricol?: Color; + attcol?: Color; + eyecol: Color; + facial?: Color; + sigcol?: OperatorLoadOutSigcol; + OperatorAmp?: Oid; + Upgrades?: string[]; + AbilityOverride: AbilityOverride; + ItemId: Oid; +} + +export interface AbilityOverride { + Ability: string; + Index: number; +} + +export interface PendingCoupon { + Expiry: Date; + Discount: number; +} + +export interface PendingRecipe { + ItemType: string; + CompletionDate: Date; + ItemId: Oid; +} + +export interface PendingTrade { + State: number; + SelfReady: boolean; + BuddyReady: boolean; + Giving?: Giving; + Revision: number; + Getting: Getting; + ItemId: Oid; + ClanTax?: number; +} + +export interface Getting { + RandomUpgrades?: RandomUpgrade[]; + _SlotOrderInfo: GettingSlotOrderInfo[]; + PremiumCredits?: number; +} + +export interface RandomUpgrade { + UpgradeFingerprint: UpgradeFingerprint; + ItemType: string; + ItemId: Oid; +} + +export interface UpgradeFingerprint { + compat: string; + lim: number; + lvlReq: number; + pol: FocusSchool; + buffs: Buff[]; + curses: Buff[]; +} + +export interface Buff { + Tag: string; + Value: number; +} + +export enum GettingSlotOrderInfo { + Empty = "", + LotusUpgradesModsRandomizedPlayerMeleeWeaponRandomModRare0 = "/Lotus/Upgrades/Mods/Randomized/PlayerMeleeWeaponRandomModRare:0", + P = "P" +} + +export interface Giving { + RawUpgrades: Consumable[]; + _SlotOrderInfo: GivingSlotOrderInfo[]; +} + +export enum GivingSlotOrderInfo { + Empty = "", + LotusTypesSentinelsSentinelPreceptsItemVacum = "/Lotus/Types/Sentinels/SentinelPrecepts/ItemVacum", + LotusUpgradesModsPistolDualStatElectEventPistolMod = "/Lotus/Upgrades/Mods/Pistol/DualStat/ElectEventPistolMod" +} + +export interface PeriodicMissionCompletion { + date: Date; + tag: string; + count?: number; +} + +export interface PersonalGoalProgress { + Count: number; + Tag: string; + Best?: number; + _id: Oid; + ReceivedClanReward0?: boolean; + ReceivedClanReward1?: boolean; +} + +export interface PersonalTechProject { + State: number; + ReqCredits: number; + ItemType: string; + ReqItems: Consumable[]; + CompletionDate?: Date; + ItemId: Oid; + ProductCategory?: string; + CategoryItemId?: Oid; + HasContributions?: boolean; +} + +export interface PlayerSkills { + LPP_SPACE: number; + LPS_GUNNERY: number; + LPS_PILOTING: number; + LPS_ENGINEERING: number; + LPS_TACTICAL: number; + LPS_COMMAND: number; +} + +export interface QuestKey { + Progress: Progress[]; + unlock: boolean; + Completed: boolean; + ItemType: string; + CompletionDate?: Date; +} + +export interface Progress { + c: number; + i: boolean; + m: boolean; + b?: any[]; +} + +export interface RawUpgrade { + ItemCount: number; + LastAdded: Oid; + ItemType: string; +} + +export interface Scoop { + ItemType: string; + Configs: ScoopConfig[]; + UpgradeVer: number; + ItemId: Oid; +} + +export interface ScoopConfig { + pricol?: Color; +} + +export interface SeasonChallengeHistory { + challenge: string; + id: string; +} + +export interface SentientSpawnChanceBoosters { + numOceanMissionsCompleted: number; +} + +export interface SentinelWeapon { + ItemType: string; + Configs: SentinelWeaponConfig[]; + UpgradeVer?: number; + XP?: number; + ItemId: Oid; + Features?: number; + Polarity?: Polarity[]; + Polarized?: number; +} + +export interface SentinelWeaponConfig { + Skins?: FluffySkin[]; + Upgrades?: string[]; +} + +export enum FluffySkin { + Empty = "", + LotusUpgradesSkinsHolsterCustomizationsGlaiveInPlace = "/Lotus/Upgrades/Skins/HolsterCustomizations/GlaiveInPlace", + LotusUpgradesSkinsHolsterCustomizationsPistolHipsR = "/Lotus/Upgrades/Skins/HolsterCustomizations/PistolHipsR", + LotusUpgradesSkinsHolsterCustomizationsRifleUpperBack = "/Lotus/Upgrades/Skins/HolsterCustomizations/RifleUpperBack" +} + +export interface Sentinel { + ItemType: string; + Configs: KubrowPetConfig[]; + UpgradeVer: number; + XP: number; + Features?: number; + Polarity?: Polarity[]; + Polarized?: number; + ItemId: Oid; +} + +export interface Settings { + FriendInvRestriction: string; + GiftMode: string; + GuildInvRestriction: string; + ShowFriendInvNotifications: boolean; + TradingRulesConfirmed: boolean; +} + +export interface Ship { + ItemType: string; + ShipExterior: Terior; + AirSupportPower: string; + ItemId: Oid; +} + +export interface SpaceGun { + ItemType: string; + Configs: SpaceGunConfig[]; + XP?: number; + UpgradeVer?: number; + ItemId: Oid; + Features?: number; + Polarized?: number; + Polarity?: Polarity[]; + UpgradeType?: UpgradeType; + UpgradeFingerprint?: string; + ItemName?: string; +} + +export interface SpaceGunConfig { + Skins?: string[]; + pricol?: Color; + Upgrades?: string[]; +} + +export interface Space { + ItemType: string; + Configs: KubrowPetConfig[]; + XP: number; + UpgradeVer: number; + ItemId: Oid; + Features?: number; +} + +export interface SpecialItem { + ItemType: string; + Configs: SpecialItemConfig[]; + XP?: number; + UpgradeVer?: number; + Features: number; + ItemId: Oid; + Polarized?: number; + Polarity?: Polarity[]; + ModSlotPurchases?: number; +} + +export interface SpecialItemConfig { + Upgrades?: string[]; + pricol?: Color; + Skins?: string[]; + attcol?: Color; + eyecol?: PurpleCol; + sigcol?: PurpleCol; + Name?: string; +} + +export interface PurpleCol { + en: number; +} + +export interface SpectreLoadout { + LongGuns: string; + Melee: string; + Pistols: string; + PistolsFeatures: number; + PistolsModularParts: string[]; + Suits: string; + ItemType: string; +} + +export interface StepSequencer { + NotePacks: NotePacks; + FingerPrint: string; + Name: string; + ItemId: Oid; +} + +export interface NotePacks { + MELODY: string; + BASS: string; + PERCUSSION: string; +} + +export interface ISuitDocument extends ISuitDatabase, Document {} + +export interface ISuitResponse extends ISuitDatabase { + ItemId: Oid; +} + +export interface ISuitDatabase { + ItemType: string; + Configs: SuitConfig[]; + UpgradeVer?: number; + XP?: number; + InfestationDate?: Date; + Features?: number; + Polarity?: Polarity[]; + Polarized?: number; + ModSlotPurchases?: number; + ItemId: Oid; + FocusLens?: string; + UnlockLevel?: number; +} + +export interface SuitConfig { + Skins?: string[]; + pricol?: Color; + attcol?: Color; + eyecol?: Color; + sigcol?: Color; + Upgrades?: string[]; + Songs?: Song[]; + Name?: string; + AbilityOverride?: AbilityOverride; + PvpUpgrades?: string[]; + ugly?: boolean; +} + +export interface Song { + m?: string; + b?: string; + p?: string; + s: string; +} + +export interface TauntHistory { + node: string; + state: string; +} + +export interface WeaponSkin { + ItemType: string; + ItemId: Oid; +} + +export interface WebFlags { + activeBuyPlat: number; + noShow2FA: boolean; + Tennocon2018Digital: boolean; + VisitPrimeAccess: Date; + VisitTennocon2019: Date; + enteredSC2019: Date; + VisitPrimeVault: Date; + VisitBuyPlatinum: Date; + ClickedSku_640_Page__en_buyplatinum: Date; + ClickedSku_640_Page__buyplatinum: Date; + VisitStarterPack: Date; + Tennocon2020Digital: boolean; + Anniversary2021: boolean; + HitDownloadBtn: Date; +} diff --git a/static/fixed_responses/new_inventory.json b/static/fixed_responses/new_inventory.json new file mode 100644 index 00000000..8c112a7a --- /dev/null +++ b/static/fixed_responses/new_inventory.json @@ -0,0 +1,121 @@ +{ + "SubscribedToEmails": 0, + "Created": { "$date": { "$numberLong": "1685829131" } }, + "SubscribedToEmailsPersonalized": 0, + "RewardSeed": -5604904486637265640, + "CrewMemberBin": { "Slots": 3 }, + "CrewShipSalvageBin": { "Slots": 8 }, + "DrifterMelee": [{ "ItemType": "/Lotus/Types/Friendly/PlayerControllable/Weapons/DuviriDualSwords", "ItemId": { "$oid": "647bb619e15fa43f0ee4b1b1" } }], + "FusionPoints": 0, + "MechBin": { "Slots": 4 }, + "OperatorAmpBin": { "Slots": 8 }, + "PveBonusLoadoutBin": { "Slots": 0 }, + "PvpBonusLoadoutBin": { "Slots": 0 }, + "RandomModBin": { "Slots": 15 }, + "RegularCredits": 0, + "SentinelBin": { "Slots": 10 }, + "SpaceSuitBin": { "Slots": 4 }, + "SpaceWeaponBin": { "Slots": 4 }, + "SuitBin": { "Slots": 2 }, + "WeaponBin": { "Slots": 8 }, + "LastInventorySync": { "$oid": "647bb5d79f963c9d24668257" }, + "NextRefill": { "$date": { "$numberLong": "1685829131" } }, + "ActiveLandscapeTraps": [], + "ChallengeProgress": [], + "CrewMembers": [], + "CrewShips": [], + "CrewShipHarnesses": [], + "CrewShipSalvagedWeapons": [], + "CrewShipSalvagedWeaponSkins": [], + "CrewShipWeapons": [], + "CrewShipWeaponSkins": [], + "DataKnives": [], + "DrifterGuns": [], + "Drones": [], + "Horses": [], + "Hoverboards": [], + "KubrowPets": [], + "KubrowPetEggs": [], + "KubrowPetPrints": [], + "LongGuns": [], + "MechSuits": [], + "Melee": [], + "MoaPets": [], + "OperatorAmps": [], + "OperatorLoadOuts": [], + "AdultOperatorLoadOuts": [], + "KahlLoadOuts": [], + "PendingRecipes": [], + "PersonalGoalProgress": [], + "PersonalTechProjects": [], + "Pistols": [], + "QualifyingInvasions": [], + "RepVotes": [], + "Scoops": [], + "Sentinels": [], + "SentinelWeapons": [], + "Ships": [], + "SpaceGuns": [], + "SpaceMelee": [], + "SpaceSuits": [], + "SpecialItems": [], + "StepSequencers": [], + "Suits": [], + "Upgrades": [], + "WeaponSkins": [], + "Boosters": [], + "Consumables": [], + "EmailItems": [], + "FlavourItems": [], + "FocusUpgrades": [], + "FusionTreasures": [], + "LeagueTickets": [], + "LevelKeys": [], + "LoreFragmentScans": [], + "MiscItems": [], + "PendingSpectreLoadouts": [], + "Quests": [], + "QuestKeys": [], + "RawUpgrades": [], + "Recipes": [], + "Robotics": [], + "ShipDecorations": [], + "SpectreLoadouts": [], + "XPInfo": [], + "CrewShipAmmo": [], + "CrewShipRawSalvage": [], + "EvolutionProgress": [], + "Missions": [], + "TauntHistory": [], + "CompletedSyndicates": [], + "UsedDailyDeals": [], + "DailyAffiliation": 16000, + "DailyAffiliationPvp": 16000, + "DailyAffiliationLibrary": 16000, + "DailyAffiliationCetus": 16000, + "DailyAffiliationQuills": 16000, + "DailyAffiliationSolaris": 16000, + "DailyAffiliationVentkids": 16000, + "DailyAffiliationVox": 16000, + "DailyAffiliationEntrati": 16000, + "DailyAffiliationNecraloid": 16000, + "DailyAffiliationZariman": 16000, + "DailyAffiliationKahl": 16000, + "DailyFocus": 250000, + "GiftsRemaining": 8, + "LibraryAvailableDailyTaskInfo": { + "EnemyTypes": ["/Lotus/Types/Enemies/Orokin/OrokinBladeSawmanAvatar"], + "EnemyLocTag": "/Lotus/Language/Game/OrokinBladeSawman", + "EnemyIcon": "/Lotus/Interface/Icons/Npcs/Orokin/OrokinBladeSawman.png", + "ScansRequired": 4, + "RewardStoreItem": "/Lotus/StoreItems/Upgrades/Mods/FusionBundles/UncommonFusionBundle", + "RewardQuantity": 10, + "RewardStanding": 10000 + }, + "DuviriInfo": { "Seed": 5898912197983600352, "NumCompletions": 0 }, + "TradesRemaining": 0, + "HasContributedToDojo": false, + "HasResetAccount": false, + "PendingCoupon": { "Expiry": { "$date": { "$numberLong": "0" } }, "Discount": 0 }, + "PremiumCreditsFree": 0 +} diff --git a/static/fixed_responses/postTutorialInventory.json b/static/fixed_responses/postTutorialInventory.json new file mode 100644 index 00000000..1c2d8721 --- /dev/null +++ b/static/fixed_responses/postTutorialInventory.json @@ -0,0 +1,145 @@ +{ + "SubscribedToEmails": 0, + "Created": { "$date": { "$numberLong": "1685829131" } }, + "SubscribedToEmailsPersonalized": 0, + "RewardSeed": -5604904486637265640, + "CrewMemberBin": { "Slots": 3 }, + "CrewShipSalvageBin": { "Slots": 8 }, + "DrifterMelee": [{ "ItemType": "/Lotus/Types/Friendly/PlayerControllable/Weapons/DuviriDualSwords", "ItemId": { "$oid": "647bd268c547fe5b2909e715" } }], + "FusionPoints": 0, + "MechBin": { "Slots": 4 }, + "OperatorAmpBin": { "Slots": 8 }, + "PveBonusLoadoutBin": { "Slots": 0 }, + "PvpBonusLoadoutBin": { "Slots": 0 }, + "RandomModBin": { "Slots": 15 }, + "RegularCredits": 3000, + "SentinelBin": { "Slots": 10 }, + "SpaceSuitBin": { "Slots": 4 }, + "SpaceWeaponBin": { "Slots": 4 }, + "SuitBin": { "Slots": 1 }, + "WeaponBin": { "Slots": 5 }, + "DailyAffiliation": 16000, + "DailyAffiliationCetus": 16000, + "DailyAffiliationEntrati": 16000, + "DailyAffiliationKahl": 16000, + "DailyAffiliationLibrary": 16000, + "DailyAffiliationNecraloid": 16000, + "DailyAffiliationPvp": 16000, + "DailyAffiliationQuills": 16000, + "DailyAffiliationSolaris": 16000, + "DailyAffiliationVentkids": 16000, + "DailyAffiliationVox": 16000, + "DailyAffiliationZariman": 16000, + "DailyFocus": 250000, + "DuviriInfo": { "Seed": 5898912197983600352, "NumCompletions": 0 }, + "GiftsRemaining": 8, + "TradesRemaining": 0, + "Recipes": [{ "ItemCount": 1, "ItemType": "/Lotus/Types/Recipes/Weapons/BoltonfaBlueprint" }], + "SeasonChallengeHistory": [ + { "challenge": "SeasonDailySolveCiphers", "id": "001000220000000000000308" }, + { "challenge": "SeasonDailyVisitFeaturedDojo", "id": "001000230000000000000316" }, + { "challenge": "SeasonDailyKillEnemiesWithRadiation", "id": "001000230000000000000317" }, + { "challenge": "SeasonWeeklyCompleteSortie", "id": "001000230000000000000309" }, + { "challenge": "SeasonWeeklyVenusBounties", "id": "001000230000000000000310" }, + { "challenge": "SeasonWeeklyZarimanBountyHunter", "id": "001000230000000000000311" }, + { "challenge": "SeasonWeeklyCatchRarePlainsFish", "id": "001000230000000000000312" }, + { "challenge": "SeasonWeeklyKillArchgunEnemies", "id": "001000230000000000000313" }, + { "challenge": "SeasonWeeklyHardKillSilverGroveSpecters", "id": "001000230000000000000314" }, + { "challenge": "SeasonWeeklyHardKillRopalolyst", "id": "001000230000000000000315" } + ], + "StoryModeChoice": "WARFRAME", + "ChallengeProgress": [{ "Progress": 2, "Name": "EMGetKills" }], + "ChallengesFixVersion": 6, + "ActiveQuest": "/Lotus/Types/Keys/VorsPrize/VorsPrizeQuestKeyChain", + "Consumables": [{ "ItemCount": 1, "ItemType": "/Lotus/Types/Restoratives/LisetAutoHack" }], + "DataKnives": [{ "ItemType": "/Lotus/Weapons/Tenno/HackingDevices/TnHackingDevice/TnHackingDeviceWeapon", "XP": 450000, "ItemId": { "$oid": "647bd274f22fc794a2cd3d33" } }], + "FlavourItems": [ + { "ItemType": "/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem1" }, + { "ItemType": "/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem2" }, + { "ItemType": "/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem3" }, + { "ItemType": "/Lotus/Types/StoreItems/AvatarImages/AvatarImageItem4" } + ], + "LongGuns": [{ "ItemType": "/Lotus/Weapons/MK1Series/MK1Paris", "XP": 0, "Configs": [{}, {}, {}], "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }], + "Melee": [{ "ItemType": "/Lotus/Weapons/Tenno/Melee/LongSword/LongSword", "XP": 0, "Configs": [{}, {}, {}], "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }], + "Pistols": [{ "ItemType": "/Lotus/Weapons/MK1Series/MK1Kunai", "XP": 0, "Configs": [{}, {}, {}], "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }], + "PlayedParkourTutorial": true, + "PremiumCreditsFree": 50, + "QuestKeys": [{ "ItemType": "/Lotus/Types/Keys/VorsPrize/VorsPrizeQuestKeyChain" }], + "RawUpgrades": [{ "ItemCount": 1, "LastAdded": { "$oid": "6450f9bfe0714a4d6703f05f" }, "ItemType": "/Lotus/Upgrades/Mods/Warframe/AvatarShieldMaxMod" }], + "ReceivedStartingGear": true, + "Scoops": [{ "ItemType": "/Lotus/Weapons/Tenno/Speedball/SpeedballWeaponTest", "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }], + "Ships": [{ "ItemType": "/Lotus/Types/Items/Ships/DefaultShip", "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }], + "Suits": [{ "ItemType": "/Lotus/Powersuits/Volt/Volt", "XP": 0, "Configs": [{}, {}, {}], "UpgradeVer": 101, "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }], + "TrainingRetriesLeft": 0, + "WeaponSkins": [{ "ItemType": "/Lotus/Upgrades/Skins/Volt/VoltHelmet", "ItemId": { "$oid": "647bd27cf856530b4f3bf343" } }], + "LastInventorySync": { "$oid": "647bd27cf856530b4f3bf343" }, + "NextRefill": { "$date": { "$numberLong": "1685829131" } }, + "ActiveLandscapeTraps": [], + "CrewMembers": [], + "CrewShips": [], + "CrewShipHarnesses": [], + "CrewShipSalvagedWeapons": [], + "CrewShipSalvagedWeaponSkins": [], + "CrewShipWeapons": [], + "CrewShipWeaponSkins": [], + "DrifterGuns": [], + "Drones": [], + "Horses": [], + "Hoverboards": [], + "KubrowPets": [], + "KubrowPetEggs": [], + "KubrowPetPrints": [], + "MechSuits": [], + "MoaPets": [], + "OperatorAmps": [], + "OperatorLoadOuts": [], + "AdultOperatorLoadOuts": [], + "KahlLoadOuts": [], + "PendingRecipes": [], + "PersonalGoalProgress": [], + "PersonalTechProjects": [], + "QualifyingInvasions": [], + "RepVotes": [], + "Sentinels": [], + "SentinelWeapons": [], + "SpaceGuns": [], + "SpaceMelee": [], + "SpaceSuits": [], + "SpecialItems": [], + "StepSequencers": [], + "Upgrades": [], + "Boosters": [], + "EmailItems": [], + "FocusUpgrades": [], + "FusionTreasures": [], + "LeagueTickets": [], + "LevelKeys": [], + "LoreFragmentScans": [], + "MiscItems": [], + "PendingSpectreLoadouts": [], + "Quests": [], + "Robotics": [], + "ShipDecorations": [], + "SpectreLoadouts": [], + "XPInfo": [], + "CrewShipAmmo": [], + "CrewShipRawSalvage": [], + "EvolutionProgress": [], + "Missions": [], + "TauntHistory": [], + "CompletedSyndicates": [], + "UsedDailyDeals": [], + "LibraryAvailableDailyTaskInfo": { + "EnemyTypes": ["/Lotus/Types/Enemies/Orokin/OrokinBladeSawmanAvatar"], + "EnemyLocTag": "/Lotus/Language/Game/OrokinBladeSawman", + "EnemyIcon": "/Lotus/Interface/Icons/Npcs/Orokin/OrokinBladeSawman.png", + "ScansRequired": 4, + "RewardStoreItem": "/Lotus/StoreItems/Upgrades/Mods/FusionBundles/UncommonFusionBundle", + "RewardQuantity": 10, + "RewardStanding": 10000 + }, + "HasContributedToDojo": false, + "HasResetAccount": false, + "PendingCoupon": { "Expiry": { "$date": { "$numberLong": "0" } }, "Discount": 0 }, + "PremiumCredits": 50 +} -- 2.47.2 From ad55d2f09a26ed8adc22ac898a99679b13ddb3eb Mon Sep 17 00:00:00 2001 From: AKCore Date: Sat, 3 Jun 2023 19:12:17 -0700 Subject: [PATCH 7/8] "Fix" VaRiAbLe NaMeS --- src/controllers/api/findSessionsController.ts | 18 +++++++++--------- src/controllers/api/joinSessionController.ts | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/controllers/api/findSessionsController.ts b/src/controllers/api/findSessionsController.ts index 5a1f4301..9e4da0f5 100644 --- a/src/controllers/api/findSessionsController.ts +++ b/src/controllers/api/findSessionsController.ts @@ -3,24 +3,24 @@ import { getSession } from "@/src/managers/sessionManager"; const findSessionsController: RequestHandler = (_req, res) => { console.log("FindSession Request:", JSON.parse(_req.body)); - let r = JSON.parse(_req.body); - if (r.id != undefined) { + let req = JSON.parse(_req.body); + if (req.id != undefined) { console.log("Found ID"); - let s = getSession(r.id); + let session = getSession(req.id); - if (s) res.json({ queryId: r.queryId, Sessions: s }); + if (session) res.json({ queryId: req.queryId, Sessions: session }); else res.json({}); - } else if (r.originalSessionId != undefined) { + } else if (req.originalSessionId != undefined) { console.log("Found OriginalSessionID"); - let s = getSession(r.originalSessionId); - if (s) res.json({ queryId: r.queryId, Sessions: [s] }); + let session = getSession(req.originalSessionId); + if (session) res.json({ queryId: req.queryId, Sessions: session }); else res.json({}); } else { console.log("Found SessionRequest"); - let s = getSession(_req.body); - if (s) res.json({ queryId: r.queryId, Sessions: [s] }); + let session = getSession(_req.body); + if (session) res.json({ queryId: req.queryId, Sessions: session }); else res.json({}); } }; diff --git a/src/controllers/api/joinSessionController.ts b/src/controllers/api/joinSessionController.ts index 0b940eb1..3cd6a7e0 100644 --- a/src/controllers/api/joinSessionController.ts +++ b/src/controllers/api/joinSessionController.ts @@ -3,9 +3,9 @@ import { getSessionByID } from "@/src/managers/sessionManager"; const joinSessionController: RequestHandler = (_req, res) => { console.log("JoinSession Request:", JSON.parse(_req.body)); - let r = JSON.parse(_req.body); - let s = getSessionByID(r.sessionIds[0]); - res.json({ rewardSeed: s?.rewardSeed, sessionId: { $oid: s?.sessionId } }); + let req = JSON.parse(_req.body); + let session = getSessionByID(req.sessionIds[0]); + res.json({ rewardSeed: session?.rewardSeed, sessionId: { $oid: session?.sessionId } }); }; export { joinSessionController }; -- 2.47.2 From 6ac5ddad06d0efaddd3a869c9aad3d6c74b4c411 Mon Sep 17 00:00:00 2001 From: AKCore Date: Sat, 3 Jun 2023 19:17:23 -0700 Subject: [PATCH 8/8] Update login_static.ts remove NRS ips --- static/fixed_responses/login_static.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/fixed_responses/login_static.ts b/static/fixed_responses/login_static.ts index 8319186a..d5b3ede9 100644 --- a/static/fixed_responses/login_static.ts +++ b/static/fixed_responses/login_static.ts @@ -24,7 +24,7 @@ export const platformCDNs = [ export const Nonce = 1231231233; -export const NRS = ["104.237.145.11", "139.144.69.73", "170.187.231.80", "45.33.58.33", "85.159.214.213"]; +export const NRS = ["localhost"]; export const DTLS = 99; -- 2.47.2