new style for dialog roll and remove console.log debuggers (#272)

* new style for dialog roll and remove console.log debuggers

* enhance advantage logic
This commit is contained in:
Murilo Brito 2025-07-05 14:34:42 -03:00 committed by GitHub
parent 0add5f369e
commit 41181f19f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 682 additions and 233 deletions

View file

@ -0,0 +1,24 @@
<div>
{{#if uses}}
<div class="form-group">
<div class="form-fields">
<label for="uses.enabled">Uses: {{uses.value}}/{{uses.max}}</label>
<input name="uses.enabled" type="checkbox"{{#if uses.enabled}} checked{{/if}}>
</div>
</div>
{{/if}}
{{#each costs as | cost index |}}
<div class="form-group">
<div class="form-fields">
<label for="{{type}}">{{type}}: {{total}}</label>
<input name="costs.{{index}}.enabled" type="checkbox"{{#if enabled}} checked{{/if}}>
{{#if scalable}}
<input type="range" value="{{scale}}" min="1" max="10" step="{{step}}" name="costs.{{index}}.scale">
{{/if}}
</div>
</div>
{{/each}}
{{!-- <footer>
<button data-action="sendCost"{{#unless canUse}} disabled{{/unless}}>Accept</button>
</footer> --}}
</div>

View file

@ -0,0 +1,33 @@
<div>
<div class="form-group">
<label><strong>{{title}}</strong></label>
<div class="form-fields">
{{!-- <input type="text" value="{{formula}}" disabled /> --}}
<div>{{@root.formula}}</div>
</div>
<div>
<input type="text" value="{{extraFormula}}" name="extraFormula" placeholder="Situational Bonus">
</div>
</div>
{{!-- {{#each bonusDamage as |damage index|}}
<div class="form-group">
<label><strong>{{damage.description}}</strong></label>
<div class="form-fields">
<label>Enabled</label>
<input style="align-self: baseline;" type="checkbox" name="bonusDamage.{{index}}.initiallySelected" {{checked damage.initiallySelected}} />
{{#if (and damage.initiallySelected damage.hopeIncrease)}}
<label>Hope</label>
<div class="hope-container">
<i data-action="decreaseHopeUse" data-index="{{index}}" class="fa-solid fa-caret-left icon-button {{#if (eq damage.hopeUses 0)}}disabled{{/if}}"></i>
<div>{{damage.hopeUses}}</div>
<i data-action="increaseHopeUse" data-index="{{index}}" class="fa-solid fa-caret-right icon-button {{#if (eq ../hopeUsed ../hope)}}disabled{{/if}}"></i>
</div>
{{/if}}
</div>
</div>
{{/each}} --}}
<footer>
<button data-action="submitRoll">Roll</button>
</footer>
</div>

View file

@ -0,0 +1,7 @@
<header class="dialog-header">
{{#if rollConfig.headerTitle}}
<h1>{{rollConfig.headerTitle}}</h1>
{{else}}
<h1>{{rollConfig.title}}</h1>
{{/if}}
</header>

View file

@ -0,0 +1,126 @@
<div>
{{#if @root.hasRoll}}
<div class="roll-dialog-container">
{{#unless @root.isLite}}
<div class="dices-section">
{{#if (eq @root.rollType 'D20Roll')}}
<div class="dice-option">
<img class="dice-icon" src="{{concat 'systems/daggerheart/assets/icons/dice/default/' @root.roll.d20.denomination '.svg'}}" alt="">
<div class="dice-select">
<select name="roll.dice.d20">
{{selectOptions diceOptions selected=@root.roll.d20.denomination}}
</select>
</div>
</div>
{{#if @root.advantage}}
{{#if (eq @root.advantage 1)}}
<div class="dice-option">
<img class="dice-icon" src="{{concat 'systems/daggerheart/assets/icons/dice/adv/' @root.roll.d20.denomination '.svg'}}" alt="">
<div class="dice-select">
<span class="label">Advantage</span>
</div>
</div>
{{else if (eq @root.advantage -1)}}
<div class="dice-option">
<img class="dice-icon" src="{{concat 'systems/daggerheart/assets/icons/dice/disadv/' @root.roll.d20.denomination '.svg'}}" alt="">
<div class="dice-select">
<span class="label">Disdvantage</span>
</div>
</div>
{{/if}}
{{/if}}
{{/if}}
{{#if (eq @root.rollType 'DualityRoll')}}
<div class="dice-option">
<img class="dice-icon" src="{{concat 'systems/daggerheart/assets/icons/dice/hope/' @root.roll.dHope.denomination '.svg'}}" alt="">
<div class="dice-select">
<span class="label">Hope</span>
<select name="roll.dice.dHope">
{{selectOptions diceOptions selected=@root.roll.dHope.denomination}}
</select>
</div>
</div>
<div class="dice-option">
<img class="dice-icon" src="{{concat 'systems/daggerheart/assets/icons/dice/fear/' @root.roll.dFear.denomination '.svg'}}" alt="">
<div class="dice-select">
<span class="label">Fear</span>
<select name="roll.dice.dFear">
{{selectOptions diceOptions selected=@root.roll.dFear.denomination}}
</select>
</div>
</div>
{{#if @root.advantage}}
{{#if (eq @root.advantage 1)}}
<div class="dice-option">
<img class="dice-icon" src="{{concat 'systems/daggerheart/assets/icons/dice/adv/' @root.roll.dAdvantage.denomination '.svg'}}" alt="">
<div class="dice-select">
<span class="label">Advantage</span>
</div>
</div>
{{else if (eq @root.advantage -1)}}
<div class="dice-option">
<img class="dice-icon" src="{{concat 'systems/daggerheart/assets/icons/dice/disadv/' @root.roll.dAdvantage.denomination '.svg'}}" alt="">
<div class="dice-select">
<span class="label">Disdvantage</span>
</div>
</div>
{{/if}}
{{/if}}
{{/if}}
</div>
<fieldset class="experience-container">
<legend>Experiences</legend>
{{#each experiences}}
{{#if name}}
<div class="experience-chip {{#if (includes ../selectedExperiences id)}}selected{{/if}}" data-action="selectExperience" data-key="{{id}}">
{{#if (includes ../selectedExperiences id)}}
<span><i class="fa-solid fa-circle"></i></span>
{{else}}
<span><i class="fa-regular fa-circle"></i></span>
{{/if}}
{{#if (eq @root.rollType 'D20Roll')}}
<span class="label">{{name}} +{{modifier}}</span>
{{else}}
<span class="label">{{name}} +{{value}}</span>
{{/if}}
</div>
{{/if}}
{{/each}}
</fieldset>
<fieldset class="modifier-container one-column">
<legend>Modifiers</legend>
<div class="nest-inputs">
<button class="advantage-chip flex1 {{#if (eq advantage 1)}}selected{{/if}}" data-action="updateIsAdvantage" data-advantage="1">
{{#if (eq advantage 1)}}
<span><i class="fa-solid fa-circle"></i></span>
{{else}}
<span><i class="fa-regular fa-circle"></i></span>
{{/if}}
<span class="label">{{localize "DAGGERHEART.General.Advantage.Full"}}</span>
</button>
<button class="disadvantage-chip flex1 {{#if (eq advantage -1)}}selected{{/if}}" data-action="updateIsAdvantage" data-advantage="-1">
{{#if (eq advantage -1)}}
<span><i class="fa-solid fa-circle"></i></span>
{{else}}
<span><i class="fa-regular fa-circle"></i></span>
{{/if}}
<span class="label">{{localize "DAGGERHEART.General.Disadvantage.Full"}}</span>
</button>
{{#unless (eq @root.rollType 'D20Roll')}}
<select name="roll.dice.advantageFaces">
{{selectOptions diceOptions selected=@root.roll.dAdvantage.denomination}}
</select>
{{/unless}}
</div>
<input type="text" value="{{extraFormula}}" name="extraFormula" placeholder="Situational Bonus">
</fieldset>
{{/unless}}
<span class="formula-label"><b>Formula:</b> {{@root.formula}}</span>
<button class="sunmit-btn" data-action="submitRoll"{{#unless canRoll}} disabled{{/unless}}>
<i class="fa-solid fa-dice"></i>
<span class="label">Roll</span>
</button>
</div>
{{/if}}
</div>