adjusted gem rewards
This commit is contained in:
parent
d6c25289fd
commit
72150b070d
|
|
@ -311,6 +311,6 @@ export const game = {
|
||||||
const { finished, stage } = serverGame;
|
const { finished, stage } = serverGame;
|
||||||
if (finished == 0) return 0;
|
if (finished == 0) return 0;
|
||||||
if (stage < 2) 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));
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import {
|
||||||
} from "../../components/Dialog";
|
} from "../../components/Dialog";
|
||||||
import GemsIcon from "../../components/GemIcon";
|
import GemsIcon from "../../components/GemIcon";
|
||||||
import { themes } from "../../themes";
|
import { themes } from "../../themes";
|
||||||
import { useWSMutation } from "../../hooks";
|
import { useWSMutation, useWSQuery } from "../../hooks";
|
||||||
import { Rarity } from "../../components/Rarity";
|
import { Rarity } from "../../components/Rarity";
|
||||||
import { lootboxResultAtom } from "../../atoms";
|
import { lootboxResultAtom } from "../../atoms";
|
||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
|
|
@ -24,6 +24,7 @@ const Store = () => {
|
||||||
const openLootbox = useWSMutation("user.openLootbox");
|
const openLootbox = useWSMutation("user.openLootbox");
|
||||||
const [lootboxResult, setLootboxResult] = useAtom(lootboxResultAtom);
|
const [lootboxResult, setLootboxResult] = useAtom(lootboxResultAtom);
|
||||||
const currentLootbox = lootboxes.find((l) => l.id === lootboxResult?.lootbox);
|
const currentLootbox = lootboxes.find((l) => l.id === lootboxResult?.lootbox);
|
||||||
|
const { refetch } = useWSQuery("user.getOwnGems", null);
|
||||||
|
|
||||||
// this should be run only once per application lifetime
|
// this should be run only once per application lifetime
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -182,7 +183,11 @@ const Store = () => {
|
||||||
variant="outline"
|
variant="outline"
|
||||||
size="default"
|
size="default"
|
||||||
className="mx-auto items-center"
|
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 />
|
Buy for <b>{lootbox.priceText}</b> <GemsIcon />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue