1 import React from 'react';
3 import CountDisplay from './CountDisplay';
4 import ToggleIcon from './ToggleIcon';
8 getDungeonRemainingItems,
10 } from '../../helpers/tracker';
11 import { useTracker } from '../../hooks/tracker';
13 const Dungeons = () => {
14 const { config, dungeons, state } = useTracker();
16 const layout = React.useMemo(() => {
18 const compassX = shouldShowDungeonItem(config, 'Map') ? mapX + 1 : mapX;
19 const smallX = shouldShowDungeonItem(config, 'Compass') ? compassX + 1 : compassX;
20 const bigX = shouldShowDungeonItem(config, 'Small') ? smallX + 1 : smallX;
21 const countX = shouldShowDungeonItem(config, 'Big') ? bigX + 1 : bigX;
22 const bossX = countX + 1;
23 const prizeX = bossX + 1;
24 const dungeonWidth = prizeX + 1;
25 const width = (4 * dungeonWidth) + 2;
27 const viewBox = `0 0 ${width} ${height}`;
34 map: `translate(${mapX} 0) scale(0.9)`,
35 compass: `translate(${compassX} 0) scale(0.9)`,
36 small: `translate(${smallX} 0) scale(0.9)`,
37 big: `translate(${bigX} 0) scale(0.9)`,
38 checks: `translate(${countX} 0) scale(0.9)`,
39 boss: `translate(${bossX} 0)`,
40 prize: `translate(${prizeX} 0)`,
41 hc: 'translate(0.5, 0.5)',
42 ct: 'translate(0.5, 1.5)',
43 gt: 'translate(0.5, 2.5)',
44 gtBoss1: `translate(${bossX - 2} 1)`,
45 gtBoss2: `translate(${bossX - 1} 1)`,
46 gtBoss3: `translate(${bossX} 1)`,
47 ep: `translate(${dungeonWidth + 0.5}, 0.5)`,
48 dp: `translate(${dungeonWidth + 0.5}, 1.5)`,
49 th: `translate(${dungeonWidth + 0.5}, 2.5)`,
50 pd: `translate(${(2 * dungeonWidth) + 1.5}, 0.5)`,
51 sp: `translate(${(2 * dungeonWidth) + 1.5}, 1.5)`,
52 sw: `translate(${(2 * dungeonWidth) + 1.5}, 2.5)`,
53 tt: `translate(${(2 * dungeonWidth) + 1.5}, 3.5)`,
54 ip: `translate(${(3 * dungeonWidth) + 2.5}, 0.5)`,
55 mm: `translate(${(3 * dungeonWidth) + 2.5}, 1.5)`,
56 tr: `translate(${(3 * dungeonWidth) + 2.5}, 2.5)`,
59 }, [config, dungeons]);
62 xmlns="http://www.w3.org/2000/svg"
65 height={layout.height}
66 viewBox={layout.viewBox}
67 onContextMenu={(e) => {
72 {dungeons.map(dungeon =>
74 className={`dungeon dungeon-${dungeon.id}`}
76 transform={layout.transform[dungeon.id]}
78 <g transform={layout.transform.tag}>
79 <text className="dungeon-tag">{dungeon.id.toUpperCase()}</text>
81 {shouldShowDungeonItem(config, 'Map') ?
82 <g transform={layout.transform.map}>
84 controller={ToggleIcon.dungeonController(dungeon)}
90 {shouldShowDungeonItem(config, 'Compass') ?
91 <g transform={layout.transform.compass}>
93 controller={ToggleIcon.dungeonController(dungeon)}
99 {shouldShowDungeonItem(config, 'Small') ?
100 <g transform={layout.transform.small}>
102 controller={ToggleIcon.dungeonCountController(dungeon, dungeon.sk)}
103 icons={['small-key']}
107 count={getDungeonAcquiredSKs(state, dungeon)}
112 {shouldShowDungeonItem(config, 'Big') ?
113 <g transform={layout.transform.big}>
115 controller={ToggleIcon.dungeonController(dungeon)}
121 <g transform={layout.transform.checks}>
123 controller={ToggleIcon.dungeonCheckController(dungeon)}
124 icons={['open-chest', 'chest']}
127 <CountDisplay count={getDungeonRemainingItems(state, dungeon)} />
130 <g transform={layout.transform.boss}>
132 controller={ToggleIcon.dungeonBossController(dungeon)}
133 icons={dungeon.bosses}
139 <g transform={layout.transform.prize}>
141 controller={ToggleIcon.dungeonPrizeController(dungeon)}
152 {dungeon.id === 'gt' && config.bossShuffle ? <>
153 <g transform={layout.transform.gtBoss1}>
155 controller={ToggleIcon.gtBossController('bot')}
160 <g transform={layout.transform.gtBoss2}>
162 controller={ToggleIcon.gtBossController('mid')}
167 <g transform={layout.transform.gtBoss3}>
169 controller={ToggleIcon.gtBossController('top')}
180 export default Dungeons;