mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-12-04 12:54:08 +01:00
feat: free-play choice + per-game dual leaderboard (backend)
Free-to-play alongside paid, with scores split per game between a Pleb board
(free) and the Hall of Champions (paid). Keys on the existing per-game
game_mode, so no new game columns.
- Leaderboard API: GET /api/leaderboard?board=pleb|champions|all. champions =
game_mode IN (PAID_SINGLE,PAID_CREDITS), pleb = FREE. board is whitelisted.
Migration 019 adds a supporting partial index.
- FREE_PLAY_ENABLED config: offer free play as an explicit choice even when the
instance also sells credits/entry (always on when payments are off).
- play_free socket event -> handleAutoStart(socket, {free:true}); skips all
payment/credits/payout-address gating and records the game as game_mode=FREE
via processGameStart(..., {forceFree:true}) -> _processGameStartFree (no
payment, no payout, counted).
- getPaymentOptionsForUser exposes a play_free option; /api/game-modes exposes
freePlayEnabled.
Adds freePlay.test.js. Full backend suite: 22 suites / 158 tests.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
-- Migration 019: Index for the per-game leaderboard split (Pleb vs Hall of Champions)
|
||||
--
|
||||
-- The leaderboard is split by game_mode: free games -> Pleb board, paid (credits/entry)
|
||||
-- games -> Hall of Champions. This composite index supports both filtered queries
|
||||
-- (score-ranked, restricted to ranked games).
|
||||
CREATE INDEX IF NOT EXISTS idx_games_leaderboard
|
||||
ON games (game_mode, score DESC)
|
||||
WHERE status IN ('won', 'lost') AND score > 0;
|
||||
Reference in New Issue
Block a user