first commit after clone

This commit is contained in:
rwanoux
2024-04-17 11:51:59 +02:00
parent f483a219c1
commit 0fe0d530b1
3 changed files with 173 additions and 161 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
import {onManageActiveEffect, prepareActiveEffectCategories} from "../system/effects.mjs"; import { onManageActiveEffect, prepareActiveEffectCategories } from "../system/effects.mjs";
import { VermineActorSheet } from "./actor-sheet.mjs"; import { VermineActorSheet } from "./actor-sheet.mjs";
import { getRollBox } from "../system/dialogs.mjs"; import { getRollBox } from "../system/dialogs.mjs";
import { TotemPicker } from "../system/applications.mjs"; import { TotemPicker } from "../system/applications.mjs";
@@ -104,6 +104,7 @@ export class VermineCharacterSheet extends VermineActorSheet {
super.activateListeners(html); super.activateListeners(html);
// Choose Totem // Choose Totem
html.find('.chooseTotem').click(this._onTotemButton.bind(this)); html.find('.chooseTotem').click(this._onTotemButton.bind(this));
html.find('.ability .rollable').click(this._onRoll.bind(this));
} }
@@ -144,9 +145,9 @@ export class VermineCharacterSheet extends VermineActorSheet {
skillScore: 0, skillScore: 0,
label: game.i18n.localize(dataset.label) label: game.i18n.localize(dataset.label)
}; };
if (dataset.type == 'ability'){ if (dataset.type == 'ability') {
data.abilityScore = this.actor.system.abilities[dataset.label].value; data.abilityScore = this.actor.system.abilities[dataset.label].value;
} else if (dataset.type == 'skill'){ } else if (dataset.type == 'skill') {
data.skillScore = this.actor.system.skills[dataset.label].value; data.skillScore = this.actor.system.skills[dataset.label].value;
} }
getRollBox(data); getRollBox(data);
+20 -20
View File
@@ -1,5 +1,5 @@
export class CombatResultDialog extends Dialog { export class CombatResultDialog extends Dialog {
constructor(dialogData, options) { constructor(dialogData, options) {
/*let options = { classes: ["combat", "result"], ...options }; /*let options = { classes: ["combat", "result"], ...options };
@@ -33,11 +33,11 @@
} }
} }
export const getRollBox = async function(data) { export const getRollBox = async function (data) {
let html = await renderTemplate('systems/vermine2047/templates/roll.hbs', data); let html = await renderTemplate('systems/vermine2047/templates/roll.hbs', data);
let ui = new Dialog({ let dial = new Dialog({
title: game.i18n.localize("ROLLS.tool"), title: game.i18n.localize("ROLLS.tool"),
content: html, content: html,
buttons: { buttons: {
@@ -53,35 +53,35 @@
formData[item.name] = item.value; formData[item.name] = item.value;
}); });
// console.log("roll form data", formData); // console.log("roll form data", formData);
let NoD = parseInt(formData.abilityScore,10); let NoD = parseInt(formData.abilityScore, 10);
let Reroll = 0; let Reroll = 0;
// difficulty // difficulty
data.difficulty = (formData.difficulty != undefined) ? formData.difficulty : 7; data.difficulty = (formData.difficulty != undefined) ? formData.difficulty : 7;
// maîtrise bonus // maîtrise bonus
if (formData.rollType == 'skill'){ if (formData.rollType == 'skill') {
NoD += CONFIG.VERMINE.SkillLevels[formData.skillScore].dicePool || 0; NoD += CONFIG.VERMINE.SkillLevels[formData.skillScore].dicePool || 0;
Reroll += CONFIG.VERMINE.SkillLevels[formData.skillScore].reroll || 0; Reroll += CONFIG.VERMINE.SkillLevels[formData.skillScore].reroll || 0;
} }
console.log('reroll', Reroll); console.log('reroll', Reroll);
// réserves // réserves
if (formData.self_control > 0){ if (formData.self_control > 0) {
NoD += parseInt(formData.self_control,10); NoD += parseInt(formData.self_control, 10);
} }
if (formData.group > 0){ if (formData.group > 0) {
NoD += parseInt(formData.group,10); NoD += parseInt(formData.group, 10);
} }
// checks // checks
if (formData.usingSpecialization !== undefined && formData.usingSpecialization == 1){ if (formData.usingSpecialization !== undefined && formData.usingSpecialization == 1) {
NoD += 1; NoD += 1;
} }
if (formData.usingTools !== undefined && formData.usingTools == 1){ if (formData.usingTools !== undefined && formData.usingTools == 1) {
NoD += 1; NoD += 1;
} }
if (formData.helped !== undefined && formData.helped == 1){ if (formData.helped !== undefined && formData.helped == 1) {
NoD += 1; NoD += 1;
} }
if (formData.abilityScore == 0){ if (formData.abilityScore == 0 || !formData.abilityScore) {
ui.notifications.notify(`veuillez saisir une caractéristique`); ui.notifications.notify(`veuillez saisir une caractéristique`);
} else return game.vermine2047.VermineRoll.roll(data.actorId, data.label, NoD, Reroll, data); } else return game.vermine2047.VermineRoll.roll(data.actorId, data.label, NoD, Reroll, data);
} }
@@ -92,12 +92,12 @@
} }
}, },
render: function (h) { render: function (h) {
if( h.find('input[name="abilityScore"]').val()== 0 && data.rollType == 'ability'){ if (h.find('input[name="abilityScore"]').val() == 0 && data.rollType == 'ability') {
h.find('input[name="abilityScore"]').val(data.abilities[data.label].value); h.find('input[name="abilityScore"]').val(data.abilities[data.label].value);
} }
h.find('select[name="ability"]').change((event) => { h.find('select[name="ability"]').change((event) => {
if (event.target.value != undefined){ if (event.target.value != undefined) {
const abilityScore = data.abilities[event.target.value].value; const abilityScore = data.abilities[event.target.value].value;
console.log('ability', abilityScore); console.log('ability', abilityScore);
// on enregistre la valeur de la caractéristique // on enregistre la valeur de la caractéristique
@@ -106,13 +106,13 @@
}); });
h.find('select[name="skill"]').change((event) => { h.find('select[name="skill"]').change((event) => {
if (data.rollType == 'skill' && event.target.value != undefined){ if (data.rollType == 'skill' && event.target.value != undefined) {
const skillScore = data.skills[event.target.value].value; const skillScore = data.skills[event.target.value].value;
// on enregistre la valeur de la compétence // on enregistre la valeur de la compétence
h.find('input[name="skillScore"]').val(skillScore); h.find('input[name="skillScore"]').val(skillScore);
// on met à jour les infos de niveaux de compétence // on met à jour les infos de niveaux de compétence
const skillLevel = CONFIG.VERMINE.SkillLevels[skillScore]; const skillLevel = CONFIG.VERMINE.SkillLevels[skillScore];
if (skillLevel != undefined){ if (skillLevel != undefined) {
h.find('#skillLevel').text(game.i18n.localize(skillLevel.label)); h.find('#skillLevel').text(game.i18n.localize(skillLevel.label));
h.find('#skillDicePool').text(skillLevel.dicePool); h.find('#skillDicePool').text(skillLevel.dicePool);
h.find('#skillReroll').text(skillLevel.reroll); h.find('#skillReroll').text(skillLevel.reroll);
@@ -125,5 +125,5 @@
}); });
} }
}); });
ui.render(true); dial.render(true);
} }
+17 -6
View File
@@ -2,17 +2,28 @@
{{#each config.totems as | totem tk|}} {{#each config.totems as | totem tk|}}
{{#if (ne tk "human")}} {{#if (ne tk "human")}}
{{#if (ne tk "adapted")}} {{#if (ne tk "adapted")}}
<div class="flexrow row mdb flex-group-center"> <div class="flexrow row mdb flex-group-center">
<h4 style="flex:33%;"> <h4 style="flex:33%;">
<a class="totem" data-totem="{{ tk }}" title="{{ smarttlk "TOTEMS" tk "description"}}"> <a class="totem" data-totem="{{ tk }}"
<img src="/systems/vermine2047/assets/images/ui/totems/{{ tk }}.webp" alt="{{ localize totem }}" width="80" height="80" /> title="{{ smarttlk "TOTEMS"
tk "description"}}">
<img
src="/systems/vermine2047/assets/images/ui/totems/{{ tk }}.webp"
alt="{{ localize totem }}" width="80" height="80" />
<h2>{{ smarttlk "TOTEMS"
tk "name"}}</h2>
</a> </a>
</h4> </h4>
<p style="flex:66%;text-align:left;"> <p style="flex:66%;text-align:left;">
<strong>Instincts</strong> : {{ smarttlk "TOTEMS" tk "instincts"}}<br> <strong>Instincts</strong> : {{ smarttlk "TOTEMS" tk
<strong>Interdits</strong> : {{ smarttlk "TOTEMS" tk "bans"}}<br> "instincts"}}<br>
<strong>Comportements</strong> : {{ smarttlk "TOTEMS" tk "behaviour"}}<br> <strong>Interdits</strong> : {{ smarttlk "TOTEMS" tk
<strong>Totem opposé</strong> : {{ smartcfg "totem_opposites" tk }}<br> "bans"}}<br>
<strong>Comportements</strong> : {{ smarttlk "TOTEMS" tk
"behaviour"}}<br>
<strong>Totem opposé</strong> : {{ smartcfg "totem_opposites" tk
}}<br>
</p> </p>
</div> </div>
{{/if}} {{/if}}