forked from OpenWF/SpaceNinjaServer
		
	feat: remove incarnon (#688)
This commit is contained in:
		
							parent
							
								
									f1c0c5a429
								
							
						
					
					
						commit
						c80dd1bbd0
					
				@ -9,27 +9,40 @@ export const evolveWeaponController: RequestHandler = async (req, res) => {
 | 
			
		||||
    const accountId = await getAccountIdForRequest(req);
 | 
			
		||||
    const inventory = await getInventory(accountId);
 | 
			
		||||
    const payload = getJSONfromString(String(req.body)) as IEvolveWeaponRequest;
 | 
			
		||||
    console.assert(payload.Action == "EWA_INSTALL");
 | 
			
		||||
 | 
			
		||||
    const recipe = getRecipe(payload.Recipe)!;
 | 
			
		||||
    addMiscItems(
 | 
			
		||||
        inventory,
 | 
			
		||||
        recipe.ingredients.map(x => ({ ItemType: x.ItemType, ItemCount: x.ItemCount * -1 }))
 | 
			
		||||
    );
 | 
			
		||||
    if (payload.Action == "EWA_INSTALL") {
 | 
			
		||||
        addMiscItems(
 | 
			
		||||
            inventory,
 | 
			
		||||
            recipe.ingredients.map(x => ({ ItemType: x.ItemType, ItemCount: x.ItemCount * -1 }))
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
    const item = inventory[payload.Category].find(item => item._id.toString() == (req.query.ItemId as string))!;
 | 
			
		||||
    item.Features ??= 0;
 | 
			
		||||
    item.Features |= EquipmentFeatures.INCARNON_GENESIS;
 | 
			
		||||
        const item = inventory[payload.Category].find(item => item._id.toString() == (req.query.ItemId as string))!;
 | 
			
		||||
        item.Features ??= 0;
 | 
			
		||||
        item.Features |= EquipmentFeatures.INCARNON_GENESIS;
 | 
			
		||||
 | 
			
		||||
    item.SkillTree = "0";
 | 
			
		||||
        item.SkillTree = "0";
 | 
			
		||||
 | 
			
		||||
    inventory.EvolutionProgress ??= [];
 | 
			
		||||
    if (!inventory.EvolutionProgress.find(entry => entry.ItemType == payload.EvoType)) {
 | 
			
		||||
        inventory.EvolutionProgress.push({
 | 
			
		||||
            Progress: 0,
 | 
			
		||||
            Rank: 1,
 | 
			
		||||
            ItemType: payload.EvoType
 | 
			
		||||
        });
 | 
			
		||||
        inventory.EvolutionProgress ??= [];
 | 
			
		||||
        if (!inventory.EvolutionProgress.find(entry => entry.ItemType == payload.EvoType)) {
 | 
			
		||||
            inventory.EvolutionProgress.push({
 | 
			
		||||
                Progress: 0,
 | 
			
		||||
                Rank: 1,
 | 
			
		||||
                ItemType: payload.EvoType
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    } else if (payload.Action == "EWA_UNINSTALL") {
 | 
			
		||||
        addMiscItems(inventory, [
 | 
			
		||||
            {
 | 
			
		||||
                ItemType: recipe.resultType,
 | 
			
		||||
                ItemCount: 1
 | 
			
		||||
            }
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        const item = inventory[payload.Category].find(item => item._id.toString() == (req.query.ItemId as string))!;
 | 
			
		||||
        item.Features! &= ~EquipmentFeatures.INCARNON_GENESIS;
 | 
			
		||||
    } else {
 | 
			
		||||
        throw new Error(`unexpected evolve weapon action: ${payload.Action}`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    await inventory.save();
 | 
			
		||||
@ -37,7 +50,7 @@ export const evolveWeaponController: RequestHandler = async (req, res) => {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
interface IEvolveWeaponRequest {
 | 
			
		||||
    Action: "EWA_INSTALL";
 | 
			
		||||
    Action: string;
 | 
			
		||||
    Category: WeaponTypeInternal;
 | 
			
		||||
    Recipe: string; // e.g. "/Lotus/Types/Items/MiscItems/IncarnonAdapters/UnlockerBlueprints/DespairIncarnonBlueprint"
 | 
			
		||||
    UninstallRecipe: "";
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user