Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Master 2024-06-24 19:50:36 +08:00
commit 1161988ca4
30 changed files with 81 additions and 72 deletions

View File

@ -19,7 +19,7 @@
"@typescript-eslint/no-unsafe-member-access": "warn", "@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-misused-promises": "warn", "@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/no-unsafe-argument": "warn", "@typescript-eslint/no-unsafe-argument": "error",
"@typescript-eslint/no-unsafe-call": "warn", "@typescript-eslint/no-unsafe-call": "warn",
"@typescript-eslint/no-unsafe-assignment": "warn", "@typescript-eslint/no-unsafe-assignment": "warn",
"@typescript-eslint/no-explicit-any": "warn", "@typescript-eslint/no-explicit-any": "warn",

8
package-lock.json generated
View File

@ -12,7 +12,7 @@
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"express": "^5.0.0-beta.3", "express": "^5.0.0-beta.3",
"mongoose": "^8.1.1", "mongoose": "^8.1.1",
"warframe-public-export-plus": "^0.3.2", "warframe-public-export-plus": "^0.3.3",
"warframe-riven-info": "^0.1.0", "warframe-riven-info": "^0.1.0",
"winston": "^3.11.0", "winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1" "winston-daily-rotate-file": "^4.7.1"
@ -3669,9 +3669,9 @@
} }
}, },
"node_modules/warframe-public-export-plus": { "node_modules/warframe-public-export-plus": {
"version": "0.3.2", "version": "0.3.3",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.2.tgz", "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.3.tgz",
"integrity": "sha512-0jAStLLrMaz0zm7wfY1/3SWLPmMJcYNNErVTPo8YqBZlot1aikVuDNu+crVmN+LWDDLrn01T7f83EYaw7TYo6w==" "integrity": "sha512-35pSMqXxe9vG4kdA+SnCyZyWO8zRGuPQbNeOPgZm5886kiujR+Qd6iY7TH0fdQYgKCk1M+q8lXonATT9VB9bbQ=="
}, },
"node_modules/warframe-riven-info": { "node_modules/warframe-riven-info": {
"version": "0.1.0", "version": "0.1.0",

View File

@ -16,7 +16,7 @@
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"express": "^5.0.0-beta.3", "express": "^5.0.0-beta.3",
"mongoose": "^8.1.1", "mongoose": "^8.1.1",
"warframe-public-export-plus": "^0.3.2", "warframe-public-export-plus": "^0.3.3",
"warframe-riven-info": "^0.1.0", "warframe-riven-info": "^0.1.0",
"winston": "^3.11.0", "winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1" "winston-daily-rotate-file": "^4.7.1"

View File

@ -7,7 +7,7 @@ import { getInventory } from "@/src/services/inventoryService";
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
const addFriendImageController: RequestHandler = async (req, res) => { const addFriendImageController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const json = getJSONfromString(req.body.toString()) as IUpdateGlyphRequest; const json = getJSONfromString(String(req.body)) as IUpdateGlyphRequest;
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
inventory.ActiveAvatarImageType = json.AvatarImageType; inventory.ActiveAvatarImageType = json.AvatarImageType;
await inventory.save(); await inventory.save();

View File

@ -15,7 +15,7 @@ export interface IClaimCompletedRecipeRequest {
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
export const claimCompletedRecipeController: RequestHandler = async (req, res) => { export const claimCompletedRecipeController: RequestHandler = async (req, res) => {
const claimCompletedRecipeRequest = getJSONfromString(req.body.toString()) as IClaimCompletedRecipeRequest; const claimCompletedRecipeRequest = getJSONfromString(String(req.body)) as IClaimCompletedRecipeRequest;
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
if (!accountId) throw new Error("no account id"); if (!accountId) throw new Error("no account id");

View File

@ -8,7 +8,7 @@ import { ICreateGuildRequest } from "@/src/types/guildTypes";
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
const createGuildController: RequestHandler = async (req, res) => { const createGuildController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const payload: ICreateGuildRequest = getJSONfromString(req.body.toString()); const payload = getJSONfromString(String(req.body)) as ICreateGuildRequest;
// Create guild on database // Create guild on database
const guild = new Guild({ const guild = new Guild({

View File

@ -9,7 +9,7 @@ import { EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTyp
export const evolveWeaponController: RequestHandler = async (req, res) => { export const evolveWeaponController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const payload = getJSONfromString(req.body.toString()) as IEvolveWeaponRequest; const payload = getJSONfromString(String(req.body)) as IEvolveWeaponRequest;
console.assert(payload.Action == "EWA_INSTALL"); console.assert(payload.Action == "EWA_INSTALL");
// TODO: We should remove the Genesis item & its resources, but currently we don't know these "recipes". // TODO: We should remove the Genesis item & its resources, but currently we don't know these "recipes".

View File

@ -4,25 +4,25 @@ import { logger } from "@/src/utils/logger";
//TODO: cleanup //TODO: cleanup
const findSessionsController: RequestHandler = (_req, res) => { const findSessionsController: RequestHandler = (_req, res) => {
const reqBody = JSON.parse(_req.body); const reqBody = JSON.parse(String(_req.body));
logger.debug("FindSession Request ", { reqBody }); logger.debug("FindSession Request ", { reqBody });
const req = JSON.parse(_req.body); const req = JSON.parse(String(_req.body));
if (req.id != undefined) { if (req.id != undefined) {
logger.debug("Found ID"); logger.debug("Found ID");
const session = getSession(req.id); const session = getSession(req.id as string);
if (session) res.json({ queryId: req.queryId, Sessions: session }); if (session) res.json({ queryId: req.queryId, Sessions: session });
else res.json({}); else res.json({});
} else if (req.originalSessionId != undefined) { } else if (req.originalSessionId != undefined) {
logger.debug("Found OriginalSessionID"); logger.debug("Found OriginalSessionID");
const session = getSession(req.originalSessionId); const session = getSession(req.originalSessionId as string);
if (session) res.json({ queryId: req.queryId, Sessions: session }); if (session) res.json({ queryId: req.queryId, Sessions: session });
else res.json({}); else res.json({});
} else { } else {
logger.debug("Found SessionRequest"); logger.debug("Found SessionRequest");
const session = getSession(_req.body); const session = getSession(String(_req.body));
if (session) res.json({ queryId: req.queryId, Sessions: session }); if (session) res.json({ queryId: req.queryId, Sessions: session });
else res.json({}); else res.json({});
} }

View File

@ -15,7 +15,7 @@ export const focusController: RequestHandler = async (req, res) => {
res.end(); res.end();
break; break;
case FocusOperation.UnlockWay: { case FocusOperation.UnlockWay: {
const focusType = (JSON.parse(req.body.toString()) as IWayRequest).FocusType; const focusType = (JSON.parse(String(req.body)) as IWayRequest).FocusType;
const focusPolarity = focusTypeToPolarity(focusType); const focusPolarity = focusTypeToPolarity(focusType);
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const cost = inventory.FocusAbility ? 50_000 : 0; const cost = inventory.FocusAbility ? 50_000 : 0;
@ -32,7 +32,7 @@ export const focusController: RequestHandler = async (req, res) => {
break; break;
} }
case FocusOperation.ActivateWay: { case FocusOperation.ActivateWay: {
const focusType = (JSON.parse(req.body.toString()) as IWayRequest).FocusType; const focusType = (JSON.parse(String(req.body)) as IWayRequest).FocusType;
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
inventory.FocusAbility = focusType; inventory.FocusAbility = focusType;
await inventory.save(); await inventory.save();
@ -40,7 +40,7 @@ export const focusController: RequestHandler = async (req, res) => {
break; break;
} }
case FocusOperation.UnlockUpgrade: { case FocusOperation.UnlockUpgrade: {
const request = JSON.parse(req.body.toString()) as IUnlockUpgradeRequest; const request = JSON.parse(String(req.body)) as IUnlockUpgradeRequest;
const focusPolarity = focusTypeToPolarity(request.FocusTypes[0]); const focusPolarity = focusTypeToPolarity(request.FocusTypes[0]);
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
let cost = 0; let cost = 0;
@ -57,7 +57,7 @@ export const focusController: RequestHandler = async (req, res) => {
break; break;
} }
case FocusOperation.LevelUpUpgrade: { case FocusOperation.LevelUpUpgrade: {
const request = JSON.parse(req.body.toString()) as ILevelUpUpgradeRequest; const request = JSON.parse(String(req.body)) as ILevelUpUpgradeRequest;
const focusPolarity = focusTypeToPolarity(request.FocusInfos[0].ItemType); const focusPolarity = focusTypeToPolarity(request.FocusInfos[0].ItemType);
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
let cost = 0; let cost = 0;
@ -75,7 +75,7 @@ export const focusController: RequestHandler = async (req, res) => {
break; break;
} }
case FocusOperation.UnbindUpgrade: { case FocusOperation.UnbindUpgrade: {
const request = JSON.parse(req.body.toString()) as IUnbindUpgradeRequest; const request = JSON.parse(String(req.body)) as IUnbindUpgradeRequest;
const focusPolarity = focusTypeToPolarity(request.FocusTypes[0]); const focusPolarity = focusTypeToPolarity(request.FocusTypes[0]);
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
inventory.FocusXP[focusPolarity] -= 750_000 * request.FocusTypes.length; inventory.FocusXP[focusPolarity] -= 750_000 * request.FocusTypes.length;
@ -105,7 +105,7 @@ export const focusController: RequestHandler = async (req, res) => {
break; break;
} }
case FocusOperation.ConvertShard: { case FocusOperation.ConvertShard: {
const request = JSON.parse(req.body.toString()) as IConvertShardRequest; const request = JSON.parse(String(req.body)) as IConvertShardRequest;
// Tally XP // Tally XP
let xp = 0; let xp = 0;
for (const shard of request.Shards) { for (const shard of request.Shards) {

View File

@ -2,11 +2,12 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
import { updateGeneric } from "@/src/services/inventoryService"; import { updateGeneric } from "@/src/services/inventoryService";
import { RequestHandler } from "express"; import { RequestHandler } from "express";
import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getJSONfromString } from "@/src/helpers/stringHelpers";
import { IGenericUpdate } from "@/src/types/genericUpdate";
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
const genericUpdateController: RequestHandler = async (request, response) => { const genericUpdateController: RequestHandler = async (request, response) => {
const accountId = await getAccountIdForRequest(request); const accountId = await getAccountIdForRequest(request);
const update = getJSONfromString(request.body.toString()); const update = getJSONfromString(String(request.body)) as IGenericUpdate;
response.json(await updateGeneric(update, accountId)); response.json(await updateGeneric(update, accountId));
}; };

View File

@ -7,11 +7,10 @@ import { IOid } from "@/src/types/commonTypes";
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
export const infestedFoundryController: RequestHandler = async (req, res) => { export const infestedFoundryController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const payload = getJSONfromString(req.body.toString());
switch (req.query.mode) { switch (req.query.mode) {
case "s": { case "s": {
// shard installation // shard installation
const request = payload as IShardInstallRequest; const request = getJSONfromString(String(req.body)) as IShardInstallRequest;
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const suit = inventory.Suits.find(suit => suit._id.toString() == request.SuitId.$oid)!; const suit = inventory.Suits.find(suit => suit._id.toString() == request.SuitId.$oid)!;
if ( if (
@ -42,9 +41,10 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
case "n": { case "n": {
// name the beast // name the beast
const request = getJSONfromString(String(req.body)) as IHelminthNameRequest;
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
inventory.InfestedFoundry ??= {}; inventory.InfestedFoundry ??= {};
inventory.InfestedFoundry.Name = payload.newName as string; inventory.InfestedFoundry.Name = request.newName;
await inventory.save(); await inventory.save();
res.json({ res.json({
InventoryChanges: { InventoryChanges: {
@ -73,6 +73,10 @@ interface IShardInstallRequest {
Color: string; Color: string;
} }
interface IHelminthNameRequest {
newName: string;
}
const colorToShard: Record<string, string> = { const colorToShard: Record<string, string> = {
ACC_RED: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmar", ACC_RED: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmar",
ACC_RED_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmarMythic", ACC_RED_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalAmarMythic",

View File

@ -136,6 +136,9 @@ const inventoryController: RequestHandler = async (request, response) => {
} }
} }
// Fix for #380
inventoryResponse.NextRefill = { $date: { $numberLong: "9999999999999" } };
response.json(inventoryResponse); response.json(inventoryResponse);
}; };

View File

@ -3,10 +3,10 @@ import { getSessionByID } from "@/src/managers/sessionManager";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";
const joinSessionController: RequestHandler = (_req, res) => { const joinSessionController: RequestHandler = (_req, res) => {
const reqBody = JSON.parse(_req.body); const reqBody = JSON.parse(String(_req.body));
logger.debug(`JoinSession Request`, { reqBody }); logger.debug(`JoinSession Request`, { reqBody });
const req = JSON.parse(_req.body); const req = JSON.parse(String(_req.body));
const session = getSessionByID(req.sessionIds[0]); const session = getSessionByID(req.sessionIds[0] as string);
res.json({ rewardSeed: session?.rewardSeed, sessionId: { $oid: session?.sessionId } }); res.json({ rewardSeed: session?.rewardSeed, sessionId: { $oid: session?.sessionId } });
}; };

View File

@ -22,7 +22,7 @@ interface IModularCraftRequest {
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
export const modularWeaponCraftingController: RequestHandler = async (req, res) => { export const modularWeaponCraftingController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const data: IModularCraftRequest = getJSONfromString(req.body.toString()); const data = getJSONfromString(String(req.body)) as IModularCraftRequest;
if (!(data.WeaponType in modularWeaponTypes)) { if (!(data.WeaponType in modularWeaponTypes)) {
throw new Error(`unknown modular weapon type: ${data.WeaponType}`); throw new Error(`unknown modular weapon type: ${data.WeaponType}`);
} }

View File

@ -12,7 +12,7 @@ interface INameWeaponRequest {
export const nameWeaponController: RequestHandler = async (req, res) => { export const nameWeaponController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const body = getJSONfromString(req.body.toString()) as INameWeaponRequest; const body = getJSONfromString(String(req.body)) as INameWeaponRequest;
const item = inventory[req.query.Category as string as TEquipmentKey].find( const item = inventory[req.query.Category as string as TEquipmentKey].find(
item => item._id.toString() == (req.query.ItemId as string) item => item._id.toString() == (req.query.ItemId as string)
)!; )!;

View File

@ -5,7 +5,7 @@ import { getInventory, addMods, addRecipes } from "@/src/services/inventoryServi
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
export const sellController: RequestHandler = async (req, res) => { export const sellController: RequestHandler = async (req, res) => {
const payload: ISellRequest = JSON.parse(req.body.toString()); const payload = JSON.parse(String(req.body)) as ISellRequest;
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);

View File

@ -8,7 +8,7 @@ import { WeaponTypeInternal } from "@/src/services/itemDataService";
export const setWeaponSkillTreeController: RequestHandler = async (req, res) => { export const setWeaponSkillTreeController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const payload = getJSONfromString(req.body.toString()) as ISetWeaponSkillTreeRequest; const payload = getJSONfromString(String(req.body)) as ISetWeaponSkillTreeRequest;
const item = inventory[req.query.Category as WeaponTypeInternal].find( const item = inventory[req.query.Category as WeaponTypeInternal].find(
item => item._id.toString() == (req.query.ItemId as string) item => item._id.toString() == (req.query.ItemId as string)

View File

@ -12,7 +12,7 @@ interface IStartDojoRecipeRequest {
export const startDojoRecipeController: RequestHandler = async (req, res) => { export const startDojoRecipeController: RequestHandler = async (req, res) => {
const guild = await getGuildForRequest(req); const guild = await getGuildForRequest(req);
// At this point, we know that a member of the guild is making this request. Assuming they are allowed to start a build. // At this point, we know that a member of the guild is making this request. Assuming they are allowed to start a build.
const request = JSON.parse(req.body.toString()) as IStartDojoRecipeRequest; const request = JSON.parse(String(req.body)) as IStartDojoRecipeRequest;
guild.DojoComponents!.push({ guild.DojoComponents!.push({
_id: new Types.ObjectId(), _id: new Types.ObjectId(),
pf: request.PlacedComponent.pf, pf: request.PlacedComponent.pf,

View File

@ -11,7 +11,7 @@ interface IStartRecipeRequest {
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
export const startRecipeController: RequestHandler = async (req, res) => { export const startRecipeController: RequestHandler = async (req, res) => {
const startRecipeRequest = getJSONfromString(req.body.toString()) as IStartRecipeRequest; const startRecipeRequest = getJSONfromString(String(req.body)) as IStartRecipeRequest;
logger.debug("StartRecipe Request", { startRecipeRequest }); logger.debug("StartRecipe Request", { startRecipeRequest });
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);

View File

@ -7,7 +7,7 @@ import { IStepSequencer } from "@/src/types/inventoryTypes/inventoryTypes";
export const stepSequencersController: RequestHandler = async (req, res) => { export const stepSequencersController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const stepSequencer = JSON.parse(req.body.toString()) as IStepSequencer; const stepSequencer = JSON.parse(String(req.body)) as IStepSequencer;
delete stepSequencer.ItemId; delete stepSequencer.ItemId;
const stepSequencerIndex = inventory.StepSequencers.push(stepSequencer); const stepSequencerIndex = inventory.StepSequencers.push(stepSequencer);
const changedInventory = await inventory.save(); const changedInventory = await inventory.save();

View File

@ -7,10 +7,9 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
const syndicateSacrificeController: RequestHandler = async (request, response) => { const syndicateSacrificeController: RequestHandler = async (request, response) => {
const accountId = await getAccountIdForRequest(request); const accountId = await getAccountIdForRequest(request);
const body = getJSONfromString(request.body); const update = getJSONfromString(String(request.body)) as ISyndicateSacrifice;
let reply = {}; let reply = {};
try { try {
const update = JSON.parse(body) as ISyndicateSacrifice;
if (typeof update !== "object") { if (typeof update !== "object") {
throw new Error("Invalid data format"); throw new Error("Invalid data format");
} }

View File

@ -19,7 +19,7 @@ interface ITrainingResultsResponse {
const trainingResultController: RequestHandler = async (req, res): Promise<void> => { const trainingResultController: RequestHandler = async (req, res): Promise<void> => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const trainingResults = getJSONfromString(req.body.toString()) as ITrainingResultsRequest; const trainingResults = getJSONfromString(String(req.body)) as ITrainingResultsRequest;
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);

View File

@ -6,7 +6,7 @@ import { IUpdateChallengeProgressRequest } from "@/src/types/requestTypes";
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
const updateChallengeProgressController: RequestHandler = async (req, res) => { const updateChallengeProgressController: RequestHandler = async (req, res) => {
const payload: IUpdateChallengeProgressRequest = getJSONfromString(req.body.toString()); const payload = getJSONfromString(String(req.body)) as IUpdateChallengeProgressRequest;
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
await updateChallengeProgress(payload, accountId); await updateChallengeProgress(payload, accountId);

View File

@ -5,9 +5,9 @@ const updateSessionGetController: RequestHandler = (_req, res) => {
res.json({}); res.json({});
}; };
const updateSessionPostController: RequestHandler = (_req, res) => { const updateSessionPostController: RequestHandler = (_req, res) => {
console.log("UpdateSessions POST Request:", JSON.parse(_req.body)); console.log("UpdateSessions POST Request:", JSON.parse(String(_req.body)));
console.log("ReqID:", _req.query.sessionId as string); console.log("ReqID:", _req.query.sessionId as string);
updateSession(_req.query.sessionId as string, _req.body); updateSession(_req.query.sessionId as string, String(_req.body));
res.json({}); res.json({});
}; };
export { updateSessionGetController, updateSessionPostController }; export { updateSessionGetController, updateSessionPostController };

View File

@ -12,7 +12,7 @@ import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inven
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
export const upgradesController: RequestHandler = async (req, res) => { export const upgradesController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req); const accountId = await getAccountIdForRequest(req);
const payload = JSON.parse(req.body.toString()) as IUpgradesRequest; const payload = JSON.parse(String(req.body)) as IUpgradesRequest;
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
const InventoryChanges: any = {}; const InventoryChanges: any = {};
for (const operation of payload.Operations) { for (const operation of payload.Operations) {

View File

@ -3,7 +3,7 @@ import { updateConfig } from "@/src/services/configService";
// eslint-disable-next-line @typescript-eslint/no-misused-promises // eslint-disable-next-line @typescript-eslint/no-misused-promises
const updateConfigDataController: RequestHandler = async (req, res) => { const updateConfigDataController: RequestHandler = async (req, res) => {
await updateConfig(req.body.toString()); await updateConfig(String(req.body));
res.end(); res.end();
}; };

View File

@ -27,7 +27,7 @@ import { logger } from "@/src/utils/logger";
import { WeaponTypeInternal, getWeaponType, getExalted } from "@/src/services/itemDataService"; import { WeaponTypeInternal, getWeaponType, getExalted } from "@/src/services/itemDataService";
import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes"; import { ISyndicateSacrifice, ISyndicateSacrificeResponse } from "../types/syndicateTypes";
import { IEquipmentClient } from "../types/inventoryTypes/commonInventoryTypes"; import { IEquipmentClient } from "../types/inventoryTypes/commonInventoryTypes";
import { ExportCustoms, ExportRecipes, ExportResources } from "warframe-public-export-plus"; import { ExportCustoms, ExportFlavour, ExportRecipes, ExportResources } from "warframe-public-export-plus";
export const createInventory = async ( export const createInventory = async (
accountOwnerId: Types.ObjectId, accountOwnerId: Types.ObjectId,
@ -112,6 +112,13 @@ export const addItem = async (
} }
}; };
} }
if (typeName in ExportFlavour) {
return {
InventoryChanges: {
FlavourItems: [await addCustomization(typeName, accountId)]
}
};
}
// Path-based duck typing // Path-based duck typing
switch (typeName.substr(1).split("/")[1]) { switch (typeName.substr(1).split("/")[1]) {
@ -171,12 +178,6 @@ export const addItem = async (
[weaponType]: [weapon] [weaponType]: [weapon]
} }
}; };
case "Interface":
return {
InventoryChanges: {
FlavourItems: [await addCustomization(typeName, accountId)]
}
};
case "Objects": { case "Objects": {
// /Lotus/Objects/Tenno/Props/TnoLisetTextProjector (Note Beacon) // /Lotus/Objects/Tenno/Props/TnoLisetTextProjector (Note Beacon)
const inventory = await getInventory(accountId); const inventory = await getInventory(accountId);
@ -196,13 +197,6 @@ export const addItem = async (
} }
case "Types": case "Types":
switch (typeName.substr(1).split("/")[2]) { switch (typeName.substr(1).split("/")[2]) {
case "AvatarImages":
case "SuitCustomizations":
return {
InventoryChanges: {
FlavourItems: [await addCustomization(typeName, accountId)]
}
};
case "Sentinels": case "Sentinels":
// TOOD: Sentinels should also grant their DefaultUpgrades & SentinelWeapon. // TOOD: Sentinels should also grant their DefaultUpgrades & SentinelWeapon.
const sentinel = await addSentinel(typeName, accountId); const sentinel = await addSentinel(typeName, accountId);

View File

@ -3,7 +3,7 @@ import { getSubstringFromKeyword } from "@/src/helpers/stringHelpers";
import { addItem, addBooster, updateCurrency, updateSlots } from "@/src/services/inventoryService"; import { addItem, addBooster, updateCurrency, updateSlots } from "@/src/services/inventoryService";
import { IPurchaseRequest, SlotPurchase, IInventoryChanges, IBinChanges } from "@/src/types/purchaseTypes"; import { IPurchaseRequest, SlotPurchase, IInventoryChanges, IBinChanges } from "@/src/types/purchaseTypes";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";
import { ExportBundles, TRarity } from "warframe-public-export-plus"; import { ExportBundles, ExportGear, TRarity } from "warframe-public-export-plus";
export const getStoreItemCategory = (storeItem: string) => { export const getStoreItemCategory = (storeItem: string) => {
const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/"); const storeItemString = getSubstringFromKeyword(storeItem, "StoreItems/");
@ -75,7 +75,8 @@ const handleStoreItemAcquisition = async (
storeItemName: string, storeItemName: string,
accountId: string, accountId: string,
quantity: number, quantity: number,
durability: TRarity durability: TRarity,
ignorePurchaseQuantity: boolean = false
): Promise<{ InventoryChanges: IInventoryChanges }> => { ): Promise<{ InventoryChanges: IInventoryChanges }> => {
let purchaseResponse = { let purchaseResponse = {
InventoryChanges: {} InventoryChanges: {}
@ -92,7 +93,8 @@ const handleStoreItemAcquisition = async (
component.typeName, component.typeName,
accountId, accountId,
component.purchaseQuantity * quantity, component.purchaseQuantity * quantity,
component.durability component.durability,
true
) )
).InventoryChanges ).InventoryChanges
); );
@ -101,9 +103,14 @@ const handleStoreItemAcquisition = async (
const storeCategory = getStoreItemCategory(storeItemName); const storeCategory = getStoreItemCategory(storeItemName);
const internalName = storeItemName.replace("/StoreItems", ""); const internalName = storeItemName.replace("/StoreItems", "");
logger.debug(`store category ${storeCategory}`); logger.debug(`store category ${storeCategory}`);
if (!ignorePurchaseQuantity) {
if (internalName in ExportGear) {
quantity *= ExportGear[internalName].purchaseQuantity || 1;
}
}
switch (storeCategory) { switch (storeCategory) {
default: default:
purchaseResponse = await addItem(accountId, internalName); purchaseResponse = await addItem(accountId, internalName, quantity);
break; break;
case "Types": case "Types":
purchaseResponse = await handleTypesPurchase(internalName, accountId, quantity); purchaseResponse = await handleTypesPurchase(internalName, accountId, quantity);

View File

@ -253,7 +253,8 @@ export interface IInventoryResponse {
NemesisAbandonedRewards: string[]; NemesisAbandonedRewards: string[];
DailyAffiliationKahl: number; DailyAffiliationKahl: number;
LastInventorySync: IOid; LastInventorySync: IOid;
NextRefill: IMongoDate; NextRefill: IMongoDate; // Next time argon crystals will have a decay tick
FoundToday?: IMiscItem[]; // for Argon Crystals
ActiveLandscapeTraps: any[]; ActiveLandscapeTraps: any[];
EvolutionProgress?: IEvolutionProgress[]; EvolutionProgress?: IEvolutionProgress[];
RepVotes: any[]; RepVotes: any[];

View File

@ -112,9 +112,6 @@
<div class="card mb-4"> <div class="card mb-4">
<h5 class="card-header">Warframes</h5> <h5 class="card-header">Warframes</h5>
<div class="card-body"> <div class="card-body">
<table class="table table-hover w-100">
<tbody id="warframe-list"></tbody>
</table>
<form class="input-group" onsubmit="doAcquireWarframe();return false;"> <form class="input-group" onsubmit="doAcquireWarframe();return false;">
<input <input
class="form-control" class="form-control"
@ -123,6 +120,9 @@
/> />
<button class="btn btn-primary" type="submit">Add</button> <button class="btn btn-primary" type="submit">Add</button>
</form> </form>
<table class="table table-hover w-100">
<tbody id="warframe-list"></tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
@ -130,13 +130,13 @@
<div class="card mb-4"> <div class="card mb-4">
<h5 class="card-header">Weapons</h5> <h5 class="card-header">Weapons</h5>
<div class="card-body"> <div class="card-body">
<table class="table table-hover w-100">
<tbody id="weapon-list"></tbody>
</table>
<form class="input-group" onsubmit="doAcquireWeapon();return false;"> <form class="input-group" onsubmit="doAcquireWeapon();return false;">
<input class="form-control" id="weapon-to-acquire" list="datalist-weapons" /> <input class="form-control" id="weapon-to-acquire" list="datalist-weapons" />
<button class="btn btn-primary" type="submit">Add</button> <button class="btn btn-primary" type="submit">Add</button>
</form> </form>
<table class="table table-hover w-100">
<tbody id="weapon-list"></tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
@ -191,13 +191,13 @@
<div class="card mb-4"> <div class="card mb-4">
<h5 class="card-header">Mods</h5> <h5 class="card-header">Mods</h5>
<div class="card-body"> <div class="card-body">
<table class="table table-hover w-100">
<tbody id="mods-list"></tbody>
</table>
<form class="input-group" onsubmit="doAcquireMod();return false;"> <form class="input-group" onsubmit="doAcquireMod();return false;">
<input class="form-control" id="mod-to-acquire" list="datalist-mods" /> <input class="form-control" id="mod-to-acquire" list="datalist-mods" />
<button class="btn btn-primary" type="submit">Add</button> <button class="btn btn-primary" type="submit">Add</button>
</form> </form>
<table class="table table-hover w-100">
<tbody id="mods-list"></tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
@ -248,7 +248,7 @@
<div class="form-check"> <div class="form-check">
<input class="form-check-input" type="checkbox" id="unlockAllFlavourItems" /> <input class="form-check-input" type="checkbox" id="unlockAllFlavourItems" />
<label class="form-check-label" for="unlockAllFlavourItems"> <label class="form-check-label" for="unlockAllFlavourItems">
Unlock All Flavor Items (Glyphs & co.) Unlock All <abbr title="Animation Sets, Glyphs, Plattes, etc.">Flavor Items</abbr>
</label> </label>
</div> </div>
<div class="form-check"> <div class="form-check">