Compare commits

..

No commits in common. "79ac6eef40da58805d7459795dad38004e6564fb" and "ead7b67efc8b2a2d96220339a233225c5d0c2d78" have entirely different histories.

7 changed files with 15 additions and 111 deletions

8
package-lock.json generated
View File

@ -17,7 +17,7 @@
"mongoose": "^8.11.0",
"morgan": "^1.10.0",
"typescript": ">=4.7.4 <5.6.0",
"warframe-public-export-plus": "^0.5.43",
"warframe-public-export-plus": "^0.5.42",
"warframe-riven-info": "^0.1.2",
"winston": "^3.17.0",
"winston-daily-rotate-file": "^5.0.0"
@ -4073,9 +4073,9 @@
}
},
"node_modules/warframe-public-export-plus": {
"version": "0.5.43",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.43.tgz",
"integrity": "sha512-LeF7HmsjOPsJDtgr66x3iMEIAQgcxKNM54VG895FTemgHLLo34UGDyeS1yIfY67WxxbTUgW3MkHQLlCEJXD14w=="
"version": "0.5.42",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.42.tgz",
"integrity": "sha512-up3P5bLKD42Xkr3o7TX9WUwvpJzK88aQTLZ2bB6QWUHdsJxl/Z3TBn+HSd3eouIDTMVUzbTDeDPosSw7TcLegA=="
},
"node_modules/warframe-riven-info": {
"version": "0.1.2",

View File

@ -22,7 +22,7 @@
"mongoose": "^8.11.0",
"morgan": "^1.10.0",
"typescript": ">=4.7.4 <5.6.0",
"warframe-public-export-plus": "^0.5.43",
"warframe-public-export-plus": "^0.5.42",
"warframe-riven-info": "^0.1.2",
"winston": "^3.17.0",
"winston-daily-rotate-file": "^5.0.0"

View File

@ -2,14 +2,7 @@ import { RequestHandler } from "express";
import { getGuildForRequestEx, getGuildVault, scaleRequiredCount } from "@/src/services/guildService";
import { ExportDojoRecipes, IDojoResearch } from "warframe-public-export-plus";
import { getAccountIdForRequest } from "@/src/services/loginService";
import {
addItem,
addMiscItems,
addRecipes,
combineInventoryChanges,
getInventory,
updateCurrency
} from "@/src/services/inventoryService";
import { addMiscItems, addRecipes, getInventory, updateCurrency } from "@/src/services/inventoryService";
import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes";
import { IInventoryChanges } from "@/src/types/purchaseTypes";
import { config } from "@/src/services/configService";
@ -134,20 +127,6 @@ export const guildTechController: RequestHandler = async (req, res) => {
Recipes: recipeChanges
}
});
} else if (action == "Fabricate") {
const payload = data as IGuildTechFabricateRequest;
const recipe = ExportDojoRecipes.fabrications[payload.RecipeType];
const inventory = await getInventory(accountId);
const inventoryChanges: IInventoryChanges = updateCurrency(inventory, recipe.price, false);
inventoryChanges.MiscItems = recipe.ingredients.map(x => ({
ItemType: x.ItemType,
ItemCount: x.ItemCount * -1
}));
addMiscItems(inventory, inventoryChanges.MiscItems);
combineInventoryChanges(inventoryChanges, (await addItem(inventory, recipe.resultType)).InventoryChanges);
await inventory.save();
// Not a mistake: This response uses `inventoryChanges` instead of `InventoryChanges`.
res.json({ inventoryChanges: inventoryChanges });
} else {
throw new Error(`unknown guildTech action: ${data.Action}`);
}
@ -165,12 +144,10 @@ const processFundedProject = (
}
};
type TGuildTechRequest =
| ({
Action: string;
} & Partial<IGuildTechStartFields> &
Partial<IGuildTechContributeFields>)
| IGuildTechFabricateRequest;
type TGuildTechRequest = {
Action: string;
} & Partial<IGuildTechStartFields> &
Partial<IGuildTechContributeFields>;
interface IGuildTechStartFields {
Mode: "Guild";
@ -187,9 +164,3 @@ interface IGuildTechContributeFields {
VaultCredits: number;
VaultMiscItems: IMiscItem[];
}
interface IGuildTechFabricateRequest {
Action: "Fabricate";
Mode: "Guild";
RecipeType: string;
}

View File

@ -6,7 +6,6 @@ import {
ExportDrones,
ExportGear,
ExportMisc,
ExportRailjackWeapons,
ExportRecipes,
ExportRelics,
ExportResources,
@ -161,12 +160,6 @@ const getItemListsController: RequestHandler = (req, response) => {
name: getString(item.name, lang)
});
}
for (const [uniqueName, item] of Object.entries(ExportRailjackWeapons)) {
res.miscitems.push({
uniqueName: uniqueName,
name: getString(item.name, lang)
});
}
res.mods = [];
for (const [uniqueName, upgrade] of Object.entries(ExportUpgrades)) {

View File

@ -75,8 +75,7 @@ import {
ICollectibleEntry,
IIncentiveState,
ISongChallenge,
ILibraryPersonalProgress,
ICrewShipWeaponDatabase
ILibraryPersonalProgress
} from "../../types/inventoryTypes/inventoryTypes";
import { IOid } from "../../types/commonTypes";
import {
@ -1038,25 +1037,6 @@ const alignmentSchema = new Schema<IAlignment>(
{ _id: false }
);
const crewShipWeaponSchema2 = new Schema<ICrewShipWeaponDatabase>(
{
ItemType: String
},
{ id: false }
);
crewShipWeaponSchema2.virtual("ItemId").get(function () {
return { $oid: this._id.toString() } satisfies IOid;
});
crewShipWeaponSchema2.set("toJSON", {
virtuals: true,
transform(_document, returnedObject) {
delete returnedObject._id;
delete returnedObject.__v;
}
});
const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
{
accountOwnerId: Schema.Types.ObjectId,
@ -1177,7 +1157,7 @@ const inventorySchema = new Schema<IInventoryDatabase, InventoryDocumentProps>(
//Default RailJack
CrewShipAmmo: [typeCountSchema],
CrewShipWeapons: [crewShipWeaponSchema2],
CrewShipWeapons: [Schema.Types.Mixed],
CrewShipWeaponSkins: [upgradeSchema],
//NPC Crew and weapon
@ -1424,7 +1404,6 @@ export type InventoryDocumentProps = {
WeaponSkins: Types.DocumentArray<IWeaponSkinDatabase>;
QuestKeys: Types.DocumentArray<IQuestKeyDatabase>;
Drones: Types.DocumentArray<IDroneDatabase>;
CrewShipWeapons: Types.DocumentArray<ICrewShipWeaponDatabase>;
CrewShipWeaponSkins: Types.DocumentArray<IUpgradeDatabase>;
} & { [K in TEquipmentKey]: Types.DocumentArray<IEquipmentDatabase> };

View File

@ -26,8 +26,7 @@ import {
ILibraryDailyTaskInfo,
ICalendarProgress,
IDroneClient,
IUpgradeClient,
ICrewShipWeaponClient
IUpgradeClient
} from "@/src/types/inventoryTypes/inventoryTypes";
import { IGenericUpdate } from "../types/genericUpdate";
import {
@ -55,7 +54,6 @@ import {
ExportGear,
ExportKeys,
ExportMisc,
ExportRailjackWeapons,
ExportRecipes,
ExportResources,
ExportSentinels,
@ -388,12 +386,6 @@ export const addItem = async (
};
}
}
if (typeName in ExportRailjackWeapons) {
// I'm not sure if these use a slot. Maybe CrewShipSalvageBin?
return {
InventoryChanges: addCrewShipWeapon(inventory, typeName)
};
}
if (typeName in ExportMisc.creditBundles) {
const creditsTotal = ExportMisc.creditBundles[typeName] * quantity;
inventory.RegularCredits += creditsTotal;
@ -867,7 +859,6 @@ export const addCustomization = (
inventoryChanges: IInventoryChanges = {}
): IInventoryChanges => {
const flavourItemIndex = inventory.FlavourItems.push({ ItemType: customizationName }) - 1;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
inventoryChanges.FlavourItems ??= [];
(inventoryChanges.FlavourItems as IFlavourItem[]).push(
inventory.FlavourItems[flavourItemIndex].toJSON<IFlavourItem>()
@ -881,7 +872,6 @@ export const addSkin = (
inventoryChanges: IInventoryChanges = {}
): IInventoryChanges => {
const index = inventory.WeaponSkins.push({ ItemType: typeName }) - 1;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
inventoryChanges.WeaponSkins ??= [];
(inventoryChanges.WeaponSkins as IWeaponSkinClient[]).push(
inventory.WeaponSkins[index].toJSON<IWeaponSkinClient>()
@ -889,27 +879,12 @@ export const addSkin = (
return inventoryChanges;
};
const addCrewShipWeapon = (
inventory: TInventoryDatabaseDocument,
typeName: string,
inventoryChanges: IInventoryChanges = {}
): IInventoryChanges => {
const index = inventory.CrewShipWeapons.push({ ItemType: typeName, _id: new Types.ObjectId() }) - 1;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
inventoryChanges.CrewShipWeapons ??= [];
(inventoryChanges.CrewShipWeapons as ICrewShipWeaponClient[]).push(
inventory.CrewShipWeapons[index].toJSON<ICrewShipWeaponClient>()
);
return inventoryChanges;
};
const addCrewShipWeaponSkin = (
inventory: TInventoryDatabaseDocument,
typeName: string,
inventoryChanges: IInventoryChanges = {}
): IInventoryChanges => {
const index = inventory.CrewShipWeaponSkins.push({ ItemType: typeName }) - 1;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
inventoryChanges.CrewShipWeaponSkins ??= [];
(inventoryChanges.CrewShipWeaponSkins as IUpgradeClient[]).push(
inventory.CrewShipWeaponSkins[index].toJSON<IUpgradeClient>()

View File

@ -31,7 +31,6 @@ export interface IInventoryDatabase
| "WeaponSkins"
| "Upgrades"
| "CrewShipSalvagedWeaponSkins"
| "CrewShipWeapons"
| "CrewShipWeaponSkins"
| "AdultOperatorLoadOuts"
| "OperatorLoadOuts"
@ -57,7 +56,6 @@ export interface IInventoryDatabase
WeaponSkins: IWeaponSkinDatabase[];
Upgrades: IUpgradeDatabase[];
CrewShipSalvagedWeaponSkins: IUpgradeDatabase[];
CrewShipWeapons: ICrewShipWeaponDatabase[];
CrewShipWeaponSkins: IUpgradeDatabase[];
AdultOperatorLoadOuts: IOperatorConfigDatabase[];
OperatorLoadOuts: IOperatorConfigDatabase[];
@ -291,8 +289,8 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu
PlayerSkills: IPlayerSkills;
CrewShipAmmo: IConsumable[];
CrewShipSalvagedWeaponSkins: IUpgradeClient[];
CrewShipWeapons: ICrewShipWeaponClient[];
CrewShipSalvagedWeapons: IEquipmentClient[];
CrewShipWeapons: ICrewShipWeapon[];
CrewShipSalvagedWeapons: ICrewShipWeapon[];
CrewShipWeaponSkins: IUpgradeClient[];
TradeBannedUntil?: IMongoDate;
PlayedParkourTutorial: boolean;
@ -491,23 +489,11 @@ export interface IFlavourItem {
export type IMiscItem = ITypeCount;
// inventory.CrewShips[0].Weapon
export interface ICrewShipWeapon {
PILOT: ICrewShipPilotWeapon;
PORT_GUNS: ICrewShipPortGuns;
}
// inventory.CrewShipWeapons
export interface ICrewShipWeaponClient {
ItemType: string;
ItemId: IOid;
}
export interface ICrewShipWeaponDatabase {
ItemType: string;
_id: Types.ObjectId;
}
export interface ICrewShipPilotWeapon {
PRIMARY_A: IEquipmentSelection;
SECONDARY_A: IEquipmentSelection;