Skip to content

ravewebdev/dice-roller

Repository files navigation

Dice Roller

Description

This plugin provides the Dice Roller block, which can be used to roll different polyhedral dice for use in Table-Top Role-Playing Games.

Built with WDS Block Starter.

Installation

  1. Upload the dice-roller folder to the /wp-content/plugins directory.
  2. Activate the Dice Roller plugin through the 'Plugins' menu in WordPress.
  3. Add the 'Dice Roller' block in a post or page.
  4. Select the type and number of dice you want in your block. Optionally, if you select to include two or more of one die, select what function to use on the dice (e.g., Add all rolls together).
  5. Save and view your page or post.
  6. Click 'Roll these dice!' to generate die results.

Frequently Asked Questions

How should I use this block?

Use this block anytime you want to simulate rolling some dice (or a coin flip)! If you're building a character for a Role-Playing Game, try using this block for attack rolls. Each block instance can represent a different weapon or attack, including the attack roll itself, damage, and any bonus or penalty rolls.

How can I report issues or suggest improvements?

Feel free to create an issue or PR in the Github repo here.

Screenshots

Admin Demo: Insert Dice Roller block and select dice

Admin Demo: Insert Dice Roller block and select dice

Frontend Demo: Rolling dice

Frontend Demo: Rolling dice

Changelog

1.1.4

  • Fixed: Centered die list to align elements properly when result text length exceeds width of dice.

1.1.3

  • Updated: Simplified dice list styling to avoid size jumps after rolling.

1.1.2

  • Fixed: Updated webpack config and js setup to work with wp-scripts v12.
  • Updated: Brought npm packages up to latest versions.

1.1.1

  • Fixed: Removed duplicate block wrapper div on frontend display.

1.1.0

  • Added: Added additional Multi-die handling options for returning sum resulting from dropping the highest or lowest roll.
  • Added: Created data attribute for roll result values.

1.0.2

  • Updated: Cleaned up code, comments to be more in line with similar blocks (e.g., Initiative Tracker).

1.0.1

  • Fixed: Added stroke property to icons with contrast color for darker screens.

1.0.0

  • Added: Create Dice Roller block with frontend polyhedral rolling and custom multi-die handling.

Credits