feat: gain abilities as helminth levels up
This commit is contained in:
		
							parent
							
								
									714ec45222
								
							
						
					
					
						commit
						0291b56592
					
				@ -91,19 +91,21 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            addInfestedFoundryXP(inventory.InfestedFoundry, 666 * totalPercentagePointsGained);
 | 
					            const recipeChanges = addInfestedFoundryXP(inventory.InfestedFoundry, 666 * totalPercentagePointsGained);
 | 
				
			||||||
 | 
					            addRecipes(inventory, recipeChanges);
 | 
				
			||||||
            addMiscItems(inventory, miscItemChanges);
 | 
					            addMiscItems(inventory, miscItemChanges);
 | 
				
			||||||
            await inventory.save();
 | 
					            await inventory.save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            res.json({
 | 
					            res.json({
 | 
				
			||||||
                InventoryChanges: {
 | 
					                InventoryChanges: {
 | 
				
			||||||
 | 
					                    Recipes: recipeChanges,
 | 
				
			||||||
                    InfestedFoundry: {
 | 
					                    InfestedFoundry: {
 | 
				
			||||||
                        XP: inventory.InfestedFoundry.XP,
 | 
					                        XP: inventory.InfestedFoundry.XP,
 | 
				
			||||||
                        Resources: inventory.InfestedFoundry.Resources,
 | 
					                        Resources: inventory.InfestedFoundry.Resources,
 | 
				
			||||||
                        Slots: inventory.InfestedFoundry.Slots
 | 
					                        Slots: inventory.InfestedFoundry.Slots
 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    },
 | 
					                    },
 | 
				
			||||||
                    MiscItems: miscItemChanges
 | 
					                    MiscItems: miscItemChanges
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -153,11 +155,12 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
            inventory.InfestedFoundry!.AbilityOverrideUnlockCooldown = new Date(
 | 
					            inventory.InfestedFoundry!.AbilityOverrideUnlockCooldown = new Date(
 | 
				
			||||||
                new Date().getTime() + 24 * 60 * 60 * 1000
 | 
					                new Date().getTime() + 24 * 60 * 60 * 1000
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
            addInfestedFoundryXP(inventory.InfestedFoundry!, 1600_00);
 | 
					            const recipeChanges = addInfestedFoundryXP(inventory.InfestedFoundry!, 1600_00);
 | 
				
			||||||
 | 
					            addRecipes(inventory, recipeChanges);
 | 
				
			||||||
            await inventory.save();
 | 
					            await inventory.save();
 | 
				
			||||||
            console.log(inventory.toJSON().InfestedFoundry);
 | 
					 | 
				
			||||||
            res.json({
 | 
					            res.json({
 | 
				
			||||||
                InventoryChanges: {
 | 
					                InventoryChanges: {
 | 
				
			||||||
 | 
					                    Recipes: recipeChanges,
 | 
				
			||||||
                    RemovedIdItems: [
 | 
					                    RemovedIdItems: [
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            ItemId: request.SuitId
 | 
					                            ItemId: request.SuitId
 | 
				
			||||||
@ -198,7 +201,8 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
            suit.OffensiveUpgrade = request.OffensiveUpgradeType;
 | 
					            suit.OffensiveUpgrade = request.OffensiveUpgradeType;
 | 
				
			||||||
            suit.DefensiveUpgrade = request.DefensiveUpgradeType;
 | 
					            suit.DefensiveUpgrade = request.DefensiveUpgradeType;
 | 
				
			||||||
            suit.UpgradesExpiry = upgradesExpiry;
 | 
					            suit.UpgradesExpiry = upgradesExpiry;
 | 
				
			||||||
            addInfestedFoundryXP(inventory.InfestedFoundry!, 4800_00);
 | 
					            const recipeChanges = addInfestedFoundryXP(inventory.InfestedFoundry!, 4800_00);
 | 
				
			||||||
 | 
					            addRecipes(inventory, recipeChanges);
 | 
				
			||||||
            for (let i = 0; i != request.ResourceTypes.length; ++i) {
 | 
					            for (let i = 0; i != request.ResourceTypes.length; ++i) {
 | 
				
			||||||
                inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == request.ResourceTypes[i])!.Count -=
 | 
					                inventory.InfestedFoundry!.Resources!.find(x => x.ItemType == request.ResourceTypes[i])!.Count -=
 | 
				
			||||||
                    request.ResourceCosts[i];
 | 
					                    request.ResourceCosts[i];
 | 
				
			||||||
@ -212,6 +216,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
                DefensiveUpgrade: request.DefensiveUpgradeType,
 | 
					                DefensiveUpgrade: request.DefensiveUpgradeType,
 | 
				
			||||||
                UpgradesExpiry: toMongoDate(upgradesExpiry),
 | 
					                UpgradesExpiry: toMongoDate(upgradesExpiry),
 | 
				
			||||||
                InventoryChanges: {
 | 
					                InventoryChanges: {
 | 
				
			||||||
 | 
					                    Recipes: recipeChanges,
 | 
				
			||||||
                    InfestedFoundry: inventory.toJSON().InfestedFoundry
 | 
					                    InfestedFoundry: inventory.toJSON().InfestedFoundry
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
@ -256,7 +261,8 @@ const colorToShard: Record<string, string> = {
 | 
				
			|||||||
    ACC_PURPLE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalVioletMythic"
 | 
					    ACC_PURPLE_MYTHIC: "/Lotus/Types/Gameplay/NarmerSorties/ArchonCrystalVioletMythic"
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundry, delta: number): void => {
 | 
					const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundry, delta: number): ITypeCount[] => {
 | 
				
			||||||
 | 
					    const recipeChanges: ITypeCount[] = [];
 | 
				
			||||||
    infestedFoundry.XP ??= 0;
 | 
					    infestedFoundry.XP ??= 0;
 | 
				
			||||||
    const prevXP = infestedFoundry.XP;
 | 
					    const prevXP = infestedFoundry.XP;
 | 
				
			||||||
    infestedFoundry.XP += delta;
 | 
					    infestedFoundry.XP += delta;
 | 
				
			||||||
@ -264,17 +270,69 @@ const addInfestedFoundryXP = (infestedFoundry: IInfestedFoundry, delta: number):
 | 
				
			|||||||
        infestedFoundry.Slots ??= 0;
 | 
					        infestedFoundry.Slots ??= 0;
 | 
				
			||||||
        infestedFoundry.Slots += 3;
 | 
					        infestedFoundry.Slots += 3;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 5625_00 && infestedFoundry.XP >= 5625_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({
 | 
				
			||||||
 | 
					            ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthShieldsBlueprint",
 | 
				
			||||||
 | 
					            ItemCount: 1
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 10125_00 && infestedFoundry.XP >= 10125_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({ ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthHackBlueprint", ItemCount: 1 });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (prevXP < 15750_00 && infestedFoundry.XP >= 15750_00) {
 | 
					    if (prevXP < 15750_00 && infestedFoundry.XP >= 15750_00) {
 | 
				
			||||||
        infestedFoundry.Slots ??= 0;
 | 
					        infestedFoundry.Slots ??= 0;
 | 
				
			||||||
        infestedFoundry.Slots += 10;
 | 
					        infestedFoundry.Slots += 10;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 22500_00 && infestedFoundry.XP >= 22500_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({
 | 
				
			||||||
 | 
					            ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthAmmoEfficiencyBlueprint",
 | 
				
			||||||
 | 
					            ItemCount: 1
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 30375_00 && infestedFoundry.XP >= 30375_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({ ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthStunBlueprint", ItemCount: 1 });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (prevXP < 39375_00 && infestedFoundry.XP >= 39375_00) {
 | 
					    if (prevXP < 39375_00 && infestedFoundry.XP >= 39375_00) {
 | 
				
			||||||
        infestedFoundry.Slots ??= 0;
 | 
					        infestedFoundry.Slots ??= 0;
 | 
				
			||||||
        infestedFoundry.Slots += 20;
 | 
					        infestedFoundry.Slots += 20;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 60750_00 && infestedFoundry.XP >= 60750_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({ ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthStatusBlueprint", ItemCount: 1 });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (prevXP < 73125_00 && infestedFoundry.XP >= 73125) {
 | 
					    if (prevXP < 73125_00 && infestedFoundry.XP >= 73125) {
 | 
				
			||||||
        infestedFoundry.Slots = 1;
 | 
					        infestedFoundry.Slots = 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 86625_00 && infestedFoundry.XP >= 86625_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({
 | 
				
			||||||
 | 
					            ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthShieldArmorBlueprint",
 | 
				
			||||||
 | 
					            ItemCount: 1
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 101250_00 && infestedFoundry.XP >= 101250_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({
 | 
				
			||||||
 | 
					            ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthProcBlockBlueprint",
 | 
				
			||||||
 | 
					            ItemCount: 1
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 117000_00 && infestedFoundry.XP >= 117000_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({
 | 
				
			||||||
 | 
					            ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthEnergyShareBlueprint",
 | 
				
			||||||
 | 
					            ItemCount: 1
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 133875_00 && infestedFoundry.XP >= 133875_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({
 | 
				
			||||||
 | 
					            ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthMaxStatusBlueprint",
 | 
				
			||||||
 | 
					            ItemCount: 1
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (prevXP < 151875_00 && infestedFoundry.XP >= 151875_00) {
 | 
				
			||||||
 | 
					        recipeChanges.push({
 | 
				
			||||||
 | 
					            ItemType: "/Lotus/Types/Recipes/AbilityOverrides/HelminthTreasureBlueprint",
 | 
				
			||||||
 | 
					            ItemCount: 1
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return recipeChanges;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface IHelminthSubsumeRequest {
 | 
					interface IHelminthSubsumeRequest {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user