forked from public/bol
Avancement feuille de personnage
Avancement feuille d'items Ajout des données JSON pour génération des compendiums.
This commit is contained in:
@ -17,29 +17,6 @@ export class BoLActorSheet extends ActorSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
getData(options) {
|
||||
console.debug("getData");
|
||||
const actor = super.getData(options);
|
||||
console.log(actor.data);
|
||||
actor.data.details = actor.data.data.details;
|
||||
actor.data.attributes = Object.values(actor.data.data.attributes);
|
||||
actor.data.aptitudes = Object.values(actor.data.data.aptitudes);
|
||||
actor.data.resources = Object.values(actor.data.data.resources);
|
||||
actor.data.equipment = actor.data.items.filter(i => i.type === "item" || i.type == 'weapon' || i.type == 'armor');
|
||||
actor.data.weapons = duplicate(actor.data.items.filter(i => i.type == 'weapon' ));
|
||||
actor.data.armors = duplicate(actor.data.items.filter(i => i.type == 'armor' ));
|
||||
actor.data.features = {
|
||||
"origin" : actor.data.items.find(i => i.type === "feature" && i.data.subtype === "origin"),
|
||||
"race" : actor.data.items.find(i => i.type === "feature" && i.data.subtype === "race"),
|
||||
"careers" : actor.data.items.filter(i => i.type === "feature" && i.data.subtype === "career"),
|
||||
"boons" : actor.data.items.filter(i => i.type === "feature" && i.data.subtype === "boon"),
|
||||
"flaws" : actor.data.items.filter(i => i.type === "feature" && i.data.subtype === "flaw")
|
||||
};
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
@ -59,7 +36,7 @@ export class BoLActorSheet extends ActorSheet {
|
||||
});
|
||||
html.find('.roll-attribute').click(ev => {
|
||||
this.actor.rollAttributeAptitude( $(ev.currentTarget).data("attr-key") );
|
||||
});
|
||||
});
|
||||
html.find('.roll-career').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
this.actor.rollCareer( li.data("itemId") );
|
||||
@ -68,7 +45,10 @@ export class BoLActorSheet extends ActorSheet {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
this.actor.rollWeapon( li.data("itemId") );
|
||||
});
|
||||
|
||||
|
||||
// Equip/Unequip item
|
||||
html.find('.item-equip').click(this._onToggleEquip.bind(this));
|
||||
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
@ -82,6 +62,56 @@ export class BoLActorSheet extends ActorSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
getData(options) {
|
||||
console.debug("getData");
|
||||
const actor = super.getData(options);
|
||||
console.log(actor.data);
|
||||
actor.data.details = actor.data.data.details;
|
||||
actor.data.attributes = Object.values(actor.data.data.attributes);
|
||||
actor.data.aptitudes = Object.values(actor.data.data.aptitudes);
|
||||
actor.data.resources = Object.values(actor.data.data.resources);
|
||||
actor.data.equipment = actor.data.items.filter(i => i.type === "item" || i.type == 'weapon' || i.type == 'armor');
|
||||
actor.data.weapons = duplicate(actor.data.items.filter(i => i.type == 'weapon' ));
|
||||
actor.data.armors = duplicate(actor.data.items.filter(i => i.type == 'armor' ));
|
||||
|
||||
actor.data.features = {
|
||||
"careers" : {
|
||||
"label" : "BOL.featureCategory.careers",
|
||||
"ranked" : true,
|
||||
"items" : actor.data.items.filter(i => i.type === "feature" && i.data.subtype === "career")
|
||||
},
|
||||
"origins" : {
|
||||
"label" : "BOL.featureCategory.origins",
|
||||
"ranked" : false,
|
||||
"items" : actor.data.items.filter(i => i.type === "feature" && i.data.subtype === "origin")
|
||||
},
|
||||
"races" : {
|
||||
"label" : "BOL.featureCategory.races",
|
||||
"ranked" : false,
|
||||
"items" : actor.data.items.filter(i => i.type === "feature" && i.data.subtype === "race")
|
||||
},
|
||||
"boons" : {
|
||||
"label" : "BOL.featureCategory.boons",
|
||||
"ranked" : false,
|
||||
"items" : actor.data.items.filter(i => i.type === "feature" && i.data.subtype === "boon")
|
||||
},
|
||||
"flaws" : {
|
||||
"label" : "BOL.featureCategory.flaws",
|
||||
"ranked" : false,
|
||||
"items" : actor.data.items.filter(i => i.type === "feature" && i.data.subtype === "flaw")
|
||||
},
|
||||
"languages" : {
|
||||
"label" : "BOL.featureCategory.languages",
|
||||
"ranked" : false,
|
||||
"items" : actor.data.items.filter(i => i.type === "feature" && i.data.subtype === "language")
|
||||
}
|
||||
};
|
||||
|
||||
return actor;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Handle creating a new Owned Item for the actor using initial data defined in the HTML dataset
|
||||
* @param {Event} event The originating click event
|
||||
@ -109,6 +139,14 @@ export class BoLActorSheet extends ActorSheet {
|
||||
return this.actor.createEmbeddedDocuments("Item", [itemData]);
|
||||
}
|
||||
|
||||
|
||||
_onToggleEquip(event) {
|
||||
event.preventDefault();
|
||||
const li = $(event.currentTarget).closest(".item");
|
||||
const item = this.actor.items.get(li.data("itemId"));
|
||||
return this.actor.toggleEquipItem(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle clickable rolls.
|
||||
* @param {Event} event The originating click event
|
||||
@ -129,4 +167,12 @@ export class BoLActorSheet extends ActorSheet {
|
||||
}
|
||||
}
|
||||
|
||||
/** @override */
|
||||
setPosition(options = {}) {
|
||||
const position = super.setPosition(options);
|
||||
const sheetBody = this.element.find(".sheet-body");
|
||||
const bodyHeight = position.height - 192;
|
||||
sheetBody.css("height", bodyHeight);
|
||||
return position;
|
||||
}
|
||||
}
|
||||
|
@ -153,5 +153,21 @@ export class BoLActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} item
|
||||
* @param {*} bypassChecks
|
||||
* @returns
|
||||
*/
|
||||
toggleEquipItem(item) {
|
||||
const equipable = item.data.data.properties.equipable;
|
||||
if(equipable){
|
||||
let itemData = duplicate(item.data);
|
||||
itemData.data.worn = !itemData.data.worn;
|
||||
return item.update(itemData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -10,22 +10,22 @@ export class BoLItemSheet extends ItemSheet {
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["bol", "sheet", "item"],
|
||||
template: "systems/bol/templates/item/item-sheet.hbs",
|
||||
width: 520,
|
||||
height: 480,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }]
|
||||
});
|
||||
}
|
||||
|
||||
/** @override */
|
||||
get template() {
|
||||
const path = "systems/bol/templates/item";
|
||||
// Return a single sheet for all item types.
|
||||
//return `${path}/item-sheet.hbs`;
|
||||
// Alternatively, you could use the following return statement to do a
|
||||
// unique item sheet by type, like `weapon-sheet.html`.
|
||||
|
||||
return `${path}/item-${this.item.data.type}-sheet.hbs`;
|
||||
}
|
||||
// /** @override */
|
||||
// get template() {
|
||||
// const path = "systems/bol/templates/item";
|
||||
// // Return a single sheet for all item types.
|
||||
// //return `${path}/item-sheet.hbs`;
|
||||
// // Alternatively, you could use the following return statement to do a
|
||||
// // unique item sheet by type, like `weapon-sheet.html`.
|
||||
// return `${path}/item-${this.item.data.type}-sheet.hbs`;
|
||||
// }
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
@ -69,10 +69,8 @@ export class BoLItemSheet extends ItemSheet {
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
// Roll handlers, click handlers, etc. would go here.
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ export class BoLUtility {
|
||||
actor.saveRollData( rollData );
|
||||
|
||||
this.createChatWithRollMode( rollData.alias, {
|
||||
content: await renderTemplate(`systems/bol/templates/roll/chat-generic-result.hbs`, rollData)
|
||||
content: await renderTemplate(`systems/bol/templates/chat/chat-generic-result.hbs`, rollData)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -9,66 +9,93 @@ System.debugMode = true;
|
||||
|
||||
export const BOL = {};
|
||||
|
||||
BOL.itemProperties = {
|
||||
"equipable": "BOL.properties.equipable",
|
||||
"stackable": "BOL.properties.stackable",
|
||||
"unique": "BOL.properties.unique",
|
||||
"tailored": "BOL.properties.tailored",
|
||||
"2h": "BOL.properties.2H",
|
||||
"predilection": "BOL.properties.predilection",
|
||||
"ranged": "BOL.properties.ranged",
|
||||
"proficient": "BOL.properties.proficient",
|
||||
"finesse": "BOL.properties.finesse",
|
||||
"two-handed": "BOL.properties.two-handed",
|
||||
"equipment": "BOL.properties.equipment",
|
||||
"weapon": "BOL.properties.weapon",
|
||||
"protection": "BOL.properties.protection",
|
||||
"reloadable": "BOL.properties.reloadable",
|
||||
"bow": "BOL.properties.bow",
|
||||
"crossbow": "BOL.properties.crossbow",
|
||||
"powder": "BOL.properties.powder",
|
||||
"throwing": "BOL.properties.throwing",
|
||||
"dr": "BOL.properties.dr",
|
||||
"sneak": "BOL.properties.sneak",
|
||||
"powerful": "BOL.properties.powerful",
|
||||
"critscience": "BOL.properties.critscience",
|
||||
"specialization": "BOL.properties.specialization",
|
||||
"effects": "BOL.properties.effects",
|
||||
"activable": "BOL.properties.activable",
|
||||
"2H": "BOL.properties.2H",
|
||||
"13strmin": "BOL.properties.13strmin",
|
||||
"bashing": "BOL.properties.bashing",
|
||||
"sling": "BOL.properties.sling",
|
||||
"spell": "BOL.properties.spell",
|
||||
"profile": "BOL.properties.profile",
|
||||
"prestige": "BOL.properties.prestige",
|
||||
"alternative": "BOL.properties.alternative",
|
||||
"consumable": "BOL.properties.consumable",
|
||||
"racial": "BOL.properties.racial",
|
||||
"creature" : "BOL.properties.creature"
|
||||
};
|
||||
|
||||
BOL.itemCategories = {
|
||||
"other": "BOL.category.other",
|
||||
"armor": "BOL.category.armor",
|
||||
"shield": "BOL.category.shield",
|
||||
"melee": "BOL.category.melee",
|
||||
"ranged": "BOL.category.ranged",
|
||||
"spell": "BOL.category.spell",
|
||||
"jewel": "BOL.category.jewel",
|
||||
"scroll": "BOL.category.scroll",
|
||||
"wand": "BOL.category.wand",
|
||||
"ammunition": "BOL.category.ammunition",
|
||||
"consumable": "BOL.category.consumable",
|
||||
"container": "BOL.category.container",
|
||||
"mount": "BOL.category.mount",
|
||||
"currency": "BOL.category.currency",
|
||||
"trapping": "BOL.category.trapping"
|
||||
"equipment" : "BOL.itemCategory.equipment",
|
||||
"consumable" : "BOL.itemCategory.consumable",
|
||||
"spell" : "BOL.itemCategory.spell",
|
||||
"mount" : "BOL.itemCategory.mount",
|
||||
"vehicle" : "BOL.itemCategory.vehicle",
|
||||
"other" : "BOL.itemCategory.other"
|
||||
}
|
||||
|
||||
BOL.equipmentCategory = {
|
||||
"weapon" : "BOL.equipmentCategory.weapon",
|
||||
"protection" : "BOL.equipmentCategory.protection",
|
||||
"jewel" : "BOL.equipmentCategory.jewel",
|
||||
"scroll" : "BOL.equipmentCategory.scroll",
|
||||
"ammunition" : "BOL.equipmentCategory.ammunition",
|
||||
"container" : "BOL.equipmentCategory.container",
|
||||
"currency" : "BOL.equipmentCategory.currency",
|
||||
"other" : "BOL.equipmentCategory.other"
|
||||
}
|
||||
|
||||
BOL.protectionCategory = {
|
||||
"armor" : "BOL.protectionCategory.armor",
|
||||
"shield" : "BOL.protectionCategory.shield",
|
||||
"helm" : "BOL.protectionCategory.helm",
|
||||
"other" : "BOL.protectionCategory.other"
|
||||
}
|
||||
|
||||
BOL.weaponCategory = {
|
||||
"melee" : "BOL.weaponCategory.melee",
|
||||
"ranged" : "BOL.weaponCategory.ranged",
|
||||
"other" : "BOL.weaponCategory.other"
|
||||
}
|
||||
|
||||
BOL.itemProperty = {
|
||||
"equipable" : "BOL.itemProperty.equipable",
|
||||
"protection" : "BOL.itemProperty.protection",
|
||||
"blocking" : "BOL.itemProperty.blocking",
|
||||
"magical" : "BOL.itemProperty.magical",
|
||||
"concealable" : "BOL.itemProperty.concealable",
|
||||
"2H" : "BOL.itemProperty.2H",
|
||||
"helm" : "BOL.itemProperty.helm",
|
||||
"improvised" : "BOL.itemProperty.improvised",
|
||||
"shield" : "BOL.itemProperty.shield",
|
||||
"melee" : "BOL.itemProperty.melee",
|
||||
"throwable" : "BOL.itemProperty.throwable",
|
||||
"ignoreshield" : "BOL.itemProperty.ignoreshield",
|
||||
"bashing" : "BOL.itemProperty.bashing",
|
||||
"stackable" : "BOL.itemProperty.stackable",
|
||||
"ranged" : "BOL.itemProperty.ranged",
|
||||
"weapon" : "BOL.itemProperty.weapon",
|
||||
"reloadable" : "BOL.itemProperty.reloadable",
|
||||
"worn" : "BOL.itemProperty.worn"
|
||||
}
|
||||
|
||||
BOL.itemStat = {
|
||||
"quantity" : "BOL.itemStat.quantity",
|
||||
"weight" : "BOL.itemStat.weight",
|
||||
"price" : "BOL.itemStat.price",
|
||||
"range" : "BOL.itemStat.range",
|
||||
"damage" : "BOL.itemStat.damage",
|
||||
"reload" : "BOL.itemStat.reload",
|
||||
"soak" : "BOL.itemStat.soak",
|
||||
"blocking" : "BOL.itemStat.blocking",
|
||||
"modifiers" : "BOL.itemStat.modifiers"
|
||||
}
|
||||
|
||||
BOL.itemModifiers = {
|
||||
"init" : "BOL.itemModifiers.init",
|
||||
"social" : "BOL.itemModifiers.social",
|
||||
"agility" : "BOL.itemModifiers.agility",
|
||||
"powercost" : "BOL.itemModifiers.powercost"
|
||||
}
|
||||
|
||||
BOL.itemBlocking = {
|
||||
"malus" : "BOL.itemBlocking.malus",
|
||||
"nbAttacksPerRound" : "BOL.itemBlocking.nbAttacksPerRound"
|
||||
}
|
||||
|
||||
BOL.itemSoak = {
|
||||
"formula" : "BOL.itemSoak.formula",
|
||||
"value" : "BOL.itemSoak.value"
|
||||
}
|
||||
|
||||
BOL.itemIcons = {
|
||||
"item": "icons/containers/chest/chest-worn-oak-tan.webp",
|
||||
"capacity":"icons/sundries/scrolls/scroll-plain-tan-red.webp",
|
||||
"capacity": "icons/sundries/scrolls/scroll-plain-tan-red.webp",
|
||||
"species": "icons/environment/people/group.webp",
|
||||
"profile": "icons/sundries/documents/blueprint-axe.webp",
|
||||
"path": "icons/sundries/books/book-embossed-gold-red.webp"
|
||||
@ -76,7 +103,7 @@ BOL.itemIcons = {
|
||||
|
||||
BOL.actorIcons = {
|
||||
"npc": "icons/environment/people/commoner.webp",
|
||||
"encounter":"icons/svg/mystery-man-black.svg",
|
||||
"encounter": "icons/svg/mystery-man-black.svg",
|
||||
"loot": "icons/containers/bags/sack-simple-leather-brown.webp"
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,20 @@ export const preloadHandlebarsTemplates = async function () {
|
||||
|
||||
// Define template paths to load
|
||||
const templatePaths = [
|
||||
// ACTORS
|
||||
"systems/bol/templates/actor/parts/actor-header.hbs",
|
||||
"systems/bol/templates/actor/parts/tabs/actor-stats.hbs",
|
||||
"systems/bol/templates/actor/parts/tabs/actor-combat.hbs",
|
||||
"systems/bol/templates/actor/parts/tabs/actor-features.hbs",
|
||||
"systems/bol/templates/actor/parts/tabs/actor-equipment.hbs",
|
||||
// ITEMS
|
||||
"systems/bol/templates/item/parts/item-header.hbs",
|
||||
"systems/bol/templates/item/parts/properties/feature-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/equipment-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/armor-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/melee-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/ranged-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item-properties.hbs"
|
||||
];
|
||||
|
||||
// Load the template parts
|
||||
|
Reference in New Issue
Block a user