Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/app/armory/Armory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ export default function Armory({
)}
{item.pursuit?.questLine?.description && (
<p>
<RichDestinyText text={item.pursuit.questLine.description} ownerId={item.owner} />
<RichDestinyText
text={item.pursuit.questLine.description}
ownerId={item.vendor?.characterId ?? item.owner}
/>
</p>
)}
{itemDef.setData?.itemList && (
Expand Down
5 changes: 4 additions & 1 deletion src/app/dim-ui/DestinyTooltipText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export function DestinyTooltipText({ item }: { item: DimItem }) {
>
{isExpirationTooltip(tip) && <AppIcon icon={faClock} />}
{isPatternTooltip(tip) && <AppIcon className={styles.shapedIcon} icon={shapedIcon} />}
<RichDestinyText text={tip.displayString} ownerId={item.owner} />
<RichDestinyText
text={tip.displayString}
ownerId={item.vendor?.characterId ?? item.owner}
/>
</div>
))}
</>
Expand Down
6 changes: 5 additions & 1 deletion src/app/inventory/store/d2-item-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ export function makeFakeItem(
quantity = 1,
allowWishList = false,
itemValueVisibility,
tooltipNotificationIndexes = [],
}: {
itemInstanceId?: string;
quantity?: number;
allowWishList?: boolean;
/** if available, this should be passed in from a vendor saleItem (DestinyVendorSaleItemComponent) */
itemValueVisibility?: DestinyVendorSaleItemComponent['itemValueVisibility'];
tooltipNotificationIndexes?: number[] | undefined;
} = emptyObject(),
): DimItem | undefined {
const item = makeItem(
Expand All @@ -174,7 +176,7 @@ export function makeFakeItem(
lockable: false,
state: ItemState.None,
isWrapper: false,
tooltipNotificationIndexes: [],
tooltipNotificationIndexes: tooltipNotificationIndexes ?? [],
metricObjective: {} as DestinyObjectiveProgress,
versionNumber: context.defs.InventoryItem.get(itemHash)?.quality?.currentVersion,
},
Expand Down Expand Up @@ -397,6 +399,8 @@ export function makeItem(

const tooltipNotifications = item.tooltipNotificationIndexes?.length
? item.tooltipNotificationIndexes
// guarding against our special case for Synth bounties in case things change
.filter((i) => i >= 0 && i < itemDef.tooltipNotifications?.length)
// why the optional chain? well, somehow, an item can return tooltipNotificationIndexes,
// but have no tooltipNotifications in its def
.map((i) => itemDef.tooltipNotifications?.[i])
Expand Down
10 changes: 8 additions & 2 deletions src/app/item-popup/ItemDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ export default function ItemDescription({ item }: { item: DimItem }) {
<>
{Boolean(item.description?.length) && (
<div className={styles.description}>
<RichDestinyText text={item.description} ownerId={item.owner} />
<RichDestinyText
text={item.description}
ownerId={item.vendor?.characterId ?? item.owner}
/>
</div>
)}
{Boolean(item.displaySource?.length) && (
<div className={clsx(styles.description, styles.secondaryText)}>
<RichDestinyText text={item.displaySource} ownerId={item.owner} />
<RichDestinyText
text={item.displaySource}
ownerId={item.vendor?.characterId ?? item.owner}
/>
</div>
)}
</>
Expand Down
5 changes: 4 additions & 1 deletion src/app/item-popup/ItemPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ export default function ItemPopup({
(failureString) =>
failureString.length > 0 && (
<div className={styles.failureReason} key={failureString}>
<RichDestinyText text={failureString} ownerId={item.owner} />
<RichDestinyText
text={failureString}
ownerId={item.vendor?.characterId ?? item.owner}
/>
</div>
),
)}
Expand Down
2 changes: 1 addition & 1 deletion src/app/item-popup/ItemPopupHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function ItemPopupHeader({
<span className={styles.title}>{item.name}</span>
) : (
<h1 className={styles.title}>
<RichDestinyText text={item.name} ownerId={item.owner} />
<RichDestinyText text={item.name} ownerId={item.vendor?.characterId ?? item.owner} />
</h1>
)}
<div className={styles.subtitle}>
Expand Down
5 changes: 4 additions & 1 deletion src/app/progress/Pursuit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ export default function Pursuit({
{item.name}
</span>
<div className="milestone-description">
<RichDestinyText text={item.description} ownerId={item.owner} />
<RichDestinyText
text={item.description}
ownerId={item.vendor?.characterId ?? item.owner}
/>
</div>
</div>
</button>
Expand Down
21 changes: 21 additions & 0 deletions src/app/vendors/vendor-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createCollectibleFinder } from 'app/records/collectible-matching';
import { THE_FORBIDDEN_BUCKET, VendorHashes } from 'app/search/d2-known-values';
import { emptyArray } from 'app/utils/empty';
import {
DestinyClass,
DestinyCollectibleState,
DestinyDisplayPropertiesDefinition,
DestinyInventoryItemDefinition,
Expand All @@ -17,6 +18,16 @@ import { BucketHashes } from 'data/d2/generated-enums';
import { DimItem } from '../inventory/item-types';
import { ItemCreationContext, makeFakeItem } from '../inventory/store/d2-item-factory';

const SYNTH_BOUNTIES_EXHAUSTED = [1073165367, 2363327331, 2376000422];
const SYNTH_BOUNTIES_DUMMY = [171866827, 540971012, 3950721485];
const DestinyClassToSynthTooltipIndex: { [key in DestinyClass]: number } = {
[DestinyClass.Titan]: 1,
[DestinyClass.Hunter]: 2,
[DestinyClass.Warlock]: 0,
[DestinyClass.Classified]: -1,
[DestinyClass.Unknown]: -1,
};

/**
* This represents an item inside a vendor.
*/
Expand Down Expand Up @@ -81,6 +92,15 @@ function makeVendorItem(
const { defs, profileResponse } = context;

const inventoryItem = defs.InventoryItem.get(itemHash);
let tooltipNotificationIndexes: number[] = [];
if (SYNTH_BOUNTIES_EXHAUSTED.includes(itemHash)) {
tooltipNotificationIndexes = [0];
} else if (SYNTH_BOUNTIES_DUMMY.includes(itemHash)) {
const classType = profileResponse?.characters?.data?.[characterId]?.classType;
if (classType !== undefined && DestinyClassToSynthTooltipIndex[classType] > -1) {
tooltipNotificationIndexes = [DestinyClassToSynthTooltipIndex[classType]];
}
}
const vendorItem: VendorItem = {
failureStrings,
vendorItemIndex,
Expand Down Expand Up @@ -111,6 +131,7 @@ function makeVendorItem(
// vendor items are wish list enabled!
allowWishList: true,
itemValueVisibility: saleItem?.itemValueVisibility,
tooltipNotificationIndexes,
}),
};

Expand Down