RnK : Added ability to GM to undo the last choices

This commit is contained in:
Vlyan
2021-02-10 17:41:35 +01:00
parent 7d7d62f950
commit 48b17be458
5 changed files with 169 additions and 114 deletions

View File

@@ -40,111 +40,111 @@
</span>
</header>
</div>
<table>
{{!-- Body --}}
{{#if options.editable}}
<tr>
{{!-- Face Rings --}}
<td>
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{ localize 'l5r5e.roll_n_keep.swap_drop_here' }}
</legend>
<table>
{{!-- Body --}}
{{#if options.editable}}
<tr>
{{!-- Face Rings --}}
<td>
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{localize 'l5r5e.roll_n_keep.swap_drop_here'}}
</legend>
{{#each data.swapDiceFaces.rings}}
<div class="dice dropbox faces-change" data-type="swap" data-face="{{this}}" data-die="RingDie">
<img src="{{getDiceFaceUrl 'RingDie' this}}" alt="{{this}}" />
</div>
{{/each}}
</td>
{{!-- Center --}}
<td>
{{!-- Discard & ReRoll --}}
<table>
<tr>
<td>
<fieldset class="dropbox discards" data-type="discard">
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{ localize 'l5r5e.roll_n_keep.discard_drop_here' }}
</legend>
</fieldset>
</td>
<td>&nbsp;</td>
<td>
<fieldset class="dropbox rerolls" data-type="reroll">
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{ localize 'l5r5e.roll_n_keep.reroll_drop_here' }}
</legend>
</fieldset>
</td>
</tr>
</table>
{{!-- DiceList history --}}
<table>
{{#each data.dicesList as |item idxStep|}}
<tr>
{{#each item as |dice idxDie|}}
{{#if dice.face}}
<td>
{{#if dice.newFace}}
<img class="dice {{dice.choice}}{{#ifCond ../../data.currentStep '==' idxStep}} draggable{{/ifCond}}" data-step="{{idxStep}}" data-die="{{idxDie}}" src="{{getDiceFaceUrl dice.type dice.newFace}}" alt="{{idxStep}}_{{idxDie}}" />
{{else}}
<img class="dice {{dice.choice}}{{#ifCond ../../data.currentStep '==' idxStep}} draggable{{/ifCond}}" data-step="{{idxStep}}" data-die="{{idxDie}}" src="{{getDiceFaceUrl dice.type dice.face}}" alt="{{idxStep}}_{{idxDie}}" />
{{/if}}
</td>
{{/if}}
{{/each}}
</tr>
{{/each}}
</table>
{{!-- Keep --}}
<table>
<tr>
<td>
<fieldset class="dropbox keeps" data-type="keep">
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{ localize 'l5r5e.roll_n_keep.keep_drop_here' }}
</legend>
</fieldset>
</td>
</tr>
</table>
</td>
{{!-- Face Skills --}}
<td>
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{ localize 'l5r5e.roll_n_keep.swap_drop_here' }}
</legend>
{{#each data.swapDiceFaces.skills}}
<div class="dice dropbox faces-change" data-type="swap" data-face="{{this}}" data-die="AbilityDie">
<img src="{{getDiceFaceUrl 'AbilityDie' this}}" alt="{{this}}" />
</div>
{{/each}}
</td>
</tr>
<tr>
<td colspan="3">
<button id="finalize" name="finalize" type="button" {{#if data.submitDisabled}}disabled{{/if}}>
{{ localize 'l5r5e.roll_n_keep.bt_validate' }} <i class="fas fa-arrow-circle-right"></i>
</button>
</td>
</tr>
{{else}}
{{!-- Non editable DiceList history --}}
{{#each data.dicesList as |item idxStep|}}
<tr>
{{#each item as |dice idxDie|}}
{{#if dice.face}}
<td>
{{#if dice.newFace}}
<img class="dice {{dice.choice}}" src="{{getDiceFaceUrl dice.type dice.newFace}}" alt="{{idxStep}}_{{idxDie}}" />
{{else}}
<img class="dice {{dice.choice}}" src="{{getDiceFaceUrl dice.type dice.face}}" alt="{{idxStep}}_{{idxDie}}" />
{{/if}}
</td>
{{/if}}
{{/each}}
</tr>
{{#each data.swapDiceFaces.rings}}
<div class="dice dropbox faces-change" data-type="swap" data-face="{{this}}" data-die="RingDie">
<img src="{{getDiceFaceUrl 'RingDie' this}}" alt="{{this}}" />
</div>
{{/each}}
{{/if}}
</table>
</td>
{{!-- Center --}}
<td>
{{!-- Discard & ReRoll --}}
<table>
<tr>
<td>
<fieldset class="dropbox discards" data-type="discard">
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{localize 'l5r5e.roll_n_keep.discard_drop_here'}}
</legend>
</fieldset>
</td>
<td>&nbsp;</td>
<td>
<fieldset class="dropbox rerolls" data-type="reroll">
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{localize 'l5r5e.roll_n_keep.reroll_drop_here'}}
</legend>
</fieldset>
</td>
</tr>
</table>
{{!-- DiceList history --}}
<table>
{{#each data.dicesList as |item idxStep|}}
<tr>
{{#each item as |dice idxDie|}}
<td>
{{#if dice.face}}
{{#if dice.newFace}}
<img class="dice {{dice.choice}}{{#ifCond ../../data.currentStep '==' idxStep}} draggable{{/ifCond}}" data-step="{{idxStep}}" data-die="{{idxDie}}" src="{{getDiceFaceUrl dice.type dice.newFace}}" alt="{{idxStep}}_{{idxDie}}" />
{{else}}
<img class="dice {{dice.choice}}{{#ifCond ../../data.currentStep '==' idxStep}} draggable{{/ifCond}}" data-step="{{idxStep}}" data-die="{{idxDie}}" src="{{getDiceFaceUrl dice.type dice.face}}" alt="{{idxStep}}_{{idxDie}}" />
{{/if}}
{{/if}}
</td>
{{/each}}
</tr>
{{/each}}
</table>
{{!-- Keep --}}
<table>
<tr>
<td>
<fieldset class="dropbox keeps" data-type="keep">
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{localize 'l5r5e.roll_n_keep.keep_drop_here'}}
</legend>
</fieldset>
</td>
</tr>
</table>
</td>
{{!-- Face Skills --}}
<td>
<legend class="section-header">
<i class="fa fa-arrow-down" aria-hidden="true"></i> {{localize 'l5r5e.roll_n_keep.swap_drop_here'}}
</legend>
{{#each data.swapDiceFaces.skills}}
<div class="dice dropbox faces-change" data-type="swap" data-face="{{this}}" data-die="AbilityDie">
<img src="{{getDiceFaceUrl 'AbilityDie' this}}" alt="{{this}}" />
</div>
{{/each}}
</td>
</tr>
<tr>
<td colspan="3">
<button id="finalize" name="finalize" type="button" {{#if data.submitDisabled}}disabled{{/if}}>
{{ localize 'l5r5e.roll_n_keep.bt_validate' }} <i class="fas fa-arrow-circle-right"></i>
</button>
</td>
</tr>
{{else}}
{{!-- Non editable DiceList history --}}
{{#each data.dicesList as |item idxStep|}}
<tr>
{{#each item as |dice idxDie|}}
<td>
{{#if dice.face}}
{{#if dice.newFace}}
<img class="dice {{dice.choice}}" src="{{getDiceFaceUrl dice.type dice.newFace}}" alt="{{idxStep}}_{{idxDie}}" />
{{else}}
<img class="dice {{dice.choice}}" src="{{getDiceFaceUrl dice.type dice.face}}" alt="{{idxStep}}_{{idxDie}}" />
{{/if}}
{{/if}}
</td>
{{/each}}
</tr>
{{/each}}
{{/if}}
</table>
</form>