Liens de jets de dés dans le tchat

This commit is contained in:
Vincent Vandemeulebrouck 2025-01-12 20:00:13 +01:00
parent a9eb101c9d
commit 969bc3b573
25 changed files with 383 additions and 277 deletions

View File

@ -7,12 +7,11 @@
- à tous les tokens sélectionnés
- sinon, à l'acteur propriétaire d'un Item
- sinon, au personnage du joueur
- gestion des blocs secrets dans les descriptions
- on peut ajouter des liens "jet de dés" pour appeler une formule dés de foundry
- les liens "manipulation alchimiques" peuvent être dans les descriptions, notes, ...
- les "manipulation alchimiques" fonctionnent comme tous les autres jets
- on peut poster les liens "jet de dés" dans le tchat et les utiliser depuis le tchat
## 12.0.33 - la vieillesse d'Astrobazzarh
- retour de l'expérience pour les joueurs

View File

@ -19,7 +19,7 @@ import { RdDBaseActorSangSheet } from "./actor/base-actor-sang-sheet.js";
import { RdDCoeur } from "./coeur/rdd-coeur.js";
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js";
import { RdDItemRace } from "./item/race.js";
import { RdDTextEditor } from "./apps/rdd-text-roll.js";
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
/* -------------------------------------------- */
/**

View File

@ -1,4 +1,4 @@
import { RdDTextEditor } from "../apps/rdd-text-roll.js";
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js";
import { Grammar } from "../grammar.js";
import { ITEM_TYPES } from "../item.js";
import { RdDSheetUtility } from "../rdd-sheet-utility.js";
@ -49,6 +49,8 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
}], { renderSheet: true })
)
this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
if (this.options.vueDetaillee) {
// On carac change

View File

@ -5,7 +5,7 @@ import { RdDSheetUtility } from "../rdd-sheet-utility.js";
import { Monnaie } from "../item-monnaie.js";
import { RdDItem, ITEM_TYPES } from "../item.js";
import { RdDItemCompetenceCreature } from "../item-competencecreature.js";
import { RdDTextEditor } from "../apps/rdd-text-roll.js";
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js";
/* -------------------------------------------- */
/**

View File

@ -0,0 +1,72 @@
import "./xregexp-all.js";
import { SystemCompendiums } from "../settings/system-compendiums.js";
import { ACTOR_TYPES } from "../item.js";
import { TextRollAlchimie } from "./textroll/text-roll-alchimie.js";
import { TextRollCaracCompetence } from "./textroll/text-roll-carac-competence.js";
import { TextRollFormula } from "./textroll/text-roll-formula.js";
import { TextRollManager } from "./textroll/text-roll-formatter.js";
const TEXT_ROLL_MANAGERS = [
new TextRollAlchimie(),
new TextRollCaracCompetence(),
new TextRollFormula()];
export class RdDTextEditor {
static async enrichHTML(text, object) {
const context = {
text, object,
competences: await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage),
}
for (let manager of TEXT_ROLL_MANAGERS) {
context.code = manager.code
context.template = manager.template
context.text = await manager.onReplaceRoll(context);
}
// TEXT_ROLL_MANAGERS.forEach(async manager => await RdDTextEditor._applyReplaceAll(manager, context))
return await TextEditor.enrichHTML(context.text, {
relativeTo: object,
secrets: object?.isOwner,
async: true
})
}
static async _applyReplaceAll(manager, context) {
context.code = manager.code
context.template = manager.template
context.text = await manager.onReplaceRoll(context);
return context.text
}
static getEventElement(event) {
return $(event.currentTarget)?.parents(".roll-text-link");
}
static async rollText(event, actor) {
const code = TextRollManager.getNode(event)?.data('code')
const manager = TEXT_ROLL_MANAGERS.find(it => it.code == code)
if (manager) {
await manager.onRollText(event, actor)
}
}
static async chatRollText(event) {
const node = TextRollManager.getNode(event);
if (node) {
const code = node.data('code')
const param = node.data('json')
const manager = TEXT_ROLL_MANAGERS.find(it => it.code == code)
const text = await TextRollManager.createRollText(manager.template,
param, false)
ChatMessage.create({
content: text
})
}
}
static registerChatCallbacks(html) {
html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event))
}
}

View File

@ -1,224 +0,0 @@
import "./xregexp-all.js";
import { RdDCarac } from "../rdd-carac.js";
import { SystemCompendiums } from "../settings/system-compendiums.js";
import { RdDItemCompetence } from "../item-competence.js";
import { ACTOR_TYPES, ITEM_TYPES } from "../item.js";
import { RdDUtility } from "../rdd-utility.js";
import { Misc } from "../misc.js";
import { RdDAlchimie } from "../rdd-alchimie.js";
const REGEX_ALCHIMIE_TERMES = "(?<termes>(\\w|-)+)"
const REGEX_ALCHIMIE_MANIP = "(?<manip>(couleur|consistance))"
const XREGEXP_ROLL_ALCHIMIE = XRegExp("@roll\\[" + REGEX_ALCHIMIE_MANIP + "\\s+" + REGEX_ALCHIMIE_TERMES + "\\]", 'giu')
const XREGEXP_ROLL_ALCHIMIE_MANIP = XRegExp("@" + REGEX_ALCHIMIE_MANIP + "\\{" + REGEX_ALCHIMIE_TERMES + "\\}", 'giu')
const REGEXP_ROLL_CARAC_COMP = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)(\\/(?<competence>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?(/(?<diff>[\\+\\-]?\\d+))?"
const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu')
const REGEXP_ROLL_FORMULA = "(?<formula>[^\\[\\]]+)"
const XREGEXP_ROLL_FORMULA = XRegExp("@roll\\[" + REGEXP_ROLL_FORMULA + "\\]", 'giu')
/**
* classe pour gérer les jets d'alchimie
*/
class TextRollAlchimie {
static async onRollText(event, actor) {
actor = TextRollAlchimie.getSelectedActor(actor)
if (actor) {
const recetteId = event.currentTarget.attributes['data-recette-id']?.value
const manip = event.currentTarget.attributes['data-manip'].value
const termes = event.currentTarget.attributes['data-termes'].value
if (recetteId) {
await actor.effectuerTacheAlchimie(recetteId, manip, termes)
}
else {
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
const diff = RdDAlchimie.getDifficulte(termes)
await actor.rollCaracCompetence(carac.code, 'Alchimie', diff)
}
}
}
static getSelectedActor(actor) {
actor = actor ?? RdDUtility.getSelectedActor()
if (actor && actor.type == ACTOR_TYPES.personnage) {
return actor
}
return undefined
}
static async onReplaceRoll(context) {
const handler = new TextRollAlchimie(context)
context.text = await handler.replaceManipulationAlchimie()
}
constructor(context) {
this.context = context
}
async replaceManipulationAlchimie() {
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE, async (rollMatch, i) => await this._replaceOneAlchimie(rollMatch, i))
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE_MANIP, async (rollMatch, i) => await this._replaceOneAlchimie(rollMatch, i))
return this.context.text
}
async _replaceOneAlchimie(rollMatch, i) {
if (rollMatch.termes && rollMatch.manip) {
const manip = rollMatch.manip
await this._replaceManip(manip, rollMatch, i)
}
}
async _replaceManip(manip, rollMatch, i) {
const termes = rollMatch.termes
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
const diff = RdDAlchimie.getDifficulte(termes)
const recette = (this.context.object instanceof Item && this.context.object.type == ITEM_TYPES.recettealchimique) ? this.context.object : undefined
const replacement = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/apps/link-text-roll-alchimie.hbs`, {
manip,
termes,
recette,
carac,
diff
})
this.context.text = this.context.text.replace(rollMatch[0], replacement);
}
}
/**
* classe pour gérer les jets de caractéristique/compétence depuis
* les journaux/descriptions
*/
class TextRollCaracCompetence {
static async onRollText(event, actor) {
const caracCode = event.currentTarget.attributes['data-carac-code']?.value
if (caracCode) {
const competence = event.currentTarget.attributes['data-competence']?.value
const diff = event.currentTarget.attributes['data-diff']?.value
const actors = TextRollCaracCompetence.getSelectedActors(actor)
actors.forEach(async it => await TextRollCaracCompetence.doRoll(it, caracCode, competence, diff))
}
}
static async doRoll(actor, caracCode, competence, diff) {
caracCode = actor.mapCarac(caracCode)
if (competence) {
if (actor.type == ACTOR_TYPES.personnage) {
await actor.rollCaracCompetence(caracCode, competence, diff)
}
else {
await actor.doRollCaracCompetence(caracCode, competence, diff)
}
}
else {
await actor.rollCarac(caracCode, { diff })
}
}
static async onReplaceRoll(context) {
const handler = new TextRollCaracCompetence(context)
context.text = await handler.replaceRollCaracCompetence()
}
static getSelectedActors(actor) {
const selected = canvas.tokens.controlled.map(it => it.actor).filter(it => it)
if (selected.length > 0) {
return selected
}
actor = actor ?? RdDUtility.getSelectedActor()
if (actor) {
return [actor]
}
return []
}
constructor(context) {
this.context = context
}
async replaceRollCaracCompetence() {
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_CARAC_COMP, async (rollMatch, i) => await this._replaceOne(rollMatch, i))
return this.context.text
}
async _replaceOne(rollMatch, i) {
const carac = RdDCarac.caracDetails(rollMatch.carac)
if (carac) {
const competence = rollMatch.competence ? RdDItemCompetence.findCompetence(this.context.competences, rollMatch.competence) : undefined
const replacement = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/apps/link-text-roll-carac-competence.hbs`, {
carac: carac,
competence: competence?.name,
diff: rollMatch.diff
})
this.context.text = this.context.text.replace(rollMatch[0], replacement)
}
}
}
/**
* classe pour gérer les jets de dés (formules Foundry)
*/
class TextRollFoundry {
static async onReplaceRoll(context) {
const handler = new TextRollFoundry(context.text)
context.text = await handler.replaceRolls()
}
static async onRollText(event, actor) {
const rollFoundry = event.currentTarget.attributes['data-roll-foundry']?.value
if (rollFoundry) {
const roll = new Roll(rollFoundry)
await roll.evaluate()
await roll.toMessage()
}
}
constructor(text) {
this.text = text
}
async replaceRolls() {
await XRegExp.forEach(this.text, XREGEXP_ROLL_FORMULA, async (rollMatch, i) => await this._replaceOne(rollMatch, i))
return this.text
}
async _replaceOne(rollMatch, i) {
if (rollMatch.formula) {
const replacement = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/apps/link-text-roll-foundry.hbs`, {
formula: rollMatch.formula,
})
this.text = this.text.replace(rollMatch[0], replacement)
}
}
}
export class RdDTextEditor {
static async enrichHTML(text, object) {
const competences = await SystemCompendiums.getCompetences(ACTOR_TYPES.personnage);
const context = { text, competences, object }
await TextRollAlchimie.onReplaceRoll(context)
await TextRollCaracCompetence.onReplaceRoll(context)
await TextRollFoundry.onReplaceRoll(context)
return await TextEditor.enrichHTML(context.text, {
relativeTo: object,
secrets: object?.isOwner,
async: true
})
}
static async rollText(event, actor) {
const rollMode = event.currentTarget.attributes['data-roll-mode']?.value;
switch (rollMode) {
case 'foundry':
return await TextRollFoundry.onRollText(event, actor)
case 'carac':
return await TextRollCaracCompetence.onRollText(event, actor)
case 'alchimie':
return await TextRollAlchimie.onRollText(event, actor)
}
}
}

View File

@ -0,0 +1,79 @@
import "../xregexp-all.js";
import { ACTOR_TYPES, ITEM_TYPES } from "../../item.js";
import { RdDCarac } from "../../rdd-carac.js";
import { RdDUtility } from "../../rdd-utility.js";
import { RdDAlchimie } from "../../rdd-alchimie.js";
import { TextRollManager } from "./text-roll-formatter.js";
const REGEX_ALCHIMIE_TERMES = "(?<termes>(\\w|-)+)"
const REGEX_ALCHIMIE_MANIP = "(?<manip>(couleur|consistance))"
const XREGEXP_ROLL_ALCHIMIE = XRegExp("@roll\\[" + REGEX_ALCHIMIE_MANIP + "\\s+" + REGEX_ALCHIMIE_TERMES + "\\]", 'giu')
const XREGEXP_ROLL_ALCHIMIE_MANIP = XRegExp("@" + REGEX_ALCHIMIE_MANIP + "\\{" + REGEX_ALCHIMIE_TERMES + "\\}", 'giu')
/**
* classe pour gérer les jets d'alchimie
*/
export class TextRollAlchimie {
get code() { return 'alchimie' }
get template() { return `systems/foundryvtt-reve-de-dragon/templates/apps/textroll/link-text-roll-alchimie.hbs` }
async onReplaceRoll(context) {
const handler = new AlchimieTextBuilder(context)
return await handler.replaceAll()
}
async onRollText(event, actor) {
actor = this.getSelectedActor(actor)
if (actor) {
const node = TextRollManager.getNode(event)
const recetteId = node.data('recetteid')
const manip = node.data('manip')
const termes = node.data('termes')
if (recetteId) {
await actor.effectuerTacheAlchimie(recetteId, manip, termes)
}
else {
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
const diff = RdDAlchimie.getDifficulte(termes)
await actor.rollCaracCompetence(carac.code, 'Alchimie', diff)
}
}
}
getSelectedActor(actor) {
actor = actor ?? RdDUtility.getSelectedActor()
if (actor && actor.type == ACTOR_TYPES.personnage) {
return actor
}
return undefined
}
}
class AlchimieTextBuilder {
constructor(context) {
this.context = context
}
async replaceAll() {
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE, async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_ALCHIMIE_MANIP, async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
return this.context.text
}
async replaceMatch(rollMatch, i) {
if (rollMatch.termes && rollMatch.manip) {
const manip = rollMatch.manip
const termes = rollMatch.termes
const carac = RdDCarac.caracDetails(RdDAlchimie.getCaracTache(manip))
const diff = RdDAlchimie.getDifficulte(termes)
const recette = (this.context.object instanceof Item && this.context.object.type == ITEM_TYPES.recettealchimique) ? this.context.object : undefined
const replacement = await TextRollManager.createRollText(this.context.template,
{
code: this.context.code,
manip, termes, carac, diff, recetteid: recette?.id,
})
this.context.text = this.context.text.replace(rollMatch[0], replacement);
}
}
}

View File

@ -0,0 +1,88 @@
import "../xregexp-all.js";
import { ACTOR_TYPES } from "../../item.js";
import { RdDCarac } from "../../rdd-carac.js";
import { RdDItemCompetence } from "../../item-competence.js";
import { RdDUtility } from "../../rdd-utility.js";
import { TextRollManager } from "./text-roll-formatter.js";
const REGEXP_ROLL_CARAC_COMP = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)(\\/(?<competence>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+))?(/(?<diff>[\\+\\-]?\\d+))?"
const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu')
/**
* classe pour gérer les jets de caractéristique/compétence depuis
* les journaux/descriptions
*/
export class TextRollCaracCompetence {
get code() { return 'carac' }
get template() { return `systems/foundryvtt-reve-de-dragon/templates/apps/textroll/link-text-roll-carac-competence.hbs` }
async onReplaceRoll(context) {
const handler = new CaracCompetenceTextBuilder(context)
return await handler.replaceAll()
}
async onRollText(event, actor) {
const node = TextRollManager.getNode(event)
const caracCode = node.data('carac-code')
if (caracCode) {
const competence = node.data('competence')
const diff = node.data('diff')
const actors = this.getSelectedActors(actor)
actors.forEach(async it => await this.doRoll(it, caracCode, competence, diff))
}
}
async doRoll(actor, caracCode, competence, diff) {
caracCode = actor.mapCarac(caracCode)
if (competence) {
if (actor.type == ACTOR_TYPES.personnage) {
await actor.rollCaracCompetence(caracCode, competence, diff)
}
else {
await actor.doRollCaracCompetence(caracCode, competence, diff)
}
}
else {
await actor.rollCarac(caracCode, { diff })
}
}
getSelectedActors(actor) {
const selected = canvas.tokens.controlled.map(it => it.actor).filter(it => it)
if (selected.length > 0) {
return selected
}
actor = actor ?? RdDUtility.getSelectedActor()
if (actor) {
return [actor]
}
return []
}
}
class CaracCompetenceTextBuilder {
constructor(context) {
this.context = context
}
async replaceAll() {
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_CARAC_COMP, async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
return this.context.text
}
async replaceMatch(rollMatch, i) {
const carac = RdDCarac.caracDetails(rollMatch.carac)
if (carac) {
const competence = rollMatch.competence ? RdDItemCompetence.findCompetence(this.context.competences, rollMatch.competence) : undefined
const replacement = await TextRollManager.createRollText(this.context.template,
{
code: this.context.code,
carac: carac,
competence: competence?.name,
diff: rollMatch.diff,
})
this.context.text = this.context.text.replace(rollMatch[0], replacement)
}
}
}

View File

@ -0,0 +1,14 @@
export class TextRollManager {
static async createRollText(template, param, showLink = true) {
return await renderTemplate(template, {
param: param,
options: { showlink: showLink }
})
}
static getNode(event) {
return $(event.currentTarget)?.parents(".roll-text-link");
}
}

View File

@ -0,0 +1,51 @@
import "../xregexp-all.js";
import { TextRollManager } from "./text-roll-formatter.js";
const REGEXP_ROLL_FORMULA = "(?<formula>[^\\[\\]]+)"
const XREGEXP_ROLL_FORMULA = XRegExp("@roll\\[" + REGEXP_ROLL_FORMULA + "\\]", 'giu')
/**
* classe pour gérer les jets de dés (formules Foundry)
*/
export class TextRollFormula {
get code() { return 'formula' }
get template() { return `systems/foundryvtt-reve-de-dragon/templates/apps/textroll/link-text-roll-formula.hbs` }
async onReplaceRoll(context) {
const handler = new FormulaTextBuilder(context)
return await handler.replaceAll()
}
async onRollText(event, actor) {
const node = TextRollManager.getNode(event)
const rollFormula = node.data('roll-formula')
if (rollFormula) {
const roll = new Roll(rollFormula)
await roll.evaluate()
await roll.toMessage()
}
}
}
class FormulaTextBuilder {
constructor(context) {
this.context = context
}
async replaceAll() {
await XRegExp.forEach(this.context.text, XREGEXP_ROLL_FORMULA,
async (rollMatch, i) => await this.replaceMatch(rollMatch, i))
return this.context.text
}
async replaceMatch(rollMatch, i) {
if (rollMatch.formula) {
const replacement = await TextRollManager.createRollText(this.context.template,
{
code: this.context.code,
formula: rollMatch.formula,
})
this.context.text = this.context.text.replace(rollMatch[0], replacement)
}
}
}

View File

@ -1,6 +1,5 @@
import { RdDBaseActor } from "../actor/base-actor.js";
import { ChatUtility } from "../chat-utility.js";
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
const INFO_COEUR = 'info-coeur';

View File

@ -13,7 +13,7 @@ import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
import { ACTOR_TYPES, ITEM_TYPES, RdDItem } from "./item.js";
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
import { RdDTextEditor } from "./apps/rdd-text-roll.js";
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
/**
* Extend the basic ItemSheet for RdD specific items
@ -207,6 +207,7 @@ export class RdDItemSheet extends ItemSheet {
this.html.find('input[name="system.cacher_points_de_tache"]').change(async event => await this.item.update({ 'system.cacher_points_de_tache': event.currentTarget.checked }));
this.html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
this.html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
if (this.actor) {
this.html.find('.item-split').click(async event => RdDSheetUtility.splitItem(RdDSheetUtility.getItem(event, this.actor), this.actor, this.getActionRenderItem()));

View File

@ -1,4 +1,4 @@
import { RdDTextEditor } from "../apps/rdd-text-roll.js";
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js";
import { SYSTEM_RDD } from "../constants.js";
import { Misc } from "../misc.js";
@ -24,5 +24,6 @@ export class RdDJournalSheet extends JournalTextPageSheet {
super.activateListeners(html);
html.find('.roll-text').click(async event => await RdDTextEditor.rollText(event, this.actor))
html.find('.chat-roll-text').click(async event => await RdDTextEditor.chatRollText(event))
}
}

View File

@ -76,7 +76,7 @@ import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.
import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js"
import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
import { RdDJournalSheet } from "./journal/journal-sheet.js"
import { RdDTextEditor } from "./apps/rdd-text-roll.js"
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js"
/**
* RdD system

View File

@ -22,6 +22,7 @@ import { APP_ASTROLOGIE_REFRESH } from "./sommeil/app-astrologie.js";
import { RDD_CONFIG } from "./constants.js";
import { RdDBaseActor } from "./actor/base-actor.js";
import { RdDCarac } from "./rdd-carac.js";
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
/* -------------------------------------------- */
// This table starts at 0 -> niveau -10
@ -289,7 +290,8 @@ export class RdDUtility {
Handlebars.registerHelper('grammar-apostrophe', (article, str) => Grammar.apostrophe(article, str));
Handlebars.registerHelper('grammar-un', str => Grammar.articleIndetermine(str));
Handlebars.registerHelper('grammar-accord', (genre, ...args) => Grammar.accord(genre, args));
Handlebars.registerHelper('json-stringify', object => JSON.stringify(object))
// math
Handlebars.registerHelper('min', (...args) => Math.min(...args.slice(0, -1)));
Handlebars.registerHelper('repeat', function(n, block) {
@ -695,6 +697,8 @@ export class RdDUtility {
RdDCombat.registerChatCallbacks(html)
RdDEmpoignade.registerChatCallbacks(html)
RdDCoeur.registerChatCallbacks(html)
RdDTextEditor.registerChatCallbacks(html)
// Gestion spécifique message passeurs
html.on("click", '.tmr-passeur-coord a', event => {

View File

@ -22,8 +22,9 @@ results:
flags: {}
type: text
text: >-
Ami bousculé : Le compagnon bousculé doit réussir Empathie/Vigilance à
-1d6 ou être en demi-surprise jusquà la fin du round suivant.
Ami bousculé : Le compagnon bousculé doit réussir
@roll[Empathie/Vigilance] à
-@roll[1d6] ou être en demi-surprise jusquà la fin du round suivant.
img: icons/svg/d20-black.svg
weight: 1
range:
@ -72,7 +73,7 @@ results:
flags: {}
type: text
text: >-
Arme choquée : Larme utilisée joue un jet de Résistance à -2d6 et perd ce
Arme choquée : Larme utilisée joue un jet de Résistance à -@roll[2d6] et perd ce
nombre de points de résistance en cas déchec.
img: icons/svg/d20-black.svg
weight: 1
@ -90,7 +91,7 @@ results:
flags: {}
type: text
text: >-
Déséquilibré : Réussir Agilité/Vigilance à -1d6 ou être en demi-surprise
Déséquilibré : Réussir Agilité/Vigilance à -@roll[1d6] ou être en demi-surprise
jusquà la fin du round suivant.
img: icons/svg/d20-black.svg
weight: 1
@ -107,7 +108,7 @@ results:
- _id: GOYmqZj1Lnc0cKO9
flags: {}
type: text
text: 'Faux mouvement : Perte de 2d6 points dendurance.'
text: 'Faux mouvement : Perte de @roll[2d6] points dendurance.'
img: icons/svg/d20-black.svg
weight: 1
range:
@ -124,7 +125,7 @@ results:
flags: {}
type: text
text: >-
Déséquilibré : Réussir Agilité/Vigilance à -1d6 ou être en demi-surprise
Déséquilibré : Réussir Agilité/Vigilance à -@roll[1d6] ou être en demi-surprise
jusquà la fin du round suivant.
img: icons/svg/d20-black.svg
weight: 1
@ -142,7 +143,7 @@ results:
flags: {}
type: text
text: >-
Arme choquée : Larme utilisée joue un jet de Résistance à -2d6 et perd ce
Arme choquée : Larme utilisée joue un jet de Résistance à -@roll[2d6] et perd ce
nombre de points de résistance en cas déchec.
img: icons/svg/d20-black.svg
weight: 1
@ -192,8 +193,9 @@ results:
flags: {}
type: text
text: >-
Ami bousculé : Le compagnon bousculé doit réussir Empathie/Vigilance à
-1d6 ou être en demi-surprise jusquà la fin du round suivant.
Ami bousculé : Le compagnon bousculé doit réussir
@roll[Empathie/Vigilance] à
-@roll[1d6] ou être en demi-surprise jusquà la fin du round suivant.
img: icons/svg/d20-black.svg
weight: 1
range:

View File

@ -1038,10 +1038,20 @@ a.rdd-world-content-link {
white-space: nowrap;
word-break: break-all;
}
span.content-link,
a.content-link {
background: hsla(45, 100%, 80%, 0.2);
color: hsla(300, 70%, 20%, 0.8);
font-weight: 560;
padding: 0.1rem 0.3rem;
border: 1px solid var(--color-border-dark-tertiary);
border-radius: 0.25rem;
white-space: nowrap;
word-break: break-all;
}
li label.compteur {
display: inline-block;
flex-direction: row;
@ -1067,15 +1077,6 @@ li label.compteur {
max-width: 90%;
}
a.roll-text.content-link {
color: hsla(300, 70%, 40%, 0.5);
font-weight: bold;
border: 1px solid var(--color-border-dark-tertiary);
border-radius: 0.25rem;
white-space: nowrap;
word-break: break-all;
}
.window-app.sheet .window-content .tooltip:hover .tooltiptext {
top: 2rem;
left: 2rem;

View File

@ -1,9 +1,9 @@
{
"id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"version": "12.0.33",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.33/rddsystem.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.33/system.json",
"version": "12.0.34",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.34/rddsystem.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.34/system.json",
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
"compatibility": {
"minimum": "11",

View File

@ -1,8 +0,0 @@
<span><a class="roll-text content-link"
data-roll-mode="alchimie"
{{#if recette}}data-recette-id="{{recette.id}}"{{/if}}
data-manip="{{manip}}"
data-termes="{{termes}}"
data-tooltip="{{upperFirst carac.label}}/Alchimie à {{diff}}">
{{~manip}} {{termes~}}
</a></span>

View File

@ -1,9 +0,0 @@
<span><a class="roll-text content-link"
data-roll-mode="carac"
{{#if competence}}data-competence="{{competence}}"{{/if~}}
{{#if diff}}data-diff="{{diff}}"{{/if~}}
data-carac-code="{{carac.code}}">
{{~uppercase carac.label~}}
{{#if competence}} / {{upperFirst competence}}{{/if~}}
{{#if diff}} à {{diff}}{{/if~}}
</a></span>

View File

@ -1,5 +0,0 @@
<span><a class="roll-text content-link"
data-roll-mode="foundry"
data-roll-foundry="{{formula}}">
{{~formula~}}
</a></span>

View File

@ -0,0 +1,14 @@
<span class="content-link roll-text-link"
data-code="{{param.code}}"
data-json="{{json-stringify param}}"
data-manip="{{param.manip}}"
data-termes="{{param.termes}}"
{{#if recetteid}}data-recetteid="{{param.recetteid}}"{{/if}}
>
<a class="roll-text" data-tooltip="{{upperFirst param.carac.label}}/Alchimie à {{param.diff}}">
{{~param.manip}} {{param.termes~}}
</a>
{{#if options.showlink}}
<a class="chat-roll-text" data-tooltip="Montrer"><i class="fas fa-comment"></i></a>
{{/if}}
</span>

View File

@ -0,0 +1,15 @@
<span class="content-link roll-text-link"
data-code="{{param.code}}"
data-json="{{json-stringify param}}"
data-carac-code="{{param.carac.code}}"
{{#if competence}}data-competence="{{param.competence}}"{{/if~}}
{{#if diff}}data-diff="{{param.diff}}"{{/if~}}
>
<a class="roll-text">
{{~uppercase param.carac.label~}}
{{#if param.competence}} / {{upperFirst param.competence}}{{/if~}}
{{#if param.diff}} à {{param.diff}}{{/if~}}</a>
{{#if options.showlink}}
<a class="chat-roll-text" data-tooltip="Montrer"><i class="fas fa-comment"></i></a>
{{/if}}
</span>

View File

@ -0,0 +1,10 @@
<span class="content-link roll-text-link"
data-code="{{param.code}}"
data-json="{{json-stringify param}}"
data-roll-formula="{{param.formula}}"
>
<a class="roll-text">{{~param.formula~}}</a>
{{#if options.showlink}}
<a class="chat-roll-text" data-tooltip="Montrer"><i class="fas fa-comment"></i></a>
{{/if}}
</span>