Weapons and Armor are now stored like any other item on the PC. Added equip/unequip logic.

This commit is contained in:
WBHarry 2025-05-25 20:56:11 +02:00
parent 71319f2b74
commit 8e92b5f6d9
13 changed files with 121 additions and 70 deletions

View file

@ -1,12 +1,6 @@
<fieldset class="left-main-container armor-section active-item-section item-section">
<legend class="legend armor-container">
<span>{{localize "DAGGERHEART.Sheets.PC.Armor.Title"}}</span>
{{#if armor}}
<div data-action="viewObject" data-value="{{armor.uuid}}" class="active-item-label-chip">
<img src="{{armor.img}}" />
<button data-action="removeActiveItem" data-item="{{armor.uuid}}"><i class="fa-solid fa-x"></i></button>
</div>
{{/if}}
</legend>
<div class="active-item-container">

View file

@ -6,12 +6,6 @@
<div class="inventory-weapon-section-first item-section">
<h2 class="armor-container">
{{localize "DAGGERHEART.Sheets.PC.Inventory.InventoryWeapon"}}
{{#if weapons.first}}
<div data-action="viewObject" data-value="{{weapons.first.uuid}}" class="active-item-label-chip">
<img src="{{weapons.first.img}}" />
<button data-action="removeInventoryWeapon" data-item="{{weapons.first.uuid}}"><i class="fa-solid fa-x"></i></button>
</div>
{{/if}}
</h2>
<div class="active-item-container">
<div class="flexrow">

View file

@ -20,37 +20,29 @@
<h2 class="weapons-label-row">
{{localize "DAGGERHEART.Sheets.PC.Weapons.PrimaryTitle"}}
{{#if weapons.primary}}
<div data-action="viewObject" data-value="{{weapons.primary.uuid}}" class="active-item-label-chip">
<img src="{{weapons.primary.img}}" />
<button data-action="removeActiveItem" data-item="{{weapons.primary.uuid}}"><i class="fa-solid fa-x"></i></button>
</div>
<img class="damage-roll" data-action="attackRoll" data-weapon="{{weapons.primary.uuid}}" src="icons/svg/d12-grey.svg" />
{{/if}}
</h2>
<div class="flexrow">
<input value="{{weapons.primary.name}}" type="text" />
<input value="{{localize weapons.primary.trait}}" type="text" />
<input value="{{localize weapons.primary.range.name}}" type="text" />
<input value="{{localize weapons.primary.range.label}}" type="text" />
<input value="{{weapons.primary.damage.value}} {{#if weapons.primary}}({{localize weapons.primary.damage.type.abbreviation}}){{/if}}" type="text" />
</div>
<input value="{{localize weapons.primary.feature.name}} {{#if weapons.primary.feature}}({{localize weapons.primary.feature.description}}){{/if}}" type="text" />
<input value="{{localize weapons.primary.feature.label}} {{#if weapons.primary.feature}}({{localize weapons.primary.feature.description}}){{/if}}" type="text" />
</div>
<div class="active-item-container">
<h2 class="weapons-label-row">
{{localize "DAGGERHEART.Sheets.PC.Weapons.SecondaryTitle"}}
{{#if weapons.secondary}}
<div data-action="viewObject" data-value="{{weapons.secondary.uuid}}" class="active-item-label-chip">
<img src="{{weapons.secondary.img}}" />
<button data-action="removeActiveItem" data-item="{{weapons.secondary.uuid}}"><i class="fa-solid fa-x"></i></button>
</div>
<img class="damage-roll" data-action="damageRoll" data-value="{{weapons.secondary.damage.value}}" src="icons/svg/d12-grey.svg" />
{{/if}}
</h2>
<div class="flexrow">
<input value="{{weapons.secondary.name}}" type="text" />
<input value="{{localize weapons.secondary.trait}}" type="text" />
<input value="{{localize weapons.secondary.range.name}}" type="text" />
<input value="{{weapons.secondary.damage.value}} {{#if weapons.secondary}}({{localize weapons.secondary.damage.type.abbreviation}}){{/if}}" type="text" />
<input value="{{localize weapons.secondary.range.label}}" type="text" />
<input value="{{weapons.secondary.damage.label}} {{#if weapons.secondary}}({{localize weapons.secondary.damage.type.abbreviation}}){{/if}}" type="text" />
</div>
<input value="{{localize weapons.secondary.feature.name}} {{#if weapons.secondary.feature}}({{localize weapons.secondary.feature.description}}){{/if}}" style="text-overflow: ellipsis;" type="text" />
</div>

View file

@ -88,7 +88,7 @@
</div>
<div class="body-section flex3">
{{> "systems/daggerheart/templates/sheets/parts/attributes.hbs" }}
{{> "systems/daggerheart/templates/sheets/parts/weapons.hbs" weapons=document.system.activeWeapons proficiency=document.system.proficiency.value }}
{{> "systems/daggerheart/templates/sheets/parts/weapons.hbs" weapons=document.system.equippedWeapons proficiency=document.system.proficiency.value }}
{{> "systems/daggerheart/templates/sheets/parts/armor.hbs" armor=document.system.armor }}
{{> "systems/daggerheart/templates/sheets/parts/inventory.hbs" weapons=document.system.inventoryWeapons }}
</div>

View file

@ -18,6 +18,9 @@
{{item.name}}
</div>
</div>
<div class="flexrow">
<button data-action="toggleEquipItem" id="{{item.id}}">{{localize "Equip"}}</button>
</div>
<div class="inventory-item-quantity spaced">
<i data-action="itemQuantityDecrease" class="fa-solid fa-chevron-left icon-button {{#if (lte item.system.quantity 1)}}disabled{{/if}}"></i>
<input type="text" data-item="system.quantity" value="{{item.system.quantity}}" data-dtype="Number" />