forked from public/bol
Support des propriétés d'items
Amélioration de l'interface Améliorations cosmétiques
This commit is contained in:
@ -11,8 +11,8 @@ export class BoLItemSheet extends ItemSheet {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["bol", "sheet", "item"],
|
||||
template: "systems/bol/templates/item/item-sheet.hbs",
|
||||
width: 520,
|
||||
height: 480,
|
||||
width: 650,
|
||||
height: 750,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }]
|
||||
});
|
||||
}
|
||||
@ -30,31 +30,17 @@ export class BoLItemSheet extends ItemSheet {
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/** @override */
|
||||
getData() {
|
||||
const objectData = BoLUtility.data(this.item);
|
||||
// const objectData = BoLUtility.data(this.object);
|
||||
|
||||
let itemData = foundry.utils.deepClone(BoLUtility.templateData(this.item));
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: this.id,
|
||||
config: game.bol.config,
|
||||
type: objectData.type,
|
||||
img: objectData.img,
|
||||
name: objectData.name,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
data: itemData,
|
||||
limited: this.object.limited,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
isGM: game.user.isGM,
|
||||
itemProperties : this.item.itemProperties
|
||||
|
||||
}
|
||||
console.log("ITEMDATA", formData);
|
||||
this.options.editable = !(this.object.data.origin == "embeddedItem");
|
||||
return formData;
|
||||
getData(options) {
|
||||
const data = super.getData(options);
|
||||
const itemData = data.data;
|
||||
data.config = game.bol.config;
|
||||
data.item = itemData;
|
||||
data.data = itemData.data;
|
||||
data.category = itemData.category;
|
||||
data.itemProperties = this.item.itemProperties;
|
||||
data.isGM = game.user.isGM;
|
||||
console.log("ITEMDATA", data);
|
||||
return data;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -76,6 +62,13 @@ export class BoLItemSheet extends ItemSheet {
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
// Roll handlers, click handlers, etc. would go here.
|
||||
|
||||
html.find('.armorQuality').change(ev => {
|
||||
const li = $(ev.currentTarget);
|
||||
console.log(game.bol.config.soakFormulas[li.val()]);
|
||||
$('.soakFormula').val(game.bol.config.soakFormulas[li.val()]);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ export class BoLItem extends Item {
|
||||
const props = [];
|
||||
if ( this.data.type === "item" ) {
|
||||
const entries = Object.entries(this.data.data.properties);
|
||||
props.push(...entries.filter(e => e[1] === true).map(e => { return game.bol.config.itemProperties[e[0]] }));
|
||||
props.push(...entries.filter(e => e[1] === true).map(e => { return game.bol.config.itemProperties2[e[0]] }));
|
||||
}
|
||||
return props.filter(p => !!p);
|
||||
}
|
||||
|
@ -9,23 +9,95 @@ System.debugMode = true;
|
||||
|
||||
export const BOL = {};
|
||||
|
||||
BOL.damageValues = {
|
||||
"d3" : "d3",
|
||||
"d6M" : "d6M (Malus)",
|
||||
"d6" : "d6",
|
||||
"d6B" : "d6B (Bonus)",
|
||||
"d6BB" : "d6B + dé bonus",
|
||||
}
|
||||
|
||||
BOL.armorQualities = {
|
||||
"none" : "BOL.armorQuality.none",
|
||||
"light" : "BOL.armorQuality.light",
|
||||
"lightQ" : "BOL.armorQuality.lightQ",
|
||||
"lightSup" : "BOL.armorQuality.lightSup",
|
||||
"lightLeg" : "BOL.armorQuality.lightLeg",
|
||||
"medium" : "BOL.armorQuality.medium",
|
||||
"mediumQ" : "BOL.armorQuality.mediumQ",
|
||||
"mediumSup" : "BOL.armorQuality.mediumSup",
|
||||
"mediumLeg" : "BOL.armorQuality.mediumLeg",
|
||||
"heavy" : "BOL.armorQuality.heavy",
|
||||
"heavyQ" : "BOL.armorQuality.heavyQ",
|
||||
"heavySup" : "BOL.armorQuality.heavySup",
|
||||
"heavyLeg" : "BOL.armorQuality.heavyLeg"
|
||||
}
|
||||
|
||||
BOL.soakFormulas = {
|
||||
"none" : "0",
|
||||
"light" : "1d6-3",
|
||||
"lightQ" : "1d6r1-3",
|
||||
"lightSup" : "1d6-2",
|
||||
"lightLeg" : "2d6kh1-2",
|
||||
"medium" : "1d6-2",
|
||||
"mediumQ" : "1d6r1-2",
|
||||
"mediumSup" : "1d6-1",
|
||||
"mediumLeg" : "2d6kh1-1",
|
||||
"heavy" : "1d6-1",
|
||||
"heavyQ" : "1d6r1-1",
|
||||
"heavySup" : "1d6",
|
||||
"heavyLeg" : "2d6kh1"
|
||||
}
|
||||
|
||||
BOL.attackAttributes = {
|
||||
"vigor" : "BOL.attributes.vigor",
|
||||
"agility" : "BOL.attributes.agility",
|
||||
"mind" : "BOL.attributes.mind",
|
||||
"appeal" : "BOL.attributes.appeal"
|
||||
}
|
||||
|
||||
BOL.attackAptitudes = {
|
||||
"melee" : "BOL.aptitudes.melee",
|
||||
"ranged" : "BOL.aptitudes.ranged"
|
||||
}
|
||||
|
||||
BOL.aptitudes = {
|
||||
"melee" : "BOL.aptitudes.melee",
|
||||
"ranged" : "BOL.aptitudes.ranged",
|
||||
"init" : "BOL.aptitudes.init",
|
||||
"def" : "BOL.aptitudes.def"
|
||||
}
|
||||
|
||||
BOL.damageAttributes = {
|
||||
"vigor" : "BOL.attributes.vigor",
|
||||
"agility" : "BOL.attributes.agility",
|
||||
"mind" : "BOL.attributes.mind",
|
||||
"appeal" : "BOL.attributes.appeal"
|
||||
}
|
||||
|
||||
BOL.itemCategories = {
|
||||
"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.equipmentCategories = {
|
||||
"weapon" : "BOL.equipmentCategory.weapon",
|
||||
BOL.itemSubtypes = {
|
||||
"equipment" : "BOL.equipmentCategory.equipment",
|
||||
"protection" : "BOL.equipmentCategory.protection",
|
||||
"weapon" : "BOL.equipmentCategory.weapon",
|
||||
"magical" : "BOL.equipmentCategory.magical"
|
||||
}
|
||||
|
||||
BOL.equipmentCategories = {
|
||||
"armor" : "BOL.equipmentCategory.armor",
|
||||
"weapon" : "BOL.equipmentCategory.weapon",
|
||||
"shield" : "BOL.equipmentCategory.shield",
|
||||
"helm" : "BOL.equipmentCategory.helm",
|
||||
"jewel" : "BOL.equipmentCategory.jewel",
|
||||
"scroll" : "BOL.equipmentCategory.scroll",
|
||||
"ammunition" : "BOL.equipmentCategory.ammunition",
|
||||
"container" : "BOL.equipmentCategory.container",
|
||||
"ammunition" : "BOL.equipmentCategory.ammunition",
|
||||
"currency" : "BOL.equipmentCategory.currency",
|
||||
"other" : "BOL.equipmentCategory.other"
|
||||
}
|
||||
@ -43,7 +115,14 @@ BOL.weaponCategories = {
|
||||
"other" : "BOL.weaponCategory.other"
|
||||
}
|
||||
|
||||
BOL.itemProperties = {
|
||||
BOL.itemProperties1 = {
|
||||
"equipable" : "BOL.itemProperty.equipable",
|
||||
"protection" : "BOL.itemProperty.protection",
|
||||
"magical" : "BOL.itemProperty.magical",
|
||||
"worn" : "BOL.itemProperty.worn",
|
||||
}
|
||||
|
||||
BOL.itemProperties2 = {
|
||||
"equipable" : "BOL.itemProperty.equipable",
|
||||
"protection" : "BOL.itemProperty.protection",
|
||||
"blocking" : "BOL.itemProperty.blocking",
|
||||
@ -62,6 +141,15 @@ BOL.itemProperties = {
|
||||
"weapon" : "BOL.itemProperty.weapon",
|
||||
"reloadable" : "BOL.itemProperty.reloadable",
|
||||
"worn" : "BOL.itemProperty.worn",
|
||||
"spell" : "BOL.itemProperty.spell",
|
||||
"armor" : "BOL.itemProperty.armor",
|
||||
"consumable" : "BOL.itemProperty.consumable",
|
||||
"bow" : "BOL.itemProperty.bow",
|
||||
"crossbow" : "BOL.itemProperty.crossbow",
|
||||
"throwing" : "BOL.itemProperty.throwing",
|
||||
"activable" : "BOL.itemProperty.activable",
|
||||
"powder" : "BOL.itemProperty.powder",
|
||||
"damage" : "BOL.itemProperty.damage"
|
||||
}
|
||||
|
||||
BOL.itemStats = {
|
||||
|
@ -56,6 +56,10 @@ export const registerHandlebarsHelpers = function () {
|
||||
return val1 || val2;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('or3', function (val1, val2, val3) {
|
||||
return val1 || val2 || val3;
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('not', function (cond) {
|
||||
return !cond;
|
||||
});
|
||||
@ -100,4 +104,10 @@ export const registerHandlebarsHelpers = function () {
|
||||
return array.includes(val);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper('eval', function (expr) {
|
||||
return eval(expr);
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
export default function registerHooks() {
|
||||
|
||||
Hooks.on("renderPause", ((_app, html) => {
|
||||
html.find("img").attr("src", "systems/bol/ui/pause2.webp")
|
||||
}))
|
||||
/**
|
||||
* Create a macro when dropping an entity on the hotbar
|
||||
* Item - open roll dialog for item
|
||||
|
@ -19,11 +19,8 @@ export const preloadHandlebarsTemplates = async function () {
|
||||
"systems/bol/templates/item/parts/properties/item-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/equipment-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/protection-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/shield-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/weapon-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/armor-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/melee-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/ranged-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/magical-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/feature/career-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/feature/boon-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/feature/flaw-properties.hbs",
|
||||
|
Reference in New Issue
Block a user