Skip to content

Commit

Permalink
show enemy tiers and item levels in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisinajar committed Feb 4, 2024
1 parent 2ad9ba9 commit 9b62b22
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 35 deletions.
4 changes: 4 additions & 0 deletions src/components/combat/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ export function Combat(): JSX.Element {
value={challengeOption.id}
>
{challengeOption.name}
 
<Typography variant="caption" display="inline-block">
Tier {challengeOption.level}
</Typography>
</MenuItem>
))}
</Select>
Expand Down
4 changes: 2 additions & 2 deletions src/game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ export default function Home(): JSX.Element {
>
in the wiki
</Link>
. The game is nearly impossible to 100% out without
consulting the wiki.
. The game is nearly impossible to 100% without consulting
the wiki.
</Typography>

<Typography variant="h5" sx={{ mb: 2 }}>
Expand Down
42 changes: 25 additions & 17 deletions src/game/inventory/equipment-slot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,32 @@ export function EquipmentSlot({
onEquip(slot, e.target.value);
}}
>
{items.map((inventoryItem) => (
<MenuItem
key={inventoryItem.id}
value={inventoryItem.id}
disabled={otherEquippedItems.indexOf(inventoryItem.id) >= 0}
>
{inventoryItem.id === equipped ? (
<b>{itemDisplayName(inventoryItem)}</b>
) : (
itemDisplayName(inventoryItem)
)}
{inventoryItem.enchantment && (
<Typography variant="subtitle2" sx={{ color: "info.main" }}>
&nbsp;{getEnchantmentDisplay(inventoryItem.enchantment)}
{items.map((inventoryItem) => {
return (
<MenuItem
key={inventoryItem.id}
value={inventoryItem.id}
disabled={otherEquippedItems.indexOf(inventoryItem.id) >= 0}
>
{inventoryItem.id === equipped ? (
<b>{itemDisplayName(inventoryItem)}</b>
) : (
itemDisplayName(inventoryItem)
)}
<Typography
variant="caption"
sx={{ color: "info.secondary" }}
>
&nbsp;Lvl. {inventoryItem.level}
</Typography>
)}
</MenuItem>
))}
{inventoryItem.enchantment && (
<Typography variant="subtitle2" sx={{ color: "info.main" }}>
&nbsp;{getEnchantmentDisplay(inventoryItem.enchantment)}
</Typography>
)}
</MenuItem>
);
})}
</Select>
</FormControl>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/game/shop-items.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ query ShopItems {
name
cost
type
level
}
}
66 changes: 50 additions & 16 deletions src/game/shop/shop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function SellItemShop({
onChange={(e) => {
const itemId = e.target.value;
const inventoryItem = hero.inventory.find(
(item) => item.id === itemId
(item) => item.id === itemId,
);
if (!inventoryItem) {
return;
Expand All @@ -109,10 +109,25 @@ export function SellItemShop({
!sellItem || !!item.enchantment || isItemEquipped(hero, item)
}
>
{sellItem?.cost &&
`${itemDisplayName(
item
)}: ${sellItem.cost.toLocaleString()} Gold`}
{sellItem?.cost && (
<>
<Typography display="inline-block">
{itemDisplayName(item)}
</Typography>
&nbsp;
<Typography variant="caption" display="inline-block">
Lvl. {item.level}
</Typography>
&nbsp;
<Typography
variant="subtitle2"
display="inline-block"
sx={{ color: "info.main" }}
>
{sellItem.cost.toLocaleString()} Gold
</Typography>
</>
)}
{!sellItem?.cost && item.name}{" "}
{isItemEquipped(hero, item) && "*EQUIPPED*"}
</MenuItem>
Expand Down Expand Up @@ -158,17 +173,36 @@ export function ItemTypeShop({
}
}}
>
{items.map((shopItem) => (
<MenuItem
key={shopItem.id}
value={shopItem.id}
disabled={!shopItem.cost || shopItem.cost > hero.gold}
>
{shopItem.cost &&
`${shopItem.name}: ${shopItem.cost.toLocaleString()} Gold`}
{!shopItem.cost && shopItem.name}
</MenuItem>
))}
{items.map((shopItem) => {
return (
<MenuItem
key={shopItem.id}
value={shopItem.id}
disabled={!shopItem.cost || shopItem.cost > hero.gold}
>
{shopItem.cost && (
<>
<Typography display="inline-block">
{itemDisplayName(shopItem)}
</Typography>
&nbsp;
<Typography variant="caption" display="inline-block">
Lvl. {shopItem.level}
</Typography>
&nbsp;
<Typography
variant="subtitle2"
display="inline-block"
sx={{ color: "info.main" }}
>
{shopItem.cost.toLocaleString()} Gold
</Typography>
</>
)}
{!shopItem.cost && shopItem.name}
</MenuItem>
);
})}
</Select>
</FormControl>
);
Expand Down

0 comments on commit 9b62b22

Please sign in to comment.