From 8bee025827eb12a212fee32eea44c5fc5c9b9bd4 Mon Sep 17 00:00:00 2001 From: Starknet Dev Date: Sat, 22 Jun 2024 10:13:35 +0100 Subject: [PATCH] - add discovery display for loot - add env variable for network --- indexer/env-sepolia | 2 +- ui/.env.preview | 2 +- ui/.env.production | 2 +- .../components/actions/DiscoveryDisplay.tsx | 21 +++++++++++++++++++ ui/src/app/components/onboarding/Intro.tsx | 18 +++++++++------- ui/src/app/lib/networkConfig.ts | 6 +++--- 6 files changed, 38 insertions(+), 13 deletions(-) diff --git a/indexer/env-sepolia b/indexer/env-sepolia index 9c99ffa64..215c2ae84 100644 --- a/indexer/env-sepolia +++ b/indexer/env-sepolia @@ -1,4 +1,4 @@ -GAME="0x0305f26ad19e0a10715d9f3137573d3a543de7b707967cd85d11234d6ec0fb7e" +GAME="0x05545d79b497a9b924ed3321361520566c90dc1abb0aa1643cc4839b12c73136" START=68300 MONGO_CONNECTION_STRING="mongodb://mongo:mongo@mongo:27017" MONGO_DB="mongo" diff --git a/ui/.env.preview b/ui/.env.preview index e9351d77f..600689064 100644 --- a/ui/.env.preview +++ b/ui/.env.preview @@ -1 +1 @@ -NEXT_PUBLIC_NETWORK=preview \ No newline at end of file +NEXT_PUBLIC_NETWORK=sepolia \ No newline at end of file diff --git a/ui/.env.production b/ui/.env.production index bc2125a48..47cc682cb 100644 --- a/ui/.env.production +++ b/ui/.env.production @@ -1 +1 @@ -NEXT_PUBLIC_NETWORK=prod \ No newline at end of file +NEXT_PUBLIC_NETWORK=mainnet \ No newline at end of file diff --git a/ui/src/app/components/actions/DiscoveryDisplay.tsx b/ui/src/app/components/actions/DiscoveryDisplay.tsx index 40294b0d1..ee3f11866 100644 --- a/ui/src/app/components/actions/DiscoveryDisplay.tsx +++ b/ui/src/app/components/actions/DiscoveryDisplay.tsx @@ -7,7 +7,10 @@ import { TwoCoinIcon, HealthPotionIcon, } from "@/app/components/icons/Icons"; +import LootIcon from "@/app/components/icons/LootIcon"; import { Discovery } from "@/app/types"; +import { GameData } from "@/app/lib/data/GameData"; +import { getItemData } from "@/app/lib/utils"; interface DiscoveryProps { discoveryData: Discovery; @@ -22,6 +25,8 @@ export const DiscoveryDisplay = ({ discoveryData }: DiscoveryProps) => { const AdventurerHealthExists = (discoveryData?.adventurerHealth ?? 0) > 0; + const gameData = new GameData(); + const renderDiscoveryMessage = () => { if (discoveryData?.discoveryType === "Beast") { if (discoveryData?.ambushed) { @@ -130,6 +135,22 @@ export const DiscoveryDisplay = ({ discoveryData }: DiscoveryProps) => { ); } + + if (discoveryData?.subDiscoveryType === "Loot") { + const itemName = gameData.ITEMS[discoveryData?.outputAmount!]; + const { slot } = getItemData(itemName ?? ""); + return ( + +
+

+ WOW! Discovered the Loot item {itemName}!{" "} + +

+
+ +
+ ); + } } return null; diff --git a/ui/src/app/components/onboarding/Intro.tsx b/ui/src/app/components/onboarding/Intro.tsx index 0679bce41..e5a323f70 100644 --- a/ui/src/app/components/onboarding/Intro.tsx +++ b/ui/src/app/components/onboarding/Intro.tsx @@ -1,7 +1,7 @@ import { Button } from "@/app/components/buttons/Button"; import Profile from "public/icons/profile.svg"; import QuestionMark from "public/icons/question-mark.svg"; -import useUIStore from "@/app/hooks/useUIStore"; +import useUIStore, { Network } from "@/app/hooks/useUIStore"; import { SoundOffIcon, SoundOnIcon } from "@/app/components/icons/Icons"; import { useUiSounds, soundSelector } from "@/app/hooks/useUiSound"; @@ -16,6 +16,8 @@ const Intro = () => { } = useUIStore(); const { play: clickPlay } = useUiSounds(soundSelector.click); + + const network = process.env.NEXT_PUBLIC_NETWORK; return (
-

Play On Testnet

+

+ Play On {network == "sepolia" ? "Testnet" : "Mainnet"} +

Looking for a hassle-free gaming experience? Play on Testnet, diff --git a/ui/src/app/lib/networkConfig.ts b/ui/src/app/lib/networkConfig.ts index b7857a4e8..d9b6fa1ec 100644 --- a/ui/src/app/lib/networkConfig.ts +++ b/ui/src/app/lib/networkConfig.ts @@ -8,16 +8,16 @@ export const networkConfig = { ethAddress: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", gameAddress: - "0x05a502f60dac021a4d15a7a2df02b8a486aa672d747cca614589d10e8c50ba9d", + "0x05545d79b497a9b924ed3321361520566c90dc1abb0aa1643cc4839b12c73136", lordsAddress: - "0x0619077dc1fcc970a03a3239a5dc9c55990afcdb7f02a48a32dd107593cc3f71", + "0x0213c1cd576885fac65226505f8e01b908ad569c138e34f17ca220d67dd3c106", beastsAddress: "0x020c7c02c973ffa3a48fb78e9472b679c72c11b59512f524154ade0a39f54136", goldenTokenAddress: "0x07626660faba349aad9ad2aaa0ff8645c079fa8e043a168d640d92472806eeac", revenueAddress: "0x0314924118945405ac0bcd6181457712795c0effc29d8dd3be86d3f3ec62adc1", - appUrl: "https://sepolia-survivor.provable.games", + appUrl: "https://sepolia-lootsurvivor.io", beastsViewer: "https://testnet.realms.world/collection/beasts", goldenTokenMintUrl: "https://testnet.realms.world/collection/goldenToken", blockExplorerUrl: "https://sepolia.voyager.online/",