Skip to content

Commit f02fd07

Browse files
committed
Add spell preparation controls to spell list
1 parent 1d748fe commit f02fd07

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

module/sheets/actor-sheet.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,17 @@ export class BasicFantasyRPGActorSheet extends ActorSheet {
197197
li.slideUp(200, () => this.render(false));
198198
});
199199

200+
// Prepare Spells
201+
html.find('.spell-prepare').click(ev => {
202+
const change = event.currentTarget.dataset.change;
203+
if (parseInt(change)) {
204+
const li = $(ev.currentTarget).parents(".item");
205+
const item = this.actor.items.get(li.data("itemId"));
206+
let newValue = item.data.data.prepared.value + parseInt(change);
207+
item.update({"data.prepared.value": newValue});
208+
}
209+
});
210+
200211
// Active Effect management
201212
html.find(".effect-control").click(ev => onManageActiveEffect(ev, this.actor));
202213

templates/actor/parts/actor-spells.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
</div>
2828
<h4>{{item.name}}</h4>
2929
</div>
30-
<div class="item-prop">{{localize item.data.prepared.label}}: {{item.data.prepared.value}}</div>
30+
<div class="item-prop grid grid-3col">
31+
<div class="flex-group-right"><a class="item-control spell-prepare" data-change="-1"><i class="fas fa-minus"></i></a></div>
32+
<div class="flex-group-center">{{item.data.prepared.value}}</div>
33+
<div class="flex-group-left"><a class="item-control spell-prepare" data-change="+1"><i class="fas fa-plus"></i></a></div>
34+
</div>
3135
<div class="item-controls">
3236
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
3337
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>

0 commit comments

Comments
 (0)