Skip to content

Commit

Permalink
- add discovery display for loot
Browse files Browse the repository at this point in the history
- add env variable for network
  • Loading branch information
starknetdev committed Jun 22, 2024
1 parent 8872273 commit 8bee025
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 13 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="0x0305f26ad19e0a10715d9f3137573d3a543de7b707967cd85d11234d6ec0fb7e"
GAME="0x05545d79b497a9b924ed3321361520566c90dc1abb0aa1643cc4839b12c73136"
START=68300
MONGO_CONNECTION_STRING="mongodb://mongo:mongo@mongo:27017"
MONGO_DB="mongo"
Expand Down
2 changes: 1 addition & 1 deletion ui/.env.preview
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NEXT_PUBLIC_NETWORK=preview
NEXT_PUBLIC_NETWORK=sepolia
2 changes: 1 addition & 1 deletion ui/.env.production
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NEXT_PUBLIC_NETWORK=prod
NEXT_PUBLIC_NETWORK=mainnet
21 changes: 21 additions & 0 deletions ui/src/app/components/actions/DiscoveryDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down Expand Up @@ -130,6 +135,22 @@ export const DiscoveryDisplay = ({ discoveryData }: DiscoveryProps) => {
</span>
);
}

if (discoveryData?.subDiscoveryType === "Loot") {
const itemName = gameData.ITEMS[discoveryData?.outputAmount!];
const { slot } = getItemData(itemName ?? "");
return (
<span className="flex flex-row items-center justify-between">
<div className="flex self-center">
<p>
WOW! Discovered the Loot item {itemName}!{" "}
<LootIcon size={"w-5"} type={slot} />
</p>
</div>
<HealthPotionIcon />
</span>
);
}
}

return null;
Expand Down
18 changes: 11 additions & 7 deletions ui/src/app/components/onboarding/Intro.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand All @@ -16,6 +16,8 @@ const Intro = () => {
} = useUIStore();

const { play: clickPlay } = useUiSounds(soundSelector.click);

const network = process.env.NEXT_PUBLIC_NETWORK;
return (
<div className="min-h-screen container flex flex-col items-center">
<Button
Expand Down Expand Up @@ -51,24 +53,26 @@ const Intro = () => {
<Profile className="sm:hidden 2xl:block fill-current h-12 sm:h-32" />
<p className="sm:text-xl">
Dive into the full immersion of Loot Survivor by logging in now!
Join the Mainnet for a chance to win real funds and exciting
prizes.
Join {network?.toUpperCase()} for a chance to win real funds and
exciting prizes.
</p>
<div className="flex flex-col gap-2">
<Button
size={"lg"}
onClick={() => {
setLoginScreen(true);
setNetwork("sepolia");
setNetwork(network! as Network);
}}
disabled
disabled={network == "sepolia" ? false : true}
>
Login to Mainnet
Login to {network}
</Button>
</div>
</div>
<div className="flex flex-col items-center justify-between border border-terminal-green p-2 sm:p-5 text-center gap-2 sm:gap-10 z-1 h-[250px] sm:h-[425px] 2xl:h-[500px] w-full sm:w-1/3">
<h4 className="m-0 uppercase text-3xl">Play On Testnet</h4>
<h4 className="m-0 uppercase text-3xl">
Play On {network == "sepolia" ? "Testnet" : "Mainnet"}
</h4>
<QuestionMark className="sm:hidden 2xl:block fill-current h-12 sm:h-32" />
<p className="sm:text-xl">
Looking for a hassle-free gaming experience? Play on Testnet,
Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/lib/networkConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down

0 comments on commit 8bee025

Please sign in to comment.