increase dice size
This commit is contained in:
parent
fb7ffc4d78
commit
247fc6729a
|
@ -62,9 +62,9 @@ def message(socket, data):
|
||||||
try:
|
try:
|
||||||
groups = [0 if d is None else int(d) for d in reg.groups()]
|
groups = [0 if d is None else int(d) for d in reg.groups()]
|
||||||
dice_num, dice_sides, dice_mod = groups
|
dice_num, dice_sides, dice_mod = groups
|
||||||
assert 0 < dice_num < 100
|
assert 1 <= dice_num <= 256
|
||||||
assert 0 < dice_sides < 100
|
assert 1 <= dice_sides <= 256
|
||||||
assert -1000 < dice_mod < 1000
|
assert -65536 <= dice_mod <= 65536
|
||||||
except (ValueError, AssertionError):
|
except (ValueError, AssertionError):
|
||||||
return
|
return
|
||||||
dice_results = [random.randint(1, dice_sides) for _ in range(dice_num)]
|
dice_results = [random.randint(1, dice_sides) for _ in range(dice_num)]
|
||||||
|
|
|
@ -8,14 +8,14 @@ class DiceCallForm(forms.Form):
|
||||||
"""
|
"""
|
||||||
The form for the QM making dice calls.
|
The form for the QM making dice calls.
|
||||||
"""
|
"""
|
||||||
diceNum = forms.IntegerField(min_value=1, max_value=99)
|
diceNum = forms.IntegerField(min_value=1, max_value=256)
|
||||||
diceSides = forms.IntegerField(min_value=1, max_value=99)
|
diceSides = forms.IntegerField(min_value=1, max_value=65536)
|
||||||
diceMod = forms.IntegerField(
|
diceMod = forms.IntegerField(
|
||||||
min_value=-999, max_value=999, required=False)
|
min_value=-65536, max_value=65536, required=False)
|
||||||
diceChal = forms.IntegerField(
|
diceChal = forms.IntegerField(
|
||||||
min_value=1, max_value=999, required=False)
|
min_value=1, max_value=65536, required=False)
|
||||||
diceRollsTaken = forms.IntegerField(
|
diceRollsTaken = forms.IntegerField(
|
||||||
min_value=1, max_value=99, required=False)
|
min_value=1, max_value=256, required=False)
|
||||||
diceStrict = forms.BooleanField(required=False)
|
diceStrict = forms.BooleanField(required=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -111,17 +111,17 @@
|
||||||
<div id="QMPostDice" class="QMPostTabContent" style="display:none;">
|
<div id="QMPostDice" class="QMPostTabContent" style="display:none;">
|
||||||
Dice for the dice god.<br>
|
Dice for the dice god.<br>
|
||||||
<form id="QMDicePostForm" action="javascript:void(0);" onsubmit="form_post('QMDicePostForm', 'dice_post');">
|
<form id="QMDicePostForm" action="javascript:void(0);" onsubmit="form_post('QMDicePostForm', 'dice_post');">
|
||||||
Dice: <input type="number" name="diceNum" min="1" max="99" required>
|
Dice: <input type="number" name="diceNum" min="1" max="256" required>
|
||||||
d <input type="number" name="diceSides" min="1" max="99" required>
|
d <input type="number" name="diceSides" min="1" max="65536" required>
|
||||||
±<input type="number" name="diceMod" min="-999" max="999">
|
±<input type="number" name="diceMod" min="-65536" max="65536">
|
||||||
<input type="checkbox" name="diceStrict">
|
<input type="checkbox" name="diceStrict">
|
||||||
<span class="tooltip" title="Only take matching rolls.">Strict</span><br>
|
<span class="tooltip" title="Only take matching rolls.">Strict</span><br>
|
||||||
<input type="checkbox" onclick="document.getElementById('diceChal').disabled=!this.checked;">
|
<input type="checkbox" onclick="document.getElementById('diceChal').disabled=!this.checked;">
|
||||||
<span class="tooltip" title="Dice challenge">DC:</span>
|
<span class="tooltip" title="Dice challenge">DC:</span>
|
||||||
<input type="number" name="diceChal" id="diceChal" min="1" max="999" disabled><br>
|
<input type="number" name="diceChal" id="diceChal" min="1" max="65536" disabled><br>
|
||||||
<input type="checkbox" onclick="document.getElementById('diceRollsTaken').disabled=!this.checked;">
|
<input type="checkbox" onclick="document.getElementById('diceRollsTaken').disabled=!this.checked;">
|
||||||
<span class="tooltip" title="Automatically close the dice call after this many rolls have been made.">Rolls Taken:</span>
|
<span class="tooltip" title="Automatically close the dice call after this many rolls have been made.">Rolls Taken:</span>
|
||||||
<input type="number" name="diceRollsTaken" id="diceRollsTaken" min="1" max="99" disabled><br>
|
<input type="number" name="diceRollsTaken" id="diceRollsTaken" min="1" max="256" disabled><br>
|
||||||
<input type="submit" name="submit" value="Roll 'em">
|
<input type="submit" name="submit" value="Roll 'em">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
34
quest/migrations/0004_auto_20180924_0931.py
Normal file
34
quest/migrations/0004_auto_20180924_0931.py
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# Generated by Django 2.1.1 on 2018-09-24 13:31
|
||||||
|
|
||||||
|
import django.core.validators
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('quest', '0003_quest_anon_name'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='dicecall',
|
||||||
|
name='dice_challenge',
|
||||||
|
field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(65536)]),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='dicecall',
|
||||||
|
name='dice_roll',
|
||||||
|
field=models.CharField(max_length=16),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='dicecall',
|
||||||
|
name='rolls_taken',
|
||||||
|
field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(256)]),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='diceroll',
|
||||||
|
name='roll',
|
||||||
|
field=models.CharField(max_length=16),
|
||||||
|
),
|
||||||
|
]
|
|
@ -56,22 +56,22 @@ class DiceCall(models.Model):
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
primary_key=True,
|
primary_key=True,
|
||||||
)
|
)
|
||||||
dice_roll = models.CharField(max_length=9)
|
dice_roll = models.CharField(max_length=16)
|
||||||
strict = models.BooleanField()
|
strict = models.BooleanField()
|
||||||
dice_challenge = models.IntegerField(
|
dice_challenge = models.IntegerField(
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
validators=[
|
validators=[
|
||||||
MaxValueValidator(999),
|
MinValueValidator(1),
|
||||||
MinValueValidator(1)
|
MaxValueValidator(65536),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
rolls_taken = models.IntegerField(
|
rolls_taken = models.IntegerField(
|
||||||
null=True,
|
null=True,
|
||||||
blank=True,
|
blank=True,
|
||||||
validators=[
|
validators=[
|
||||||
MaxValueValidator(99),
|
MinValueValidator(1),
|
||||||
MinValueValidator(1)
|
MaxValueValidator(256),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
open = models.BooleanField()
|
open = models.BooleanField()
|
||||||
|
@ -87,7 +87,7 @@ class DiceRoll(models.Model):
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
primary_key=True,
|
primary_key=True,
|
||||||
)
|
)
|
||||||
roll = models.CharField(max_length=9)
|
roll = models.CharField(max_length=16)
|
||||||
results = models.TextField()
|
results = models.TextField()
|
||||||
total = models.IntegerField()
|
total = models.IntegerField()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user