forked from public/foundryvtt-reve-de-dragon
Cleanup - preparation Coeur
Simplification de code: - des Méthodes simples sur une ligne - utilisation de item.update au lieu de updateEmbeddedDocuments quand possibe - renommage des templates SubActeur - déplacement de logs quand compétence non trouvée
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { ENTITE_NONINCARNE } from "./constants.js";
|
||||
import { DialogSelectTarget } from "./dialog-select-target.js";
|
||||
import { DialogSelect } from "./dialog-select.js";
|
||||
|
||||
export class Targets {
|
||||
static listTargets() {
|
||||
@ -11,10 +11,7 @@ export class Targets {
|
||||
}
|
||||
|
||||
static extractTokenData(target) {
|
||||
if (!target) {
|
||||
return undefined
|
||||
}
|
||||
return { id: target.id, name: target.document.name, img: target.document.texture.src ?? target.actor.img ?? 'icons/svg/mystery-man.svg' };
|
||||
return { id: target?.id, name: target?.document.name, img: target?.document.texture.src ?? target?.actor.img ?? 'icons/svg/mystery-man.svg' };
|
||||
}
|
||||
|
||||
static isTargetEntite(target) {
|
||||
@ -30,11 +27,12 @@ export class Targets {
|
||||
return;
|
||||
default:
|
||||
{
|
||||
const tokens = targets.map(it => Targets.extractTokenData(it))
|
||||
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-select-target.html", {
|
||||
tokens: tokens
|
||||
});
|
||||
new DialogSelectTarget(html, onSelectTarget, targets).render(true);
|
||||
const selectData = {
|
||||
title: "Choisir une cible",
|
||||
label: "Choisir une seule des cibles",
|
||||
list: targets.map(it => Targets.extractTokenData(it))
|
||||
};
|
||||
DialogSelect.select(selectData, onSelectTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user