feat: support additional mission completion fields
All checks were successful
Build / build (20) (pull_request) Successful in 35s
Build / build (22) (pull_request) Successful in 57s
Build / build (18) (pull_request) Successful in 1m24s

Closes #932, Closes #468
This commit is contained in:
AMelonInsideLemon 2025-02-09 15:30:02 +01:00
parent 4504b95977
commit 5fedc2ce2b
2 changed files with 33 additions and 0 deletions

View File

@ -83,6 +83,19 @@ export const addMissionInventoryUpdates = (
if (inventoryUpdates.MissionFailed === true) {
return;
}
if (inventoryUpdates.RewardInfo && 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()
});
}
}
for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) {
if (value === undefined) {
logger.error(`Inventory update key ${key} has no value `);
@ -178,6 +191,22 @@ export const addMissionInventoryUpdates = (
});
break;
}
case "SyndicateId": {
inventory.CompletedSyndicates.push(value);
break;
}
case "SortieId": {
inventory.CompletedSorties.push(value);
break;
}
case "SeasonChallengeCompletions":
const processedCompletions = value.map(({ challenge, id }) => ({
challenge: challenge.substring(challenge.lastIndexOf("/") + 1),
id
}));
inventory.SeasonChallengeHistory.push(...processedCompletions);
break;
default:
// Equipment XP updates
if (equipmentKeys.includes(key as TEquipmentKey)) {

View File

@ -44,6 +44,9 @@ export type IMissionInventoryUpdateRequest = {
CrewShipAmmo?: ITypeCount[];
BonusMiscItems?: ITypeCount[];
SyndicateId?: string;
SortieId?: string;
SeasonChallengeCompletions?: ISeasonChallenge[];
AffiliationChanges?: IAffiliationChange[];
crossPlaySetting?: string;
rewardsMultiplier?: number;
@ -100,6 +103,7 @@ export interface IRewardInfo {
rewardQualifications?: string; // did a Survival for 5 minutes and this was "1"
PurgatoryRewardQualifications?: string;
rewardSeed?: number;
periodicMissionTag?: string;
}
export type IMissionStatus = "GS_SUCCESS" | "GS_FAILURE" | "GS_DUMPED" | "GS_QUIT" | "GS_INTERRUPTED";