feat: implement polarization (forma) #173
@ -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;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
				
			|||||||
@ -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"> {
 | 
				
			||||||
 | 
				
			|||||||
@ -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: {}[];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user