Skip to content

Commit

Permalink
Merge pull request #9764 from robojumper/strip-sockets-discounted-mods
Browse files Browse the repository at this point in the history
Add discounted mods option to Strip Sockets
  • Loading branch information
bhollis authored Aug 23, 2023
2 parents ddac260 + b97812d commit 3e897dc
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,7 @@
"Shaders": "{{count}}x Shader",
"Ornaments": "{{count}}x Ornament",
"WeaponMods": "{{count}}x Weapon Mod",
"DiscountedMods": "{{count}}x Discounted Mod",
"ArmorMods": "{{count}}x Armor Mod",
"Subclass": "{{count}}x Subclass Option",
"Others": "{{count}}x Ghost Projection"
Expand Down
4 changes: 4 additions & 0 deletions src/app/loadout/mod-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ export function mapToNonReducedModCostVariant(plugHash: number): number {
return reducedToNormalMod[plugHash] ?? plugHash;
}

export function isReducedModCostVariant(plugHash: number): boolean {
return reducedToNormalMod[plugHash] !== undefined;
}

/**
* Find the complementary cost variant.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/app/strip-sockets/StripSockets.m.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
}

.plug {
cursor: pointer;

&.ok {
opacity: 0.3;
transform: scale(0.8);
Expand Down
7 changes: 6 additions & 1 deletion src/app/strip-sockets/StripSockets.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { PressTip } from 'app/dim-ui/PressTip';
import Sheet from 'app/dim-ui/Sheet';
import { t } from 'app/i18next-t';
import { locateItem } from 'app/inventory/locate-item';
import { destiny2CoreSettingsSelector, useD2Definitions } from 'app/manifest/selectors';
import { filterFactorySelector } from 'app/search/search-filter';
import { AppIcon, faCheckCircle, refreshIcon } from 'app/shell/icons';
Expand Down Expand Up @@ -253,7 +254,11 @@ function StripSocketsProcess({
<div className={styles.iconList}>
{socketList.map((socket, idx) => {
const state = socketStates[idx];
const icon = <DefItemIcon itemDef={socket.plugItemDef} />;
const icon = (
<div onClick={() => locateItem(socket.item)}>
<DefItemIcon itemDef={socket.plugItemDef} />
</div>
);
const failed = state !== 'ok' && state !== 'todo';
const key = `${socket.item.index}-${socket.socketIndex}`;
const className = clsx('item', styles.plug, {
Expand Down
8 changes: 8 additions & 0 deletions src/app/strip-sockets/strip-sockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { D2ManifestDefinitions } from 'app/destiny2/d2-definitions';
import { I18nKey, tl } from 'app/i18next-t';
import { canInsertPlug, insertPlug } from 'app/inventory/advanced-write-actions';
import { DimItem, DimSocket, PluggableInventoryItemDefinition } from 'app/inventory/item-types';
import { isReducedModCostVariant } from 'app/loadout/mod-utils';
import { DEFAULT_ORNAMENTS } from 'app/search/d2-known-values';
import { ThunkResult } from 'app/store/types';
import { CancelToken } from 'app/utils/cancel';
Expand All @@ -21,6 +22,7 @@ export type SocketKind =
| 'ornaments'
| 'weaponmods'
| 'armormods'
| 'discountedmods'
| 'subclass'
| 'others';

Expand All @@ -35,6 +37,9 @@ function identifySocket(
} else if (plugDef.itemCategoryHashes?.includes(ItemCategoryHashes.WeaponModsDamage)) {
return 'weaponmods';
} else if (plugDef.itemCategoryHashes?.includes(ItemCategoryHashes.ArmorMods)) {
if (isReducedModCostVariant(plugDef.hash)) {
return 'discountedmods';
}
return 'armormods';
} else if (plugDef.plug.plugCategoryHash === PlugCategoryHashes.Hologram) {
return 'others';
Expand Down Expand Up @@ -66,6 +71,9 @@ export function collectSocketsToStrip(
armormods: {
name: tl('StripSockets.ArmorMods'),
},
discountedmods: {
name: tl('StripSockets.DiscountedMods'),
},
subclass: {
name: tl('StripSockets.Subclass'),
},
Expand Down
1 change: 1 addition & 0 deletions src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,7 @@
"Button": "Strip {{numSockets}} Sockets",
"Cancel": "Cancel",
"Choose": "Choose Sockets to strip",
"DiscountedMods": "{{count}}x Discounted Mod",
"Done": "Stripped Sockets",
"NoSockets": "No Sockets to clear",
"Ok": "Ok",
Expand Down

0 comments on commit 3e897dc

Please sign in to comment.