Skip to content

Commit

Permalink
Merge pull request #245 from DestinyItemManager/fix-autostat
Browse files Browse the repository at this point in the history
Fix autoStatMods/includeRuntimeStatBenefits
  • Loading branch information
bhollis authored Oct 22, 2024
2 parents bc2e0eb + e00c55b commit 69ddd46
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions api/shapes/loadouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
7 changes: 7 additions & 0 deletions api/stately/loadouts-queries.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
2 changes: 0 additions & 2 deletions api/stately/loadouts-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion api/stately/stately-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function convertEnum(
*/
export function stripDefaults<T extends Record<string, unknown>>(data: T): Partial<T> {
return Object.entries(data).reduce<Record<string, unknown>>((result, [key, value]) => {
if (value) {
if (value || value === false) {
result[key] = value;
}
return result;
Expand Down

0 comments on commit 69ddd46

Please sign in to comment.