only pay players who havent hit a mine
This commit is contained in:
parent
c110fdf83a
commit
6e93a2905b
1 changed files with 7 additions and 1 deletions
|
|
@ -63,7 +63,13 @@ setInterval(async () => {
|
||||||
const sessionRaw = await redis.get(key);
|
const sessionRaw = await redis.get(key);
|
||||||
if (!sessionRaw) continue;
|
if (!sessionRaw) continue;
|
||||||
const game = JSON.parse(sessionRaw) as MinesSession;
|
const game = JSON.parse(sessionRaw) as MinesSession;
|
||||||
if (game.status === 'active' && game.revealedTiles.length > 0 && now - game.lastActivity > 20000) {
|
|
||||||
|
if (
|
||||||
|
game.status === 'active' &&
|
||||||
|
game.revealedTiles.length > 0 &&
|
||||||
|
now - game.lastActivity > 20000 &&
|
||||||
|
!game.revealedTiles.some(idx => game.minePositions.includes(idx))
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
const [userData] = await db
|
const [userData] = await db
|
||||||
.select({ baseCurrencyBalance: user.baseCurrencyBalance })
|
.select({ baseCurrencyBalance: user.baseCurrencyBalance })
|
||||||
|
|
|
||||||
Reference in a new issue