Cleanup roll windows

- permettre plusieurs fenêtres de jets en même temps en éliminant les
  id dans le html et les jquery sur id pour éviter les interactions
- génération de la table par handlebars
This commit is contained in:
Vincent Vandemeulebrouck
2022-12-06 01:30:12 +01:00
parent f027e3318b
commit 2122a54db7
43 changed files with 319 additions and 343 deletions

View File

@ -23,7 +23,7 @@
<span class="tooltiptext ttt-fatigue">{{{calc.fatigue.html}}}</span>
Fatigue
<a class="fatigue-moins"><i class="fas fa-minus-square"></i></a>
<input class="resource-content" id="fatigue-value" type="text" name="system.sante.fatigue.value" value="{{system.sante.fatigue.value}}" data-dtype="Number" />
<input class="resource-content" type="text" name="system.sante.fatigue.value" value="{{system.sante.fatigue.value}}" data-dtype="Number" />
<span>/ {{system.sante.fatigue.max}}</span>
<a class="fatigue-plus"><i class="fas fa-plus-square"></i></a>
</label>
@ -32,7 +32,7 @@
<label class="compteur">
<span class="ptreve-actuel"><a>Rêve</a></span>
<a class="ptreve-actuel-moins"><i class="fas fa-minus-square"></i></a>
<input class="resource-content" id="pointsreve-value" type="text" name="system.reve.reve.value" value="{{system.reve.reve.value}}" data-dtype="Number" />
<input class="resource-content" class="pointsreve-value" type="text" name="system.reve.reve.value" value="{{system.reve.reve.value}}" data-dtype="Number" />
<span>/ {{system.reve.seuil.value}}</span>
<a class="ptreve-actuel-plus"><i class="fas fa-plus-square"></i></a>
</label>

View File

@ -6,7 +6,7 @@
</header>
<label>&nbsp;&nbsp;Conditions</label>
<select name="diffConditions" id="diffConditions" data-dtype="Number">
<select name="diffConditions" data-dtype="Number">
{{#select diffConditions}}
{{#each ajustementsConditions as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>

View File

@ -5,7 +5,7 @@
<div class="form-group">
<label>Nombre de brins</label>
<select name="nbBrins" id="nbBrins" data-dtype="number">
<select name="nbBrins" data-dtype="number">
{{#select nbBrins}}
{{{nbBrinsSelect}}}
{{/select}}

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<div>
<div class="flexrow flex-center">
<div>

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" />
<h4>{{item.name}}</h4>
<div class="flexrow">

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" />
<h4>{{item.name}}</h4>
<label>Quantité totale : {{item.system.quantite}}</label>

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<img class="chat-icon" src="{{item.img}}" title="{{item.name}}" alt="{{item.name}}" />
<h4>{{item.name}}</h4>
<div class="flexcol">

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<h2>Fabrication: {{recette.name}}</h2>
<div class="grid grid-2col">
<div class="flex-group-left">
@ -20,12 +20,12 @@
{{/if}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution">
</div>
</form>
<script>

View File

@ -14,12 +14,10 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<h2>Chanter: {{oeuvre.name}}</h2>
<div class="grid grid-2col">
@ -15,12 +15,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -41,7 +41,7 @@
{{/if}}
{{#if ajustements.attaqueDefenseurSurpris.used}}
<div class="flexrow">
<label id="defenseur-surprise">{{ajustements.attaqueDefenseurSurpris.label}}</label>
<label>{{ajustements.attaqueDefenseurSurpris.label}}</label>
</div>
{{/if}}
@ -75,12 +75,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -16,12 +16,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -16,12 +16,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<h2>Boire</h2>
<img class="chat-icon" src="systems/foundryvtt-reve-de-dragon/icons/objets/chope_gres.webp" alt="Chope d'alcool"/>
<div class="grid grid-2col">
@ -6,14 +6,14 @@
<label>Etat général</label><label class="flexrow">{{etat}}</label>
<label>Déjà bu</label><label class="flexrow">{{diffNbDoses}}</label>
<label>Force du breuvage</label>
<select name="forceAlcool" id="forceAlcool" data-dtype="number">
<select class="force-alcool" data-dtype="number">
{{#select forceAlcool}}
{{#each ajustementsForce as |key|}}
<option value={{key}}>{{key}}</option>
{{/each}}
{{/select}}
</select>
<label>Ajustement final</label><label id="roll-param">10 / 0</label>
<label>Ajustement final</label><label class="roll-ethylisme">10 / 0</label>
</div>
</form>

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<h2>Jouer à : {{oeuvre.name}}</h2>
<div class="grid grid-2col">
@ -16,13 +16,12 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}}
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -17,12 +17,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -20,29 +20,28 @@
</div>
<div class="flexrow">
<label>Comportement antérieur : {{upperFirst meditation.system.comportement}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isComportement" {{#if conditionMeditation.isComportement}}checked{{/if}} />
<input class="attribute-value conditionMeditation" type="checkbox" name="isComportement" {{#if conditionMeditation.isComportement}}checked{{/if}} />
</div>
<div class="flexrow">
<label>Heure : {{upperFirst meditation.system.heure}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isHeure" {{#if conditionMeditation.isHeure}}checked{{/if}} />
<input class="attribute-value conditionMeditation" type="checkbox" name="isHeure" {{#if conditionMeditation.isHeure}}checked{{/if}} />
</div>
<div class="flexrow">
<label>Purification : {{upperFirst meditation.system.purification}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isPurification" {{#if conditionMeditation.isPurification}}checked{{/if}} />
<input class="attribute-value conditionMeditation" type="checkbox" name="isPurification" {{#if conditionMeditation.isPurification}}checked{{/if}} />
</div>
<div class="flexrow">
<label>Vêture : {{upperFirst meditation.system.veture}}</label>
<input class="attribute-value conditionMeditation" type="checkbox" id="isVeture" {{#if conditionMeditation.isVeture}}checked{{/if}} />
<input class="attribute-value conditionMeditation" type="checkbox" name="isVeture" {{#if conditionMeditation.isVeture}}checked{{/if}} />
</div>
<hr>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements"></div>
<div class="placeholder-ajustements"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<h2>Interpréter la mélodie: {{oeuvre.name}}</h2>
<div class="grid grid-2col">
@ -15,12 +15,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<h2>Interpréter une Œuvre: {{oeuvre.name}}</h2>
<div class="grid grid-2col">
@ -16,12 +16,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -1,4 +1,4 @@
<form class="rdddialog">
<form class="rdd-roll-dialog">
<h2>Cuisiner: {{oeuvre.name}}</h2>
<div class="grid grid-2col">
@ -29,12 +29,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-moral.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html" oeuvre.system}}
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -6,8 +6,7 @@
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffLibre.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
<button id="lancer" type="button">Lancer les dés</button>
<button class="lancer-table-resolution" type="button">Lancer les dés</button>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>

View File

@ -12,12 +12,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -33,12 +33,11 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffFixe.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-diffCondition.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-roll-forcer.html"}}
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -21,7 +21,7 @@
</div>
<div class="flexrow">
<label for="ptreve-variable">Points de Rêve: </label>
<select name="ptreve-variable" class="div-sort-ptreve-var" id="ptreve-variable" data-dtype="number">
<select name="ptreve-variable" class="div-sort-ptreve-var" data-dtype="number">
{{#select ptreve-variable}}
{{#each coutreve as |cout key|}}
<option value={{cout}}>{{cout}}</option>
@ -49,7 +49,7 @@
</div>
<div class="flexrow">
<label for="diffLibre">Difficulté</label>
<select name="diffLibre" class="div-sort-difficulte-var" id="diffLibre" data-dtype="number">
<select name="diffLibre" class="div-sort-difficulte-var" data-dtype="number">
{{#select diffLibre}}
{{#each difficultesLibres as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>
@ -64,7 +64,7 @@
<label for="bonus-case">Bonus de case </label>
<label name="bonus-case" class="bonus-case">0%</label>
</div>
<div id="tableAjustements" class="flexrow"></div>
<div class="placeholder-ajustements" class="flexrow"></div>
</div>
</div>
<div class="description-sort">
@ -72,8 +72,7 @@
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html" sort=selectedSort}}
</div>
<div id="tableResolution"></div>
<div id="tableProbaReussite"></div>
<div class="placeholder-resolution"></div>
</form>
<script>

View File

@ -4,7 +4,7 @@
<section class="sheet-body">
<div class="form-group">
<label for="xp">Caractéristique</label>
<select name="system.carac" id="caracselect" data-dtype="String">
<select name="system.carac" data-dtype="String">
{{#select system.carac}}
{{#each caracList as |carac key|}}
<option value="{{key}}">{{carac.label}}</option>
@ -14,7 +14,7 @@
</div>
<div class="form-group">
<label for="xp">Compétence</label>
<select name="system.competence" id="competenceselect" data-dtype="String">
<select name="system.competence" data-dtype="String">
{{#select system.competence}}
<option value="">Sans compétence</option>
{{>"systems/foundryvtt-reve-de-dragon/templates/enum-competence.html"}}

View File

@ -1,7 +1,7 @@
<div class="table-ajustement">
<span class="tooltip tooltip-dotted">
<span>Ajustement Final:</span>
<span id="roll-param">{{selectedCarac.value}} / {{numberFormat finalLevel decimals=0 sign=true}}</span>
<span class="roll-param-resolution">{{selectedCarac.value}} / {{numberFormat finalLevel decimals=0 sign=true}}</span>
<div class="tooltiptext ttt-ajustements">
{{#each ajustements as |item key|}}
{{#if item.used}}

View File

@ -1,6 +1,6 @@
<div class="flexrow">
<label for="diffConditions">Conditions</label>
<select name="diffConditions" id="diffConditions" data-dtype="number" {{#unless use.conditions}}disabled{{/unless}}>
<select name="diffConditions" data-dtype="number" {{#unless use.conditions}}disabled{{/unless}}>
{{#select diffConditions}}
{{#each ajustementsConditions as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>

View File

@ -1,6 +1,6 @@
<div class="flexrow">
<label for="diffLibre">Difficulté choisie</label>
<select name="diffLibre" id="diffLibre" data-dtype="number" {{#unless use.libre}}disabled{{/unless}}>
<select name="diffLibre" data-dtype="number" {{#unless use.libre}}disabled{{/unless}}>
{{#select diffLibre}}
{{#each difficultesLibres as |key|}}
<option value={{key}}>{{numberFormat key decimals=0 sign=true}}</option>

View File

@ -1,6 +1,6 @@
{{#if isGM}}
<div class="flexrow">
<label for="force-dice-result">Résultat du dé</label>
<input name='force-dice-result' id='force-dice-result' value='{{forceDiceResult}}'>
<input name='force-dice-result' value='{{forceDiceResult}}'>
</div>
{{/if}}

View File

@ -1,4 +1,4 @@
<select name="carac" id="carac" class="flex-grow select-carac" data-dtype="String">
<select name="carac" class="flex-grow" data-dtype="String">
{{#select carac}}
{{#each carac as |caracitem key|}}
<option value={{key}}>{{caracitem.label}}</option>

View File

@ -0,0 +1,44 @@
<table class='table-resolution'>
<tr>
{{#if (gt min -8)}}
<th class="table-resolution-level">-8</th>
{{/if}}
{{#if (gt min -7)}}
<th class="table-resolution-level">...</th>
{{/if}}
{{#each cols as |col|}}
<th class="table-resolution-level">{{numberFormat col decimals=0 sign=true}}</th>
{{/each}}
</tr>
{{#each rows as |row|}}
<tr>
{{#if (gt @root.min -8)}}
<td class="table-resolution-carac" data-row="{{row}}" data-col="{{col}}">{{computeResolutionScore row -8}}</td>
{{/if}}
{{#if (gt @root.min -7)}}
<td class=""></td>
{{/if}}
{{#each @root.cols as |col|}}
{{#if (and (eq row @root.carac) (eq col @root.difficulte))}}
<td class="table-resolution-target">{{computeResolutionScore row col}}</td>
{{else if (eq col -8)}}
<td class="table-resolution-carac">{{computeResolutionScore row col}}</td>
{{else}}
<td>{{computeResolutionScore row col}}</td>
{{/if}}
</td>
{{/each}}
</tr>
{{/each}}
</table>
{{#with (computeResolutionChances carac difficulte) as |cell|}}
<div>
<span class="table-proba-reussite">
Particulière: <span class="rdd-roll-part">{{cell.part}}</span>
- Significative: <span class="rdd-roll-sign">{{cell.sign}}</span>
- Réussite: <span class="rdd-roll-norm">{{cell.score}}</span>
- Echec Particulier: <span class="rdd-roll-epart">{{cell.epart}}</span>
- Echec Total: <span class="rdd-roll-etotal">{{cell.etotal}}</span>
</span>
</div>
{{/with}}