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.actor.equipItem( li.data("item-id") );
this.render(true); 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 => { html.find('.update-field').change(ev => {
const fieldName = $(ev.currentTarget).data("field-name"); const fieldName = $(ev.currentTarget).data("field-name");
let value = ev.currentTarget.value; let value = ev.currentTarget.value;

View File

@ -194,6 +194,15 @@ export class PegasusActor extends Actor {
} }
} }
/* -------------------------------------------- */
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) { async equipItem(itemId) {
let item = this.data.items.find(item => item.id == itemId); let item = this.data.items.find(item => item.id == itemId);

View File

@ -312,6 +312,8 @@
</span> </span>
<span class="stat-label outfit-label">{{#if power.data.activated}}Activated{{/if}}</span> <span class="stat-label outfit-label">{{#if power.data.activated}}Activated{{/if}}</span>
<div class="item-controls"> <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-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> <a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div> </div>