diff --git a/modules/pegasus-actor-sheet.js b/modules/pegasus-actor-sheet.js
index 42da1a0..2230601 100644
--- a/modules/pegasus-actor-sheet.js
+++ b/modules/pegasus-actor-sheet.js
@@ -200,15 +200,19 @@ export class PegasusActorSheet extends ActorSheet {
this.actor.equipItem( 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;
+ this.actor.update( { [`${fieldName}`]: value } );
+ });
html.find('.perk-active').click(ev => {
const li = $(ev.currentTarget).parents(".item");
this.actor.activatePerk( li.data("item-id") );
- this.render(true);
-
+ this.render(true);
});
}
-
+
/* -------------------------------------------- */
/** @override */
setPosition(options = {}) {
diff --git a/modules/pegasus-create-char.js b/modules/pegasus-create-char.js
index d723bf8..90480cd 100644
--- a/modules/pegasus-create-char.js
+++ b/modules/pegasus-create-char.js
@@ -1,6 +1,7 @@
import { PegasusUtility } from "./pegasus-utility.js";
import { PegasusActor } from "./pegasus-actor.js";
import { PegasusActorSheet } from "./pegasus-actor-sheet.js";
+import { PegasusItemSheet } from "./pegasus-item-sheet.js";
export class PegasusActorCreate {
@@ -176,6 +177,42 @@ export class PegasusActorCreate {
}
}
+ /* -------------------------------------------- */
+ async openItemView( event) {
+ let step = $(event.currentTarget).data("step");
+ let itemId = $(event.currentTarget).data("item-id");
+ let itemData
+
+ if ( step == 'select-race') {
+ itemData = this.races.find( item => item._id == itemId );
+ }
+ if ( step == 'select-race-optionnal') {
+ itemData = this.raceOptionnalAbilities.optionnalabilities.find( item => item._id == itemId );
+ }
+ if ( step == 'select-race-perks') {
+ itemData = this.perks.find( item => item._id == itemId );
+ }
+ if ( step == 'select-race-perks'){
+ itemData = this.racePerks.find( item => item._id == itemId );
+ }
+ if ( step == 'select-role') {
+ itemData = this.roles.find( item => item._id == itemId );
+ }
+ if ( step == 'select-role-start-spec') {
+ itemData = this.roleSpecStart.find( item => item._id == itemId );
+ }
+ if (step == 'select-role-spec') {
+ itemData = this.roleSpec.find( item => item._id == itemId );
+ }
+ if (step == 'select-role-perk') {
+ itemData = this.rolePerks.find( item => item._id == itemId );
+ }
+ if (itemData) {
+ let item = await Item.create(itemData, {temporary: true});
+ new PegasusItemSheet(item).render(true);
+ }
+ }
+
/* -------------------------------------------- */
manageSelectableStats( race ) {
this.raceSelectableStats = {
diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js
index 3d507af..bdeec9a 100644
--- a/modules/pegasus-utility.js
+++ b/modules/pegasus-utility.js
@@ -128,10 +128,11 @@ export class PegasusUtility {
static async chatListeners(html) {
html.on("click", '.chat-create-actor', event => {
- console.log("Event !")
game.system.pegasus.creator.processChatEvent(event);
} );
-
+ html.on("click", '.view-item-from-chat', event => {
+ game.system.pegasus.creator.openItemView( event)
+ } );
}
/* -------------------------------------------- */
diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html
index 8592010..d2f5534 100644
--- a/templates/actor-sheet.html
+++ b/templates/actor-sheet.html
@@ -188,6 +188,15 @@
+
+
Basic Actions
diff --git a/templates/chat-create-actor.html b/templates/chat-create-actor.html
index 17d0800..3b2a9af 100644
--- a/templates/chat-create-actor.html
+++ b/templates/chat-create-actor.html
@@ -11,7 +11,7 @@
{{#each races as |race index|}}
- {{race.name}} |
+ {{race.name}} |
Select it ! |
{{/each}}
@@ -25,7 +25,7 @@
{{/if}}
- {{#if (eq step "select-race-perks-all")}}
- Select {{nbperks}} from the Perks Compendium. Once done, click the button below
-
Race Perks selected!
-
- {{/if}}
-
{{#if (eq step "select-race-perks")}}
Now select {{nbraceperks}} Perk(s) for your character