fix: give non-exalted additional items when acquiring warframe #1408
@ -16,7 +16,6 @@
 | 
			
		||||
        "@typescript-eslint/restrict-plus-operands": "warn",
 | 
			
		||||
        "@typescript-eslint/no-unsafe-member-access": "warn",
 | 
			
		||||
        "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "caughtErrors": "none" }],
 | 
			
		||||
        "@typescript-eslint/no-misused-promises": "warn",
 | 
			
		||||
        "@typescript-eslint/no-unsafe-argument": "error",
 | 
			
		||||
        "@typescript-eslint/no-unsafe-call": "warn",
 | 
			
		||||
        "@typescript-eslint/no-unsafe-assignment": "warn",
 | 
			
		||||
 | 
			
		||||
@ -53,7 +53,7 @@ export const addStartingGear = async (
 | 
			
		||||
    addEquipment(inventory, "LongGuns", LongGuns[0].ItemType, undefined, inventoryChanges);
 | 
			
		||||
    addEquipment(inventory, "Pistols", Pistols[0].ItemType, undefined, inventoryChanges);
 | 
			
		||||
    addEquipment(inventory, "Melee", Melee[0].ItemType, undefined, inventoryChanges);
 | 
			
		||||
    addPowerSuit(inventory, Suits[0].ItemType, inventoryChanges);
 | 
			
		||||
    await addPowerSuit(inventory, Suits[0].ItemType, inventoryChanges);
 | 
			
		||||
    addEquipment(
 | 
			
		||||
        inventory,
 | 
			
		||||
        "DataKnives",
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ import {
 | 
			
		||||
import { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate";
 | 
			
		||||
import { IMissionInventoryUpdateRequest } from "../types/requestTypes";
 | 
			
		||||
import { logger } from "@/src/utils/logger";
 | 
			
		||||
import { convertInboxMessage, fromStoreItem, getExalted, getKeyChainItems } from "@/src/services/itemDataService";
 | 
			
		||||
import { convertInboxMessage, fromStoreItem, getKeyChainItems } from "@/src/services/itemDataService";
 | 
			
		||||
import {
 | 
			
		||||
    EquipmentFeatures,
 | 
			
		||||
    IEquipmentClient,
 | 
			
		||||
@ -55,8 +55,10 @@ import {
 | 
			
		||||
    ExportSentinels,
 | 
			
		||||
    ExportSyndicates,
 | 
			
		||||
    ExportUpgrades,
 | 
			
		||||
    ExportWarframes,
 | 
			
		||||
    ExportWeapons,
 | 
			
		||||
    IDefaultUpgrade,
 | 
			
		||||
    IPowersuit,
 | 
			
		||||
    TStandingLimitBin
 | 
			
		||||
} from "warframe-public-export-plus";
 | 
			
		||||
import { createShip } from "./shipService";
 | 
			
		||||
@ -481,12 +483,12 @@ export const addItem = async (
 | 
			
		||||
            switch (typeName.substr(1).split("/")[2]) {
 | 
			
		||||
                default: {
 | 
			
		||||
                    return {
 | 
			
		||||
                        ...addPowerSuit(
 | 
			
		||||
                        ...(await addPowerSuit(
 | 
			
		||||
                            inventory,
 | 
			
		||||
                            typeName,
 | 
			
		||||
                            {},
 | 
			
		||||
                            premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
 | 
			
		||||
                        ),
 | 
			
		||||
                        )),
 | 
			
		||||
                        ...occupySlot(inventory, InventorySlot.SUITS, premiumPurchase)
 | 
			
		||||
                    };
 | 
			
		||||
                }
 | 
			
		||||
@ -697,20 +699,33 @@ const addSentinelWeapon = (
 | 
			
		||||
    inventoryChanges.SentinelWeapons.push(inventory.SentinelWeapons[index].toJSON<IEquipmentClient>());
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const addPowerSuit = (
 | 
			
		||||
export const addPowerSuit = async (
 | 
			
		||||
    inventory: TInventoryDatabaseDocument,
 | 
			
		||||
    powersuitName: string,
 | 
			
		||||
    inventoryChanges: IInventoryChanges = {},
 | 
			
		||||
    features: number | undefined = undefined
 | 
			
		||||
): IInventoryChanges => {
 | 
			
		||||
    const specialItems = getExalted(powersuitName);
 | 
			
		||||
    if (specialItems) {
 | 
			
		||||
        for (const specialItem of specialItems) {
 | 
			
		||||
            addSpecialItem(inventory, specialItem, inventoryChanges);
 | 
			
		||||
): Promise<IInventoryChanges> => {
 | 
			
		||||
    const powersuit = ExportWarframes[powersuitName] as IPowersuit | undefined;
 | 
			
		||||
    const exalted = powersuit?.exalted ?? [];
 | 
			
		||||
    for (const specialItem of exalted) {
 | 
			
		||||
        addSpecialItem(inventory, specialItem, inventoryChanges);
 | 
			
		||||
    }
 | 
			
		||||
    if (powersuit?.additionalItems) {
 | 
			
		||||
        for (const item of powersuit.additionalItems) {
 | 
			
		||||
            if (exalted.indexOf(item) == -1) {
 | 
			
		||||
                combineInventoryChanges(inventoryChanges, await addItem(inventory, item, 1));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    const suitIndex =
 | 
			
		||||
        inventory.Suits.push({ ItemType: powersuitName, Configs: [], UpgradeVer: 101, XP: 0, Features: features }) - 1;
 | 
			
		||||
        inventory.Suits.push({
 | 
			
		||||
            ItemType: powersuitName,
 | 
			
		||||
            Configs: [],
 | 
			
		||||
            UpgradeVer: 101,
 | 
			
		||||
            XP: 0,
 | 
			
		||||
            Features: features,
 | 
			
		||||
            IsNew: true
 | 
			
		||||
        }) - 1;
 | 
			
		||||
    inventoryChanges.Suits ??= [];
 | 
			
		||||
    inventoryChanges.Suits.push(inventory.Suits[suitIndex].toJSON<IEquipmentClient>());
 | 
			
		||||
    return inventoryChanges;
 | 
			
		||||
@ -722,15 +737,21 @@ export const addMechSuit = (
 | 
			
		||||
    inventoryChanges: IInventoryChanges = {},
 | 
			
		||||
    features: number | undefined = undefined
 | 
			
		||||
): IInventoryChanges => {
 | 
			
		||||
    const specialItems = getExalted(mechsuitName);
 | 
			
		||||
    if (specialItems) {
 | 
			
		||||
        for (const specialItem of specialItems) {
 | 
			
		||||
    const powersuit = ExportWarframes[mechsuitName] as IPowersuit | undefined;
 | 
			
		||||
    if (powersuit?.exalted) {
 | 
			
		||||
        for (const specialItem of powersuit.exalted) {
 | 
			
		||||
            addSpecialItem(inventory, specialItem, inventoryChanges);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    const suitIndex =
 | 
			
		||||
        inventory.MechSuits.push({ ItemType: mechsuitName, Configs: [], UpgradeVer: 101, XP: 0, Features: features }) -
 | 
			
		||||
        1;
 | 
			
		||||
        inventory.MechSuits.push({
 | 
			
		||||
            ItemType: mechsuitName,
 | 
			
		||||
            Configs: [],
 | 
			
		||||
            UpgradeVer: 101,
 | 
			
		||||
            XP: 0,
 | 
			
		||||
            Features: features,
 | 
			
		||||
            IsNew: true
 | 
			
		||||
        }) - 1;
 | 
			
		||||
    inventoryChanges.MechSuits ??= [];
 | 
			
		||||
    inventoryChanges.MechSuits.push(inventory.MechSuits[suitIndex].toJSON<IEquipmentClient>());
 | 
			
		||||
    return inventoryChanges;
 | 
			
		||||
@ -768,7 +789,8 @@ export const addSpaceSuit = (
 | 
			
		||||
            Configs: [],
 | 
			
		||||
            UpgradeVer: 101,
 | 
			
		||||
            XP: 0,
 | 
			
		||||
            Features: features
 | 
			
		||||
            Features: features,
 | 
			
		||||
            IsNew: true
 | 
			
		||||
        }) - 1;
 | 
			
		||||
    inventoryChanges.SpaceSuits ??= [];
 | 
			
		||||
    inventoryChanges.SpaceSuits.push(inventory.SpaceSuits[suitIndex].toJSON<IEquipmentClient>());
 | 
			
		||||
 | 
			
		||||
@ -31,7 +31,6 @@ import {
 | 
			
		||||
    IDefaultUpgrade,
 | 
			
		||||
    IInboxMessage,
 | 
			
		||||
    IMissionReward,
 | 
			
		||||
    IPowersuit,
 | 
			
		||||
    IRecipe,
 | 
			
		||||
    TReward
 | 
			
		||||
} from "warframe-public-export-plus";
 | 
			
		||||
@ -56,10 +55,6 @@ export const getRecipeByResult = (resultType: string): IRecipe | undefined => {
 | 
			
		||||
    return Object.values(ExportRecipes).find(x => x.resultType == resultType);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const getExalted = (uniqueName: string): string[] | undefined => {
 | 
			
		||||
    return getSuitByUniqueName(uniqueName)?.exalted;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const getItemCategoryByUniqueName = (uniqueName: string): string => {
 | 
			
		||||
    //Lotus/Types/Items/MiscItems/PolymerBundle
 | 
			
		||||
 | 
			
		||||
@ -76,10 +71,6 @@ export const getItemCategoryByUniqueName = (uniqueName: string): string => {
 | 
			
		||||
    return category;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const getSuitByUniqueName = (uniqueName: string): IPowersuit | undefined => {
 | 
			
		||||
    return ExportWarframes[uniqueName];
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export const getItemName = (uniqueName: string): string | undefined => {
 | 
			
		||||
    if (uniqueName in ExportArcanes) {
 | 
			
		||||
        return ExportArcanes[uniqueName].name;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user