message: revert to basic intrinsic match for d2
diff: @@ -16,11 +16,16 @@ import { RootState } from '../store/reducers';
  import Sheet from '../dim-ui/Sheet';
  import { showNotification } from '../notifications/notifications';
  import { scrollToPosition } from 'app/dim-ui/scroll';
  -import { DestinyDisplayPropertiesDefinition } from 'bungie-api-ts/destiny2';
  +import {
  + DestinyDisplayPropertiesDefinition,
  + DestinyInventoryItemDefinition
  +} from 'bungie-api-ts/destiny2';
  import { makeDupeID } from 'app/search/search-filters';
  import { D2ManifestDefinitions } from '../destiny2/d2-definitions';
  import { getItemDamageType, getItemSpecialtyModSlotDisplayName } from 'app/utils/item-utils';
  -import intrinsicLookupTable from 'data/d2/intrinsic-perk-lookup.json';
  +// import intrinsicLookupTable from 'data/d2/intrinsic-perk-lookup.json';
  +// we are falling back to using just an exactly matching intrinsic perk for now
  +// archetypes are difficult.
  import { INTRINSIC_PLUG_CATEGORY } from 'app/inventory/store/sockets';
  import BungieImage from 'app/dim-ui/BungieImage';
  interface StoreProps {
  @@ -470,19 +475,16 @@ class Compare extends React.Component<Props, State> {
  return itemRpmStat?.value || -99999999;
  };
  + /* disabled for now
  const weaponTypes = Object.keys(intrinsicLookupTable).map(Number);
  const thisWeaponsType =
  weaponTypes.find((h) => exampleItem.itemCategoryHashes.includes(h)) || -99999999;
  - const exampleItemRpm = getRpm(exampleItem);
  -
  - /** d2ai-generated list of intrinsic hashes that count as matching our example item */
  const matchingIntrisics = intrinsicLookupTable[thisWeaponsType]?.[exampleItemRpm];
  const intrinsicPerk =
  matchingIntrisics &&
  this.props.defs &&
  this.props.defs.InventoryItem.get(matchingIntrisics[0]);
  const intrinsicName = intrinsicPerk?.displayProperties.name || t('Compare.Archetype');
  -
  const getIntrinsicPerk: (item: D2Item) => number = (item) => {
  const intrinsic =
  item.sockets &&
  @@ -491,6 +493,21 @@ class Compare extends React.Component<Props, State> {
  );
  return intrinsic?.plug?.plugItem.hash || -99999999;
  };
  + */
  + const getIntrinsicPerk: (item: D2Item) => DestinyInventoryItemDefinition | undefined = (
  + item
  + ) => {
  + const intrinsic =
  + item.sockets &&
  + item.sockets.sockets.find((s) =>
  + s.plug?.plugItem.itemCategoryHashes?.includes(INTRINSIC_PLUG_CATEGORY)
  + );
  + return intrinsic?.plug?.plugItem;
  + };
  + const exampleItemRpm = getRpm(exampleItem);
  + const intrinsic = exampleItem.isDestiny2() && getIntrinsicPerk(exampleItem);
  + const intrinsicName = (intrinsic && intrinsic.displayProperties.name) || t('Compare.Archetype');
  + const intrinsicHash = intrinsic && intrinsic.hash;
  // minimum filter: make sure it's all weapons and the same weapon type
  allWeapons = allWeapons
  @@ -524,11 +541,7 @@ class Compare extends React.Component<Props, State> {
  buttonLabel: <>{[intrinsicName, exampleItem.typeName].join(' + ')}</>,
  items: exampleItem.isDestiny2()
  ? allWeapons.filter(
  - (i) =>
  - i.isDestiny2() &&
  - i.sockets &&
  - matchingIntrisics &&
  - matchingIntrisics.includes(getIntrinsicPerk(i))
  + (i) => i.isDestiny2() && i.sockets && getIntrinsicPerk(i)?.hash === intrinsicHash
  )
  : allWeapons.filter((i) => exampleItemRpm === getRpm(i))
  },
  