diff --git a/backend/entities/game.ts b/backend/entities/game.ts index 058f5c1..0ea9ca5 100644 --- a/backend/entities/game.ts +++ b/backend/entities/game.ts @@ -311,6 +311,6 @@ export const game = { const { finished, stage } = serverGame; if (finished == 0) return 0; if (stage < 2) return 0; - return Math.floor(Math.pow(2, stage * 1.1)); + return Math.floor(Math.pow(2, stage * 0.9 + stage * 1.2)); }, }; diff --git a/src/views/store/Store.tsx b/src/views/store/Store.tsx index 65a4d47..392c7a2 100644 --- a/src/views/store/Store.tsx +++ b/src/views/store/Store.tsx @@ -10,7 +10,7 @@ import { } from "../../components/Dialog"; import GemsIcon from "../../components/GemIcon"; import { themes } from "../../themes"; -import { useWSMutation } from "../../hooks"; +import { useWSMutation, useWSQuery } from "../../hooks"; import { Rarity } from "../../components/Rarity"; import { lootboxResultAtom } from "../../atoms"; import { useAtom } from "jotai"; @@ -24,6 +24,7 @@ const Store = () => { const openLootbox = useWSMutation("user.openLootbox"); const [lootboxResult, setLootboxResult] = useAtom(lootboxResultAtom); const currentLootbox = lootboxes.find((l) => l.id === lootboxResult?.lootbox); + const { refetch } = useWSQuery("user.getOwnGems", null); // this should be run only once per application lifetime useEffect(() => { @@ -182,7 +183,11 @@ const Store = () => { variant="outline" size="default" className="mx-auto items-center" - onClick={() => openLootbox.mutateAsync({ id: lootbox.id })} + onClick={() => + openLootbox + .mutateAsync({ id: lootbox.id }) + .then(() => refetch()) + } > Buy for {lootbox.priceText}