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,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>

View file

@ -1,23 +0,0 @@
<div class="npc-roll-dialog-container">
<div class="selection-container">
<div class="dice-container">
<div class="dice-inner-container">
<img src="icons/svg/d20-grey.svg" />
<div class="dice-number">d20</div>
</div>
<div class="advantage-container">
<button class="advantage-button {{#if this.advantage}}active{{/if}} advantage" data-action="updateIsAdvantage" data-advantage="true">{{localize "DAGGERHEART.General.Advantage.Full"}}</button>
<button class="advantage-button {{#if (eq this.advantage false)}}active{{/if}} disadvantage" data-action="updateIsAdvantage">{{localize "DAGGERHEART.General.Disadvantage.Full"}}</button>
</div>
</div>
<div class="roll-dialog-experience-container">
{{#each this.experiences as |experience|}}
<button class="experience-chip {{#if experience.selected}}active{{/if}}" data-action="selectExperience" id="{{id}}">{{experience.name}} {{experience.value}}</button>
{{/each}}
</div>
</div>
<footer class="flexrow">
<button type="submit" class="roll-button">Roll</button>
</footer>
</div>

View file

@ -1,81 +0,0 @@
<div>
{{#if @root.hasRoll}}
<div class="roll-dialog-container">
<div class="flexcol">
<div>
{{!-- <input type="text" value="{{@root.formula}}" disabled> --}}
<div>{{@root.formula}}</div>
</div>
{{#unless @root.isLite}}
<div class="roll-dialog-experience-container">
{{#each experiences}}
{{#if name}}
<div class="roll-dialog-chip {{#if (includes ../selectedExperiences id)}}selected{{/if}}" data-action="selectExperience" data-key="{{id}}">
<span>{{name}}</span>
<span>+{{value}}</span>
</div>
{{/if}}
{{/each}}
</div>
<div class="flexrow">
<button class="disadvantage flex1 {{#if (eq advantage 1)}}selected{{/if}}" data-action="updateIsAdvantage" data-advantage="1">{{localize "DAGGERHEART.General.Advantage.Full"}}</button>
<button class="disadvantage flex1 {{#if (eq advantage -1)}}selected{{/if}}" data-action="updateIsAdvantage" data-advantage="-1">{{localize "DAGGERHEART.General.Disadvantage.Full"}}</button>
</div>
{{#if (eq @root.rollType 'D20Roll')}}
<div class="flexrow">
<select name="roll.dice.d20">
{{selectOptions diceOptions selected=@root.roll.d20.denomination}}
</select>
</div>
{{/if}}
{{#if (eq @root.rollType 'DualityRoll')}}
<div class="flexrow">
<div>Hope Dice</div>
<select name="roll.dice.dHope">
{{selectOptions diceOptions selected=@root.roll.dHope.denomination}}
</select>
</div>
<div class="flexrow">
<div>Fear Dice</div>
<select name="roll.dice.dFear">
{{selectOptions diceOptions selected=@root.roll.dFear.denomination}}
</select>
</div>
{{#if roll.advantage}}
<div class="flexrow">
<div>Adv/Disadv Dice</div>
<select name="roll.dice.advantageFaces">
{{selectOptions diceOptions selected=@root.roll.dAdvantage.denomination}}
</select>
</div>
{{/if}}
{{/if}}
<div>
<input type="text" value="{{extraFormula}}" name="extraFormula" placeholder="Situational Bonus">
</div>
{{/unless}}
{{!-- {{#if (not isNpc)}} --}}
{{!-- <div class="form-group">
<label>Hope</label>
<div class="form-fields">
<select name="hope">
{{selectOptions diceOptions selected=hope valueAttr="value" labelAttr="name" localize=true}}
</select>
</div>
</div>
<div class="form-group">
<label>Fear</label>
<div class="form-fields">
<select name="fear">
{{selectOptions diceOptions selected=fear valueAttr="value" labelAttr="name" localize=true}}
</select>
</div>
</div> --}}
{{!-- {{/if}} --}}
</div>
</div>
{{/if}}
<footer>
<button data-action="submitRoll"{{#unless canRoll}} disabled{{/unless}}>Roll</button>
</footer>
</div>