forked from public/foundryvtt-reve-de-dragon
#122 Gestion d'acturs liés à une fiche de perso
This commit is contained in:
@ -269,20 +269,24 @@ export class RdDUtility {
|
||||
console.log(dragData, actorSheet.actor._id);
|
||||
let dropID = $(event.target).parents(".item").attr("data-item-id"); // Only relevant if container drop
|
||||
let objetId = dragData.id || dragData.data._id;
|
||||
if ( dropID ) { // Dropped over an item !!!
|
||||
if (actorSheet.objetVersConteneur[objetId] != dropID && objetId != dropID) {
|
||||
if (actorSheet.actor.validateConteneur(objetId, dropID) && actorSheet.actor.testConteneurCapacite(objetId, dropID)) {
|
||||
await actorSheet.actor.enleverDeConteneur(objetId, actorSheet.objetVersConteneur[objetId]);
|
||||
await actorSheet.actor.ajouterAConteneur(objetId, dropID);
|
||||
if ( dragData.type == 'Item') {
|
||||
if ( dropID ) { // Dropped over an item !!!
|
||||
if (actorSheet.objetVersConteneur[objetId] != dropID && objetId != dropID) {
|
||||
if (actorSheet.actor.validateConteneur(objetId, dropID) && actorSheet.actor.testConteneurCapacite(objetId, dropID)) {
|
||||
await actorSheet.actor.enleverDeConteneur(objetId, actorSheet.objetVersConteneur[objetId]);
|
||||
await actorSheet.actor.ajouterAConteneur(objetId, dropID);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dragData.actorId && dragData.actorId != actorSheet.actor._id ) { // Un acteur est à l'origine de l'item -> deplacement
|
||||
console.log("Moving objects");
|
||||
actorSheet.actor.moveItemsBetweenActors( objetId, dragData.actorId);
|
||||
return false;
|
||||
}
|
||||
actorSheet.actor.computeEncombrementTotalEtMalusArmure();
|
||||
} else if ( dragData.type == "Actor" ) {
|
||||
actorSheet.actor.addSubacteur( objetId );
|
||||
}
|
||||
if (dragData.actorId && dragData.actorId != actorSheet.actor._id ) { // Un acteur est à l'origine de l'item -> deplacement
|
||||
console.log("Moving objects");
|
||||
actorSheet.actor.moveItemsBetweenActors( objetId, dragData.actorId);
|
||||
return false;
|
||||
}
|
||||
actorSheet.actor.computeEncombrementTotalEtMalusArmure();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -836,6 +840,77 @@ export class RdDUtility {
|
||||
chatData["whisper"] = ChatMessage.getWhisperRecipients(forceWhisper);
|
||||
}
|
||||
|
||||
return chatData;
|
||||
return chatData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static confirmerSuppressionSubacteur(actorSheet, li ) {
|
||||
let actorId = li.data("actor-id");
|
||||
let actor = game.actors.get( actorId );
|
||||
let msgTxt = "<p>Etes vous certain de vouloir supprimer le lien vers ce véhicule/monture/suivant : " + actor.data.name +" ?</p>";
|
||||
let buttons = {
|
||||
delete: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Supprimer le lien",
|
||||
callback: () => {
|
||||
console.log("Delete : ", actorId);
|
||||
actorSheet.actor.removeSubacteur( actorId );
|
||||
li.slideUp(200, () => actorSheet.render(false));
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: "Annuler"
|
||||
}
|
||||
}
|
||||
let d = new Dialog({
|
||||
title: "Confirmer la suppression du lien",
|
||||
content: msgTxt,
|
||||
buttons: buttons,
|
||||
default: "cancel"
|
||||
});
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async confirmerSuppression(actorSheet, li) {
|
||||
let itemId = li.data("item-id");
|
||||
let objet = actorSheet.actor.items.find( item => item._id == itemId );
|
||||
let msgTxt = "<p>Etes vous certain de vouloir supprimer cet objet ?";
|
||||
let buttons = { delete: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Supprimer l'objet",
|
||||
callback: () => {
|
||||
console.log("Delete : ", itemId);
|
||||
actorSheet.actor.deleteOwnedItem( itemId );
|
||||
li.slideUp(200, () => actorSheet.render(false));
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: "Annuler"
|
||||
}
|
||||
}
|
||||
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);
|
||||
actorSheet.actor.deleteAllConteneur( itemId );
|
||||
li.slideUp(200, () => actorSheet.render(false));
|
||||
}
|
||||
}
|
||||
}
|
||||
msgTxt += "</p>";
|
||||
let d = new Dialog({
|
||||
title: "Confirmer la suppression",
|
||||
content: msgTxt,
|
||||
buttons: buttons,
|
||||
default: "cancel"
|
||||
});
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user