Skip to content

Commit c0d2171

Browse files
authored
Merge pull request #4 from mcglincy/master
Add support for DiceSoNice.
2 parents 66ed110 + 3dadcb1 commit c0d2171

File tree

8 files changed

+48
-2
lines changed

8 files changed

+48
-2
lines changed

Diff for: asset/dsn/dsn-d6-1.png

1.1 KB
Loading

Diff for: asset/dsn/dsn-d6-2.png

1.1 KB
Loading

Diff for: asset/dsn/dsn-d6-3.png

1.1 KB
Loading

Diff for: asset/dsn/dsn-d6-4.png

1.1 KB
Loading

Diff for: asset/dsn/dsn-d6-5.png

1.1 KB
Loading

Diff for: asset/dsn/dsn-d6-6.png

4.64 KB
Loading

Diff for: script/hooks.js

+25
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,31 @@ Hooks.once("init", () => {
3838
preloadHandlebarsTemplates();
3939
});
4040

41+
Hooks.once('diceSoNiceReady', (dice3d) => {
42+
dice3d.addSystem({ id: "vaesen", name: "Vaesen" }, true);
43+
dice3d.addDicePreset({
44+
type: "d6",
45+
labels: [
46+
"systems/vaesen/asset/dsn/dsn-d6-1.png",
47+
"systems/vaesen/asset/dsn/dsn-d6-2.png",
48+
"systems/vaesen/asset/dsn/dsn-d6-3.png",
49+
"systems/vaesen/asset/dsn/dsn-d6-4.png",
50+
"systems/vaesen/asset/dsn/dsn-d6-5.png",
51+
"systems/vaesen/asset/dsn/dsn-d6-6.png",
52+
],
53+
system: "vaesen"
54+
});
55+
dice3d.addColorset({
56+
name: 'vaesen',
57+
description: 'Vaesen',
58+
category: 'Colors',
59+
foreground: "#2D1A00",
60+
background: "#F5F4F1",
61+
outline: 'black',
62+
texture: 'wood'
63+
}, "force");
64+
});
65+
4166
function preloadHandlebarsTemplates() {
4267
const templatePaths = [
4368
"systems/vaesen/model/player.html",

Diff for: script/util/roll.js

+23-2
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,35 @@ function roll(sheet, testName, attribute, skill, bonus, damage) {
4343
sheet.lastDamage = damage;
4444
let numberOfDice = attribute + skill + bonus;
4545
rollDice(sheet, numberOfDice);
46-
sendRollToChat(sheet, false);
46+
showDice(sheet, false);
4747
}
4848

4949
export function push(sheet) {
5050
let numberOfDiceToPush = sheet.dices.filter(dice => dice !== 6).length;
5151
sheet.dices = sheet.dices.filter(dice => dice === 6);
5252
rollDice(sheet, numberOfDiceToPush);
53-
sendRollToChat(sheet, true);
53+
showDice(sheet, true);
54+
}
55+
56+
function showDice(sheet, isPushed) {
57+
if (game.dice3d) {
58+
// DiceSoNice module is installed
59+
const dice = sheet.dices.map(r => {
60+
return {
61+
result: r,
62+
resultLabel: r,
63+
type: "d6",
64+
vectors: [],
65+
options: {}
66+
};
67+
});
68+
const data = { throws:[{ dice }] };
69+
// send the roll to chat once the DSN roll is finished
70+
game.dice3d.show(data).then(displayed => { sendRollToChat(sheet, isPushed); });
71+
} else {
72+
// DiceSoNice not installed, so just send the roll to chat
73+
sendRollToChat(sheet, isPushed);
74+
}
5475
}
5576

5677
function sendRollToChat(sheet, isPushed) {

0 commit comments

Comments
 (0)