Skip to content

Commit

Permalink
Merge pull request #10653 from DestinyItemManager/clean-sockets
Browse files Browse the repository at this point in the history
Remove damage mods from weapons
  • Loading branch information
bhollis authored Jul 25, 2024
2 parents 7dd043f + d293e1c commit 2e7d2d3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 15 deletions.
24 changes: 12 additions & 12 deletions src/app/inventory/__snapshots__/d2-stores.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -27643,7 +27643,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Owner": "Vault",
"Perks 0": "High-Impact Frame*",
"Perks 1": "Arrowhead Brake*",
"Perks 10": "Empty Memento Socket*",
"Perks 10": undefined,
"Perks 11": undefined,
"Perks 12": undefined,
"Perks 13": undefined,
Expand Down Expand Up @@ -28325,7 +28325,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Owner": "Vault",
"Perks 0": "Lightweight Frame*",
"Perks 1": "Chambered Compensator*",
"Perks 10": "Empty Memento Socket*",
"Perks 10": undefined,
"Perks 11": undefined,
"Perks 12": undefined,
"Perks 13": undefined,
Expand Down Expand Up @@ -28697,7 +28697,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Owner": "Vault",
"Perks 0": "Precision Frame*",
"Perks 1": "Fluted Barrel*",
"Perks 10": "Empty Memento Socket*",
"Perks 10": undefined,
"Perks 11": undefined,
"Perks 12": undefined,
"Perks 13": undefined,
Expand Down Expand Up @@ -28883,7 +28883,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Owner": "Vault",
"Perks 0": "Precision Frame*",
"Perks 1": "Extended Barrel*",
"Perks 10": "Empty Memento Socket*",
"Perks 10": undefined,
"Perks 11": undefined,
"Perks 12": undefined,
"Perks 13": undefined,
Expand Down Expand Up @@ -30371,7 +30371,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Owner": "Vault",
"Perks 0": "Lightweight Frame*",
"Perks 1": "Arrowhead Brake*",
"Perks 10": "Empty Memento Socket*",
"Perks 10": undefined,
"Perks 11": undefined,
"Perks 12": undefined,
"Perks 13": undefined,
Expand Down Expand Up @@ -30495,7 +30495,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Owner": "Vault",
"Perks 0": "Precision Frame*",
"Perks 1": "Full Bore*",
"Perks 10": "Empty Memento Socket*",
"Perks 10": undefined,
"Perks 11": undefined,
"Perks 12": undefined,
"Perks 13": undefined,
Expand Down Expand Up @@ -30557,7 +30557,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Owner": "Vault",
"Perks 0": "High-Impact Frame*",
"Perks 1": "Corkscrew Rifling*",
"Perks 10": "Empty Memento Socket*",
"Perks 10": undefined,
"Perks 11": undefined,
"Perks 12": undefined,
"Perks 13": undefined,
Expand Down Expand Up @@ -30619,7 +30619,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Owner": "Vault",
"Perks 0": "High-Impact Frame*",
"Perks 1": "Chambered Compensator*",
"Perks 10": "Empty Memento Socket*",
"Perks 10": undefined,
"Perks 11": undefined,
"Perks 12": undefined,
"Perks 13": undefined,
Expand Down Expand Up @@ -30805,7 +30805,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Owner": "Vault",
"Perks 0": "Adaptive Frame*",
"Perks 1": "Extended Barrel*",
"Perks 10": "Empty Memento Socket*",
"Perks 10": undefined,
"Perks 11": undefined,
"Perks 12": undefined,
"Perks 13": undefined,
Expand Down Expand Up @@ -31494,7 +31494,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Perks 2": "Quickdraw IS",
"Perks 3": "Accelerated Coils*",
"Perks 4": "Hip-Fire Grip*",
"Perks 5": "Void Damage Mod*",
"Perks 5": undefined,
"Perks 6": undefined,
"Perks 7": undefined,
"Perks 8": undefined,
Expand Down Expand Up @@ -31558,7 +31558,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Perks 4": "High-Caliber Rounds*",
"Perks 5": "Tactical Mag",
"Perks 6": "Under Pressure*",
"Perks 7": "Kinetic Damage Mod*",
"Perks 7": undefined,
"Perks 8": undefined,
"Perks 9": undefined,
"Power": 1918,
Expand Down Expand Up @@ -31680,7 +31680,7 @@ exports[`process stores generates a correct Weapons CSV export 1`] = `
"Perks 2": "Quick Launch",
"Perks 3": "Sticky Grenades*",
"Perks 4": "Quickdraw*",
"Perks 5": "Arc Damage Mod*",
"Perks 5": undefined,
"Perks 6": undefined,
"Perks 7": undefined,
"Perks 8": undefined,
Expand Down
18 changes: 15 additions & 3 deletions src/app/utils/socket-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
armor2PlugCategoryHashes,
} from 'app/search/d2-known-values';
import { DestinySocketCategoryStyle, TierType } from 'bungie-api-ts/destiny2';
import { emptyPlugHashes } from 'data/d2/empty-plug-hashes';
import {
BucketHashes,
ItemCategoryHashes,
Expand Down Expand Up @@ -136,8 +137,14 @@ export function getIntrinsicArmorPerkSocket(item: DimItem): DimSocket | undefine
}
}

/**
* returns sockets that contains intrinsic perks even if those sockets are not
* the "Intrinsic" socket. This handles the exotic class items that were added
* in The Final Shape. Note that items with a normal intrinsic perk (so far)
* won't have anything here, while exotic class items (so far) don't have a
* normal intrinsic.
*/
export function getExtraIntrinsicPerkSockets(item: DimItem): DimSocket[] {
// returns sockets that contains intrinsic perks even if those sockets are not the "Intrinsic" socket
return item.isExotic && item.bucket.hash === BucketHashes.ClassArmor && item.sockets
? item.sockets.allSockets
.filter((s) => s.isPerk && s.visibleInGame && socketContainsIntrinsicPlug(s))
Expand Down Expand Up @@ -291,8 +298,10 @@ function filterSocketCategories(
*/
export function isSocketEmpty(socket: DimSocket) {
return (
socket.plugged?.plugDef.hash === socket.emptyPlugItemHash &&
socket.plugged?.plugDef.plug.plugCategoryHash !== PlugCategoryHashes.V400EmptyExoticMasterwork
socket.plugged &&
(socket.plugged.plugDef.hash === socket.emptyPlugItemHash ||
emptyPlugHashes.has(socket.plugged?.plugDef.hash)) &&
socket.plugged.plugDef.plug.plugCategoryHash !== PlugCategoryHashes.V400EmptyExoticMasterwork
);
}

Expand Down Expand Up @@ -342,6 +351,9 @@ export function getWeaponSockets(
PlugCategoryHashes.CraftingPlugsWeaponsModsTransfusersLevel,
// Hide catalyst socket for exotics with no known catalyst
!item.catalystInfo && PlugCategoryHashes.V400EmptyExoticMasterwork,
PlugCategoryHashes.V300WeaponDamageTypeEnergy,
PlugCategoryHashes.V300WeaponDamageTypeAttack,
PlugCategoryHashes.V300WeaponDamageTypeKinetic,
];

const modSocketsByCategory = filterSocketCategories(
Expand Down

0 comments on commit 2e7d2d3

Please sign in to comment.