fix: give non-exalted additional items when acquiring warframe (#1408)
Also upgraded `no-misused-promises` to an error and added `IsNew` field to powersuits. Reviewed-on: #1408 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
parent
a0fa41cd58
commit
3d69828610
@ -16,7 +16,6 @@
|
|||||||
"@typescript-eslint/restrict-plus-operands": "warn",
|
"@typescript-eslint/restrict-plus-operands": "warn",
|
||||||
"@typescript-eslint/no-unsafe-member-access": "warn",
|
"@typescript-eslint/no-unsafe-member-access": "warn",
|
||||||
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "caughtErrors": "none" }],
|
"@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-argument": "error",
|
||||||
"@typescript-eslint/no-unsafe-call": "warn",
|
"@typescript-eslint/no-unsafe-call": "warn",
|
||||||
"@typescript-eslint/no-unsafe-assignment": "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, "LongGuns", LongGuns[0].ItemType, undefined, inventoryChanges);
|
||||||
addEquipment(inventory, "Pistols", Pistols[0].ItemType, undefined, inventoryChanges);
|
addEquipment(inventory, "Pistols", Pistols[0].ItemType, undefined, inventoryChanges);
|
||||||
addEquipment(inventory, "Melee", Melee[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(
|
addEquipment(
|
||||||
inventory,
|
inventory,
|
||||||
"DataKnives",
|
"DataKnives",
|
||||||
|
@ -30,7 +30,7 @@ import {
|
|||||||
import { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate";
|
import { IGenericUpdate, IUpdateNodeIntrosResponse } from "../types/genericUpdate";
|
||||||
import { IMissionInventoryUpdateRequest } from "../types/requestTypes";
|
import { IMissionInventoryUpdateRequest } from "../types/requestTypes";
|
||||||
import { logger } from "@/src/utils/logger";
|
import { logger } from "@/src/utils/logger";
|
||||||
import { convertInboxMessage, fromStoreItem, getExalted, getKeyChainItems } from "@/src/services/itemDataService";
|
import { convertInboxMessage, fromStoreItem, getKeyChainItems } from "@/src/services/itemDataService";
|
||||||
import {
|
import {
|
||||||
EquipmentFeatures,
|
EquipmentFeatures,
|
||||||
IEquipmentClient,
|
IEquipmentClient,
|
||||||
@ -55,8 +55,10 @@ import {
|
|||||||
ExportSentinels,
|
ExportSentinels,
|
||||||
ExportSyndicates,
|
ExportSyndicates,
|
||||||
ExportUpgrades,
|
ExportUpgrades,
|
||||||
|
ExportWarframes,
|
||||||
ExportWeapons,
|
ExportWeapons,
|
||||||
IDefaultUpgrade,
|
IDefaultUpgrade,
|
||||||
|
IPowersuit,
|
||||||
TStandingLimitBin
|
TStandingLimitBin
|
||||||
} from "warframe-public-export-plus";
|
} from "warframe-public-export-plus";
|
||||||
import { createShip } from "./shipService";
|
import { createShip } from "./shipService";
|
||||||
@ -481,12 +483,12 @@ export const addItem = async (
|
|||||||
switch (typeName.substr(1).split("/")[2]) {
|
switch (typeName.substr(1).split("/")[2]) {
|
||||||
default: {
|
default: {
|
||||||
return {
|
return {
|
||||||
...addPowerSuit(
|
...(await addPowerSuit(
|
||||||
inventory,
|
inventory,
|
||||||
typeName,
|
typeName,
|
||||||
{},
|
{},
|
||||||
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
||||||
),
|
)),
|
||||||
...occupySlot(inventory, InventorySlot.SUITS, premiumPurchase)
|
...occupySlot(inventory, InventorySlot.SUITS, premiumPurchase)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -504,12 +506,12 @@ export const addItem = async (
|
|||||||
}
|
}
|
||||||
case "EntratiMech": {
|
case "EntratiMech": {
|
||||||
return {
|
return {
|
||||||
...addMechSuit(
|
...(await addMechSuit(
|
||||||
inventory,
|
inventory,
|
||||||
typeName,
|
typeName,
|
||||||
{},
|
{},
|
||||||
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
||||||
),
|
)),
|
||||||
...occupySlot(inventory, InventorySlot.MECHSUITS, premiumPurchase)
|
...occupySlot(inventory, InventorySlot.MECHSUITS, premiumPurchase)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -697,40 +699,65 @@ const addSentinelWeapon = (
|
|||||||
inventoryChanges.SentinelWeapons.push(inventory.SentinelWeapons[index].toJSON<IEquipmentClient>());
|
inventoryChanges.SentinelWeapons.push(inventory.SentinelWeapons[index].toJSON<IEquipmentClient>());
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addPowerSuit = (
|
export const addPowerSuit = async (
|
||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
powersuitName: string,
|
powersuitName: string,
|
||||||
inventoryChanges: IInventoryChanges = {},
|
inventoryChanges: IInventoryChanges = {},
|
||||||
features: number | undefined = undefined
|
features: number | undefined = undefined
|
||||||
): IInventoryChanges => {
|
): Promise<IInventoryChanges> => {
|
||||||
const specialItems = getExalted(powersuitName);
|
const powersuit = ExportWarframes[powersuitName] as IPowersuit | undefined;
|
||||||
if (specialItems) {
|
const exalted = powersuit?.exalted ?? [];
|
||||||
for (const specialItem of specialItems) {
|
for (const specialItem of exalted) {
|
||||||
addSpecialItem(inventory, specialItem, inventoryChanges);
|
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 =
|
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 ??= [];
|
||||||
inventoryChanges.Suits.push(inventory.Suits[suitIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.Suits.push(inventory.Suits[suitIndex].toJSON<IEquipmentClient>());
|
||||||
return inventoryChanges;
|
return inventoryChanges;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const addMechSuit = (
|
export const addMechSuit = async (
|
||||||
inventory: TInventoryDatabaseDocument,
|
inventory: TInventoryDatabaseDocument,
|
||||||
mechsuitName: string,
|
mechsuitName: string,
|
||||||
inventoryChanges: IInventoryChanges = {},
|
inventoryChanges: IInventoryChanges = {},
|
||||||
features: number | undefined = undefined
|
features: number | undefined = undefined
|
||||||
): IInventoryChanges => {
|
): Promise<IInventoryChanges> => {
|
||||||
const specialItems = getExalted(mechsuitName);
|
const powersuit = ExportWarframes[mechsuitName] as IPowersuit | undefined;
|
||||||
if (specialItems) {
|
const exalted = powersuit?.exalted ?? [];
|
||||||
for (const specialItem of specialItems) {
|
for (const specialItem of exalted) {
|
||||||
addSpecialItem(inventory, specialItem, inventoryChanges);
|
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 =
|
const suitIndex =
|
||||||
inventory.MechSuits.push({ ItemType: mechsuitName, Configs: [], UpgradeVer: 101, XP: 0, Features: features }) -
|
inventory.MechSuits.push({
|
||||||
1;
|
ItemType: mechsuitName,
|
||||||
|
Configs: [],
|
||||||
|
UpgradeVer: 101,
|
||||||
|
XP: 0,
|
||||||
|
Features: features,
|
||||||
|
IsNew: true
|
||||||
|
}) - 1;
|
||||||
inventoryChanges.MechSuits ??= [];
|
inventoryChanges.MechSuits ??= [];
|
||||||
inventoryChanges.MechSuits.push(inventory.MechSuits[suitIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.MechSuits.push(inventory.MechSuits[suitIndex].toJSON<IEquipmentClient>());
|
||||||
return inventoryChanges;
|
return inventoryChanges;
|
||||||
@ -768,7 +795,8 @@ export const addSpaceSuit = (
|
|||||||
Configs: [],
|
Configs: [],
|
||||||
UpgradeVer: 101,
|
UpgradeVer: 101,
|
||||||
XP: 0,
|
XP: 0,
|
||||||
Features: features
|
Features: features,
|
||||||
|
IsNew: true
|
||||||
}) - 1;
|
}) - 1;
|
||||||
inventoryChanges.SpaceSuits ??= [];
|
inventoryChanges.SpaceSuits ??= [];
|
||||||
inventoryChanges.SpaceSuits.push(inventory.SpaceSuits[suitIndex].toJSON<IEquipmentClient>());
|
inventoryChanges.SpaceSuits.push(inventory.SpaceSuits[suitIndex].toJSON<IEquipmentClient>());
|
||||||
|
@ -31,7 +31,6 @@ import {
|
|||||||
IDefaultUpgrade,
|
IDefaultUpgrade,
|
||||||
IInboxMessage,
|
IInboxMessage,
|
||||||
IMissionReward,
|
IMissionReward,
|
||||||
IPowersuit,
|
|
||||||
IRecipe,
|
IRecipe,
|
||||||
TReward
|
TReward
|
||||||
} from "warframe-public-export-plus";
|
} 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);
|
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 => {
|
export const getItemCategoryByUniqueName = (uniqueName: string): string => {
|
||||||
//Lotus/Types/Items/MiscItems/PolymerBundle
|
//Lotus/Types/Items/MiscItems/PolymerBundle
|
||||||
|
|
||||||
@ -76,10 +71,6 @@ export const getItemCategoryByUniqueName = (uniqueName: string): string => {
|
|||||||
return category;
|
return category;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSuitByUniqueName = (uniqueName: string): IPowersuit | undefined => {
|
|
||||||
return ExportWarframes[uniqueName];
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getItemName = (uniqueName: string): string | undefined => {
|
export const getItemName = (uniqueName: string): string | undefined => {
|
||||||
if (uniqueName in ExportArcanes) {
|
if (uniqueName in ExportArcanes) {
|
||||||
return ExportArcanes[uniqueName].name;
|
return ExportArcanes[uniqueName].name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user