forked from public/foundryvtt-reve-de-dragon
#36 Gestion des taches et création à partir d'un livre
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import { RdDItemSort } from "./item-sort.js";
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet with some very simple modifications
|
||||
@ -29,22 +30,24 @@ export class RdDItemSheet extends ItemSheet {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getData() {
|
||||
async getData() {
|
||||
let data = super.getData();
|
||||
|
||||
if ( data.item.type == 'tache') {
|
||||
//console.log("****", data, this);
|
||||
data.caracList = duplicate(this.actor.data.data.carac),
|
||||
data.competenceList = this.actor.getCompetenceList()
|
||||
if ( data.item.type == 'tache' || data.item.type == 'livre') {
|
||||
data.caracList = duplicate(game.system.model.Actor.personnage.carac);
|
||||
data.competenceList = await RdDUtility.getCompetenceList( 'foundryvtt-reve-de-dragon.competences' );
|
||||
}
|
||||
if ( this.actor ) {
|
||||
data.isOwned = true;
|
||||
data.actorId = this.actor._id;
|
||||
}
|
||||
data.bonusCaseList = RdDItemSort.getBonusCaseList(data, true);
|
||||
data.isGM = game.user.isGM; // Pour vérouiller certaines éditions
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
@ -54,10 +57,15 @@ export class RdDItemSheet extends ItemSheet {
|
||||
|
||||
// Select competence categorie
|
||||
html.find("#categorie").on("click", this._onClickSelectCategorie.bind(this) );
|
||||
|
||||
html.find('#creer-tache-livre').click((event) => {
|
||||
let actorId = event.currentTarget.attributes['data-actor-id'].value;
|
||||
let actor = game.actors.get( actorId );
|
||||
actor.creerTacheDepuisLivre( this.item );
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
async _onClickSelectCategorie(event) {
|
||||
event.preventDefault();
|
||||
|
||||
|
Reference in New Issue
Block a user