-
Notifications
You must be signed in to change notification settings - Fork 0
/
Emit Light.js
97 lines (94 loc) · 2.88 KB
/
Emit Light.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
function tokenUpdate(data) {
canvas.tokens.controlled.map(token => token.update(data));
}
let torchAnimation = {"type": "torch", "speed": 1, "intensity": 1};
let dialogEditor = new Dialog({
title: `Token Light Picker`,
content: `Pick the light source the selected token is holding.`,
buttons: {
none: {
label: `None`,
callback: () => {
tokenUpdate({"dimLight": 0, "brightLight": 0, "lightAngle": 360,});
dialogEditor.render(true);
}
},
torch: {
label: `Torch`,
callback: () => {
tokenUpdate({"dimLight": 40, "brightLight": 20, "lightAngle": 360, "lightAnimation": torchAnimation});
dialogEditor.render(true);
}
},
light: {
label: `Light Cantrip`,
callback: () => {
tokenUpdate({"dimLight": 40, "brightLight": 20, "lightAngle": 360, "lightAnimation": {"type": "none"}});
dialogEditor.render(true);
}
},
candle: {
label: `Candle`,
callback: () => {
tokenUpdate({"dimLight": 10, "brightLight": 5, "lightAngle": 360, "lightAnimation": torchAnimation});
dialogEditor.render(true);
}
},
lamp: {
label: `Lamp`,
callback: () => {
tokenUpdate({"dimLight": 45, "brightLight": 15, "lightAngle": 360, "lightAnimation": torchAnimation});
dialogEditor.render(true);
}
},
bullseye: {
label: `Bullseye Lantern`,
callback: () => {
tokenUpdate({"dimLight": 120, "brightLight": 60, "lightAngle": 60, "lightAnimation": torchAnimation});
dialogEditor.render(true);
}
},
hoodedOpen: {
label: `Hooded Lantern (Open)`,
callback: () => {
tokenUpdate({"dimLight": 60, "brightLight": 30, "lightAngle": 360, "lightAnimation": torchAnimation});
dialogEditor.render(true);
}
},
hoodedClosed: {
label: `Hooded Lantern (Closed)`,
callback: () => {
tokenUpdate({"dimLight": 5, "brightLight": 0, "lightAngle": 360, "lightAnimation": torchAnimation});
dialogEditor.render(true);
}
},
moonTouchedSword: {
label: `Moon-Touched Sword`,
callback: () => {
tokenUpdate({"dimLight": 30, "brightLight": 15, "lightAngle": 360, "lightAnimation": torchAnimation});
dialogEditor.render(true);
}
},
faerieFire: {
label: `Faerie Fire`,
callback: () => {
tokenUpdate({"dimLight": 10, "brightLight": 0, "lightAngle": 360, "lightAnimation": torchAnimation});
dialogEditor.render(true);
}
},
produceFlame: {
label: `Produce Flame`,
callback: () => {
tokenUpdate({"dimLight": 20, "brightLight": 10, "lightAngle": 360, "lightAnimation": torchAnimation});
dialogEditor.render(true);
}
},
close: {
icon: "<i class='fas fa-tick'></i>",
label: `Close`
},
},
default: "close",
close: () => {}
});
dialogEditor.render(true)