improve: add EquipmentFeatures
This commit is contained in:
parent
1fe8351dca
commit
e173220225
@ -1,6 +1,6 @@
|
||||
import { RequestHandler } from "express";
|
||||
import { IUpgradesRequest } from "@/src/types/requestTypes";
|
||||
import { FocusSchool, IEquipmentDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { FocusSchool, IEquipmentDatabase, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
|
||||
import { IMiscItem, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
|
||||
import { getAccountIdForRequest } from "@/src/services/loginService";
|
||||
import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService";
|
||||
@ -31,7 +31,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
||||
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||
if (item._id.toString() == payload.ItemId.$oid) {
|
||||
item.Features ??= 0;
|
||||
item.Features |= 1;
|
||||
item.Features |= EquipmentFeatures.DOUBLE_CAPACITY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -41,7 +41,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
||||
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||
if (item._id.toString() == payload.ItemId.$oid) {
|
||||
item.Features ??= 0;
|
||||
item.Features |= 2;
|
||||
item.Features |= EquipmentFeatures.UTILITY_SLOT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -52,7 +52,7 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
||||
for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) {
|
||||
if (item._id.toString() == payload.ItemId.$oid) {
|
||||
item.Features ??= 0;
|
||||
item.Features |= 32;
|
||||
item.Features |= EquipmentFeatures.ARCANE_SLOT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,12 @@ export interface IEquipmentClient extends Omit<IEquipmentDatabase, "_id"> {
|
||||
ItemId: IOid;
|
||||
}
|
||||
|
||||
export enum EquipmentFeatures {
|
||||
DOUBLE_CAPACITY = 1,
|
||||
UTILITY_SLOT = 2,
|
||||
ARCANE_SLOT = 32,
|
||||
}
|
||||
|
||||
export interface IEquipmentDatabase {
|
||||
ItemType: string;
|
||||
ItemName?: string;
|
||||
|
Loading…
x
Reference in New Issue
Block a user