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
13 changes: 12 additions & 1 deletion packages/client/src/components/ActionsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ export const MONSTER_MOVE_MAPPING: Record<string, string> = {
'12': 'Venom Bite',
'13': 'Ember',
'14': 'Iron Sword',
'15': 'Wall of Force',
'16': 'Venom Bite',
'17': 'Claw',
'18': 'Wall of Force',
'19': 'Burrow Strike',
'20': 'Steel Sword',
'21': 'Fire Lance',
'22': 'Spectral Bite',
'23': 'Maul',
'24': 'Steel Sword',
'25': 'Dragon Breath',
};

export const ActionsPanel = (): JSX.Element => {
Expand Down Expand Up @@ -526,7 +537,7 @@ export const ActionsPanel = (): JSX.Element => {
const itemName =
currentBattle?.encounterType === EncounterType.PvE &&
attack.attackerId !== character?.id
? MONSTER_MOVE_MAPPING[(opponent as Monster).mobId]
? MONSTER_MOVE_MAPPING[(opponent as Monster).mobId] ?? 'an item'
: attackItem?.name ?? 'an item';

const possibleStatusEffectAttack = statusEffectActions.find(
Expand Down
10 changes: 9 additions & 1 deletion packages/client/src/components/StatsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ export const StatsPanel = (): JSX.Element => {
};
}, [character]);

const consumablesInInventory = useMemo(() => {
return inventoryConsumables
.reduce((acc, item) => {
return acc + item.balance;
}, BigInt(0))
.toString();
}, [inventoryConsumables]);

if (!character) {
return (
<VStack h="100%" justify="center">
Expand Down Expand Up @@ -412,7 +420,7 @@ export const StatsPanel = (): JSX.Element => {
>
<Text fontWeight={500}>Consumables</Text>
<HStack h={6}>
<Text fontWeight={700}>{inventoryConsumables.length}</Text>
<Text fontWeight={700}>{consumablesInInventory}</Text>
<PotionSvg mb={0.5} theme="dark" />
</HStack>
</HStack>
Expand Down
30 changes: 27 additions & 3 deletions packages/client/src/pages/Character.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,30 @@ const ItemsPanel = ({ character }: { character: Character }): JSX.Element => {
const maxWeaponsEquipped =
equippedSpellsAndWeaponsIds.length === MAX_EQUIPPED_WEAPONS;

const armorInInventory = useMemo(() => {
return inventoryArmor
.reduce((acc, item) => {
return acc + item.balance;
}, BigInt(0))
.toString();
}, [inventoryArmor]);

const spellsAndWeaponsInInventory = useMemo(() => {
return spellsAndWeapons
.reduce((acc, item) => {
return acc + item.balance;
}, BigInt(0))
.toString();
}, [spellsAndWeapons]);

const consumablesInInventory = useMemo(() => {
return inventoryConsumables
.reduce((acc, item) => {
return acc + item.balance;
}, BigInt(0))
.toString();
}, [inventoryConsumables]);

if (isLoadingItemTemplates) {
return (
<Center h="100%">
Expand Down Expand Up @@ -779,7 +803,7 @@ const ItemsPanel = ({ character }: { character: Character }): JSX.Element => {
</HStack>
<PolygonalCard clipPath="none" p={6}>
<Text fontWeight="bold" mt={{ base: 8, lg: 0 }} size="lg">
Armor ({inventoryArmor.length}) - {equippedArmor.length}/
Armor ({armorInInventory}) - {equippedArmor.length}/
{MAX_EQUIPPED_ARMOR} equipped{' '}
</Text>
{maxArmorEquipped && <Text fontSize="sm">(Max armor equipped)</Text>}
Expand Down Expand Up @@ -815,7 +839,7 @@ const ItemsPanel = ({ character }: { character: Character }): JSX.Element => {
})}
</Grid>
<Text fontWeight="bold" mt={{ base: 8, lg: 12 }} size="lg">
Weapons & Spells ({spellsAndWeapons.length}) -{' '}
Weapons & Spells ({spellsAndWeaponsInInventory}) -{' '}
{equippedSpellsAndWeaponsIds.length}/{MAX_EQUIPPED_WEAPONS} equipped{' '}
</Text>
{maxWeaponsEquipped && (
Expand Down Expand Up @@ -856,7 +880,7 @@ const ItemsPanel = ({ character }: { character: Character }): JSX.Element => {
})}
</Grid>
<Text fontWeight="bold" mt={{ base: 8, lg: 12 }} size="lg">
Consumables ({inventoryConsumables.length})
Consumables ({consumablesInInventory})
</Text>
<Grid
templateColumns={{
Expand Down