fix: not being able to purchase or craft some recipes #314
@ -48,6 +48,9 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
|
|||||||
res.json({});
|
res.json({});
|
||||||
} else {
|
} else {
|
||||||
logger.debug("Claiming Recipe", { buildable, pendingRecipe });
|
logger.debug("Claiming Recipe", { buildable, pendingRecipe });
|
||||||
|
if (buildable.consumeOnUse) {
|
||||||
|
// TODO: Remove one instance of this recipe, and include that in InventoryChanges.
|
||||||
|
}
|
||||||
let currencyChanges = {};
|
let currencyChanges = {};
|
||||||
if (req.query.rush && buildable.skipBuildTimePrice) {
|
if (req.query.rush && buildable.skipBuildTimePrice) {
|
||||||
currencyChanges = await updateCurrency(buildable.skipBuildTimePrice, true, accountId);
|
currencyChanges = await updateCurrency(buildable.skipBuildTimePrice, true, accountId);
|
||||||
@ -55,7 +58,7 @@ export const claimCompletedRecipeController: RequestHandler = async (req, res) =
|
|||||||
res.json({
|
res.json({
|
||||||
InventoryChanges: {
|
InventoryChanges: {
|
||||||
...currencyChanges,
|
...currencyChanges,
|
||||||
...(await addItem(accountId, buildable.uniqueName, buildable.buildQuantity)).InventoryChanges
|
...(await addItem(accountId, buildable.resultType, buildable.num)).InventoryChanges
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,14 @@ import { getIndexAfter } from "@/src/helpers/stringHelpers";
|
|||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import Items, { Buildable, Category, MinimalItem, Warframe, Weapon } from "warframe-items";
|
import Items, { Buildable, Category, MinimalItem, Warframe, Weapon } from "warframe-items";
|
||||||
import badItems from "@/static/json/exclude-mods.json";
|
import badItems from "@/static/json/exclude-mods.json";
|
||||||
import { dict_en, ExportWarframes, ExportWeapons, IPowersuit } from "warframe-public-export-plus";
|
import {
|
||||||
|
dict_en,
|
||||||
|
ExportRecipes,
|
||||||
|
ExportWarframes,
|
||||||
|
ExportWeapons,
|
||||||
|
IPowersuit,
|
||||||
|
IRecipe
|
||||||
|
} from "warframe-public-export-plus";
|
||||||
|
|
||||||
export type MinWarframe = Omit<Warframe, "patchlogs">;
|
export type MinWarframe = Omit<Warframe, "patchlogs">;
|
||||||
export type MinWeapon = Omit<Weapon, "patchlogs">;
|
export type MinWeapon = Omit<Weapon, "patchlogs">;
|
||||||
@ -102,11 +109,9 @@ export const blueprintNames = Object.fromEntries(
|
|||||||
|
|
||||||
const buildables = items.filter(item => !!(item as Buildable).components);
|
const buildables = items.filter(item => !!(item as Buildable).components);
|
||||||
|
|
||||||
export const getItemByBlueprint = (uniqueName: string): (MinItem & Buildable) | undefined => {
|
// Gets a recipe by its uniqueName
|
||||||
const item = buildables.find(item =>
|
export const getItemByBlueprint = (uniqueName: string): IRecipe | undefined => {
|
||||||
(item as Buildable).components?.find(component => component.uniqueName === uniqueName)
|
return ExportRecipes[uniqueName];
|
||||||
);
|
|
||||||
return item;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getExalted = (uniqueName: string) => {
|
export const getExalted = (uniqueName: string) => {
|
||||||
|
@ -34,9 +34,9 @@ export const startRecipe = async (recipeName: string, accountId: string) => {
|
|||||||
throw new Error(`unknown recipe ${recipeName}`);
|
throw new Error(`unknown recipe ${recipeName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const componentsNeeded = recipe.components?.map(component => ({
|
const componentsNeeded = recipe.ingredients.map(component => ({
|
||||||
uniqueName: component.uniqueName,
|
uniqueName: component.ItemType,
|
||||||
count: component.itemCount
|
count: component.ItemCount
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (!componentsNeeded) {
|
if (!componentsNeeded) {
|
||||||
@ -47,11 +47,6 @@ export const startRecipe = async (recipeName: string, accountId: string) => {
|
|||||||
//TODO: consume components used
|
//TODO: consume components used
|
||||||
//await updateResources(accountId, componentsNeeded);
|
//await updateResources(accountId, componentsNeeded);
|
||||||
|
|
||||||
//might be redundant
|
|
||||||
if (recipe.consumeOnBuild) {
|
|
||||||
//consume
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!recipe.buildTime) {
|
if (!recipe.buildTime) {
|
||||||
logger.error(`recipe ${recipeName} has no build time`);
|
logger.error(`recipe ${recipeName} has no build time`);
|
||||||
throw new Error(`recipe ${recipeName} has no build time`);
|
throw new Error(`recipe ${recipeName} has no build time`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user