Fixed so genericStatuses aren't shown in activeEffectConfig if turned off. Fixed localization of genericStatuses in Inventory-ItemV2.

This commit is contained in:
WBHarry 2025-07-28 01:49:09 +02:00
parent 6d7401c874
commit 80f5198d77
3 changed files with 21 additions and 3 deletions

View file

@ -99,7 +99,17 @@ export default class DhActiveEffectConfig extends foundry.applications.sheets.Ac
async _preparePartContext(partId, context) { async _preparePartContext(partId, context) {
const partContext = await super._preparePartContext(partId, context); const partContext = await super._preparePartContext(partId, context);
switch (partId) { switch (partId) {
case 'changes': case 'details':
const useGeneric = game.settings.get(
CONFIG.DH.id,
CONFIG.DH.SETTINGS.gameSettings.appearance
).showGenericStatusEffects;
if (!useGeneric) {
partContext.statuses = Object.values(CONFIG.DH.GENERAL.conditions).map(status => ({
value: status.id,
label: game.i18n.localize(status.name)
}));
}
break; break;
} }

View file

@ -41,6 +41,14 @@ export default class DhActiveEffect extends ActiveEffect {
}); });
} }
get localizedStatuses() {
const statusMap = new Map(foundry.CONFIG.statusEffects.map(status => [status.id, status.name]));
return this.statuses.map(x => ({
key: x,
name: game.i18n.localize(statusMap.get(x))
}));
}
async _preCreate(data, options, user) { async _preCreate(data, options, user) {
const update = {}; const update = {};
if (!data.img) { if (!data.img) {

View file

@ -156,8 +156,8 @@ Parameters:
{{localize 'DAGGERHEART.EFFECTS.Duration.passive'}} {{localize 'DAGGERHEART.EFFECTS.Duration.passive'}}
{{/if}} {{/if}}
</div> </div>
{{#each item.statuses as |status|}} {{#each item.localizedStatuses as |status|}}
<div class="tag">{{localize (concat 'DAGGERHEART.CONFIG.Condition.' status '.name')}}</div> <div class="tag">{{status.name}}</div>
{{/each}} {{/each}}
</div> </div>
{{else if (not hideLabels)}} {{else if (not hideLabels)}}