Skip to content

Commit

Permalink
fix: fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TiyoSheng committed Oct 31, 2023
1 parent 3dd32e1 commit 5286c1f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/client/src/mud/createSystemCalls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export function createSystemCalls(
const tx = await worldContract.write.selectLootNFT([tokenId], {nonce});
await waitForTransaction(tx);
let LootList1Data = getComponentValue(LootList1, encodeEntity({ addr: "address" }, { addr: address}));
let LootList2Data = getComponentValue(LootList2, encodeEntity({ addr: "address" }, { addr: address}));
return Object.assign(LootList1Data, LootList2Data);
// let LootList2Data = getComponentValue(LootList2, encodeEntity({ addr: "address" }, { addr: address}));
return LootList1Data
} catch (error) {
console.log('selectLootNFT', error);
message.error(error.cause.reason);
Expand Down
8 changes: 5 additions & 3 deletions packages/client/src/pages/game/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,18 @@ const Game = () => {
return loot;
})

console.log(LootList1Data, 'LootList1Data')

const players = useEntityQuery([Has(Player)]).map((entity) => {
const address = decodeEntity({ addr: "address" }, entity)?.addr?.toLocaleLowerCase() || ''
const player = getComponentValue(Player, entity);
player.addr = address
player.username = player.name;
LootList1Data.forEach((item) => {
if (item.addr.toLocaleLowerCase() === address.toLocaleLowerCase()) {
let clothes = item.chest.replace('\"', '').split(' of')[0]
let handheld = item.weapon.replace('\"', '').split(' of')[0]
let head = item.head.replace('\"', '').split(' of')[0]
let clothes = lootData.chest.split('\" ')[1].split(' of')[0]
let handheld = lootData.weapon.split('\" ')[1].split(' of')[0]
let head = lootData.head.split('\" ')[1].split(' of')[0]
player.equip = {
clothes,
handheld,
Expand Down
8 changes: 5 additions & 3 deletions packages/client/src/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ const Home = () => {
let playerData = rep[0]
let lootData = rep[1]

let clothes = lootData.chest.replace('\"', '').split(' of')[0]
let handheld = lootData.weapon.replace('\"', '').split(' of')[0]
let head = lootData.head.replace('\"', '').split(' of')[0]
let clothes = lootData.chest.split('\" ')[1].split(' of')[0]
let handheld = lootData.weapon.split('\" ')[1].split(' of')[0]
let head = lootData.head.split('\" ')[1].split(' of')[0]
setPlayer(playerData)
setClothes(clothes);
setHandheld(handheld);
Expand All @@ -211,6 +211,8 @@ const Home = () => {
}
});
} catch (error) {
setMinting(false);
console.log(error)
message.error(error);
}
}
Expand Down

0 comments on commit 5286c1f

Please sign in to comment.