feat: implement polarization (forma) (#173)

This commit is contained in:
Sainan 2024-05-09 01:07:14 +02:00 committed by GitHub
parent bc3fca8ccf
commit d62785a883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import { RequestHandler } from "express"; import { RequestHandler } from "express";
import { IUpgradesRequest } from "@/src/types/requestTypes"; import { IUpgradesRequest } from "@/src/types/requestTypes";
import { IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { IGenericItemDatabase, IMiscItem, TGenericItemKey } from "@/src/types/inventoryTypes/inventoryTypes"; import { IGenericItemDatabase, IMiscItem, TGenericItemKey } from "@/src/types/inventoryTypes/inventoryTypes";
import { addMiscItems, getInventory } from "@/src/services/inventoryService"; import { addMiscItems, getInventory } from "@/src/services/inventoryService";
@ -42,6 +43,20 @@ export const upgradesController: RequestHandler = async (req, res) => {
if (item._id.toString() == payload.ItemId.$oid) { if (item._id.toString() == payload.ItemId.$oid) {
item.Features ??= 0; item.Features ??= 0;
item.Features |= 32; item.Features |= 32;
}
}
break;
case "/Lotus/Types/Items/MiscItems/Forma":
for (const item of inventory[payload.ItemCategory as TGenericItemKey] as IGenericItemDatabase[]) {
if (item._id.toString() == payload.ItemId.$oid) {
item.XP = 0;
item.Polarity ??= [];
item.Polarity.push({
Slot: operation.PolarizeSlot,
Value: operation.PolarizeValue
} satisfies IPolarity);
item.Polarized ??= 0;
item.Polarized += 1;
break; break;
} }
} }

View File

@ -91,7 +91,9 @@ export interface IGenericItem {
Configs: IItemConfig[]; Configs: IItemConfig[];
UpgradeVer: number; UpgradeVer: number;
ItemId: IOid; ItemId: IOid;
Features?: number; //space suit has this Features?: number;
Polarity?: IPolarity[];
Polarized?: number;
} }
export interface IGenericItemDatabase extends Omit<IGenericItem, "ItemId"> { export interface IGenericItemDatabase extends Omit<IGenericItem, "ItemId"> {

View File

@ -1,4 +1,5 @@
import { IOid } from "./commonTypes"; import { IOid } from "./commonTypes";
import { FocusSchool } from "@/src/types/inventoryTypes/commonInventoryTypes";
import { import {
IBooster, IBooster,
IChallengeProgress, IChallengeProgress,
@ -78,6 +79,6 @@ export interface IUpgradeOperation {
OperationType: string; OperationType: string;
UpgradeRequirement: string; // uniqueName of item being consumed UpgradeRequirement: string; // uniqueName of item being consumed
PolarizeSlot: number; PolarizeSlot: number;
PolarizeValue: string; // polarity PolarizeValue: FocusSchool;
PolarityRemap: {}[]; PolarityRemap: {}[];
} }