From e00c55b255c0ad9b064dc8989f05f167f46b9040 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Mon, 21 Oct 2024 16:48:35 -0700 Subject: [PATCH] Fix autoStatMods/includeRuntimeStatBenefits --- api/shapes/loadouts.ts | 3 +++ api/stately/loadouts-queries.test.ts | 7 +++++++ api/stately/loadouts-queries.ts | 2 -- api/stately/stately-utils.ts | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/api/shapes/loadouts.ts b/api/shapes/loadouts.ts index b560b00..477a4dd 100644 --- a/api/shapes/loadouts.ts +++ b/api/shapes/loadouts.ts @@ -209,6 +209,9 @@ export const defaultLoadoutParameters: LoadoutParameters = { assumeArmorMasterwork: AssumeArmorMasterwork.None, autoStatMods: true, includeRuntimeStatBenefits: true, + clearArmor: true, + clearMods: true, + clearWeapons: true, }; /** A constraint on the values an armor stat can take */ diff --git a/api/stately/loadouts-queries.test.ts b/api/stately/loadouts-queries.test.ts index d5f8802..7849ac4 100644 --- a/api/stately/loadouts-queries.test.ts +++ b/api/stately/loadouts-queries.test.ts @@ -57,6 +57,10 @@ it('can roundtrip loadout parameters', () => { const loParams: LoadoutParameters = { ...defaultLoadoutParameters, exoticArmorHash: 3045642045, + autoStatMods: false, + clearArmor: true, + clearMods: true, + clearWeapons: true, }; const statelyLoParams = client.create( @@ -72,6 +76,9 @@ it('can roundtrip loadout parameters w/ a negative armor hash', () => { const loParams: LoadoutParameters = { ...defaultLoadoutParameters, exoticArmorHash: -1, + clearArmor: true, + clearMods: true, + clearWeapons: true, }; const statelyLoParams = client.create( diff --git a/api/stately/loadouts-queries.ts b/api/stately/loadouts-queries.ts index 9096a13..ef37dee 100644 --- a/api/stately/loadouts-queries.ts +++ b/api/stately/loadouts-queries.ts @@ -149,8 +149,6 @@ export function convertLoadoutParametersFromStately( modsByBucket: _.isEmpty(modsByBucket) ? undefined : listToMap('bucketHash', 'modHashes', modsByBucket), - autoStatMods: true, - includeRuntimeStatBenefits: true, artifactUnlocks: artifactUnlocks ? stripTypeName(artifactUnlocks) : undefined, inGameIdentifiers: inGameIdentifiers ? stripTypeName(inGameIdentifiers) : undefined, }; diff --git a/api/stately/stately-utils.ts b/api/stately/stately-utils.ts index a8d6aa9..667d464 100644 --- a/api/stately/stately-utils.ts +++ b/api/stately/stately-utils.ts @@ -104,7 +104,7 @@ export function convertEnum( */ export function stripDefaults>(data: T): Partial { return Object.entries(data).reduce>((result, [key, value]) => { - if (value) { + if (value || value === false) { result[key] = value; } return result;