forked from leftypol/leftypol
functions.php: handle very large numbers with handle_dice_roll_markup
This commit is contained in:
parent
cc82987bb0
commit
585e5638fd
1 changed files with 3 additions and 1 deletions
|
@ -2813,10 +2813,12 @@ function handle_dice_roll_markup(array $matches, ?string $img_path): string {
|
|||
$dice_faces = 6;
|
||||
}
|
||||
|
||||
$tot = $dice_offset;
|
||||
$tot = 0;
|
||||
for ($i = 0; $i < $dice_count; $i++) {
|
||||
$tot += mt_rand(1, $dice_faces);
|
||||
}
|
||||
// Ensure that final result is at least an integer.
|
||||
$tot = abs((int)($dice_offset + $tot));
|
||||
|
||||
if ($img_path !== null) {
|
||||
$img_text = "<img src='{$config['root']}{$img_path}' alt='dice' title='dice' class=\"inline-dice\"/>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue