Repository navigation
Expand file tree
/
Copy pathwfrp3e.mjs
More file actions
207 lines (191 loc) · 5.89 KB
/
Copy pathwfrp3e.mjs
File metadata and controls
207 lines (191 loc) · 5.89 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
/**
* Warhammer Fantasy Roleplay - 3rd Edition's Game System for Foundry VTT
* A Foundry VTT game system for Warhammer Fantasy Roleplay - 3rd Edition.
* Author: Grégory "McGregor777" Gauthier
* Software License: MIT
* Repository: https://github.com/McGregor777/wfrp3e
* Issue Tracker: https://github.com/foundryvtt/wfrp3e/issues
*/
import * as wfrp3e from "./modules/_module.mjs";
globalThis.wfrp3e = wfrp3e;
Hooks.once("init", async () => {
console.log("WFRP3e | Initialising Game System");
game.settings.register("wfrp3e", "startingCareerDrawingMethod", {
name: "SETTINGS.startingCareerDrawingMethod.name",
hint: "SETTINGS.startingCareerDrawingMethod.hint",
scope: "world",
config: true,
type: String,
choices: {
"drawThree": "SETTINGS.startingCareerDrawingMethod.CHOICES.drawThree",
"rollTable": "SETTINGS.startingCareerDrawingMethod.CHOICES.rollTable",
"freeChoice": "SETTINGS.startingCareerDrawingMethod.CHOICES.freeChoice",
},
default: "drawThree"
});
game.settings.register("wfrp3e", "stressFatigueCreatures", {
name: "SETTINGS.stressFatigueCreatures.name",
hint: "SETTINGS.stressFatigueCreatures.hint",
scope: "world",
config: true,
type: String,
choices: {
"wounds": "SETTINGS.stressFatigueCreatures.CHOICES.wounds",
"budget": "SETTINGS.stressFatigueCreatures.CHOICES.budget"
},
default: "drawThree"
})
CONFIG.fontDefinitions["ArnoPro"] = {
editor: true,
fonts: [
{urls: ["systems/wfrp3e/assets/fonts/ArnoPro-Regular.otf"]},
{urls: ["systems/wfrp3e/assets/fonts/ArnoPro-Bold.otf"], weight: 700},
{urls: ["systems/wfrp3e/assets/fonts/ArnoPro-Italic.otf"], style: "italic"},
{urls: ["systems/wfrp3e/assets/fonts/ArnoPro-BoldItalic.otf"], style: "italic", weight: 700}
]
};
CONFIG.fontDefinitions["Caslon Antique"] = {editor: true, fonts: []};
wfrp3e.applications.initialiseHandlebars();
wfrp3e.applications.initialiseTextEnrichers();
wfrp3e.applications.sheets.registerSheets();
wfrp3e.applications.sidebar.tabs.configureTabs();
wfrp3e.applications.ux.replaceContextMenu();
wfrp3e.data.assignDataModels();
wfrp3e.dice.assignRollClasses();
wfrp3e.dice.terms.assignTerms();
wfrp3e.documents.assignDocumentClasses();
console.log("WFRP3e | Game System initialised | Welcome to the grim and perilous world of Warhammer Fantasy Roleplay - 3rd Edition!");
});
Hooks.on("applyActiveEffect", (actor, change, current, delta, object) => {
foundry.utils.setProperty(actor, change.key, current - Math.sign(current) * delta);
});
// Register all WFRP3e special dice to Dice So Nice!
Hooks.once("diceSoNiceReady", (dice3d) => {
dice3d.addSystem({id: "wfrp3e", name: "Warhammer Fantasy Roleplay - 3rd Edition"}, "preferred");
// Characteristic Dice.
dice3d.addDicePreset({
type: "da",
labels: ["", "", "s", "s", "s", "s", "B", "B"],
system: "wfrp3e",
colorset: "characteristic"
}, "d10");
dice3d.addColorset({
name: "characteristic",
description: "WFRP3e/Characteristic Dice",
category: "Warhammer Fantasy Roleplay - 3rd Edition",
foreground: "#FFFFFF",
background: "#4040FF",
outline: "#000000",
material: "plastic",
font: "WFRP3eSymbols",
visibility: 'hidden'
}, "preferred");
// Fortune Dice.
dice3d.addDicePreset({
type: "df",
labels: ["", "", "", "s", "s", "B"],
system: "wfrp3e",
colorset: "fortune"
}, "d6");
dice3d.addColorset({
name: "fortune",
description: "WFRP3e/Fortune Dice",
category: "Warhammer Fantasy Roleplay - 3rd Edition",
foreground: "#000000",
background: "#FFFFFF",
outline: "#FFFFFF",
material: "plastic",
font: "WFRP3eSymbols",
visibility: 'hidden'
}, "preferred");
// Expertise Dice.
dice3d.addDicePreset({
type: "de",
labels: ["", "s", "r", "B", "B", "S"],
system: "wfrp3e",
colorset: "expertise",
}, "d6");
dice3d.addColorset({
name: "expertise",
description: "WFRP3e/Expertise Dice",
category: "Warhammer Fantasy Roleplay - 3rd Edition",
foreground: "#000000",
background: "#FFFF00",
outline: "#FFFFFF",
material: "plastic",
font: "WFRP3eSymbols",
visibility: 'hidden'
}, "preferred");
// Conservative Dice.
dice3d.addDicePreset({
type: "do",
labels: ["", "s", "s", "s", "s", "B", "B", "s\nB", "s\nd", "s\nd"],
system: "wfrp3e",
colorset: "conservative"
}, "d10");
dice3d.addColorset({
name: "conservative",
description: "WFRP3e/Conservative Dice",
category: "Warhammer Fantasy Roleplay - 3rd Edition",
foreground: "#FFFFFF",
background: "#008000",
outline: "#000000",
material: "plastic",
font: "WFRP3eSymbols",
visibility: 'hidden'
}, "preferred");
// Reckless Dice.
dice3d.addDicePreset({
type: "dr",
labels: ["", "", "s\ns", "s\ns", "s\nB", "B\nB", "b", "b", "s\ne", "s\ne"],
system: "wfrp3e",
colorset: "reckless"
}, "d10");
dice3d.addColorset({
name: "reckless",
description: "WFRP3e/Reckless Dice",
category: "Warhammer Fantasy Roleplay - 3rd Edition",
foreground: "#FFFFFF",
background: "#C00000",
outline: "#000000",
material: "plastic",
font: "WFRP3eSymbols",
visibility: 'hidden'
}, "preferred");
// Challenge Dice.
dice3d.addDicePreset({
type: "dh",
labels: ["", "c", "c", "c\nc", "c\nc", "b", "b\nb", "C"],
system: "wfrp3e",
colorset: "challenge"
}, "d10");
dice3d.addColorset({
name: "challenge",
description: "WFRP3e/Challenge Dice",
category: "Warhammer Fantasy Roleplay - 3rd Edition",
foreground: "#FFFFFF",
background: "#800080",
outline: "#000000",
material: "plastic",
font: "WFRP3eSymbols",
visibility: 'hidden'
}, "preferred");
// Misfortune Dice.
dice3d.addDicePreset({
type: "dm",
labels: ["", "", "", "c", "c", "b"],
system: "wfrp3e",
colorset: "misfortune",
}, "d6");
dice3d.addColorset({
name: "misfortune",
description: "WFRP3e/Misfortune Dice",
category: "Warhammer Fantasy Roleplay - 3rd Edition",
foreground: "#FFFFFF",
background: "#000000",
outline: "#000000",
material: "plastic",
font: "WFRP3eSymbols",
visibility: 'hidden'
}, "preferred");
});