This commit is contained in:
WBHarry 2025-07-05 22:29:59 +02:00
parent af24b5064e
commit baa7f6352e
10 changed files with 10 additions and 11 deletions

View file

@ -215,7 +215,6 @@
"Features": "Features", "Features": "Features",
"proficiency": "Proficiency", "proficiency": "Proficiency",
"unarmored": "Unarmored", "unarmored": "Unarmored",
"newFeature": "New Feature",
"Experience": { "Experience": {
"Single": "Experience", "Single": "Experience",
"plural": "Experiences" "plural": "Experiences"

View file

@ -151,7 +151,7 @@ export default class DHAdversarySettings extends HandlebarsApplicationMixin(Appl
await this.actor.createEmbeddedDocuments('Item', [ await this.actor.createEmbeddedDocuments('Item', [
{ {
type: 'feature', type: 'feature',
name: game.i18n.localize('DAGGERHEART.General.newFeature'), name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') }),
img: 'icons/skills/melee/weapons-crossed-swords-black.webp' img: 'icons/skills/melee/weapons-crossed-swords-black.webp'
} }
]); ]);

View file

@ -127,7 +127,7 @@ export default class DHEnvironmentSettings extends HandlebarsApplicationMixin(Ap
await this.actor.createEmbeddedDocuments('Item', [ await this.actor.createEmbeddedDocuments('Item', [
{ {
type: 'feature', type: 'feature',
name: game.i18n.localize('DAGGERHEART.General.newFeature'), name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') }),
img: 'icons/magic/perception/orb-crystal-ball-scrying-blue.webp' img: 'icons/magic/perception/orb-crystal-ball-scrying-blue.webp'
} }
]); ]);

View file

@ -153,7 +153,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
static async #addFeature(_event, _button) { static async #addFeature(_event, _button) {
const feature = await game.items.documentClass.create({ const feature = await game.items.documentClass.create({
type: 'feature', type: 'feature',
name: game.i18n.localize('DAGGERHEART.General.newFeature') name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') })
}); });
await this.document.update({ await this.document.update({
'system.features': [...this.document.system.features.filter(x => x).map(x => x.uuid), feature.uuid] 'system.features': [...this.document.system.features.filter(x => x).map(x => x.uuid), feature.uuid]

View file

@ -175,7 +175,7 @@ export default class ClassSheet extends DHBaseItemSheet {
const actionPath = this.getActionPath(target.dataset.type); const actionPath = this.getActionPath(target.dataset.type);
const feature = await game.items.documentClass.create({ const feature = await game.items.documentClass.create({
type: 'feature', type: 'feature',
name: game.i18n.localize('DAGGERHEART.General.newFeature') name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') })
}); });
await this.document.update({ await this.document.update({
[`system.${actionPath}`]: [ [`system.${actionPath}`]: [

View file

@ -40,7 +40,7 @@ export default class SubclassSheet extends DHBaseItemSheet {
static async addFeature(_, target) { static async addFeature(_, target) {
const feature = await game.items.documentClass.create({ const feature = await game.items.documentClass.create({
type: 'feature', type: 'feature',
name: game.i18n.localize('DAGGERHEART.General.newFeature') name: game.i18n.format('DOCUMENT.New', { type: game.i18n.localize('TYPES.Item.feature') })
}); });
await this.document.update({ await this.document.update({
[`system.${target.dataset.type}`]: feature.uuid [`system.${target.dataset.type}`]: feature.uuid

View file

@ -205,7 +205,7 @@ export default class DhCharacter extends BaseDataActor {
companionFeatures = [], companionFeatures = [],
features = []; features = [];
for (var item of this.parent.items) { for (let item of this.parent.items) {
if (item.system.type === CONFIG.DH.ITEM.featureTypes.ancestry.id) { if (item.system.type === CONFIG.DH.ITEM.featureTypes.ancestry.id) {
ancestryFeatures.push(item); ancestryFeatures.push(item);
} else if (item.system.type === CONFIG.DH.ITEM.featureTypes.community.id) { } else if (item.system.type === CONFIG.DH.ITEM.featureTypes.community.id) {

View file

@ -61,7 +61,7 @@ export default class DHWeapon extends BaseDataItem {
const removed = this.features.filter(x => !changes.system.features.includes(x)); const removed = this.features.filter(x => !changes.system.features.includes(x));
const added = changes.system.features.filter(x => !this.features.includes(x)); const added = changes.system.features.filter(x => !this.features.includes(x));
for (var weaponFeature of removed) { for (let weaponFeature of removed) {
for (var effectId of weaponFeature.effectIds) { for (var effectId of weaponFeature.effectIds) {
await this.parent.effects.get(effectId).delete(); await this.parent.effects.get(effectId).delete();
} }
@ -69,7 +69,7 @@ export default class DHWeapon extends BaseDataItem {
changes.system.actions = this.actions.filter(x => !weaponFeature.actionIds.includes(x._id)); changes.system.actions = this.actions.filter(x => !weaponFeature.actionIds.includes(x._id));
} }
for (var weaponFeature of added) { for (let weaponFeature of added) {
const featureData = CONFIG.DH.ITEM.weaponFeatures[weaponFeature.value]; const featureData = CONFIG.DH.ITEM.weaponFeatures[weaponFeature.value];
if (featureData.effects?.length > 0) { if (featureData.effects?.length > 0) {
const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [ const embeddedItems = await this.parent.createEmbeddedDocuments('ActiveEffect', [

View file

@ -4,7 +4,7 @@
data-group='{{tabs.features.group}}' data-group='{{tabs.features.group}}'
> >
<button class="add-feature-btn" data-action="addFeature"> <button class="add-feature-btn" data-action="addFeature">
{{localize "DAGGERHEART.General.newFeature"}} {{localize "DOCUMENT.New" type=(localize "TYPES.Item.feature")}}
</button> </button>
<fieldset> <fieldset>
<legend>{{localize tabs.features.label}}</legend> <legend>{{localize tabs.features.label}}</legend>

View file

@ -4,7 +4,7 @@
data-group='{{tabs.features.group}}' data-group='{{tabs.features.group}}'
> >
<button class="add-feature-btn" data-action="addFeature"> <button class="add-feature-btn" data-action="addFeature">
{{localize "DAGGERHEART.General.newFeature"}} {{localize "DOCUMENT.New" type=(localize "TYPES.Item.feature")}}
</button> </button>
<fieldset> <fieldset>
<legend>{{localize tabs.features.label}}</legend> <legend>{{localize tabs.features.label}}</legend>