Reorder params for ease to read
(options json param at the end)
This commit is contained in:
parent
e7b9070cf1
commit
b611cc9092
@ -1388,8 +1388,9 @@ export class RdDActor extends Actor {
|
|||||||
value: carac.value,
|
value: carac.value,
|
||||||
xp: carac.xp
|
xp: carac.xp
|
||||||
}
|
}
|
||||||
let content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, xpData);
|
ChatUtility.createChatMessage(this.name, "default", {
|
||||||
ChatUtility.createChatMessage({ content: content }, "default", this.name);
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, xpData)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1413,8 +1414,9 @@ export class RdDActor extends Actor {
|
|||||||
archetype: competence.data.niveau_archetype,
|
archetype: competence.data.niveau_archetype,
|
||||||
archetypeWarning: competence.data.niveau > competence.data.niveau_archetype
|
archetypeWarning: competence.data.niveau > competence.data.niveau_archetype
|
||||||
}
|
}
|
||||||
let content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, xpData);
|
ChatUtility.createChatMessage(this.name, "default", {
|
||||||
ChatUtility.createChatMessage({ content: content }, "default", this.name);
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, xpData)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,21 +3,20 @@
|
|||||||
* Class providing helper methods to get the list of users, and
|
* Class providing helper methods to get the list of users, and
|
||||||
*/
|
*/
|
||||||
export class ChatUtility {
|
export class ChatUtility {
|
||||||
|
/* -------------------------------------------- */
|
||||||
static removeMyChatMessageContaining(part) {
|
static removeMyChatMessageContaining(part) {
|
||||||
const toDelete = game.messages.filter(it => it.user._id == game.user._id)
|
const toDelete = game.messages.filter(it => it.user._id == game.user._id)
|
||||||
.filter(it => it.data.content.includes(part));
|
.filter(it => it.data.content.includes(part));
|
||||||
toDelete.forEach(it => it.delete());
|
toDelete.forEach(it => it.delete());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static chatWithRollMode(chatOptions, name) {
|
static createChatWithRollMode(name, chatOptions) {
|
||||||
let rollMode = game.settings.get("core", "rollMode");
|
ChatUtility.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions);
|
||||||
ChatUtility.createChatMessage(chatOptions, rollMode, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static createChatMessage(chatOptions, rollMode, name) {
|
static createChatMessage(name, rollMode, chatOptions) {
|
||||||
switch (rollMode) {
|
switch (rollMode) {
|
||||||
case "blindroll": // GM only
|
case "blindroll": // GM only
|
||||||
if (!game.user.isGM) {
|
if (!game.user.isGM) {
|
||||||
|
@ -422,9 +422,9 @@ export class RdDCombat {
|
|||||||
const arme = rollData.arme;
|
const arme = rollData.arme;
|
||||||
const avecArme = arme?.data.categorie_parade != 'sans-armes';
|
const avecArme = arme?.data.categorie_parade != 'sans-armes';
|
||||||
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
|
const action = (rollData.attackerRoll ? (arme ? "la parade" : "l'esquive") : "l'attaque");
|
||||||
ChatUtility.chatWithRollMode({
|
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||||
content: `<strong>Echec total à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme })
|
content: `<strong>Echec total à ${action}!</strong> ` + await RdDRollTables.getMaladresse({ arme: avecArme })
|
||||||
}, this.defender.name)
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -507,9 +507,9 @@ export class RdDCombat {
|
|||||||
console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll);
|
console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll);
|
||||||
if (!defenderRoll.attackerRoll.isPart) {
|
if (!defenderRoll.attackerRoll.isPart) {
|
||||||
// TODO: attaquant doit jouer résistance et peut être désarmé p132
|
// TODO: attaquant doit jouer résistance et peut être désarmé p132
|
||||||
ChatUtility.chatWithRollMode({
|
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||||
content: `(à gérer) L'attaquant doit jouer résistance et peut être désarmé (p132)`
|
content: `(à gérer) L'attaquant doit jouer résistance et peut être désarmé (p132)`
|
||||||
}, this.defender.name)
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,10 +584,9 @@ export class RdDCombat {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
_onEsquiveParticuliere(rollData) {
|
_onEsquiveParticuliere(rollData) {
|
||||||
console.log("RdDCombat._onEsquiveParticuliere >>>", rollData);
|
console.log("RdDCombat._onEsquiveParticuliere >>>", rollData);
|
||||||
let chatOptions = {
|
ChatUtility.createChatWithRollMode(this.defender.name, {
|
||||||
content: "<strong>Vous pouvez esquiver une deuxième esquive!</strong>"
|
content: "<strong>Vous pouvez esquiver une deuxième esquive!</strong>"
|
||||||
}
|
});
|
||||||
ChatUtility.chatWithRollMode(chatOptions, this.defender.name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -757,7 +756,6 @@ export class RdDCombat {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async displayActorCombatStatus(actor) {
|
static async displayActorCombatStatus(actor) {
|
||||||
let rollMode = game.settings.get("core", "rollMode");
|
|
||||||
let rollData = {
|
let rollData = {
|
||||||
alias: actor.name,
|
alias: actor.name,
|
||||||
etatGeneral: actor.getEtatGeneral(),
|
etatGeneral: actor.getEtatGeneral(),
|
||||||
@ -773,8 +771,9 @@ export class RdDCombat {
|
|||||||
} else if (actor.countBlessuresByName("graves") > 0) {
|
} else if (actor.countBlessuresByName("graves") > 0) {
|
||||||
rollData.isGrave = true;
|
rollData.isGrave = true;
|
||||||
}
|
}
|
||||||
let content = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, rollData);
|
ChatUtility.createChatWithRollMode(actor.name, {
|
||||||
ChatUtility.createChatMessage({ content: content }, rollMode, actor.name);
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-turn-summary.html`, rollData)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
@ -192,15 +192,14 @@ export class RdDCommands {
|
|||||||
};
|
};
|
||||||
await RdDResolutionTable.rollData(rollData);
|
await RdDResolutionTable.rollData(rollData);
|
||||||
msg.content = await RdDResolutionTable.buildRollDataHtml(rollData);
|
msg.content = await RdDResolutionTable.buildRollDataHtml(rollData);
|
||||||
ChatUtility.chatWithRollMode(msg, game.user.name);
|
ChatUtility.createChatWithRollMode(game.user.name, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
async rollDeDraconique(msg) {
|
async rollDeDraconique(msg) {
|
||||||
let rollMode = game.settings.get("core", "rollMode");
|
|
||||||
let ddr = new DeDraconique().evaluate();
|
let ddr = new DeDraconique().evaluate();
|
||||||
await RdDDice.show(ddr, rollMode);
|
await RdDDice.show(ddr, rollMode);
|
||||||
msg.content = `Lancer d'un Dé draconique: ${ddr.total}`;
|
msg.content = `Lancer d'un Dé draconique: ${ddr.total}`;
|
||||||
ChatUtility.createChatMessage(msg, rollMode, game.user.name);
|
ChatUtility.createChatWithRollMode(game.user.name, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,9 +91,9 @@ export class RdDResolutionTable {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
|
static async displayRollData(rollData, actor = undefined, template = 'chat-resultat-general.html') {
|
||||||
ChatUtility.chatWithRollMode(
|
ChatUtility.createChatWithRollMode(actor?.userName ?? game.user.name, {
|
||||||
{ content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template) },
|
content: await RdDResolutionTable.buildRollDataHtml(rollData, actor, template)
|
||||||
actor?.userName ?? game.user.name)
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user