[Fix] Levelup New Experience Increase (#1461)

* Fixed so you can select a newly gained experience to increase

* .

* Exchanged forEach with for..of. The future is now
This commit is contained in:
WBHarry 2025-12-24 01:00:24 +01:00 committed by GitHub
parent f184db1f93
commit 0806c2d1ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 12 deletions

View file

@ -357,11 +357,23 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
const experienceIncreaseTagify = htmlElement.querySelector('.levelup-experience-increases');
if (experienceIncreaseTagify) {
const allExperiences = {
...this.actor.system.experiences,
...Object.values(this.levelup.levels).reduce((acc, level) => {
for (const key of Object.keys(level.achievements.experiences)) {
acc[key] = level.achievements.experiences[key];
}
return acc;
}, {})
};
tagifyElement(
experienceIncreaseTagify,
Object.keys(this.actor.system.experiences).reduce((acc, id) => {
const experience = this.actor.system.experiences[id];
acc.push({ id: id, label: experience.name });
Object.keys(allExperiences).reduce((acc, id) => {
const experience = allExperiences[id];
if (experience.name) {
acc.push({ id: id, label: experience.name });
}
return acc;
}, []),