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 });
 | 
			
		||||
    }
 | 
			
		||||
    addMiscItems(inventory, miscItemChanges);
 | 
			
		||||
    let affiliationMod;
 | 
			
		||||
    if (gainedStanding && syndicateTag) affiliationMod = addStanding(inventory, syndicateTag, gainedStanding);
 | 
			
		||||
    if (gainedStanding && syndicateTag) addStanding(inventory, syndicateTag, gainedStanding);
 | 
			
		||||
    await inventory.save();
 | 
			
		||||
    res.json({
 | 
			
		||||
        InventoryChanges: {
 | 
			
		||||
            MiscItems: miscItemChanges
 | 
			
		||||
        },
 | 
			
		||||
        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 { ExportSyndicates, ExportWeapons } from "warframe-public-export-plus";
 | 
			
		||||
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";
 | 
			
		||||
 | 
			
		||||
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 };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const affiliationMod = addStanding(inventory, request.Operation.AffiliationTag, gainedStanding, true);
 | 
			
		||||
    const affiliationMods: IAffiliationMods[] = [];
 | 
			
		||||
    addStanding(inventory, request.Operation.AffiliationTag, gainedStanding, affiliationMods, true);
 | 
			
		||||
 | 
			
		||||
    await inventory.save();
 | 
			
		||||
 | 
			
		||||
    res.json({
 | 
			
		||||
        InventoryChanges: inventoryChanges,
 | 
			
		||||
        AffiliationMods: [affiliationMod]
 | 
			
		||||
        AffiliationMods: affiliationMods
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1202,8 +1202,9 @@ export const addStanding = (
 | 
			
		||||
    inventory: TInventoryDatabaseDocument,
 | 
			
		||||
    syndicateTag: string,
 | 
			
		||||
    gainedStanding: number,
 | 
			
		||||
    affiliationMods: IAffiliationMods[] = [],
 | 
			
		||||
    isMedallion: boolean = false
 | 
			
		||||
): IAffiliationMods => {
 | 
			
		||||
): void => {
 | 
			
		||||
    let syndicate = inventory.Affiliations.find(x => x.Tag == syndicateTag);
 | 
			
		||||
    const syndicateMeta = ExportSyndicates[syndicateTag];
 | 
			
		||||
 | 
			
		||||
@ -1223,10 +1224,10 @@ export const addStanding = (
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    syndicate.Standing += gainedStanding;
 | 
			
		||||
    return {
 | 
			
		||||
    affiliationMods.push({
 | 
			
		||||
        Tag: syndicateTag,
 | 
			
		||||
        Standing: gainedStanding
 | 
			
		||||
    };
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// TODO: AffiliationMods support (Nightwave).
 | 
			
		||||
 | 
			
		||||
@ -1236,19 +1236,18 @@ export const addMissionRewards = async (
 | 
			
		||||
                SyndicateXPItemReward = medallionAmount;
 | 
			
		||||
            } else {
 | 
			
		||||
                if (rewardInfo.JobTier! >= 0) {
 | 
			
		||||
                    AffiliationMods.push(
 | 
			
		||||
                        addStanding(
 | 
			
		||||
                            inventory,
 | 
			
		||||
                            syndicateEntry.Tag,
 | 
			
		||||
                            Math.floor(currentJob.xpAmounts[rewardInfo.JobStage] / (rewardInfo.Q ? 0.8 : 1))
 | 
			
		||||
                        )
 | 
			
		||||
                    addStanding(
 | 
			
		||||
                        inventory,
 | 
			
		||||
                        syndicateEntry.Tag,
 | 
			
		||||
                        Math.floor(currentJob.xpAmounts[rewardInfo.JobStage] / (rewardInfo.Q ? 0.8 : 1)),
 | 
			
		||||
                        AffiliationMods
 | 
			
		||||
                    );
 | 
			
		||||
                } else {
 | 
			
		||||
                    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) {
 | 
			
		||||
                        AffiliationMods.push(addStanding(inventory, syndicateEntry.Tag, 5000));
 | 
			
		||||
                        addStanding(inventory, syndicateEntry.Tag, 5000, AffiliationMods);
 | 
			
		||||
                    }
 | 
			
		||||
                    if (
 | 
			
		||||
                        [
 | 
			
		||||
@ -1259,7 +1258,7 @@ export const addMissionRewards = async (
 | 
			
		||||
                            "Heists/HeistExploiterBountyOne"
 | 
			
		||||
                        ].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;
 | 
			
		||||
            if (tier > 5) standingAmount = 7500; // InfestedLichBounty
 | 
			
		||||
            if (isSteelPath) standingAmount *= 1.5;
 | 
			
		||||
            AffiliationMods.push(addStanding(inventory, syndicateTag, standingAmount));
 | 
			
		||||
            addStanding(inventory, syndicateTag, standingAmount, AffiliationMods);
 | 
			
		||||
        }
 | 
			
		||||
        if (syndicateTag == "HexSyndicate" && chemistry && tier < 6) {
 | 
			
		||||
            const seed = getWorldState().SyndicateMissions.find(x => x.Tag == "HexSyndicate")!.Seed;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user