forked from OpenWF/SpaceNinjaServer
		
	feat: implement polarization (forma) (#173)
This commit is contained in:
		
							parent
							
								
									bc3fca8ccf
								
							
						
					
					
						commit
						d62785a883
					
				@ -1,5 +1,6 @@
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import { IUpgradesRequest } from "@/src/types/requestTypes";
 | 
			
		||||
import { IPolarity } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
import { IGenericItemDatabase, IMiscItem, TGenericItemKey } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
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) {
 | 
			
		||||
                        item.Features ??= 0;
 | 
			
		||||
                        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;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
@ -91,7 +91,9 @@ export interface IGenericItem {
 | 
			
		||||
    Configs: IItemConfig[];
 | 
			
		||||
    UpgradeVer: number;
 | 
			
		||||
    ItemId: IOid;
 | 
			
		||||
    Features?: number; //space suit has this
 | 
			
		||||
    Features?: number;
 | 
			
		||||
    Polarity?: IPolarity[];
 | 
			
		||||
    Polarized?: number;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IGenericItemDatabase extends Omit<IGenericItem, "ItemId"> {
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,5 @@
 | 
			
		||||
import { IOid } from "./commonTypes";
 | 
			
		||||
import { FocusSchool } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
import {
 | 
			
		||||
    IBooster,
 | 
			
		||||
    IChallengeProgress,
 | 
			
		||||
@ -78,6 +79,6 @@ export interface IUpgradeOperation {
 | 
			
		||||
    OperationType: string;
 | 
			
		||||
    UpgradeRequirement: string; // uniqueName of item being consumed
 | 
			
		||||
    PolarizeSlot: number;
 | 
			
		||||
    PolarizeValue: string; // polarity
 | 
			
		||||
    PolarizeValue: FocusSchool;
 | 
			
		||||
    PolarityRemap: {}[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user