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 inventory = await getInventory(accountId);
|
||||||
const InventoryChanges: any = {};
|
const InventoryChanges: any = {};
|
||||||
for (const operation of payload.Operations) {
|
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);
|
updateCurrency(10, true, accountId);
|
||||||
} else {
|
} else {
|
||||||
addMiscItems(inventory, [
|
addMiscItems(inventory, [
|
||||||
@ -83,6 +86,21 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
throw new Error("Unsupported upgrade: " + operation.UpgradeRequirement);
|
throw new Error("Unsupported upgrade: " + operation.UpgradeRequirement);
|
||||||
}
|
}
|
||||||
|
@ -193,6 +193,7 @@ const WeaponSchema = new Schema<IWeaponDatabase>(
|
|||||||
Polarity: [polaritySchema],
|
Polarity: [polaritySchema],
|
||||||
FocusLens: String,
|
FocusLens: String,
|
||||||
ModSlotPurchases: Number,
|
ModSlotPurchases: Number,
|
||||||
|
CustomizationSlotPurchases: Number,
|
||||||
UpgradeType: Schema.Types.Mixed, //todo
|
UpgradeType: Schema.Types.Mixed, //todo
|
||||||
UpgradeFingerprint: String,
|
UpgradeFingerprint: String,
|
||||||
ItemName: String,
|
ItemName: String,
|
||||||
@ -275,6 +276,7 @@ const suitSchema = new Schema<ISuitDatabase>(
|
|||||||
Polarity: [polaritySchema],
|
Polarity: [polaritySchema],
|
||||||
Polarized: Number,
|
Polarized: Number,
|
||||||
ModSlotPurchases: Number,
|
ModSlotPurchases: Number,
|
||||||
|
CustomizationSlotPurchases: Number,
|
||||||
FocusLens: String,
|
FocusLens: String,
|
||||||
UnlockLevel: Number
|
UnlockLevel: Number
|
||||||
},
|
},
|
||||||
|
@ -17,6 +17,7 @@ export interface ISuitDatabase {
|
|||||||
Polarity?: IPolarity[];
|
Polarity?: IPolarity[];
|
||||||
Polarized?: number;
|
Polarized?: number;
|
||||||
ModSlotPurchases?: number;
|
ModSlotPurchases?: number;
|
||||||
|
CustomizationSlotPurchases?: number;
|
||||||
FocusLens?: string;
|
FocusLens?: string;
|
||||||
UnlockLevel?: number;
|
UnlockLevel?: number;
|
||||||
_id: Types.ObjectId;
|
_id: Types.ObjectId;
|
||||||
|
@ -95,6 +95,7 @@ export interface IGenericItem {
|
|||||||
Polarity?: IPolarity[];
|
Polarity?: IPolarity[];
|
||||||
Polarized?: number;
|
Polarized?: number;
|
||||||
ModSlotPurchases?: number;
|
ModSlotPurchases?: number;
|
||||||
|
CustomizationSlotPurchases?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IGenericItemDatabase extends Omit<IGenericItem, "ItemId"> {
|
export interface IGenericItemDatabase extends Omit<IGenericItem, "ItemId"> {
|
||||||
|
@ -17,6 +17,7 @@ export interface IWeaponDatabase {
|
|||||||
Polarity?: IPolarity[];
|
Polarity?: IPolarity[];
|
||||||
FocusLens?: string;
|
FocusLens?: string;
|
||||||
ModSlotPurchases?: number;
|
ModSlotPurchases?: number;
|
||||||
|
CustomizationSlotPurchases?: number;
|
||||||
UpgradeType?: string;
|
UpgradeType?: string;
|
||||||
UpgradeFingerprint?: string;
|
UpgradeFingerprint?: string;
|
||||||
ItemName?: string;
|
ItemName?: string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user