Skip to content

Commit

Permalink
config
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Aug 21, 2024
1 parent c280477 commit 12662df
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions clients/react-client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ function App() {

setPlayers((prevPlayers) => {
const newPlayers = { ...prevPlayers };
if (entities && entities[hash]["dojo_starter_rpg-Player"]) {
if (
entities &&
entities[hash] &&
entities[hash]["dojo_starter_rpg-Player"]
) {
const playerData = entities[hash]["dojo_starter_rpg-Player"];
const player: Player = {
damage: Number(playerData.damage.value),
Expand All @@ -114,7 +118,11 @@ function App() {

setDungeons((prevDungeons) => {
const newDungeons = { ...prevDungeons };
if (entities && entities[hash]["dojo_starter_rpg-Dungeon"]) {
if (
entities &&
entities[hash] &&
entities[hash]["dojo_starter_rpg-Dungeon"]
) {
const dungeonData = entities[hash]["dojo_starter_rpg-Dungeon"];
const dungeon: Dungeon = {
reward: Number(dungeonData.reward.value),
Expand Down Expand Up @@ -281,8 +289,9 @@ function App() {
<ul>
{Object.values(players).map((player) => (
<li key={player.id}>
Name: {torii.parseCairoShortString(player.name)}, Health:{" "}
{player.health}, Gold: {player.gold}
Name: {torii.parseCairoShortString(player.name)}, <br />
Health: {player.health}, <br />
Gold: {player.gold}
</li>
))}
</ul>
Expand All @@ -291,8 +300,8 @@ function App() {
<ul>
{Object.values(dungeons).map((dungeon) => (
<li key={dungeon.id}>
ID: {dungeon.id}, Monster: {dungeon.monster}, Health:{" "}
{dungeon.health}
ID: {dungeon.id}, <br /> Monster: {dungeon.monster}, <br />
Health: {dungeon.health}
</li>
))}
</ul>
Expand Down

0 comments on commit 12662df

Please sign in to comment.