diff --git a/packages/client/src/pages/game/index.tsx b/packages/client/src/pages/game/index.tsx index 4a0c62ec..b342a0dd 100644 --- a/packages/client/src/pages/game/index.tsx +++ b/packages/client/src/pages/game/index.tsx @@ -92,9 +92,9 @@ const Game = () => { player.username = player.name; LootList1Data.forEach((item) => { if (item.addr.toLocaleLowerCase() === address.toLocaleLowerCase()) { - 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] + let clothes = lootData.chest.replace(/"(.*?)"/, '').split(' of')[0].replace(/^\s+|\s+$/g,"") + let handheld = lootData.weapon.replace(/"(.*?)"/, '').split(' of')[0].replace(/^\s+|\s+$/g,"") + let head = lootData.head.replace(/"(.*?)"/, '').split(' of')[0].replace(/^\s+|\s+$/g,"") player.equip = { clothes, handheld, diff --git a/packages/client/src/pages/home/index.tsx b/packages/client/src/pages/home/index.tsx index f024e01d..81e1f265 100644 --- a/packages/client/src/pages/home/index.tsx +++ b/packages/client/src/pages/home/index.tsx @@ -192,9 +192,9 @@ const Home = () => { let playerData = rep[0] let lootData = rep[1] - 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] + let clothes = lootData.chest.replace(/"(.*?)"/, '').split(' of')[0].replace(/^\s+|\s+$/g,"") + let handheld = lootData.weapon.replace(/"(.*?)"/, '').split(' of')[0].replace(/^\s+|\s+$/g,"") + let head = lootData.head.replace(/"(.*?)"/, '').split(' of')[0].replace(/^\s+|\s+$/g,"") setPlayer(playerData) setClothes(clothes); setHandheld(handheld);