Skip to content

Commit

Permalink
closes #372
Browse files Browse the repository at this point in the history
  • Loading branch information
Muttley committed Oct 19, 2023
1 parent 2664fb2 commit f888547
Show file tree
Hide file tree
Showing 18 changed files with 289 additions and 147 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
### Bugfixes
* [#537] Ranger D12 damage seeming to roll twice

### Enhancements
* [#372] Add ability to indicate physical items are stashed and no longer taking up inventory slots

## v.1.4.8

### Bugfixes
Expand Down
2 changes: 2 additions & 0 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ SHADOWDARK.inventory.tooltip.item_increment: Increase Quantity
SHADOWDARK.inventory.tooltip.sell_treasure: Sell Treasure
SHADOWDARK.inventory.tooltip.toggle_equipped: Toggle Equipped
SHADOWDARK.inventory.tooltip.toggle_light_source: Toggle Light Source
SHADOWDARK.inventory.tooltip.toggle_stashed: Toggle Stashed
SHADOWDARK.inventory.total_coins: Total Coins
SHADOWDARK.inventory.total_gems: Total Gems
SHADOWDARK.item_type.armor: Armor
Expand Down Expand Up @@ -377,6 +378,7 @@ SHADOWDARK.item.spell_name: Spell Name
SHADOWDARK.item.spell_range: Range
SHADOWDARK.item.spell_tier: Tier
SHADOWDARK.item.spell.label: Spell
SHADOWDARK.item.stashed.label: Stashed
SHADOWDARK.item.talent_class: Talent Class
SHADOWDARK.item.treasure: Treasure
SHADOWDARK.item.wand.label: Wand
Expand Down
5 changes: 3 additions & 2 deletions scss/sheets/actors/_player.scss
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,11 @@
}
}

.item-toggle-equipped {
.item-toggle-equipped,
.item-toggle-stashed {
color: var(--inactive-control);

&.equipped {
&.enabled {
color: black;
}
}
Expand Down
26 changes: 25 additions & 1 deletion system/src/sheets/PlayerSheetSD.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export default class PlayerSheetSD extends ActorSheetSD {
event => this._onToggleEquipped(event)
);

html.find(".item-toggle-stashed").click(
event => this._onToggleStashed(event)
);

html.find(".item-toggle-light").click(
event => this._onToggleLightSource(event)
);
Expand Down Expand Up @@ -564,6 +568,24 @@ export default class PlayerSheetSD extends ActorSheetSD {
{
_id: itemId,
"system.equipped": !item.system.equipped,
"system.stashed": false,
},
]);

if (item.type === "Armor") this.actor.updateArmor(updatedItem);
}

async _onToggleStashed(event) {
event.preventDefault();

const itemId = $(event.currentTarget).data("item-id");
const item = this.actor.getEmbeddedDocument("Item", itemId);

const [updatedItem] = await this.actor.updateEmbeddedDocuments("Item", [
{
_id: itemId,
"system.stashed": !item.system.stashed,
"system.equipped": false,
},
]);

Expand Down Expand Up @@ -779,7 +801,9 @@ export default class PlayerSheetSD extends ActorSheetSD {

i.slotsUsed = totalSlotsUsed;

slotCount += i.slotsUsed;
if (!i.system.stashed) {
slotCount += i.slotsUsed;
}

const section = i.system.treasure
? "treasure"
Expand Down
3 changes: 2 additions & 1 deletion system/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@
"free_carry": 0,
"per_slot": 1,
"slots_used": 1
}
},
"stashed": false
}
},
"Ancestry": {
Expand Down
125 changes: 72 additions & 53 deletions system/templates/actors/player/inventory.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<th>&nbsp;</th>
<th width="95px">{{localize 'SHADOWDARK.inventory.label.quantity'}}</th>
<th width="55px">{{localize 'SHADOWDARK.inventory.label.slots'}}</th>
<th width="50px">&nbsp;</th>
<th width="70px">&nbsp;</th>
</tr>
{{#each inventory as |section sid|}}
<tr class="inventory-section-header">
Expand Down Expand Up @@ -87,13 +87,15 @@
<td class="item-list-centered">
{{#if item.system.canBeEquipped}}
<a
class="item-control item-toggle-equipped {{#if item.system.equipped}}equipped{{/if}}"
class="item-control item-toggle-equipped {{#if item.system.equipped}}enabled{{/if}}"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.inventory.tooltip.toggle_equipped'}}"
>
<i class="fas fa-shirt"></i>
</a>
&nbsp;
{{/if}}

{{#if item.system.treasure}}
<a
class="item-control sell-treasure"
Expand All @@ -103,72 +105,89 @@
<i class="fa-solid fa-coins"></i>
</a>
{{/if}}
{{#if item.system.light.isSource}}
<a
class="item-control item-toggle-light {{#if item.system.light.active}}lit{{/if}}"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.inventory.tooltip.toggle_light_source'}}"
>
<i class="fa-solid fa-fire-flame-curved"></i>
</a>
{{/if}}
{{#ifEq item.type "Potion"}}
<a
class="item-control use-potion"
data-action="use-potion"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.sheet.player.tooltip.use_potion'}}"
>
<i class="fas fa-prescription-bottle"></i>
</a>
{{/ifEq}}
{{#if ../../canUseMagicItems}}
{{#ifEq item.type "Scroll"}}

{{#unless item.system.stashed}}
{{#if item.system.light.isSource}}
<a
class="item-control use-scroll"
data-action="cast-spell"
class="item-control item-toggle-light {{#if item.system.light.active}}lit{{/if}}"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.sheet.player.tooltip.use_scroll'}}"
data-tooltip="{{localize 'SHADOWDARK.inventory.tooltip.toggle_light_source'}}"
>
<i class="fa-solid fa-scroll"></i>
<i class="fa-solid fa-fire-flame-curved"></i>
</a>
{{#if ../../isSpellcaster}}
&nbsp;
&nbsp;
{{/if}}
{{#ifEq item.type "Potion"}}
<a
class="item-control use-potion"
data-action="use-potion"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.sheet.player.tooltip.use_potion'}}"
>
<i class="fas fa-prescription-bottle"></i>
</a>
&nbsp;
{{/ifEq}}
{{#if ../../canUseMagicItems}}
{{#ifEq item.type "Scroll"}}
<a
class="item-control use-scroll"
data-action="learn-spell"
data-action="cast-spell"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.sheet.player.tooltip.learn_spell'}}"
data-tooltip="{{localize 'SHADOWDARK.sheet.player.tooltip.use_scroll'}}"
>
<i class="fa-solid fa-graduation-cap"></i>
<i class="fa-solid fa-scroll"></i>
</a>
{{/if}}
{{/ifEq}}
{{#ifEq item.type "Wand"}}
{{#unless item.system.lost}}
&nbsp;
{{#if ../../isSpellcaster}}
<a
class="item-control use-scroll"
data-action="learn-spell"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.sheet.player.tooltip.learn_spell'}}"
>
<i class="fa-solid fa-graduation-cap"></i>
</a>
{{/if}}
{{/ifEq}}
{{#ifEq item.type "Wand"}}
{{#unless item.system.lost}}
<a
class="item-control use-wand"
data-action="cast-spell"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.sheet.player.tooltip.use_wand'}}"
>
<i class="fa-solid fa-wand-magic-sparkles"></i>
</a>
&nbsp;
{{/unless}}
<a
class="item-control use-wand"
data-action="cast-spell"
class="item-control toggle-lost"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.sheet.player.tooltip.use_wand'}}"
data-tooltip="{{localize "SHADOWDARK.sheet.player.toggle_spell_lost"}}"
>
<i class="fa-solid fa-wand-magic-sparkles"></i>
{{#if item.system.lost}}
<i style="color:red;" class="fa-solid fa-xmark"></i>
{{else}}
<i style="color:green;" class="fa-solid fa-check"></i>
{{/if}}
</a>
&nbsp;
{{/unless}}
<a
class="item-control toggle-lost"
data-item-id="{{item._id}}"
data-tooltip="{{localize "SHADOWDARK.sheet.player.toggle_spell_lost"}}"
>
{{#if item.system.lost}}
<i style="color:red;" class="fa-solid fa-xmark"></i>
{{else}}
<i style="color:green;" class="fa-solid fa-check"></i>
{{/if}}
</a>
{{/ifEq}}
{{/ifEq}}
{{/if}}
{{/unless}}

{{#if item.system.isPhysical}}
<a
class="item-control item-toggle-stashed {{#if item.system.stashed}}enabled{{/if}}"
data-item-id="{{item._id}}"
data-tooltip="{{localize 'SHADOWDARK.inventory.tooltip.toggle_stashed'}}"
>
<i class="fa-solid fa-box"></i>
</a>
{{/if}}

</td>
</tr>
{{/each}}
Expand Down
5 changes: 5 additions & 0 deletions system/templates/chat/item/armor.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
{{this.name}}
</li>
{{/each}}
{{#if item.system.stashed}}
<li class="tag tag_secondary tag_small">
{{localize 'SHADOWDARK.item.stashed.label'}}
</li>
{{/if}}
</ul>
</footer>
</div>
7 changes: 7 additions & 0 deletions system/templates/chat/item/default.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,12 @@
</div>

<footer class="card-footer">
<ul class="tags">
{{#if item.system.stashed}}
<li class="tag tag_secondary tag_small">
{{localize 'SHADOWDARK.item.stashed.label'}}
</li>
{{/if}}
</ul>
</footer>
</div>
33 changes: 25 additions & 8 deletions system/templates/chat/item/potion.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,30 @@
</div>

<div class="chat-card-buttons">
<button
class="item-control"
data-actor-id="{{actor.id}}"
data-item-id="{{item._id}}"
data-action="use-potion"
>
{{localize 'SHADOWDARK.chat_card.button.use_potion'}}
</button>
{{#unless item.system.stashed}}
<button
class="item-control"
data-actor-id="{{actor.id}}"
data-item-id="{{item._id}}"
data-action="use-potion"
>
{{localize 'SHADOWDARK.chat_card.button.use_potion'}}
</button>
{{/unless}}
</div>

<footer class="card-footer">
<ul class="tags">
{{#each itemProperties}}
<li class="tag tag_primary tag_small">
{{this.name}}
</li>
{{/each}}
{{#if item.system.stashed}}
<li class="tag tag_secondary tag_small">
{{localize 'SHADOWDARK.item.stashed.label'}}
</li>
{{/if}}
</ul>
</footer>
</div>
47 changes: 27 additions & 20 deletions system/templates/chat/item/scroll.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,28 @@
</div>

<div class="chat-card-buttons {{#if isSpellcaster}}grid-2-columns{{/if}}">
{{#if canUseMagicItems}}
<button
class="item-control"
data-actor-id="{{actor.id}}"
data-item-id="{{item._id}}"
data-action="cast-spell"
>
{{localize 'SHADOWDARK.chat_card.button.use_scroll'}}
</button>
{{/if}}
{{#if isSpellcaster}}
<button
class="item-control"
data-actor-id="{{actor.id}}"
data-item-id="{{item._id}}"
data-action="learn-spell"
>
{{localize 'SHADOWDARK.chat_card.button.learn_spell'}}
</button>
{{/if}}
{{#unless item.system.stashed}}
{{#if canUseMagicItems}}
<button
class="item-control"
data-actor-id="{{actor.id}}"
data-item-id="{{item._id}}"
data-action="cast-spell"
>
{{localize 'SHADOWDARK.chat_card.button.use_scroll'}}
</button>
{{/if}}
{{#if isSpellcaster}}
<button
class="item-control"
data-actor-id="{{actor.id}}"
data-item-id="{{item._id}}"
data-action="learn-spell"
>
{{localize 'SHADOWDARK.chat_card.button.learn_spell'}}
</button>
{{/if}}
{{/unless}}
</div>

<footer class="card-footer">
Expand All @@ -56,6 +58,11 @@
{{localize "SHADOWDARK.item.spell_range"}}:
{{fromConfig "SPELL_RANGES" item.system.range }}
</li>
{{#if item.system.stashed}}
<li class="tag tag_secondary tag_small">
{{localize 'SHADOWDARK.item.stashed.label'}}
</li>
{{/if}}
</ul>
</footer>
</div>
Loading

0 comments on commit f888547

Please sign in to comment.