From 02184b2765375bbee8b50695b4feb5e5a255e6c1 Mon Sep 17 00:00:00 2001 From: Starknet Dev Date: Tue, 28 May 2024 08:59:56 +0100 Subject: [PATCH] - increase max bag amount - remove interlude on beast screen - fetch entropy on initial load and after 10 secs - update contracts --- indexer/env-sepolia | 2 +- .../components/marketplace/MarketplaceRow.tsx | 2 +- .../marketplace/MarketplaceTable.tsx | 2 +- ui/src/app/containers/BeastScreen.tsx | 105 +++++------------- ui/src/app/containers/InventoryScreen.tsx | 2 +- ui/src/app/containers/UpgradeScreen.tsx | 10 +- 6 files changed, 42 insertions(+), 81 deletions(-) diff --git a/indexer/env-sepolia b/indexer/env-sepolia index b08e55389..04bcd44ef 100644 --- a/indexer/env-sepolia +++ b/indexer/env-sepolia @@ -1,4 +1,4 @@ -GAME="0x06c63851635f1e0ee0695a157292892cabaa030a8eca20a32b6a86c968c47c33" +GAME="0xa2516792efec852999cfd1d69a3caab70a168f7bb59c257065f64281df93a5" START=68300 MONGO_CONNECTION_STRING="mongodb://mongo:mongo@mongo:27017" MONGO_DB="mongo" diff --git a/ui/src/app/components/marketplace/MarketplaceRow.tsx b/ui/src/app/components/marketplace/MarketplaceRow.tsx index a901644e6..3d22fae05 100644 --- a/ui/src/app/components/marketplace/MarketplaceRow.tsx +++ b/ui/src/app/components/marketplace/MarketplaceRow.tsx @@ -108,7 +108,7 @@ const MarketplaceRow = ({ ).length; const equipFull = equippedItems + purchaseEquipItems === 8; - const bagFull = baggedItems + purchaseNoEquipItems === 11; + const bagFull = baggedItems + purchaseNoEquipItems === 15; useEffect(() => { if (isActive) { diff --git a/ui/src/app/components/marketplace/MarketplaceTable.tsx b/ui/src/app/components/marketplace/MarketplaceTable.tsx index 9eeb20463..4c482f66e 100644 --- a/ui/src/app/components/marketplace/MarketplaceTable.tsx +++ b/ui/src/app/components/marketplace/MarketplaceTable.tsx @@ -152,7 +152,7 @@ const MarketplaceTable = ({ {(() => { const item = sortedMarketLatestItems[showEquipQ ?? 0]; const bagFull = - adventurerItems.filter((obj) => !obj.equipped).length == 11; + adventurerItems.filter((obj) => !obj.equipped).length == 15; return (
state.adventurer); const loading = useLoadingStore((state) => state.loading); const estimatingFee = useUIStore((state) => state.estimatingFee); - const entropyReady = useUIStore((state) => state.entropyReady); - const setEntropyReady = useUIStore((state) => state.setEntropyReady); const resetNotification = useLoadingStore((state) => state.resetNotification); const [showBattleLog, setShowBattleLog] = useState(false); const hasBeast = useAdventurerStore((state) => state.computed.hasBeast); @@ -172,32 +169,12 @@ export default function BeastScreen({
); - useEffect(() => { - if (adventurer?.level == 1) { - const interval = setInterval(async () => { - const entropy = await gameContract!.call("get_adventurer_entropy", [ - adventurer?.id!, - ]); - console.log(entropy); - if (entropy !== BigInt(0)) { - setEntropyReady(true); - clearInterval(interval); - } - }, 10000); // We call the getAdventurerEntropy function every 30 seconds - - return () => clearInterval(interval); // Cleanup on component unmount - } - }, []); - - console.log(entropyReady); - if (showBattleLog) { return ; } return (
- {adventurer?.level == 1 && !entropyReady && }
{hasBeast ? ( @@ -213,62 +190,40 @@ export default function BeastScreen({
{isAlive && ( <> - {entropyReady ? ( - <> -
-
- -
-
- -
+ <> +
+
+ +
+
+
-
-
- -
-
- -
+
+
+
+
- - ) : ( -
- {/*
-
- Current: -
-

{currentBlockNumber}

-
-
-
- Reveal: -
- {adventurer?.revealBlock} -
-
+
+
-

- Waiting for Block Reveal -

*/}
- )} + )} diff --git a/ui/src/app/containers/InventoryScreen.tsx b/ui/src/app/containers/InventoryScreen.tsx index df24398a1..1b64cd23f 100644 --- a/ui/src/app/containers/InventoryScreen.tsx +++ b/ui/src/app/containers/InventoryScreen.tsx @@ -296,7 +296,7 @@ export default function InventoryScreen({ - {`${bagItems.length}/${11}`} + {`${bagItems.length}/${15}`} diff --git a/ui/src/app/containers/UpgradeScreen.tsx b/ui/src/app/containers/UpgradeScreen.tsx index 113cf190c..9e1311ec5 100644 --- a/ui/src/app/containers/UpgradeScreen.tsx +++ b/ui/src/app/containers/UpgradeScreen.tsx @@ -90,7 +90,7 @@ export default function UpgradeScreen({ }); useEffect(() => { - const interval = setInterval(async () => { + const fetchEntropy = async () => { const entropy = await gameContract!.call("get_adventurer_entropy", [ adventurer?.id!, ]); @@ -99,7 +99,13 @@ export default function UpgradeScreen({ setEntropyReady(true); clearInterval(interval); } - }, 10000); // We call the getAdventurerEntropy function every 30 seconds + }; + + // Call the function immediately + fetchEntropy(); + + // Set up the interval to call the function every 10 seconds + const interval = setInterval(fetchEntropy, 10000); return () => clearInterval(interval); // Cleanup on component unmount }, []);