Skip to content

Building, tests & screenshots ​

Layout ​

fxmanifest.lua                 shared libs + config + np_admin lib, then bridges, client/*.lua, server/*.lua (globs)
shared/lib/                    00 core (NpDarts global, util, RNG, bridge selection) · 01 locale · 02 format
                               10 board (regulation geometry) · 11 checkout (routes) · 12 rules (every mode)
                               13 sway (the throw model, client and server)
shared/config.lua, config_pubs.lua, config_gear.lua
shared/locales/{en,de}.lua
bridge/np_admin.lua            np_admin lib, vendored byte-identical (after the config)
shared/np_admin_settings.lua   np_admin Resource settings
bridge/framework/{client,server}/   esx | qbx | qb | standalone   (esx first)
bridge/inventory/server/            np_inventory | ox | qb | esx | none   (np_inventory first)
server/NN_*.lua                00 core (pushes, payload checks, rate limit, permissions, logs, boot) · 01 db · 02 rpc ·
                               03 players · 04 boards + pubs · 05 escrow · 06 throw · 07 match · 08 lobby + play RPCs ·
                               09 intox · 10 ai · 11 stats · 12 profile + loadout + items · 13 pub owner · 14 leagues,
                               cups, challenges · 15 phone · 16 notify · 20 exports · 30 np_admin · 31 commands · 99 boot
client/NN_*.lua                00 state + pushes · 01 nui · 02 rpc · 03 hud glue · 04 world (boards, blips, chalkboard,
                               prompts, keys, np_menu) · 05 board fx · 06 play · 07 intox · 08 ai ped · 09 placement · 10 api
items/                         np_inventory.lua, ox_inventory.lua, qb_items.lua, esx_items.sql
sql/np_darts.sql
web/                           React + Vite: index.html (ui_page), phone.html (Oche), chalk.html (chalkboard DUI)
design/                        Nimbus UI tokens and CSS, never edited
tests/                         plain-Lua harness and suites

shared/lib/10_board.lua, 12_rules.lua and 13_sway.lua are pure Lua without natives: the client draws the same reticle and board the server evaluates, and the tests pin every rule down.

Build ​

sh
cd web
npm install
npm run build          # FiveM guard check + tsc --noEmit + vite build → web/dist/{index,phone,chalk}.html
npm test               # vitest
npm run dev            # browser mock on http://localhost:5186
npm run screenshots    # mock build + headless Chrome → web/screenshots/*.png

npm run build first runs scripts/check-fivem-guard.mjs: in FiveM a blurred surface renders as a black box over the game, so the HTML sets html.nb-fivem before the first paint and the CSS turns backdrop-filter off under it. The guard fails the build when that rule or the code that sets the class is missing.

Browser mock ​

npm run dev runs the UI without FiveM, with mock data. URL parameters pick a screen:

Parameter Values
screen throw, visit, scoreboard, lobby, loadout, profile, pub, invite, end, spectate
mode cricket, killer, clock (with screen=scoreboard)
material liquid
stake A stake for screen=lobby
flight A flight preview for screen=loadout
shot 1: no animations, for screenshots

The phone app runs at /phone.html?tab=league|cups|challenges, the chalkboard at /chalk.html.

npm run screenshots builds the UI, makes a mock build (vite build --mode mock --outDir dist-mock), serves it with vite preview on port 4326 and renders every screen with headless Chrome: the ten screens at 1920 × 1080, the Cricket, Killer and Around the Clock scoreboards, Liquid Glass, the three phone tabs at 470 × 920 and the chalkboard at 560 × 760. A name filter renders one (npm run screenshots -- lobby); CHROME= points at another Chrome, SCALE=3 renders at 3×. The screenshots on these pages come from there.

Tests ​

sh
tests/run.sh               # luac -p on every Lua file, then every tests/test_*.lua in its own process
VERBOSE=1 tests/run.sh     # with resource log lines and stubbed natives
LUA=lua5.4 LUAC=luac5.4 tests/run.sh

The harness (tests/harness.lua) stubs FiveM natives, events, exports and oxmysql, fakes es_extended and qb-core players (money, jobs with grade, duty and boss, items), np_inventory, np_payments, np_hud, np_phone, np_drugs, np_admin, np_prophandler and np_npchandler, runs a cooperative thread scheduler with a clock, and boots the resource files in fxmanifest.lua order.

Suite Covers
test_server.lua ESX + np_inventory + np_payments: whole matches through the RPC event in every mode, escrow, payouts, refunds, forfeits, timeouts, the house regular, leagues, cups, challenges, the owner tools, exports, the phone app RPCs
test_client.lua The client: NUI callbacks, state bag handlers, server pushes
test_bridges.lua Bridge smoke tests in their own processes: qb-core, standalone, the default ESX inventory

The web tests (web/tests/, vitest): board.test.ts and gear.test.ts check that the TypeScript board and gear models match the Lua ones, format.test.ts the formatting, silver-line.test.ts the Nimbus surfaces and the FiveM guard.

Not verified without a running server ​

A few values depend on the game and may need a tweak on a live server: the stuck dart rotation and depth (Config.Native.dartRotation, Config.Native.board.dartDepth), the dart-in-hand offset (Config.Native.handOffset), the chalkboard position next to the board (Config.Chalkboard.offset), whether the MC clubhouse interiors are loaded on your server, and the feel of the sway numbers (Config.Sway, also in np_admin).

Conventions ​

  • One global NpDarts (plus Config, L). Lua 5.4; every file parses with plain luac -p.
  • RPC handlers return { ok = true, … } or S.err(code); every code has a text in en and de.
  • Money is whole dollars, timestamps unix seconds, board positions mm from the bull (x right, y up).
  • No ACE anywhere: every staff check is npAdmin.can(src, node).