Skip to content

Commit

Permalink
- increase max bag amount
Browse files Browse the repository at this point in the history
- remove interlude on beast screen
- fetch entropy on initial load and after 10 secs
- update contracts
  • Loading branch information
starknetdev committed May 28, 2024
1 parent e619ea3 commit 02184b2
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 81 deletions.
2 changes: 1 addition & 1 deletion indexer/env-sepolia
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GAME="0x06c63851635f1e0ee0695a157292892cabaa030a8eca20a32b6a86c968c47c33"
GAME="0xa2516792efec852999cfd1d69a3caab70a168f7bb59c257065f64281df93a5"
START=68300
MONGO_CONNECTION_STRING="mongodb://mongo:mongo@mongo:27017"
MONGO_DB="mongo"
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/components/marketplace/MarketplaceRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/components/marketplace/MarketplaceTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div
Expand Down
105 changes: 30 additions & 75 deletions ui/src/app/containers/BeastScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { processBeastName } from "@/app/lib/utils";
import { Battle, NullBeast, ButtonData, Beast } from "@/app/types";
import { Button } from "@/app/components/buttons/Button";
import useUIStore from "@/app/hooks/useUIStore";
import InterludeScreen from "@/app/containers/InterludeScreen";
import ActionMenu from "@/app/components/menu/ActionMenu";
import { getBlock } from "@/app/api/api";

Expand Down Expand Up @@ -37,8 +36,6 @@ export default function BeastScreen({
const adventurer = useAdventurerStore((state) => 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);
Expand Down Expand Up @@ -172,32 +169,12 @@ export default function BeastScreen({
</div>
);

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 <BattleLog />;
}

return (
<div className="sm:w-2/3 flex flex-col sm:flex-row h-full">
{adventurer?.level == 1 && !entropyReady && <InterludeScreen />}
<div className="sm:w-1/2 order-1 sm:order-2 h-3/4 sm:h-full">
{hasBeast ? (
<BeastDisplay beastData={beastData} beastsContract={beastsContract} />
Expand All @@ -213,62 +190,40 @@ export default function BeastScreen({
<div className="flex flex-col gap-1 sm:gap-5 items-center sm:w-1/2 order-1 text-lg h-1/4 sm:h-full">
{isAlive && (
<>
{entropyReady ? (
<>
<div className="sm:hidden flex flex-row sm:flex-col gap-5 items-center justify-center sm:justify-start w-full h-3/4 sm:h-1/4">
<div className="flex flex-col items-center w-1/2 sm:w-full h-1/2 sm:h-full">
<ActionMenu
buttonsData={attackButtonsData}
size={"fill"}
title="Attack"
/>
</div>
<div className="flex flex-col items-center w-1/2 sm:w-full h-1/2 sm:h-full">
<ActionMenu
buttonsData={fleeButtonsData}
size={"fill"}
title={buttonText}
/>
</div>
<>
<div className="sm:hidden flex flex-row sm:flex-col gap-5 items-center justify-center sm:justify-start w-full h-3/4 sm:h-1/4">
<div className="flex flex-col items-center w-1/2 sm:w-full h-1/2 sm:h-full">
<ActionMenu
buttonsData={attackButtonsData}
size={"fill"}
title="Attack"
/>
</div>
<div className="flex flex-col items-center w-1/2 sm:w-full h-1/2 sm:h-full">
<ActionMenu
buttonsData={fleeButtonsData}
size={"fill"}
title={buttonText}
/>
</div>
<div className="hidden sm:flex flex-row gap-2 sm:flex-col items-center justify-center h-1/3 w-3/4">
<div className="flex flex-col items-center justify-center h-1/2 w-full">
<ActionMenu
buttonsData={attackButtonsData}
size={"fill"}
title="Attack"
/>
</div>
<div className="flex flex-col items-center justify-center h-1/2 w-full">
<ActionMenu
buttonsData={fleeButtonsData}
size={"fill"}
title="Flee"
/>
</div>
</div>
<div className="hidden sm:flex flex-row gap-2 sm:flex-col items-center justify-center h-1/3 w-3/4">
<div className="flex flex-col items-center justify-center h-1/2 w-full">
<ActionMenu
buttonsData={attackButtonsData}
size={"fill"}
title="Attack"
/>
</div>
</>
) : (
<div className="flex flex-col gap-5 items-center">
{/* <div className="flex flex-row gap-5">
<div className="flex flex-row items-center gap-2">
Current:
<div className="border border-terminal-green p-2">
<p className="animate-pulse">{currentBlockNumber}</p>
</div>
</div>
<div className="flex flex-row items-center gap-2">
Reveal:
<div className="border border-terminal-green p-2">
{adventurer?.revealBlock}
</div>
</div>
<div className="flex flex-col items-center justify-center h-1/2 w-full">
<ActionMenu
buttonsData={fleeButtonsData}
size={"fill"}
title="Flee"
/>
</div>
<p className="text-2xl loading-ellipsis">
Waiting for Block Reveal
</p> */}
</div>
)}
</>
</>
)}

Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/containers/InventoryScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export default function InventoryScreen({
</span>
<span className="flex flex-row gap-1 text-lg items-center sm:text-3xl">
<LootIcon type="bag" size="w-5" />
{`${bagItems.length}/${11}`}
{`${bagItems.length}/${15}`}
</span>
</span>
</span>
Expand Down
10 changes: 8 additions & 2 deletions ui/src/app/containers/UpgradeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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!,
]);
Expand All @@ -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
}, []);
Expand Down

0 comments on commit 02184b2

Please sign in to comment.