merge EndOfMatchUpload conditions
This commit is contained in:
parent
b93a4a6dae
commit
cb89e31c15
@ -77,11 +77,8 @@ export const addMissionInventoryUpdates = async (
|
|||||||
inventoryUpdates: IMissionInventoryUpdateRequest
|
inventoryUpdates: IMissionInventoryUpdateRequest
|
||||||
): Promise<IInventoryChanges> => {
|
): Promise<IInventoryChanges> => {
|
||||||
const inventoryChanges: IInventoryChanges = {};
|
const inventoryChanges: IInventoryChanges = {};
|
||||||
if (
|
if (inventoryUpdates.EndOfMatchUpload) {
|
||||||
inventoryUpdates.EndOfMatchUpload &&
|
if (inventoryUpdates.Missions && inventoryUpdates.Missions.Tag in ExportRegions) {
|
||||||
inventoryUpdates.Missions &&
|
|
||||||
inventoryUpdates.Missions.Tag in ExportRegions
|
|
||||||
) {
|
|
||||||
const node = ExportRegions[inventoryUpdates.Missions.Tag];
|
const node = ExportRegions[inventoryUpdates.Missions.Tag];
|
||||||
if (node.miscItemFee) {
|
if (node.miscItemFee) {
|
||||||
addMiscItems(inventory, [
|
addMiscItems(inventory, [
|
||||||
@ -92,28 +89,9 @@ export const addMissionInventoryUpdates = async (
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inventoryUpdates.RewardInfo) {
|
|
||||||
if (inventoryUpdates.RewardInfo.periodicMissionTag) {
|
|
||||||
const tag = inventoryUpdates.RewardInfo.periodicMissionTag;
|
|
||||||
const existingCompletion = inventory.PeriodicMissionCompletions.find(completion => completion.tag === tag);
|
|
||||||
|
|
||||||
if (existingCompletion) {
|
|
||||||
existingCompletion.date = new Date();
|
|
||||||
} else {
|
|
||||||
inventory.PeriodicMissionCompletions.push({
|
|
||||||
tag: tag,
|
|
||||||
date: new Date()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (inventoryUpdates.RewardInfo.NemesisAbandonedRewards) {
|
|
||||||
inventory.NemesisAbandonedRewards = inventoryUpdates.RewardInfo.NemesisAbandonedRewards;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (
|
if (
|
||||||
inventoryUpdates.MissionFailed &&
|
inventoryUpdates.MissionFailed &&
|
||||||
inventoryUpdates.MissionStatus == "GS_FAILURE" &&
|
inventoryUpdates.MissionStatus == "GS_FAILURE" &&
|
||||||
inventoryUpdates.EndOfMatchUpload &&
|
|
||||||
inventoryUpdates.ObjectiveReached &&
|
inventoryUpdates.ObjectiveReached &&
|
||||||
!inventoryUpdates.LockedWeaponGroup
|
!inventoryUpdates.LockedWeaponGroup
|
||||||
) {
|
) {
|
||||||
@ -136,6 +114,25 @@ export const addMissionInventoryUpdates = async (
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (inventoryUpdates.RewardInfo) {
|
||||||
|
if (inventoryUpdates.RewardInfo.periodicMissionTag) {
|
||||||
|
const tag = inventoryUpdates.RewardInfo.periodicMissionTag;
|
||||||
|
const existingCompletion = inventory.PeriodicMissionCompletions.find(completion => completion.tag === tag);
|
||||||
|
|
||||||
|
if (existingCompletion) {
|
||||||
|
existingCompletion.date = new Date();
|
||||||
|
} else {
|
||||||
|
inventory.PeriodicMissionCompletions.push({
|
||||||
|
tag: tag,
|
||||||
|
date: new Date()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inventoryUpdates.RewardInfo.NemesisAbandonedRewards) {
|
||||||
|
inventory.NemesisAbandonedRewards = inventoryUpdates.RewardInfo.NemesisAbandonedRewards;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) {
|
for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
logger.error(`Inventory update key ${key} has no value `);
|
logger.error(`Inventory update key ${key} has no value `);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user