Petits fixes et petits conforts #543

Merged
uberwald merged 4 commits from VincentVk/foundryvtt-reve-de-dragon:v1.5 into v1.5 2022-07-22 10:45:44 +02:00
6 changed files with 42 additions and 22 deletions

View File

@ -98,7 +98,6 @@ export class RdDActor extends Actor {
* @param {Object} options (Unused) Additional options which customize the creation workflow.
*
*/
static async create(actorData, options) {
// Case of compendium global import
if (actorData instanceof Array) {
@ -135,13 +134,6 @@ export class RdDActor extends Actor {
this.encTotal = 0;
this.prixTotalEquipement = 0;
/*
// Auto-resize token
if (this.isToken) {
let tokenSize = actorData.data.carac.taille.value/10;
this.token.update({height: tokenSize, width: tokenSize } );
}*/
// Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized.
if (actorData.type === 'personnage') this._prepareCharacterData(actorData);
@ -3593,7 +3585,7 @@ export class RdDActor extends Actor {
isEntiteCauchemarAccordee(attaquant) {
if (!this.isEntiteCauchemar()) { return true; }
let resonnance = Misc.templateData(this).sante.resonnance;
return (resonnance.actors.find(it => it == attaquant._id));
return (resonnance.actors.find(it => it == attaquant.id));
}
/* -------------------------------------------- */
@ -3603,11 +3595,11 @@ export class RdDActor extends Actor {
return;
}
let resonnance = duplicate(Misc.templateData(this).sante.resonnance);
if (resonnance.actors.find(it => it == attaquant._id)) {
if (resonnance.actors.find(it => it == attaquant.id)) {
// déjà accordé
return;
}
resonnance.actors.push(attaquant._id);
resonnance.actors.push(attaquant.id);
await this.update({ "data.sante.resonnance": resonnance });
return;
}

View File

@ -55,7 +55,7 @@ export class DialogItemAchat extends Dialog {
static prepareVenteData(buttonAcheter, vendeurId, vendeur, acheteur) {
const jsondata = buttonAcheter.attributes['data-jsondata']?.value;
const prixLot = buttonAcheter.attributes['data-prixLot']?.value ?? 0;
const prixLot = parseInt(buttonAcheter.attributes['data-prixLot']?.value ?? 0);
let venteData = {
item: JSON.parse(jsondata),
vendeurId: vendeurId,

View File

@ -320,7 +320,7 @@ export class RdDCombatManager extends Combat {
initOffset = 10;
caracForInit = combatant.actor.getReveActuel();
initInfo = "Possession"
} else if (action.name == 'autre') {
} else if (action.action == 'autre') {
initOffset = 2;
initInfo = "Autre Action"
} else if (action.action == 'haut-reve') {

View File

@ -1,3 +1,4 @@
import { RdDActor } from "./actor.js";
import { Misc } from "./misc.js";
import { RdDDice } from "./rdd-dice.js";
@ -11,9 +12,18 @@ const words = [ 'pore', 'pre', 'flor', 'lane', 'turlu', 'pin', 'a', 'alph', 'i',
export class RdDNameGen {
static async getName(msg, params) {
let name = Misc.upperFirst( await RdDDice.rollOneOf(words) + await RdDDice.rollOneOf(words) )
//console.log(name);
ChatMessage.create( { content: `Nom : ${name}`, whisper: ChatMessage.getWhisperRecipients("GM") } );
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-command-nom.html`, {
nom: Misc.upperFirst(await RdDDice.rollOneOf(words) + await RdDDice.rollOneOf(words))
});
ChatMessage.create({ content: html, whisper: ChatMessage.getWhisperRecipients("GM") });
}
static async onCreerActeur(event) {
const button = event.currentTarget;
await RdDActor.create({
name: button.attributes['data-nom'].value,
type: button.attributes['data-type'].value
},
{renderSheet: true});
}
}

View File

@ -11,6 +11,7 @@ import { RdDDice } from "./rdd-dice.js";
import { RdDItem } from "./item.js";
import { Monnaie } from "./item-monnaie.js";
import { RdDPossession } from "./rdd-possession.js";
import { RdDNameGen } from "./rdd-namegen.js";
/* -------------------------------------------- */
// This table starts at 0 -> niveau -10
@ -704,6 +705,7 @@ export class RdDUtility {
// gestion bouton tchat Acheter
html.on("click", '.button-acheter', event => DialogItemAchat.onButtonAcheter(event));
html.on("click", '.button-creer-acteur', event => RdDNameGen.onCreerActeur(event));
// Gestion du bouton payer
html.on("click", '.payer-button', event => {

View File

@ -0,0 +1,16 @@
<h4>Proposition de nom: {{nom}}</h4>
<span class="chat-card-button-area">
<a class="button-creer-acteur chat-card-button"
data-nom='{{nom}}'
data-type='personnage'
>
Créer un Personnage</a>
</span>
<span class="chat-card-button-area">
<a class="button-creer-acteur chat-card-button"
data-nom='{{nom}}'
data-type='creature'>
Créer une créature</a>
</span>