Merge branch 'master-des' into 'master'
Un dé pour les heures draconiques See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!219
BIN
icons/heures/hd01.webp
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
icons/heures/hd02.webp
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
icons/heures/hd03.webp
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
icons/heures/hd04.webp
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
icons/heures/hd05.webp
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
icons/heures/hd06.webp
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
icons/heures/hd07.webp
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
icons/heures/hd08.webp
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
icons/heures/hd09.webp
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
icons/heures/hd10.webp
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
icons/heures/hd11.webp
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
icons/heures/hd12.webp
Normal file
After Width: | Height: | Size: 3.2 KiB |
@ -2,18 +2,30 @@ import { ChatUtility } from "./chat-utility.js";
|
||||
import { SYSTEM_RDD } from "./constants.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
function img(src) {
|
||||
return `<img src="${src}" class="dice-img" />`
|
||||
}
|
||||
|
||||
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 = `<img src="${signeDragon}" />`;
|
||||
const imgSigneDragon = img(signeDragon);
|
||||
const labelsDeDragon = ['1', '2', '3', '4', '5', '6', signeDragon, '0'];
|
||||
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) {
|
||||
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -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%;
|
||||
|