Added LinkedItems for class. Added autoremoval of features and linkeditems when the related item is removed.

This commit is contained in:
WBHarry 2025-07-22 04:48:21 +02:00
parent 6336f2a60f
commit df8b96e9bc
16 changed files with 202 additions and 118 deletions

View file

@ -181,7 +181,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
const feature = await cls.create({ const feature = await cls.create({
type: 'feature', type: 'feature',
name: cls.defaultName({ type: 'feature' }), name: cls.defaultName({ type: 'feature' }),
[`system.itemLinks.${this.document.uuid}`]: CONFIG.DH.ITEM.featureSubTypes[type] [`system.itemLinks.${this.document.uuid}`]: CONFIG.DH.ITEM.itemLinkFeatureTypes[type]
}); });
await this.document.update({ await this.document.update({
'system.features': [...this.document.system.features, feature].map(f => f.uuid) 'system.features': [...this.document.system.features, feature].map(f => f.uuid)
@ -275,7 +275,9 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) {
if (item?.type === 'feature') { if (item?.type === 'feature') {
const { type } = target.dataset; const { type } = target.dataset;
const previouslyLinked = item.system.itemLinks[this.document.uuid] !== undefined; const previouslyLinked = item.system.itemLinks[this.document.uuid] !== undefined;
await item.update({ [`system.itemLinks.${this.document.uuid}`]: CONFIG.DH.ITEM.featureSubTypes[type] }); await item.update({
[`system.itemLinks.${this.document.uuid}`]: CONFIG.DH.ITEM.itemLinkFeatureTypes[type]
});
if (!previouslyLinked) { if (!previouslyLinked) {
const current = this.document.system.features.map(x => x.uuid); const current = this.document.system.features.map(x => x.uuid);

View file

@ -8,8 +8,7 @@ export default class ClassSheet extends DHBaseItemSheet {
classes: ['class'], classes: ['class'],
position: { width: 700 }, position: { width: 700 },
actions: { actions: {
removeItemFromCollection: ClassSheet.#removeItemFromCollection, removeLinkedItem: ClassSheet.#removeLinkedItem
removeSuggestedItem: ClassSheet.#removeSuggestedItem
}, },
tagifyConfigs: [ tagifyConfigs: [
{ {
@ -76,6 +75,34 @@ export default class ClassSheet extends DHBaseItemSheet {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
/* Application Drag/Drop */
/* -------------------------------------------- */
async linkedItemUpdate(item, property, replace) {
const removedLinkedItems = [];
const existingLink = item.system.itemLinks[this.document.uuid];
if (replace) {
const toRemove = this.document.system.linkedItems.find(
x => x.uuid !== item.uuid && x.system.itemLinks[this.document.uuid] === property
);
if (toRemove) {
removedLinkedItems.push(toRemove.uuid);
await toRemove.update({ [`system.itemLinks.-=${this.document.uuid}`]: null });
}
}
await item.update({ [`system.itemLinks.${this.document.uuid}`]: CONFIG.DH.ITEM.itemLinkTypes[property] });
if (!existingLink) {
await this.document.update({
'system.linkedItems': [
...this.document.system.linkedItems.map(x => x.uuid).filter(x => !removedLinkedItems.includes(x)),
item.uuid
]
});
} else {
this.render();
}
}
async _onDrop(event) { async _onDrop(event) {
event.stopPropagation(); event.stopPropagation();
@ -83,6 +110,10 @@ export default class ClassSheet extends DHBaseItemSheet {
const item = await fromUuid(data.uuid); const item = await fromUuid(data.uuid);
const target = event.target.closest('fieldset.drop-section'); const target = event.target.closest('fieldset.drop-section');
if (item.type === 'subclass') { if (item.type === 'subclass') {
const previouslyLinked = item.system.itemLinks[this.document.uuid] !== undefined;
if (previouslyLinked) return;
await item.update({ [`system.itemLinks.${this.document.uuid}`]: null });
await this.document.update({ await this.document.update({
'system.subclasses': [...this.document.system.subclasses.map(x => x.uuid), item.uuid] 'system.subclasses': [...this.document.system.subclasses.map(x => x.uuid), item.uuid]
}); });
@ -90,47 +121,30 @@ export default class ClassSheet extends DHBaseItemSheet {
super._onDrop(event); super._onDrop(event);
} else if (item.type === 'weapon') { } else if (item.type === 'weapon') {
if (target.classList.contains('primary-weapon-section')) { if (target.classList.contains('primary-weapon-section')) {
if (!this.document.system.characterGuide.suggestedPrimaryWeapon && !item.system.secondary) if (!item.system.secondary) {
await this.document.update({ await this.linkedItemUpdate(item, CONFIG.DH.ITEM.itemLinkTypes.primaryWeapon, true);
'system.characterGuide.suggestedPrimaryWeapon': item.uuid }
});
} else if (target.classList.contains('secondary-weapon-section')) { } else if (target.classList.contains('secondary-weapon-section')) {
if (!this.document.system.characterGuide.suggestedSecondaryWeapon && item.system.secondary) if (item.system.secondary) {
await this.document.update({ await this.linkedItemUpdate(item, CONFIG.DH.ITEM.itemLinkTypes.secondaryWeapon, true);
'system.characterGuide.suggestedSecondaryWeapon': item.uuid }
});
} }
} else if (item.type === 'armor') { } else if (item.type === 'armor') {
if (target.classList.contains('armor-section')) { if (target.classList.contains('armor-section')) {
if (!this.document.system.characterGuide.suggestedArmor) await this.linkedItemUpdate(item, CONFIG.DH.ITEM.itemLinkTypes.armor, true);
await this.document.update({
'system.characterGuide.suggestedArmor': item.uuid
});
} }
} else if (target.classList.contains('choice-a-section')) { } else if (target.classList.contains('choice-a-section')) {
if (item.type === 'miscellaneous' || item.type === 'consumable') { if (item.type === 'miscellaneous' || item.type === 'consumable') {
if (this.document.system.inventory.choiceA.length < 2) if (this.document.system.choiceA.length < 2)
await this.document.update({ await this.linkedItemUpdate(item, CONFIG.DH.ITEM.itemLinkTypes.choiceA);
'system.inventory.choiceA': [
...this.document.system.inventory.choiceA.map(x => x.uuid),
item.uuid
]
});
} }
} else if (item.type === 'miscellaneous') { } else if (item.type === 'miscellaneous') {
if (target.classList.contains('take-section')) { if (target.classList.contains('take-section')) {
if (this.document.system.inventory.take.length < 3) if (this.document.system.take.length < 3)
await this.document.update({ await this.linkedItemUpdate(item, CONFIG.DH.ITEM.itemLinkTypes.take);
'system.inventory.take': [...this.document.system.inventory.take.map(x => x.uuid), item.uuid]
});
} else if (target.classList.contains('choice-b-section')) { } else if (target.classList.contains('choice-b-section')) {
if (this.document.system.inventory.choiceB.length < 2) if (this.document.system.choiceB.length < 2)
await this.document.update({ await this.linkedItemUpdate(item, CONFIG.DH.ITEM.itemLinkTypes.choiceB);
'system.inventory.choiceB': [
...this.document.system.inventory.choiceB.map(x => x.uuid),
item.uuid
]
});
} }
} }
} }
@ -140,23 +154,18 @@ export default class ClassSheet extends DHBaseItemSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
/** /**
* Removes an item from an class collection by UUID. * Removes an item from class LinkedItems by uuid.
* @param {PointerEvent} event - The originating click event * @param {PointerEvent} event - The originating click event
* @param {HTMLElement} element - The capturing HTML element which defines the [data-action="removeItemFromCollection"] * @param {HTMLElement} element - The capturing HTML element which defines the [data-action="removeLinkedItem"]
*/ */
static async #removeItemFromCollection(_event, element) { static async #removeLinkedItem(_event, element) {
const { uuid, target } = element.dataset; const { uuid } = element.dataset;
const prop = foundry.utils.getProperty(this.document.system, target); const item = this.document.system.linkedItems.find(x => x.uuid === uuid);
await this.document.update({ [`system.${target}`]: prop.filter(i => i.uuid !== uuid) }); if (!item) return;
}
/** await item.update({ [`system.itemLinks-=${uuid}`]: null });
* Removes an suggested item from the class. await this.document.update({
* @param {PointerEvent} _event - The originating click event 'system.linkedItems': this.document.system.linkedItems.filter(x => x.uuid !== uuid).map(x => x.uuid)
* @param {HTMLElement} element - The capturing HTML element which defines the [data-action="removeSuggestedItem"] });
*/
static async #removeSuggestedItem(_event, element) {
const { target } = element.dataset;
await this.document.update({ [`system.characterGuide.${target}`]: null });
} }
} }

View file

@ -1311,7 +1311,7 @@ export const featureTypes = {
} }
}; };
export const featureSubTypes = { export const itemLinkFeatureTypes = {
primary: 'primary', primary: 'primary',
secondary: 'secondary', secondary: 'secondary',
hope: 'hope', hope: 'hope',
@ -1321,6 +1321,20 @@ export const featureSubTypes = {
mastery: 'mastery' mastery: 'mastery'
}; };
export const itemLinkItemTypes = {
primaryWeapon: 'primaryWeapon',
secondaryWeapon: 'secondaryWeapon',
armor: 'armor',
choiceA: 'choiceA',
choiceB: 'choiceB',
take: 'take'
};
export const itemLinkTypes = {
...itemLinkFeatureTypes,
...itemLinkItemTypes
};
export const actionTypes = { export const actionTypes = {
passive: { passive: {
id: 'passive', id: 'passive',

View file

@ -361,9 +361,9 @@ export default class DhCharacter extends BaseDataActor {
const subclassState = this.class.subclass.system.featureState; const subclassState = this.class.subclass.system.featureState;
const subType = item.system.subType; const subType = item.system.subType;
if ( if (
subType === CONFIG.DH.ITEM.featureSubTypes.foundation || subType === CONFIG.DH.ITEM.itemLinkFeatureTypes.foundation ||
(subType === CONFIG.DH.ITEM.featureSubTypes.specialization && subclassState >= 2) || (subType === CONFIG.DH.ITEM.itemLinkFeatureTypes.specialization && subclassState >= 2) ||
(subType === CONFIG.DH.ITEM.featureSubTypes.mastery && subclassState >= 3) (subType === CONFIG.DH.ITEM.itemLinkFeatureTypes.mastery && subclassState >= 3)
) { ) {
subclassFeatures.push(item); subclassFeatures.push(item);
} }

View file

@ -6,7 +6,7 @@ export default class ItemLinksField extends foundry.data.fields.TypedObjectField
constructor(options, context) { constructor(options, context) {
super( super(
new foundry.data.fields.StringField({ new foundry.data.fields.StringField({
choices: CONFIG.DH.ITEM.featureSubTypes, choices: CONFIG.DH.ITEM.itemLinkTypes,
nullable: true, nullable: true,
initial: null initial: null
}), }),

View file

@ -20,12 +20,14 @@ export default class DHAncestry extends BaseDataItem {
} }
get primaryFeature() { get primaryFeature() {
return this.features.find(x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.featureSubTypes.primary); return this.features.find(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkFeatureTypes.primary
);
} }
get secondaryFeature() { get secondaryFeature() {
return this.features.find( return this.features.find(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.featureSubTypes.secondary x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkFeatureTypes.secondary
); );
} }
} }

View file

@ -10,7 +10,8 @@ export default class DHArmor extends AttachableItem {
label: 'TYPES.Item.armor', label: 'TYPES.Item.armor',
type: 'armor', type: 'armor',
hasDescription: true, hasDescription: true,
isInventoryItem: true isInventoryItem: true,
isItemLinkable: true
}); });
} }

View file

@ -24,7 +24,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
hasResource: false, hasResource: false,
isQuantifiable: false, isQuantifiable: false,
isInventoryItem: false, isInventoryItem: false,
isItemLinkable: true isItemLinkable: false
}; };
} }
@ -143,8 +143,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
} }
async _preDelete() { async _preDelete() {
if (!this.actor || this.actor.type !== 'character') return; if (this.actor && this.actor.type === 'character') {
const items = this.actor.items.filter(item => item.system.originId === this.parent.id); const items = this.actor.items.filter(item => item.system.originId === this.parent.id);
if (items.length > 0) if (items.length > 0)
await this.actor.deleteEmbeddedDocuments( await this.actor.deleteEmbeddedDocuments(
@ -152,4 +151,19 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
items.map(x => x.id) items.map(x => x.id)
); );
} }
if (this.metadata.isItemLinkable) {
const linkEntries = Object.entries(this.itemLinks);
for (let [uuid, type] of linkEntries) {
const item = await foundry.utils.fromUuid(uuid);
const path = CONFIG.DH.ITEM.itemLinkFeatureTypes[type] ? 'system.features' : 'system.linkedItems';
await item.update({
[path]: foundry.utils
.getProperty(item, path)
.filter(x => x.uuid !== this.parent.uuid)
.map(x => x.uuid)
});
}
}
}
} }

View file

@ -28,12 +28,8 @@ export default class DHClass extends BaseDataItem {
}), }),
evasion: new fields.NumberField({ initial: 0, integer: true, label: 'DAGGERHEART.GENERAL.evasion' }), evasion: new fields.NumberField({ initial: 0, integer: true, label: 'DAGGERHEART.GENERAL.evasion' }),
features: new ForeignDocumentUUIDArrayField({ type: 'Item' }), features: new ForeignDocumentUUIDArrayField({ type: 'Item' }),
linkedItems: new ForeignDocumentUUIDArrayField({ type: 'Item' }),
subclasses: new ForeignDocumentUUIDArrayField({ type: 'Item', required: false }), subclasses: new ForeignDocumentUUIDArrayField({ type: 'Item', required: false }),
inventory: new fields.SchemaField({
take: new ForeignDocumentUUIDArrayField({ type: 'Item', required: false }),
choiceA: new ForeignDocumentUUIDArrayField({ type: 'Item', required: false }),
choiceB: new ForeignDocumentUUIDArrayField({ type: 'Item', required: false })
}),
characterGuide: new fields.SchemaField({ characterGuide: new fields.SchemaField({
suggestedTraits: new fields.SchemaField({ suggestedTraits: new fields.SchemaField({
agility: new fields.NumberField({ initial: 0, integer: true }), agility: new fields.NumberField({ initial: 0, integer: true }),
@ -42,21 +38,54 @@ export default class DHClass extends BaseDataItem {
instinct: new fields.NumberField({ initial: 0, integer: true }), instinct: new fields.NumberField({ initial: 0, integer: true }),
presence: new fields.NumberField({ initial: 0, integer: true }), presence: new fields.NumberField({ initial: 0, integer: true }),
knowledge: new fields.NumberField({ initial: 0, integer: true }) knowledge: new fields.NumberField({ initial: 0, integer: true })
}), })
suggestedPrimaryWeapon: new ForeignDocumentUUIDField({ type: 'Item' }),
suggestedSecondaryWeapon: new ForeignDocumentUUIDField({ type: 'Item' }),
suggestedArmor: new ForeignDocumentUUIDField({ type: 'Item' })
}), }),
isMulticlass: new fields.BooleanField({ initial: false }) isMulticlass: new fields.BooleanField({ initial: false })
}; };
} }
get hopeFeatures() { get hopeFeatures() {
return this.features.filter(x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.featureSubTypes.hope); return this.features.filter(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkFeatureTypes.hope
);
} }
get classFeatures() { get classFeatures() {
return this.features.filter(x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.featureSubTypes.class); return this.features.filter(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkFeatureTypes.class
);
}
get suggestedPrimaryWeapon() {
return this.linkedItems.find(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkTypes.primaryWeapon
);
}
get suggestedSecondaryWeapon() {
return this.linkedItems.find(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkTypes.secondaryWeapon
);
}
get suggestedArmor() {
return this.linkedItems.find(x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkTypes.armor);
}
get take() {
return this.linkedItems.filter(x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkTypes.take);
}
get choiceA() {
return this.linkedItems.filter(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkTypes.choiceA
);
}
get choiceB() {
return this.linkedItems.filter(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkTypes.choiceB
);
} }
async _preCreate(data, options, user) { async _preCreate(data, options, user) {

View file

@ -9,7 +9,8 @@ export default class DHConsumable extends BaseDataItem {
type: 'consumable', type: 'consumable',
hasDescription: true, hasDescription: true,
isQuantifiable: true, isQuantifiable: true,
isInventoryItem: true isInventoryItem: true,
isItemLinkable: true
}); });
} }

View file

@ -23,7 +23,11 @@ export default class DHFeature extends BaseDataItem {
nullable: true, nullable: true,
initial: null initial: null
}), }),
subType: new fields.StringField({ choices: CONFIG.DH.ITEM.featureSubTypes, nullable: true, initial: null }), subType: new fields.StringField({
choices: CONFIG.DH.ITEM.itemLinkFeatureTypes,
nullable: true,
initial: null
}),
originId: new fields.StringField({ nullable: true, initial: null }), originId: new fields.StringField({ nullable: true, initial: null }),
identifier: new fields.StringField(), identifier: new fields.StringField(),
actions: new fields.ArrayField(new ActionField()) actions: new fields.ArrayField(new ActionField())

View file

@ -9,7 +9,8 @@ export default class DHMiscellaneous extends BaseDataItem {
type: 'miscellaneous', type: 'miscellaneous',
hasDescription: true, hasDescription: true,
isQuantifiable: true, isQuantifiable: true,
isInventoryItem: true isInventoryItem: true,
isItemLinkable: true
}); });
} }

View file

@ -7,7 +7,8 @@ export default class DHSubclass extends BaseDataItem {
return foundry.utils.mergeObject(super.metadata, { return foundry.utils.mergeObject(super.metadata, {
label: 'TYPES.Item.subclass', label: 'TYPES.Item.subclass',
type: 'subclass', type: 'subclass',
hasDescription: true hasDescription: true,
isItemLinkable: true
}); });
} }
@ -30,19 +31,19 @@ export default class DHSubclass extends BaseDataItem {
get foundationFeatures() { get foundationFeatures() {
return this.features.filter( return this.features.filter(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.featureSubTypes.foundation x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkFeatureTypes.foundation
); );
} }
get specializationFeatures() { get specializationFeatures() {
return this.features.filter( return this.features.filter(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.featureSubTypes.specialization x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkFeatureTypes.specialization
); );
} }
get masteryFeatures() { get masteryFeatures() {
return this.features.filter( return this.features.filter(
x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.featureSubTypes.mastery x => x.system.itemLinks[this.parent.uuid] === CONFIG.DH.ITEM.itemLinkFeatureTypes.mastery
); );
} }

View file

@ -9,8 +9,8 @@ export default class DHWeapon extends AttachableItem {
label: 'TYPES.Item.weapon', label: 'TYPES.Item.weapon',
type: 'weapon', type: 'weapon',
hasDescription: true, hasDescription: true,
isInventoryItem: true isInventoryItem: true,
// hasInitialAction: true isItemLinkable: true
}); });
} }

View file

@ -23,7 +23,7 @@
</fieldset> </fieldset>
</div> </div>
<fieldset> <fieldset class="drop-section">
<legend>{{localize "TYPES.Item.subclass"}}</legend> <legend>{{localize "TYPES.Item.subclass"}}</legend>
<div class="feature-list"> <div class="feature-list">
{{#each source.system.subclasses as |subclass index|}} {{#each source.system.subclasses as |subclass index|}}
@ -36,8 +36,8 @@
<div class='controls'> <div class='controls'>
<a <a
class='effect-control' class='effect-control'
data-action='viewDoc' data-action='editDoc'
data-uuid={{subclass.uuid}} data-item-uuid={{subclass.uuid}}
data-tooltip='{{localize "DAGGERHEART.UI.Tooltip.openItemWorld"}}' data-tooltip='{{localize "DAGGERHEART.UI.Tooltip.openItemWorld"}}'
> >
<i class="fa-solid fa-globe"></i> <i class="fa-solid fa-globe"></i>

View file

@ -37,45 +37,51 @@
<fieldset class="one-column drop-section primary-weapon-section"> <fieldset class="one-column drop-section primary-weapon-section">
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedPrimaryWeaponTitle"}}</legend> <legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedPrimaryWeaponTitle"}}</legend>
<div class="drop-section-body list-items"> <div class="drop-section-body list-items">
{{#if document.system.characterGuide.suggestedPrimaryWeapon}} {{#with (ifThen document.system.suggestedPrimaryWeapon document.system.suggestedPrimaryWeapon null)}}
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{document.system.characterGuide.suggestedPrimaryWeapon.uuid}}"> {{#if this}}
<img class="image" src="{{document.system.characterGuide.suggestedPrimaryWeapon.img}}" /> <div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}">
<span>{{document.system.characterGuide.suggestedPrimaryWeapon.name}}</span> <img class="image" src="{{this.img}}" />
<span>{{this.name}}</span>
<div class="controls"> <div class="controls">
<i data-action="removeSuggestedItem" data-target="suggestedPrimaryWeapon" class="fa-solid fa-trash icon-button"></i> <a><i data-action="removeLinkedItem" data-uuid="{{this.uuid}}" class="fa-solid fa-trash icon-button"></i></a>
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{/with}}
</div> </div>
</fieldset> </fieldset>
<fieldset class="one-column drop-section secondary-weapon-section"> <fieldset class="one-column drop-section secondary-weapon-section">
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedSecondaryWeaponTitle"}}</legend> <legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedSecondaryWeaponTitle"}}</legend>
<div class="drop-section-body list-items"> <div class="drop-section-body list-items">
{{#if document.system.characterGuide.suggestedSecondaryWeapon}} {{#with (ifThen document.system.suggestedSecondaryWeapon document.system.suggestedSecondaryWeapon null)}}
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{system.system.characterGuide.suggestedSecondaryWeapon.uuid}}"> {{#if this}}
<img class="image" src="{{document.system.characterGuide.suggestedSecondaryWeapon.img}}" /> <div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}">
<span>{{document.system.characterGuide.suggestedSecondaryWeapon.name}}</span> <img class="image" src="{{this.img}}" />
<span>{{this.name}}</span>
<div class="controls"> <div class="controls">
<i data-action="removeSuggestedItem" data-target="suggestedSecondaryWeapon" class="fa-solid fa-trash icon-button"></i> <a><i data-action="removeLinkedItem" data-uuid="{{this.uuid}}" class="fa-solid fa-trash icon-button"></i></a>
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{/with}}
</div> </div>
</fieldset> </fieldset>
<fieldset class="one-column drop-section armor-section"> <fieldset class="one-column drop-section armor-section">
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedArmorTitle"}}</legend> <legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedArmorTitle"}}</legend>
<div class="drop-section-body list-items"> <div class="drop-section-body list-items">
{{#if document.system.characterGuide.suggestedArmor}} {{#with (ifThen document.system.suggestedArmor document.system.suggestedArmor null)}}
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{document.system.characterGuide.suggestedArmor.uuid}}"> {{#if this}}
<img class="image" src="{{document.system.characterGuide.suggestedArmor.img}}" /> <div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}">
<span>{{document.system.characterGuide.suggestedArmor.name}}</span> <img class="image" src="{{this.img}}" />
<span>{{this.name}}</span>
<div class="controls"> <div class="controls">
<i data-action="removeSuggestedItem" data-target="suggestedArmor" class="fa-solid fa-trash icon-button"></i> <a><i data-action="removeLinkedItem" data-uuid="{{this.uuid}}" class="fa-solid fa-trash icon-button"></i></a>
</div> </div>
</div> </div>
{{/if}} {{/if}}
{{/with}}
</div> </div>
</fieldset> </fieldset>
</fieldset> </fieldset>
@ -85,12 +91,12 @@
<fieldset class="one-column drop-section take-section"> <fieldset class="one-column drop-section take-section">
<legend>{{localize "DAGGERHEART.GENERAL.take"}}</legend> <legend>{{localize "DAGGERHEART.GENERAL.take"}}</legend>
<div class="drop-section-body list-items"> <div class="drop-section-body list-items">
{{#each source.system.inventory.take}} {{#each source.system.take}}
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}"> <div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}">
<img class="image" src="{{this.img}}" /> <img class="image" src="{{this.img}}" />
<span>{{this.name}}</span> <span>{{this.name}}</span>
<div class="controls"> <div class="controls">
<i data-action="removeItemFromCollection" data-target="invetory.take" data-uuid="{{this.uuid}}" class="fa-solid fa-trash icon-button"></i> <a><i data-action="removeLinkedItem" data-uuid="{{this.uuid}}" class="fa-solid fa-trash icon-button"></i></a>
</div> </div>
</div> </div>
{{/each}} {{/each}}
@ -100,12 +106,12 @@
<fieldset class="one-column drop-section choice-a-section"> <fieldset class="one-column drop-section choice-a-section">
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.inventory.thenChoose"}}</legend> <legend>{{localize "DAGGERHEART.ITEMS.Class.guide.inventory.thenChoose"}}</legend>
<div class="drop-section-body list-items"> <div class="drop-section-body list-items">
{{#each source.system.inventory.choiceA}} {{#each source.system.choiceA}}
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}"> <div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}">
<img class="image" src="{{this.img}}" /> <img class="image" src="{{this.img}}" />
<span>{{this.name}}</span> <span>{{this.name}}</span>
<div class="controls"> <div class="controls">
<i data-action="removeItemFromCollection" data-target="invetory.choiceA" data-uuid="{{this.uuid}}" class="fa-solid fa-trash icon-button"></i> <a><i data-action="removeLinkedItem" data-uuid="{{this.uuid}}" class="fa-solid fa-trash icon-button"></i></a>
</div> </div>
</div> </div>
{{/each}} {{/each}}
@ -115,12 +121,12 @@
<fieldset class="one-column drop-section choice-b-section"> <fieldset class="one-column drop-section choice-b-section">
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.inventory.andEither"}}</legend> <legend>{{localize "DAGGERHEART.ITEMS.Class.guide.inventory.andEither"}}</legend>
<div class="drop-section-body list-items"> <div class="drop-section-body list-items">
{{#each source.system.inventory.choiceB}} {{#each source.system.choiceB}}
<div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}"> <div class="suggested-item item-line" data-action="editDoc" data-item-uuid="{{this.uuid}}">
<img class="image" src="{{this.img}}" /> <img class="image" src="{{this.img}}" />
<span>{{this.name}}</span> <span>{{this.name}}</span>
<div class="controls"> <div class="controls">
<i data-action="removeItemFromCollection" data-target="invetory.choiceB" data-uuid="{{this.uuid}}" class="fa-solid fa-trash icon-button"></i> <a><i data-action="removeLinkedItem" data-uuid="{{this.uuid}}" class="fa-solid fa-trash icon-button"></i></a>
</div> </div>
</div> </div>
{{/each}} {{/each}}