fix giveKeyChainTriggeredItems
This commit is contained in:
parent
eff6d495fc
commit
643eaf35c5
@ -9,8 +9,8 @@ const giveKeyChainTriggeredItemsController: RequestHandler = async (req, res) =>
|
|||||||
const accountId = await getAccountIdForRequest(req);
|
const accountId = await getAccountIdForRequest(req);
|
||||||
const payload = getJSONfromString(req.body as string) as IGiveKeyChainTriggeredItemsRequest;
|
const payload = getJSONfromString(req.body as string) as IGiveKeyChainTriggeredItemsRequest;
|
||||||
const result = await giveKeyChainTriggeredItems(accountId, payload.KeyChain, payload.ChainStage);
|
const result = await giveKeyChainTriggeredItems(accountId, payload.KeyChain, payload.ChainStage);
|
||||||
if (result != null) res.json(result);
|
if (result) res.json(result);
|
||||||
else res.status(200).end();
|
else res.json([]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { giveKeyChainTriggeredItemsController };
|
export { giveKeyChainTriggeredItemsController };
|
||||||
|
@ -2,7 +2,8 @@ import { IInventoryDatabaseDocument, IQuestKeyDatabase } from "@/src/types/inven
|
|||||||
import { IUpdateQuestRequest, IUpdateQuestResponse } from "@/src/types/questTypes";
|
import { IUpdateQuestRequest, IUpdateQuestResponse } from "@/src/types/questTypes";
|
||||||
import { addItem, getInventory } from "@/src/services/inventoryService";
|
import { addItem, getInventory } from "@/src/services/inventoryService";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { ExportKeys } from "warframe-public-export-plus";
|
import { ExportKeys, ExportRecipes } from "warframe-public-export-plus";
|
||||||
|
import { ItemType } from "../helpers/customHelpers/addItemHelpers";
|
||||||
|
|
||||||
export const setActiveQuest = async (accountId: string, quest: string) => {
|
export const setActiveQuest = async (accountId: string, quest: string) => {
|
||||||
const inventory = await getInventory(accountId);
|
const inventory = await getInventory(accountId);
|
||||||
@ -79,14 +80,24 @@ export const giveKeyChainTriggeredItems = async (accountId: string, keyChain: st
|
|||||||
const quest = ExportKeys[keyChain];
|
const quest = ExportKeys[keyChain];
|
||||||
|
|
||||||
if (quest.chainStages) {
|
if (quest.chainStages) {
|
||||||
for (const chainStage of quest.chainStages) {
|
const stage = quest.chainStages[chainStage];
|
||||||
if (chainStage.itemsToGiveWhenTriggered.length > 0) {
|
if (stage.itemsToGiveWhenTriggered.length > 0) {
|
||||||
let itemType = chainStage.itemsToGiveWhenTriggered[0];
|
let itemType = stage.itemsToGiveWhenTriggered[0];
|
||||||
if (itemType.indexOf("") > 0) {
|
if (itemType.indexOf("") > 0) {
|
||||||
itemType = itemType.replace("/Lotus/StoreItems/", "/Lotus/");
|
itemType = itemType.replace("/Lotus/StoreItems/", "/Lotus/");
|
||||||
}
|
}
|
||||||
await addItem(accountId, itemType, 1);
|
await addItem(accountId, itemType, 1);
|
||||||
|
|
||||||
|
if (itemType in ExportRecipes) {
|
||||||
|
return {
|
||||||
|
Recipes: [{
|
||||||
|
ItemType: itemType,
|
||||||
|
ItemCount: 1
|
||||||
|
}]
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// more
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user