Support des propriétés d'items
Amélioration de l'interface d'édition d'items
This commit is contained in:
@@ -38,11 +38,53 @@ export class BoLActorSheet extends ActorSheet {
|
||||
// Equip/Unequip item
|
||||
html.find('.item-equip').click(this._onToggleEquip.bind(this));
|
||||
|
||||
// Incr./Decr. career ranks
|
||||
html.find(".inc-dec-btns").click((ev) => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
if(li){
|
||||
const item = this.actor.items.get(li.data("itemId"));
|
||||
if(item){
|
||||
const dataset = ev.currentTarget.dataset;
|
||||
const operator = dataset.operator;
|
||||
const target = dataset.target;
|
||||
const incr = parseInt(dataset.incr);
|
||||
const min = parseInt(dataset.min);
|
||||
const max = parseInt(dataset.max);
|
||||
const itemData = item.data;
|
||||
let value = eval("itemData."+target);
|
||||
if(operator === "minus"){
|
||||
if(value >= min + incr) value -= incr;
|
||||
else value = min;
|
||||
}
|
||||
if(operator === "plus"){
|
||||
if(value <= max - incr) value += incr;
|
||||
else value = max;
|
||||
}
|
||||
let update = {};
|
||||
update[target] = value;
|
||||
item.update(update);
|
||||
}
|
||||
}
|
||||
// const input = html.find("#" + type);
|
||||
// let value = parseInt(input.val(), 10) || 0;
|
||||
// value += operator === "plus" ? 1 : -1;
|
||||
// input.val(value > 0 ? value : 0);
|
||||
});
|
||||
|
||||
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
this.actor.deleteEmbeddedDocuments("Item", [li.data("itemId")])
|
||||
li.slideUp(200, () => this.render(false));
|
||||
Dialog.confirm({
|
||||
title: "Suppression",
|
||||
content: `Vous êtes sûr de vouloir supprimer cet item ?`,
|
||||
yes: () => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
this.actor.deleteEmbeddedDocuments("Item", [li.data("itemId")])
|
||||
li.slideUp(200, () => this.render(false));
|
||||
},
|
||||
no: () => {},
|
||||
defaultYes: false,
|
||||
});
|
||||
});
|
||||
|
||||
// Rollable abilities.
|
||||
@@ -65,17 +107,28 @@ export class BoLActorSheet extends ActorSheet {
|
||||
|
||||
/** @override */
|
||||
getData(options) {
|
||||
const actorData = super.getData(options);
|
||||
actorData.data = {
|
||||
details : this.actor.details,
|
||||
attributes : this.actor.attributes,
|
||||
aptitudes : this.actor.aptitudes,
|
||||
resources : this.actor.resources,
|
||||
equipment : this.actor.equipment,
|
||||
combat : this.actor.buildCombat(),
|
||||
features : this.actor.buildFeatures()
|
||||
};
|
||||
return actorData;
|
||||
const data = super.getData(options);
|
||||
const actorData = data.data;
|
||||
data.config = game.bol.config;
|
||||
data.data = actorData.data;
|
||||
data.details = this.actor.details;
|
||||
data.attributes = this.actor.attributes;
|
||||
data.aptitudes = this.actor.aptitudes;
|
||||
data.resources = this.actor.resources;
|
||||
data.equipment = this.actor.equipment;
|
||||
data.weapons = this.actor.weapons;
|
||||
data.protections = this.actor.protections;
|
||||
data.containers = this.actor.containers;
|
||||
data.treasure = this.actor.treasure;
|
||||
data.vehicles = this.actor.vehicles;
|
||||
data.ammos = this.actor.ammos;
|
||||
data.misc = this.actor.misc;
|
||||
data.combat = this.actor.buildCombat();
|
||||
data.features = this.actor.buildFeatures();
|
||||
data.isGM = game.user.isGM;
|
||||
|
||||
console.log("ACTORDATA", data);
|
||||
return data;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
|
||||
|
@@ -68,27 +68,50 @@ export class BoLActor extends Actor {
|
||||
get equipment() {
|
||||
return this.itemData.filter(i => i.type === "item");
|
||||
}
|
||||
get weapons() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.subtype === "weapon");
|
||||
}
|
||||
get armors() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.subtype === "armor" && i.data.worn === true);
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.category === "equipment" && i.data.subtype === "armor");
|
||||
}
|
||||
get helms() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.subtype === "helm" && i.data.worn === true);
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.category === "equipment" && i.data.subtype === "helm");
|
||||
}
|
||||
get shields() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.subtype === "shield" && i.data.worn === true);
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.category === "equipment" && i.data.subtype === "shield");
|
||||
}
|
||||
|
||||
get weapons() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.category === "equipment" && i.data.subtype === "weapon");
|
||||
}
|
||||
get protections() {
|
||||
return this.armors.concat(this.helms)
|
||||
return this.armors.concat(this.helms).concat(this.shields)
|
||||
}
|
||||
|
||||
get melee() {
|
||||
return this.weapons.filter(i => i.data.properties.melee === true && i.data.worn === true);
|
||||
return this.weapons.filter(i => i.data.properties.melee === true);
|
||||
}
|
||||
get ranged() {
|
||||
return this.weapons.filter(i => i.data.properties.ranged === true && i.data.worn === true);
|
||||
return this.weapons.filter(i => i.data.properties.ranged === true);
|
||||
}
|
||||
|
||||
get containers() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.category === "equipment" && i.data.subtype === "container");
|
||||
}
|
||||
|
||||
get treasure() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.category === "equipment" && i.data.subtype === "currency");
|
||||
}
|
||||
|
||||
get vehicles() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.category === "vehicle");
|
||||
}
|
||||
|
||||
get ammos() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.category === "equipment" && i.data.subtype === "ammunition");
|
||||
}
|
||||
|
||||
get misc() {
|
||||
return this.itemData.filter(i => i.type === "item" && i.data.category === "equipment" && (i.data.subtype === "other" ||i.data.subtype === "container" ||i.data.subtype === "scroll" || i.data.subtype === "jewel"));
|
||||
}
|
||||
|
||||
buildFeatures(){
|
||||
return {
|
||||
"careers": {
|
||||
|
@@ -34,9 +34,9 @@ export class BoLRoll {
|
||||
adv:adv,
|
||||
mod: mod,
|
||||
attr:attribute,
|
||||
careers:actorData.data.features.careers,
|
||||
boons:actorData.data.features.boons,
|
||||
flaws:actorData.data.features.flaws
|
||||
careers:actorData.features.careers,
|
||||
boons:actorData.features.boons,
|
||||
flaws:actorData.features.flaws
|
||||
};
|
||||
const rollOptionContent = await renderTemplate(rollOptionTpl, dialogData);
|
||||
let d = new Dialog({
|
||||
@@ -80,9 +80,9 @@ export class BoLRoll {
|
||||
adv:adv,
|
||||
mod: mod,
|
||||
apt:aptitude,
|
||||
careers:actorData.data.features.careers,
|
||||
boons:actorData.data.features.boons,
|
||||
flaws:actorData.data.features.flaws
|
||||
careers:actorData.features.careers,
|
||||
boons:actorData.features.boons,
|
||||
flaws:actorData.features.flaws
|
||||
};
|
||||
const rollOptionContent = await renderTemplate(rollOptionTpl, dialogData);
|
||||
let d = new Dialog({
|
||||
|
@@ -17,6 +17,25 @@ BOL.damageValues = {
|
||||
"d6BB" : "d6B + dé bonus",
|
||||
}
|
||||
|
||||
BOL.equipmentSlots = {
|
||||
"none" : "BOL.equipmentSlots.none",
|
||||
"head" : "BOL.equipmentSlots.head",
|
||||
"neck" : "BOL.equipmentSlots.neck",
|
||||
"shoulders" : "BOL.equipmentSlots.shoulders",
|
||||
"body" : "BOL.equipmentSlots.body",
|
||||
"rhand" : "BOL.equipmentSlots.rhand",
|
||||
"lhand" : "BOL.equipmentSlots.lhand",
|
||||
"2hands" : "BOL.equipmentSlots.2hands",
|
||||
"rarm" : "BOL.equipmentSlots.rarm",
|
||||
"larm" : "BOL.equipmentSlots.larm",
|
||||
"chest" : "BOL.equipmentSlots.chest",
|
||||
"belt" : "BOL.equipmentSlots.belt",
|
||||
"legs" : "BOL.equipmentSlots.legs",
|
||||
"feet" : "BOL.equipmentSlots.feet",
|
||||
"finder" : "BOL.equipmentSlots.finder",
|
||||
"ear" : "BOL.equipmentSlots.ear"
|
||||
}
|
||||
|
||||
BOL.armorQualities = {
|
||||
"none" : "BOL.armorQuality.none",
|
||||
"light" : "BOL.armorQuality.light",
|
||||
@@ -83,13 +102,6 @@ BOL.itemCategories = {
|
||||
}
|
||||
|
||||
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",
|
||||
@@ -102,6 +114,26 @@ BOL.equipmentCategories = {
|
||||
"other" : "BOL.equipmentCategory.other"
|
||||
}
|
||||
|
||||
BOL.vehicleSubtypes = {
|
||||
"mount" : "BOL.vehicleCategory.mount",
|
||||
"flying" : "BOL.vehicleCategory.flying",
|
||||
"boat" : "BOL.vehicleCategory.boat",
|
||||
"other" : "BOL.vehicleCategory.other"
|
||||
}
|
||||
|
||||
// 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",
|
||||
// "container" : "BOL.equipmentCategory.container",
|
||||
// "ammunition" : "BOL.equipmentCategory.ammunition",
|
||||
// "currency" : "BOL.equipmentCategory.currency",
|
||||
// "other" : "BOL.equipmentCategory.other"
|
||||
// }
|
||||
|
||||
BOL.protectionCategories = {
|
||||
"armor" : "BOL.protectionCategory.armor",
|
||||
"shield" : "BOL.protectionCategory.shield",
|
||||
|
@@ -11,6 +11,7 @@ export const preloadHandlebarsTemplates = async function () {
|
||||
"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-actions.hbs",
|
||||
"systems/bol/templates/actor/parts/tabs/actor-features.hbs",
|
||||
"systems/bol/templates/actor/parts/tabs/actor-equipment.hbs",
|
||||
// ITEMS
|
||||
@@ -18,6 +19,7 @@ export const preloadHandlebarsTemplates = async function () {
|
||||
"systems/bol/templates/item/parts/properties/feature-properties.hbs",
|
||||
"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/vehicle-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/protection-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/weapon-properties.hbs",
|
||||
"systems/bol/templates/item/parts/properties/item/magical-properties.hbs",
|
||||
|
Reference in New Issue
Block a user