2024-09-06 23:17:53 -05:00
|
|
|
import {
|
|
|
|
|
asset,
|
|
|
|
|
consumableDefinitions,
|
|
|
|
|
gameDefinitions,
|
|
|
|
|
provisionDefinitions,
|
|
|
|
|
} from '@blitzkit/core';
|
2024-08-16 12:58:17 -05:00
|
|
|
import { Box, Flex, Heading, Text } from '@radix-ui/themes';
|
2024-08-16 12:52:29 -05:00
|
|
|
import * as Duel from '../../../../../../stores/duel';
|
|
|
|
|
|
2024-09-21 20:26:58 -05:00
|
|
|
const awaitedGameDefinitions = await gameDefinitions;
|
|
|
|
|
const awaitedConsumableDefinitions = await consumableDefinitions;
|
|
|
|
|
const awaitedProvisionDefinitions = await provisionDefinitions;
|
|
|
|
|
|
2024-08-16 12:52:29 -05:00
|
|
|
export function GameModeSection() {
|
|
|
|
|
const tank = Duel.use((state) => state.protagonist.tank);
|
2024-08-16 20:06:37 -05:00
|
|
|
const roles = Object.entries(tank.roles);
|
|
|
|
|
|
|
|
|
|
if (roles.length === 0) return null;
|
2024-08-16 12:52:29 -05:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Flex direction="column" gap="4" align="center">
|
|
|
|
|
<Heading size="6">Game mode abilities</Heading>
|
|
|
|
|
|
2024-08-16 12:58:17 -05:00
|
|
|
<Flex justify="center" gap="4" wrap="wrap" px="4">
|
2024-08-16 20:06:37 -05:00
|
|
|
{roles.map(([key, value]) => {
|
2024-08-16 12:52:29 -05:00
|
|
|
const id = Number(key);
|
|
|
|
|
const gameMode = awaitedGameDefinitions.gameModes[id];
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Flex
|
2024-08-19 20:29:18 -05:00
|
|
|
key={id}
|
2024-08-21 19:45:33 -05:00
|
|
|
width="16rem"
|
2024-08-19 13:45:12 -05:00
|
|
|
height="20rem"
|
2024-08-16 12:52:29 -05:00
|
|
|
overflow="hidden"
|
2024-08-16 19:41:03 -05:00
|
|
|
direction="column"
|
2024-08-16 12:52:29 -05:00
|
|
|
style={{
|
|
|
|
|
borderRadius: 'var(--radius-3)',
|
2024-09-06 23:17:53 -05:00
|
|
|
background: `url(${asset(
|
|
|
|
|
`icons/game_mode_banners/${id}.webp`,
|
|
|
|
|
)})`,
|
2024-08-16 12:52:29 -05:00
|
|
|
backgroundSize: 'cover',
|
|
|
|
|
backgroundPosition: 'center',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Box
|
2024-08-26 10:21:03 -05:00
|
|
|
flexGrow="1"
|
2024-08-16 12:52:29 -05:00
|
|
|
style={{
|
2024-09-06 23:17:53 -05:00
|
|
|
background: `url(${asset(
|
|
|
|
|
`icons/game_mode_banners/${id}.webp`,
|
|
|
|
|
)})`,
|
2024-08-16 12:52:29 -05:00
|
|
|
backgroundSize: 'cover',
|
|
|
|
|
backgroundPosition: 'center',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Flex
|
|
|
|
|
p="3"
|
2024-08-16 12:58:17 -05:00
|
|
|
direction="column"
|
2024-08-19 13:45:12 -05:00
|
|
|
height="98px"
|
|
|
|
|
flexShrink="0"
|
2024-08-16 12:52:29 -05:00
|
|
|
style={{
|
|
|
|
|
backdropFilter: 'blur(4rem)',
|
2024-08-16 12:58:17 -05:00
|
|
|
WebkitBackdropFilter: 'blur(4rem)',
|
2024-08-16 12:52:29 -05:00
|
|
|
}}
|
2024-08-16 14:09:58 -05:00
|
|
|
align="center"
|
|
|
|
|
justify="center"
|
2024-08-16 12:52:29 -05:00
|
|
|
>
|
2024-08-16 14:09:58 -05:00
|
|
|
<Text size="4" weight="bold">
|
|
|
|
|
{gameMode.name}
|
|
|
|
|
</Text>
|
|
|
|
|
|
|
|
|
|
<Flex direction="column">
|
|
|
|
|
{awaitedGameDefinitions.roles[value].provisions.map((id) => {
|
|
|
|
|
const provisions = awaitedProvisionDefinitions[id];
|
|
|
|
|
|
|
|
|
|
return (
|
2024-08-19 20:28:25 -05:00
|
|
|
<Text color="gray" wrap="nowrap" key={id}>
|
2024-08-16 14:09:58 -05:00
|
|
|
<Flex align="center" gap="1">
|
|
|
|
|
<img
|
|
|
|
|
style={{
|
2024-08-16 19:41:03 -05:00
|
|
|
width: '1.5em',
|
|
|
|
|
height: '1.5em',
|
2024-08-16 14:09:58 -05:00
|
|
|
objectFit: 'contain',
|
|
|
|
|
}}
|
|
|
|
|
src={asset(`icons/provisions/${id}.webp`)}
|
|
|
|
|
alt={provisions.name}
|
|
|
|
|
/>
|
|
|
|
|
{provisions.name}
|
|
|
|
|
</Flex>
|
|
|
|
|
</Text>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
{awaitedGameDefinitions.roles[value].consumables.map((id) => {
|
|
|
|
|
const consumable = awaitedConsumableDefinitions[id];
|
|
|
|
|
|
|
|
|
|
return (
|
2024-08-19 20:28:56 -05:00
|
|
|
<Text color="gray" wrap="nowrap" key={id}>
|
2024-08-16 14:09:58 -05:00
|
|
|
<Flex align="center" gap="1">
|
|
|
|
|
<img
|
|
|
|
|
style={{
|
2024-08-16 19:41:03 -05:00
|
|
|
width: '1.5em',
|
|
|
|
|
height: '1.5em',
|
2024-08-16 14:09:58 -05:00
|
|
|
objectFit: 'contain',
|
|
|
|
|
}}
|
|
|
|
|
src={asset(`icons/consumables/${id}.webp`)}
|
|
|
|
|
alt={consumable.name}
|
|
|
|
|
/>
|
|
|
|
|
{consumable.name}
|
|
|
|
|
</Flex>
|
|
|
|
|
</Text>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Flex>
|
2024-08-16 12:52:29 -05:00
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</Flex>
|
|
|
|
|
</Flex>
|
|
|
|
|
);
|
|
|
|
|
}
|