feat: rushing recipes, refactor: addItem #248
@ -2,6 +2,7 @@ import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { updateCurrency } from "@/src/services/inventoryService";
|
||||
import { RequestHandler } from "express";
|
||||
import { updateSlots } from "@/src/services/inventoryService";
|
||||
import { InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
|
||||
/*
|
||||
loadout slots are additionally purchased slots only
|
||||
@ -27,7 +28,7 @@ export const inventorySlotsController: RequestHandler = async (req, res) => {
|
||||
//TODO: check which slot was purchased because pvpBonus is also possible
|
||||
|
||||
const currencyChanges = await updateCurrency(20, true, accountId);
|
||||
await updateSlots(accountId, "PveBonusLoadoutBin", 1, 1);
|
||||
await updateSlots(accountId, InventorySlot.PVE_LOADOUTS, 1, 1);
|
||||
|
||||
//console.log({ InventoryChanges: currencyChanges }, " added loadout changes:");
|
||||
|
||||
|
@ -14,7 +14,8 @@ import {
|
||||
IMission,
|
||||
IRawUpgrade,
|
||||
ISeasonChallengeHistory,
|
||||
ITypeCount
|
||||
ITypeCount,
|
||||
InventorySlot
|
||||
} from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { IGenericUpdate } from "../types/genericUpdate";
|
||||
import {
|
||||
@ -74,7 +75,7 @@ export const addItem = async (
|
||||
case "Powersuits":
|
||||
if (typeName.includes("EntratiMech")) {
|
||||
const mechSuit = await addMechSuit(typeName, accountId);
|
||||
await updateSlots(accountId, "MechBin", 0, 1);
|
||||
await updateSlots(accountId, InventorySlot.MECHSUITS, 0, 1);
|
||||
logger.debug("mech suit", mechSuit);
|
||||
return {
|
||||
InventoryChanges: {
|
||||
@ -88,7 +89,7 @@ export const addItem = async (
|
||||
};
|
||||
}
|
||||
const suit = await addPowerSuit(typeName, accountId);
|
||||
await updateSlots(accountId, "SuitBin", 0, 1);
|
||||
await updateSlots(accountId, InventorySlot.SUITS, 0, 1);
|
||||
return {
|
||||
InventoryChanges: {
|
||||
SuitBin: {
|
||||
@ -102,7 +103,7 @@ export const addItem = async (
|
||||
case "Weapons":
|
||||
const weaponType = getWeaponType(typeName);
|
||||
const weapon = await addWeapon(weaponType, typeName, accountId);
|
||||
await updateSlots(accountId, "WeaponBin", 0, 1);
|
||||
await updateSlots(accountId, InventorySlot.WEAPONS, 0, 1);
|
||||
return {
|
||||
InventoryChanges: {
|
||||
WeaponBin: { count: 1, platinum: 0, Slots: -1 },
|
||||
@ -127,7 +128,7 @@ export const addItem = async (
|
||||
case "Sentinels":
|
||||
// TOOD: Sentinels should also grant their DefaultUpgrades & SentinelWeapon.
|
||||
const sentinel = await addSentinel(typeName, accountId);
|
||||
await updateSlots(accountId, "SentinelBin", 0, 1);
|
||||
await updateSlots(accountId, InventorySlot.SENTINELS, 0, 1);
|
||||
return {
|
||||
InventoryChanges: {
|
||||
SentinelBin: { count: 1, platinum: 0, Slots: -1 },
|
||||
|
@ -419,6 +419,14 @@ export interface ICrewShipHarnessConfig {
|
||||
Upgrades?: string[];
|
||||
}
|
||||
|
||||
export enum InventorySlot {
|
||||
SUITS = "SuitBin",
|
||||
WEAPONS = "WeaponBin",
|
||||
MECHSUITS = "MechBin",
|
||||
PVE_LOADOUTS = "PveBonusLoadoutBin",
|
||||
SENTINELS = "SentinelBin"
|
||||
}
|
||||
|
||||
export interface ISlots {
|
||||
Extra: number; // can be undefined, but not if used via mongoose
|
||||
Slots: number;
|
||||
|
Loading…
x
Reference in New Issue
Block a user