TMR et acteurs à cocher pour les signe draconiques
Au lieu d'une liste à sélection multiple, choisir les types de TMR avec des cases à cocher. Lors de l'ajout de signes éphémères, sélectionner les personnages avec des cases à cocher.
This commit is contained in:
@ -32,8 +32,7 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
|
||||
const position = super.setPosition(options);
|
||||
const sheetHeader = this.element.find(".sheet-header");
|
||||
const sheetBody = this.element.find(".sheet-body");
|
||||
const bodyHeight = position.height - sheetHeader[0].clientHeight;
|
||||
sheetBody.css("height", bodyHeight);
|
||||
sheetBody.css("height", position.height - sheetHeader[0].clientHeight)
|
||||
return position;
|
||||
}
|
||||
|
||||
@ -41,16 +40,17 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const formData = duplicate(this.item);
|
||||
this.tmrs = TMRUtility.buildSelectionTypesTMR(this.item.system.typesTMR);
|
||||
mergeObject(formData, {
|
||||
tmrs: this.tmrs,
|
||||
title: formData.name,
|
||||
isGM: game.user.isGM,
|
||||
owner: this.actor.isOwner,
|
||||
owner: this.actor?.isOwner,
|
||||
isOwned: this.actor ? true : false,
|
||||
actorId: this.actor?.id,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
});
|
||||
formData.tmrs = TMRUtility.listSelectedTMR(formData.system.typesTMR ?? []);
|
||||
return formData;
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
|
||||
if (!this.options.editable) return;
|
||||
|
||||
html.find(".signe-aleatoire").click(event => this.setSigneAleatoire());
|
||||
html.find(".select-tmr").change((event) => this.onSelectTmr(event));
|
||||
html.find("input.select-tmr").change((event) => this.onSelectTmr(event));
|
||||
html.find(".signe-xp-sort").change((event) => this.onValeurXpSort(event.currentTarget.attributes['data-typereussite']?.value, Number(event.currentTarget.value)));
|
||||
}
|
||||
|
||||
@ -72,9 +72,13 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
|
||||
}
|
||||
|
||||
async onSelectTmr(event) {
|
||||
event.preventDefault();
|
||||
const selectedTMR = $(".select-tmr").val();
|
||||
this.item.update({ 'system.typesTMR': selectedTMR });
|
||||
const tmrName = $(event.currentTarget)?.data("tmr-name");
|
||||
const onTmr = this.tmrs.find(it => it.name == tmrName);
|
||||
if (onTmr){
|
||||
onTmr.selected = event.currentTarget.checked;
|
||||
}
|
||||
|
||||
this.item.update({ 'system.typesTMR': TMRUtility.buildListTypesTMRSelection(this.tmrs) });
|
||||
}
|
||||
|
||||
async onValeurXpSort(event) {
|
||||
|
Reference in New Issue
Block a user