creation des spec depuis skill

This commit is contained in:
rwanoux
2024-05-14 09:58:08 +02:00
parent ff03badcdd
commit a62b067f3d
3 changed files with 39 additions and 9 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
### fiche de perso
-[ ] création de spécialitées depuis le (+) des compétences
-[X] création de spécialitées depuis le (+) des compétences
-[ ] fixer les cases hexas , comprtement chelou , piste = un click à l'air d'envoyer 2 update, verifier le onChange
-[ ] dialog d'edition des min-max
+25 -4
View File
@@ -109,17 +109,26 @@ export class VermineCharacterSheet extends VermineActorSheet {
/** @override */
activateListeners(html) {
super.activateListeners(html);
// Choose Totem
html.find('.chooseTotem').click(this._onTotemButton.bind(this));
html.find('.ability .rollable').click(this._onRoll.bind(this));
html.find('[data-totem-name]').click(this._onClickTotemDice.bind(this));
//desactiver les inputs si mode jeu
if (!this.actor.flags.world?.editMode) {
this.disableInputs(html)
}
// Choose Totem
html.find('.chooseTotem').click(this._onTotemButton.bind(this));
//activer lest jets
html.find('.ability .rollable').click(this._onRoll.bind(this));
//gérer les dés totems
html.find('[data-totem-name]').click(this._onClickTotemDice.bind(this));
//creation de specialités
html.find('i.add-specialty').click(this.addSpecialty.bind(this))
}
//mode jeu/edit en mode jeu on bloque les selects et input
disableInputs(html) {
for (let input of html.find('input')) {
//préserver le toggle mode jeu/ mode edit
if (input.name != "flags.world.editMode") {
input.setAttribute('disabled', true)
}
@@ -129,6 +138,18 @@ export class VermineCharacterSheet extends VermineActorSheet {
select.setAttribute('disabled', true)
}
}
async addSpecialty(ev) {
let skillName = ev.target.closest('.ability').querySelector('label').dataset.label;
let itemData = {
name: `spécialité, ${skillName}`,
type: 'specialty',
system: {
skill: skillName
}
}
let spec = await this.actor.createEmbeddedDocuments("Item", [itemData]);
spec[0].sheet.render(true)
}
async _onClickTotemDice(ev) {
let el = ev.currentTarget;
let totem = el.dataset.totemName;
+13 -4
View File
@@ -102,8 +102,10 @@
{{#iflteq @minorwoundmax @root.system.minorWound.value }}
checked
{{/iflteq}}
" />
"
{{#iflteq @minorwoundmax @root.system.minorWound.value }}
checked="true"
{{/iflteq}} />
</div>
{{/repeat}}
</div>
@@ -124,7 +126,11 @@
checked
{{/iflteq}}
" />
"
{{#iflteq @minorwoundmax @root.system.majorWound.value }}
checked="true"
{{/iflteq}} />
</div>
{{/repeat}}
@@ -146,7 +152,10 @@
checked
{{/iflteq}}
" />
"
{{#iflteq @minorwoundmax @root.system.deadlyWound.value }}
checked="true"
{{/iflteq}} />
</div>
{{/repeat}}