Iss337 - Allow armor slots to be edited from the character sheet (#345)

* add armor slot input

* working progress bar

* fix label styling

* fix more styling

* fix styling issue on firefix

* Restored armorSlots when empty and added localization

---------

Co-authored-by: psitacus <walther.johnson@ucalgary.ca>
Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
Psitacus 2025-07-15 04:03:12 -06:00 committed by GitHub
parent 6b6f4e61d6
commit ef45cd71f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 172 additions and 13 deletions

View file

@ -103,6 +103,11 @@ export default class CharacterSheet extends DHBaseActorSheet {
htmlElement.querySelectorAll('.inventory-item-quantity').forEach(element => {
element.addEventListener('change', this.updateItemQuantity.bind(this));
});
// Add listener for armor marks input
htmlElement.querySelectorAll('.armor-marks-input').forEach(element => {
element.addEventListener('change', this.updateArmorMarks.bind(this));
});
}
/** @inheritDoc */
@ -515,6 +520,16 @@ export default class CharacterSheet extends DHBaseActorSheet {
this.render();
}
async updateArmorMarks(event) {
const armor = this.document.system.armor;
if (!armor) return;
const maxMarks = this.document.system.armorScore;
const value = Math.min(Math.max(Number(event.currentTarget.value), 0), maxMarks);
await armor.update({ 'system.marks.value': value });
this.render();
}
/* -------------------------------------------- */
/* Application Clicks Actions */
/* -------------------------------------------- */