forked from OpenWF/SpaceNinjaServer
		
	Having this item in the inventory unlocks the helminth option which is helpfully called "remove cyst" to install and uninstall it on a frame. Reviewed-on: OpenWF/SpaceNinjaServer#2177 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
		
			
				
	
	
		
			28 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { fromMongoDate, fromOid } from "@/src/helpers/inventoryHelpers";
 | 
						|
import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
						|
import { addMiscItem, getInventory } from "@/src/services/inventoryService";
 | 
						|
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
						|
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
						|
import { RequestHandler } from "express";
 | 
						|
 | 
						|
export const umbraController: RequestHandler = async (req, res) => {
 | 
						|
    const accountId = await getAccountIdForRequest(req);
 | 
						|
    const inventory = await getInventory(accountId, "Suits MiscItems");
 | 
						|
    const payload = getJSONfromString<IUmbraRequest>(String(req.body));
 | 
						|
    for (const clientSuit of payload.Suits) {
 | 
						|
        const dbSuit = inventory.Suits.id(fromOid(clientSuit.ItemId))!;
 | 
						|
        if (clientSuit.UmbraDate) {
 | 
						|
            addMiscItem(inventory, "/Lotus/Types/Items/MiscItems/UmbraEchoes", -1);
 | 
						|
            dbSuit.UmbraDate = fromMongoDate(clientSuit.UmbraDate);
 | 
						|
        } else {
 | 
						|
            dbSuit.UmbraDate = undefined;
 | 
						|
        }
 | 
						|
    }
 | 
						|
    await inventory.save();
 | 
						|
    res.end();
 | 
						|
};
 | 
						|
 | 
						|
interface IUmbraRequest {
 | 
						|
    Suits: IEquipmentClient[];
 | 
						|
}
 |