Skip to content

Commit

Permalink
fix(inventory): display players name properly.
Browse files Browse the repository at this point in the history
Along with a few general clean up / movement items, this address's the issue where after a refresh / reload of the game, the players name would disappear from the top of the players inventory.
  • Loading branch information
SobieskiCodes committed Jul 20, 2024
1 parent a393bf9 commit 40a3848
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/CurrentStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { useSelector } from 'react-redux';
const CurrentStatus = () => {
const status = useSelector((state) => state.player.status);
const currency = useSelector((state) => state.player.stats.currency);
const level = useSelector((state) => state.player.stats.level);
const xp = useSelector((state) => state.player.stats.xp);

return (
<div>
Current Status: {status}, Currency: {currency}
Current Status: {status}, Currency: {currency}, Level: {level}, XP: {xp}
</div>
);
};
Expand Down
6 changes: 3 additions & 3 deletions src/features/expeditions/expeditionZones.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const zones = [
duration: 10, // seconds
xpRange: [15, 25],
lootDrops: [
{ type: 'item', item: items.equipment.filter, chance: 0.000033 },
{ type: 'item', item: items.equipment.spongeFilter, chance: 0.000033 },
{ type: 'item', item: items.equipment.light, chance: 0.000033 },
{ type: 'item', item: items.equipment.filter, chance: 0.00013 },
{ type: 'item', item: items.equipment.spongeFilter, chance: 0.00093 },
{ type: 'item', item: items.equipment.light, chance: 0.00093 },
{ type: 'currency', amountRange: [5, 10], chance: 0.2 },
],
image: 'icons/expeditions/coralReef.png',
Expand Down
1 change: 1 addition & 0 deletions src/features/player/saveState.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const saveState = (state) => {

const serializedState = JSON.stringify({
player: {
name: playerState.name,
stats: playerState.stats,
inventory: playerState.inventory,
equipment: playerState.equipment,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Inventory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import '../styles/inventory.css';
import InventorySlot from '../components/InventorySlot';

const Inventory = () => {
const player = useSelector(state => state.player);
const player = useSelector((state) => state.player);
const dispatch = useDispatch();

return (
Expand Down

0 comments on commit 40a3848

Please sign in to comment.