fix: preinstall potatoes on non-crafted equipment
All checks were successful
Build / build (18) (push) Successful in 38s
Build / build (22) (push) Successful in 48s
Build / build (20) (push) Successful in 55s
Build / build (18) (pull_request) Successful in 37s
Build / build (20) (pull_request) Successful in 49s
Build / build (22) (pull_request) Successful in 53s
All checks were successful
Build / build (18) (push) Successful in 38s
Build / build (22) (push) Successful in 48s
Build / build (20) (push) Successful in 55s
Build / build (18) (pull_request) Successful in 37s
Build / build (20) (pull_request) Successful in 49s
Build / build (22) (pull_request) Successful in 53s
This commit is contained in:
parent
ca55b21a2a
commit
54b8b4dc3e
@ -36,7 +36,12 @@ import {
|
||||
} from "../types/requestTypes";
|
||||
import { logger } from "@/src/utils/logger";
|
||||
import { getExalted, getKeyChainItems } from "@/src/services/itemDataService";
|
||||
import { IEquipmentClient, IEquipmentDatabase, IItemConfig } from "../types/inventoryTypes/commonInventoryTypes";
|
||||
import {
|
||||
EquipmentFeatures,
|
||||
IEquipmentClient,
|
||||
IEquipmentDatabase,
|
||||
IItemConfig
|
||||
} from "../types/inventoryTypes/commonInventoryTypes";
|
||||
import {
|
||||
ExportArcanes,
|
||||
ExportBundles,
|
||||
@ -325,7 +330,14 @@ export const addItem = async (
|
||||
if (typeName in ExportWeapons) {
|
||||
const weapon = ExportWeapons[typeName];
|
||||
if (weapon.totalDamage != 0) {
|
||||
const inventoryChanges = addEquipment(inventory, weapon.productCategory, typeName);
|
||||
const inventoryChanges = addEquipment(
|
||||
inventory,
|
||||
weapon.productCategory,
|
||||
typeName,
|
||||
[],
|
||||
{},
|
||||
premiumPurchase ? { Features: EquipmentFeatures.DOUBLE_CAPACITY } : {}
|
||||
);
|
||||
if (weapon.additionalItems) {
|
||||
for (const item of weapon.additionalItems) {
|
||||
combineInventoryChanges(inventoryChanges, (await addItem(inventory, item, 1)).InventoryChanges);
|
||||
@ -405,7 +417,12 @@ export const addItem = async (
|
||||
default: {
|
||||
return {
|
||||
InventoryChanges: {
|
||||
...addPowerSuit(inventory, typeName),
|
||||
...addPowerSuit(
|
||||
inventory,
|
||||
typeName,
|
||||
{},
|
||||
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
||||
),
|
||||
...occupySlot(inventory, InventorySlot.SUITS, premiumPurchase)
|
||||
}
|
||||
};
|
||||
@ -413,7 +430,12 @@ export const addItem = async (
|
||||
case "Archwing": {
|
||||
return {
|
||||
InventoryChanges: {
|
||||
...addSpaceSuit(inventory, typeName),
|
||||
...addSpaceSuit(
|
||||
inventory,
|
||||
typeName,
|
||||
{},
|
||||
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
||||
),
|
||||
...occupySlot(inventory, InventorySlot.SPACESUITS, premiumPurchase)
|
||||
}
|
||||
};
|
||||
@ -421,7 +443,12 @@ export const addItem = async (
|
||||
case "EntratiMech": {
|
||||
return {
|
||||
InventoryChanges: {
|
||||
...addMechSuit(inventory, typeName),
|
||||
...addMechSuit(
|
||||
inventory,
|
||||
typeName,
|
||||
{},
|
||||
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
||||
),
|
||||
...occupySlot(inventory, InventorySlot.MECHSUITS, premiumPurchase)
|
||||
}
|
||||
};
|
||||
@ -455,7 +482,12 @@ export const addItem = async (
|
||||
case "Sentinels": {
|
||||
return {
|
||||
InventoryChanges: {
|
||||
...addSentinel(inventory, typeName),
|
||||
...addSentinel(
|
||||
inventory,
|
||||
typeName,
|
||||
{},
|
||||
premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined
|
||||
),
|
||||
...occupySlot(inventory, InventorySlot.SENTINELS, premiumPurchase)
|
||||
}
|
||||
};
|
||||
@ -574,7 +606,8 @@ export const applyDefaultUpgrades = (
|
||||
export const addSentinel = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
sentinelName: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
inventoryChanges: IInventoryChanges = {},
|
||||
features: number | undefined = undefined
|
||||
): IInventoryChanges => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (ExportSentinels[sentinelName]?.defaultWeapon) {
|
||||
@ -584,7 +617,8 @@ export const addSentinel = (
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
const configs: IItemConfig[] = applyDefaultUpgrades(inventory, ExportSentinels[sentinelName]?.defaultUpgrades);
|
||||
|
||||
const sentinelIndex = inventory.Sentinels.push({ ItemType: sentinelName, Configs: configs, XP: 0 }) - 1;
|
||||
const sentinelIndex =
|
||||
inventory.Sentinels.push({ ItemType: sentinelName, Configs: configs, XP: 0, Features: features }) - 1;
|
||||
inventoryChanges.Sentinels ??= [];
|
||||
inventoryChanges.Sentinels.push(inventory.Sentinels[sentinelIndex].toJSON<IEquipmentClient>());
|
||||
|
||||
@ -604,7 +638,8 @@ export const addSentinelWeapon = (
|
||||
export const addPowerSuit = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
powersuitName: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
inventoryChanges: IInventoryChanges = {},
|
||||
features: number | undefined = undefined
|
||||
): IInventoryChanges => {
|
||||
const specialItems = getExalted(powersuitName);
|
||||
if (specialItems) {
|
||||
@ -612,7 +647,8 @@ export const addPowerSuit = (
|
||||
addSpecialItem(inventory, specialItem, inventoryChanges);
|
||||
}
|
||||
}
|
||||
const suitIndex = inventory.Suits.push({ ItemType: powersuitName, Configs: [], UpgradeVer: 101, XP: 0 }) - 1;
|
||||
const suitIndex =
|
||||
inventory.Suits.push({ ItemType: powersuitName, Configs: [], UpgradeVer: 101, XP: 0, Features: features }) - 1;
|
||||
inventoryChanges.Suits ??= [];
|
||||
inventoryChanges.Suits.push(inventory.Suits[suitIndex].toJSON<IEquipmentClient>());
|
||||
return inventoryChanges;
|
||||
@ -621,7 +657,8 @@ export const addPowerSuit = (
|
||||
export const addMechSuit = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
mechsuitName: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
inventoryChanges: IInventoryChanges = {},
|
||||
features: number | undefined = undefined
|
||||
): IInventoryChanges => {
|
||||
const specialItems = getExalted(mechsuitName);
|
||||
if (specialItems) {
|
||||
@ -629,7 +666,9 @@ export const addMechSuit = (
|
||||
addSpecialItem(inventory, specialItem, inventoryChanges);
|
||||
}
|
||||
}
|
||||
const suitIndex = inventory.MechSuits.push({ ItemType: mechsuitName, Configs: [], UpgradeVer: 101, XP: 0 }) - 1;
|
||||
const suitIndex =
|
||||
inventory.MechSuits.push({ ItemType: mechsuitName, Configs: [], UpgradeVer: 101, XP: 0, Features: features }) -
|
||||
1;
|
||||
inventoryChanges.MechSuits ??= [];
|
||||
inventoryChanges.MechSuits.push(inventory.MechSuits[suitIndex].toJSON<IEquipmentClient>());
|
||||
return inventoryChanges;
|
||||
@ -658,9 +697,17 @@ export const addSpecialItem = (
|
||||
export const addSpaceSuit = (
|
||||
inventory: TInventoryDatabaseDocument,
|
||||
spacesuitName: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
inventoryChanges: IInventoryChanges = {},
|
||||
features: number | undefined = undefined
|
||||
): IInventoryChanges => {
|
||||
const suitIndex = inventory.SpaceSuits.push({ ItemType: spacesuitName, Configs: [], UpgradeVer: 101, XP: 0 }) - 1;
|
||||
const suitIndex =
|
||||
inventory.SpaceSuits.push({
|
||||
ItemType: spacesuitName,
|
||||
Configs: [],
|
||||
UpgradeVer: 101,
|
||||
XP: 0,
|
||||
Features: features
|
||||
}) - 1;
|
||||
inventoryChanges.SpaceSuits ??= [];
|
||||
inventoryChanges.SpaceSuits.push(inventory.SpaceSuits[suitIndex].toJSON<IEquipmentClient>());
|
||||
return inventoryChanges;
|
||||
|
Loading…
x
Reference in New Issue
Block a user