v0.1.9
This commit is contained in:
@@ -9,12 +9,12 @@ export class VermineActorSheet extends ActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["vermine2047", "sheet", "actor"],
|
||||
/*classes: ["vermine2047", "sheet", "actor"],
|
||||
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
|
||||
height: 800,
|
||||
width: 690,
|
||||
resizable: false,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]*/
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export class VermineCharacterSheet extends VermineActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["vermine2047", "sheet", "actor"],
|
||||
classes: ["vermine2047", "sheet", "character", "actor"],
|
||||
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
|
||||
width: 600,
|
||||
height: 600,
|
||||
|
||||
@@ -10,10 +10,10 @@ export class VermineCreatureSheet extends ActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["vermine2047", "sheet", "actor"],
|
||||
classes: ["vermine2047", "sheet", "actor", "creature"],
|
||||
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
|
||||
width: 600,
|
||||
height: 600,
|
||||
width: 300,
|
||||
height: 300,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
|
||||
});
|
||||
}
|
||||
@@ -92,6 +92,33 @@ export class VermineCreatureSheet extends ActorSheet {
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
html.find('.item-create').click(this._onItemCreate.bind(this));
|
||||
}
|
||||
|
||||
async _onItemCreate(event) {
|
||||
event.preventDefault();
|
||||
const header = event.currentTarget;
|
||||
// Get the type of item to create.
|
||||
const type = header.dataset.type;
|
||||
// Grab any data associated with this control.
|
||||
const data = duplicate(header.dataset);
|
||||
// Initialize a default name.
|
||||
// const name = `New ${type.capitalize()}`;
|
||||
const name = game.i18n.localize('ITEMS.new_' + type);
|
||||
|
||||
console.log('onItemCreate child', data.type, this.actor.type);
|
||||
// Prepare the item object.
|
||||
const itemData = {
|
||||
name: name,
|
||||
type: type,
|
||||
system: data
|
||||
};
|
||||
// Remove the type from the dataset since it's in the itemData.type prop.
|
||||
delete itemData.system["type"];
|
||||
|
||||
// Finally, create the item!
|
||||
return await Item.create(itemData, {parent: this.actor});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ export class VermineItemSheet extends ItemSheet {
|
||||
// Add the actor's data to context.data for easier access, as well as flags.
|
||||
context.system = itemData.system;
|
||||
context.flags = itemData.flags;
|
||||
context.config = CONFIG.VERMINE;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
+14
-43
@@ -11,10 +11,10 @@ export class VermineGroupSheet extends VermineActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["vermine2047", "sheet", "actor"],
|
||||
classes: ["vermine2047", "sheet", "actor", "group"],
|
||||
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
|
||||
width: 600,
|
||||
height: 600,
|
||||
width: 500,
|
||||
height: 500,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
|
||||
});
|
||||
}
|
||||
@@ -88,41 +88,19 @@ export class VermineGroupSheet extends VermineActorSheet {
|
||||
* @return {undefined}
|
||||
*/
|
||||
_prepareItems(context) {
|
||||
// Initialize containers.
|
||||
const abilities = [];
|
||||
const specialties = [];
|
||||
const backgrounds = [];
|
||||
const evolutions = [];
|
||||
const traumas = [];
|
||||
context.specialties = this.actor.itemTypes['specialty'];
|
||||
context.backgrounds = this.actor.itemTypes['background'];
|
||||
context.evolutions = this.actor.itemTypes['evolution'];
|
||||
context.traumas = this.actor.itemTypes['trauma'];
|
||||
|
||||
context.gear = this.actor.itemTypes['item'];
|
||||
context.weapons = this.actor.itemTypes['weapon'];
|
||||
context.defenses = this.actor.itemTypes['defense'];
|
||||
context.vehicles = this.actor.itemTypes['vehicle'];
|
||||
|
||||
context.totem_abilities = this.actor.itemTypes['ability'].filter(i=>i.system.type === 'totem');
|
||||
context.abilities = this.actor.itemTypes['ability'].filter(i=>i.system.type !== 'totem');
|
||||
|
||||
// Iterate through items, allocating to containers
|
||||
for (let i of context.items) {
|
||||
i.img = i.img || DEFAULT_TOKEN;
|
||||
if (i.type === 'ability') {
|
||||
abilities.push(i);
|
||||
}
|
||||
else if (i.type === 'specialty') {
|
||||
specialties.push(i);
|
||||
}
|
||||
else if (i.type === 'background') {
|
||||
backgrounds.push(i);
|
||||
}
|
||||
else if (i.type === 'evolution') {
|
||||
evolutions.push(i);
|
||||
}
|
||||
else if (i.type === 'trauma') {
|
||||
traumas.push(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Assign and return
|
||||
context.abilities = abilities;
|
||||
context.specialties = specialties;
|
||||
context.backgrounds = backgrounds;
|
||||
context.evolutions = evolutions;
|
||||
context.traumas = traumas;
|
||||
context.members = [];
|
||||
context.encounters = [];
|
||||
|
||||
@@ -134,13 +112,6 @@ export class VermineGroupSheet extends VermineActorSheet {
|
||||
context.encounters.push(game.actors.get(encounterId));
|
||||
}
|
||||
|
||||
context.gear = this.actor.itemTypes['item'];
|
||||
context.weapons = this.actor.itemTypes['weapon'];
|
||||
context.defenses = this.actor.itemTypes['defense'];
|
||||
context.vehicles = this.actor.itemTypes['vehicle'];
|
||||
|
||||
context.totem_abilities = this.actor.itemTypes['ability'].filter(i=>i.type !== 'totem');
|
||||
context.abilities = this.actor.itemTypes['ability'].filter(i=>i.type === 'totem');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ export class VermineNpcSheet extends VermineActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["vermine2047", "sheet", "actor"],
|
||||
classes: ["vermine2047", "sheet", "actor", "npc"],
|
||||
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
|
||||
width: 600,
|
||||
height: 600,
|
||||
width: 400,
|
||||
height: 400,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user