Skip to content

Commit

Permalink
Merge pull request #10498 from DestinyItemManager/enhancement-filters
Browse files Browse the repository at this point in the history
"enhanceable" and "enhanced" filters
  • Loading branch information
nev-r authored Jun 5, 2024
2 parents 7c8cd3a + 134cd32 commit 96e40bb
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@
"Energy": "Shows items that have energy capacity (Armor 2.0).",
"Engrams": "Shows engrams.",
"EnhancedPerk": "Shows weapons that have the specified number of enhanced perks.",
"Enhanced": "Shows weapons that have been enhanced.",
"Enhanceable": "Shows weapons that can be enhanced.",
"Equipment": "Items that can be equipped.",
"Equipped": "Items that are currently equipped on a character.",
"Event": "Shows items from which event in Destiny 2 they appeared in.",
Expand Down
2 changes: 2 additions & 0 deletions src/app/search/__snapshots__/search-config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ exports[`buildSearchConfig generates a reasonable filter map: is filters 1`] = `
"emotes",
"energy",
"engrams",
"enhanceable",
"enhanced",
"equipment",
"equippable",
"equipped",
Expand Down
34 changes: 34 additions & 0 deletions src/app/search/items/search-filters/sockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,40 @@ const socketFilters: ItemFilterDefinition[] = [
(item) =>
item.sockets && compare!(countEnhancedPerks(item.sockets)),
},
{
keywords: 'enhanceable',
description: tl('Filter.Enhanceable'),
destinyVersion: 2,
filter: () => (item) =>
Boolean(
item.sockets?.allSockets.some(
(s) =>
s.plugged?.plugDef.plug.plugCategoryHash ===
PlugCategoryHashes.CraftingPlugsWeaponsModsEnhancers,
),
),
},
{
keywords: 'enhanced',
description: tl('Filter.Enhanced'),
destinyVersion: 2,
filter: () => (item) => {
const socket = item.sockets?.allSockets.find(
(s) =>
s.plugged?.plugDef.plug.plugCategoryHash ===
PlugCategoryHashes.CraftingPlugsWeaponsModsEnhancers,
);
return Boolean(
socket?.plugged &&
// rules out items where enhancing hasn't even started
// if "empty" is plugged, there's a socket offering enhancement to the player
socket.emptyPlugItemHash !== socket.plugged.plugDef.hash &&
// rules out half-enhanced items
// the game explicitly warns you that half-enhanced items stop looking masterworked
item.masterwork,
);
},
},
{
keywords: 'retiredperk',
description: tl('Filter.RetiredPerk'),
Expand Down
2 changes: 2 additions & 0 deletions src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@
"DupeLower": "Duplicate items, including reissues, that are not the highest power dupe. Only one duplicate is chosen as the highest, and the rest are considered lower.",
"Energy": "Shows items that have energy capacity (Armor 2.0).",
"Engrams": "Shows engrams.",
"Enhanceable": "Shows weapons that can be enhanced.",
"Enhanced": "Shows weapons that have been enhanced.",
"EnhancedPerk": "Shows weapons that have the specified number of enhanced perks.",
"Equipment": "Items that can be equipped.",
"Equipped": "Items that are currently equipped on a character.",
Expand Down

0 comments on commit 96e40bb

Please sign in to comment.