diff --git a/.gitignore b/.gitignore
index 5fbfb325..f60e6d39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
.vscode/settings.json
+.idea
todo.txt
todo.md
diff --git a/fonts/heures_draconiques.ttf b/fonts/heures_draconiques.ttf
deleted file mode 100644
index 2200a65e..00000000
Binary files a/fonts/heures_draconiques.ttf and /dev/null differ
diff --git a/fonts/heuresdraconiques2.ttf b/fonts/heuresdraconiques2.ttf
new file mode 100644
index 00000000..93828e89
Binary files /dev/null and b/fonts/heuresdraconiques2.ttf differ
diff --git a/fonts/heuresdraconiques2.woff b/fonts/heuresdraconiques2.woff
new file mode 100644
index 00000000..327b0c96
Binary files /dev/null and b/fonts/heuresdraconiques2.woff differ
diff --git a/fonts/heuresdraconiques2.woff2 b/fonts/heuresdraconiques2.woff2
new file mode 100644
index 00000000..96e35cc0
Binary files /dev/null and b/fonts/heuresdraconiques2.woff2 differ
diff --git a/icons/heures/hd01.webp b/icons/heures/hd01.webp
new file mode 100644
index 00000000..abf0f41c
Binary files /dev/null and b/icons/heures/hd01.webp differ
diff --git a/icons/heures/hd02.webp b/icons/heures/hd02.webp
new file mode 100644
index 00000000..dad93fcc
Binary files /dev/null and b/icons/heures/hd02.webp differ
diff --git a/icons/heures/hd03.webp b/icons/heures/hd03.webp
new file mode 100644
index 00000000..6983d86d
Binary files /dev/null and b/icons/heures/hd03.webp differ
diff --git a/icons/heures/hd04.webp b/icons/heures/hd04.webp
new file mode 100644
index 00000000..284e3754
Binary files /dev/null and b/icons/heures/hd04.webp differ
diff --git a/icons/heures/hd05.webp b/icons/heures/hd05.webp
new file mode 100644
index 00000000..f243eb93
Binary files /dev/null and b/icons/heures/hd05.webp differ
diff --git a/icons/heures/hd06.webp b/icons/heures/hd06.webp
new file mode 100644
index 00000000..0c2d1952
Binary files /dev/null and b/icons/heures/hd06.webp differ
diff --git a/icons/heures/hd07.webp b/icons/heures/hd07.webp
new file mode 100644
index 00000000..e13f5a38
Binary files /dev/null and b/icons/heures/hd07.webp differ
diff --git a/icons/heures/hd08.webp b/icons/heures/hd08.webp
new file mode 100644
index 00000000..abda8b9b
Binary files /dev/null and b/icons/heures/hd08.webp differ
diff --git a/icons/heures/hd09.webp b/icons/heures/hd09.webp
new file mode 100644
index 00000000..d9f66574
Binary files /dev/null and b/icons/heures/hd09.webp differ
diff --git a/icons/heures/hd10.webp b/icons/heures/hd10.webp
new file mode 100644
index 00000000..9ef3279d
Binary files /dev/null and b/icons/heures/hd10.webp differ
diff --git a/icons/heures/hd11.webp b/icons/heures/hd11.webp
new file mode 100644
index 00000000..6b4b8ccc
Binary files /dev/null and b/icons/heures/hd11.webp differ
diff --git a/icons/heures/hd12.webp b/icons/heures/hd12.webp
new file mode 100644
index 00000000..9bb28205
Binary files /dev/null and b/icons/heures/hd12.webp differ
diff --git a/module/actor.js b/module/actor.js
index cd80c2f2..b4cdcccb 100644
--- a/module/actor.js
+++ b/module/actor.js
@@ -13,7 +13,6 @@ import { RdDItemSort } from "./item-sort.js";
import { Grammar } from "./grammar.js";
import { RdDEncaisser } from "./rdd-roll-encaisser.js";
import { RdDCombat } from "./rdd-combat.js";
-import { DeDraconique } from "./de-draconique.js";
import { RdDAudio } from "./rdd-audio.js";
import { RdDItemCompetence } from "./item-competence.js";
import { RdDItemArme } from "./item-arme.js";
@@ -629,7 +628,7 @@ export class RdDActor extends Actor {
}
}
else {
- let deRecuperation = (await DeDraconique.ddr("selfroll")).total;
+ let deRecuperation = new Roll("1dr + 7").evaluate().total;
console.log("recuperationReve", deRecuperation);
if (deRecuperation >= 7) {
// Rêve de Dragon !
diff --git a/module/constants.js b/module/constants.js
new file mode 100644
index 00000000..708e4ab5
--- /dev/null
+++ b/module/constants.js
@@ -0,0 +1 @@
+export const SYSTEM_RDD = "foundryvtt-reve-de-dragon";
diff --git a/module/de-draconique.js b/module/de-draconique.js
deleted file mode 100644
index 4cd5d6bd..00000000
--- a/module/de-draconique.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import { RdDDice } from "./rdd-dice.js";
-
-export class DeDraconique extends Roll{
-
- static async ddr(rollMode=undefined) {
- let ddr = new DeDraconique().evaluate();
- await RdDDice.show(ddr, rollMode);
- return ddr;
- }
-
- constructor(){
- super("1d8x8 - 0")
- }
-
- evaluate() {
- super.evaluate();
- const rerolls = Math.ceil(this.total / 8);
- this.terms[this.terms.length - 1].number = rerolls;
- this._total -= rerolls;
- return this;
- }
-
- async render(chatOptions) {
- return super.render(chatOptions)
- }
-}
\ No newline at end of file
diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js
index b51107b6..bcb6cd0d 100644
--- a/module/rdd-calendrier.js
+++ b/module/rdd-calendrier.js
@@ -11,9 +11,9 @@ const dossierIconesHeures = 'systems/foundryvtt-reve-de-dragon/icons/heures/'
const heuresList = ["vaisseau", "sirene", "faucon", "couronne", "dragon", "epees", "lyre", "serpent", "poissonacrobate", "araignee", "roseau", "chateaudormant"];
const heuresDef = {
"vaisseau": { label: "Vaisseau", lettreFont: 'v', saison: "printemps", heure: 0, icon: 'hd01.svg' },
- "sirene": { label: "Sirène", lettreFont: 'S', saison: "printemps", heure: 1, icon: 'hd02.svg' },
+ "sirene": { label: "Sirène", lettreFont: 'i', saison: "printemps", heure: 1, icon: 'hd02.svg' },
"faucon": { label: "Faucon", lettreFont: 'f', saison: "printemps", heure: 2, icon: 'hd03.svg' },
- "couronne": { label: "Couronne", lettreFont: 'C', saison: "ete", heure: 3, icon: 'hd04.svg' },
+ "couronne": { label: "Couronne", lettreFont: '', saison: "ete", heure: 3, icon: 'hd04.svg' },
"dragon": { label: "Dragon", lettreFont: 'd', saison: "ete", heure: 4, icon: 'hd05.svg' },
"epees": { label: "Epées", lettreFont: 'e', saison: "ete", heure: 5, icon: 'hd06.svg' },
"lyre": { label: "Lyre", lettreFont: 'l', saison: "automne", heure: 6, icon: 'hd07.svg' },
@@ -41,6 +41,7 @@ export class RdDCalendrier extends Application {
this.calendrier = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "calendrier"));
//console.log("CALENDRIER", this.calendrier);
if (this.calendrier == undefined || this.calendrier.moisRdD == undefined) {
+ this.calendrier = {};
this.calendrier.heureRdD = 0; // Index dans heuresList
this.calendrier.minutesRelative = 0;
this.calendrier.moisRdD = 0; // Index dans heuresList
@@ -52,6 +53,7 @@ export class RdDCalendrier extends Application {
// position
this.calendrierPos = duplicate(game.settings.get("foundryvtt-reve-de-dragon", "calendrier-pos"));
if (this.calendrierPos == undefined || this.calendrierPos.top == undefined) {
+ this.calendrierPos = {};
this.calendrierPos.top = 200;
this.calendrierPos.left = 200;
if (game.user.isGM) { // Uniquement si GM
diff --git a/module/rdd-commands.js b/module/rdd-commands.js
index 0163d31e..f8b44405 100644
--- a/module/rdd-commands.js
+++ b/module/rdd-commands.js
@@ -1,6 +1,5 @@
/* -------------------------------------------- */
-import { DeDraconique } from "./de-draconique.js";
import { RdDItemCompetence } from "./item-competence.js";
import { Misc } from "./misc.js";
import { RdDCarac } from "./rdd-carac.js";
@@ -166,11 +165,25 @@ export class RdDCommands {
}
/* -------------------------------------------- */
- help(msg, table = undefined) {
+ async help(msg) {
+ this.help(msg, undefined);
+ }
+ async help(msg, table) {
let list = []
this._buildSubTableHelp(list, table || this.commandsTable);
- const messageAide = list.reduce((a, b) => a + '
' + b);
- RdDCommands._chatAnswer(msg, `Commandes disponibles`);
+
+ let html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/settings/dialog-aide-commands.html", { commands: list });
+ let d = new Dialog(
+ {
+ title: "Commandes disponibles dans le tchat",
+ content: html,
+ buttons: {},
+ },
+ {
+ width: 600, height: 500,
+ });
+
+ d.render(true);
}
/* -------------------------------------------- */
@@ -221,23 +234,23 @@ export class RdDCommands {
}
let actors = canvas.tokens.controlled.map(it => it.actor).filter(it => it);
- if (actors && actors.length > 0){
+ if (actors && actors.length > 0) {
let length = params.length;
- let diff = Number(params[length-1]);
- if (Number.isInteger(Number(diff))){
- length --;
+ let diff = Number(params[length - 1]);
+ if (Number.isInteger(Number(diff))) {
+ length--;
}
else {
diff = 0;
}
const caracName = params[0];
- const compName = length>1 ? params.slice(1, length).reduce((a, b) => `${a} ${b}`): undefined;
+ const compName = length > 1 ? params.slice(1, length).reduce((a, b) => `${a} ${b}`) : undefined;
for (let actor of actors) {
await actor.rollCaracCompetence(caracName, compName, diff);
}
return;
}
- else{
+ else {
ui.notifications.warn("Sélectionnez au moins un personnage pour lancer les dés")
}
}
@@ -258,7 +271,7 @@ export class RdDCommands {
/* -------------------------------------------- */
async rollDeDraconique(msg) {
- let ddr = new DeDraconique().evaluate();
+ let ddr = new Roll("1dr + 7").evaluate();
ddr.showDice = true;
await RdDDice.showDiceSoNice(ddr);
RdDCommands._chatAnswer(msg, `Lancer d'un Dé draconique: ${ddr.total}`);
diff --git a/module/rdd-dice.js b/module/rdd-dice.js
index 94df5543..4a9d42fb 100644
--- a/module/rdd-dice.js
+++ b/module/rdd-dice.js
@@ -1,15 +1,145 @@
import { ChatUtility } from "./chat-utility.js";
+import { SYSTEM_RDD } from "./constants.js";
+import { Misc } from "./misc.js";
+
+function img(src) {
+ return ``
+}
+
+function iconHeure(heure) {
+ if (heure < 10) {
+ heure = '0' + heure;
+ }
+ return `systems/foundryvtt-reve-de-dragon/icons/heures/hd${heure}.webp`
+}
+const imagesHeures = [1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 11, 12].map(it => iconHeure(it));
+
+const imgSigneDragon = img(imagesHeures[4]);
+
+/** De7 pour les jets de rencontre */
+export class De7 extends Die {
+ /** @override */
+ static DENOMINATION = "7";
+
+ static diceSoNiceData(system) {
+ return {
+ type: "d7",
+ font: "HeuresDraconiques",
+ fontScale : 0.7,
+ labels: ['1', '2', '3', '4', '5', '6', 'd', '0'],
+ system: system
+ }
+ }
+
+ constructor(termData) {
+ termData.faces = 8;
+ super(termData);
+ }
+
+ evaluate() {
+ super.evaluate();
+ this.explode("x=8");
+ return this;
+ }
+
+ get total() {
+ return this.values.filter(it => it != 8).reduce(Misc.sum(), 0);
+ }
+
+ static getResultLabel(result) {
+ switch (result) {
+ case 7: return imgSigneDragon;
+ }
+ return result;
+ }
+}
+
+/** DeDraconique pour le D8 sans limite avec 8=>0 */
+export class DeDraconique extends Die {
+ static DENOMINATION = "r";
+
+ static diceSoNiceData(system) {
+ return {
+ type: "dr",
+ font: "HeuresDraconiques",
+ fontScale : 0.7,
+ labels: ['1', '2', '3', '4', '5', '6', 'd', '0'],
+ system: system
+ }
+ }
+
+ constructor(termData) {
+ termData.faces = 8;
+ super(termData);
+ }
+
+ evaluate() {
+ super.evaluate();
+ this.explode("x=7");
+ return this;
+ }
+
+ get total() {
+ return this.values.filter(it => it != 8).reduce(Misc.sum(), 0);
+ }
+
+ static getResultLabel(result) {
+ switch (result) {
+ case 7: return imgSigneDragon;
+ case 8: return 0;
+ }
+ return result;
+ }
+}
+
+/** De 12 avec les heures */
+export class DeHeure extends Die {
+
+ /** @override */
+ static DENOMINATION = "h";
+
+ static diceSoNiceData(system) {
+ return {
+ type: "dh",
+ font: "HeuresDraconiques",
+ labels: ['v', 'i', 'f', 'o', 'd', 'e', 'l', 's', 'p', 'a', 'r', 'c'],
+ system: system
+ }
+ }
+
+ constructor(termData) {
+ termData.faces = 12;
+ super(termData);
+ }
+
+ static getResultLabel(result) {
+ return img(imagesHeures[result-1]);
+ }
+}
export class RdDDice {
+ static init() {
+ CONFIG.Dice.terms[De7.DENOMINATION] = De7;
+ CONFIG.Dice.terms[DeDraconique.DENOMINATION] = DeDraconique;
+ CONFIG.Dice.terms[DeHeure.DENOMINATION] = DeHeure;
+ }
+
+ static diceSoNiceReady(dice3d) {
+ for (const system of Object.keys(dice3d.DiceFactory.systems)) {
+ dice3d.addDicePreset(De7.diceSoNiceData(system));
+ dice3d.addDicePreset(DeDraconique.diceSoNiceData(system));
+ dice3d.addDicePreset(DeHeure.diceSoNiceData(system));
+ }
+ }
/* -------------------------------------------- */
static async show(roll, rollMode = undefined) {
- if (roll.showDice || game.settings.get("foundryvtt-reve-de-dragon", "dice-so-nice") == true) {
+ if (roll.showDice || game.settings.get(SYSTEM_RDD, "dice-so-nice") == true) {
await this.showDiceSoNice(roll, rollMode);
}
return roll;
}
-
+
/* -------------------------------------------- */
static async showDiceSoNice(roll, rollMode = undefined) {
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
diff --git a/module/rdd-main.js b/module/rdd-main.js
index f76c177c..5e9cadcc 100644
--- a/module/rdd-main.js
+++ b/module/rdd-main.js
@@ -30,6 +30,7 @@ import { RdDHotbar } from "./rdd-hotbar-drop.js"
import { EffetsDraconiques } from "./tmr/effets-draconiques.js";
import { RdDHerbes } from "./rdd-herbes.js";
import { RdDItem } from "./item.js";
+import { RdDDice } from "./rdd-dice.js";
/* -------------------------------------------- */
/* Foundry VTT Initialization */
@@ -171,6 +172,7 @@ Hooks.once("init", async function () {
// préparation des différents modules
RdDUtility.init();
+ RdDDice.init();
RdDCommands.init();
RdDCombat.init();
RdDCombatManager.init(),
@@ -230,7 +232,12 @@ Hooks.once("ready", function () {
});
/* -------------------------------------------- */
-/* Foundry VTT Initialization */
+/* Dice-so-nice ready */
+/* -------------------------------------------- */
+Hooks.once('diceSoNiceReady', (dice3d) => RdDDice.diceSoNiceReady(dice3d));
+
+/* -------------------------------------------- */
+/* Foundry VTT chat message */
/* -------------------------------------------- */
Hooks.on("chatMessage", (html, content, msg) => {
if (content[0] == '/') {
diff --git a/module/tmr-rencontres.js b/module/tmr-rencontres.js
index 0a98c6cf..4c03dd19 100644
--- a/module/tmr-rencontres.js
+++ b/module/tmr-rencontres.js
@@ -1,4 +1,3 @@
-import { DeDraconique } from "./de-draconique.js";
import { Grammar } from "./grammar.js";
import { Misc } from "./misc.js";
import { TMRUtility } from "./tmr-utility.js";
@@ -382,7 +381,7 @@ export class TMRRencontres {
/* -------------------------------------------- */
static async evaluerForceRencontre(rencontre) {
if (TMRRencontres.isReveDeDragon(rencontre)) {
- const ddr = await DeDraconique.ddr("selfroll")
+ const ddr = new Roll("1dr + 7").evaluate();
rencontre.force = 7 + ddr.total;
}
else {
diff --git a/styles/simple.css b/styles/simple.css
index 3f9f5f67..e1a80db1 100644
--- a/styles/simple.css
+++ b/styles/simple.css
@@ -20,10 +20,15 @@
src: url('../fonts/CaslonAntique.ttf') format("truetype");
}
@font-face {
- font-family: "heures Draconiques";
- src: url('../fonts/heures_draconiques.ttf') format("truetype");
- }
-
+ font-family: 'HeuresDraconiques';
+ src:
+ url('../fonts/heuresdraconiques2.woff') format('woff'),
+ url('../fonts/heuresdraconiques2.woff2') format('woff2'),
+ url('../fonts/heuresdraconiques2.ttf') format('truetype');
+ font-weight: normal;
+ font-style: normal;
+}
+
:root {
/* =================== 1. ACTOR SHEET FONT STYLES =========== */
--window-header-title-font-family: CaslonAntique;
@@ -242,6 +247,9 @@ table {border: 1px solid #7a7971;}
object-position: 50% 0;
}
+.dice-img {
+ border-width: 0;
+}
.button-img {
vertical-align: baseline;
width: 8%;
diff --git a/templates/settings/dialog-aide-commands.html b/templates/settings/dialog-aide-commands.html
new file mode 100644
index 00000000..8d39f597
--- /dev/null
+++ b/templates/settings/dialog-aide-commands.html
@@ -0,0 +1,20 @@
+Dés spéciaux
+
+ -
+ /roll 1d7: lance un dé de rencontre
+
+ -
+ /roll 1dr: lance un dé draconique (de 0à 7, relance et additionne en cas de 7)
+
+ -
+ /roll 1dh: lance le dé des heures (de 1 à 12)
+
+
+Commandes disponibles
+
+ {{#each commands as |command key|}}
+ -
+ {{{command}}}
+
+ {{/each}}
+
\ No newline at end of file