v10.7.14 - l'expérience de Sémolosse #646

Merged
uberwald merged 5 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2023-05-29 07:46:21 +02:00
6 changed files with 51 additions and 7 deletions
Showing only changes of commit 5fc455fbad - Show all commits

View File

@ -1,6 +1,9 @@
---
# v10.7 - L'os de Semolosse
## v10.7.14 - l'expérience de Semolosse
- Affichage des personnages accordés sur les fiches des entités
## v10.7.13 - l'armure de Semolosse
- Fix: en cas d'armure variable, la détérioration diminue le dé d'armure

View File

@ -1,4 +1,6 @@
import { RdDActorSheet } from "./actor-sheet.js";
import { RdDSheetUtility } from "./rdd-sheet-utility.js";
import { RdDUtility } from "./rdd-utility.js";
export class RdDActorEntiteSheet extends RdDActorSheet {
@ -13,6 +15,12 @@ export class RdDActorEntiteSheet extends RdDActorSheet {
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }]
});
}
async getData() {
let formData = await super.getData();
formData.resonances = this.actor.system.sante.resonnance.actors.map(actorId => game.actors.get(actorId))
.map(actor => { return { id: actor.id, name: actor.name, img: actor.img } })
return formData
}
/* -------------------------------------------- */
/** @override */
@ -35,6 +43,23 @@ export class RdDActorEntiteSheet extends RdDActorSheet {
let compName = event.currentTarget.attributes.compname.value;
this.actor.updateCreatureCompetence(compName, "dommages", parseInt(event.target.value));
});
this.html.find('.resonance-delete').click(async event => {
const li = RdDSheetUtility.getEventElement(event);
const actorId = li.data("actor-id");
if (actorId) {
const actorResonance = game.actors.get(actorId);
RdDUtility.confirmerSuppressionSubacteur(this, actorResonance, li, () => {
console.log('Delete : ', actorId);
this.removeSubacteur(actorId);
RdDUtility.slideOnDelete(this, li);
});
}
});
}
async removeSubacteur(actorId) {
let newResonances = this.actor.system.sante.resonnance.actors.filter(id => id != actorId);
await this.actor.update({ 'system.sante.resonnance.actors': newResonances }, { renderSheet: false });
}
}

View File

@ -129,7 +129,11 @@ export class RdDActorSheet extends RdDBaseActorSheet {
const actorId = li.data("actor-id");
if (actorId) {
const subActor = game.actors.get(actorId);
RdDUtility.confirmerSuppressionSubacteur(this, subActor, li);
RdDUtility.confirmerSuppressionSubacteur(this, subActor, li, () => {
console.log('Delete : ', subActor.id);
this.actor.removeSubacteur(subActor.id);
RdDUtility.slideOnDelete(this, li);
});
}
});
this.html.find('.experiencelog-delete').click(async event => {

View File

@ -136,6 +136,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/actor/blessure.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/maladies-poisons.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/possessions.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/resonances.hbs',
'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/taches.html',
'systems/foundryvtt-reve-de-dragon/templates/actor/oeuvres.html',
@ -859,17 +860,13 @@ export class RdDUtility {
}
/* -------------------------------------------- */
static confirmerSuppressionSubacteur(sheet, subActor, htmlToDelete) {
static confirmerSuppressionSubacteur(sheet, subActor, htmlToDelete, onSuppression = ()=>{}) {
RdDConfirm.confirmer({
settingConfirmer: "confirmation-supprimer-lien-acteur",
content: `<p>Etes vous certain de vouloir supprimer le lien vers ${subActor.name} ?</p>`,
title: 'Confirmer la suppression',
buttonLabel: 'Supprimer le lien',
onAction: () => {
console.log('Delete : ', subActor.id);
sheet.actor.removeSubacteur(subActor.id);
RdDUtility.slideOnDelete(sheet, htmlToDelete);
}
onAction: onSuppression
})
}

View File

@ -41,6 +41,9 @@
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-creature.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/comp-possession.html"}}
</div>
<div>
{{>"systems/foundryvtt-reve-de-dragon/templates/actor/resonances.hbs"}}
</div>
</div>
</div>
<div class="form-group large-editor">

View File

@ -0,0 +1,12 @@
<span class="item-name"><h4>Personnages accordés</h4></span>
<ul class="item-list alterne-list">
{{#each resonances as |actor|}}
<li class="item flexrow list-item" data-actor-id="{{actor.id}}">
<img class="sheet-competence-img" src="{{actor.img}}" title="{{actor.name}}"/>
<span class="subacteur-label"><a>{{actor.name}}</a></span>
<div class="flex-shrink">
<a class="resonance-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>