#151 : permission de supprimer une rencontre depuis la fiche de PJ
This commit is contained in:
parent
43218dd282
commit
54a937c620
@ -124,6 +124,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
|
||||
RdDUtility.filterItemsPerTypeForSheet(data);
|
||||
data.data.sortReserve = data.data.reve.reserve.list;
|
||||
data.data.rencontres = duplicate(data.data.reve.rencontre.list);
|
||||
data.data.caseSpeciales = data.itemsByType['casetmr'];
|
||||
RdDUtility.buildArbreDeConteneur(this, data);
|
||||
data.data.surEncombrementMessage = (data.data.compteurs.surenc.value < 0) ? "Sur-Encombrement!" : "";
|
||||
@ -189,12 +190,17 @@ export class RdDActorSheet extends ActorSheet {
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
// Update Inventory Item
|
||||
html.find('.item-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
const item = this.actor.getOwnedItem(li.data("item-id"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
// Update Inventory Item
|
||||
html.find('.rencontre-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
const rencontreKey = li.data("item-id");
|
||||
this.actor.deleteTMRRencontre(rencontreKey);
|
||||
});
|
||||
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
|
@ -1189,6 +1189,17 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async deleteTMRRencontre(rencontreKey) {
|
||||
let list = duplicate(this.data.data.reve.rencontre.list);
|
||||
let newList = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if ( i != rencontreKey)
|
||||
newList.push( list[i]);
|
||||
}
|
||||
await this.update({ "data.reve.rencontre.list": newList });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async updateCoordTMR(coord) {
|
||||
let tmrPos = duplicate(this.data.data.reve.tmrpos);
|
||||
|
@ -79,7 +79,8 @@ export class RdDCalendrier extends Application {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDateFromIndex( index ) {
|
||||
getDateFromIndex( index = undefined ) {
|
||||
if ( !index) index = this.getCurrentDayIndex();
|
||||
let month = Math.floor(index / 28);
|
||||
let day = (index - (month*28)) + 1;
|
||||
return day+" "+heuresList[month];
|
||||
|
@ -321,6 +321,8 @@ export class RdDTMRDialog extends Dialog {
|
||||
isMauvaise ? await TMRRencontres.getMauvaiseRencontre()
|
||||
: await TMRRencontres.getRencontreAleatoire(tmr.type);
|
||||
rencontre.coord = tmr.coord;
|
||||
rencontre.date = game.system.rdd.calendrier.getDateFromIndex();
|
||||
rencontre.heure = game.system.rdd.calendrier.getCurrentHeure();
|
||||
return rencontre;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"description": "Rêve de Dragon RPG for FoundryVTT",
|
||||
"version": "1.3.17",
|
||||
"version": "1.3.18",
|
||||
"manifestPlusVersion": "1.0.0",
|
||||
"minimumCoreVersion": "0.7.5",
|
||||
"compatibleCoreVersion": "0.7.9",
|
||||
|
@ -546,6 +546,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
<hr>
|
||||
|
||||
{{!-- Liste de blessures --}}
|
||||
<h3 class="blessures-title">Blessures:</h3>
|
||||
<div class="flex-group-left flexcol competence-column">
|
||||
@ -824,6 +825,20 @@
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
<hr>
|
||||
<div>
|
||||
<h3>Rencontres présentes:</h3>
|
||||
<ul class="item-list">
|
||||
{{#each data.rencontres as |rencontre key|}}
|
||||
<li class="item flexrow" data-item-id="{{key}}" data-attribute="{{key}}">
|
||||
<span class="case-label"><a data-id="{{key}}">{{rencontre.rencontre.name}} - {{rencontre.coord}} ({{rencontre.rencontre.date}} - {{rencontre.rencontre.heure}})</a></span>
|
||||
<div class="item-controls">
|
||||
<a class="item-control rencontre-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
{{!-- Queues, Souffles, Tetes, Ombre --}}
|
||||
<hr>
|
||||
|
Loading…
Reference in New Issue
Block a user