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/rdd-dice.js b/module/rdd-dice.js index 9ba7aa11..3e978531 100644 --- a/module/rdd-dice.js +++ b/module/rdd-dice.js @@ -2,25 +2,37 @@ 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 signeDragon = 'systems/foundryvtt-reve-de-dragon/icons/heures/hdragon.webp'; -const imgSigneDragon = ``; +const imgSigneDragon = img(signeDragon); const labelsDeDragon = ['1', '2', '3', '4', '5', '6', signeDragon, '0']; -const bumpsDeDragon = [, , , , , , signeDragon, ]; +const bumpsDeDragon = [, , , , , , signeDragon,]; +const signeHeure = 'systems/foundryvtt-reve-de-dragon/icons/heures/hd'; /** De7 pour les jets de rencontre */ export class De7 extends Die { /** @override */ static DENOMINATION = "7"; - - static diceSoNiceData() { - return { type: "d7", labels: labelsDeDragon, bumpMaps: bumpsDeDragon, system: SYSTEM_RDD } + + static diceSoNiceData(system) { + return { type: "d7", labels: labelsDeDragon, bumpMaps: bumpsDeDragon, system: system } } - + constructor(termData) { termData.faces = 8; super(termData); } - + evaluate() { super.evaluate(); this.explode("x=8"); @@ -33,7 +45,7 @@ export class De7 extends Die { static getResultLabel(result) { switch (result) { - case '7': return imgSigneDragon + case 7: return imgSigneDragon } return result; } @@ -43,8 +55,8 @@ export class De7 extends Die { export class DeDraconique extends Die { static DENOMINATION = "r"; - static diceSoNiceData() { - return { type: "dr", labels: labelsDeDragon, bumpMaps: bumpsDeDragon, system: SYSTEM_RDD } + static diceSoNiceData(system) { + return { type: "dr", labels: labelsDeDragon, bumpMaps: bumpsDeDragon, system: system } } constructor(termData) { @@ -64,22 +76,52 @@ export class DeDraconique extends Die { static getResultLabel(result) { switch (result) { - case '7': return imgSigneDragon + case 7: return imgSigneDragon } return result; } } +const imagesHeures = [1, 2, 3, 4, 5, 6, 7, 9, 9, 10, 11, 12].map(it => iconHeure(it)); + +/** De 12 avec les heures */ +export class DeHeure extends Die { + + /** @override */ + static DENOMINATION = "h"; + + static diceSoNiceData(system) { + return { + type: "dh", + labels: imagesHeures, + bumpMaps: imagesHeures, + system: system + } + } + + constructor(termData) { + termData.faces = 12; + super(termData); + } + + static getResultLabel(result) { + return img(imagesHeures[result]); + } +} + 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) { - dice3d.addSystem({ id: SYSTEM_RDD, name: "RĂªve de Dragon" }); - dice3d.addDicePreset(De7.diceSoNiceData()); - dice3d.addDicePreset(DeDraconique.diceSoNiceData()); + for (const system of Object.keys(dice3d.DiceFactory.systems)) { + dice3d.addDicePreset(De7.diceSoNiceData(system)); + dice3d.addDicePreset(DeDraconique.diceSoNiceData(system)); + dice3d.addDicePreset(DeHeure.diceSoNiceData(system)); + } } /* -------------------------------------------- */ diff --git a/styles/simple.css b/styles/simple.css index ee5dde37..74932217 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -240,6 +240,9 @@ table {border: 1px solid #7a7971;} object-position: 50% 0; } +.dice-img { + border-width: 0; +} .button-img { vertical-align: baseline; width: 8%;