Gestion de la Faune #587

Merged
uberwald merged 5 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2022-12-03 23:16:36 +01:00
36 changed files with 453 additions and 350 deletions

BIN
icons/faune/cerf.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

BIN
icons/faune/chevre.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
icons/faune/crabe.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
icons/faune/lapin.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
icons/faune/oie.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
icons/faune/oiseau.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
icons/faune/poisson.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
icons/faune/rongeur.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
icons/faune/saumon.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
icons/faune/singe-vert.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -20,6 +20,7 @@
"TypeMonnaie": "Monnaie", "TypeMonnaie": "Monnaie",
"TypeHerbe": "Herbe ou plante", "TypeHerbe": "Herbe ou plante",
"TypeIngredient": "Ingrédient", "TypeIngredient": "Ingrédient",
"TypeFaune": "Faune",
"TypeLivre": "Livre", "TypeLivre": "Livre",
"TypePotion": "Potion", "TypePotion": "Potion",
"TypeArme": "Arme", "TypeArme": "Arme",

View File

@ -132,10 +132,12 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onDropItem(event, dragData) { async _onDropItem(event, dragData) {
const destItemId = $(event.target)?.closest('.item').attr('data-item-id') const destItemId = $(event.target)?.closest('.item').attr('data-item-id')
const dropParams = RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor.id, dragData, this.objetVersConteneur) const dropParams = RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor, dragData, this.objetVersConteneur)
const callSuper = await this.actor.processDropItem(dropParams) if (dropParams){
if (callSuper) { const callSuper = await this.actor.processDropItem(dropParams)
await super._onDropItem(event, dragData) if (callSuper) {
await super._onDropItem(event, dragData)
}
} }
} }

View File

@ -145,7 +145,7 @@ export class RdDActor extends Actor {
// Make separate methods for each Actor type (character, npc, etc.) to keep // Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized. // things organized.
if (this.isPersonnage()) this._prepareCharacterData(this) if (this.isPersonnage()) this._prepareCharacterData(this)
if (this.isCreature()) this._prepareCreatureData(this) if (this.isCreatureEntite()) this._prepareCreatureData(this)
if (this.isVehicule()) this._prepareVehiculeData(this) if (this.isVehicule()) this._prepareVehiculeData(this)
this.computeEtatGeneral(); this.computeEtatGeneral();
} }
@ -193,10 +193,36 @@ export class RdDActor extends Actor {
} }
} }
canReceive(item) {
if (this.isCreature()) {
return item.type == 'competencecreature' || RdDItem.isItemInventaire(item);
}
if (this.isEntite()) {
return item.type == 'competencecreature';
}
if (this.isVehicule()) {
return RdDItem.isItemInventaire(item);
}
if (this.isPersonnage()) {
switch (item.type) {
case 'competencecreature': case 'tarot':
return false;
}
return true;
}
return false;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
isCreature() { isCreatureEntite() {
return this.type == 'creature' || this.type == 'entite'; return this.type == 'creature' || this.type == 'entite';
} }
isCreature() {
return this.type == 'creature';
}
isEntite() {
return this.type == 'entite';
}
/* -------------------------------------------- */ /* -------------------------------------------- */
isPersonnage() { isPersonnage() {
return this.type == 'personnage'; return this.type == 'personnage';
@ -1175,13 +1201,13 @@ export class RdDActor extends Actor {
} }
let result = true; let result = true;
const item = this.getObjet(itemId); const item = this.getObjet(itemId);
if (item?.isEquipement() && sourceActorId == targetActorId) { if (item?.isInventaire() && sourceActorId == targetActorId) {
// rangement // rangement
if (srcId != destId && itemId != destId) { // déplacement de l'objet if (srcId != destId && itemId != destId) { // déplacement de l'objet
const src = this.getObjet(srcId); const src = this.getObjet(srcId);
const dest = this.getObjet(destId); const dest = this.getObjet(destId);
const cible = this.getContenantOrParent(dest); const cible = this.getContenantOrParent(dest);
const [empilable, message] = item.isEquipementEmpilable(dest); const [empilable, message] = item.isInventaireEmpilable(dest);
if (empilable) { if (empilable) {
await this.regrouperEquipementsSimilaires(item, dest); await this.regrouperEquipementsSimilaires(item, dest);
result = false; result = false;
@ -1359,7 +1385,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
computePrixTotalEquipement() { computePrixTotalEquipement() {
const valeur = this.items.filter(it => it.isEquipement()) const valeur = this.items.filter(it => it.isInventaire())
.map(it => it.valeurTotale()) .map(it => it.valeurTotale())
.reduce(Misc.sum(), 0); .reduce(Misc.sum(), 0);
return valeur; return valeur;
@ -2995,7 +3021,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
getHeureNaissance() { getHeureNaissance() {
if (this.isCreature()) { if (this.isCreatureEntite()) {
return 0; return 0;
} }
return this.system.heure; return this.system.heure;
@ -3003,7 +3029,7 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
ajustementAstrologique() { ajustementAstrologique() {
if (this.isCreature()) { if (this.isCreatureEntite()) {
return 0; return 0;
} }
// selon l'heure de naissance... // selon l'heure de naissance...

View File

@ -23,7 +23,7 @@ const MILIEUX = [
"Sous-sols" "Sous-sols"
] ]
const ITEM_ENVIRONNEMENT_TYPES = [ const ITEM_ENVIRONNEMENT_TYPES = [
'herbe', 'ingredient' 'herbe', 'ingredient', 'faune'
] ]
export class Environnement { export class Environnement {
@ -126,22 +126,12 @@ export class Environnement {
export class EnvironmentSheetHelper { export class EnvironmentSheetHelper {
static defaultOptions(defaultOptions, type) { static defaultOptions(defaultOptions) {
return mergeObject(defaultOptions, { return mergeObject(defaultOptions, {
classes: ["rdd", "sheet", "item"],
template: `systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html`,
width: 500,
height: 600,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }] tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
}); });
} }
/* -------------------------------------------- */
static getHeaderButtons(sheet, buttons) {
buttons.unshift({ class: "post", icon: "fas fa-comment", onclick: ev => sheet.item.postItem() });
return buttons;
}
static setPosition(sheet, superPosition) { static setPosition(sheet, superPosition) {
const position = superPosition; const position = superPosition;
const sheetHeader = sheet.element.find(".sheet-header"); const sheetHeader = sheet.element.find(".sheet-header");
@ -152,22 +142,14 @@ export class EnvironmentSheetHelper {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async getData(sheet, formData) { static async getData(sheet, formData) {
const autresMilieux = await game.system.rdd.environnement.autresMilieux(sheet.item); return mergeObject(formData, {
mergeObject(formData, { milieux: await game.system.rdd.environnement.autresMilieux(sheet.item)
title: formData.name,
isGM: game.user.isGM,
owner: sheet.actor?.isOwner,
isOwned: sheet.actor ? true : false,
actorId: sheet.actor?.id,
editable: sheet.isEditable,
cssClass: sheet.isEditable ? "editable" : "locked",
milieux: autresMilieux
}); });
return formData;
} }
static activateListeners(sheet, html) { static activateListeners(sheet, html) {
if (!sheet.options.editable) return; if (!sheet.options.editable) return;
html.find("input.input-selection-milieu").keypress(event => { html.find("input.input-selection-milieu").keypress(event => {
if (event.keyCode == '13') { if (event.keyCode == '13') {
EnvironmentSheetHelper.onAddMilieu(html, sheet, event); EnvironmentSheetHelper.onAddMilieu(html, sheet, event);
@ -238,13 +220,4 @@ export class EnvironmentSheetHelper {
return $(event.currentTarget)?.parents("div.environnement-milieu").data("milieu"); return $(event.currentTarget)?.parents("div.environnement-milieu").data("milieu");
} }
static template(itemType) {
/* -------------------------------------------- */
return `systems/foundryvtt-reve-de-dragon/templates/item-${itemType}-sheet.html`;
}
static title(item) {
return Misc.typeName('Item', item.type) + ': ' + item.name;
}
} }

View File

@ -0,0 +1,58 @@
import { RdDItemSheet } from "./item-sheet.js";
import { RdDSheetUtility } from "./rdd-sheet-utility.js";
import { RdDUtility } from "./rdd-utility.js";
export class RdDConteneurItemSheet extends RdDItemSheet {
static get ITEM_TYPE() { return "conteneur" };
async getData() {
const formData = await super.getData();
if (this.actor) {
this.prepareConteneurData(formData);
}
}
activateListeners(html) {
super.activateListeners(html);
if (!this.options.editable) return;
html.find('.conteneur-name a').click(async event => {
RdDUtility.toggleAfficheContenu(RdDSheetUtility.getItemId(event));
this.render(true);
});
}
/* -------------------------------------------- */
prepareConteneurData(formData) {
RdDUtility.filterEquipementParType(formData, this.actor.itemTypes);
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems;
}
async _onDragStart(event) {
console.log("_onDragStart", event);
if (event.target.classList.contains("entity-link")) return;
const itemId = event.srcElement?.attributes["data-item-id"].value;
const item = this.actor.items.get(itemId);
// Create drag data
const dragData = {
actorId: this.actor.id,
type: "Item",
data: item.system
};
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
}
async _onDropItem(event, dragData) {
if (this.actor) {
const dropParams = RdDSheetUtility.prepareItemDropParameters(this.item.id, this.actor, dragData, this.objetVersConteneur);
await this.actor.processDropItem(dropParams);
await this.render(true);
}
}
}

View File

@ -0,0 +1,54 @@
import { EnvironmentSheetHelper } from "./environnement.js";
import { RdDItemSheet } from "./item-sheet.js";
import { RdDUtility } from "./rdd-utility.js";
export class RdDFauneItemSheet extends RdDItemSheet {
static get ITEM_TYPE() { return "faune" };
static get defaultOptions() {
return EnvironmentSheetHelper.defaultOptions(super.defaultOptions);
}
setPosition(options = {}) {
return EnvironmentSheetHelper.setPosition(this, super.setPosition(options));
}
async getData() {
const formData = await super.getData();
return await EnvironmentSheetHelper.getData(this, formData);
}
activateListeners(html) {
super.activateListeners(html);
if (!this.options.editable) return;
EnvironmentSheetHelper.activateListeners(this, html);
html.find("a.linked-actor-delete").click(event => this.onDeleteLinkedActor());
}
async _onDropActor(event, dragData) {
console.log('faune:dropActor', event, dragData)
const actor = fromUuidSync(dragData.uuid);
if (actor?.pack) {
this.item.update({
'system.actor.pack': actor.pack,
'system.actor.id': actor._id,
'system.actor.name': actor.name
});
}
else {
ui.notifications.warn(`${actor.name} ne provient pas d'eun compendium.
<br>Choisissez une créature du compendium pour représenter un élément de faune générique`)
}
}
async onDeleteLinkedActor() {
this.item.update({
'system.actor.pack': '',
'system.actor.id': '',
'system.actor.name': ''
});
}
}

View File

@ -1,26 +1,12 @@
import { SYSTEM_RDD } from "./constants.js";
import { EnvironmentSheetHelper } from "./environnement.js"; import { EnvironmentSheetHelper } from "./environnement.js";
import { RdDItemSheet } from "./item-sheet.js"; import { RdDItemSheet } from "./item-sheet.js";
import { Misc } from "./misc.js";
const ITEM_TYPE = 'herbe';
export class RdDHerbeItemSheet extends RdDItemSheet { export class RdDHerbeItemSheet extends RdDItemSheet {
static register() { static get ITEM_TYPE() { return "herbe" };
Items.registerSheet(SYSTEM_RDD, RdDHerbeItemSheet, {
label: Misc.typeName('Item', ITEM_TYPE),
types: [ITEM_TYPE],
makeDefault: true
});
}
static get defaultOptions() { static get defaultOptions() {
return EnvironmentSheetHelper.defaultOptions(super.defaultOptions, ITEM_TYPE); return EnvironmentSheetHelper.defaultOptions(super.defaultOptions);
}
_getHeaderButtons() {
return EnvironmentSheetHelper.getHeaderButtons(this, super._getHeaderButtons());
} }
setPosition(options = {}) { setPosition(options = {}) {
@ -36,12 +22,4 @@ export class RdDHerbeItemSheet extends RdDItemSheet {
super.activateListeners(html); super.activateListeners(html);
EnvironmentSheetHelper.activateListeners(this, html); EnvironmentSheetHelper.activateListeners(this, html);
} }
get template() {
return EnvironmentSheetHelper.template(this.item.type);
}
get title() {
return EnvironmentSheetHelper.title(this.item);
}
} }

View File

@ -1,25 +1,12 @@
import { SYSTEM_RDD } from "./constants.js";
import { EnvironmentSheetHelper } from "./environnement.js"; import { EnvironmentSheetHelper } from "./environnement.js";
import { RdDItemSheet } from "./item-sheet.js"; import { RdDItemSheet } from "./item-sheet.js";
import { Misc } from "./misc.js";
const ITEM_TYPE = 'ingredient';
export class RdDIngredientItemSheet extends RdDItemSheet { export class RdDIngredientItemSheet extends RdDItemSheet {
static register() { static get ITEM_TYPE() { return "ingredient" };
Items.registerSheet(SYSTEM_RDD, RdDIngredientItemSheet, {
label: Misc.typeName('Item', ITEM_TYPE),
types: [ITEM_TYPE],
makeDefault: true
});
}
static get defaultOptions() { static get defaultOptions() {
return EnvironmentSheetHelper.defaultOptions(super.defaultOptions, ITEM_TYPE); return EnvironmentSheetHelper.defaultOptions(super.defaultOptions);
}
_getHeaderButtons() {
return EnvironmentSheetHelper.getHeaderButtons(this, super._getHeaderButtons());
} }
setPosition(options = {}) { setPosition(options = {}) {
@ -35,12 +22,4 @@ export class RdDIngredientItemSheet extends RdDItemSheet {
super.activateListeners(html); super.activateListeners(html);
EnvironmentSheetHelper.activateListeners(this, html); EnvironmentSheetHelper.activateListeners(this, html);
} }
get template() {
return EnvironmentSheetHelper.template(this.item.type);
}
get title() {
return EnvironmentSheetHelper.title(this.item);
}
} }

View File

@ -1,29 +1,16 @@
import { RdDRencontre } from "./item-rencontre.js"; import { RdDRencontre } from "./item-rencontre.js";
import { RdDItemSheet } from "./item-sheet.js";
/** export class RdDRencontreItemSheet extends RdDItemSheet {
* Item sheet pour configurer les rencontres
* @extends {ItemSheet} static get ITEM_TYPE() { return "rencontre" };
*/
export class RdDRencontreItemSheet extends ItemSheet {
/** @override */
static get defaultOptions() { static get defaultOptions() {
return mergeObject(super.defaultOptions, { return mergeObject(super.defaultOptions, {
classes: ["rdd", "sheet", "item"],
template: "systems/foundryvtt-reve-de-dragon/templates/item-rencontre-sheet.html",
width: 500,
height: 500,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }] tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }]
}); });
} }
/* -------------------------------------------- */
_getHeaderButtons() {
let buttons = super._getHeaderButtons();
buttons.unshift({ class: "post", icon: "fas fa-comment", onclick: ev => this.item.postItem() });
return buttons;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/** @override */ /** @override */
setPosition(options = {}) { setPosition(options = {}) {
@ -34,7 +21,6 @@ export class RdDRencontreItemSheet extends ItemSheet {
return position; return position;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async getData() { async getData() {
const formData = duplicate(this.item); const formData = duplicate(this.item);
@ -96,13 +82,4 @@ export class RdDRencontreItemSheet extends ItemSheet {
updates[key] = liste; updates[key] = liste;
this.item.update(updates); this.item.update(updates);
} }
get template() {
/* -------------------------------------------- */
return `systems/foundryvtt-reve-de-dragon/templates/item-rencontre-sheet.html`;
}
get title() {
return `Rencontre: ${this.object.name}`;
}
} }

View File

@ -9,30 +9,54 @@ import { ReglesOptionelles } from "./settings/regles-optionelles.js";
import { SYSTEM_RDD } from "./constants.js"; import { SYSTEM_RDD } from "./constants.js";
import { RdDSheetUtility } from "./rdd-sheet-utility.js"; import { RdDSheetUtility } from "./rdd-sheet-utility.js";
import { SystemCompendiums } from "./settings/system-compendiums.js"; import { SystemCompendiums } from "./settings/system-compendiums.js";
import { Misc } from "./misc.js";
/** /**
* Extend the basic ItemSheet with some very simple modifications * Extend the basic ItemSheet for RdD specific items
* @extends {ItemSheet}
*/ */
export class RdDItemSheet extends ItemSheet { export class RdDItemSheet extends ItemSheet {
static get ITEM_TYPE() {
return undefined
}
static defaultTemplate(type) {
return type ?
`systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html` :
"systems/foundryvtt-reve-de-dragon/templates/item-sheet.html";
}
static register(sheetClass) {
Items.registerSheet(SYSTEM_RDD, sheetClass, {
label: Misc.typeName('Item', sheetClass.ITEM_TYPE),
types: [sheetClass.ITEM_TYPE],
makeDefault: true
})
}
/** @override */ /** @override */
static get defaultOptions() { static get defaultOptions() {
return mergeObject(super.defaultOptions, { return mergeObject(super.defaultOptions, {
classes: [SYSTEM_RDD, "sheet", "item"], classes: [SYSTEM_RDD, "sheet", "item"],
template: "systems/foundryvtt-reve-de-dragon/templates/item-sheet.html", template: RdDItemSheet.defaultTemplate(RdDItemSheet.ITEM_TYPE),
width: 550, width: 550,
height: 550 height: 550
}); });
} }
/* -------------------------------------------- */
get template() {
return RdDItemSheet.defaultTemplate(this.item.type);
}
get title() {
return `${Misc.typeName('Item', this.item.type)}: ${this.item.name}`;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
_getHeaderButtons() { _getHeaderButtons() {
let buttons = super._getHeaderButtons(); let buttons = super._getHeaderButtons();
// Add "Post to chat" button if (this.item.isInventaire() && this.item.isVideOuNonConteneur()) {
// We previously restricted this to GM and editable items only. If you ever find this comment because it broke something: eh, sorry!
if ("cout" in this.item.system && this.item.isVideOuNonConteneur()) {
buttons.unshift({ buttons.unshift({
class: "vendre", class: "vendre",
icon: "fas fa-comments-dollar", icon: "fas fa-comments-dollar",
@ -69,18 +93,13 @@ export class RdDItemSheet extends ItemSheet {
system: this.item.system, system: this.item.system,
isGM: game.user.isGM, isGM: game.user.isGM,
actorId: this.actor?.id, actorId: this.actor?.id,
isOwned: this.actor ? true : false,
owner: this.item.isOwner, owner: this.item.isOwner,
editable: this.isEditable, editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked", cssClass: this.isEditable ? "editable" : "locked",
isSoins: false, isSoins: false,
description: await TextEditor.enrichHTML(this.item.system.description, {async: true}), description: await TextEditor.enrichHTML(this.item.system.description, { async: true }),
descriptionmj: await TextEditor.enrichHTML(this.item.system.descriptionmj, {async: true}) descriptionmj: await TextEditor.enrichHTML(this.item.system.descriptionmj, { async: true })
}
if (this.actor) {
formData.isOwned = true;
if (this.item.type == 'conteneur') {
this.prepareConteneurData(formData);
}
} }
const competences = await SystemCompendiums.getCompetences(this.actor?.type); const competences = await SystemCompendiums.getCompetences(this.actor?.type);
@ -97,18 +116,18 @@ export class RdDItemSheet extends ItemSheet {
formData.competences = competences.filter(it => RdDItemCompetence.isDraconic(it)); formData.competences = competences.filter(it => RdDItemCompetence.isDraconic(it));
} }
if (this.item.type == 'recettecuisine') { if (this.item.type == 'recettecuisine') {
formData.ingredients = await TextEditor.enrichHTML(this.object.system.ingredients, {async: true}) formData.ingredients = await TextEditor.enrichHTML(this.object.system.ingredients, { async: true })
} }
if (this.item.type == 'extraitpoetique') { if (this.item.type == 'extraitpoetique') {
formData.extrait = await TextEditor.enrichHTML(this.object.system.extrait, {async: true}) formData.extrait = await TextEditor.enrichHTML(this.object.system.extrait, { async: true })
formData.texte = await TextEditor.enrichHTML(this.object.system.texte, {async: true}) formData.texte = await TextEditor.enrichHTML(this.object.system.texte, { async: true })
} }
if (this.item.type == 'recettealchimique') { if (this.item.type == 'recettealchimique') {
RdDAlchimie.processManipulation(this.item, this.actor && this.actor.id); RdDAlchimie.processManipulation(this.item, this.actor && this.actor.id);
formData.manipulation_update = await TextEditor.enrichHTML(this.object.system.manipulation_update, {async: true}) formData.manipulation_update = await TextEditor.enrichHTML(this.object.system.manipulation_update, { async: true })
formData.utilisation = await TextEditor.enrichHTML(this.object.system.utilisation, {async: true}) formData.utilisation = await TextEditor.enrichHTML(this.object.system.utilisation, { async: true })
formData.enchantement = await TextEditor.enrichHTML(this.object.system.enchantement, {async: true}) formData.enchantement = await TextEditor.enrichHTML(this.object.system.enchantement, { async: true })
formData.sureffet = await TextEditor.enrichHTML(this.object.system.sureffet, {async: true}) formData.sureffet = await TextEditor.enrichHTML(this.object.system.sureffet, { async: true })
} }
if (this.item.type == 'gemme') { if (this.item.type == 'gemme') {
formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList(); formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList();
@ -133,25 +152,10 @@ export class RdDItemSheet extends ItemSheet {
return formData; return formData;
} }
/* -------------------------------------------- */
prepareConteneurData(formData) {
RdDUtility.filterEquipementParType(formData, this.actor.itemTypes);
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.objets);
formData.subItems = formData.conteneurs.find(it => it._id == this.item.id)?.subItems;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/** @override */ /** @override */
activateListeners(html) { activateListeners(html) {
super.activateListeners(html); super.activateListeners(html);
if (this.item.type == 'conteneur') {
this.form.ondragstart = (event) => this._onDragStart(event);
this.form.ondrop = (event) => this._onDrop(event);
}
let itemSheetDialog = this; let itemSheetDialog = this;
HtmlUtility._showControlWhen($(".item-cout"), ReglesOptionelles.isUsing('afficher-prix-joueurs') || game.user.isGM || !this.item.isOwned); HtmlUtility._showControlWhen($(".item-cout"), ReglesOptionelles.isUsing('afficher-prix-joueurs') || game.user.isGM || !this.item.isOwned);
@ -159,6 +163,9 @@ export class RdDItemSheet extends ItemSheet {
// Everything below here is only needed if the sheet is editable // Everything below here is only needed if the sheet is editable
if (!this.options.editable) return; if (!this.options.editable) return;
this.form.ondragstart = (event) => this._onDragStart(event);
this.form.ondrop = (event) => this._onDrop(event);
// Select competence categorie // Select competence categorie
html.find(".categorie").change(event => this._onSelectCategorie(event)); html.find(".categorie").change(event => this._onSelectCategorie(event));
@ -229,10 +236,6 @@ export class RdDItemSheet extends ItemSheet {
const item = RdDSheetUtility.getItem(event, this.actor); const item = RdDSheetUtility.getItem(event, this.actor);
this.actor.actionItem(item, async () => itemSheetDialog.render(true)); this.actor.actionItem(item, async () => itemSheetDialog.render(true));
}); });
html.find('.conteneur-name a').click(async event => {
RdDUtility.toggleAfficheContenu(RdDSheetUtility.getItemId(event));
this.render(true);
});
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -247,65 +250,51 @@ export class RdDItemSheet extends ItemSheet {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
get template() {
let type = this.item.type
return `systems/foundryvtt-reve-de-dragon/templates/item-${type}-sheet.html`;
}
/* -------------------------------------------- */
/** @override */ /** @override */
_updateObject(event, formData) { _updateObject(event, formData) {
// Données de bonus de cases ? if (this.item.type == 'sort') {
formData['system.bonuscase'] = RdDItemSort.buildBonusCaseStringFromFormData(formData.bonusValue, formData.caseValue); // Données de bonus de cases ?
formData['system.bonuscase'] = RdDItemSort.buildBonusCaseStringFromFormData(formData.bonusValue, formData.caseValue);
}
return this.item.update(formData); return this.item.update(formData);
} }
/* -------------------------------------------- */
async _onDragStart(event) { async _onDragStart(event) {
console.log("_onDragStart", event);
if (event.target.classList.contains("entity-link")) return;
const itemId = event.srcElement?.attributes["data-item-id"].value;
const item = this.actor.items.get(itemId);
// Create drag data
const dragData = {
actorId: this.actor.id,
type: "Item",
data: item.system
};
event.dataTransfer.setData("text/plain", JSON.stringify(dragData));
} }
async _onDrop(event) { async _onDrop(event) {
// Try to extract the dragData // Try to extract the dragData
let dragData; let dragData = RdDItemSheet.$extractDragData(event);
try { if (!dragData) return false;
dragData = JSON.parse(event.dataTransfer.getData('text/plain'));
} catch (err) {
return false;
}
const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData); const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData);
if (allowed === false) return; if (allowed === false) return false;
// Handle different dragData types // Handle different dragData types
switch (dragData.type) { switch (dragData.type) {
case "Item": case "Item":
return this._onDropItem(event, dragData); return this._onDropItem(event, dragData);
case "Actor":
return this._onDropActor(event, dragData);
} }
return super._onDrop(event); return super._onDrop(event);
} }
/* -------------------------------------------- */ static $extractDragData(event) {
async _onDropItem(event, dragData) { try {
if (this.actor) { const eventData = event?.dataTransfer?.getData('text/plain');
const dropParams = RdDSheetUtility.prepareItemDropParameters(this.item.id, this.actor.id, dragData, this.objetVersConteneur); if (eventData) {
await this.actor.processDropItem(dropParams); return JSON.parse(eventData);
await this.render(true); }
} } catch (err) { }
return undefined;
} }
async _onDropItem(event, dragData) {
}
async _onDropActor(event, dragData) {
}
} }

View File

@ -1,29 +1,14 @@
import { SYSTEM_RDD } from "./constants.js"; import { RdDItemSheet } from "./item-sheet.js";
import { RdDItemSigneDraconique } from "./item-signedraconique.js"; import { RdDItemSigneDraconique } from "./item-signedraconique.js";
import { TMRUtility } from "./tmr-utility.js"; import { TMRUtility } from "./tmr-utility.js";
/** /**
* Item sheet pour signes draconiques * Item sheet pour signes draconiques
* @extends {ItemSheet} * @extends {RdDItemSheet}
*/ */
export class RdDSigneDraconiqueItemSheet extends ItemSheet { export class RdDSigneDraconiqueItemSheet extends RdDItemSheet {
/** @override */ static get ITEM_TYPE() { return "signedraconique" }
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: [SYSTEM_RDD, "sheet", "item"],
template: "systems/foundryvtt-reve-de-dragon/templates/item-signedraconique-sheet.html",
width: 550,
height: 550
});
}
/* -------------------------------------------- */
_getHeaderButtons() {
let buttons = super._getHeaderButtons();
buttons.unshift({ class: "post", icon: "fas fa-comment", onclick: ev => this.item.postItem() });
return buttons;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
/** @override */ /** @override */
@ -61,12 +46,13 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
if (!this.options.editable) return; if (!this.options.editable) return;
html.find(".signe-aleatoire").click(event => this.setSigneAleatoire()); html.find(".signe-aleatoire").click(event => this.setSigneAleatoire());
html.find("input.select-tmr").change((event) => this.onSelectTmr(event)); html.find("input.select-tmr").change(event => this.onSelectTmr(event));
html.find(".signe-xp-sort").change((event) => this.onValeurXpSort(event.currentTarget.attributes['data-typereussite']?.value, Number(event.currentTarget.value))); html.find(".signe-xp-sort").change(event => this.onValeurXpSort(event.currentTarget.attributes['data-typereussite']?.value, Number(event.currentTarget.value)));
} }
async setSigneAleatoire() { async setSigneAleatoire() {
const newSigne = await RdDItemSigneDraconique.randomSigneDraconique(); const newSigne = await RdDItemSigneDraconique.randomSigneDraconique();
newSigne.name = this.item.name;
this.item.update(newSigne); this.item.update(newSigne);
} }
@ -88,12 +74,4 @@ export class RdDSigneDraconiqueItemSheet extends ItemSheet {
await this.item.update({ 'system.valeur': newValeur }); await this.item.update({ 'system.valeur': newValeur });
} }
/* -------------------------------------------- */
get template() {
return `systems/foundryvtt-reve-de-dragon/templates/item-signedraconique-sheet.html`;
}
get title() {
return `Signe draconique: ${this.object.name}`;
}
} }

View File

@ -1,16 +1,16 @@
import { DialogItemVente } from "./dialog-item-vente.js"; import { DialogItemVente } from "./dialog-item-vente.js";
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { Monnaie } from "./item-monnaie.js";
import { RdDHerbes } from "./rdd-herbes.js"; import { RdDHerbes } from "./rdd-herbes.js";
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
const typesObjetsEquipement = [ const typesObjetsInventaire = [
"arme", "arme",
"armure", "armure",
"conteneur", "conteneur",
"gemme", "gemme",
"herbe", "herbe",
"ingredient", "ingredient",
"faune",
"livre", "livre",
"monnaie", "monnaie",
"munition", "munition",
@ -36,6 +36,7 @@ export const defaultItemImg = {
conteneur: "systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp", conteneur: "systems/foundryvtt-reve-de-dragon/icons/objets/sac_a_dos.webp",
sort: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp", sort: "systems/foundryvtt-reve-de-dragon/icons/competence_oniros.webp",
herbe: "systems/foundryvtt-reve-de-dragon/icons/botanique/Endorlotte.webp", herbe: "systems/foundryvtt-reve-de-dragon/icons/botanique/Endorlotte.webp",
faune: "systems/foundryvtt-reve-de-dragon/icons/faune/rongeur.webp",
ingredient: "systems/foundryvtt-reve-de-dragon/icons/objets/sable_poudre.webp", ingredient: "systems/foundryvtt-reve-de-dragon/icons/objets/sable_poudre.webp",
livre: "systems/foundryvtt-reve-de-dragon/icons/objets/livre.webp", livre: "systems/foundryvtt-reve-de-dragon/icons/objets/livre.webp",
potion: "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp", potion: "systems/foundryvtt-reve-de-dragon/icons/objets/liqueur_de_bagdol.webp",
@ -70,7 +71,11 @@ export class RdDItem extends Item {
return defaultItemImg[itemType]; return defaultItemImg[itemType];
} }
static isEquipementFieldEditable(type, field) { static isItemInventaire(newLocal) {
return typesObjetsInventaire.includes(newLocal.type);
}
static isFieldInventaireModifiable(type, field) {
switch (field) { switch (field) {
case 'quantite': case 'quantite':
if (['conteneur'].includes(type)) { if (['conteneur'].includes(type)) {
@ -78,8 +83,8 @@ export class RdDItem extends Item {
} }
break; break;
case 'cout': case 'cout':
if(['monnaie'].includes(type)){ if (['monnaie'].includes(type)) {
return game.user.isGM; return game.user.isGM;
} }
break; break;
} }
@ -98,12 +103,12 @@ export class RdDItem extends Item {
constructor(itemData, context) { constructor(itemData, context) {
if (!itemData.img) { if (!itemData.img) {
itemData.img = RdDItem.getDefaultImg(itemData.type); itemData.img = RdDItem.getDefaultImg(itemData.type);
} }
super(itemData, context); super(itemData, context);
} }
static getTypesObjetsEquipement() { static getItemTypesInventaire() {
return typesObjetsEquipement return typesObjetsInventaire
} }
static getTypesOeuvres() { static getTypesOeuvres() {
@ -113,11 +118,14 @@ export class RdDItem extends Item {
isCompetencePersonnage() { isCompetencePersonnage() {
return this.type == 'competence' return this.type == 'competence'
} }
isCompetenceCreature() {
return this.type == 'competencecreature'
}
isCompetence() { isCompetence() {
return typesObjetsCompetence.includes(this.type) return typesObjetsCompetence.includes(this.type)
} }
isEquipement() { isInventaire() {
return typesObjetsEquipement.includes(this.type) return RdDItem.isItemInventaire(this)
} }
isOeuvre() { isOeuvre() {
return typesObjetsOeuvres.includes(this.type) return typesObjetsOeuvres.includes(this.type)
@ -136,7 +144,7 @@ export class RdDItem extends Item {
} }
getItemGroup() { getItemGroup() {
if (this.isEquipement()) return "equipement"; if (this.isInventaire()) return "equipement";
if (this.isOeuvre()) return "oeuvre"; if (this.isOeuvre()) return "oeuvre";
if (this.isDraconique()) return "draconique"; if (this.isDraconique()) return "draconique";
if (this.isConnaissance()) return "connaissance"; if (this.isConnaissance()) return "connaissance";
@ -180,7 +188,7 @@ export class RdDItem extends Item {
getEncTotal() { getEncTotal() {
return this.getEnc() * this.getQuantite(); return this.getEnc() * this.getQuantite();
} }
getEnc() { getEnc() {
switch (this.type) { switch (this.type) {
@ -202,7 +210,7 @@ export class RdDItem extends Item {
prepareDerivedData() { prepareDerivedData() {
super.prepareDerivedData(); super.prepareDerivedData();
if (this.isEquipement()) { if (this.isInventaire()) {
this.system.encTotal = this.getEncTotal(); this.system.encTotal = this.getEncTotal();
if (this.isPotion()) { if (this.isPotion()) {
this.prepareDataPotion() this.prepareDataPotion()
@ -229,13 +237,13 @@ export class RdDItem extends Item {
case 'potion': return this._actionOrWarnQuantiteZero('Boire', warn); case 'potion': return this._actionOrWarnQuantiteZero('Boire', warn);
case 'livre': return this._actionOrWarnQuantiteZero('Lire', warn); case 'livre': return this._actionOrWarnQuantiteZero('Lire', warn);
case 'conteneur': return 'Ouvrir'; case 'conteneur': return 'Ouvrir';
case 'herbe': return this.isHerbeAPotion() ? this._actionOrWarnQuantiteZero('Décoction', warn) : undefined; case 'herbe': return this.isHerbeAPotion() ? this._actionOrWarnQuantiteZero('Décoction', warn) : undefined;
case 'queue': case 'ombre': return this.system.refoulement>0 ? 'Refouler' : undefined; case 'queue': case 'ombre': return this.system.refoulement > 0 ? 'Refouler' : undefined;
} }
return undefined; return undefined;
} }
_actionOrWarnQuantiteZero(actionName, warn){ _actionOrWarnQuantiteZero(actionName, warn) {
if ((this.system.quantite ?? 0) <= 0) { if ((this.system.quantite ?? 0) <= 0) {
if (warn) { if (warn) {
ui.notifications.warn(`Vous n'avez plus de ${this.name}.`); ui.notifications.warn(`Vous n'avez plus de ${this.name}.`);
@ -275,14 +283,14 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
// détermine si deux équipements sont similaires: de même type, et avec les même champs hormis la quantité // détermine si deux équipements sont similaires: de même type, et avec les même champs hormis la quantité
isEquipementEmpilable(other) { isInventaireEmpilable(other) {
if (!other || !this.isEquipement()) { if (!other || !this.isInventaire()) {
return [false, undefined]; return [false, undefined];
} }
if (this.system.quantite == undefined) { if (this.system.quantite == undefined) {
return [false, `Impossible de regrouper des ${this.type}, ils ne sont pas empilables`]; return [false, `Impossible de regrouper des ${this.type}, ils ne sont pas empilables`];
} }
else if (this.type != other.type) { else if (this.type != other.type) {
return [false, `Impossible de regrouper des ${this.type} avec des ${other.type}`]; return [false, `Impossible de regrouper des ${this.type} avec des ${other.type}`];
} }
@ -309,7 +317,7 @@ export class RdDItem extends Item {
ui.notifications.warn(`Votre ${this.name} n'est pas vide, pas possible de le proposer`); ui.notifications.warn(`Votre ${this.name} n'est pas vide, pas possible de le proposer`);
return; return;
} }
await DialogItemVente.display(this, async (vente) => { await DialogItemVente.display(this, async (vente) => {
vente["properties"] = this.getProprietes(); vente["properties"] = this.getProprietes();
if (vente.isOwned) { if (vente.isOwned) {
if (vente.quantiteNbLots * vente.tailleLot > vente.quantiteMax) { if (vente.quantiteNbLots * vente.tailleLot > vente.quantiteMax) {
@ -318,7 +326,7 @@ export class RdDItem extends Item {
} }
} }
vente.jsondata = JSON.stringify(vente.item); vente.jsondata = JSON.stringify(vente.item);
console.log(vente); console.log(vente);
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.html', vente); let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-vente-item.html', vente);
ChatMessage.create(RdDUtility.chatDataSetup(html)); ChatMessage.create(RdDUtility.chatDataSetup(html));
@ -327,7 +335,7 @@ export class RdDItem extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
getProprietes() { getProprietes() {
return this[`_${this.type}ChatData`](); return this[`_${this.type}ChatData`]().filter(it => it != undefined);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -351,29 +359,31 @@ export class RdDItem extends Item {
}); });
} }
static propertyIfDefined(name, val, condition = (it) => true) { static propertyIfDefined(name, val, condition = true) {
return condition ? [`<b>${name}</b>: ${val}`] : []; return condition ? `<b>${name}</b>: ${val}` : undefined;
} }
_inventaireTemplateChatData() {
return [
RdDItem.propertyIfDefined('Qualité', this.system.qualite, this.system.qualite != 0),
RdDItem.propertyIfDefined('Encombrement', this.system.encombrement)
// cout et quantité masqués
]
}
/* -------------------------------------------- */ /* -------------------------------------------- */
_objetChatData() { _objetChatData() {
return [].concat( return this._inventaireTemplateChatData()
RdDItem.propertyIfDefined('Résistance', this.system.resistance, this.system.resistance),
RdDItem.propertyIfDefined('Qualité', this.system.qualite, this.system.qualite),
RdDItem.propertyIfDefined('Encombrement', this.system.encombrement),
);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_nourritureboissonChatData() { _nourritureboissonChatData() {
return [].concat( return [
RdDItem.propertyIfDefined('Sustentation', this.system.sust, this.system.sust > 0), RdDItem.propertyIfDefined('Sustentation', this.system.sust, this.system.sust > 0),
RdDItem.propertyIfDefined('Désaltère', this.system.desaltere, this.system.boisson), RdDItem.propertyIfDefined('Désaltère', this.system.desaltere, this.system.boisson),
RdDItem.propertyIfDefined('Force alcool', this.system.force, this.system.boisson && this.system.alcoolise), RdDItem.propertyIfDefined('Force alcool', this.system.force, this.system.boisson && this.system.alcoolise),
RdDItem.propertyIfDefined('Exotisme', this.system.exotisme, this.system.exotisme < 0), RdDItem.propertyIfDefined('Exotisme', this.system.exotisme, this.system.exotisme < 0),
RdDItem.propertyIfDefined('Qualité', this.system.qualite, this.system.qualite), ...this._inventaireTemplateChatData()
RdDItem.propertyIfDefined('Encombrement', this.system.encombrement), ]
);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_armeChatData() { _armeChatData() {
@ -382,21 +392,19 @@ export class RdDItem extends Item {
`<b>Dommages</b>: ${this.system.dommages}`, `<b>Dommages</b>: ${this.system.dommages}`,
`<b>Force minimum</b>: ${this.system.force}`, `<b>Force minimum</b>: ${this.system.force}`,
`<b>Resistance</b>: ${this.system.resistance}`, `<b>Resistance</b>: ${this.system.resistance}`,
`<b>Encombrement</b>: ${this.system.encombrement}` ...this._inventaireTemplateChatData()
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_conteneurChatData() { _conteneurChatData() {
return [ return [
`<b>Capacité</b>: ${this.system.capacite} Enc.`, `<b>Capacité</b>: ${this.system.capacite} Enc.`,
`<b>Encombrement</b>: ${this.system.encombrement}` ...this._inventaireTemplateChatData()
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_munitionChatData() { _munitionChatData() {
return [ return this._inventaireTemplateChatData()
`<b>Encombrement</b>: ${this.system.encombrement}`
]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_armureChatData() { _armureChatData() {
@ -404,7 +412,7 @@ export class RdDItem extends Item {
`<b>Protection</b>: ${this.system.protection}`, `<b>Protection</b>: ${this.system.protection}`,
`<b>Détérioration</b>: ${this.system.deterioration}`, `<b>Détérioration</b>: ${this.system.deterioration}`,
`<b>Malus armure</b>: ${this.system.malus}`, `<b>Malus armure</b>: ${this.system.malus}`,
`<b>Encombrement</b>: ${this.system.encombrement}` ...this._inventaireTemplateChatData()
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -438,16 +446,24 @@ export class RdDItem extends Item {
_herbeChatData() { _herbeChatData() {
return [ return [
`<b>Milieu</b>: ${this.system.milieu}`, `<b>Milieu</b>: ${this.system.milieu}`,
`<b>Rareté</b>: ${this.system.rarete}`,
`<b>Catégorie</b>: ${this.system.categorie}`, `<b>Catégorie</b>: ${this.system.categorie}`,
...this._inventaireTemplateChatData()
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_ingredientChatData() { _ingredientChatData() {
return [ return [
`<b>Milieu</b>: ${this.system.milieu}`, `<b>Milieu</b>: ${this.system.milieu}`,
`<b>Rareté</b>: ${this.system.rarete}`,
`<b>Catégorie</b>: ${this.system.categorie}`, `<b>Catégorie</b>: ${this.system.categorie}`,
...this._inventaireTemplateChatData()
]
}
/* -------------------------------------------- */
_fauneChatData() {
return [
`<b>Sustentation</b>: ${this.system.sust}`,
`<b>Milieu</b>: ${this.system.milieu}`,
...this._inventaireTemplateChatData()
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -457,12 +473,9 @@ export class RdDItem extends Item {
`<b>Compétence</b>: ${this.system.competence}`, `<b>Compétence</b>: ${this.system.competence}`,
`<b>Périodicité</b>: ${this.system.periodicite}`, `<b>Périodicité</b>: ${this.system.periodicite}`,
`<b>Fatigue</b>: ${this.system.fatigue}`, `<b>Fatigue</b>: ${this.system.fatigue}`,
`<b>Difficulté</b>: ${this.system.difficulte}` `<b>Difficulté</b>: ${this.system.difficulte}`,
].concat([ RdDItem.propertyIfDefined('Points de Tâche', this.system.points_de_tache, this.system.cacher_points_de_tache),
this.system.cacher_points_de_tache ? [] :`<b>Points de Tâche</b>: ${this.system.points_de_tache}`
]).concat([
`<b>Points de Tâche atteints</b>: ${this.system.points_de_tache_courant}`] `<b>Points de Tâche atteints</b>: ${this.system.points_de_tache_courant}`]
);
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_livreChatData() { _livreChatData() {
@ -470,8 +483,8 @@ export class RdDItem extends Item {
`<b>Compétence</b>: ${this.system.competence}`, `<b>Compétence</b>: ${this.system.competence}`,
`<b>Auteur</b>: ${this.system.auteur}`, `<b>Auteur</b>: ${this.system.auteur}`,
`<b>Difficulté</b>: ${this.system.difficulte}`, `<b>Difficulté</b>: ${this.system.difficulte}`,
`<b>Points de Tâche</b>: ${this.system.points_de_tache}`, RdDItem.propertyIfDefined('Points de Tâche', this.system.points_de_tache, this.system.cacher_points_de_tache),
`<b>Encombrement</b>: ${this.system.encombrement}` ...this._inventaireTemplateChatData()
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -479,32 +492,44 @@ export class RdDItem extends Item {
return [ return [
`<b>Rareté</b>: ${this.system.rarete}`, `<b>Rareté</b>: ${this.system.rarete}`,
`<b>Catégorie</b>: ${this.system.categorie}`, `<b>Catégorie</b>: ${this.system.categorie}`,
`<b>Encombrement</b>: ${this.system.encombrement}`, ...this._inventaireTemplateChatData()
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_queueChatData() { _queueChatData() {
function label(categorie) {
switch (categorie) {
case 'ideefixe': return 'Idée fixe';
case 'lancinant': return 'Désir lancinant';
}
return ''
}
return [ return [
`<b>Refoulement</b>: ${this.system.refoulement}` `<b>Refoulement</b>: ${this.system.refoulement}`,
`<b>Catégorie</b>: ${label(this.system.categorie)}`,
`<b>Affecte</b>: ${this.system.hautrevant ? 'les haut-rêvants' : 'tout le monde'}`,
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_ombreChatData() { _ombreChatData() {
return [ return this._queueChatData()
`<b>Refoulement</b>: ${this.system.refoulement}`
]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_souffleChatData() { _souffleChatData() {
return []; return [
`<b>Affecte</b>: ${this.system.hautrevant ? 'les haut-rêvants' : 'tout le monde'}`,
];
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_teteChatData() { _teteChatData() {
return []; return [
`<b>Affecte</b>: ${this.system.hautrevant ? 'les haut-rêvants' : 'tout le monde'}`,
];
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_tarotChatData() { _tarotChatData() {
return [ return [
RdDItem.propertyIfDefined('Carte', RdDUtility.linkCompendium(this.pack, this.id, this.name), this.pack),
`<b>Concept</b>: ${this.system.concept}`, `<b>Concept</b>: ${this.system.concept}`,
`<b>Aspect</b>: ${this.system.aspect}`, `<b>Aspect</b>: ${this.system.aspect}`,
] ]
@ -518,10 +543,7 @@ export class RdDItem extends Item {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_monnaieChatData() { _monnaieChatData() {
return [ return this._inventaireTemplateChatData()
`<b>Valeur en Sols</b>: ${this.system.cout}`,
`<b>Encombrement</b>: ${this.system.encombrement}`
]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
_meditationChatData() { _meditationChatData() {
@ -545,9 +567,9 @@ export class RdDItem extends Item {
] ]
} }
return [ return [
`<b>Force</b>: ${this.system.force}`, `<b>Force</b>: ${this.system.formule}`,
`<b>Refoulement</b>: ${this.system.refoulement}`, `<b>Refoulement</b>: ${this.system.refoulement}`,
`<b>Présent de cités</b>: ${this.system.presentCite}`, RdDItem.propertyIfDefined('<b>Présent de cités</b>', '', this.system.presentCite),
] ]
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -562,15 +584,12 @@ export class RdDItem extends Item {
if (!this.system.identifie) { if (!this.system.identifie) {
return [`<b>Inconnue</b>`] return [`<b>Inconnue</b>`]
} }
let properties = [ return [
`<b>Malignité</b>: ${this.system.malignite}`, `<b>Malignité</b>: ${this.system.malignite}`,
`<b>Périodicité</b>: ${this.system.periodicite}`, `<b>Périodicité</b>: ${this.system.periodicite}`,
`<b>Dommages</b>: ${this.system.dommages}` `<b>Dommages</b>: ${this.system.dommages}`,
] RdDItem.propertyIfDefined('<b>Remedes</b>', this.system.remedes, this.system.remedesconnus),
if (this.system.remedesconnus) { ]
properties.push(`<b>Remedes</b>: ${this.system.remedes}`)
}
return properties;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -585,7 +604,7 @@ export class RdDItem extends Item {
`<b>Taille</b>: ${this.system.taille}`, `<b>Taille</b>: ${this.system.taille}`,
`<b>Inertie</b>: ${this.system.inertie}`, `<b>Inertie</b>: ${this.system.inertie}`,
`<b>Enchantabilité</b>: ${this.system.enchantabilite}`, `<b>Enchantabilité</b>: ${this.system.enchantabilite}`,
`<b>Prix</b>: ${this.system.cout}`, ...this._inventaireTemplateChatData()
] ]
} }

View File

@ -42,7 +42,8 @@ export class Misc {
} }
static typeName(type, subType) { static typeName(type, subType) {
return game.i18n.localize(`${type.toUpperCase()}.Type${Misc.upperFirst(subType)}`); return subType ? game.i18n.localize(`${type.toUpperCase()}.Type${Misc.upperFirst(subType)}`)
: '';
} }
/** /**

View File

@ -246,7 +246,7 @@ export class RdDCombatManager extends Combat {
if (actions.length > 0) { if (actions.length > 0) {
return actions; return actions;
} }
if (actor.isCreature()) { if (actor.isCreatureEntite()) {
actions = actions.concat(RdDCombatManager.listActionsCreature(actor.itemTypes['competencecreature'])); actions = actions.concat(RdDCombatManager.listActionsCreature(actor.itemTypes['competencecreature']));
} else { } else {
// Recupération des items 'arme' // Recupération des items 'arme'
@ -821,7 +821,7 @@ export class RdDCombat {
essais: {} essais: {}
}; };
if (this.attacker.isCreature()) { if (this.attacker.isCreatureEntite()) {
RdDItemCompetenceCreature.setRollDataCreature(rollData); RdDItemCompetenceCreature.setRollDataCreature(rollData);
} }
else if (arme) { else if (arme) {
@ -1079,7 +1079,7 @@ export class RdDCombat {
show: {} show: {}
}; };
if (this.defender.isCreature()) { if (this.defender.isCreatureEntite()) {
RdDItemCompetenceCreature.setRollDataCreature(defenderRoll); RdDItemCompetenceCreature.setRollDataCreature(defenderRoll);
} }
@ -1158,7 +1158,7 @@ export class RdDCombat {
show: {} show: {}
}; };
if (this.defender.isCreature()) { if (this.defender.isCreatureEntite()) {
RdDItemCompetenceCreature.setRollDataCreature(rollData); RdDItemCompetenceCreature.setRollDataCreature(rollData);
} }
return rollData; return rollData;

View File

@ -42,6 +42,8 @@ import { TMRRencontres } from "./tmr-rencontres.js";
import { RdDHerbeItemSheet } from "./item-herbe-sheet.js"; import { RdDHerbeItemSheet } from "./item-herbe-sheet.js";
import { Environnement } from "./environnement.js"; import { Environnement } from "./environnement.js";
import { RdDIngredientItemSheet } from "./item-ingredient-sheet.js"; import { RdDIngredientItemSheet } from "./item-ingredient-sheet.js";
import { RdDFauneItemSheet } from "./item-faune-sheet.js";
import { RdDConteneurItemSheet } from "./item-conteneur-sheet.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
/* Foundry VTT Initialization */ /* Foundry VTT Initialization */
@ -163,8 +165,8 @@ Hooks.once("init", async function () {
RdDCombat.onSocketMessage(sockmsg); RdDCombat.onSocketMessage(sockmsg);
ChatUtility.onSocketMessage(sockmsg); ChatUtility.onSocketMessage(sockmsg);
RdDActor.onSocketMessage(sockmsg); RdDActor.onSocketMessage(sockmsg);
} catch(e) { } catch (e) {
console.error('game.socket.on(SYSTEM_SOCKET_ID) Exception: ', sockmsg,' => ', e) console.error('game.socket.on(SYSTEM_SOCKET_ID) Exception: ', sockmsg, ' => ', e)
} }
}); });
@ -187,28 +189,24 @@ Hooks.once("init", async function () {
Actors.registerSheet(SYSTEM_RDD, RdDActorVehiculeSheet, { types: ["vehicule"], makeDefault: true }); Actors.registerSheet(SYSTEM_RDD, RdDActorVehiculeSheet, { types: ["vehicule"], makeDefault: true });
Actors.registerSheet(SYSTEM_RDD, RdDActorEntiteSheet, { types: ["entite"], makeDefault: true }); Actors.registerSheet(SYSTEM_RDD, RdDActorEntiteSheet, { types: ["entite"], makeDefault: true });
Items.unregisterSheet("core", ItemSheet); Items.unregisterSheet("core", ItemSheet);
Items.registerSheet(SYSTEM_RDD, RdDSigneDraconiqueItemSheet, {
label: "Signe draconique", RdDItemSheet.register(RdDSigneDraconiqueItemSheet);
types: ["signedraconique"], RdDItemSheet.register(RdDRencontreItemSheet);
makeDefault: true RdDItemSheet.register(RdDConteneurItemSheet);
}); RdDItemSheet.register(RdDHerbeItemSheet);
Items.registerSheet(SYSTEM_RDD, RdDRencontreItemSheet, { RdDItemSheet.register(RdDFauneItemSheet);
label: "Rencontre", RdDItemSheet.register(RdDIngredientItemSheet);
types: ["rencontre"],
makeDefault: true
});
RdDHerbeItemSheet.register();
RdDIngredientItemSheet.register();
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, { Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
types: [ types: [
"competence", "competencecreature", "competence", "competencecreature",
"recettealchimique", "musique", "chant", "danse", "jeu", "recettecuisine", "oeuvre", "recettealchimique", "musique", "chant", "danse", "jeu", "recettecuisine", "oeuvre",
"objet", "arme", "armure", "conteneur", "livre", "potion", "munition", "objet", "arme", "armure", "livre", "potion", "munition",
"monnaie", "nourritureboisson", "gemme", "monnaie", "nourritureboisson", "gemme",
"meditation", "queue", "ombre", "souffle", "tete", "casetmr", "sort", "sortreserve", "meditation", "queue", "ombre", "souffle", "tete", "casetmr", "sort", "sortreserve",
"nombreastral", "tache", "maladie", "poison", "possession", "nombreastral", "tache", "maladie", "poison", "possession",
"tarot", "extraitpoetique" "tarot", "extraitpoetique"
], makeDefault: true ], makeDefault: true
}); });
CONFIG.Combat.documentClass = RdDCombatManager; CONFIG.Combat.documentClass = RdDCombatManager;
@ -247,8 +245,8 @@ function messageDeBienvenue() {
/* -------------------------------------------- */ /* -------------------------------------------- */
// Register world usage statistics // Register world usage statistics
function registerUsageCount( registerKey ) { function registerUsageCount(registerKey) {
if ( game.user.isGM ) { if (game.user.isGM) {
game.settings.register("world", "world-key", { game.settings.register("world", "world-key", {
name: "Unique world key", name: "Unique world key",
scope: "world", scope: "world",
@ -258,9 +256,9 @@ function registerUsageCount( registerKey ) {
}); });
let worldKey = game.settings.get("world", "world-key") let worldKey = game.settings.get("world", "world-key")
if ( worldKey == undefined || worldKey == "" ) { if (worldKey == undefined || worldKey == "") {
worldKey = randomID(32) worldKey = randomID(32)
game.settings.set("world", "world-key", worldKey ) game.settings.set("world", "world-key", worldKey)
} }
let regURL = `https://www.uberwald.me/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.version}"` let regURL = `https://www.uberwald.me/fvtt_appcount/count.php?name="${registerKey}"&worldKey="${worldKey}"&version="${game.release.generation}.${game.release.build}"&system="${game.system.id}"&systemversion="${game.system.version}"`
$.ajax(regURL) $.ajax(regURL)
@ -300,7 +298,7 @@ Hooks.once("ready", async function () {
} }
if (Misc.isUniqueConnectedGM()) { if (Misc.isUniqueConnectedGM()) {
messageDeBienvenue(); messageDeBienvenue();
registerUsageCount( SYSTEM_RDD ); registerUsageCount(SYSTEM_RDD);
} }
}); });

View File

@ -45,7 +45,7 @@ export class RdDPossession {
defender: defender, defender: defender,
targetToken: Targets.extractTokenData(target) targetToken: Targets.extractTokenData(target)
}; };
if (attacker.isCreature()) { if (attacker.isCreatureEntite()) {
RdDItemCompetenceCreature.setRollDataCreature(rollData) RdDItemCompetenceCreature.setRollDataCreature(rollData)
} }

View File

@ -19,17 +19,23 @@ export class RdDSheetUtility {
return $(event.currentTarget)?.parents(".item"); return $(event.currentTarget)?.parents(".item");
} }
static prepareItemDropParameters(destItemId, actorId, dragData, objetVersConteneur) { static prepareItemDropParameters(destItemId, actor, dragData, objetVersConteneur) {
const item = fromUuidSync(dragData.uuid) const item = fromUuidSync(dragData.uuid)
return { if (actor.canReceive(item)) {
destId: destItemId, return {
targetActorId: actorId, destId: destItemId,
itemId: item.id, targetActorId: actor.id,
sourceActorId: item.actor?.id, itemId: item.id,
srcId: objetVersConteneur[item.id], sourceActorId: item.actor?.id,
onEnleverConteneur: () => { delete objetVersConteneur[item.id]; }, srcId: objetVersConteneur[item.id],
onAjouterDansConteneur: (itemId, conteneurId) => { objetVersConteneur[itemId] = conteneurId; } onEnleverConteneur: () => { delete objetVersConteneur[item.id]; },
onAjouterDansConteneur: (itemId, conteneurId) => { objetVersConteneur[itemId] = conteneurId; }
}
} }
else {
ui.notifications.warn(`Impossible de donner ${item.name} à ${actor.name}: ${item.type} / ${actor.type}`);
}
return undefined;
} }
static async splitItem(item, actor, onSplit = () => { }) { static async splitItem(item, actor, onSplit = () => { }) {

View File

@ -1,5 +1,4 @@
/* Common useful functions shared between objects */ /* Common useful functions shared between objects */
import { ChatUtility } from "./chat-utility.js"; import { ChatUtility } from "./chat-utility.js";
import { RdDCombat } from "./rdd-combat.js"; import { RdDCombat } from "./rdd-combat.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
@ -14,7 +13,6 @@ import { RdDPossession } from "./rdd-possession.js";
import { RdDNameGen } from "./rdd-namegen.js"; import { RdDNameGen } from "./rdd-namegen.js";
import { RdDConfirm } from "./rdd-confirm.js"; import { RdDConfirm } from "./rdd-confirm.js";
import { RdDCalendrier } from "./rdd-calendrier.js"; import { RdDCalendrier } from "./rdd-calendrier.js";
import { RdDCarac } from "./rdd-carac.js";
import { Environnement } from "./environnement.js"; import { Environnement } from "./environnement.js";
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -185,6 +183,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/item-sort-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-sort-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-herbe-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-herbe-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-ingredient-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-ingredient-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-faune-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-livre-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-livre-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-tache-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-tache-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-potion-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-potion-sheet.html',
@ -220,6 +219,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-type.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-type.html',
'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html', 'systems/foundryvtt-reve-de-dragon/templates/enum-tmr-effet.html',
// Partials // Partials
'systems/foundryvtt-reve-de-dragon/templates/common/compendium-link.hbs',
'systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-description-overflow.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-description-sort.html',
'systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html', 'systems/foundryvtt-reve-de-dragon/templates/partial-roll-ajustements.html',
@ -328,14 +328,18 @@ export class RdDUtility {
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
}) })
); );
Handlebars.registerHelper('linkCompendium', (compendium, id, name) => `@Compendium[${compendium}.${id}]{${name}}`); Handlebars.registerHelper('linkCompendium', (pack, id, name)=> RdDUtility.linkCompendium(pack, id, name));
Handlebars.registerHelper('uniteQuantite', (type) => RdDItem.getUniteQuantite(type)); Handlebars.registerHelper('uniteQuantite', (type) => RdDItem.getUniteQuantite(type));
Handlebars.registerHelper('isEquipementFieldEditable', (type, field) => RdDItem.isEquipementFieldEditable(type, field)); Handlebars.registerHelper('isFieldInventaireModifiable', (type, field) => RdDItem.isFieldInventaireModifiable(type, field));
Handlebars.registerHelper('getFrequenceRarete', (rarete, field) => Environnement.getFrequenceRarete(rarete, field)); Handlebars.registerHelper('getFrequenceRarete', (rarete, field) => Environnement.getFrequenceRarete(rarete, field));
Handlebars.registerHelper('either', (a, b) => a ?? b); Handlebars.registerHelper('either', (a, b) => a ?? b);
return loadTemplates(templatePaths); return loadTemplates(templatePaths);
} }
static linkCompendium(pack, id, name) {
return `@Compendium[${pack}.${id}]{${name}}`;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static async creerObjet(actorSheet) { static async creerObjet(actorSheet) {
let itemType = $(".item-type").val(); let itemType = $(".item-type").val();
@ -344,7 +348,7 @@ export class RdDUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static async selectObjetType(actorSheet) { static async selectObjetType(actorSheet) {
let typeObjets = RdDItem.getTypesObjetsEquipement(); let typeObjets = RdDItem.getItemTypesInventaire();
let options = `<span class="competence-label">Selectionnez le type d'équipement</span><select class="item-type">`; let options = `<span class="competence-label">Selectionnez le type d'équipement</span><select class="item-type">`;
for (let typeName of typeObjets) { for (let typeName of typeObjets) {
options += `<option value="${typeName}">${typeName}</option>` options += `<option value="${typeName}">${typeName}</option>`
@ -466,9 +470,9 @@ export class RdDUtility {
formData.livres = this.arrayOrEmpty(itemTypes['livre']); formData.livres = this.arrayOrEmpty(itemTypes['livre']);
formData.potions = this.arrayOrEmpty(itemTypes['potion']); formData.potions = this.arrayOrEmpty(itemTypes['potion']);
formData.ingredients = this.arrayOrEmpty(itemTypes['ingredient']); formData.ingredients = this.arrayOrEmpty(itemTypes['ingredient']);
formData.faunes = this.arrayOrEmpty(itemTypes['faune']);
formData.herbes = this.arrayOrEmpty(itemTypes['herbe']); formData.herbes = this.arrayOrEmpty(itemTypes['herbe']);
formData.monnaie = this.arrayOrEmpty(itemTypes['monnaie']); formData.monnaie = this.arrayOrEmpty(itemTypes['monnaie']).sort(Monnaie.triValeurEntiere());
formData.monnaie.sort(Monnaie.triValeurEntiere());
formData.nourritureboissons = this.arrayOrEmpty(itemTypes['nourritureboisson']); formData.nourritureboissons = this.arrayOrEmpty(itemTypes['nourritureboisson']);
formData.gemmes = this.arrayOrEmpty(itemTypes['gemme']); formData.gemmes = this.arrayOrEmpty(itemTypes['gemme']);
@ -481,6 +485,7 @@ export class RdDUtility {
.concat(formData.potions) .concat(formData.potions)
.concat(formData.ingredients) .concat(formData.ingredients)
.concat(formData.herbes) .concat(formData.herbes)
.concat(formData.faunes)
.concat(formData.monnaie) .concat(formData.monnaie)
.concat(formData.nourritureboissons) .concat(formData.nourritureboissons)
.concat(formData.gemmes); .concat(formData.gemmes);

View File

@ -497,8 +497,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
} }
.foundryvtt-reve-de-dragon .sheet-body, .foundryvtt-reve-de-dragon .sheet-body,
.foundryvtt-reve-de-dragon .sheet-body .tab, .foundryvtt-reve-de-dragon .sheet-body .tab {
.foundryvtt-reve-de-dragon .sheet-body .tab .editor {
height: 100%; height: 100%;
} }
@ -543,7 +542,7 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
.editor { .editor {
border: 2; border: 2;
height: 300px; height: 10rem;
padding: 0 3px; padding: 0 3px;
} }

View File

@ -1,8 +1,8 @@
{ {
"id": "foundryvtt-reve-de-dragon", "id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"version": "10.3.4", "version": "10.3.5",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.3.4.zip", "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-10.3.5.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v10/system.json",
"compatibility": { "compatibility": {
"minimum": "10", "minimum": "10",

View File

@ -572,7 +572,7 @@
"types": [ "types": [
"competence", "competencecreature", "competence", "competencecreature",
"recettealchimique", "musique", "chant", "danse", "jeu", "recettecuisine", "oeuvre", "recettealchimique", "musique", "chant", "danse", "jeu", "recettecuisine", "oeuvre",
"objet", "arme", "armure", "conteneur", "herbe", "ingredient", "livre", "potion", "munition", "objet", "arme", "armure", "conteneur", "herbe", "ingredient", "faune", "livre", "potion", "munition",
"monnaie", "nourritureboisson", "gemme", "monnaie", "nourritureboisson", "gemme",
"meditation", "rencontre", "queue", "ombre", "souffle", "tete", "casetmr", "signedraconique", "sort", "sortreserve", "meditation", "rencontre", "queue", "ombre", "souffle", "tete", "casetmr", "signedraconique", "sort", "sortreserve",
"nombreastral", "tache", "maladie", "poison", "possession", "nombreastral", "tache", "maladie", "poison", "possession",
@ -700,11 +700,11 @@
}, },
"nourritureboisson": { "nourritureboisson": {
"templates": [ "description", "inventaire" ], "templates": [ "description", "inventaire" ],
"sust": 0,
"boisson": false, "boisson": false,
"desaltere": 0, "desaltere": 0,
"alcoolise": false, "alcoolise": false,
"force": 0, "force": 0,
"sust": 0,
"exotisme": 0 "exotisme": 0
}, },
"herbe": { "herbe": {
@ -717,8 +717,20 @@
"templates": [ "description", "inventaire", "environnement" ], "templates": [ "description", "inventaire", "environnement" ],
"niveau": 0, "niveau": 0,
"base": 0, "base": 0,
"sust": 0,
"exotisme": 0,
"categorie": "" "categorie": ""
}, },
"faune": {
"templates": [ "description", "inventaire", "environnement"],
"sust": 0,
"exotisme": 0,
"actor": {
"id": "",
"pack": "",
"name": ""
}
},
"livre": { "livre": {
"templates": [ "description", "inventaire" ], "templates": [ "description", "inventaire" ],
"competence": "", "competence": "",

View File

@ -0,0 +1 @@
<a class="content-link" draggable="true" data-pack="{{pack}}" data-uuid="Compendium.{{pack}}.{{id}}" data-id="{{id}}"><i class="fas fa-suitcase"></i>{{name}}</a>

View File

@ -0,0 +1,47 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}" />
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
</div>
</header>
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="informations">Informations</a>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.html"}}
</nav>
<section class="sheet-body">
<div class="tab items" data-group="primary" data-tab="informations">
<div class="flexcol">
<div class="form-group">
<label for="system.sust">Sustentation (si applicable)</label>
<input class="attribute-value" type="number" name="system.sust" value="{{system.sust}}" data-dtype="Number" min="0"/>
</div>
{{#if (gt system.sust 0)}}
<div class="form-group">
<label for="system.exotisme">Exotisme</label>
<input class="attribute-value" type="number" name="system.exotisme" value="{{system.exotisme}}" data-dtype="Number" min="-10" max="0"/>
</div>
{{/if}}
<div class="form-group">
<label>Créature correspondante</label>
<div>
{{#if system.actor.id}}
<label>
{{>'systems/foundryvtt-reve-de-dragon/templates/common/compendium-link.hbs'
pack=system.actor.pack id=system.actor.id name=system.actor.name}}
</label>
<a class="linked-actor-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
{{else}}
<label>Pas de fiche de créature</label>
{{/if}}
</div>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.html"}}
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</div>
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.html"}}
</section>
</form>

View File

@ -5,7 +5,7 @@
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1> <h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
{{#if isIngredientPotionBase}} {{#if isIngredientPotionBase}}
<div class="form-group"> <div class="form-group">
<span for="xp"><a class="creer-potion-base chat-card-button" data-actor-id="{{actorId}}">Fabriquer une potion depuis cette plante</a></span> <span><a class="creer-potion-base chat-card-button" data-actor-id="{{actorId}}">Fabriquer une potion depuis cette plante</a></span>
</div> </div>
{{/if}} {{/if}}
</div> </div>

View File

@ -1,20 +1,20 @@
<div class="form-group"> <div class="form-group">
<label for="system.qualite">Qualité</label> <label for="system.qualite">Qualité</label>
<input class="attribute-value" type="text" name="system.qualite" value="{{system.qualite}}" data-dtype="Number" <input class="attribute-value" type="text" name="system.qualite" value="{{system.qualite}}" data-dtype="Number"
{{#unless (isEquipementFieldEditable type 'qualite')}}disabled{{/unless}}/> {{#unless (isFieldInventaireModifiable type 'qualite')}}disabled{{/unless}}/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="system.encombrement">Encombrement</label> <label for="system.encombrement">Encombrement</label>
<input class="attribute-value" type="text" name="system.encombrement" value="{{system.encombrement}}" data-dtype="Number" <input class="attribute-value" type="text" name="system.encombrement" value="{{system.encombrement}}" data-dtype="Number"
{{#unless (isEquipementFieldEditable type 'encombrement')}}disabled{{/unless}}/> {{#unless (isFieldInventaireModifiable type 'encombrement')}}disabled{{/unless}}/>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="system.quantite">Quantité {{uniteQuantite type}}</label> <label for="system.quantite">Quantité {{uniteQuantite type}}</label>
<input class="attribute-value" type="text" name="system.quantite" value="{{system.quantite}}" data-dtype="Number" <input class="attribute-value" type="text" name="system.quantite" value="{{system.quantite}}" data-dtype="Number"
{{#unless (isEquipementFieldEditable type 'quantite')}}disabled{{/unless}}/> {{#unless (isFieldInventaireModifiable type 'quantite')}}disabled{{/unless}}/>
</div> </div>
<div class="form-group item-cout"> <div class="form-group item-cout">
<label for="system.cout">Prix (sols) </label> <label for="system.cout">Prix (sols) </label>
<input class="attribute-value" type="text" name="system.cout" value="{{system.cout}}" data-dtype="Number" <input class="attribute-value" type="text" name="system.cout" value="{{system.cout}}" data-dtype="Number"
{{#unless (isEquipementFieldEditable type 'cout')}}disabled{{/unless}}/> {{#unless (isFieldInventaireModifiable type 'cout')}}disabled{{/unless}}/>
</div> </div>