#125 : Gestion des equipements groupés
This commit is contained in:
parent
a432ed6d32
commit
4dbab303f3
@ -62,11 +62,6 @@ export class RdDActorCreatureSheet extends RdDActorSheet {
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
prepareCreatureData( ) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/** @override */
|
/** @override */
|
||||||
activateListeners(html) {
|
activateListeners(html) {
|
||||||
|
@ -148,13 +148,11 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async confirmerSuppression(li) {
|
async confirmerSuppression(li) {
|
||||||
let itemId = li.data("item-id");
|
let itemId = li.data("item-id");
|
||||||
let d = new Dialog({
|
let objet = this.actor.items.find( item => item._id == itemId );
|
||||||
title: "Confirmer la suppression",
|
let msgTxt = "<p>Etes vous certain de vouloir supprimer cet objet ?";
|
||||||
content: "<p>Etes vous certain de vouloir supprimer cet objet ?</p>",
|
let buttons = { delete: {
|
||||||
buttons: {
|
|
||||||
delete: {
|
|
||||||
icon: '<i class="fas fa-check"></i>',
|
icon: '<i class="fas fa-check"></i>',
|
||||||
label: "Supprimer",
|
label: "Supprimer l'objet",
|
||||||
callback: () => {
|
callback: () => {
|
||||||
console.log("Delete : ", itemId);
|
console.log("Delete : ", itemId);
|
||||||
this.actor.deleteOwnedItem( itemId );
|
this.actor.deleteOwnedItem( itemId );
|
||||||
@ -165,8 +163,25 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
icon: '<i class="fas fa-times"></i>',
|
icon: '<i class="fas fa-times"></i>',
|
||||||
label: "Annuler"
|
label: "Annuler"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
default: "cancel",
|
if ( objet.data.type == 'conteneur' && objet.data.data.contenu.length > 0) {
|
||||||
|
msgTxt += "<br>Cet objet est aussi un conteneur avec du contenu : choisissez l'option de suppression";
|
||||||
|
buttons['deleteall'] = {
|
||||||
|
icon: '<i class="fas fa-check"></i>',
|
||||||
|
label: "Supprimer le conteneur et tout son contenu",
|
||||||
|
callback: () => {
|
||||||
|
console.log("Delete : ", itemId);
|
||||||
|
this.actor.deleteAllConteneur( itemId );
|
||||||
|
li.slideUp(200, () => this.render(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
msgTxt += "</p>";
|
||||||
|
let d = new Dialog({
|
||||||
|
title: "Confirmer la suppression",
|
||||||
|
content: msgTxt,
|
||||||
|
buttons: buttons,
|
||||||
|
default: "cancel"
|
||||||
});
|
});
|
||||||
d.render(true);
|
d.render(true);
|
||||||
}
|
}
|
||||||
|
@ -706,6 +706,31 @@ export class RdDActor extends Actor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
buildSubConteneurObjetList( conteneurId, deleteList ) {
|
||||||
|
let conteneur = this.items.find( conteneur => conteneurId == conteneur._id); // recup conteneur
|
||||||
|
if ( conteneur ) { // Si présent
|
||||||
|
for ( let subId of conteneur.data.data.contenu ) {
|
||||||
|
let subObj = this.items.find( subobjet => subId == subobjet._id); // recup conteneur
|
||||||
|
if ( subObj.type == 'conteneur') {
|
||||||
|
this.buildSubConteneurObjetList( subId, deleteList );
|
||||||
|
}
|
||||||
|
deleteList.push( subId );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deleteList.push( conteneurId );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async deleteAllConteneur( itemId ) {
|
||||||
|
let list = [];
|
||||||
|
this.buildSubConteneurObjetList( itemId, list );
|
||||||
|
//console.log("List to delete", list);
|
||||||
|
for( let id of list) {
|
||||||
|
await this.deleteOwnedItem( id );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/** Supprime un item d'un conteneur, sur la base
|
/** Supprime un item d'un conteneur, sur la base
|
||||||
* de leurs ID */
|
* de leurs ID */
|
||||||
|
@ -200,3 +200,4 @@
|
|||||||
{"_id":"zQWlnUsd8bPySujd","name":"Aiguille à coudre","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.01,"equipe":false,"resistance":0,"qualite":0,"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/aiguille.webp","effects":[]}
|
{"_id":"zQWlnUsd8bPySujd","name":"Aiguille à coudre","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":1,"encombrement":0.01,"equipe":false,"resistance":0,"qualite":0,"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/aiguille.webp","effects":[]}
|
||||||
{"_id":"zYI8mDiysWtmsSyy","name":"Carquois","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"conteneur","data":{"description":"","capacite":2,"encombrement":0.1,"equipe":false,"qualite":0,"cout":0.5},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/carquois.webp","effects":[]}
|
{"_id":"zYI8mDiysWtmsSyy","name":"Carquois","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"conteneur","data":{"description":"","capacite":2,"encombrement":0.1,"equipe":false,"qualite":0,"cout":0.5},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/carquois.webp","effects":[]}
|
||||||
{"_id":"zlDa1vwmls6Uf4pt","name":"Bourse de cuir","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"conteneur","data":{"description":"","capacite":0.5,"encombrement":0.01,"equipe":false,"qualite":0,"contenu":[],"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bourse.webp","effects":[]}
|
{"_id":"zlDa1vwmls6Uf4pt","name":"Bourse de cuir","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"conteneur","data":{"description":"","capacite":0.5,"encombrement":0.01,"equipe":false,"qualite":0,"contenu":[],"cout":0.1},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/bourse.webp","effects":[]}
|
||||||
|
{"_id":"lOI2HVu3B6EDY4sE","name":"Arbalète","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"<p>Nie jusqu'à 2 points d'armure.</p>\n<p>Rechargement 1 round.</p>","quantite":1,"encombrement":3,"equipe":false,"dommages":"3","force":"0","resistance":0,"competence":"Arbalète","cout":30,"portee_courte":15,"portee_moyenne":30,"portee_extreme":70,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false,"categorie_parade":""},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arbalete.webp","effects":[]}
|
||||||
|
Loading…
Reference in New Issue
Block a user