Iss4 - create a way to attach attach items to armor and weapons (#310)

* add basic drag drop window

* add better field

* make effects copy onto actor on attachment

* make items from inventory draggable

* working drop from inventory

* remove duplication issue

* add attachment only flag and logic

* add weapons to attachables

* remove debug logs

* try to make it drier

* remove unecessary try catch

* remove extra configs

* remove superfluous comments

* remove spurious defenses

* make drier

* remove unecessary code

* deduplicate and simplify

* its a desert

* standardize to be more similar to class item code

* fix bug of duplicate effects being created

* fix localization string

* fix bug of item equiping and un equiping

* remove this since were not going to be using attachmentonly

* update attachment tab with comments

* remove attachment only logic in favor of just transfer

* change flags

* change armor and weapon to be attachableItem

* change armor and weapon to be attachableItem

* change weapon to use mixin

* add mixin to armor

* move everything to mixin sheet

* refactor code for review comments

* cleanup and somehow git is ignoring some changes

* see if this picks up the changes now

* Import/Export updates

---------

Co-authored-by: psitacus <walther.johnson@ucalgary.ca>
Co-authored-by: WBHarry <williambjrklund@gmail.com>
This commit is contained in:
Psitacus 2025-07-12 19:07:22 -06:00 committed by GitHub
parent 812a5e8dd7
commit 687500f191
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 357 additions and 18 deletions

View file

@ -7,7 +7,7 @@
{{formGroup fields.origin value=source.origin rootId=rootId disabled=true}}
{{/if}}
{{#if isItemEffect}}
{{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=legacyTransfer.hint}}
{{formGroup fields.transfer value=source.transfer rootId=rootId label=legacyTransfer.label hint=(localize "DAGGERHEART.EFFECTS.Attachments.transferHint")}}
{{/if}}
{{formGroup fields.statuses value=source.statuses options=statuses rootId=rootId classes="statuses"}}

View file

@ -1,4 +1,4 @@
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}">
<li class="inventory-item" data-item-id="{{item.id}}" data-item-uuid="{{item.uuid}}" data-type="{{type}}" draggable="true">
<img src="{{item.img}}" class="item-img {{#if isActor}}actor-img{{/if}}" data-action="useItem" {{#if (not noTooltip)}}data-tooltip="{{concat "#item#" item.uuid}}"{{/if}} />
<div class="item-label">
{{#if isCompanion}}

View file

@ -0,0 +1,29 @@
<section
class='tab {{tabs.attachments.cssClass}} {{tabs.attachments.id}}'
data-tab='{{tabs.attachments.id}}'
data-group='{{tabs.attachments.group}}'
>
<fieldset class="one-column drop-section attachments-section">
<legend>{{localize tabs.attachments.label}}</legend>
{{#if attachedItems}}
<div class="attached-items">
{{#each attachedItems as |item|}}
<div class="inventory-item attached-item" data-uuid="{{item.uuid}}">
<img src="{{item.img}}" alt="{{item.name}}" class="item-img">
<div class="item-label">
<div class="item-name">{{item.name}}</div>
</div>
<div class="controls">
<a data-action="removeAttachment" data-uuid="{{item.uuid}}"><i class="fa-solid fa-trash remove-attachment"></i></a>
</div>
</div>
{{/each}}
</div>
{{/if}}
<div class="drop-area" data-drop-type="Item" style="width: 100%;">
<span>{{localize "DAGGERHEART.EFFECTS.Attachments.attachHint"}}</span>
</div>
</fieldset>
</section>