adjusted gem rewards

This commit is contained in:
MasterGordon 2024-10-15 23:58:10 +02:00
parent d6c25289fd
commit 72150b070d
2 changed files with 8 additions and 3 deletions

View File

@ -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));
},
};

View File

@ -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 <b>{lootbox.priceText}</b> <GemsIcon />
</Button>