Gestion de la Faune #587
@ -132,12 +132,14 @@ 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)
|
||||||
|
if (dropParams){
|
||||||
const callSuper = await this.actor.processDropItem(dropParams)
|
const callSuper = await this.actor.processDropItem(dropParams)
|
||||||
if (callSuper) {
|
if (callSuper) {
|
||||||
await super._onDropItem(event, dragData)
|
await super._onDropItem(event, dragData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async createItem(name, type) {
|
async createItem(name, type) {
|
||||||
|
@ -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...
|
||||||
|
@ -30,9 +30,7 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_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",
|
||||||
@ -73,8 +71,8 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
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) {
|
if (this.actor) {
|
||||||
formData.isOwned = true;
|
formData.isOwned = true;
|
||||||
@ -97,18 +95,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();
|
||||||
@ -256,8 +254,10 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
|
|
||||||
/** @override */
|
/** @override */
|
||||||
_updateObject(event, formData) {
|
_updateObject(event, formData) {
|
||||||
|
if (this.item.type == 'sort') {
|
||||||
// Données de bonus de cases ?
|
// Données de bonus de cases ?
|
||||||
formData['system.bonuscase'] = RdDItemSort.buildBonusCaseStringFromFormData(formData.bonusValue, formData.caseValue);
|
formData['system.bonuscase'] = RdDItemSort.buildBonusCaseStringFromFormData(formData.bonusValue, formData.caseValue);
|
||||||
|
}
|
||||||
|
|
||||||
return this.item.update(formData);
|
return this.item.update(formData);
|
||||||
}
|
}
|
||||||
@ -301,7 +301,7 @@ export class RdDItemSheet extends ItemSheet {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async _onDropItem(event, dragData) {
|
async _onDropItem(event, dragData) {
|
||||||
if (this.actor) {
|
if (this.actor) {
|
||||||
const dropParams = RdDSheetUtility.prepareItemDropParameters(this.item.id, this.actor.id, dragData, this.objetVersConteneur);
|
const dropParams = RdDSheetUtility.prepareItemDropParameters(this.item.id, this.actor, dragData, this.objetVersConteneur);
|
||||||
await this.actor.processDropItem(dropParams);
|
await this.actor.processDropItem(dropParams);
|
||||||
await this.render(true);
|
await this.render(true);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
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",
|
||||||
@ -70,7 +69,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,7 +81,7 @@ 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;
|
||||||
@ -102,8 +105,8 @@ export class RdDItem extends Item {
|
|||||||
super(itemData, context);
|
super(itemData, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTypesObjetsEquipement() {
|
static getItemTypesInventaire() {
|
||||||
return typesObjetsEquipement
|
return typesObjetsInventaire
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTypesOeuvres() {
|
static getTypesOeuvres() {
|
||||||
@ -113,11 +116,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 +142,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";
|
||||||
@ -202,7 +208,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()
|
||||||
@ -230,12 +236,12 @@ export class RdDItem extends Item {
|
|||||||
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,8 +281,8 @@ 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];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +465,7 @@ export class RdDItem extends Item {
|
|||||||
`<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([
|
].concat([
|
||||||
this.system.cacher_points_de_tache ? [] :`<b>Points de Tâche</b>: ${this.system.points_de_tache}`
|
this.system.cacher_points_de_tache ? [] : `<b>Points de Tâche</b>: ${this.system.points_de_tache}`
|
||||||
]).concat([
|
]).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}`]
|
||||||
);
|
);
|
||||||
|
@ -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)}`)
|
||||||
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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;
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,11 +19,12 @@ 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)
|
||||||
|
if (actor.canReceive(item)) {
|
||||||
return {
|
return {
|
||||||
destId: destItemId,
|
destId: destItemId,
|
||||||
targetActorId: actorId,
|
targetActorId: actor.id,
|
||||||
itemId: item.id,
|
itemId: item.id,
|
||||||
sourceActorId: item.actor?.id,
|
sourceActorId: item.actor?.id,
|
||||||
srcId: objetVersConteneur[item.id],
|
srcId: objetVersConteneur[item.id],
|
||||||
@ -31,6 +32,11 @@ export class RdDSheetUtility {
|
|||||||
onAjouterDansConteneur: (itemId, conteneurId) => { objetVersConteneur[itemId] = conteneurId; }
|
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 = () => { }) {
|
||||||
const dialog = await DialogSplitItem.create(item, async (item, split) => {
|
const dialog = await DialogSplitItem.create(item, async (item, split) => {
|
||||||
|
@ -330,7 +330,7 @@ export class RdDUtility {
|
|||||||
);
|
);
|
||||||
Handlebars.registerHelper('linkCompendium', (compendium, id, name) => `@Compendium[${compendium}.${id}]{${name}}`);
|
Handlebars.registerHelper('linkCompendium', (compendium, id, name) => `@Compendium[${compendium}.${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);
|
||||||
@ -344,7 +344,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>`
|
||||||
@ -467,8 +467,7 @@ export class RdDUtility {
|
|||||||
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.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']);
|
||||||
|
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user