This commit is contained in:
Ordis 2024-01-20 22:48:42 +01:00
parent 4a102b9d3b
commit 7aaa51b3eb
16 changed files with 216 additions and 118 deletions

View File

@ -0,0 +1,10 @@
//this is a controller for the claimCompletedRecipe route
//it will claim a recipe for the user
import { Request, RequestHandler, Response } from "express";
import { logger } from "@/src/utils/logger";
export const claimCompletedRecipeController: RequestHandler = async (_req: Request, res: Response) => {
logger.debug("Claiming Completed Recipe");
res.json({ status: "success" });
};

View File

@ -24,6 +24,7 @@ const inventoryController: RequestHandler = async (request: Request, response: R
return; return;
} }
//TODO: make a function that converts from database representation to client
const inventoryJSON = inventory.toJSON(); const inventoryJSON = inventory.toJSON();
const inventoryResponse = toInventoryResponse(inventoryJSON); const inventoryResponse = toInventoryResponse(inventoryJSON);

View File

@ -0,0 +1,21 @@
import { parseString } from "@/src/helpers/general";
import { getJSONfromString } from "@/src/helpers/stringHelpers";
import { startRecipe } from "@/src/services/recipeService";
import { logger } from "@/src/utils/logger";
import { RequestHandler } from "express";
interface IStartRecipeRequest {
RecipeName: string;
Ids: string[];
}
// eslint-disable-next-line @typescript-eslint/no-misused-promises
export const startRecipeController: RequestHandler = async (req, res) => {
const startRecipeRequest = getJSONfromString(req.body.toString()) as IStartRecipeRequest;
logger.debug("StartRecipe Request", { startRecipeRequest });
const accountId = parseString(req.query.accountId);
const newRecipeId = await startRecipe(startRecipeRequest.RecipeName, accountId);
res.json(newRecipeId);
};

View File

@ -1,5 +1,5 @@
import { ItemType, toAddItemRequest } from "@/src/helpers/customHelpers/addItemHelpers"; import { ItemType, toAddItemRequest } from "@/src/helpers/customHelpers/addItemHelpers";
import { getWeaponType } from "@/src/helpers/purchaseHelpers"; import { getWeaponType } from "@/src/services/itemDataService";
import { addPowerSuit, addWeapon } from "@/src/services/inventoryService"; import { addPowerSuit, addWeapon } from "@/src/services/inventoryService";
import { RequestHandler } from "express"; import { RequestHandler } from "express";

View File

@ -1,5 +1,5 @@
import { isString, parseString } from "@/src/helpers/general"; import { isString, parseString } from "@/src/helpers/general";
import { items } from "@/static/data/items"; import { items } from "@/src/services/itemDataService";
export enum ItemType { export enum ItemType {
Powersuit = "Powersuit", Powersuit = "Powersuit",

View File

@ -1,8 +1,7 @@
import { parseBoolean, parseNumber, parseString } from "@/src/helpers/general"; import { parseBoolean, parseNumber, parseString } from "@/src/helpers/general";
import { WeaponTypeInternal } from "@/src/services/inventoryService"; import { weapons } from "@/src/services/itemDataService";
import { slotPurchaseNameToSlotName } from "@/src/services/purchaseService"; import { slotPurchaseNameToSlotName } from "@/src/services/purchaseService";
import { IPurchaseRequest, SlotPurchaseName } from "@/src/types/purchaseTypes"; import { IPurchaseRequest, SlotPurchaseName } from "@/src/types/purchaseTypes";
import { weapons } from "@/static/data/items";
export const toPurchaseRequest = (purchaseRequest: unknown): IPurchaseRequest => { export const toPurchaseRequest = (purchaseRequest: unknown): IPurchaseRequest => {
if (!purchaseRequest || typeof purchaseRequest !== "object") { if (!purchaseRequest || typeof purchaseRequest !== "object") {
@ -41,22 +40,6 @@ export const toPurchaseRequest = (purchaseRequest: unknown): IPurchaseRequest =>
throw new Error("invalid purchaseRequest"); throw new Error("invalid purchaseRequest");
}; };
export const getWeaponType = (weaponName: string) => {
const weaponInfo = weapons.find(i => i.uniqueName === weaponName);
if (!weaponInfo) {
throw new Error(`unknown weapon ${weaponName}`);
}
const weaponType = weaponInfo.productCategory as WeaponTypeInternal;
if (!weaponType) {
throw new Error(`unknown weapon category for item ${weaponName}`);
}
return weaponType;
};
export const isSlotPurchaseName = (slotPurchaseName: string): slotPurchaseName is SlotPurchaseName => { export const isSlotPurchaseName = (slotPurchaseName: string): slotPurchaseName is SlotPurchaseName => {
return slotPurchaseName in slotPurchaseNameToSlotName; return slotPurchaseName in slotPurchaseNameToSlotName;
}; };

View File

@ -1,4 +1,4 @@
export const getJSONfromString = (str: string): any => { export const getJSONfromString = (str: string) => {
const jsonSubstring = str.substring(0, str.lastIndexOf("}") + 1); const jsonSubstring = str.substring(0, str.lastIndexOf("}") + 1);
return JSON.parse(jsonSubstring); return JSON.parse(jsonSubstring);
}; };

View File

@ -1,4 +1,4 @@
import { Model, Schema, Types, model } from "mongoose"; import { HydratedDocument, Model, Schema, Types, model } from "mongoose";
import { import {
IFlavourItem, IFlavourItem,
IRawUpgrade, IRawUpgrade,
@ -10,7 +10,9 @@ import {
ISlots, ISlots,
IGenericItem, IGenericItem,
IMailbox, IMailbox,
IDuviriInfo IDuviriInfo,
IPendingRecipe as IPendingRecipeDatabase,
IPendingRecipeResponse
} from "../../types/inventoryTypes/inventoryTypes"; } from "../../types/inventoryTypes/inventoryTypes";
import { IMongoDate, IOid } from "../../types/commonTypes"; import { IMongoDate, IOid } from "../../types/commonTypes";
import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes"; import { ISuitDatabase } from "@/src/types/inventoryTypes/SuitTypes";
@ -25,6 +27,29 @@ import {
} from "@/src/types/inventoryTypes/commonInventoryTypes"; } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { toOid } from "@/src/helpers/inventoryHelpers"; import { toOid } from "@/src/helpers/inventoryHelpers";
const pendingRecipeSchema = new Schema<IPendingRecipeDatabase>(
{
ItemType: String,
CompletionDate: Date
},
{ id: false }
);
pendingRecipeSchema.virtual("ItemId").get(function () {
return { $oid: this._id.toString() };
});
pendingRecipeSchema.set("toJSON", {
virtuals: true,
transform(_document, returnedObject) {
delete returnedObject._id;
delete returnedObject.__v;
(returnedObject as IPendingRecipeResponse).CompletionDate = {
$date: { $numberLong: (returnedObject as IPendingRecipeDatabase).CompletionDate.getTime().toString() }
};
}
});
const polaritySchema = new Schema<IPolarity>({ const polaritySchema = new Schema<IPolarity>({
Slot: Number, Slot: Number,
Value: String Value: String
@ -296,7 +321,6 @@ DuviriInfoSchema.set("toJSON", {
}); });
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
accountOwnerId: Schema.Types.ObjectId, accountOwnerId: Schema.Types.ObjectId,
SubscribedToEmails: Number, SubscribedToEmails: Number,
Created: Schema.Types.Mixed, Created: Schema.Types.Mixed,
@ -325,7 +349,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
MechBin: slotsBinSchema, MechBin: slotsBinSchema,
CrewMemberBin: slotsBinSchema, CrewMemberBin: slotsBinSchema,
//How many trades do you have left //How many trades do you have left
TradesRemaining: Number, TradesRemaining: Number,
//How many Gift do you have left*(gift spends the trade) //How many Gift do you have left*(gift spends the trade)
@ -351,7 +374,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
DailyAffiliationZariman: Number, DailyAffiliationZariman: Number,
DailyAffiliationKahl: Number, DailyAffiliationKahl: Number,
//Daily Focus limit //Daily Focus limit
DailyFocus: Number, DailyFocus: Number,
//you not used Focus //you not used Focus
@ -441,20 +463,17 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
//Railjack/Components(https://warframe.fandom.com/wiki/Railjack/Components) //Railjack/Components(https://warframe.fandom.com/wiki/Railjack/Components)
CrewShipRawSalvage: [Schema.Types.Mixed], CrewShipRawSalvage: [Schema.Types.Mixed],
//Default RailJack //Default RailJack
CrewShips: [Schema.Types.Mixed], CrewShips: [Schema.Types.Mixed],
CrewShipAmmo: [Schema.Types.Mixed], CrewShipAmmo: [Schema.Types.Mixed],
CrewShipWeapons: [Schema.Types.Mixed], CrewShipWeapons: [Schema.Types.Mixed],
CrewShipWeaponSkins: [Schema.Types.Mixed], CrewShipWeaponSkins: [Schema.Types.Mixed],
//NPC Crew and weapon //NPC Crew and weapon
CrewMembers: [Schema.Types.Mixed], CrewMembers: [Schema.Types.Mixed],
CrewShipSalvagedWeaponSkins: [Schema.Types.Mixed], CrewShipSalvagedWeaponSkins: [Schema.Types.Mixed],
CrewShipSalvagedWeapons: [Schema.Types.Mixed], CrewShipSalvagedWeapons: [Schema.Types.Mixed],
//Complete Mission\Quests //Complete Mission\Quests
Missions: [Schema.Types.Mixed], Missions: [Schema.Types.Mixed],
QuestKeys: [Schema.Types.Mixed], QuestKeys: [Schema.Types.Mixed],
@ -478,25 +497,22 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
//Retries rank up(3 time) //Retries rank up(3 time)
TrainingRetriesLeft: Number, TrainingRetriesLeft: Number,
//you saw last played Region when you opened the star map //you saw last played Region when you opened the star map
LastRegionPlayed: String, LastRegionPlayed: String,
//Blueprint //Blueprint
Recipes: [Schema.Types.Mixed], Recipes: [Schema.Types.Mixed],
//Crafting Blueprint(Item Name + CompletionDate) //Crafting Blueprint(Item Name + CompletionDate)
PendingRecipes: [Schema.Types.Mixed], PendingRecipes: [pendingRecipeSchema],
//warframe\Weapon skins //warframe\Weapon skins
WeaponSkins: [Schema.Types.Mixed], WeaponSkins: [Schema.Types.Mixed],
//Ayatan Item //Ayatan Item
FusionTreasures: [Schema.Types.Mixed], FusionTreasures: [Schema.Types.Mixed],
//"node": "TreasureTutorial", "state": "TS_COMPLETED" //"node": "TreasureTutorial", "state": "TS_COMPLETED"
TauntHistory: [Schema.Types.Mixed], TauntHistory: [Schema.Types.Mixed],
//noShow2FA,VisitPrimeVault etc //noShow2FA,VisitPrimeVault etc
WebFlags: Schema.Types.Mixed, WebFlags: Schema.Types.Mixed,
//Id CompletedAlerts //Id CompletedAlerts
@ -508,7 +524,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
//Alert->Kuva Siphon //Alert->Kuva Siphon
PeriodicMissionCompletions: [Schema.Types.Mixed], PeriodicMissionCompletions: [Schema.Types.Mixed],
//Codex->LoreFragment //Codex->LoreFragment
LoreFragmentScans: [Schema.Types.Mixed], LoreFragmentScans: [Schema.Types.Mixed],
@ -530,12 +545,10 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
//If you want change Spectre Gear id //If you want change Spectre Gear id
PendingSpectreLoadouts: [Schema.Types.Mixed], PendingSpectreLoadouts: [Schema.Types.Mixed],
//New quest Email spam //New quest Email spam
//example:"ItemType": "/Lotus/Types/Keys/RailJackBuildQuest/RailjackBuildQuestEmailItem", //example:"ItemType": "/Lotus/Types/Keys/RailJackBuildQuest/RailjackBuildQuestEmailItem",
EmailItems: [Schema.Types.Mixed], EmailItems: [Schema.Types.Mixed],
//Profile->Wishlist //Profile->Wishlist
Wishlist: [String], Wishlist: [String],
@ -579,7 +592,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
//Night Wave Challenge //Night Wave Challenge
SeasonChallengeHistory: [Schema.Types.Mixed], SeasonChallengeHistory: [Schema.Types.Mixed],
//Cephalon Simaris Entries Example:"TargetType"+"Scans"(1-10)+"Completed": true|false //Cephalon Simaris Entries Example:"TargetType"+"Scans"(1-10)+"Completed": true|false
LibraryPersonalProgress: [Schema.Types.Mixed], LibraryPersonalProgress: [Schema.Types.Mixed],
//Cephalon Simaris Daily Task //Cephalon Simaris Daily Task
@ -611,7 +623,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
//TradeBannedUntil data //TradeBannedUntil data
TradeBannedUntil: Schema.Types.Mixed, TradeBannedUntil: Schema.Types.Mixed,
//https://warframe.fandom.com/wiki/Helminth //https://warframe.fandom.com/wiki/Helminth
InfestedFoundry: Schema.Types.Mixed, InfestedFoundry: Schema.Types.Mixed,
NextRefill: Schema.Types.Mixed, NextRefill: Schema.Types.Mixed,
@ -624,7 +635,6 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>({
//https://warframe.fandom.com/wiki/Incarnon //https://warframe.fandom.com/wiki/Incarnon
EvolutionProgress: [Schema.Types.Mixed], EvolutionProgress: [Schema.Types.Mixed],
//Unknown and system //Unknown and system
DuviriInfo: DuviriInfoSchema, DuviriInfo: DuviriInfoSchema,
Mailbox: MailboxSchema, Mailbox: MailboxSchema,
@ -685,13 +695,14 @@ type InventoryDocumentProps = {
MiscItems: Types.DocumentArray<IMiscItem>; MiscItems: Types.DocumentArray<IMiscItem>;
Boosters: Types.DocumentArray<IBooster>; Boosters: Types.DocumentArray<IBooster>;
OperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>; OperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>;
AdultOperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>; AdultOperatorLoadOuts: Types.DocumentArray<IOperatorConfigClient>; //TODO: this should still contain _id
MechSuits: Types.DocumentArray<ISuitDatabase>; MechSuits: Types.DocumentArray<ISuitDatabase>;
Scoops: Types.DocumentArray<IGenericItem>; Scoops: Types.DocumentArray<IGenericItem>;
DataKnives: Types.DocumentArray<IGenericItem>; DataKnives: Types.DocumentArray<IGenericItem>;
DrifterMelee: Types.DocumentArray<IGenericItem>; DrifterMelee: Types.DocumentArray<IGenericItem>;
Sentinels: Types.DocumentArray<IWeaponDatabase>; Sentinels: Types.DocumentArray<IWeaponDatabase>;
Horses: Types.DocumentArray<IGenericItem>; Horses: Types.DocumentArray<IGenericItem>;
PendingRecipes: Types.DocumentArray<IPendingRecipeDatabase>;
}; };
type InventoryModelType = Model<IInventoryDatabase, {}, InventoryDocumentProps>; type InventoryModelType = Model<IInventoryDatabase, {}, InventoryDocumentProps>;

View File

@ -35,6 +35,8 @@ import express from "express";
import { setBootLocationController } from "@/src/controllers/api/setBootLocationController"; import { setBootLocationController } from "@/src/controllers/api/setBootLocationController";
import { focusController } from "@/src/controllers/api/focusController"; import { focusController } from "@/src/controllers/api/focusController";
import { inventorySlotsController } from "@/src/controllers/api/inventorySlotsController"; import { inventorySlotsController } from "@/src/controllers/api/inventorySlotsController";
import { startRecipeController } from "@/src/controllers/api/startRecipeController";
import { claimCompletedRecipeController } from "@/src/controllers/api/claimCompletedRecipeController";
const apiRouter = express.Router(); const apiRouter = express.Router();
@ -62,6 +64,9 @@ apiRouter.get("/logout.php", logoutController);
apiRouter.get("/setBootLocation.php", setBootLocationController); apiRouter.get("/setBootLocation.php", setBootLocationController);
// post // post
// eslint-disable-next-line @typescript-eslint/no-misused-promises
apiRouter.post("/claimCompletedRecipe.php", claimCompletedRecipeController);
apiRouter.post("/startRecipe.php", startRecipeController);
apiRouter.post("/inventorySlots.php", inventorySlotsController); apiRouter.post("/inventorySlots.php", inventorySlotsController);
apiRouter.post("/focus.php", focusController); apiRouter.post("/focus.php", focusController);
apiRouter.post("/artifacts.php", artifactsController); apiRouter.post("/artifacts.php", artifactsController);

View File

@ -17,6 +17,7 @@ import {
import { IGenericUpdate } from "../types/genericUpdate"; import { IGenericUpdate } from "../types/genericUpdate";
import { IArtifactsRequest, IMissionInventoryUpdateRequest } from "../types/requestTypes"; import { IArtifactsRequest, IMissionInventoryUpdateRequest } from "../types/requestTypes";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";
import { WeaponTypeInternal } from "@/src/services/itemDataService";
export const createInventory = async (accountOwnerId: Types.ObjectId, loadOutPresetId: Types.ObjectId) => { export const createInventory = async (accountOwnerId: Types.ObjectId, loadOutPresetId: Types.ObjectId) => {
try { try {
@ -145,8 +146,6 @@ export const updateGeneric = async (data: IGenericUpdate, accountId: string) =>
return data; return data;
}; };
export type WeaponTypeInternal = "LongGuns" | "Pistols" | "Melee";
export const addWeapon = async ( export const addWeapon = async (
weaponType: WeaponTypeInternal, weaponType: WeaponTypeInternal,
weaponName: string, weaponName: string,

View File

@ -0,0 +1,93 @@
import { logger } from "@/src/utils/logger";
import Items, { Buildable, Category, Item, Warframe, Weapon } from "warframe-items";
import { log } from "winston";
type MinWeapon = Omit<Weapon, "patchlogs">;
type MinItem = Omit<Item, "patchlogs">;
export const weapons: MinWeapon[] = (new Items({ category: ["Primary", "Secondary", "Melee"] }) as Weapon[]).map(
item => {
const next = { ...item };
delete next.patchlogs;
return next;
}
);
export type WeaponTypeInternal = "LongGuns" | "Pistols" | "Melee";
export const items: MinItem[] = new Items({ category: ["All"] }).map(item => {
const next = { ...item };
delete next.patchlogs;
return next;
});
export const getWeaponType = (weaponName: string) => {
const weaponInfo = weapons.find(i => i.uniqueName === weaponName);
if (!weaponInfo) {
throw new Error(`unknown weapon ${weaponName}`);
}
const weaponType = weaponInfo.productCategory as WeaponTypeInternal;
if (!weaponType) {
logger.error(`unknown weapon category for item ${weaponName}`);
throw new Error(`unknown weapon category for item ${weaponName}`);
}
return weaponType;
};
const getNamesObj = (category: Category) =>
new Items({ category: [category] }).reduce<{ [index: string]: string }>((acc, item) => {
acc[item.name!.replace("'S", "'s")] = item.uniqueName!;
return acc;
}, {});
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");
//logger.debug(`gear names`, { gearNames });
export const craftNames = 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])
);
export const blueprintNames = Object.fromEntries(
Object.keys(craftNames)
.filter(name => name.includes("Blueprint"))
.map(name => [name, craftNames[name]])
);
const items2 = new Items({
category: ["Warframes", "Gear", "Melee", "Primary", "Secondary", "Sentinels", "Misc", "Arch-Gun", "Arch-Melee"]
});
items2.flatMap(item => item.components || []);
// for (const item of items2) {
// console.log(item.category === "Warframes");
// if (item.category === "Warframes") {
// console.log(item);
// }
// }

View File

@ -1,7 +1,14 @@
import { IMissionRewardResponse, IReward, IInventoryFieldType, inventoryFields } from "@/src/types/missionTypes"; import { IMissionRewardResponse, IReward, IInventoryFieldType, inventoryFields } from "@/src/types/missionTypes";
import missionsDropTable from "@/static/json/missions-drop-table.json"; import missionsDropTable from "@/static/json/missions-drop-table.json";
import { modNames, relicNames, miscNames, resourceNames, gearNames, blueprintNames } from "@/static/data/items"; import {
modNames,
relicNames,
miscNames,
resourceNames,
gearNames,
blueprintNames
} from "@/src/services/itemDataService";
import { IMissionInventoryUpdateRequest } from "../types/requestTypes"; import { IMissionInventoryUpdateRequest } from "../types/requestTypes";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";

View File

@ -1,4 +1,5 @@
import { getWeaponType, parseSlotPurchaseName } from "@/src/helpers/purchaseHelpers"; import { parseSlotPurchaseName } from "@/src/helpers/purchaseHelpers";
import { getWeaponType } from "@/src/services/itemDataService";
import { getSubstringFromKeyword } from "@/src/helpers/stringHelpers"; import { getSubstringFromKeyword } from "@/src/helpers/stringHelpers";
import { import {
addBooster, addBooster,

View File

@ -0,0 +1,20 @@
import { getInventory } from "@/src/services/inventoryService";
import { Types } from "mongoose";
export const startRecipe = async (recipeName: string, accountId: string) => {
//get recipe data
//consume resources
const inventory = await getInventory(accountId);
inventory.PendingRecipes.push({
ItemType: recipeName,
CompletionDate: new Date(),
_id: new Types.ObjectId()
});
const newInventory = await inventory.save();
return {
RecipeId: { $oid: newInventory.PendingRecipes[newInventory.PendingRecipes.length - 1]._id?.toString() }
};
};

View File

@ -14,11 +14,13 @@ import { IOperatorLoadOutSigcol, IWeaponDatabase } from "@/src/types/inventoryTy
//Document extends will be deleted soon. TODO: delete and migrate uses to ... //Document extends will be deleted soon. TODO: delete and migrate uses to ...
export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {} export interface IInventoryDatabaseDocument extends IInventoryDatabase, Document {}
export interface IInventoryDatabase extends Omit<IInventoryResponse, "TrainingDate" | "LoadOutPresets" | "Mailbox"> { export interface IInventoryDatabase
extends Omit<IInventoryResponse, "TrainingDate" | "LoadOutPresets" | "Mailbox" | "PendingRecipes"> {
accountOwnerId: Types.ObjectId; accountOwnerId: Types.ObjectId;
TrainingDate: Date; // TrainingDate changed from IMongoDate to Date TrainingDate: Date; // TrainingDate changed from IMongoDate to Date
LoadOutPresets: Types.ObjectId; // LoadOutPresets changed from ILoadOutPresets to Types.ObjectId for population LoadOutPresets: Types.ObjectId; // LoadOutPresets changed from ILoadOutPresets to Types.ObjectId for population
Mailbox: Types.ObjectId; // Mailbox changed from IMailbox to Types.ObjectId Mailbox: Types.ObjectId; // Mailbox changed from IMailbox to Types.ObjectId
PendingRecipes: IPendingRecipe[];
} }
export interface IInventoryResponseDocument extends IInventoryResponse, Document {} export interface IInventoryResponseDocument extends IInventoryResponse, Document {}
@ -41,6 +43,11 @@ export interface IMailbox {
LastInboxId: IOid; LastInboxId: IOid;
} }
//TODO: perhaps split response and database into their own files
export interface IPendingRecipeResponse extends Omit<IPendingRecipe, "CompletionDate"> {
CompletionDate: IMongoDate;
}
export interface IInventoryResponse { export interface IInventoryResponse {
Horses: IGenericItem[]; Horses: IGenericItem[];
DrifterMelee: IGenericItem[]; DrifterMelee: IGenericItem[];
@ -96,7 +103,7 @@ export interface IInventoryResponse {
XPInfo: IEmailItem[]; XPInfo: IEmailItem[];
Recipes: IConsumable[]; Recipes: IConsumable[];
WeaponSkins: IWeaponSkin[]; WeaponSkins: IWeaponSkin[];
PendingRecipes: IPendingRecipe[]; PendingRecipes: IPendingRecipeResponse[];
TrainingDate: IMongoDate; TrainingDate: IMongoDate;
PlayerLevel: number; PlayerLevel: number;
Upgrades: ICrewShipSalvagedWeaponSkin[]; Upgrades: ICrewShipSalvagedWeaponSkin[];
@ -816,7 +823,7 @@ export interface IPendingCoupon {
export interface IPendingRecipe { export interface IPendingRecipe {
ItemType: string; ItemType: string;
CompletionDate: IMongoDate; CompletionDate: Date;
ItemId: IOid; ItemId: IOid;
} }

View File

@ -1,60 +0,0 @@
import Items, { Category, Item, Warframe, Weapon } from "warframe-items";
type MinWeapon = Omit<Weapon, "patchlogs">;
type MinItem = Omit<Item, "patchlogs">;
export const weapons: MinWeapon[] = (new Items({ category: ["Primary", "Secondary", "Melee"] }) as Weapon[]).map(
item => {
const next = { ...item };
delete next.patchlogs;
return next;
}
);
export const items: MinItem[] = new Items({ category: ["All"] }).map(item => {
const next = { ...item };
delete next.patchlogs;
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]])
);