-
Notifications
You must be signed in to change notification settings - Fork 0
/
trisWildshape.js
82 lines (81 loc) · 2.8 KB
/
trisWildshape.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
let applyChanges = false;
new Dialog({
title: `Wildshape`,
content: `
<form>
<div class="form-group">
<label>Wildshape Form:</label>
<select id="wildshape-form" name="wildshape-form">
<option value="blackBear">Black Bear</option>
<option value="brownBear">Brown Bear</option>
<option value="cat">Cat</option>
<option value="caveBear" selected>Cave Bear</option>
<option value="giantSpider">Giant Spider</option>
<option value="panther">Panther</option>
<option value="rhinoceros">Rhinoceros</option>
<option value="spider">Spider</option>
<option value="tiger">Tiger</option>
<option value="wolf">Wolf</option>
</select>
</div>
</form>
`,
buttons: {
yes: {
icon: "<i class='fas fa-check'></i>",
label: `Apply Changes`,
callback: () => applyChanges = true
},
no: {
icon: "<i class='fas fa-times'></i>",
label: `Cancel Changes`
},
},
default: "yes",
close: html => {
if (applyChanges) {
for ( let token of canvas.tokens.controlled ) {
let wildshapeType = html.find('[name="wildshape-form"]')[0].value || "none";
let wildshape = {};
// Get Wildshape Actors
switch (wildshapeType) {
case "blackBear":
wildshape = game.actors.entities.find(a => a.name === "Black Bear");
break;
case "brownBear":
wildshape = game.actors.entities.find(a => a.name === "Brown Bear");
break;
case "cat":
wildshape = game.actors.entities.find(a => a.id === "SaYjMQqVq9mEbZOR");
break;
case "caveBear":
wildshape = game.actors.entities.find(a => a.name === "Cave Bear");
break;
case "giantSpider":
wildshape = game.actors.entities.find(a => a.id === "lUJJUinpsXi9zwXA");
break;
case "panther":
wildshape = game.actors.entities.find(a => a.name === "Panther");
break;
case "rhinoceros":
wildshape = game.actors.entities.find(a => a.name === "Rhinoceros");
break;
case "spider":
wildshape = game.actors.entities.find(a => a.name === "Spider");
break;
case "tiger":
wildshape = game.actors.entities.find(a => a.name === "Tiger");
break;
case "wolf":
wildshape = game.actors.entities.find(a => a.id === "TXmf0eh94tEKHHqA");
break;
case "nochange":
default:
}
// Update Token
console.log(token);
actor.transformInto(wildshape);
}
}
}
}).render(true);