v10.0.22 #560

Merged
uberwald merged 7 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2022-09-28 08:25:29 +02:00
3 changed files with 36 additions and 8 deletions
Showing only changes of commit b4ca941065 - Show all commits

View File

@ -191,7 +191,6 @@ export class RdDActorSheet extends ActorSheet {
const item = RdDSheetUtility.getItem(event, this.actor);
item?.postItem();
});
html.find('.item-action').click(async event => {
const item = RdDSheetUtility.getItem(event, this.actor)
this.actor.actionItem(item);
@ -204,7 +203,16 @@ export class RdDActorSheet extends ActorSheet {
RdDUtility.confirmerSuppressionSubacteur(this, subActor, li);
}
});
html.find('.experiencelog-delete').click(async event => {
const li = $(event.currentTarget)?.parents(".experiencelog");
const key = Number(li.data("key") ?? -1);
await this.actor.deleteExperienceLog(key, 1);
});
html.find('.experiencelog-delete-previous').click(async event => {
const li = $(event.currentTarget)?.parents(".experiencelog");
const key = Number(li.data("key") ?? -1);
await this.actor.deleteExperienceLog(0, key + 1);
});
html.find('.encaisser-direct').click(async event => {
this.actor.encaisser();
})

View File

@ -1020,10 +1020,20 @@ export class RdDActor extends Actor {
let expLog = duplicate(this.system.experiencelog);
expLog.push({
mode: Misc.upperFirst(modeXP), valeur: valeurXP, raison: Misc.upperFirst(raisonXP),
daterdd: game.system.rdd.calendrier.getDateFromIndex(), datereel: `${d.getDate()}/${d.getMonth() + 1}/${d.getFullYear()}`
daterdd: game.system.rdd.calendrier.getDateFromIndex(),
datereel: `${d.getDate()}/${d.getMonth() + 1}/${d.getFullYear()}`
});
await this.update({ [`system.experiencelog`]: expLog });
}
async deleteExperienceLog(from, count) {
if (from >= 0 && count > 0) {
let expLog = duplicate(this.system.experiencelog);
expLog.splice(from, count);
await this.update({ [`system.experiencelog`]: expLog });
}
}
/* -------------------------------------------- */
async updateCompteurValue(fieldName, fieldValue, raison = 'Inconnue') {

View File

@ -2,11 +2,21 @@
<div class="form-group editor">
<ul class="item-list alterne-list">
{{#each system.experiencelog as |xp key|}}
<li class="item flexrow list-item">
<label class="flex-shrink">{{xp.mode}} </label>
<label class="flex-grow">{{xp.valeur}} {{xp.raison}} </label>
<label class="flex-shrink">{{xp.daterdd}} </label>
<label class="flex-shrink">{{xp.datereel}} </label>
<li class="experiencelog flexrow list-item" data-key="{{key}}">
<label class="flex-grow">{{xp.valeur}} {{xp.raison}}</label>
<label class="flex-shrink">{{xp.mode}}</label>
<label class="flex-shrink">{{xp.daterdd}}</label>
<label class="flex-shrink">{{xp.datereel}}</label>
{{#if @root.options.isGM}}
<span>
<a class="experiencelog-delete" title="Supprimer">
<i class="fas fa-trash"></i>
</a>
<a class="experiencelog-delete-previous" title="Supprimer jusqu'ici">
<i class="fas fa-eraser"></i>
</a>
</span>
{{/if}}
</li>
{{/each}}
</ul>