Issue 69: Adding incremental buttons to honor, glory and status. Renaming...

This commit is contained in:
Litasa
2026-02-25 21:39:21 +00:00
parent 494b027513
commit f267d06536
16 changed files with 157 additions and 42 deletions

View File

@@ -56,6 +56,9 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
// Split Others advancements, and calculate xp spent and add it to total
this._prepareOthersAdvancement(sheetData);
// Update spent_xp to actor
this.actor.system.xp_spent = sheetData.data.system.xp_spent;
// Total
sheetData.data.system.xp_saved = Math.floor(
parseInt(sheetData.data.system.xp_total) - parseInt(sheetData.data.system.xp_spent)
@@ -114,6 +117,9 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
// Money +/-
html.find(".money-control").on("click", this._modifyMoney.bind(this));
// XP +/-
html.find(".xp-control").on("click", this._modifyXP.bind(this));
// Advancements Tab to current rank onload
// TODO class "Active" Bug on load, dunno why :/
this._tabs
@@ -285,6 +291,35 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
this.render(false);
}
/**
* Add or Subtract XP (+/- buttons)
* @param {Event} event
* @private
*/
async _modifyXP(event) {
event.preventDefault();
event.stopPropagation();
const elmt = $(event.currentTarget);
let mod = elmt.data("value");
if (!mod) {
return;
}
const new_xp_total = Math.max(0, this.actor.system.xp_total + mod);
this.actor.update({
system: {
xp_total: new_xp_total,
},
});
if(this.actor.system.xp_spent > new_xp_total) {
ui.notifications.warn("l5r5e.advancements.warning.total_less_then_spent", { localize: true })
}
this.render(false);
}
/**
* Add +1 to actor school rank
* @param {Event} event