Skip to content

Commit

Permalink
add blowpipeDartName
Browse files Browse the repository at this point in the history
  • Loading branch information
jayktaylor committed Jul 4, 2024
1 parent e283f86 commit 6d9da8e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/app/components/player/equipment/EquipmentGridSlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { observer } from 'mobx-react-lite';
import { useStore } from '@/state';
import { getCdnImage } from '@/utils';
import UserIssueWarning from '@/app/components/generic/UserIssueWarning';
import { BLOWPIPE_IDS } from '@/lib/constants';

interface EquipmentGridSlotProps {
slot: keyof PlayerEquipment;
Expand All @@ -19,6 +20,17 @@ const EquipmentGridSlot: React.FC<EquipmentGridSlotProps> = observer((props) =>
// Determine whether there's any issues with this element
const issues = store.userIssues.filter((i) => i.type.startsWith(`equipment_slot_${slot}`) && i.loadout === `${store.selectedLoadout + 1}`);

const getTooltipContent = () => {
if (currentSlot !== null) {
// Special handling for blowpipes
if (BLOWPIPE_IDS.includes(currentSlot.id)) {
return `${currentSlot.name} (${currentSlot.itemVars?.blowpipeDartName?.replace(' dart', '') || 'Unknown dart'})`;
}
}

return currentSlot?.name;
};

return (
<div className="h-[40px] w-[40px] relative">
{
Expand All @@ -31,7 +43,7 @@ const EquipmentGridSlot: React.FC<EquipmentGridSlotProps> = observer((props) =>
className={`flex justify-center items-center h-[40px] w-[40px] bg-body-100 dark:bg-dark-400 dark:border-dark-400 border border-body-300 transition-colors rounded ${!isEmpty ? 'cursor-pointer hover:border-red' : ''}`}
data-slot={slot}
data-tooltip-id="tooltip"
data-tooltip-content={currentSlot?.name}
data-tooltip-content={getTooltipContent()}
onMouseDown={() => {
if (!isEmpty) store.clearEquipmentSlot(slot);
}}
Expand Down
1 change: 1 addition & 0 deletions src/app/components/player/equipment/EquipmentSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const EquipmentSelect: React.FC = observer(() => {
...blowpipe.equipment,
itemVars: {
...blowpipe.equipment.itemVars,
blowpipeDartName: dart.name,
blowpipeDartId: dart.id,
},
},
Expand Down
1 change: 1 addition & 0 deletions src/types/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface EquipmentPiece extends EquipmentStats {
category: EquipmentCategory;
isTwoHanded: boolean;
itemVars?: {
blowpipeDartName?: string;
blowpipeDartId?: number;
};
}
Expand Down

0 comments on commit 6d9da8e

Please sign in to comment.