Update 33.6.8 + mastery training #55
@ -8,4 +8,4 @@
 | 
				
			|||||||
  "skipTutorial": true,
 | 
					  "skipTutorial": true,
 | 
				
			||||||
  "testMission": true,
 | 
					  "testMission": true,
 | 
				
			||||||
  "testQuestKey": true
 | 
					  "testQuestKey": true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -12,7 +12,7 @@
 | 
				
			|||||||
        "dotenv": "^16.1.3",
 | 
					        "dotenv": "^16.1.3",
 | 
				
			||||||
        "express": "^5.0.0-beta.1",
 | 
					        "express": "^5.0.0-beta.1",
 | 
				
			||||||
        "mongoose": "^7.4.1",
 | 
					        "mongoose": "^7.4.1",
 | 
				
			||||||
        "warframe-items": "1.1260.79"
 | 
					        "warframe-items": "1.1260.121"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "devDependencies": {
 | 
					      "devDependencies": {
 | 
				
			||||||
        "@tsconfig/node20": "^1.0.0",
 | 
					        "@tsconfig/node20": "^1.0.0",
 | 
				
			||||||
@ -3597,9 +3597,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/warframe-items": {
 | 
					    "node_modules/warframe-items": {
 | 
				
			||||||
      "version": "1.1260.79",
 | 
					      "version": "1.1260.121",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/warframe-items/-/warframe-items-1.1260.79.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/warframe-items/-/warframe-items-1.1260.121.tgz",
 | 
				
			||||||
      "integrity": "sha512-Xp/nt++v5V3ghEZNhE56Mge2jeBjjr+ua6PC/7ZHYTMsO8x1xheOMuVxl7v7IjscO1rHFdYEQnSU9Gw1uipYsQ=="
 | 
					      "integrity": "sha512-C/te9WSsc3HzeSAgziAGKs6sKnYqCO41QDov8E6RUfl3D06C7ko8mHsJ2j65zF515IatJl/xelVtp0aAnQcWiQ=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/webidl-conversions": {
 | 
					    "node_modules/webidl-conversions": {
 | 
				
			||||||
      "version": "7.0.0",
 | 
					      "version": "7.0.0",
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@
 | 
				
			|||||||
    "dotenv": "^16.1.3",
 | 
					    "dotenv": "^16.1.3",
 | 
				
			||||||
    "express": "^5.0.0-beta.1",
 | 
					    "express": "^5.0.0-beta.1",
 | 
				
			||||||
    "mongoose": "^7.4.1",
 | 
					    "mongoose": "^7.4.1",
 | 
				
			||||||
    "warframe-items": "1.1260.79"
 | 
					    "warframe-items": "1.1260.121"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
    "@tsconfig/node20": "^1.0.0",
 | 
					    "@tsconfig/node20": "^1.0.0",
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										22
									
								
								src/controllers/api/artifactsController.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								src/controllers/api/artifactsController.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					import { parseString } from "@/src/helpers/general";
 | 
				
			||||||
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
 | 
					import { upgradeMod } from "@/src/services/inventoryService";
 | 
				
			||||||
 | 
					import { IArtifactsRequest } from "@/src/types/requestTypes";
 | 
				
			||||||
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
				
			||||||
 | 
					const artifactsController: RequestHandler = async (req, res) => {
 | 
				
			||||||
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
 | 
				
			||||||
 | 
					        const artifactsData = getJSONfromString(req.body.toString()) as IArtifactsRequest;
 | 
				
			||||||
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
 | 
				
			||||||
 | 
					        const upgradeModId = await upgradeMod(artifactsData, accountId);
 | 
				
			||||||
 | 
					        res.send(upgradeModId);
 | 
				
			||||||
 | 
					    } catch (err) {
 | 
				
			||||||
 | 
					        console.error("Error parsing JSON data:", err);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export { artifactsController };
 | 
				
			||||||
@ -1,7 +1,30 @@
 | 
				
			|||||||
 | 
					import { updateGeneric } from "@/src/services/inventoryService";
 | 
				
			||||||
 | 
					import { IGenericUpdate } from "@/src/types/genericUpdate";
 | 
				
			||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const genericUpdateController: RequestHandler = (_req, res) => {
 | 
					// TODO: Nightwave evidence submission support is the only thing missing.
 | 
				
			||||||
    res.json({});
 | 
					// TODO: Also, you might want to test this, because I definitely didn't.
 | 
				
			||||||
 | 
					const genericUpdateController: RequestHandler = async (request, response) => {
 | 
				
			||||||
 | 
					    const accountId = request.query.accountId as string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const [body] = String(request.body).split("\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let reply = {};
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					        const update = JSON.parse(body) as IGenericUpdate;
 | 
				
			||||||
 | 
					        if (typeof update !== "object") {
 | 
				
			||||||
 | 
					            throw new Error("Invalid data format");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        reply = await updateGeneric(update, accountId);
 | 
				
			||||||
 | 
					    } catch (err) {
 | 
				
			||||||
 | 
					        console.error("Error parsing JSON data:", err);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Response support added for when Nightwave is supported below.
 | 
				
			||||||
 | 
					    // response.json(reply);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    response.json({});
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export { genericUpdateController };
 | 
					export { genericUpdateController };
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,11 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { missionInventoryUpdate } from "@/src/services/inventoryService";
 | 
					import { missionInventoryUpdate } from "@/src/services/inventoryService";
 | 
				
			||||||
import { MissionInventoryUpdate } from "@/src/types/missionInventoryUpdateType";
 | 
					import { combineRewardAndLootInventory, getRewards } from "@/src/services/missionInventoryUpdateService ";
 | 
				
			||||||
 | 
					import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			||||||
 | 
					import { parseString } from "@/src/helpers/general";
 | 
				
			||||||
 | 
					import { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes";
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
					**** INPUT ****
 | 
				
			||||||
- [ ]  crossPlaySetting
 | 
					- [ ]  crossPlaySetting
 | 
				
			||||||
- [ ]  rewardsMultiplier
 | 
					- [ ]  rewardsMultiplier
 | 
				
			||||||
- [ ]  ActiveBoosters
 | 
					- [ ]  ActiveBoosters
 | 
				
			||||||
@ -18,20 +22,20 @@ import { MissionInventoryUpdate } from "@/src/types/missionInventoryUpdateType";
 | 
				
			|||||||
- [ ]  CurrentLoadOutIds
 | 
					- [ ]  CurrentLoadOutIds
 | 
				
			||||||
- [ ]  AliveTime
 | 
					- [ ]  AliveTime
 | 
				
			||||||
- [ ]  MissionTime
 | 
					- [ ]  MissionTime
 | 
				
			||||||
- [ ]  Missions
 | 
					- [x]  Missions
 | 
				
			||||||
- [ ]  CompletedAlerts
 | 
					- [ ]  CompletedAlerts
 | 
				
			||||||
- [ ]  LastRegionPlayed
 | 
					- [ ]  LastRegionPlayed
 | 
				
			||||||
- [ ]  GameModeId
 | 
					- [ ]  GameModeId
 | 
				
			||||||
- [ ]  hosts
 | 
					- [ ]  hosts
 | 
				
			||||||
- [x]  ChallengeProgress
 | 
					- [x]  ChallengeProgress
 | 
				
			||||||
- [ ]  SeasonChallengeHistory
 | 
					- [ ]  SeasonChallengeHistory
 | 
				
			||||||
- [ ]  PS
 | 
					- [ ]  PS (Passive anti-cheat data which includes your username, module list, process list, and system name.)
 | 
				
			||||||
- [ ]  ActiveDojoColorResearch
 | 
					- [ ]  ActiveDojoColorResearch
 | 
				
			||||||
- [ ]  RewardInfo
 | 
					- [x]  RewardInfo
 | 
				
			||||||
- [ ]  ReceivedCeremonyMsg
 | 
					- [ ]  ReceivedCeremonyMsg
 | 
				
			||||||
- [ ]  LastCeremonyResetDate
 | 
					- [ ]  LastCeremonyResetDate
 | 
				
			||||||
- [ ]  MissionPTS
 | 
					- [ ]  MissionPTS (Used to validate the mission/alive time above.)
 | 
				
			||||||
- [ ]  RepHash
 | 
					- [ ]  RepHash (A hash from the replication manager/RepMgr Unknown what it does.)
 | 
				
			||||||
- [ ]  EndOfMatchUpload
 | 
					- [ ]  EndOfMatchUpload
 | 
				
			||||||
- [ ]  ObjectiveReached
 | 
					- [ ]  ObjectiveReached
 | 
				
			||||||
- [ ]  FpsAvg
 | 
					- [ ]  FpsAvg
 | 
				
			||||||
@ -41,22 +45,43 @@ import { MissionInventoryUpdate } from "@/src/types/missionInventoryUpdateType";
 | 
				
			|||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
				
			||||||
const missionInventoryUpdateController: RequestHandler = async (req, res) => {
 | 
					const missionInventoryUpdateController: RequestHandler = async (req, res): Promise<void> => {
 | 
				
			||||||
    const [data] = String(req.body).split("\n");
 | 
					    const accountId = parseString(req.query.accountId);
 | 
				
			||||||
    const id = req.query.accountId as string;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // TODO - salt check
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        const parsedData = JSON.parse(data) as MissionInventoryUpdate;
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call
 | 
				
			||||||
        if (typeof parsedData !== "object" || parsedData === null) throw new Error("Invalid data format");
 | 
					        const lootInventory = getJSONfromString(req.body.toString()) as IMissionInventoryUpdateRequest;
 | 
				
			||||||
        await missionInventoryUpdate(parsedData, id);
 | 
					
 | 
				
			||||||
 | 
					        const { InventoryChanges, MissionRewards } = getRewards(lootInventory);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const { combinedInventoryChanges, TotalCredits, CreditsBonus, MissionCredits, FusionPoints } =
 | 
				
			||||||
 | 
					            combineRewardAndLootInventory(InventoryChanges, lootInventory);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
				
			||||||
 | 
					        const InventoryJson = JSON.stringify(await missionInventoryUpdate(combinedInventoryChanges, accountId));
 | 
				
			||||||
 | 
					        res.json({
 | 
				
			||||||
 | 
					            // InventoryJson, // this part will reset game data and missions will be locked
 | 
				
			||||||
 | 
					            MissionRewards,
 | 
				
			||||||
 | 
					            InventoryChanges,
 | 
				
			||||||
 | 
					            TotalCredits,
 | 
				
			||||||
 | 
					            CreditsBonus,
 | 
				
			||||||
 | 
					            MissionCredits,
 | 
				
			||||||
 | 
					            ...(FusionPoints !== undefined && { FusionPoints })
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
    } catch (err) {
 | 
					    } catch (err) {
 | 
				
			||||||
        console.error("Error parsing JSON data:", err);
 | 
					        console.error("Error parsing JSON data:", err);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // TODO - get original response
 | 
					 | 
				
			||||||
    res.json({});
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					**** OUTPUT ****
 | 
				
			||||||
 | 
					- [x]  InventoryJson
 | 
				
			||||||
 | 
					- [x]  MissionRewards
 | 
				
			||||||
 | 
					- [x]  TotalCredits
 | 
				
			||||||
 | 
					- [x]  CreditsBonus
 | 
				
			||||||
 | 
					- [x]  MissionCredits
 | 
				
			||||||
 | 
					- [x]  InventoryChanges
 | 
				
			||||||
 | 
					- [x]  FusionPoints
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export { missionInventoryUpdateController };
 | 
					export { missionInventoryUpdateController };
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,10 @@
 | 
				
			|||||||
import { Session, FindSessionRequest } from "@/src/types/session";
 | 
					import { ISession, IFindSessionRequest } from "@/src/types/session";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const sessions: Session[] = [];
 | 
					const sessions: ISession[] = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function createNewSession(sessionData: Session, Creator: string): Session {
 | 
					function createNewSession(sessionData: ISession, Creator: string): ISession {
 | 
				
			||||||
    const sessionId = getNewSessionID();
 | 
					    const sessionId = getNewSessionID();
 | 
				
			||||||
    const newSession: Session = {
 | 
					    const newSession: ISession = {
 | 
				
			||||||
        sessionId,
 | 
					        sessionId,
 | 
				
			||||||
        creatorId: Creator,
 | 
					        creatorId: Creator,
 | 
				
			||||||
        maxPlayers: sessionData.maxPlayers || 4,
 | 
					        maxPlayers: sessionData.maxPlayers || 4,
 | 
				
			||||||
@ -35,15 +35,15 @@ function createNewSession(sessionData: Session, Creator: string): Session {
 | 
				
			|||||||
    return newSession;
 | 
					    return newSession;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getAllSessions(): Session[] {
 | 
					function getAllSessions(): ISession[] {
 | 
				
			||||||
    return sessions;
 | 
					    return sessions;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getSessionByID(sessionId: string): Session | undefined {
 | 
					function getSessionByID(sessionId: string): ISession | undefined {
 | 
				
			||||||
    return sessions.find(session => session.sessionId === sessionId);
 | 
					    return sessions.find(session => session.sessionId === sessionId);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] {
 | 
					function getSession(sessionIdOrRequest: string | IFindSessionRequest): any[] {
 | 
				
			||||||
    if (typeof sessionIdOrRequest === "string") {
 | 
					    if (typeof sessionIdOrRequest === "string") {
 | 
				
			||||||
        const session = sessions.find(session => session.sessionId === sessionIdOrRequest);
 | 
					        const session = sessions.find(session => session.sessionId === sessionIdOrRequest);
 | 
				
			||||||
        if (session) {
 | 
					        if (session) {
 | 
				
			||||||
@ -58,10 +58,10 @@ function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] {
 | 
				
			|||||||
        return [];
 | 
					        return [];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const request = sessionIdOrRequest as FindSessionRequest;
 | 
					    const request = sessionIdOrRequest as IFindSessionRequest;
 | 
				
			||||||
    const matchingSessions = sessions.filter(session => {
 | 
					    const matchingSessions = sessions.filter(session => {
 | 
				
			||||||
        for (const key in request) {
 | 
					        for (const key in request) {
 | 
				
			||||||
            if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof Session]) {
 | 
					            if (key !== "eloRating" && key !== "queryId" && request[key] !== session[key as keyof ISession]) {
 | 
				
			||||||
                return false;
 | 
					                return false;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -74,7 +74,7 @@ function getSession(sessionIdOrRequest: string | FindSessionRequest): any[] {
 | 
				
			|||||||
    }));
 | 
					    }));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getSessionByCreatorID(creatorId: string): Session | undefined {
 | 
					function getSessionByCreatorID(creatorId: string): ISession | undefined {
 | 
				
			||||||
    return sessions.find(session => session.creatorId === creatorId);
 | 
					    return sessions.find(session => session.creatorId === creatorId);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,15 +1,15 @@
 | 
				
			|||||||
import { Model, Schema, Types, model } from "mongoose";
 | 
					import { Model, Schema, Types, model } from "mongoose";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    FlavourItem,
 | 
					    IFlavourItem,
 | 
				
			||||||
    RawUpgrade,
 | 
					    IRawUpgrade,
 | 
				
			||||||
    MiscItem,
 | 
					    IMiscItem,
 | 
				
			||||||
    IInventoryDatabase,
 | 
					    IInventoryDatabase,
 | 
				
			||||||
    Booster,
 | 
					    IBooster,
 | 
				
			||||||
    IInventoryResponse,
 | 
					    IInventoryResponse,
 | 
				
			||||||
    IInventoryDatabaseDocument,
 | 
					    IInventoryDatabaseDocument,
 | 
				
			||||||
    IInventoryResponseDocument
 | 
					    IInventoryResponseDocument
 | 
				
			||||||
} from "../types/inventoryTypes/inventoryTypes";
 | 
					} from "../types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { IMongoDate, Oid } from "../types/commonTypes";
 | 
					import { IMongoDate, IOid } from "../types/commonTypes";
 | 
				
			||||||
import { ISuitDatabase, ISuitDocument } from "@/src/types/inventoryTypes/SuitTypes";
 | 
					import { ISuitDatabase, ISuitDocument } from "@/src/types/inventoryTypes/SuitTypes";
 | 
				
			||||||
import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
 | 
					import { IWeaponDatabase } from "@/src/types/inventoryTypes/weaponTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -80,10 +80,38 @@ const BoosterSchema = new Schema({
 | 
				
			|||||||
    ItemType: String
 | 
					    ItemType: String
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const RawUpgrades = new Schema({
 | 
				
			||||||
 | 
					    ItemType: String,
 | 
				
			||||||
 | 
					    ItemCount: Number
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RawUpgrades.set("toJSON", {
 | 
				
			||||||
 | 
					    transform(_document, returnedObject) {
 | 
				
			||||||
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
 | 
				
			||||||
 | 
					        returnedObject.LastAdded = { $oid: returnedObject._id.toString() } satisfies IOid;
 | 
				
			||||||
 | 
					        delete returnedObject._id;
 | 
				
			||||||
 | 
					        delete returnedObject.__v;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const Upgrade = new Schema({
 | 
				
			||||||
 | 
					    UpgradeFingerprint: String,
 | 
				
			||||||
 | 
					    ItemType: String
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Upgrade.set("toJSON", {
 | 
				
			||||||
 | 
					    transform(_document, returnedObject) {
 | 
				
			||||||
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
 | 
				
			||||||
 | 
					        returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies IOid;
 | 
				
			||||||
 | 
					        delete returnedObject._id;
 | 
				
			||||||
 | 
					        delete returnedObject.__v;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WeaponSchema.set("toJSON", {
 | 
					WeaponSchema.set("toJSON", {
 | 
				
			||||||
    transform(_document, returnedObject) {
 | 
					    transform(_document, returnedObject) {
 | 
				
			||||||
        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
 | 
				
			||||||
        returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies Oid;
 | 
					        returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies IOid;
 | 
				
			||||||
        delete returnedObject._id;
 | 
					        delete returnedObject._id;
 | 
				
			||||||
        delete returnedObject.__v;
 | 
					        delete returnedObject.__v;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -139,7 +167,7 @@ const suitSchema = new Schema<ISuitDatabase>({
 | 
				
			|||||||
suitSchema.set("toJSON", {
 | 
					suitSchema.set("toJSON", {
 | 
				
			||||||
    transform(_document, returnedObject) {
 | 
					    transform(_document, returnedObject) {
 | 
				
			||||||
        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
 | 
				
			||||||
        returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies Oid;
 | 
					        returnedObject.ItemId = { $oid: returnedObject._id.toString() } satisfies IOid;
 | 
				
			||||||
        delete returnedObject._id;
 | 
					        delete returnedObject._id;
 | 
				
			||||||
        delete returnedObject.__v;
 | 
					        delete returnedObject.__v;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -190,7 +218,7 @@ const inventorySchema = new Schema<IInventoryDatabaseDocument, InventoryDocument
 | 
				
			|||||||
    MiscItems: [Schema.Types.Mixed],
 | 
					    MiscItems: [Schema.Types.Mixed],
 | 
				
			||||||
    ChallengesFixVersion: Number,
 | 
					    ChallengesFixVersion: Number,
 | 
				
			||||||
    ChallengeProgress: [Schema.Types.Mixed],
 | 
					    ChallengeProgress: [Schema.Types.Mixed],
 | 
				
			||||||
    RawUpgrades: [Schema.Types.Mixed],
 | 
					    RawUpgrades: [RawUpgrades],
 | 
				
			||||||
    ReceivedStartingGear: Boolean,
 | 
					    ReceivedStartingGear: Boolean,
 | 
				
			||||||
    Suits: [suitSchema],
 | 
					    Suits: [suitSchema],
 | 
				
			||||||
    LongGuns: [WeaponSchema],
 | 
					    LongGuns: [WeaponSchema],
 | 
				
			||||||
@ -212,7 +240,7 @@ const inventorySchema = new Schema<IInventoryDatabaseDocument, InventoryDocument
 | 
				
			|||||||
    PendingRecipes: [Schema.Types.Mixed],
 | 
					    PendingRecipes: [Schema.Types.Mixed],
 | 
				
			||||||
    TrainingDate: Date,
 | 
					    TrainingDate: Date,
 | 
				
			||||||
    PlayerLevel: Number,
 | 
					    PlayerLevel: Number,
 | 
				
			||||||
    Upgrades: [Schema.Types.Mixed],
 | 
					    Upgrades: [Upgrade],
 | 
				
			||||||
    EquippedGear: [String],
 | 
					    EquippedGear: [String],
 | 
				
			||||||
    DeathMarks: [String],
 | 
					    DeathMarks: [String],
 | 
				
			||||||
    FusionTreasures: [Schema.Types.Mixed],
 | 
					    FusionTreasures: [Schema.Types.Mixed],
 | 
				
			||||||
@ -355,13 +383,13 @@ type InventoryDocumentProps = {
 | 
				
			|||||||
    LongGuns: Types.DocumentArray<IWeaponDatabase>;
 | 
					    LongGuns: Types.DocumentArray<IWeaponDatabase>;
 | 
				
			||||||
    Pistols: Types.DocumentArray<IWeaponDatabase>;
 | 
					    Pistols: Types.DocumentArray<IWeaponDatabase>;
 | 
				
			||||||
    Melee: Types.DocumentArray<IWeaponDatabase>;
 | 
					    Melee: Types.DocumentArray<IWeaponDatabase>;
 | 
				
			||||||
    FlavourItems: Types.DocumentArray<FlavourItem>;
 | 
					    FlavourItems: Types.DocumentArray<IFlavourItem>;
 | 
				
			||||||
    RawUpgrades: Types.DocumentArray<RawUpgrade>;
 | 
					    RawUpgrades: Types.DocumentArray<IRawUpgrade>;
 | 
				
			||||||
    MiscItems: Types.DocumentArray<MiscItem>;
 | 
					    MiscItems: Types.DocumentArray<IMiscItem>;
 | 
				
			||||||
    Boosters: Types.DocumentArray<Booster>;
 | 
					    Boosters: Types.DocumentArray<IBooster>;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type InventoryModelType = Model<IInventoryDatabase, {}, InventoryDocumentProps>;
 | 
					type InventoryModelType = Model<IInventoryDatabase, object, InventoryDocumentProps>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const Inventory = model<IInventoryDatabase, InventoryModelType>("Inventory", inventorySchema);
 | 
					const Inventory = model<IInventoryDatabase, InventoryModelType>("Inventory", inventorySchema);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
import { Schema, model } from "mongoose";
 | 
					import { Schema, model } from "mongoose";
 | 
				
			||||||
import { IShip } from "../types/shipTypes";
 | 
					import { IShip } from "../types/shipTypes";
 | 
				
			||||||
import { Oid } from "../types/commonTypes";
 | 
					import { IOid } from "../types/commonTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const roomSchema = new Schema(
 | 
					const roomSchema = new Schema(
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@ -19,7 +19,7 @@ const shipSchema = new Schema({
 | 
				
			|||||||
shipSchema.set("toJSON", {
 | 
					shipSchema.set("toJSON", {
 | 
				
			||||||
    transform(_document, returnedObject) {
 | 
					    transform(_document, returnedObject) {
 | 
				
			||||||
        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
 | 
				
			||||||
        returnedObject.ShipId = { $oid: returnedObject._id.toString() } satisfies Oid;
 | 
					        returnedObject.ShipId = { $oid: returnedObject._id.toString() } satisfies IOid;
 | 
				
			||||||
        delete returnedObject._id;
 | 
					        delete returnedObject._id;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
@ -30,6 +30,7 @@ import { viewController } from "@/src/controllers/api/viewController";
 | 
				
			|||||||
import { joinSessionController } from "@/src/controllers/api/joinSessionController";
 | 
					import { joinSessionController } from "@/src/controllers/api/joinSessionController";
 | 
				
			||||||
import { saveLoadoutController } from "@/src/controllers/api/saveLoadout";
 | 
					import { saveLoadoutController } from "@/src/controllers/api/saveLoadout";
 | 
				
			||||||
import { trainingResultController } from "@/src/controllers/api/trainingResultController";
 | 
					import { trainingResultController } from "@/src/controllers/api/trainingResultController";
 | 
				
			||||||
 | 
					import { artifactsController } from "../controllers/api/artifactsController";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import express from "express";
 | 
					import express from "express";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -59,6 +60,7 @@ apiRouter.get("/deleteSession.php", deleteSessionController);
 | 
				
			|||||||
apiRouter.get("/logout.php", logoutController);
 | 
					apiRouter.get("/logout.php", logoutController);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// post
 | 
					// post
 | 
				
			||||||
 | 
					apiRouter.post("/artifacts.php", artifactsController);
 | 
				
			||||||
apiRouter.post("/findSessions.php", findSessionsController);
 | 
					apiRouter.post("/findSessions.php", findSessionsController);
 | 
				
			||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
					// eslint-disable-next-line @typescript-eslint/no-misused-promises
 | 
				
			||||||
apiRouter.post("/purchase.php", purchaseController);
 | 
					apiRouter.post("/purchase.php", purchaseController);
 | 
				
			||||||
 | 
				
			|||||||
@ -2,16 +2,20 @@ import { Inventory } from "@/src/models/inventoryModel";
 | 
				
			|||||||
import new_inventory from "@/static/fixed_responses/postTutorialInventory.json";
 | 
					import new_inventory from "@/static/fixed_responses/postTutorialInventory.json";
 | 
				
			||||||
import config from "@/config.json";
 | 
					import config from "@/config.json";
 | 
				
			||||||
import { Types } from "mongoose";
 | 
					import { Types } from "mongoose";
 | 
				
			||||||
import { ISuitResponse } from "@/src/types/inventoryTypes/SuitTypes";
 | 
					import { ISuitDatabase, ISuitResponse } from "@/src/types/inventoryTypes/SuitTypes";
 | 
				
			||||||
import { SlotType } from "@/src/types/purchaseTypes";
 | 
					import { SlotType } from "@/src/types/purchaseTypes";
 | 
				
			||||||
import { IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes";
 | 
					import { IWeaponDatabase, IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes";
 | 
				
			||||||
import { ChallengeProgress, FlavourItem, IInventoryDatabaseDocument } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
    MissionInventoryUpdate,
 | 
					    IChallengeProgress,
 | 
				
			||||||
    MissionInventoryUpdateCard,
 | 
					    IConsumable,
 | 
				
			||||||
    MissionInventoryUpdateGear,
 | 
					    IFlavourItem,
 | 
				
			||||||
    MissionInventoryUpdateItem
 | 
					    IInventoryDatabaseDocument,
 | 
				
			||||||
} from "../types/missionInventoryUpdateType";
 | 
					    IMiscItem,
 | 
				
			||||||
 | 
					    IMission,
 | 
				
			||||||
 | 
					    IRawUpgrade
 | 
				
			||||||
 | 
					} from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
 | 
					import { IGenericUpdate } from "../types/genericUpdate";
 | 
				
			||||||
 | 
					import { IArtifactsRequest, IMissionInventoryUpdateRequest } from "../types/requestTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const createInventory = async (accountOwnerId: Types.ObjectId) => {
 | 
					const createInventory = async (accountOwnerId: Types.ObjectId) => {
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
@ -76,6 +80,27 @@ export const updateCurrency = async (price: number, usePremium: boolean, account
 | 
				
			|||||||
    return { [currencyName]: -price };
 | 
					    return { [currencyName]: -price };
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// TODO: AffiliationMods support (Nightwave).
 | 
				
			||||||
 | 
					export const updateGeneric = async (data: IGenericUpdate, accountId: string) => {
 | 
				
			||||||
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Make it an array for easier parsing.
 | 
				
			||||||
 | 
					    if (typeof data.NodeIntrosCompleted === "string") {
 | 
				
			||||||
 | 
					        data.NodeIntrosCompleted = [data.NodeIntrosCompleted];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Combine the two arrays into one.
 | 
				
			||||||
 | 
					    data.NodeIntrosCompleted = inventory.NodeIntrosCompleted.concat(data.NodeIntrosCompleted);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Remove duplicate entries.
 | 
				
			||||||
 | 
					    const nodes = [...new Set(data.NodeIntrosCompleted)];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    inventory.NodeIntrosCompleted = nodes;
 | 
				
			||||||
 | 
					    await inventory.save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return data;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export type WeaponTypeInternal = "LongGuns" | "Pistols" | "Melee";
 | 
					export type WeaponTypeInternal = "LongGuns" | "Pistols" | "Melee";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addWeapon = async (
 | 
					export const addWeapon = async (
 | 
				
			||||||
@ -104,7 +129,7 @@ export const addWeapon = async (
 | 
				
			|||||||
    return changedInventory[weaponType][weaponIndex - 1].toJSON();
 | 
					    return changedInventory[weaponType][weaponIndex - 1].toJSON();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addCustomization = async (customizatonName: string, accountId: string): Promise<FlavourItem> => {
 | 
					export const addCustomization = async (customizatonName: string, accountId: string): Promise<IFlavourItem> => {
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const flavourItemIndex = inventory.FlavourItems.push({ ItemType: customizatonName }) - 1;
 | 
					    const flavourItemIndex = inventory.FlavourItems.push({ ItemType: customizatonName }) - 1;
 | 
				
			||||||
@ -114,42 +139,82 @@ export const addCustomization = async (customizatonName: string, accountId: stri
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const addGearExpByCategory = (
 | 
					const addGearExpByCategory = (
 | 
				
			||||||
    inventory: IInventoryDatabaseDocument,
 | 
					    inventory: IInventoryDatabaseDocument,
 | 
				
			||||||
    gearArray: MissionInventoryUpdateGear[] | undefined,
 | 
					    gearArray: ISuitDatabase[] | IWeaponDatabase[] | undefined,
 | 
				
			||||||
    categoryName: "Pistols" | "LongGuns" | "Melee" | "Suits"
 | 
					    categoryName: "Pistols" | "LongGuns" | "Melee" | "Suits"
 | 
				
			||||||
) => {
 | 
					) => {
 | 
				
			||||||
    const category = inventory[categoryName];
 | 
					    const category = inventory[categoryName];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gearArray?.forEach(({ ItemId, XP }) => {
 | 
					    gearArray?.forEach(({ ItemId, XP }) => {
 | 
				
			||||||
        const itemIndex = category.findIndex(i => i._id?.equals(ItemId.$oid));
 | 
					        const itemIndex = ItemId ? category.findIndex(item => item._id?.equals(ItemId.$oid)) : -1;
 | 
				
			||||||
        const item = category[itemIndex];
 | 
					        const item = category[itemIndex];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (itemIndex !== -1 && item.XP != undefined) {
 | 
					        if (itemIndex !== -1 && item.XP != undefined) {
 | 
				
			||||||
            item.XP += XP;
 | 
					            item.XP += XP || 0;
 | 
				
			||||||
            inventory.markModified(`${categoryName}.${itemIndex}.XP`);
 | 
					            inventory.markModified(`${categoryName}.${itemIndex}.XP`);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const addItemsByCategory = (
 | 
					const addMiscItems = (inventory: IInventoryDatabaseDocument, itemsArray: IMiscItem[] | undefined) => {
 | 
				
			||||||
    inventory: IInventoryDatabaseDocument,
 | 
					    const { MiscItems } = inventory;
 | 
				
			||||||
    itemsArray: (MissionInventoryUpdateItem | MissionInventoryUpdateCard)[] | undefined,
 | 
					 | 
				
			||||||
    categoryName: "RawUpgrades" | "MiscItems"
 | 
					 | 
				
			||||||
) => {
 | 
					 | 
				
			||||||
    const category = inventory[categoryName];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
					    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
				
			||||||
        const itemIndex = category.findIndex(i => i.ItemType === ItemType);
 | 
					        const itemIndex = MiscItems.findIndex(miscItem => miscItem.ItemType === ItemType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (itemIndex !== -1) {
 | 
					        if (itemIndex !== -1) {
 | 
				
			||||||
            category[itemIndex].ItemCount += ItemCount;
 | 
					            MiscItems[itemIndex].ItemCount += ItemCount;
 | 
				
			||||||
            inventory.markModified(`${categoryName}.${itemIndex}.ItemCount`);
 | 
					            inventory.markModified(`MiscItems.${itemIndex}.ItemCount`);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            category.push({ ItemCount, ItemType });
 | 
					            MiscItems.push({ ItemCount, ItemType });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const addChallenges = (inventory: IInventoryDatabaseDocument, itemsArray: ChallengeProgress[] | undefined) => {
 | 
					const addConsumables = (inventory: IInventoryDatabaseDocument, itemsArray: IConsumable[] | undefined) => {
 | 
				
			||||||
 | 
					    const { Consumables } = inventory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
				
			||||||
 | 
					        const itemIndex = Consumables.findIndex(i => i.ItemType === ItemType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (itemIndex !== -1) {
 | 
				
			||||||
 | 
					            Consumables[itemIndex].ItemCount += ItemCount;
 | 
				
			||||||
 | 
					            inventory.markModified(`Consumables.${itemIndex}.ItemCount`);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            Consumables.push({ ItemCount, ItemType });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const addRecipes = (inventory: IInventoryDatabaseDocument, itemsArray: IConsumable[] | undefined) => {
 | 
				
			||||||
 | 
					    const { Recipes } = inventory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    itemsArray?.forEach(({ ItemCount, ItemType }) => {
 | 
				
			||||||
 | 
					        const itemIndex = Recipes.findIndex(i => i.ItemType === ItemType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (itemIndex !== -1) {
 | 
				
			||||||
 | 
					            Recipes[itemIndex].ItemCount += ItemCount;
 | 
				
			||||||
 | 
					            inventory.markModified(`Recipes.${itemIndex}.ItemCount`);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            Recipes.push({ ItemCount, ItemType });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const addMods = (inventory: IInventoryDatabaseDocument, itemsArray: IRawUpgrade[] | undefined) => {
 | 
				
			||||||
 | 
					    const { RawUpgrades } = inventory;
 | 
				
			||||||
 | 
					    itemsArray?.forEach(({ ItemType, ItemCount }) => {
 | 
				
			||||||
 | 
					        const itemIndex = RawUpgrades.findIndex(i => i.ItemType === ItemType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (itemIndex !== -1) {
 | 
				
			||||||
 | 
					            RawUpgrades[itemIndex].ItemCount += ItemCount;
 | 
				
			||||||
 | 
					            inventory.markModified(`RawUpgrades.${itemIndex}.ItemCount`);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            RawUpgrades.push({ ItemCount, ItemType });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const addChallenges = (inventory: IInventoryDatabaseDocument, itemsArray: IChallengeProgress[] | undefined) => {
 | 
				
			||||||
    const category = inventory.ChallengeProgress;
 | 
					    const category = inventory.ChallengeProgress;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    itemsArray?.forEach(({ Name, Progress }) => {
 | 
					    itemsArray?.forEach(({ Name, Progress }) => {
 | 
				
			||||||
@ -164,35 +229,54 @@ const addChallenges = (inventory: IInventoryDatabaseDocument, itemsArray: Challe
 | 
				
			|||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const addMissionComplete = (inventory: IInventoryDatabaseDocument, { Tag, Completes }: IMission) => {
 | 
				
			||||||
 | 
					    const { Missions } = inventory;
 | 
				
			||||||
 | 
					    const itemIndex = Missions.findIndex(item => item.Tag === Tag);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (itemIndex !== -1) {
 | 
				
			||||||
 | 
					        Missions[itemIndex].Completes += Completes;
 | 
				
			||||||
 | 
					        inventory.markModified(`Missions.${itemIndex}.Completes`);
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        Missions.push({ Tag, Completes });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const gearKeys = ["Suits", "Pistols", "LongGuns", "Melee"] as const;
 | 
					const gearKeys = ["Suits", "Pistols", "LongGuns", "Melee"] as const;
 | 
				
			||||||
type GearKeysType = (typeof gearKeys)[number];
 | 
					type GearKeysType = (typeof gearKeys)[number];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const missionInventoryUpdate = async (data: MissionInventoryUpdate, accountId: string): Promise<void> => {
 | 
					export const missionInventoryUpdate = async (data: IMissionInventoryUpdateRequest, accountId: string) => {
 | 
				
			||||||
    const { RawUpgrades, MiscItems, RegularCredits, ChallengeProgress } = data;
 | 
					    const { RawUpgrades, MiscItems, RegularCredits, ChallengeProgress, FusionPoints, Consumables, Recipes, Missions } =
 | 
				
			||||||
 | 
					        data;
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // TODO - multipliers logic
 | 
					 | 
				
			||||||
    // credits
 | 
					    // credits
 | 
				
			||||||
    inventory.RegularCredits += RegularCredits || 0;
 | 
					    inventory.RegularCredits += RegularCredits || 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // gear exp
 | 
					    // endo
 | 
				
			||||||
 | 
					    inventory.FusionPoints += FusionPoints || 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Gear XP
 | 
				
			||||||
    gearKeys.forEach((key: GearKeysType) => addGearExpByCategory(inventory, data[key], key));
 | 
					    gearKeys.forEach((key: GearKeysType) => addGearExpByCategory(inventory, data[key], key));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // other
 | 
					    // other
 | 
				
			||||||
    addItemsByCategory(inventory, RawUpgrades, "RawUpgrades"); // TODO - check mods fusion level
 | 
					    addMods(inventory, RawUpgrades);
 | 
				
			||||||
    addItemsByCategory(inventory, MiscItems, "MiscItems");
 | 
					    addMiscItems(inventory, MiscItems);
 | 
				
			||||||
 | 
					    addConsumables(inventory, Consumables);
 | 
				
			||||||
 | 
					    addRecipes(inventory, Recipes);
 | 
				
			||||||
    addChallenges(inventory, ChallengeProgress);
 | 
					    addChallenges(inventory, ChallengeProgress);
 | 
				
			||||||
 | 
					    addMissionComplete(inventory, Missions!);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await inventory.save();
 | 
					    const changedInventory = await inventory.save();
 | 
				
			||||||
 | 
					    return changedInventory.toJSON();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const addBooster = async (ItemType: string, time: number, accountId: string): Promise<void> => {
 | 
					export const addBooster = async (ItemType: string, time: number, accountId: string): Promise<void> => {
 | 
				
			||||||
    const currentTime = Math.floor(Date.now() / 1000) - 129600; // booster time getting more without 129600, probably defence logic, idk
 | 
					    const currentTime = Math.floor(Date.now() / 1000) - 129600; // Value is wrong without 129600. Figure out why, please. :)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const inventory = await getInventory(accountId);
 | 
					    const inventory = await getInventory(accountId);
 | 
				
			||||||
    const { Boosters } = inventory;
 | 
					    const { Boosters } = inventory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const itemIndex = Boosters.findIndex(i => i.ItemType === ItemType);
 | 
					    const itemIndex = Boosters.findIndex(booster => booster.ItemType === ItemType);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (itemIndex !== -1) {
 | 
					    if (itemIndex !== -1) {
 | 
				
			||||||
        const existingBooster = Boosters[itemIndex];
 | 
					        const existingBooster = Boosters[itemIndex];
 | 
				
			||||||
@ -205,4 +289,55 @@ export const addBooster = async (ItemType: string, time: number, accountId: stri
 | 
				
			|||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const upgradeMod = async (artifactsData: IArtifactsRequest, accountId: string): Promise<string | undefined> => {
 | 
				
			||||||
 | 
					    const { Upgrade, LevelDiff, Cost, FusionPointCost } = artifactsData;
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					        const inventory = await getInventory(accountId);
 | 
				
			||||||
 | 
					        const { Upgrades, RawUpgrades } = inventory;
 | 
				
			||||||
 | 
					        const { ItemType, UpgradeFingerprint, ItemId } = Upgrade;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const safeUpgradeFingerprint = UpgradeFingerprint || '{"lvl":0}';
 | 
				
			||||||
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
 | 
				
			||||||
 | 
					        const parsedUpgradeFingerprint = JSON.parse(safeUpgradeFingerprint);
 | 
				
			||||||
 | 
					        parsedUpgradeFingerprint.lvl += LevelDiff;
 | 
				
			||||||
 | 
					        const stringifiedUpgradeFingerprint = JSON.stringify(parsedUpgradeFingerprint);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        let itemIndex = Upgrades.findIndex(upgrade => upgrade._id?.equals(ItemId!.$oid));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (itemIndex !== -1) {
 | 
				
			||||||
 | 
					            Upgrades[itemIndex].UpgradeFingerprint = stringifiedUpgradeFingerprint;
 | 
				
			||||||
 | 
					            inventory.markModified(`Upgrades.${itemIndex}.UpgradeFingerprint`);
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            itemIndex =
 | 
				
			||||||
 | 
					                Upgrades.push({
 | 
				
			||||||
 | 
					                    UpgradeFingerprint: stringifiedUpgradeFingerprint,
 | 
				
			||||||
 | 
					                    ItemType
 | 
				
			||||||
 | 
					                }) - 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            const rawItemIndex = RawUpgrades.findIndex(rawUpgrade => rawUpgrade.ItemType === ItemType);
 | 
				
			||||||
 | 
					            RawUpgrades[rawItemIndex].ItemCount--;
 | 
				
			||||||
 | 
					            if (RawUpgrades[rawItemIndex].ItemCount > 0) {
 | 
				
			||||||
 | 
					                inventory.markModified(`RawUpgrades.${rawItemIndex}.UpgradeFingerprint`);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                RawUpgrades.splice(rawItemIndex, 1);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        inventory.RegularCredits -= Cost;
 | 
				
			||||||
 | 
					        inventory.FusionPoints -= FusionPointCost;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const changedInventory = await inventory.save();
 | 
				
			||||||
 | 
					        const itemId = changedInventory.toJSON().Upgrades[itemIndex]?.ItemId?.$oid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (!itemId) {
 | 
				
			||||||
 | 
					            throw new Error("Item Id not found in upgradeMod");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return itemId;
 | 
				
			||||||
 | 
					    } catch (error) {
 | 
				
			||||||
 | 
					        console.error("Error in upgradeMod:", error);
 | 
				
			||||||
 | 
					        throw error;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export { createInventory, addPowerSuit };
 | 
					export { createInventory, addPowerSuit };
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										245
									
								
								src/services/missionInventoryUpdateService .ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										245
									
								
								src/services/missionInventoryUpdateService .ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,245 @@
 | 
				
			|||||||
 | 
					import { IMissionRewardResponse, IReward, IInventoryFieldType, inventoryFields } from "@/src/types/missionTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import missionsDropTable from "@/static/json/missions-drop-table.json";
 | 
				
			||||||
 | 
					import { modNames, relicNames, miscNames, resourceNames, gearNames, blueprintNames } from "@/static/data/items";
 | 
				
			||||||
 | 
					import { IMissionInventoryUpdateRequest } from "../types/requestTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// need reverse engineer rewardSeed, otherwise ingame displayed rotation reward will be different than added to db or displayed on mission end
 | 
				
			||||||
 | 
					const getRewards = ({
 | 
				
			||||||
 | 
					    RewardInfo
 | 
				
			||||||
 | 
					}: IMissionInventoryUpdateRequest): {
 | 
				
			||||||
 | 
					    InventoryChanges: IMissionInventoryUpdateRequest;
 | 
				
			||||||
 | 
					    MissionRewards: IMissionRewardResponse[];
 | 
				
			||||||
 | 
					} => {
 | 
				
			||||||
 | 
					    if (!RewardInfo) {
 | 
				
			||||||
 | 
					        return { InventoryChanges: {}, MissionRewards: [] };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const rewards = (missionsDropTable as { [key: string]: IReward[] })[RewardInfo.node];
 | 
				
			||||||
 | 
					    if (!rewards) {
 | 
				
			||||||
 | 
					        return { InventoryChanges: {}, MissionRewards: [] };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const rotationCount = RewardInfo.rewardQualifications?.length || 0;
 | 
				
			||||||
 | 
					    const rotations = getRotations(rotationCount);
 | 
				
			||||||
 | 
					    const drops: IReward[] = [];
 | 
				
			||||||
 | 
					    for (const rotation of rotations) {
 | 
				
			||||||
 | 
					        const rotationRewards = rewards.filter(reward => reward.rotation === rotation);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Separate guaranteed and chance drops
 | 
				
			||||||
 | 
					        const guaranteedDrops: IReward[] = [];
 | 
				
			||||||
 | 
					        const chanceDrops: IReward[] = [];
 | 
				
			||||||
 | 
					        for (const reward of rotationRewards) {
 | 
				
			||||||
 | 
					            if (reward.chance === 100) {
 | 
				
			||||||
 | 
					                guaranteedDrops.push(reward);
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                chanceDrops.push(reward);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const randomDrop = getRandomRewardByChance(chanceDrops);
 | 
				
			||||||
 | 
					        if (randomDrop) {
 | 
				
			||||||
 | 
					            guaranteedDrops.push(randomDrop);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        drops.push(...guaranteedDrops);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // const testDrops = [
 | 
				
			||||||
 | 
					    //     { chance: 7.69, name: "Lith W3 Relic", rotation: "B" },
 | 
				
			||||||
 | 
					    //     { chance: 7.69, name: "Lith W3 Relic", rotation: "B" },
 | 
				
			||||||
 | 
					    //     { chance: 10.82, name: "2X Orokin Cell", rotation: "C" },
 | 
				
			||||||
 | 
					    //     { chance: 10.82, name: "Arrow Mutation", rotation: "C" },
 | 
				
			||||||
 | 
					    //     { chance: 10.82, name: "200 Endo", rotation: "C" },
 | 
				
			||||||
 | 
					    //     { chance: 10.82, name: "200 Endo", rotation: "C" },
 | 
				
			||||||
 | 
					    //     { chance: 10.82, name: "2,000,000 Credits Cache", rotation: "C" },
 | 
				
			||||||
 | 
					    //     { chance: 7.69, name: "Health Restore (Large)", rotation: "C" },
 | 
				
			||||||
 | 
					    //     { chance: 7.69, name: "Vapor Specter Blueprint", rotation: "C" }
 | 
				
			||||||
 | 
					    // ];
 | 
				
			||||||
 | 
					    // console.log("Mission rewards:", testDrops);
 | 
				
			||||||
 | 
					    // return formatRewardsToInventoryType(testDrops);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    console.log("Mission rewards:", drops);
 | 
				
			||||||
 | 
					    return formatRewardsToInventoryType(drops);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const combineRewardAndLootInventory = (
 | 
				
			||||||
 | 
					    rewardInventory: IMissionInventoryUpdateRequest,
 | 
				
			||||||
 | 
					    lootInventory: IMissionInventoryUpdateRequest
 | 
				
			||||||
 | 
					) => {
 | 
				
			||||||
 | 
					    const missionCredits = lootInventory.RegularCredits || 0;
 | 
				
			||||||
 | 
					    const creditsBonus = rewardInventory.RegularCredits || 0;
 | 
				
			||||||
 | 
					    const totalCredits = missionCredits + creditsBonus;
 | 
				
			||||||
 | 
					    const FusionPoints = (lootInventory.FusionPoints || 0) + (rewardInventory.FusionPoints || 0) || undefined;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    lootInventory.RegularCredits = totalCredits;
 | 
				
			||||||
 | 
					    if (FusionPoints) {
 | 
				
			||||||
 | 
					        lootInventory.FusionPoints = FusionPoints;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    inventoryFields.forEach((field: IInventoryFieldType) => {
 | 
				
			||||||
 | 
					        if (rewardInventory[field] && !lootInventory[field]) {
 | 
				
			||||||
 | 
					            lootInventory[field] = [];
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        rewardInventory[field]?.forEach(item => lootInventory[field]!.push(item));
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return {
 | 
				
			||||||
 | 
					        combinedInventoryChanges: lootInventory,
 | 
				
			||||||
 | 
					        TotalCredits: [totalCredits, totalCredits],
 | 
				
			||||||
 | 
					        CreditsBonus: [creditsBonus, creditsBonus],
 | 
				
			||||||
 | 
					        MissionCredits: [missionCredits, missionCredits],
 | 
				
			||||||
 | 
					        ...(FusionPoints !== undefined && { FusionPoints })
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const getRotations = (rotationCount: number): (string | undefined)[] => {
 | 
				
			||||||
 | 
					    if (rotationCount === 0) return [undefined];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const rotationPattern = ["A", "A", "B", "C"];
 | 
				
			||||||
 | 
					    const rotatedValues = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (let i = 0; i < rotationCount; i++) {
 | 
				
			||||||
 | 
					        rotatedValues.push(rotationPattern[i % rotationPattern.length]);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return rotatedValues;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const getRandomRewardByChance = (data: IReward[] | undefined): IReward | undefined => {
 | 
				
			||||||
 | 
					    if (!data || data.length == 0) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const totalChance = data.reduce((sum, item) => sum + item.chance, 0);
 | 
				
			||||||
 | 
					    const randomValue = Math.random() * totalChance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let cumulativeChance = 0;
 | 
				
			||||||
 | 
					    for (const item of data) {
 | 
				
			||||||
 | 
					        cumulativeChance += item.chance;
 | 
				
			||||||
 | 
					        if (randomValue <= cumulativeChance) {
 | 
				
			||||||
 | 
					            return item;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const formatRewardsToInventoryType = (
 | 
				
			||||||
 | 
					    rewards: IReward[]
 | 
				
			||||||
 | 
					): { InventoryChanges: IMissionInventoryUpdateRequest; MissionRewards: IMissionRewardResponse[] } => {
 | 
				
			||||||
 | 
					    const InventoryChanges: IMissionInventoryUpdateRequest = {};
 | 
				
			||||||
 | 
					    const MissionRewards: IMissionRewardResponse[] = [];
 | 
				
			||||||
 | 
					    for (const reward of rewards) {
 | 
				
			||||||
 | 
					        if (itemCheck(InventoryChanges, MissionRewards, reward.name)) {
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (reward.name.includes(" Endo")) {
 | 
				
			||||||
 | 
					            if (!InventoryChanges.FusionPoints) {
 | 
				
			||||||
 | 
					                InventoryChanges.FusionPoints = 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            InventoryChanges.FusionPoints += getCountFromName(reward.name);
 | 
				
			||||||
 | 
					        } else if (reward.name.includes(" Credits Cache") || reward.name.includes("Return: ")) {
 | 
				
			||||||
 | 
					            if (!InventoryChanges.RegularCredits) {
 | 
				
			||||||
 | 
					                InventoryChanges.RegularCredits = 0;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            InventoryChanges.RegularCredits += getCountFromName(reward.name);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return { InventoryChanges, MissionRewards };
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const itemCheck = (
 | 
				
			||||||
 | 
					    InventoryChanges: IMissionInventoryUpdateRequest,
 | 
				
			||||||
 | 
					    MissionRewards: IMissionRewardResponse[],
 | 
				
			||||||
 | 
					    name: string
 | 
				
			||||||
 | 
					) => {
 | 
				
			||||||
 | 
					    const rewardCheck = {
 | 
				
			||||||
 | 
					        RawUpgrades: modNames[name],
 | 
				
			||||||
 | 
					        Consumables: gearNames[name],
 | 
				
			||||||
 | 
					        MiscItems:
 | 
				
			||||||
 | 
					            miscNames[name] ||
 | 
				
			||||||
 | 
					            miscNames[name.replace(/\d+X\s*/, "")] ||
 | 
				
			||||||
 | 
					            resourceNames[name] ||
 | 
				
			||||||
 | 
					            resourceNames[name.replace(/\d+X\s*/, "")] ||
 | 
				
			||||||
 | 
					            relicNames[name.replace("Relic", "Intact")] ||
 | 
				
			||||||
 | 
					            relicNames[name.replace("Relic (Radiant)", "Radiant")],
 | 
				
			||||||
 | 
					        Recipes: blueprintNames[name]
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					    for (const key of Object.keys(rewardCheck) as IInventoryFieldType[]) {
 | 
				
			||||||
 | 
					        if (rewardCheck[key]) {
 | 
				
			||||||
 | 
					            addRewardResponse(InventoryChanges, MissionRewards, name, rewardCheck[key]!, key);
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const getCountFromName = (name: string) => {
 | 
				
			||||||
 | 
					    const regex = /(^(?:\d{1,3}(?:,\d{3})*(?:\.\d+)?)(\s|X))|(\s(?:\d{1,3}(?:,\d{3})*(?:\.\d+)?)$)/;
 | 
				
			||||||
 | 
					    const countMatches = name.match(regex);
 | 
				
			||||||
 | 
					    return countMatches ? parseInt(countMatches[0].replace(/,/g, ""), 10) : 1;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const addRewardResponse = (
 | 
				
			||||||
 | 
					    InventoryChanges: IMissionInventoryUpdateRequest,
 | 
				
			||||||
 | 
					    MissionRewards: IMissionRewardResponse[],
 | 
				
			||||||
 | 
					    ItemName: string,
 | 
				
			||||||
 | 
					    ItemType: string,
 | 
				
			||||||
 | 
					    InventoryCategory: IInventoryFieldType
 | 
				
			||||||
 | 
					) => {
 | 
				
			||||||
 | 
					    if (!ItemType) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!InventoryChanges[InventoryCategory]) {
 | 
				
			||||||
 | 
					        InventoryChanges[InventoryCategory] = [];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const ItemCount = getCountFromName(ItemName);
 | 
				
			||||||
 | 
					    const TweetText = `${ItemName}`;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const existReward = InventoryChanges[InventoryCategory]!.find(item => item.ItemType === ItemType);
 | 
				
			||||||
 | 
					    if (existReward) {
 | 
				
			||||||
 | 
					        existReward.ItemCount += ItemCount;
 | 
				
			||||||
 | 
					        const missionReward = MissionRewards.find(missionReward => missionReward.TypeName === ItemType);
 | 
				
			||||||
 | 
					        if (missionReward) {
 | 
				
			||||||
 | 
					            missionReward.ItemCount += ItemCount;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        InventoryChanges[InventoryCategory]!.push({ ItemType, ItemCount });
 | 
				
			||||||
 | 
					        MissionRewards.push({
 | 
				
			||||||
 | 
					            ItemCount,
 | 
				
			||||||
 | 
					            TweetText,
 | 
				
			||||||
 | 
					            ProductCategory: InventoryCategory,
 | 
				
			||||||
 | 
					            StoreItem: ItemType.replace("/Lotus/", "/Lotus/StoreItems/"),
 | 
				
			||||||
 | 
					            TypeName: ItemType
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// eslint-disable-next-line @typescript-eslint/no-unused-vars
 | 
				
			||||||
 | 
					const _missionRewardsCheckAllNamings = () => {
 | 
				
			||||||
 | 
					    let tempRewards: IReward[] = [];
 | 
				
			||||||
 | 
					    Object.values(missionsDropTable as { [key: string]: IReward[] }).forEach(rewards => {
 | 
				
			||||||
 | 
					        rewards.forEach(reward => {
 | 
				
			||||||
 | 
					            tempRewards.push(reward);
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    tempRewards = tempRewards
 | 
				
			||||||
 | 
					        .filter(reward => !modNames[reward.name])
 | 
				
			||||||
 | 
					        .filter(reward => !miscNames[reward.name])
 | 
				
			||||||
 | 
					        .filter(reward => !miscNames[reward.name.replace(/\d+X\s*/, "")])
 | 
				
			||||||
 | 
					        .filter(reward => !resourceNames[reward.name])
 | 
				
			||||||
 | 
					        .filter(reward => !resourceNames[reward.name.replace(/\d+X\s*/, "")])
 | 
				
			||||||
 | 
					        .filter(reward => !gearNames[reward.name])
 | 
				
			||||||
 | 
					        .filter(reward => {
 | 
				
			||||||
 | 
					            return (
 | 
				
			||||||
 | 
					                !relicNames[reward.name.replace("Relic", "Intact")] &&
 | 
				
			||||||
 | 
					                !relicNames[reward.name.replace("Relic (Radiant)", "Radiant")]
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					        .filter(reward => !blueprintNames[reward.name])
 | 
				
			||||||
 | 
					        .filter(reward => !reward.name.includes(" Endo"))
 | 
				
			||||||
 | 
					        .filter(reward => !reward.name.includes(" Credits Cache") && !reward.name.includes("Return: "));
 | 
				
			||||||
 | 
					    console.log(tempRewards);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					// _missionRewardsCheckAllNamings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export { getRewards, combineRewardAndLootInventory };
 | 
				
			||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
export interface Oid {
 | 
					export interface IOid {
 | 
				
			||||||
    $oid: string;
 | 
					    $oid: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								src/types/genericUpdate.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/types/genericUpdate.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					export interface IGenericUpdate {
 | 
				
			||||||
 | 
					    NodeIntrosCompleted: string | string[];
 | 
				
			||||||
 | 
					    // AffiliationMods: any[];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
import { Oid } from "@/src/types/commonTypes";
 | 
					import { IOid } from "@/src/types/commonTypes";
 | 
				
			||||||
import { AbilityOverride, Color, Polarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
					import { IAbilityOverride, IColor, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
				
			||||||
import { Document, Types } from "mongoose";
 | 
					import { Document, Types } from "mongoose";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// export interface ISuitDocument extends ISuitResponse, Document {}
 | 
					// export interface ISuitDocument extends ISuitResponse, Document {}
 | 
				
			||||||
@ -8,7 +8,7 @@ export interface ISuitDocument extends Document, ISuitResponse {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface ISuitResponse extends ISuitDatabase {
 | 
					export interface ISuitResponse extends ISuitDatabase {
 | 
				
			||||||
    ItemId: Oid;
 | 
					    ItemId: IOid;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface ISuitDatabase {
 | 
					export interface ISuitDatabase {
 | 
				
			||||||
@ -18,24 +18,25 @@ export interface ISuitDatabase {
 | 
				
			|||||||
    XP?: number;
 | 
					    XP?: number;
 | 
				
			||||||
    InfestationDate?: Date;
 | 
					    InfestationDate?: Date;
 | 
				
			||||||
    Features?: number;
 | 
					    Features?: number;
 | 
				
			||||||
    Polarity?: Polarity[];
 | 
					    Polarity?: IPolarity[];
 | 
				
			||||||
    Polarized?: number;
 | 
					    Polarized?: number;
 | 
				
			||||||
    ModSlotPurchases?: number;
 | 
					    ModSlotPurchases?: number;
 | 
				
			||||||
    FocusLens?: string;
 | 
					    FocusLens?: string;
 | 
				
			||||||
    UnlockLevel?: number;
 | 
					    UnlockLevel?: number;
 | 
				
			||||||
    _id: Types.ObjectId;
 | 
					    _id: Types.ObjectId;
 | 
				
			||||||
 | 
					    ItemId?: IOid;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface SuitConfig {
 | 
					export interface SuitConfig {
 | 
				
			||||||
    Skins?: string[];
 | 
					    Skins?: string[];
 | 
				
			||||||
    pricol?: Color;
 | 
					    pricol?: IColor;
 | 
				
			||||||
    attcol?: Color;
 | 
					    attcol?: IColor;
 | 
				
			||||||
    eyecol?: Color;
 | 
					    eyecol?: IColor;
 | 
				
			||||||
    sigcol?: Color;
 | 
					    sigcol?: IColor;
 | 
				
			||||||
    Upgrades?: string[];
 | 
					    Upgrades?: string[];
 | 
				
			||||||
    Songs?: Song[];
 | 
					    Songs?: Song[];
 | 
				
			||||||
    Name?: string;
 | 
					    Name?: string;
 | 
				
			||||||
    AbilityOverride?: AbilityOverride;
 | 
					    AbilityOverride?: IAbilityOverride;
 | 
				
			||||||
    PvpUpgrades?: string[];
 | 
					    PvpUpgrades?: string[];
 | 
				
			||||||
    ugly?: boolean;
 | 
					    ugly?: boolean;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
export interface Polarity {
 | 
					export interface IPolarity {
 | 
				
			||||||
    Slot: number;
 | 
					    Slot: number;
 | 
				
			||||||
    Value: FocusSchool;
 | 
					    Value: FocusSchool;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -15,7 +15,7 @@ export enum FocusSchool {
 | 
				
			|||||||
    ApWard = "AP_WARD"
 | 
					    ApWard = "AP_WARD"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface Color {
 | 
					export interface IColor {
 | 
				
			||||||
    t0?: number;
 | 
					    t0?: number;
 | 
				
			||||||
    t1?: number;
 | 
					    t1?: number;
 | 
				
			||||||
    t2?: number;
 | 
					    t2?: number;
 | 
				
			||||||
@ -26,16 +26,17 @@ export interface Color {
 | 
				
			|||||||
    m1?: number;
 | 
					    m1?: number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface AbilityOverride {
 | 
					export interface IAbilityOverride {
 | 
				
			||||||
    Ability: string;
 | 
					    Ability: string;
 | 
				
			||||||
    Index: number;
 | 
					    Index: number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface SlotsBin {
 | 
					export interface ISlotsBin {
 | 
				
			||||||
    Slots: number;
 | 
					    Slots: number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface sigcol {
 | 
					// ISigCol? IsIgCoL? ISIGCOL!
 | 
				
			||||||
 | 
					export interface Isigcol {
 | 
				
			||||||
    t0: number;
 | 
					    t0: number;
 | 
				
			||||||
    t1: number;
 | 
					    t1: number;
 | 
				
			||||||
    en: number;
 | 
					    en: number;
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1,9 +1,9 @@
 | 
				
			|||||||
import { Oid } from "@/src/types/commonTypes";
 | 
					import { IOid } from "@/src/types/commonTypes";
 | 
				
			||||||
import { Color, Polarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
					import { IColor, IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
				
			||||||
import { Types } from "mongoose";
 | 
					import { Types } from "mongoose";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IWeaponResponse extends IWeaponDatabase {
 | 
					export interface IWeaponResponse extends IWeaponDatabase {
 | 
				
			||||||
    ItemId: Oid;
 | 
					    ItemId: IOid;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IWeaponDatabase {
 | 
					export interface IWeaponDatabase {
 | 
				
			||||||
@ -13,7 +13,7 @@ export interface IWeaponDatabase {
 | 
				
			|||||||
    XP?: number;
 | 
					    XP?: number;
 | 
				
			||||||
    Features?: number;
 | 
					    Features?: number;
 | 
				
			||||||
    Polarized?: number;
 | 
					    Polarized?: number;
 | 
				
			||||||
    Polarity?: Polarity[];
 | 
					    Polarity?: IPolarity[];
 | 
				
			||||||
    FocusLens?: string;
 | 
					    FocusLens?: string;
 | 
				
			||||||
    ModSlotPurchases?: number;
 | 
					    ModSlotPurchases?: number;
 | 
				
			||||||
    UpgradeType?: string;
 | 
					    UpgradeType?: string;
 | 
				
			||||||
@ -22,19 +22,20 @@ export interface IWeaponDatabase {
 | 
				
			|||||||
    ModularParts?: string[];
 | 
					    ModularParts?: string[];
 | 
				
			||||||
    UnlockLevel?: number;
 | 
					    UnlockLevel?: number;
 | 
				
			||||||
    _id?: Types.ObjectId;
 | 
					    _id?: Types.ObjectId;
 | 
				
			||||||
 | 
					    ItemId?: IOid;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface WeaponConfig {
 | 
					export interface WeaponConfig {
 | 
				
			||||||
    Skins?: string[];
 | 
					    Skins?: string[];
 | 
				
			||||||
    pricol?: Color;
 | 
					    pricol?: IColor;
 | 
				
			||||||
    Upgrades?: string[];
 | 
					    Upgrades?: string[];
 | 
				
			||||||
    attcol?: Color;
 | 
					    attcol?: IColor;
 | 
				
			||||||
    eyecol?: OperatorLoadOutSigcol;
 | 
					    eyecol?: IOperatorLoadOutSigcol;
 | 
				
			||||||
    Name?: string;
 | 
					    Name?: string;
 | 
				
			||||||
    PvpUpgrades?: string[];
 | 
					    PvpUpgrades?: string[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface OperatorLoadOutSigcol {
 | 
					export interface IOperatorLoadOutSigcol {
 | 
				
			||||||
    t0?: number;
 | 
					    t0?: number;
 | 
				
			||||||
    t1?: number;
 | 
					    t1?: number;
 | 
				
			||||||
    en?: number;
 | 
					    en?: number;
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ export interface ILoginResponse extends Omit<IDatabaseAccountDocument, "email" |
 | 
				
			|||||||
    HUB: string;
 | 
					    HUB: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//includes virtual id
 | 
					// Includes virtual ID
 | 
				
			||||||
export interface IDatabaseAccountDocument extends IDatabaseAccount {
 | 
					export interface IDatabaseAccountDocument extends IDatabaseAccount {
 | 
				
			||||||
    id: string;
 | 
					    id: string;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,64 +0,0 @@
 | 
				
			|||||||
interface MongooseId{
 | 
					 | 
				
			||||||
    $oid: string;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
interface ExpireDate{
 | 
					 | 
				
			||||||
    $date: {
 | 
					 | 
				
			||||||
        $numberLong: string;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface MissionInventoryUpdateGear{
 | 
					 | 
				
			||||||
    ItemType: string;
 | 
					 | 
				
			||||||
    ItemName: string;
 | 
					 | 
				
			||||||
    ItemId: MongooseId;
 | 
					 | 
				
			||||||
    XP: number;
 | 
					 | 
				
			||||||
    UpgradeVer: number;
 | 
					 | 
				
			||||||
    Features: number;
 | 
					 | 
				
			||||||
    Polarized: number;
 | 
					 | 
				
			||||||
    CustomizationSlotPurchases: number;
 | 
					 | 
				
			||||||
    ModSlotPurchases: number;
 | 
					 | 
				
			||||||
    FocusLens: string;
 | 
					 | 
				
			||||||
    Expiry: ExpireDate;
 | 
					 | 
				
			||||||
    Polarity: any[];
 | 
					 | 
				
			||||||
    Configs: any[];
 | 
					 | 
				
			||||||
    ModularParts: any[];
 | 
					 | 
				
			||||||
    SkillTree: string;
 | 
					 | 
				
			||||||
    UpgradeType: string;
 | 
					 | 
				
			||||||
    UpgradeFingerprint: string;
 | 
					 | 
				
			||||||
    OffensiveUpgrade: string;
 | 
					 | 
				
			||||||
    DefensiveUpgrade: string;
 | 
					 | 
				
			||||||
    UpgradesExpiry: ExpireDate;
 | 
					 | 
				
			||||||
    ArchonCrystalUpgrades: any[];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface MissionInventoryUpdateItem{
 | 
					 | 
				
			||||||
    ItemCount: number;
 | 
					 | 
				
			||||||
    ItemType: string;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface MissionInventoryUpdateCard extends MissionInventoryUpdateItem{
 | 
					 | 
				
			||||||
    ItemId: MongooseId;
 | 
					 | 
				
			||||||
    UpgradeFingerprint: string;
 | 
					 | 
				
			||||||
    PendingRerollFingerprint: string;
 | 
					 | 
				
			||||||
    LastAdded: MongooseId;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
interface MissionInventoryUpdateChallange{
 | 
					 | 
				
			||||||
    Name: string;
 | 
					 | 
				
			||||||
    Progress: number;
 | 
					 | 
				
			||||||
    Completed: any[];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export interface MissionInventoryUpdate{
 | 
					 | 
				
			||||||
    rewardsMultiplier?: number;
 | 
					 | 
				
			||||||
    ActiveBoosters?: any[];
 | 
					 | 
				
			||||||
    LongGuns?: MissionInventoryUpdateGear[];
 | 
					 | 
				
			||||||
    Pistols?: MissionInventoryUpdateGear[];
 | 
					 | 
				
			||||||
    Suits?: MissionInventoryUpdateGear[];
 | 
					 | 
				
			||||||
    Melee?: MissionInventoryUpdateGear[];
 | 
					 | 
				
			||||||
    RawUpgrades?: MissionInventoryUpdateCard[];
 | 
					 | 
				
			||||||
    MiscItems?: MissionInventoryUpdateItem[];
 | 
					 | 
				
			||||||
    RegularCredits?: number;
 | 
					 | 
				
			||||||
    ChallengeProgress?: MissionInventoryUpdateChallange[];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										17
									
								
								src/types/missionTypes.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/types/missionTypes.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					export const inventoryFields = ["RawUpgrades", "MiscItems", "Consumables", "Recipes"] as const;
 | 
				
			||||||
 | 
					export type IInventoryFieldType = (typeof inventoryFields)[number];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IMissionRewardResponse {
 | 
				
			||||||
 | 
					    StoreItem?: string;
 | 
				
			||||||
 | 
					    TypeName: string;
 | 
				
			||||||
 | 
					    UpgradeLevel?: number;
 | 
				
			||||||
 | 
					    ItemCount: number;
 | 
				
			||||||
 | 
					    TweetText: string;
 | 
				
			||||||
 | 
					    ProductCategory: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export interface IReward {
 | 
				
			||||||
 | 
					    name: string;
 | 
				
			||||||
 | 
					    chance: number;
 | 
				
			||||||
 | 
					    rotation?: string;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -1,6 +1,5 @@
 | 
				
			|||||||
/* eslint-disable prettier/prettier */
 | 
					 | 
				
			||||||
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
 | 
					import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
 | 
				
			||||||
import { FlavourItem } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					import { IFlavourItem } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes";
 | 
					import { IWeaponResponse } from "@/src/types/inventoryTypes/weaponTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IPurchaseRequest {
 | 
					export interface IPurchaseRequest {
 | 
				
			||||||
@ -29,7 +28,7 @@ export interface IPurchaseResponse {
 | 
				
			|||||||
        Melee?: IWeaponResponse[];
 | 
					        Melee?: IWeaponResponse[];
 | 
				
			||||||
        PremiumCredits?: number;
 | 
					        PremiumCredits?: number;
 | 
				
			||||||
        RegularCredits?: number;
 | 
					        RegularCredits?: number;
 | 
				
			||||||
        FlavourItems?: FlavourItem[];
 | 
					        FlavourItems?: IFlavourItem[];
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										53
									
								
								src/types/requestTypes.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								src/types/requestTypes.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,53 @@
 | 
				
			|||||||
 | 
					import {
 | 
				
			||||||
 | 
					    IBooster,
 | 
				
			||||||
 | 
					    IChallengeProgress,
 | 
				
			||||||
 | 
					    IConsumable,
 | 
				
			||||||
 | 
					    ICrewShipSalvagedWeaponSkin,
 | 
				
			||||||
 | 
					    IMiscItem,
 | 
				
			||||||
 | 
					    IMission,
 | 
				
			||||||
 | 
					    IRawUpgrade
 | 
				
			||||||
 | 
					} from "./inventoryTypes/inventoryTypes";
 | 
				
			||||||
 | 
					import { IWeaponDatabase } from "./inventoryTypes/weaponTypes";
 | 
				
			||||||
 | 
					import { ISuitDatabase } from "./inventoryTypes/SuitTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					interface IArtifactsRequest {
 | 
				
			||||||
 | 
					    Upgrade: ICrewShipSalvagedWeaponSkin;
 | 
				
			||||||
 | 
					    LevelDiff: number;
 | 
				
			||||||
 | 
					    Cost: number;
 | 
				
			||||||
 | 
					    FusionPointCost: number;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					interface IMissionInventoryUpdateRequest {
 | 
				
			||||||
 | 
					    rewardsMultiplier?: number;
 | 
				
			||||||
 | 
					    ActiveBoosters?: IBooster[];
 | 
				
			||||||
 | 
					    LongGuns?: IWeaponDatabase[];
 | 
				
			||||||
 | 
					    Pistols?: IWeaponDatabase[];
 | 
				
			||||||
 | 
					    Suits?: ISuitDatabase[];
 | 
				
			||||||
 | 
					    Melee?: IWeaponDatabase[];
 | 
				
			||||||
 | 
					    RawUpgrades?: IRawUpgrade[];
 | 
				
			||||||
 | 
					    MiscItems?: IMiscItem[];
 | 
				
			||||||
 | 
					    Consumables?: IConsumable[];
 | 
				
			||||||
 | 
					    Recipes?: IConsumable[];
 | 
				
			||||||
 | 
					    RegularCredits?: number;
 | 
				
			||||||
 | 
					    ChallengeProgress?: IChallengeProgress[];
 | 
				
			||||||
 | 
					    RewardInfo?: IMissionInventoryUpdateRequestRewardInfo;
 | 
				
			||||||
 | 
					    FusionPoints?: number;
 | 
				
			||||||
 | 
					    Missions?: IMission;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					interface IMissionInventoryUpdateRequestRewardInfo {
 | 
				
			||||||
 | 
					    node: string;
 | 
				
			||||||
 | 
					    rewardTier?: number;
 | 
				
			||||||
 | 
					    nightmareMode?: boolean;
 | 
				
			||||||
 | 
					    useVaultManifest?: boolean;
 | 
				
			||||||
 | 
					    EnemyCachesFound?: number;
 | 
				
			||||||
 | 
					    toxinOk?: boolean;
 | 
				
			||||||
 | 
					    lostTargetWave?: number;
 | 
				
			||||||
 | 
					    defenseTargetCount?: number;
 | 
				
			||||||
 | 
					    EOM_AFK?: number;
 | 
				
			||||||
 | 
					    rewardQualifications?: string;
 | 
				
			||||||
 | 
					    PurgatoryRewardQualifications?: string;
 | 
				
			||||||
 | 
					    rewardSeed?: number;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export { IArtifactsRequest, IMissionInventoryUpdateRequest };
 | 
				
			||||||
@ -1,4 +1,5 @@
 | 
				
			|||||||
export interface Session {
 | 
					/* eslint-disable @typescript-eslint/no-explicit-any */
 | 
				
			||||||
 | 
					export interface ISession {
 | 
				
			||||||
    sessionId: string;
 | 
					    sessionId: string;
 | 
				
			||||||
    creatorId: string;
 | 
					    creatorId: string;
 | 
				
			||||||
    maxPlayers: number;
 | 
					    maxPlayers: number;
 | 
				
			||||||
@ -26,6 +27,6 @@ export interface Session {
 | 
				
			|||||||
    fullReset: number;
 | 
					    fullReset: number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface FindSessionRequest {
 | 
					export interface IFindSessionRequest {
 | 
				
			||||||
    [key: string]: any;
 | 
					    [key: string]: any;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -1,7 +1,5 @@
 | 
				
			|||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import { Types } from "mongoose";
 | 
					import { Types } from "mongoose";
 | 
				
			||||||
import { Oid } from "@/src/types/commonTypes";
 | 
					import { IOid } from "@/src/types/commonTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IShip {
 | 
					export interface IShip {
 | 
				
			||||||
    ShipOwnerId: Types.ObjectId;
 | 
					    ShipOwnerId: Types.ObjectId;
 | 
				
			||||||
@ -10,8 +8,9 @@ export interface IShip {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IShipClassResponse extends IShipClassDatabase {
 | 
					export interface IShipClassResponse extends IShipClassDatabase {
 | 
				
			||||||
    ShipId: Oid;
 | 
					    ShipId: IOid;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IShipClassDatabase {
 | 
					export interface IShipClassDatabase {
 | 
				
			||||||
    Rooms: IRoomsClass[];
 | 
					    Rooms: IRoomsClass[];
 | 
				
			||||||
    Features: string[];
 | 
					    Features: string[];
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
import Items, { Item, Weapon } from "warframe-items";
 | 
					import Items, { Category, Item, Warframe, Weapon } from "warframe-items";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type MinWeapon = Omit<Weapon, "patchlogs">;
 | 
					type MinWeapon = Omit<Weapon, "patchlogs">;
 | 
				
			||||||
type MinItem = Omit<Item, "patchlogs">;
 | 
					type MinItem = Omit<Item, "patchlogs">;
 | 
				
			||||||
@ -16,3 +16,45 @@ export const items: MinItem[] = new Items({ category: ["All"] }).map(item => {
 | 
				
			|||||||
    delete next.patchlogs;
 | 
					    delete next.patchlogs;
 | 
				
			||||||
    return next;
 | 
					    return next;
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const getNamesObj = (category: Category) =>
 | 
				
			||||||
 | 
					    new Items({ category: [category] }).reduce((acc, item) => {
 | 
				
			||||||
 | 
					        acc[item.name!.replace("'S", "'s")] = item.uniqueName!;
 | 
				
			||||||
 | 
					        return acc;
 | 
				
			||||||
 | 
					    }, {} as ImportAssertions);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const modNames = getNamesObj("Mods");
 | 
				
			||||||
 | 
					export const resourceNames = getNamesObj("Resources");
 | 
				
			||||||
 | 
					export const miscNames = getNamesObj("Misc");
 | 
				
			||||||
 | 
					export const relicNames = getNamesObj("Relics");
 | 
				
			||||||
 | 
					export const skinNames = getNamesObj("Skins");
 | 
				
			||||||
 | 
					export const arcaneNames = getNamesObj("Arcanes");
 | 
				
			||||||
 | 
					export const gearNames = getNamesObj("Gear");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const craftNames: ImportAssertions = Object.fromEntries(
 | 
				
			||||||
 | 
					    (
 | 
				
			||||||
 | 
					        new Items({
 | 
				
			||||||
 | 
					            category: [
 | 
				
			||||||
 | 
					                "Warframes",
 | 
				
			||||||
 | 
					                "Gear",
 | 
				
			||||||
 | 
					                "Melee",
 | 
				
			||||||
 | 
					                "Primary",
 | 
				
			||||||
 | 
					                "Secondary",
 | 
				
			||||||
 | 
					                "Sentinels",
 | 
				
			||||||
 | 
					                "Misc",
 | 
				
			||||||
 | 
					                "Arch-Gun",
 | 
				
			||||||
 | 
					                "Arch-Melee"
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
 | 
					        }) as Warframe[]
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					        .flatMap(item => item.components || [])
 | 
				
			||||||
 | 
					        .filter(item => item.drops && item.drops[0])
 | 
				
			||||||
 | 
					        .map(item => [item.drops![0].type, item.uniqueName])
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
					craftNames["Forma Blueprint"] = "/Lotus/Types/Recipes/Components/FormaBlueprint";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export const blueprintNames: ImportAssertions = Object.fromEntries(
 | 
				
			||||||
 | 
					    Object.keys(craftNames)
 | 
				
			||||||
 | 
					        .filter(name => name.includes("Blueprint"))
 | 
				
			||||||
 | 
					        .map(name => [name, craftNames[name]])
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										1
									
								
								static/json/missions-drop-table.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								static/json/missions-drop-table.json
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										30
									
								
								static/json/scripts/missions-drop-table-get-script.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								static/json/scripts/missions-drop-table-get-script.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user