roll dialog box

This commit is contained in:
François-Xavier Guillois
2023-08-29 17:19:11 +02:00
parent 9f760deee0
commit ef111392c2
7 changed files with 93 additions and 53 deletions
+11 -1
View File
@@ -80,10 +80,20 @@ ul.unstyled li {
.system-vermine2047 .dialog .window-content { .system-vermine2047 .dialog .window-content {
background: url(/systems/vermine2047/assets/images/ui/fond_chat_box.webp); background: url(/systems/vermine2047/assets/images/ui/fond_chat_box.webp);
padding: 0; padding: 0.5rem;
overflow-y: hidden; overflow-y: hidden;
} }
.window-content .row.smb {
margin-bottom:0.25rem;
}
.window-content .row.mdb {
margin-bottom:0.5rem;
}
.window-content .row.lgb {
margin-bottom:1rem;
}
.actor.sheet form .form { .actor.sheet form .form {
display: grid; display: grid;
/*grid: /*grid:
+12
View File
@@ -218,14 +218,26 @@ export class VermineCharacterSheet extends VermineActorSheet {
// Handle rolls that supply the formula directly. // Handle rolls that supply the formula directly.
if (dataset.label) { if (dataset.label) {
dataset.rollType = dataset.type;
/*const label = game.i18n.localize(dataset.label) ? `[ability] ${game.i18n.localize(dataset.label)}` : ''; /*const label = game.i18n.localize(dataset.label) ? `[ability] ${game.i18n.localize(dataset.label)}` : '';
console.log($(element).attr('for')); console.log($(element).attr('for'));
const NoD = this.actor.system.skills[$(element).attr('for').split('.')[2]]?.value || 0 const NoD = this.actor.system.skills[$(element).attr('for').split('.')[2]]?.value || 0
return game.vermine2047.VermineRoll.roll(this.actor.id, label, NoD, 0, {});*/ return game.vermine2047.VermineRoll.roll(this.actor.id, label, NoD, 0, {});*/
let data = { let data = {
actorId: this.actor.id, actorId: this.actor.id,
abilities: this.actor.system.abilities,
skills: this.actor.system.skills,
rollType: dataset.rollType,
labelKey: dataset.label,
abilityScore: 0,
skillScore: 0,
label: game.i18n.localize(dataset.label) label: game.i18n.localize(dataset.label)
}; };
if (dataset.type == 'ability'){
data.abilityScore = this.actor.system.abilities[dataset.label].value;
} else if (dataset.type == 'skill'){
data.skillScore = this.actor.system.skills[dataset.label].value;
}
getRollBox(data); getRollBox(data);
return true; return true;
} }
-14
View File
@@ -22,20 +22,6 @@ VERMINE.DifficultyLevels = {
5:{ "label":"DIFFICULTY_LEVELS.impossible", "difficulty":10} 5:{ "label":"DIFFICULTY_LEVELS.impossible", "difficulty":10}
}, },
VERMINE.Instincts = {
1:{ "key":"architect"},
2:{ "key":"sword"},
3:{ "key":"flail"},
4:{ "key":"man"},
5:{ "key":"keeper"},
6:{ "key":"hand"},
7:{ "key":"mask"},
8:{ "key":"void"},
9:{ "key":"bone"},
0:{ "key":"traveller"}
}
VERMINE.abilityCategories = { VERMINE.abilityCategories = {
"physical": { "physical": {
"label":"VERMINE.ability_category.physical" "label":"VERMINE.ability_category.physical"
+18 -9
View File
@@ -58,6 +58,7 @@
// difficulty // difficulty
data.difficulty = (formData.difficulty != undefined) ? formData.difficulty : 7; data.difficulty = (formData.difficulty != undefined) ? formData.difficulty : 7;
// maîtrise bonus // maîtrise bonus
// TODO : utiliser la configuration des niveaux de compétences plutôt
if (formData.skill > 0 && formData.skill < 3){ if (formData.skill > 0 && formData.skill < 3){
NoD += 1; NoD += 1;
} else if (formData.skill > 2 && formData.skill < 5){ } else if (formData.skill > 2 && formData.skill < 5){
@@ -97,15 +98,23 @@
} }
}, },
render: function (h) { render: function (h) {
h.find("#skills-radio input").change(function () { h.find('select[name="skill"]').change((event) => {
let s = $(this).attr("data-skill"); if (data.rollType == 'skill' && event.target.value != undefined){
h.find(".trait-list .hidden").removeClass("show"); const skillScore = data.skills[event.target.value].value;
let f = h.find(".trait-list ." + s); // on enregistre la valeur de la compétence
f.addClass("show"); h.find('input[name="skillScore"]').val(skillScore);
if (f.length == 0) { // on met à jour les infos de niveaux de compétence
h.find(".use-trait input").attr("disabled", "disabled").prop("checked", false); const skillLevel = CONFIG.VERMINE.SkillLevels[skillScore];
} else if (skillLevel != undefined){
h.find(".use-trait input").attr("disabled", null); h.find('#skillLevel').text(game.i18n.localize(skillLevel.label));
h.find('#skillDicePool').text(skillLevel.dicePool);
h.find('#skillReroll').text(skillLevel.reroll);
} else {
h.find('#skillLevel').text('Inconnu');
h.find('#skillDicePool').text(0);
h.find('#skillReroll').text(0);
}
}
}); });
} }
}); });
+4
View File
@@ -51,7 +51,11 @@ export const registerHandlebarsHelpers = function () {
if (level < 1 || level > 5) if (level < 1 || level > 5)
return ""; return "";
let levelData = CONFIG.VERMINE.SkillLevels[level]; let levelData = CONFIG.VERMINE.SkillLevels[level];
if (property == 'label'){
return (levelData !== undefined) ? game.i18n.localize(levelData[property]) : "";
} else {
return (levelData !== undefined) ? levelData[property] : ""; return (levelData !== undefined) ? levelData[property] : "";
}
}); });
// return diff level information // return diff level information
+4 -4
View File
@@ -7,8 +7,8 @@
{{#each @root.system.abilities as |ability key|}} {{#each @root.system.abilities as |ability key|}}
{{#if (eq ability.category ackey) }} {{#if (eq ability.category ackey) }}
<div class="ability flexcol flex-group-center items-center"> <div class="ability flexcol flex-group-center items-center">
<label for="system.abilities.{{key}}.value" class="resource-label rollable flexlarge align-left" data-label="{{ smarttl "ABILITIES" key }}">{{ smarttl "ABILITIES" key }}</label> <label for="system.abilities.{{key}}.value" class="resource-label rollable flexlarge align-left" data-type="ability" data-label="{{ key }}">{{ smarttl "ABILITIES" key }}</label>
<input type="text" name="system.abilities.{{key}}.value" value="{{ability.value}}" data-dtype="Number"/> <input type="number" name="system.abilities.{{key}}.value" value="{{ability.value}}" data-dtype="Number" min="1" max="5" />
</div> </div>
{{/if}} {{/if}}
{{/each}} {{/each}}
@@ -24,11 +24,11 @@
{{#if (eq skill.category sckey) }} {{#if (eq skill.category sckey) }}
<div class="ability flexrow flex-group-center"> <div class="ability flexrow flex-group-center">
<label style="flex:60%;" for="system.skills.{{skey}}.value" class="resource-label rollable flexlarge align-left" data-roll="+@skills.{{skey}}d10" data-label="{{ smarttl "SKILLS" skey }}">{{ smarttl "SKILLS" skey }} <label style="flex:60%;" for="system.skills.{{skey}}.value" class="resource-label rollable flexlarge align-left" data-type="skill" data-label="{{ skey }}">{{ smarttl "SKILLS" skey }}
{{#if (eq skill.rarity 1)}}<sup>(I)</sup>{{/if}}{{#if (eq skill.rarity 2)}}<sup>(II)</sup>{{/if}}</label> {{#if (eq skill.rarity 1)}}<sup>(I)</sup>{{/if}}{{#if (eq skill.rarity 2)}}<sup>(II)</sup>{{/if}}</label>
<span class="die d10 pool" title="pool">{{ skillLevel "dicePool" skill.value }}</span> <span class="die d10 pool" title="pool">{{ skillLevel "dicePool" skill.value }}</span>
<span class="die d10 reroll" title="reroll">{{ skillLevel "reroll" skill.value }}</span> <span class="die d10 reroll" title="reroll">{{ skillLevel "reroll" skill.value }}</span>
<input type="text" name="system.skills.{{skey}}.value" value="{{skill.value}}" class="skill" data-dtype="Number"/> <input type="number" name="system.skills.{{skey}}.value" value="{{skill.value}}" class="skill" data-dtype="Number" min="1" max="5" />
</div> </div>
{{/if}} {{/if}}
{{/each}} {{/each}}
+40 -21
View File
@@ -1,9 +1,17 @@
<form id="dice-pool-form" class="ecryme-dv-form" data-actor-id="{{ speakerId }}"> <form id="dice-pool-form" class="ecryme-dv-form" data-actor-id="{{ speakerId }}">
<input type="hidden" name="label" id="label" value="{{ label }}" />
<input type="hidden" name="rollType" id="rollType" value="{{ rollType }}" />
<input type="hidden" name="abilityScore" id="abilityScore" value="{{ abilityScore }}" />
<input type="hidden" name="skillScore" id="skillScore" value="{{ skillScore }}" />
<div class="dice-pool flexcol"> <div class="dice-pool flexcol">
<div class="flexrow row"> <div class="flexrow row lgb flex-group-center">
<span>Type de jet <strong>{{#if (eq rollType 'skill')}}{{ localize 'VERMINE.skill_title' }}{{else}}{{ localize 'VERMINE.ability' }}{{/if}}</strong></span>
<span>{{#if (eq rollType 'skill')}}{{ localize 'VERMINE.skill_title' }}{{else}}{{ localize 'VERMINE.ability' }}{{/if}}
<strong>{{#if (eq rollType 'skill')}}{{ smarttl "SKILLS" label }}{{else}}{{ smarttl "ABILITIES" label }}{{/if}}</strong> </span>
</div>
<div class="flexrow row mdb">
<label class="label" style="flex: 60%;">{{localize 'VERMINE.difficulty'}}</label> <label class="label" style="flex: 60%;">{{localize 'VERMINE.difficulty'}}</label>
<select class="info-value" style="max-width: 40%;" name="system.skill" data-dtype="String" type="number" name="difficulty" value="7" id="difficulty" min="3" max="10"> <select class="info-value" style="max-width: 40%;" data-dtype="String" type="number" name="difficulty" id="difficulty" min="3" max="10">
{{#select difficulty }} {{#select difficulty }}
<option value="{{ diffLevel 'difficulty' 1}}">{{ diffLevel 'label' 1}} - {{ diffLevel 'difficulty' 1}}</option> <option value="{{ diffLevel 'difficulty' 1}}">{{ diffLevel 'label' 1}} - {{ diffLevel 'difficulty' 1}}</option>
<option value="{{ diffLevel 'difficulty' 1}}">{{ diffLevel 'label' 2}} - {{ diffLevel 'difficulty' 2}}</option> <option value="{{ diffLevel 'difficulty' 1}}">{{ diffLevel 'label' 2}} - {{ diffLevel 'difficulty' 2}}</option>
@@ -16,37 +24,48 @@
<!--div class="flexrow row"> <!--div class="flexrow row">
<input style="text-align: center;" class="numeric-entry" type="number" name="difficulty" value="7" id="difficulty" min="3" max="10"> <input style="text-align: center;" class="numeric-entry" type="number" name="difficulty" value="7" id="difficulty" min="3" max="10">
</div--> </div-->
<div class="flexrow row"> <div class="flexrow row mdb">
<label class="label" style="flex: 80%;">{{localize 'VERMINE.ability'}}</label> <label class="label" style="flex: 60%;">{{localize 'VERMINE.ability'}}</label>
<input type="number" class="numeric-entry" style="text-align: center;" name="ability" id="ability" min="1" max="5" value="2"> <select class="info-value" style="max-width: 40%;" data-dtype="String" type="number" name="ability" id="ability" min="1" max="5">
{{#each abilities as |ability key| }}
<option value="{{ key }}" {{#if (eq key @root.label)}}selected{{/if}}> {{ smarttl "ABILITIES" key }} - {{ ability.value }}</option>
{{/each}}
</select>
</div> </div>
<div class="flexrow row"> {{#if (eq rollType 'skill')}}
<label class="label" style="flex: 80%;">{{localize 'VERMINE.skill_title'}}</label> <div class="flexrow row mdb">
<input type="number" class="numeric-entry" style="text-align: center;" name="skill" id="skill" required min="0" max="5" {{#if skillScore}}value="{{ skillScore }}"{{else}}value="0"{{/if}}> <label class="label" style="flex: 60%;">{{localize 'VERMINE.skill_title'}}</label>
<select class="info-value" style="max-width: 40%;" data-dtype="String" type="number" name="skill" id="skill" min="1" max="5">
{{#each skills as |skill key| }}
<option value="{{ key }}" {{#if (eq key @root.label)}}selected{{/if}}> {{ smarttl "SKILLS" key }} - {{ skill.value }}</option>
{{/each}}
</select>
</div> </div>
<div class="flexrow row"> <div class="flexrow row lgb">
<label class="label">{{localize 'VERMINE.skill_mastery'}}</label> <span id="skillLevel">{{#if (ne skillScore 0)}}{{ skillLevel 'label' skillScore }}{{/if}}</span>
<span style="flex: 80%;">{{localize 'VERMINE.bonus'}} : / {{localize 'VERMINE.reroll'}} : </span> <span>{{localize 'VERMINE.bonus'}} : <em id="skillDicePool">{{#if (ne skillScore 0)}}{{ skillLevel 'dicePool' skillScore }}{{else}}0{{/if}}</em></span>
<span>{{localize 'VERMINE.reroll'}} : <em id="skillReroll">{{#if (ne skillScore 0)}}{{ skillLevel 'reroll' skillScore }}{{else}}0{{/if}}</em></span>
</div> </div>
<div class="flexrow row"> <div class="flexrow row smb">
<label class="label">{{localize 'VERMINE.specialty'}}</label> <label class="label">{{localize 'VERMINE.specialty'}} (+1D)</label>
<input type="checkbox" name="usingSpecialization" id="usingSpecialization" value="1" {{#if specialty}}checked{{/if}}> <input type="checkbox" name="usingSpecialization" id="usingSpecialization" value="1" {{#if specialty}}checked{{/if}}>
</div> </div>
<div class="flexrow row"> {{/if}}
<label class="label">{{localize 'VERMINE.help'}}</label> <div class="flexrow row smb">
<label class="label">{{localize 'VERMINE.help'}} (+1D)</label>
<input type="checkbox" name="helped" id="helped" value="1" {{#if help}}checked{{/if}}> <input type="checkbox" name="helped" id="helped" value="1" {{#if help}}checked{{/if}}>
</div> </div>
<div class="flexrow row"> <div class="flexrow row mdb">
<label class="label">{{localize 'VERMINE.tooling'}}</label> <label class="label">{{localize 'VERMINE.tooling'}} (+1D)</label>
<input type="checkbox" name="usingTools" id="usingTools" value="1" {{#if help}}checked{{/if}}> <input type="checkbox" name="usingTools" id="usingTools" value="1" {{#if help}}checked{{/if}}>
</div> </div>
<div class="flexrow row"> <div class="flexrow row mdb">
<label class="label" style="flex: 80%;">{{localize 'VERMINE.self_control'}}</label> <label class="label" style="flex: 80%;">{{localize 'VERMINE.self_control'}}</label>
<input type="number" class="numeric-entry" style="text-align: center;" name="self_control" id="self_control" min="0" max="5" value="0"> <input type="number" class="numeric-entry" style="text-align: center;" name="self_control" id="self_control" min="0" max="5" value="0">
</div> </div>
<div class="flexrow row"> <div class="flexrow row mdb">
<label class="label" style="flex: 80%;">{{localize 'VERMINE.group'}}</label> <label class="label" style="flex: 80%;">{{localize 'VERMINE.group'}}</label>
<input type="number" class="numeric-entry" style="text-align: center;" name="group" id="group" min="0" max="5" value="0"> <input type="number" class="numeric-entry" style="text-align: center;" name="group" id="group" min="0" max="" value="0">
</div> </div>
</div> </div>
<p><input type="hidden" name="speakerId" value="{{ speakerId }}" /> <p><input type="hidden" name="speakerId" value="{{ speakerId }}" />