mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
Made suggested items inactive in the Class sheet if rendered from inside a Character
This commit is contained in:
parent
682ffc04d7
commit
8fad165977
3 changed files with 56 additions and 50 deletions
|
|
@ -113,45 +113,47 @@ export default class ClassSheet extends DHBaseItemSheet {
|
||||||
});
|
});
|
||||||
} else if (item.type === 'feature') {
|
} else if (item.type === 'feature') {
|
||||||
super._onDrop(event);
|
super._onDrop(event);
|
||||||
} else if (item.type === 'weapon') {
|
} else if (this.document.parent?.type !== 'character') {
|
||||||
if (target.classList.contains('primary-weapon-section')) {
|
if (item.type === 'weapon') {
|
||||||
if (!item.system.secondary)
|
if (target.classList.contains('primary-weapon-section')) {
|
||||||
|
if (!item.system.secondary)
|
||||||
|
await this.document.update({
|
||||||
|
'system.characterGuide.suggestedPrimaryWeapon': item.uuid
|
||||||
|
});
|
||||||
|
} else if (target.classList.contains('secondary-weapon-section')) {
|
||||||
|
if (item.system.secondary)
|
||||||
|
await this.document.update({
|
||||||
|
'system.characterGuide.suggestedSecondaryWeapon': item.uuid
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (item.type === 'armor') {
|
||||||
|
if (target.classList.contains('armor-section')) {
|
||||||
await this.document.update({
|
await this.document.update({
|
||||||
'system.characterGuide.suggestedPrimaryWeapon': item.uuid
|
'system.characterGuide.suggestedArmor': item.uuid
|
||||||
});
|
|
||||||
} else if (target.classList.contains('secondary-weapon-section')) {
|
|
||||||
if (item.system.secondary)
|
|
||||||
await this.document.update({
|
|
||||||
'system.characterGuide.suggestedSecondaryWeapon': item.uuid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (item.type === 'armor') {
|
|
||||||
if (target.classList.contains('armor-section')) {
|
|
||||||
await this.document.update({
|
|
||||||
'system.characterGuide.suggestedArmor': item.uuid
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (target.classList.contains('choice-a-section')) {
|
|
||||||
if (item.type === 'loot' || item.type === 'consumable') {
|
|
||||||
const filteredChoiceA = this.document.system.inventory.choiceA;
|
|
||||||
if (filteredChoiceA.length < 2)
|
|
||||||
await this.document.update({
|
|
||||||
'system.inventory.choiceA': [...filteredChoiceA.map(x => x.uuid), item.uuid]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (item.type === 'loot') {
|
|
||||||
if (target.classList.contains('take-section')) {
|
|
||||||
const filteredTake = this.document.system.inventory.take.filter(x => x);
|
|
||||||
if (filteredTake.length < 3)
|
|
||||||
await this.document.update({
|
|
||||||
'system.inventory.take': [...filteredTake.map(x => x.uuid), item.uuid]
|
|
||||||
});
|
|
||||||
} else if (target.classList.contains('choice-b-section')) {
|
|
||||||
const filteredChoiceB = this.document.system.inventory.choiceB.filter(x => x);
|
|
||||||
if (filteredChoiceB.length < 2)
|
|
||||||
await this.document.update({
|
|
||||||
'system.inventory.choiceB': [...filteredChoiceB.map(x => x.uuid), item.uuid]
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} else if (target.classList.contains('choice-a-section')) {
|
||||||
|
if (item.type === 'loot' || item.type === 'consumable') {
|
||||||
|
const filteredChoiceA = this.document.system.inventory.choiceA;
|
||||||
|
if (filteredChoiceA.length < 2)
|
||||||
|
await this.document.update({
|
||||||
|
'system.inventory.choiceA': [...filteredChoiceA.map(x => x.uuid), item.uuid]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (item.type === 'loot') {
|
||||||
|
if (target.classList.contains('take-section')) {
|
||||||
|
const filteredTake = this.document.system.inventory.take.filter(x => x);
|
||||||
|
if (filteredTake.length < 3)
|
||||||
|
await this.document.update({
|
||||||
|
'system.inventory.take': [...filteredTake.map(x => x.uuid), item.uuid]
|
||||||
|
});
|
||||||
|
} else if (target.classList.contains('choice-b-section')) {
|
||||||
|
const filteredChoiceB = this.document.system.inventory.choiceB.filter(x => x);
|
||||||
|
if (filteredChoiceB.length < 2)
|
||||||
|
await this.document.update({
|
||||||
|
'system.inventory.choiceB': [...filteredChoiceB.map(x => x.uuid), item.uuid]
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.inactive {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
&.fit-height {
|
&.fit-height {
|
||||||
height: 95%;
|
height: 95%;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,10 @@
|
||||||
<span>{{localize "DAGGERHEART.CONFIG.Traits.knowledge.name"}}</span>
|
<span>{{localize "DAGGERHEART.CONFIG.Traits.knowledge.name"}}</span>
|
||||||
<input type="text" name="system.characterGuide.suggestedTraits.knowledge" value="{{source.system.characterGuide.suggestedTraits.knowledge}}" />
|
<input type="text" name="system.characterGuide.suggestedTraits.knowledge" value="{{source.system.characterGuide.suggestedTraits.knowledge}}" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="one-column">
|
<fieldset class="one-column">
|
||||||
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedEquipment"}}</legend>
|
<legend>{{localize "DAGGERHEART.ITEMS.Class.guide.suggestedEquipment"}}</legend>
|
||||||
<fieldset class="one-column drop-section primary-weapon-section">
|
<fieldset class="one-column drop-section primary-weapon-section {{#if (eq document.parent.type 'character')}}inactive{{/if}}">
|
||||||
<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}}
|
{{#if document.system.characterGuide.suggestedPrimaryWeapon}}
|
||||||
|
|
@ -42,14 +42,14 @@
|
||||||
<img class="image" src="{{document.system.characterGuide.suggestedPrimaryWeapon.img}}" />
|
<img class="image" src="{{document.system.characterGuide.suggestedPrimaryWeapon.img}}" />
|
||||||
<span>{{document.system.characterGuide.suggestedPrimaryWeapon.name}}</span>
|
<span>{{document.system.characterGuide.suggestedPrimaryWeapon.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<a data-action="removeSuggestedItem" data-target="suggestedPrimaryWeapon"><i class="fa-solid fa-trash icon-button"></i></a>
|
{{#unless (eq document.parent.type 'character')}}<a data-action="removeSuggestedItem" data-target="suggestedPrimaryWeapon"><i class="fa-solid fa-trash icon-button"></i></a>{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="one-column drop-section secondary-weapon-section">
|
<fieldset class="one-column drop-section secondary-weapon-section {{#if (eq document.parent.type 'character')}}inactive{{/if}}">
|
||||||
<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}}
|
{{#if document.system.characterGuide.suggestedSecondaryWeapon}}
|
||||||
|
|
@ -57,14 +57,14 @@
|
||||||
<img class="image" src="{{document.system.characterGuide.suggestedSecondaryWeapon.img}}" />
|
<img class="image" src="{{document.system.characterGuide.suggestedSecondaryWeapon.img}}" />
|
||||||
<span>{{document.system.characterGuide.suggestedSecondaryWeapon.name}}</span>
|
<span>{{document.system.characterGuide.suggestedSecondaryWeapon.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<a data-action="removeSuggestedItem" data-target="suggestedSecondaryWeapon"><i class="fa-solid fa-trash icon-button"></i></a>
|
{{#unless (eq document.parent.type 'character')}}<a data-action="removeSuggestedItem" data-target="suggestedSecondaryWeapon"><i class="fa-solid fa-trash icon-button"></i></a>{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="one-column drop-section armor-section">
|
<fieldset class="one-column drop-section armor-section {{#if (eq document.parent.type 'character')}}inactive{{/if}}">
|
||||||
<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}}
|
{{#if document.system.characterGuide.suggestedArmor}}
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
<img class="image" src="{{document.system.characterGuide.suggestedArmor.img}}" />
|
<img class="image" src="{{document.system.characterGuide.suggestedArmor.img}}" />
|
||||||
<span>{{document.system.characterGuide.suggestedArmor.name}}</span>
|
<span>{{document.system.characterGuide.suggestedArmor.name}}</span>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<a data-action="removeSuggestedItem" data-target="suggestedArmor"><i class="fa-solid fa-trash icon-button"></i></a>
|
{{#unless (eq document.parent.type 'character')}}<a data-action="removeSuggestedItem" data-target="suggestedArmor"><i class="fa-solid fa-trash icon-button"></i></a>{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
|
|
||||||
<fieldset class="one-column">
|
<fieldset class="one-column">
|
||||||
<legend>{{localize "DAGGERHEART.GENERAL.inventory"}}</legend>
|
<legend>{{localize "DAGGERHEART.GENERAL.inventory"}}</legend>
|
||||||
<fieldset class="one-column drop-section take-section">
|
<fieldset class="one-column drop-section take-section {{#if (eq document.parent.type 'character')}}inactive{{/if}}">
|
||||||
<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.inventory.take}}
|
||||||
|
|
@ -91,7 +91,7 @@
|
||||||
<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">
|
||||||
<a data-action="removeItemFromCollection" data-target="inventory.take" data-uuid="{{this.uuid}}"><i class="fa-solid fa-trash icon-button"></i></a>
|
{{#unless (eq document.parent.type 'character')}}<a data-action="removeItemFromCollection" data-target="inventory.take" data-uuid="{{this.uuid}}"><i class="fa-solid fa-trash icon-button"></i></a>{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -99,7 +99,7 @@
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="one-column drop-section choice-a-section">
|
<fieldset class="one-column drop-section choice-a-section {{#if (eq document.parent.type 'character')}}inactive{{/if}}">
|
||||||
<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.inventory.choiceA}}
|
||||||
|
|
@ -108,7 +108,7 @@
|
||||||
<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">
|
||||||
<a data-action="removeItemFromCollection" data-target="inventory.choiceA" data-uuid="{{this.uuid}}"><i class="fa-solid fa-trash icon-button"></i></a>
|
{{#unless (eq document.parent.type 'character')}}<a data-action="removeItemFromCollection" data-target="inventory.choiceA" data-uuid="{{this.uuid}}"><i class="fa-solid fa-trash icon-button"></i></a>{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -116,7 +116,7 @@
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="one-column drop-section choice-b-section">
|
<fieldset class="one-column drop-section choice-b-section {{#if (eq document.parent.type 'character')}}inactive{{/if}}">
|
||||||
<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.inventory.choiceB}}
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
<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">
|
||||||
<a data-action="removeItemFromCollection" data-target="inventory.choiceB" data-uuid="{{this.uuid}}"><i class="fa-solid fa-trash icon-button"></i></a>
|
{{#unless (eq document.parent.type 'character')}}<a data-action="removeItemFromCollection" data-target="inventory.choiceB" data-uuid="{{this.uuid}}"><i class="fa-solid fa-trash icon-button"></i></a>{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue