Daily Wheel

The Daily Wheel plugin (daily-wheel) gives every signed-in player a free spin of a prize wheel once per cooldown, 24 hours by default. A spin pays virtual chips, tournament tickets or nothing, depending on where the wheel lands. It never pays real money.

The plugin source is in plugins/daily-wheel and is built with the plugin SDK (plugin API 1.3).

Enabling the Plugin

It’s sold separately (Poker Engine releases don’t include it) as daily-wheel-<version>.tgz, with checksums in plugins-SHA256SUMS. Verify the download and upload it under Extensions › Plugins with Upload plugin (see Installing the First-Party Plugins).

When you activate it, the admin panel asks you to grant the capabilities the plugin declares:

CapabilityWhy the wheel needs it
storageKeeps each player’s last spin, spin history and hand count, and the daily totals
wallet:credit-virtualPays chip prizes
wallet:credit-ticketsPays tournament-ticket prizes
realtimeTells the player’s open tabs that the spin was used
schedulerRuns the nightly digest at 00:05 UTC
notify:in-appSends a bell notification for each prize

Every credit goes through the core wallet, so it is recorded in the balance ledger and the admin audit log with the description plugin:daily-wheel:daily-wheel-spin. The wallet’s per-plugin daily caps apply.

Settings

Edit the settings on Extensions › Plugins: Settings on the Daily Wheel row.

SettingTypeDefaultDescription
EnabledtoggleonOff hides the wheel from players and refuses spins.
Wheel segmentsJSON8 segments (below)The wheel, clockwise from the top.
Cooldown (hours)number24Hours between two spins of the same player, from 1 to 720.
When the next spin opens (resetMode)selectAfter the cooldowncooldown: Cooldown (hours) after the last spin. daily (1.1.0): once per calendar day, a new spin at 00:00 UTC whenever the player last spun.
Hands required todaynumber0Hands a player must finish on the current UTC day before spinning. 0 turns the requirement off.
Show in the main navigationtoggleoffAlso lists the wheel page in the player navigation. Off keeps the header uncluttered: players reach the wheel from the lobby banner and the header Spin! indicator.

Each segment has a label (up to 40 characters), a weight, a reward and (1.1.0) an optional color (#RGB or #RRGGBB) for wheels that draw slice colours, such as a theme’s:

[
  { "label": "50 chips", "weight": 24, "reward": { "type": "virtual", "amount": 50 } },
  { "label": "No prize", "weight": 18, "reward": { "type": "none", "amount": 0 } },
  { "label": "100 chips", "weight": 20, "reward": { "type": "virtual", "amount": 100 } },
  { "label": "1 ticket", "weight": 4, "reward": { "type": "tickets", "amount": 1 } },
  { "label": "250 chips", "weight": 14, "reward": { "type": "virtual", "amount": 250 } },
  { "label": "No prize", "weight": 12, "reward": { "type": "none", "amount": 0 } },
  { "label": "500 chips", "weight": 6, "reward": { "type": "virtual", "amount": 500 } },
  { "label": "1,000 chips", "weight": 2, "reward": { "type": "virtual", "amount": 1000 } }
]

That is the default wheel. Its weights add up to 100, so each weight reads as a percentage.

  • A segment’s chance is its weight divided by the total weight. Weights may have up to three decimals. A weight of 0 never wins.
  • reward.type is virtual (chips), tickets (whole tournament tickets) or none.
  • A wheel has 1 to 24 segments, and at least one needs a weight above 0. Saving a wheel that breaks these rules is refused with a validation error.
  • If the stored value is ever invalid, the plugin uses the default wheel and its health check reports unhealthy until you fix it.
  • Players see the labels, rewards and colours. The weights never leave the server.

Presets

plugins/daily-wheel/presets/social-casino.json (shipped in the plugin archive) is a wheel of eight equal slices (each a 1 in 8 chance) paying 10K, 25K, 15K, 50K, 10K, 25K, 100K and 15K play chips, with pine, navy, plum and amber slice colours, and one free spin per UTC day (resetMode: daily). Copy its segments into Wheel segments and set When the next spin opens to Every day at 00:00 UTC, or send the settings object, every value as a string, to PUT /api/v1/admin/plugins/daily-wheel/settings (see the Progression guide’s Presets section for a jq line). The expected payout is 31,250 chips per spin.

The hands requirement

When Hands required today is above 0, the plugin counts the hands each player finishes, from the game:hand:completed hook, per UTC day. Only hands played while the setting is above 0 are counted, so turning it on in the middle of a day starts everyone from 0. Each hand counts once, however many tables a player is on.

What Players See

  • Lobby banner (lobby.top): "Spin available" with a Spin now button while a spin is ready, or the time left until the next one. The button opens the wheel in a dialog, and the Your spins link opens the wheel page.
  • Header indicator (layout.main.header.end): a small Spin! badge while a spin is ready. It links to the wheel page and disappears in every open tab once the spin is used. On phones (below 640px) it sits at the top of the menu drawer.
  • Wheel page (/ext/daily-wheel/wheel): the wheel and the player’s last 30 spins. It is a game page, reached from the lobby banner and the header indicator; it is not in the player navigation unless Show in the main navigation is on (with more than two plugin pages, the default header folds them into a More menu, so every entry it does not need keeps the header tidy).

The server picks the segment. The wheel then turns to that segment over about 3.5 seconds, and the prize is shown once it stops. For players who set their system to reduce motion, the wheel moves straight to the segment without turning. Prizes also arrive as an in-app notification linking to the wheel page, in the notification category Prizes (prizes, in-app, on by default; plugin API 1.3), which players can switch off under Settings → Notifications → Daily Wheel.

A second spin during the cooldown is refused with "You have already spun the wheel" and the time left.

Admin Stats

Daily Wheel Stats, under Growth in the admin sidebar (a player promotion, next to the other promotion tools) (/admin/plugins/daily-wheel/page/wheel/stats), lists the last 14 UTC days: spins, prizes, chips and tickets paid, and spins that landed on "no prize", with totals and the time of the last digest.

The scheduler job daily-wheel:digest runs every day at 00:05 UTC and stores the previous day’s totals. The stats page reads those stored totals for past days and counts today’s spins live. A day the digest missed (for example while the server was down) is counted live too.

API

All routes are under /api/v1/plugins/daily-wheel and use the standard { success, data } envelope.

Method and pathAccessDescription
POST /spinsigned in, CSRFSpins. Returns { result, nextSpinAt, status }.
GET /statussigned in{ enabled, canSpin, reason, nextSpinAt, lastResult, segments, cooldownHours, resetMode, handsRequired, handsPlayedToday, serverTime }. reason is ready, cooldown, hands or disabled. segments ({ index, label, reward, color? }, clockwise from the top) has no weights.
GET /history?limit=30signed in{ spins }, newest first, up to 100.
GET /admin/stats?days=14admin with an admin session{ days, totals, lastDigest }, up to 90 days.

POST /spin errors:

Statuserror.codeWhen
429SPIN_COOLDOWNThe cooldown has not ended. error.nextSpinAt says when it does.
403HANDS_REQUIREDNot enough hands today. error.handsRequired and error.handsPlayedToday give the numbers.
403WHEEL_DISABLEDThe wheel is switched off.
409SPIN_IN_PROGRESSAnother request for the same spin is running, for example a double click.
500SPIN_FAILEDThe prize could not be credited. Nothing was used up and the player can spin again.

result.segmentIndex is the slice the server drew (an index into segments, with result.segmentCount slices), so a client that draws its own wheel turns it to that slice; the prize is already paid when the response arrives.

After a spin, the server sends the realtime event spin-result ({ result, nextSpinAt }) to every socket of that player.

How a Spin Is Kept Fair and Paid Once

  • The segment is drawn with crypto.randomInt over the integer-scaled weights, so the draw has no modulo bias.
  • Two requests that arrive together (two tabs, a double click) race for one atomic claim in plugin storage, and only one of them spins.
  • The credit uses the wallet idempotency key spin:<userId>:<dayKey>, with :<n> added for the second and later spins of a UTC day when the cooldown is shorter than a day. A retried credit never pays twice.
  • If the credit fails, the spin is released so the player can try again.

Stored Data

Everything lives in the plugin’s own storage and is deleted with the plugin.

ScopeKeyValue
playerstate{ lastSpinAt, lastResult, totalSpins }
playerspin:<day>:<n>One spin (id, dayKey, sequence, segmentIndex, segmentCount, label, reward, spunAt)
playerclaim:<ms>The claim that kept a spin single
playerhands:<day>Hands finished that day (only while the hands requirement is on). Earlier days are removed.
globalstats:<day>The digest’s totals for that day
globaldigest:last{ day, at } of the last digest

Testing

  • Unit tests (npm run plugin:test daily-wheel): weighting (chi-square on 10,000 seeded draws), cooldown, idempotency and concurrent spins, the hands requirement, the digest job, the routes, settings validation, and the banner, dialog, indicator and stats components.
  • End to end: a browser test sets a one-segment wheel through the admin settings API, spins as e2e_wheel, and checks the result, the balance, the refused second spin, the status after a reload and the admin stats.
Try the live demo Pricing

Have questions about Poker Engine? We reply fast.