Nettoyage de journal d'expérience pour MJ
Permet au MJ de vider les anciennes entrées du journal d'expérience (jusqu'à une entrée, comprise) Permet de supprimer une entrée spécifique
This commit is contained in:
parent
322506250b
commit
b4ca941065
@ -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();
|
||||
})
|
||||
|
@ -1020,11 +1020,21 @@ 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') {
|
||||
await this.update({ [`system.compteurs.${fieldName}.value`]: fieldValue });
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user