feat: implement purchasing of additional customization slots
This commit is contained in:
parent
dff85de691
commit
186d1cbbb1
@ -10,7 +10,10 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
||||
const inventory = await getInventory(accountId);
|
||||
const InventoryChanges: any = {};
|
||||
for (const operation of payload.Operations) {
|
||||
if (operation.UpgradeRequirement == "/Lotus/Types/Items/MiscItems/ModSlotUnlocker") {
|
||||
if (
|
||||
operation.UpgradeRequirement == "/Lotus/Types/Items/MiscItems/ModSlotUnlocker" ||
|
||||
operation.UpgradeRequirement == "/Lotus/Types/Items/MiscItems/CustomizationSlotUnlocker"
|
||||
) {
|
||||
updateCurrency(10, true, accountId);
|
||||
} else {
|
||||
addMiscItems(inventory, [
|
||||
@ -83,6 +86,21 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "/Lotus/Types/Items/MiscItems/CustomizationSlotUnlocker":
|
||||
for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) {
|
||||
if (item._id.toString() == payload.ItemId.$oid) {
|
||||
item.CustomizationSlotPurchases ??= 0;
|
||||
item.CustomizationSlotPurchases += 1;
|
||||
InventoryChanges[payload.ItemCategory] = {
|
||||
ItemId: {
|
||||
$oid: payload.ItemId.$oid
|
||||
},
|
||||
CustomizationSlotPurchases: item.CustomizationSlotPurchases
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unsupported upgrade: " + operation.UpgradeRequirement);
|
||||
}
|
||||
|
@ -193,6 +193,7 @@ const WeaponSchema = new Schema<IWeaponDatabase>(
|
||||
Polarity: [polaritySchema],
|
||||
FocusLens: String,
|
||||
ModSlotPurchases: Number,
|
||||
CustomizationSlotPurchases: Number,
|
||||
UpgradeType: Schema.Types.Mixed, //todo
|
||||
UpgradeFingerprint: String,
|
||||
ItemName: String,
|
||||
@ -275,6 +276,7 @@ const suitSchema = new Schema<ISuitDatabase>(
|
||||
Polarity: [polaritySchema],
|
||||
Polarized: Number,
|
||||
ModSlotPurchases: Number,
|
||||
CustomizationSlotPurchases: Number,
|
||||
FocusLens: String,
|
||||
UnlockLevel: Number
|
||||
},
|
||||
|
@ -17,6 +17,7 @@ export interface ISuitDatabase {
|
||||
Polarity?: IPolarity[];
|
||||
Polarized?: number;
|
||||
ModSlotPurchases?: number;
|
||||
CustomizationSlotPurchases?: number;
|
||||
FocusLens?: string;
|
||||
UnlockLevel?: number;
|
||||
_id: Types.ObjectId;
|
||||
|
@ -95,6 +95,7 @@ export interface IGenericItem {
|
||||
Polarity?: IPolarity[];
|
||||
Polarized?: number;
|
||||
ModSlotPurchases?: number;
|
||||
CustomizationSlotPurchases?: number;
|
||||
}
|
||||
|
||||
export interface IGenericItemDatabase extends Omit<IGenericItem, "ItemId"> {
|
||||
|
@ -17,6 +17,7 @@ export interface IWeaponDatabase {
|
||||
Polarity?: IPolarity[];
|
||||
FocusLens?: string;
|
||||
ModSlotPurchases?: number;
|
||||
CustomizationSlotPurchases?: number;
|
||||
UpgradeType?: string;
|
||||
UpgradeFingerprint?: string;
|
||||
ItemName?: string;
|
||||
|
Loading…
x
Reference in New Issue
Block a user