Generic roll and update items
This commit is contained in:
parent
3d70f556fb
commit
b4b41f5c96
@ -200,15 +200,19 @@ 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('.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 => {
|
html.find('.perk-active').click(ev => {
|
||||||
const li = $(ev.currentTarget).parents(".item");
|
const li = $(ev.currentTarget).parents(".item");
|
||||||
this.actor.activatePerk( li.data("item-id") );
|
this.actor.activatePerk( li.data("item-id") );
|
||||||
this.render(true);
|
this.render(true);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/** @override */
|
/** @override */
|
||||||
setPosition(options = {}) {
|
setPosition(options = {}) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { PegasusUtility } from "./pegasus-utility.js";
|
import { PegasusUtility } from "./pegasus-utility.js";
|
||||||
import { PegasusActor } from "./pegasus-actor.js";
|
import { PegasusActor } from "./pegasus-actor.js";
|
||||||
import { PegasusActorSheet } from "./pegasus-actor-sheet.js";
|
import { PegasusActorSheet } from "./pegasus-actor-sheet.js";
|
||||||
|
import { PegasusItemSheet } from "./pegasus-item-sheet.js";
|
||||||
|
|
||||||
export class PegasusActorCreate {
|
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 ) {
|
manageSelectableStats( race ) {
|
||||||
this.raceSelectableStats = {
|
this.raceSelectableStats = {
|
||||||
|
@ -128,10 +128,11 @@ export class PegasusUtility {
|
|||||||
static async chatListeners(html) {
|
static async chatListeners(html) {
|
||||||
|
|
||||||
html.on("click", '.chat-create-actor', event => {
|
html.on("click", '.chat-create-actor', event => {
|
||||||
console.log("Event !")
|
|
||||||
game.system.pegasus.creator.processChatEvent(event);
|
game.system.pegasus.creator.processChatEvent(event);
|
||||||
} );
|
} );
|
||||||
|
html.on("click", '.view-item-from-chat', event => {
|
||||||
|
game.system.pegasus.creator.openItemView( event)
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -188,6 +188,15 @@
|
|||||||
<div class="tab fight" data-group="primary" data-tab="combat">
|
<div class="tab fight" data-group="primary" data-tab="combat">
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li class="item flexrow list-item" data-key="nrg">
|
||||||
|
<span class="stat-label flexrow" name="nrg"><h4>{{data.nrg.label}}</h4> </span>
|
||||||
|
<input type="text" class="padd-right update-field" data-field-name="data.nrg.activated" value="{{data.nrg.activated}}" data-dtype="Number"/>
|
||||||
|
<input type="text" class="padd-right update-field" data-field-name="data.nrg.value" value="{{data.nrg.value}}" data-dtype="Number"/>
|
||||||
|
<input type="text" class="padd-right update-field" data-field-name="data.nrg.max" value="{{data.nrg.max}}" data-dtype="Number"/>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<span class="generic-label">
|
<span class="generic-label">
|
||||||
<h3>Basic Actions</h3>
|
<h3>Basic Actions</h3>
|
||||||
</span>
|
</span>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<table class="table-create-actor">
|
<table class="table-create-actor">
|
||||||
{{#each races as |race index|}}
|
{{#each races as |race index|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{race.name}}</td>
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{race._id}}">{{race.name}}</a></td>
|
||||||
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{race._id}}" >Select it !</a></td>
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{race._id}}" >Select it !</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -25,7 +25,7 @@
|
|||||||
<table class="table-create-actor">
|
<table class="table-create-actor">
|
||||||
{{#each optionnalabilities as |ability index|}}
|
{{#each optionnalabilities as |ability index|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ability.name}}</td>
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{ability._id}}">{{ability.name}}</a></td>
|
||||||
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{ability._id}}" >Select it !</a></td>
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{ability._id}}" >Select it !</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -56,19 +56,13 @@
|
|||||||
</table>
|
</table>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if (eq step "select-race-perks-all")}}
|
|
||||||
<div>Select {{nbperks}} from the Perks Compendium. Once done, click the button below<br>
|
|
||||||
<a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-stat-key="{{key}}" >Race Perks selected!</a>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if (eq step "select-race-perks")}}
|
{{#if (eq step "select-race-perks")}}
|
||||||
<div>Now select {{nbraceperks}} Perk(s) for your character
|
<div>Now select {{nbraceperks}} Perk(s) for your character
|
||||||
</div>
|
</div>
|
||||||
<table class="table-create-actor">
|
<table class="table-create-actor">
|
||||||
{{#each raceperks as |perk index|}}
|
{{#each raceperks as |perk index|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{perk.name}}</td>
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{perk._id}}">{{perk.name}}</a></td>
|
||||||
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{perk._id}}" >Select it !</a></td>
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{perk._id}}" >Select it !</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -81,7 +75,7 @@
|
|||||||
<table class="table-create-actor">
|
<table class="table-create-actor">
|
||||||
{{#each roles as |role index|}}
|
{{#each roles as |role index|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{role.name}}</td>
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{role._id}}">{{role.name}}</a></td>
|
||||||
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{role._id}}" >Select it !</a></td>
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{role._id}}" >Select it !</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -94,7 +88,7 @@
|
|||||||
<table class="table-create-actor">
|
<table class="table-create-actor">
|
||||||
{{#each rolestartspec as |spec index|}}
|
{{#each rolestartspec as |spec index|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{spec.name}}</td>
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{spec._id}}">{{spec.name}}</a></td>
|
||||||
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{spec._id}}" >Select it !</a></td>
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{spec._id}}" >Select it !</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -120,7 +114,7 @@
|
|||||||
<table class="table-create-actor">
|
<table class="table-create-actor">
|
||||||
{{#each rolespec as |spec index|}}
|
{{#each rolespec as |spec index|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{spec.name}}</td>
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{spec._id}}">{{spec.name}}</a></td>
|
||||||
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{spec._id}}" >Select it !</a></td>
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{spec._id}}" >Select it !</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
@ -133,7 +127,7 @@
|
|||||||
<table class="table-create-actor">
|
<table class="table-create-actor">
|
||||||
{{#each roleperks as |perk index|}}
|
{{#each roleperks as |perk index|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{perk.name}}</td>
|
<td><a class="view-item-from-chat" data-step="{{@root.step}}" data-item-id="{{perk._id}}">{{perk.name}}</a></td>
|
||||||
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{perk._id}}" >Select it !</a></td>
|
<td><a class="chat-card-button chat-create-actor" data-step-name="{{@root.step}}" data-item-id="{{perk._id}}" >Select it !</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
Loading…
Reference in New Issue
Block a user