From 1262f54217964abb0ce0fb7796893880e15370ef Mon Sep 17 00:00:00 2001 From: robojumper Date: Thu, 6 Jun 2024 13:57:10 +0200 Subject: [PATCH] Prismatic subclass drawer fixes --- config/i18n.json | 6 ++++++ src/app/loadout/mod-utils.ts | 18 +++++++++++++++++- src/app/utils/socket-utils.ts | 2 ++ src/locale/en.json | 6 ++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/config/i18n.json b/config/i18n.json index 7d5966266e..cc390daae3 100644 --- a/config/i18n.json +++ b/config/i18n.json @@ -782,6 +782,12 @@ "PullFromPostmasterGeneralError": "Unable to pull all items from Postmaster.", "PullFromPostmasterPopupTitle": "Pull from Postmaster", "NoSpace": "You're out of space in the vault and any other characters.", + "Prismatic": { + "Aspect": "Prismatic Aspect", + "Grenade": "Prismatic Grenade", + "Melee": "Prismatic Melee", + "Super": "Super Ability" + }, "Random": "Random", "Randomize": "Randomize Loadout", "RandomizeNew": "Create Random", diff --git a/src/app/loadout/mod-utils.ts b/src/app/loadout/mod-utils.ts index b6808da87d..8c35f86188 100644 --- a/src/app/loadout/mod-utils.ts +++ b/src/app/loadout/mod-utils.ts @@ -1,3 +1,4 @@ +import { t } from 'app/i18next-t'; import { PluggableInventoryItemDefinition } from 'app/inventory/item-types'; import { isPluggableItem } from 'app/inventory/store/sockets'; import { armor2PlugCategoryHashesByName } from 'app/search/d2-known-values'; @@ -95,7 +96,22 @@ export function createGetModRenderKey() { * e.g. "General Armor Mod", "Helmet Armor Mod", "Nightmare Mod" */ export function groupModsByModType(plugs: PluggableInventoryItemDefinition[]) { - return Object.groupBy(plugs, (plugDef) => plugDef.itemTypeDisplayName); + const plugHeader = (plug: PluggableInventoryItemDefinition) => { + // Annoyingly some Prismatic plugs' itemTypeDisplayNames include the damage type and light/dark, + // so map them to a common header here + if (plug.plug.plugCategoryIdentifier.endsWith('.prism.aspects')) { + return t('Loadouts.Prismatic.Aspect'); + } else if (plug.plug.plugCategoryIdentifier.endsWith('.prism.supers')) { + return t('Loadouts.Prismatic.Super'); + } else if (plug.plug.plugCategoryIdentifier.endsWith('.prism.grenades')) { + return t('Loadouts.Prismatic.Grenade'); + } else if (plug.plug.plugCategoryIdentifier.endsWith('.prism.melee')) { + return t('Loadouts.Prismatic.Melee'); + } else { + return plug.itemTypeDisplayName; + } + }; + return Object.groupBy(plugs, plugHeader); } /** diff --git a/src/app/utils/socket-utils.ts b/src/app/utils/socket-utils.ts index d38e1b033f..0218325b4c 100644 --- a/src/app/utils/socket-utils.ts +++ b/src/app/utils/socket-utils.ts @@ -215,12 +215,14 @@ export const aspectSocketCategoryHashes: SocketCategoryHashes[] = [ SocketCategoryHashes.Aspects_Abilities_Ikora, SocketCategoryHashes.Aspects_Abilities_Neomuna, SocketCategoryHashes.Aspects_Abilities_Stranger, + SocketCategoryHashes.Aspects_Abilities, ]; export const fragmentSocketCategoryHashes: SocketCategoryHashes[] = [ SocketCategoryHashes.Fragments_Abilities_Ikora, SocketCategoryHashes.Fragments_Abilities_Stranger, SocketCategoryHashes.Fragments_Abilities_Neomuna, + SocketCategoryHashes.Fragments_Abilities, ]; export const subclassAbilitySocketCategoryHashes: SocketCategoryHashes[] = [ diff --git a/src/locale/en.json b/src/locale/en.json index 02fdd317ed..9bbbad68b9 100644 --- a/src/locale/en.json +++ b/src/locale/en.json @@ -827,6 +827,12 @@ "OpenInOptimizer": "Optimize Armor", "PickArmor": "Pick Armor", "PickMods": "Add armor mods", + "Prismatic": { + "Aspect": "Prismatic Aspect", + "Grenade": "Prismatic Grenade", + "Melee": "Prismatic Melee", + "Super": "Super Ability" + }, "PullFromPostmaster": "Collect Postmaster", "PullFromPostmasterError": "Unable to pull from Postmaster: {{error}}.", "PullFromPostmasterGeneralError": "Unable to pull all items from Postmaster.",