Updates for 0.8.x (#118)
* Merge tag '2.17' into development (#117) * Updates for 0.8.x Updates for 0.8.x Co-authored-by: megastruktur <astromortis@gmail.com>
This commit is contained in:
parent
0a47fd9ef8
commit
ea0e308891
15 changed files with 150 additions and 94 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/.idea/*
|
|
@ -9,7 +9,7 @@ export class BladesActorSheet extends BladesSheet {
|
|||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["blades-in-the-dark", "sheet", "actor"],
|
||||
template: "systems/blades-in-the-dark/templates/actor-sheet.html",
|
||||
width: 700,
|
||||
|
@ -23,6 +23,10 @@ export class BladesActorSheet extends BladesSheet {
|
|||
/** @override */
|
||||
getData() {
|
||||
var data = super.getData();
|
||||
data.editable = this.options.editable;
|
||||
const actorData = data.data;
|
||||
data.actor = actorData;
|
||||
data.data = actorData.data;
|
||||
|
||||
// Calculate Load
|
||||
let loadout = 0;
|
||||
|
@ -76,14 +80,14 @@ export class BladesActorSheet extends BladesSheet {
|
|||
// Update Inventory Item
|
||||
html.find('.item-body').click(ev => {
|
||||
const element = $(ev.currentTarget).parents(".item");
|
||||
const item = this.actor.getOwnedItem(element.data("itemId"));
|
||||
const item = this.actor.items.get(element.data("itemId"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
html.find('.item-delete').click( async ev => {
|
||||
const element = $(ev.currentTarget).parents(".item");
|
||||
this.actor.deleteOwnedItem(element.data("itemId"));
|
||||
await this.actor.deleteEmbeddedDocuments("Item", [element.data("itemId")]);
|
||||
element.slideUp(200, () => this.render(false));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ export class BladesActor extends Actor {
|
|||
switch (data.type) {
|
||||
case 'character':
|
||||
case 'crew':
|
||||
case '\uD83D\uDD5B clock':
|
||||
data.token.actorLink = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return super.create(data, options);
|
||||
}
|
||||
|
||||
|
@ -41,14 +41,14 @@ export class BladesActor extends Actor {
|
|||
|
||||
// Calculate Dice to throw.
|
||||
let dice_amount = {};
|
||||
for (var attibute_name in this.data.data.attributes) {
|
||||
dice_amount[attibute_name] = 0;
|
||||
for (var skill_name in this.data.data.attributes[attibute_name].skills) {
|
||||
dice_amount[skill_name] = parseInt(this.data.data.attributes[attibute_name].skills[skill_name]['value'][0])
|
||||
for (var attribute_name in this.data.data.attributes) {
|
||||
dice_amount[attribute_name] = 0;
|
||||
for (var skill_name in this.data.data.attributes[attribute_name].skills) {
|
||||
dice_amount[skill_name] = parseInt(this.data.data.attributes[attribute_name].skills[skill_name]['value'][0])
|
||||
|
||||
// We add a +1d for every skill higher than 0.
|
||||
if (dice_amount[skill_name] > 0) {
|
||||
dice_amount[attibute_name]++;
|
||||
dice_amount[attribute_name]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,11 +107,11 @@ export class BladesActor extends Actor {
|
|||
yes: {
|
||||
icon: "<i class='fas fa-check'></i>",
|
||||
label: game.i18n.localize('BITD.Roll'),
|
||||
callback: (html) => {
|
||||
callback: async (html) => {
|
||||
let modifier = parseInt(html.find('[name="mod"]')[0].value);
|
||||
let position = html.find('[name="pos"]')[0].value;
|
||||
let effect = html.find('[name="fx"]')[0].value;
|
||||
this.rollAttribute(attribute_name, modifier, position, effect);
|
||||
await this.rollAttribute(attribute_name, modifier, position, effect);
|
||||
}
|
||||
},
|
||||
no: {
|
||||
|
@ -126,7 +126,7 @@ export class BladesActor extends Actor {
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
rollAttribute(attribute_name = "", additional_dice_amount = 0, position, effect) {
|
||||
async rollAttribute(attribute_name = "", additional_dice_amount = 0, position, effect) {
|
||||
|
||||
let dice_amount = 0;
|
||||
if (attribute_name !== "") {
|
||||
|
@ -138,7 +138,7 @@ export class BladesActor extends Actor {
|
|||
}
|
||||
dice_amount += additional_dice_amount;
|
||||
|
||||
bladesRoll(dice_amount, attribute_name, position, effect);
|
||||
await bladesRoll(dice_amount, attribute_name, position, effect);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
|
|
@ -9,7 +9,7 @@ export class BladesClockSheet extends BladesSheet {
|
|||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["blades-in-the-dark", "sheet", "actor"],
|
||||
template: "systems/blades-in-the-dark/templates/actors/clock-sheet.html",
|
||||
width: 700,
|
||||
|
@ -20,13 +20,24 @@ export class BladesClockSheet extends BladesSheet {
|
|||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
async _updateObject(event, formData) {
|
||||
getData() {
|
||||
var data = super.getData();
|
||||
data.editable = this.options.editable;
|
||||
const actorData = data.data;
|
||||
data.actor = actorData;
|
||||
data.data = actorData.data;
|
||||
return data;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
async _updateObject(event, formData) {
|
||||
let image_path = `/systems/blades-in-the-dark/styles/assets/progressclocks-svg/Progress Clock ${formData['data.type']}-${formData['data.value']}.svg`;
|
||||
formData['img'] = image_path;
|
||||
formData['token.img'] = image_path;
|
||||
|
||||
let data = {
|
||||
let data = [];
|
||||
let update = {
|
||||
img: image_path,
|
||||
width: 1,
|
||||
height: 1,
|
||||
|
@ -38,10 +49,15 @@ export class BladesClockSheet extends BladesSheet {
|
|||
};
|
||||
|
||||
let tokens = this.actor.getActiveTokens();
|
||||
|
||||
tokens.forEach(function(token) {
|
||||
token.update(data);
|
||||
tokens.forEach( function( token ) {
|
||||
data.push(
|
||||
foundry.utils.mergeObject(
|
||||
{ _id: token.id },
|
||||
update
|
||||
)
|
||||
);
|
||||
});
|
||||
await TokenDocument.updateDocuments( data, { parent: game.scenes.current } )
|
||||
|
||||
// Update the Actor
|
||||
return this.object.update(formData);
|
||||
|
|
|
@ -8,7 +8,7 @@ export class BladesCrewSheet extends BladesSheet {
|
|||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["blades-in-the-dark", "sheet", "actor"],
|
||||
template: "systems/blades-in-the-dark/templates/crew-sheet.html",
|
||||
width: 940,
|
||||
|
@ -22,6 +22,10 @@ export class BladesCrewSheet extends BladesSheet {
|
|||
/** @override */
|
||||
getData() {
|
||||
const data = super.getData();
|
||||
data.editable = this.options.editable;
|
||||
const actorData = data.data;
|
||||
data.actor = actorData;
|
||||
data.data = actorData.data;
|
||||
|
||||
// Calculate Turfs amount.
|
||||
// We already have Lair, so set to -1.
|
||||
|
@ -56,14 +60,14 @@ export class BladesCrewSheet extends BladesSheet {
|
|||
// Update Inventory Item
|
||||
html.find('.item-sheet-open').click(ev => {
|
||||
const element = $(ev.currentTarget).parents(".item");
|
||||
const item = this.actor.getOwnedItem(element.data("itemId"));
|
||||
const item = this.actor.items.get(element.data("itemId"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
html.find('.item-delete').click( async ev => {
|
||||
const element = $(ev.currentTarget).parents(".item");
|
||||
this.actor.deleteOwnedItem(element.data("itemId"));
|
||||
await this.actor.deleteEmbeddedDocuments("Item", [element.data("itemId")]);
|
||||
element.slideUp(200, () => this.render(false));
|
||||
});
|
||||
|
||||
|
@ -73,7 +77,7 @@ export class BladesCrewSheet extends BladesSheet {
|
|||
});
|
||||
|
||||
// Toggle Turf
|
||||
html.find('.turf-select').click(ev => {
|
||||
html.find('.turf-select').click( async ev => {
|
||||
const element = $(ev.currentTarget).parents(".item");
|
||||
|
||||
let item_id = element.data("itemId")
|
||||
|
@ -81,22 +85,22 @@ export class BladesCrewSheet extends BladesSheet {
|
|||
let turf_current_status = $(ev.currentTarget).data("turfStatus");
|
||||
let turf_checkbox_name = 'data.turfs.' + turf_id + '.value';
|
||||
|
||||
this.actor.updateEmbeddedEntity('OwnedItem', {
|
||||
await this.actor.updateEmbeddedDocuments('Item', [{
|
||||
_id: item_id,
|
||||
[turf_checkbox_name]: !turf_current_status});
|
||||
[turf_checkbox_name]: !turf_current_status}]);
|
||||
this.render(false);
|
||||
});
|
||||
|
||||
// Cohort Block Harm handler
|
||||
html.find('.cohort-block-harm input[type="radio"]').change(ev => {
|
||||
html.find('.cohort-block-harm input[type="radio"]').change( async ev => {
|
||||
const element = $(ev.currentTarget).parents(".item");
|
||||
|
||||
let item_id = element.data("itemId")
|
||||
let harm_id = $(ev.currentTarget).val();
|
||||
|
||||
this.actor.updateEmbeddedEntity('OwnedItem', {
|
||||
await this.actor.updateEmbeddedDocuments('Item', [{
|
||||
_id: item_id,
|
||||
"data.harm": [harm_id]});
|
||||
"data.harm": [harm_id]}]);
|
||||
this.render(false);
|
||||
});
|
||||
}
|
||||
|
@ -109,7 +113,7 @@ export class BladesCrewSheet extends BladesSheet {
|
|||
async _updateObject(event, formData) {
|
||||
|
||||
// Update the Item
|
||||
super._updateObject(event, formData);
|
||||
await super._updateObject(event, formData);
|
||||
|
||||
if (event.target && event.target.name === "data.tier") {
|
||||
this.render(true);
|
||||
|
|
|
@ -8,7 +8,7 @@ export class BladesFactionSheet extends BladesSheet {
|
|||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["blades-in-the-dark", "sheet", "actor"],
|
||||
template: "systems/blades-in-the-dark/templates/faction-sheet.html",
|
||||
width: 900,
|
||||
|
@ -16,9 +16,21 @@ export class BladesFactionSheet extends BladesSheet {
|
|||
tabs: [{navSelector: ".tabs", contentSelector: ".tab-content"}]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
getData() {
|
||||
const data = super.getData();
|
||||
data.editable = this.options.editable;
|
||||
const actorData = data.data;
|
||||
data.actor = actorData;
|
||||
data.data = actorData.data;
|
||||
return data;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
@ -29,14 +41,14 @@ export class BladesFactionSheet extends BladesSheet {
|
|||
// Update Inventory Item
|
||||
html.find('.item-body').click(ev => {
|
||||
const element = $(ev.currentTarget).parents(".item");
|
||||
const item = this.actor.getOwnedItem(element.data("itemId"));
|
||||
const item = this.actor.items.get(element.data("itemId"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
html.find('.item-delete').click( async ev => {
|
||||
const element = $(ev.currentTarget).parents(".item");
|
||||
this.actor.deleteOwnedItem(element.data("itemId"));
|
||||
await this.actor.deleteEmbeddedDocuments("Item", [element.data("itemId")]);
|
||||
element.slideUp(200, () => this.render(false));
|
||||
});
|
||||
|
||||
|
|
|
@ -12,12 +12,14 @@ export class BladesHelpers {
|
|||
let should_be_distinct = distinct_types.includes(item_data.type);
|
||||
// If the Item has the exact same name - remove it from list.
|
||||
// Remove Duplicate items from the array.
|
||||
let update = [];
|
||||
actor.items.forEach(i => {
|
||||
let has_double = (item_data.type === i.data.type);
|
||||
if (i.data.name === item_data.name || (should_be_distinct && has_double)) {
|
||||
actor.deleteOwnedItem(i.id);
|
||||
update.push(i.id);
|
||||
}
|
||||
});
|
||||
actor.deleteEmbeddedDocuments("Item", update);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +38,7 @@ export class BladesHelpers {
|
|||
}
|
||||
|
||||
if (logic) {
|
||||
let logic_update = { "_id": entity.data._id };
|
||||
let logic_update = { "_id": entity.id };
|
||||
logic.forEach(expression => {
|
||||
|
||||
// Different logic behav. dep on operator.
|
||||
|
@ -44,7 +46,7 @@ export class BladesHelpers {
|
|||
|
||||
// Add when creating.
|
||||
case "addition":
|
||||
mergeObject(
|
||||
foundry.utils.mergeObject(
|
||||
logic_update,
|
||||
{[expression.attribute]: Number(BladesHelpers.getNestedProperty(entity, prefix + expression.attribute)) + expression.value},
|
||||
{insertKeys: true}
|
||||
|
@ -53,7 +55,7 @@ export class BladesHelpers {
|
|||
|
||||
// Change name property.
|
||||
case "attribute_change":
|
||||
mergeObject(
|
||||
foundry.utils.mergeObject(
|
||||
logic_update,
|
||||
{[expression.attribute]: expression.value},
|
||||
{insertKeys: true}
|
||||
|
@ -62,7 +64,7 @@ export class BladesHelpers {
|
|||
|
||||
}
|
||||
});
|
||||
await Actor.update( logic_update );
|
||||
await Actor.updateDocuments( logic_update );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,7 +90,7 @@ export class BladesHelpers {
|
|||
}
|
||||
|
||||
if (logic) {
|
||||
let logic_update = { "_id": entity.data._id };
|
||||
let logic_update = { "_id": entity.id };
|
||||
var entity_data = entity.data;
|
||||
|
||||
logic.forEach(expression => {
|
||||
|
@ -97,7 +99,7 @@ export class BladesHelpers {
|
|||
|
||||
// Subtract when removing.
|
||||
case "addition":
|
||||
mergeObject(
|
||||
foundry.utils.mergeObject(
|
||||
logic_update,
|
||||
{[expression.attribute]: Number(BladesHelpers.getNestedProperty(entity, prefix + expression.attribute)) - expression.value},
|
||||
{insertKeys: true}
|
||||
|
@ -110,7 +112,7 @@ export class BladesHelpers {
|
|||
let default_expression_attribute_path = expression.attribute + '_default';
|
||||
let default_name = default_expression_attribute_path.split(".").reduce((o, i) => o[i], entity_data);
|
||||
|
||||
mergeObject(
|
||||
foundry.utils.mergeObject(
|
||||
logic_update,
|
||||
{[expression.attribute]: default_name},
|
||||
{insertKeys: true}
|
||||
|
@ -119,7 +121,7 @@ export class BladesHelpers {
|
|||
break;
|
||||
}
|
||||
});
|
||||
await Actor.update( logic_update );
|
||||
await Actor.updateDocuments( logic_update );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,7 +152,7 @@ export class BladesHelpers {
|
|||
name: randomID(),
|
||||
type: item_type
|
||||
};
|
||||
return actor.createEmbeddedEntity("OwnedItem", data);
|
||||
return actor.createEmbeddedDocuments("Item", [data]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,7 +170,7 @@ export class BladesHelpers {
|
|||
game_items = game.items.filter(e => e.type === item_type).map(e => {return e.data});
|
||||
|
||||
let pack = game.packs.find(e => e.metadata.name === item_type);
|
||||
let compendium_content = await pack.getContent();
|
||||
let compendium_content = await pack.getDocuments();
|
||||
compendium_items = compendium_content.map(e => {return e.data});
|
||||
|
||||
list_of_items = game_items.concat(compendium_items);
|
||||
|
@ -189,10 +191,10 @@ export class BladesHelpers {
|
|||
let attribute_labels = {};
|
||||
const attributes = game.system.model.Actor.character.attributes;
|
||||
|
||||
for (var attibute_name in attributes) {
|
||||
attribute_labels[attibute_name] = attributes[attibute_name].label;
|
||||
for (var skill_name in attributes[attibute_name].skills) {
|
||||
attribute_labels[skill_name] = attributes[attibute_name].skills[skill_name].label;
|
||||
for (var attribute_name in attributes) {
|
||||
attribute_labels[attribute_name] = attributes[attribute_name].label;
|
||||
for (var skill_name in attributes[attribute_name].skills) {
|
||||
attribute_labels[skill_name] = attributes[attribute_name].skills[skill_name].label;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ export class BladesItemSheet extends ItemSheet {
|
|||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["blades-in-the-dark", "sheet", "item"],
|
||||
width: 560,
|
||||
height: 'auto',
|
||||
|
@ -46,6 +46,10 @@ export class BladesItemSheet extends ItemSheet {
|
|||
getData() {
|
||||
const data = super.getData();
|
||||
data.isGm = game.user.isGM;
|
||||
data.editable = this.options.editable;
|
||||
const itemData = data.data;
|
||||
data.actor = itemData;
|
||||
data.data = itemData.data;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ export class BladesNPCSheet extends BladesSheet {
|
|||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["blades-in-the-dark", "sheet", "actor"],
|
||||
template: "systems/blades-in-the-dark/templates/npc-sheet.html",
|
||||
width: 900,
|
||||
|
@ -16,10 +16,22 @@ export class BladesNPCSheet extends BladesSheet {
|
|||
tabs: [{navSelector: ".tabs", contentSelector: ".tab-content"}]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
getData() {
|
||||
const data = super.getData();
|
||||
data.editable = this.options.editable;
|
||||
const actorData = data.data;
|
||||
data.actor = actorData;
|
||||
data.data = actorData.data;
|
||||
return data;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
|
@ -29,14 +41,14 @@ export class BladesNPCSheet extends BladesSheet {
|
|||
// Update Inventory Item
|
||||
// html.find('.item-body').click(ev => {
|
||||
// const element = $(ev.currentTarget).parents(".item");
|
||||
// const item = this.actor.getOwnedItem(element.data("itemId"));
|
||||
// const item = this.actor.items.get(element.data("itemId"));
|
||||
// item.sheet.render(true);
|
||||
// });
|
||||
|
||||
// // Delete Inventory Item
|
||||
// html.find('.item-delete').click(ev => {
|
||||
// const element = $(ev.currentTarget).parents(".item");
|
||||
// this.actor.deleteOwnedItem(element.data("itemId"));
|
||||
// this.actor.deleteEmbeddedDocuments("Item", [element.data("itemId")]);
|
||||
// element.slideUp(200, () => this.render(false));
|
||||
// });
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ export async function bladesRoll(dice_amount, attribute_name = "", position = "r
|
|||
let r = new Roll( `${dice_amount}d6`, {} );
|
||||
|
||||
// show 3d Dice so Nice if enabled
|
||||
r.roll();
|
||||
showChatRollMessage(r, zeromode, attribute_name, position, effect);
|
||||
r.evaluate({async:true});
|
||||
await showChatRollMessage(r, zeromode, attribute_name, position, effect);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,7 +88,7 @@ async function showChatRollMessage(r, zeromode, attribute_name = "", position =
|
|||
roll: r
|
||||
}
|
||||
|
||||
CONFIG.ChatMessage.entityClass.create(messageData, {})
|
||||
CONFIG.ChatMessage.documentClass.create(messageData, {})
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -234,9 +234,9 @@ export async function simpleRollPopup() {
|
|||
yes: {
|
||||
icon: "<i class='fas fa-check'></i>",
|
||||
label: `Roll`,
|
||||
callback: (html) => {
|
||||
callback: async (html) => {
|
||||
let diceQty = html.find('[name="qty"]')[0].value;
|
||||
bladesRoll(diceQty);
|
||||
await bladesRoll(diceQty);
|
||||
},
|
||||
},
|
||||
no: {
|
||||
|
|
|
@ -65,7 +65,7 @@ export class BladesSheet extends ActorSheet {
|
|||
one: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: game.i18n.localize('Add'),
|
||||
callback: () => this.addItemsToSheet(item_type, $(document).find('#items-to-add'))
|
||||
callback: async () => await this.addItemsToSheet(item_type, $(document).find('#items-to-add'))
|
||||
},
|
||||
two: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
|
@ -85,11 +85,12 @@ export class BladesSheet extends ActorSheet {
|
|||
|
||||
let items = await BladesHelpers.getAllItemsByType(item_type, game);
|
||||
let items_to_add = [];
|
||||
el.find("input:checked").each(function() {
|
||||
|
||||
el.find("input:checked").each(function() {
|
||||
items_to_add.push(items.find(e => e._id === $(this).val()));
|
||||
});
|
||||
this.actor.createEmbeddedEntity("OwnedItem", items_to_add);
|
||||
|
||||
await Item.create(items_to_add, {parent: this.document});
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
|
||||
|
@ -114,18 +115,18 @@ export class BladesSheet extends ActorSheet {
|
|||
if ( update_value == undefined) {
|
||||
update_value = document.getElementById('fac-' + update_type + '-' + item_id).value;
|
||||
};
|
||||
|
||||
var update;
|
||||
if ( update_type == "status" ) {
|
||||
var update = {_id: item_id, data:{status:{value: update_value}}};
|
||||
update = {_id: item_id, data:{status:{value: update_value}}};
|
||||
}
|
||||
else if (update_type == "hold") {
|
||||
var update = {_id: item_id, data:{hold:{value: update_value}}};
|
||||
update = {_id: item_id, data:{hold:{value: update_value}}};
|
||||
} else {
|
||||
console.log("update attempted for type undefined in blades-sheet.js onUpdateBoxClick function");
|
||||
return;
|
||||
};
|
||||
console.log(update);
|
||||
await this.actor.updateEmbeddedEntity("OwnedItem", update);
|
||||
|
||||
await this.actor.updateEmbeddedDocuments("Item", [update]);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@ Hooks.once("init", async function() {
|
|||
dice: bladesRoll
|
||||
}
|
||||
|
||||
CONFIG.Item.entityClass = BladesItem;
|
||||
CONFIG.Actor.entityClass = BladesActor;
|
||||
CONFIG.Item.documentClass = BladesItem;
|
||||
CONFIG.Actor.documentClass = BladesActor;
|
||||
|
||||
// Register System Settings
|
||||
registerSystemSettings();
|
||||
|
@ -46,7 +46,7 @@ Hooks.once("init", async function() {
|
|||
Actors.registerSheet("blades", BladesNPCSheet, { types: ["npc"], makeDefault: true });
|
||||
Items.unregisterSheet("core", ItemSheet);
|
||||
Items.registerSheet("blades", BladesItemSheet, {makeDefault: true});
|
||||
preloadHandlebarsTemplates();
|
||||
await preloadHandlebarsTemplates();
|
||||
|
||||
Actors.registeredSheets.forEach(element => console.log(element.Actor.name));
|
||||
|
||||
|
@ -150,7 +150,7 @@ Hooks.once("init", async function() {
|
|||
|
||||
let text = options.hash['text'].replace(/\n/g, "<br />");
|
||||
|
||||
return new Handlebars.SafeString(text);;
|
||||
return new Handlebars.SafeString(text);
|
||||
});
|
||||
|
||||
// "N Times" loop for handlebars.
|
||||
|
@ -284,22 +284,22 @@ Hooks.once("ready", function() {
|
|||
/*
|
||||
* Hooks
|
||||
*/
|
||||
Hooks.on("preCreateOwnedItem", (parent_entity, child_data, options, userId) => {
|
||||
Hooks.on("preCreateItem", (item, data, options, userId) => {
|
||||
|
||||
BladesHelpers.removeDuplicatedItemType(child_data, parent_entity);
|
||||
BladesHelpers.removeDuplicatedItemType(data, item.parent);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
Hooks.on("createOwnedItem", async (parent_entity, child_data, options, userId) => {
|
||||
Hooks.on("createItem", async (item, options, userId) => {
|
||||
|
||||
await BladesHelpers.callItemLogic(child_data, parent_entity);
|
||||
await BladesHelpers.callItemLogic(item.data, item.parent);
|
||||
return true;
|
||||
});
|
||||
|
||||
Hooks.on("deleteOwnedItem", async (parent_entity, child_data, options, userId) => {
|
||||
Hooks.on("deleteItem", async (item, options, userId) => {
|
||||
|
||||
await BladesHelpers.undoItemLogic(child_data, parent_entity);
|
||||
await BladesHelpers.undoItemLogic(item.data, item.parent);
|
||||
return true;
|
||||
});
|
||||
// getSceneControlButtons
|
||||
|
|
|
@ -6,7 +6,7 @@ export const migrateWorld = async function() {
|
|||
ui.notifications.info(`Applying BITD Actors migration for version ${game.system.data.version}. Please be patient and do not close your game or shut down your server.`, {permanent: true});
|
||||
|
||||
// Migrate World Actors
|
||||
for ( let a of game.actors.entities ) {
|
||||
for ( let a of game.actors.contents ) {
|
||||
if (a.data.type === 'character') {
|
||||
try {
|
||||
const updateData = _migrateActor(a.data);
|
||||
|
@ -35,7 +35,7 @@ export const migrateWorld = async function() {
|
|||
}
|
||||
|
||||
// Migrate Actor Link
|
||||
for ( let s of game.scenes.entities ) {
|
||||
for ( let s of game.scenes.contents ) {
|
||||
try {
|
||||
const updateData = _migrateSceneData(s.data);
|
||||
if ( !isObjectEmpty(updateData) ) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<div class="flexcol blades-clock-name-type">
|
||||
{{#if editable}}
|
||||
<input type="text" id="{{actor._id}}-clock-name" name="name" value="{{actor.name}}">
|
||||
<input type="text" id="{{actor.id}}-clock-name" name="name" value="{{actor.name}}">
|
||||
|
||||
<select data-type="String" name="data.type">
|
||||
{{#select data.type}}
|
||||
|
@ -14,7 +14,7 @@
|
|||
{{/if}}
|
||||
|
||||
<div class="clocks clocks-{{data.type}}">
|
||||
{{{blades-clock "data.value" data.type data.value item._id}}}
|
||||
{{{blades-clock "data.value" data.type data.value item.id}}}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
|
@ -1,16 +1,16 @@
|
|||
<form class="{{cssClass}} actor-sheet" autocomplete="off">
|
||||
<img src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="100" width="100"/>
|
||||
<input type="text" id="character-{{actor._id}}-name" name="name"value="{{actor.name}} ">
|
||||
<input type="text" id="character-{{actor._id}}-name" name="name" value="{{actor.name}} ">
|
||||
<label for="character-{{actor._id}}-name">Name</label>
|
||||
<input type="text" id="character-{{actor._id}}-short-description" name="data.description_short"value="{{data.description_short}} ">
|
||||
<input type="text" id="character-{{actor._id}}-short-description" name="data.description_short" value="{{data.description_short}} ">
|
||||
<label for="character-{{actor._id}}-short-description">Short description</label>
|
||||
<input type="text" id="character-{{actor._id}}-associated-class" name="data.associated_class"value="{{data.associated_class}} ">
|
||||
<input type="text" id="character-{{actor._id}}-associated-class" name="data.associated_class" value="{{data.associated_class}} ">
|
||||
<label for="character-{{actor._id}}-associated-class">Associated Class</label>
|
||||
<input type="text" id="character-{{actor._id}}-description" name="data.description"value="{{data.description}} ">
|
||||
<input type="text" id="character-{{actor._id}}-description" name="data.description" value="{{data.description}} ">
|
||||
<label for="character-{{actor._id}}-description">Description</label>
|
||||
<input type="text" id="character-{{actor._id}}-associated-class" name="data.associated_crew_type"value="{{data.associated_crew_type}} ">
|
||||
<input type="text" id="character-{{actor._id}}-associated-crew-type" name="data.associated_crew_type" value="{{data.associated_crew_type}} ">
|
||||
<label for="character-{{actor._id}}-associated-crew-type">Associated Crew Type</label>
|
||||
<input type="text" id="character-{{actor._id}}-notes" name="data.notes"value="{{data.notes}} ">
|
||||
<input type="text" id="character-{{actor._id}}-notes" name="data.notes" value="{{data.notes}} ">
|
||||
<label for="character-{{actor._id}}-notes">Notes</label>
|
||||
<input type="text" id="character-{{actor._id}}-associated-faction" name="data.associated_faction" value="{{data.associated_faction}}" >
|
||||
<label for="character-{{actor._id}}-associated-faction">Associated Faction</label>
|
||||
|
|
Reference in a new issue