Update addStanding API
This commit is contained in:
		
							parent
							
								
									71d1b6094c
								
							
						
					
					
						commit
						c23eac5c87
					
				@ -30,15 +30,14 @@ export const fishmongerController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
        miscItemChanges.push({ ItemType: fish.ItemType, ItemCount: fish.ItemCount * -1 });
 | 
					        miscItemChanges.push({ ItemType: fish.ItemType, ItemCount: fish.ItemCount * -1 });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    addMiscItems(inventory, miscItemChanges);
 | 
					    addMiscItems(inventory, miscItemChanges);
 | 
				
			||||||
    let affiliationMod;
 | 
					    if (gainedStanding && syndicateTag) addStanding(inventory, syndicateTag, gainedStanding);
 | 
				
			||||||
    if (gainedStanding && syndicateTag) affiliationMod = addStanding(inventory, syndicateTag, gainedStanding);
 | 
					 | 
				
			||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
    res.json({
 | 
					    res.json({
 | 
				
			||||||
        InventoryChanges: {
 | 
					        InventoryChanges: {
 | 
				
			||||||
            MiscItems: miscItemChanges
 | 
					            MiscItems: miscItemChanges
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        SyndicateTag: syndicateTag,
 | 
					        SyndicateTag: syndicateTag,
 | 
				
			||||||
        StandingChange: affiliationMod?.Standing || 0
 | 
					        StandingChange: gainedStanding
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ import { IMiscItem, InventorySlot } from "@/src/types/inventoryTypes/inventoryTy
 | 
				
			|||||||
import { IOid } from "@/src/types/commonTypes";
 | 
					import { IOid } from "@/src/types/commonTypes";
 | 
				
			||||||
import { ExportSyndicates, ExportWeapons } from "warframe-public-export-plus";
 | 
					import { ExportSyndicates, ExportWeapons } from "warframe-public-export-plus";
 | 
				
			||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
					import { IAffiliationMods, IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
				
			||||||
import { EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
					import { EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const syndicateStandingBonusController: RequestHandler = async (req, res) => {
 | 
					export const syndicateStandingBonusController: RequestHandler = async (req, res) => {
 | 
				
			||||||
@ -54,13 +54,14 @@ export const syndicateStandingBonusController: RequestHandler = async (req, res)
 | 
				
			|||||||
        inventoryChanges[slotBin] = { count: -1, platinum: 0, Slots: 1 };
 | 
					        inventoryChanges[slotBin] = { count: -1, platinum: 0, Slots: 1 };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const affiliationMod = addStanding(inventory, request.Operation.AffiliationTag, gainedStanding, true);
 | 
					    const affiliationMods: IAffiliationMods[] = [];
 | 
				
			||||||
 | 
					    addStanding(inventory, request.Operation.AffiliationTag, gainedStanding, affiliationMods, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await inventory.save();
 | 
					    await inventory.save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    res.json({
 | 
					    res.json({
 | 
				
			||||||
        InventoryChanges: inventoryChanges,
 | 
					        InventoryChanges: inventoryChanges,
 | 
				
			||||||
        AffiliationMods: [affiliationMod]
 | 
					        AffiliationMods: affiliationMods
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1202,8 +1202,9 @@ export const addStanding = (
 | 
				
			|||||||
    inventory: TInventoryDatabaseDocument,
 | 
					    inventory: TInventoryDatabaseDocument,
 | 
				
			||||||
    syndicateTag: string,
 | 
					    syndicateTag: string,
 | 
				
			||||||
    gainedStanding: number,
 | 
					    gainedStanding: number,
 | 
				
			||||||
 | 
					    affiliationMods: IAffiliationMods[] = [],
 | 
				
			||||||
    isMedallion: boolean = false
 | 
					    isMedallion: boolean = false
 | 
				
			||||||
): IAffiliationMods => {
 | 
					): void => {
 | 
				
			||||||
    let syndicate = inventory.Affiliations.find(x => x.Tag == syndicateTag);
 | 
					    let syndicate = inventory.Affiliations.find(x => x.Tag == syndicateTag);
 | 
				
			||||||
    const syndicateMeta = ExportSyndicates[syndicateTag];
 | 
					    const syndicateMeta = ExportSyndicates[syndicateTag];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -1223,10 +1224,10 @@ export const addStanding = (
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    syndicate.Standing += gainedStanding;
 | 
					    syndicate.Standing += gainedStanding;
 | 
				
			||||||
    return {
 | 
					    affiliationMods.push({
 | 
				
			||||||
        Tag: syndicateTag,
 | 
					        Tag: syndicateTag,
 | 
				
			||||||
        Standing: gainedStanding
 | 
					        Standing: gainedStanding
 | 
				
			||||||
    };
 | 
					    });
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// TODO: AffiliationMods support (Nightwave).
 | 
					// TODO: AffiliationMods support (Nightwave).
 | 
				
			||||||
 | 
				
			|||||||
@ -1236,19 +1236,18 @@ export const addMissionRewards = async (
 | 
				
			|||||||
                SyndicateXPItemReward = medallionAmount;
 | 
					                SyndicateXPItemReward = medallionAmount;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                if (rewardInfo.JobTier! >= 0) {
 | 
					                if (rewardInfo.JobTier! >= 0) {
 | 
				
			||||||
                    AffiliationMods.push(
 | 
					                    addStanding(
 | 
				
			||||||
                        addStanding(
 | 
					                        inventory,
 | 
				
			||||||
                            inventory,
 | 
					                        syndicateEntry.Tag,
 | 
				
			||||||
                            syndicateEntry.Tag,
 | 
					                        Math.floor(currentJob.xpAmounts[rewardInfo.JobStage] / (rewardInfo.Q ? 0.8 : 1)),
 | 
				
			||||||
                            Math.floor(currentJob.xpAmounts[rewardInfo.JobStage] / (rewardInfo.Q ? 0.8 : 1))
 | 
					                        AffiliationMods
 | 
				
			||||||
                        )
 | 
					 | 
				
			||||||
                    );
 | 
					                    );
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    if (jobType.endsWith("Heists/HeistProfitTakerBountyOne") && rewardInfo.JobStage === 2) {
 | 
					                    if (jobType.endsWith("Heists/HeistProfitTakerBountyOne") && rewardInfo.JobStage === 2) {
 | 
				
			||||||
                        AffiliationMods.push(addStanding(inventory, syndicateEntry.Tag, 1000));
 | 
					                        addStanding(inventory, syndicateEntry.Tag, 1000, AffiliationMods);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (jobType.endsWith("Hunts/AllTeralystsHunt") && rewardInfo.JobStage === 2) {
 | 
					                    if (jobType.endsWith("Hunts/AllTeralystsHunt") && rewardInfo.JobStage === 2) {
 | 
				
			||||||
                        AffiliationMods.push(addStanding(inventory, syndicateEntry.Tag, 5000));
 | 
					                        addStanding(inventory, syndicateEntry.Tag, 5000, AffiliationMods);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (
 | 
					                    if (
 | 
				
			||||||
                        [
 | 
					                        [
 | 
				
			||||||
@ -1259,7 +1258,7 @@ export const addMissionRewards = async (
 | 
				
			|||||||
                            "Heists/HeistExploiterBountyOne"
 | 
					                            "Heists/HeistExploiterBountyOne"
 | 
				
			||||||
                        ].some(ending => jobType.endsWith(ending))
 | 
					                        ].some(ending => jobType.endsWith(ending))
 | 
				
			||||||
                    ) {
 | 
					                    ) {
 | 
				
			||||||
                        AffiliationMods.push(addStanding(inventory, syndicateEntry.Tag, 1000));
 | 
					                        addStanding(inventory, syndicateEntry.Tag, 1000, AffiliationMods);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@ -1284,7 +1283,7 @@ export const addMissionRewards = async (
 | 
				
			|||||||
            let standingAmount = (tier + 1) * 1000;
 | 
					            let standingAmount = (tier + 1) * 1000;
 | 
				
			||||||
            if (tier > 5) standingAmount = 7500; // InfestedLichBounty
 | 
					            if (tier > 5) standingAmount = 7500; // InfestedLichBounty
 | 
				
			||||||
            if (isSteelPath) standingAmount *= 1.5;
 | 
					            if (isSteelPath) standingAmount *= 1.5;
 | 
				
			||||||
            AffiliationMods.push(addStanding(inventory, syndicateTag, standingAmount));
 | 
					            addStanding(inventory, syndicateTag, standingAmount, AffiliationMods);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (syndicateTag == "HexSyndicate" && chemistry && tier < 6) {
 | 
					        if (syndicateTag == "HexSyndicate" && chemistry && tier < 6) {
 | 
				
			||||||
            const seed = getWorldState().SyndicateMissions.find(x => x.Tag == "HexSyndicate")!.Seed;
 | 
					            const seed = getWorldState().SyndicateMissions.find(x => x.Tag == "HexSyndicate")!.Seed;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user