Skip to content

Commit

Permalink
fix: fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TiyoSheng committed Nov 7, 2023
1 parent 31f760e commit dd79c83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/client/src/mud/createSystemCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function createSystemCalls(
const tx = await worldContract.write.battleInvitation([addr, steps]);
await waitForTransaction(tx);
console.log('battleInvitation success', new Date().getTime(), tx);
return tx
} catch (error) {
console.log('battleInvitation', error);
message.error(error.cause.reason || error.cause.details);
Expand Down
10 changes: 6 additions & 4 deletions packages/client/src/pages/game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,12 @@ const Game = () => {

const setStartBattle = async (player) => {
const paths = bfs(simpleMapData, { x: curPlayer.x, y: curPlayer.y }, {x: player.x, y: player.y}).slice(1);
await battleInvitation(player.addr, formatMovePath(paths));
setTargetPlayer(player);
setBattleCurPlayer(curPlayer)
setStartBattleData(true);
let res = await battleInvitation(player.addr, formatMovePath(paths));
if (res) {
setTargetPlayer(player);
setBattleCurPlayer(curPlayer)
setStartBattleData(true);
}
}

const openTreasureChest = async (id) => {
Expand Down

0 comments on commit dd79c83

Please sign in to comment.