This commit is contained in:
sladecraven 2022-01-16 16:12:15 +01:00
parent f9d3916f3f
commit 7a05d66d0b
3 changed files with 17 additions and 0 deletions

View File

@ -192,6 +192,12 @@ export class PegasusActorSheet extends ActorSheet {
this.actor.equipItem( li.data("item-id") );
this.render(true);
});
html.find('.power-activate').click(ev => {
const li = $(ev.currentTarget).parents(".item");
this.actor.activatePower( li.data("item-id") );
this.render(true);
});
html.find('.update-field').change(ev => {
const fieldName = $(ev.currentTarget).data("field-name");
let value = ev.currentTarget.value;

View File

@ -193,6 +193,15 @@ export class PegasusActor extends Actor {
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
}
}
/* -------------------------------------------- */
async activatePower(itemId) {
let item = this.data.items.find(item => item.id == itemId);
if (item && item.data.data) {
let update = { _id: item.id, "data.activated": !item.data.data.activated };
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
}
}
/* -------------------------------------------- */
async equipItem(itemId) {

View File

@ -312,6 +312,8 @@
</span>
<span class="stat-label outfit-label">{{#if power.data.activated}}Activated{{/if}}</span>
<div class="item-controls">
<a class="item-control power-activate" title="Worn">{{#if power.data.activated}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>