Skip to content

Installation

tilttek/loot-tables-bundle

Requirements

PHP 8.5 or later with the sodium extension, Symfony 8.2 with its Workflow component, Doctrine ORM 3.7 and DoctrineBundle, phil/commerce-bundle, whose order workflow and option drawers the bundle plugs into, and tilttek/loot-tables. The screens and the production sheet are optional: the bundle registers each when its packages are installed.

PackageFor
symfony/form, symfony/options-resolverPhysicalDiceType, the form of the physical dice
symfony/ux-twig-component, symfony/twig-bundleTilttekLootTables:Commitments, the buyer's draws, and TilttekLootTables:PhysicalDice, the form on the register's page
phil/ux-kitThe recipes Card and Badge the buyer's draws are drawn with, through the Symfony UX Toolkit
symfony/consoletilttek:loot-tables:replay, the command that rolls a draw again
symfony/translationThe words of the form and the components, in English and French
phil/paged-mediaLootSheetPdf, the production sheet

Installing

composer require tilttek/loot-tables-bundle

The recipe in recipe/0.1 registers the bundle and copies its configuration; until it is published on a recipes repository, enable the bundle after the commerce core by hand:

// config/bundles.php
return [
    // …
    Phil\CommerceBundle\PhilCommerceBundle::class => ['all' => true],
    Tilttek\LootTablesBundle\TilttekLootTablesBundle::class => ['all' => true],
];

and write its configuration, config/packages/tilttek_loot_tables.yaml, as the configuration explains.

For the components, register TwigComponentBundle, and install the recipes of the UX kit the buyer's draws are drawn with:

php bin/console ux:install card badge

The table of the draws

The bundle maps its entity for Doctrine when DoctrineBundle is installed. Create the table tilttek_loot_draw with a migration:

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
ColumnHolds
id32 hexadecimal digits derived from the order, the line, the option and the unit
order_number, line, option_code, unitwhich unit of which option the draw is for; order_number is indexed
drawerthe drawer the option names
seed, commitmentthe secret seed, published in the proof once revealed, and its SHA-256, shown before the payment; null for physical dice
textsthe entries a text is drawn from, as they were when committed
resultthe source and the faces, once revealed or entered
proofthe published proof of a verifiable draw
drawnwhat the order line keeps
created_at, revealed_atwhen it was committed or entered, and revealed

The seed of a draw not yet revealed is a secret: whoever reads it knows the draw before the payment. Keep the table out of reach of what the buyers see, as any table of the store.