-
Notifications
You must be signed in to change notification settings - Fork 234
/
Copy pathsettings.mjs
317 lines (291 loc) · 7.67 KB
/
settings.mjs
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
import { ModuleArtConfig } from "./module-art.mjs";
/**
* Register all of the system's settings.
*/
export default function registerSystemSettings() {
// Internal System Migration Version
game.settings.register("dnd5e", "systemMigrationVersion", {
name: "System Migration Version",
scope: "world",
config: false,
type: String,
default: ""
});
// Challenge visibility
game.settings.register("dnd5e", "challengeVisibility", {
name: "SETTINGS.5eChallengeVisibility.Name",
hint: "SETTINGS.5eChallengeVisibility.Hint",
scope: "world",
config: true,
default: "player",
type: String,
choices: {
all: "SETTINGS.5eChallengeVisibility.All",
player: "SETTINGS.5eChallengeVisibility.Player",
none: "SETTINGS.5eChallengeVisibility.None"
}
});
// Encumbrance tracking
game.settings.register("dnd5e", "encumbrance", {
name: "SETTINGS.5eEncumbrance.Name",
hint: "SETTINGS.5eEncumbrance.Hint",
scope: "world",
config: true,
default: "none",
type: String,
choices: {
none: "SETTINGS.5eEncumbrance.None",
normal: "SETTINGS.5eEncumbrance.Normal",
variant: "SETTINGS.5eEncumbrance.Variant"
}
});
// Rest Recovery Rules
game.settings.register("dnd5e", "restVariant", {
name: "SETTINGS.5eRestN",
hint: "SETTINGS.5eRestL",
scope: "world",
config: true,
default: "normal",
type: String,
choices: {
normal: "SETTINGS.5eRestPHB",
gritty: "SETTINGS.5eRestGritty",
epic: "SETTINGS.5eRestEpic"
}
});
// Diagonal Movement Rule
game.settings.register("dnd5e", "diagonalMovement", {
name: "SETTINGS.5eDiagN",
hint: "SETTINGS.5eDiagL",
scope: "world",
config: true,
default: "555",
type: String,
choices: {
555: "SETTINGS.5eDiagPHB",
5105: "SETTINGS.5eDiagDMG",
EUCL: "SETTINGS.5eDiagEuclidean"
},
onChange: rule => canvas.grid.diagonalRule = rule
});
// Allow rotating square templates
game.settings.register("dnd5e", "gridAlignedSquareTemplates", {
name: "SETTINGS.5eGridAlignedSquareTemplatesN",
hint: "SETTINGS.5eGridAlignedSquareTemplatesL",
scope: "world",
config: true,
default: true,
type: Boolean
});
// Proficiency modifier type
game.settings.register("dnd5e", "proficiencyModifier", {
name: "SETTINGS.5eProfN",
hint: "SETTINGS.5eProfL",
scope: "world",
config: true,
default: "bonus",
type: String,
choices: {
bonus: "SETTINGS.5eProfBonus",
dice: "SETTINGS.5eProfDice"
}
});
// Allow feats during Ability Score Improvements
game.settings.register("dnd5e", "allowFeats", {
name: "SETTINGS.5eFeatsN",
hint: "SETTINGS.5eFeatsL",
scope: "world",
config: true,
default: true,
type: Boolean
});
// Use Honor ability score
game.settings.register("dnd5e", "honorScore", {
name: "SETTINGS.5eHonorN",
hint: "SETTINGS.5eHonorL",
scope: "world",
config: true,
default: false,
type: Boolean,
requiresReload: true
});
// Use Sanity ability score
game.settings.register("dnd5e", "sanityScore", {
name: "SETTINGS.5eSanityN",
hint: "SETTINGS.5eSanityL",
scope: "world",
config: true,
default: false,
type: Boolean,
requiresReload: true
});
// Apply Dexterity as Initiative Tiebreaker
game.settings.register("dnd5e", "initiativeDexTiebreaker", {
name: "SETTINGS.5eInitTBN",
hint: "SETTINGS.5eInitTBL",
scope: "world",
config: true,
default: false,
type: Boolean
});
// Record Currency Weight
game.settings.register("dnd5e", "currencyWeight", {
name: "SETTINGS.5eCurWtN",
hint: "SETTINGS.5eCurWtL",
scope: "world",
config: true,
default: true,
type: Boolean
});
// Disable Experience Tracking
game.settings.register("dnd5e", "disableExperienceTracking", {
name: "SETTINGS.5eNoExpN",
hint: "SETTINGS.5eNoExpL",
scope: "world",
config: true,
default: false,
type: Boolean
});
// Disable Advancements
game.settings.register("dnd5e", "disableAdvancements", {
name: "SETTINGS.5eNoAdvancementsN",
hint: "SETTINGS.5eNoAdvancementsL",
scope: "world",
config: true,
default: false,
type: Boolean
});
// Collapse Item Cards (by default)
game.settings.register("dnd5e", "autoCollapseItemCards", {
name: "SETTINGS.5eAutoCollapseCardN",
hint: "SETTINGS.5eAutoCollapseCardL",
scope: "client",
config: true,
default: false,
type: Boolean,
onChange: s => {
ui.chat.render();
}
});
// Allow Polymorphing
game.settings.register("dnd5e", "allowPolymorphing", {
name: "SETTINGS.5eAllowPolymorphingN",
hint: "SETTINGS.5eAllowPolymorphingL",
scope: "world",
config: true,
default: false,
type: Boolean
});
// Polymorph Settings
game.settings.register("dnd5e", "polymorphSettings", {
scope: "client",
default: {
keepPhysical: false,
keepMental: false,
keepSaves: false,
keepSkills: false,
mergeSaves: false,
mergeSkills: false,
keepClass: false,
keepFeats: false,
keepSpells: false,
keepItems: false,
keepBio: false,
keepVision: true,
keepSelf: false,
keepAE: false,
keepOriginAE: true,
keepOtherOriginAE: true,
keepFeatAE: true,
keepSpellAE: true,
keepEquipmentAE: true,
keepClassAE: true,
keepBackgroundAE: true,
transformTokens: true
}
});
// Metric Unit Weights
game.settings.register("dnd5e", "metricWeightUnits", {
name: "SETTINGS.5eMetricN",
hint: "SETTINGS.5eMetricL",
scope: "world",
config: true,
type: Boolean,
default: false
});
// Critical Damage Modifiers
game.settings.register("dnd5e", "criticalDamageModifiers", {
name: "SETTINGS.5eCriticalModifiersN",
hint: "SETTINGS.5eCriticalModifiersL",
scope: "world",
config: true,
type: Boolean,
default: false
});
// Critical Damage Maximize
game.settings.register("dnd5e", "criticalDamageMaxDice", {
name: "SETTINGS.5eCriticalMaxDiceN",
hint: "SETTINGS.5eCriticalMaxDiceL",
scope: "world",
config: true,
type: Boolean,
default: false
});
// Strict validation
game.settings.register("dnd5e", "strictValidation", {
scope: "world",
config: false,
type: Boolean,
default: true
});
// Dynamic art.
game.settings.registerMenu("dnd5e", "moduleArtConfiguration", {
name: "DND5E.ModuleArtConfigN",
label: "DND5E.ModuleArtConfigL",
hint: "DND5E.ModuleArtConfigH",
icon: "fa-solid fa-palette",
type: ModuleArtConfig,
restricted: true
});
game.settings.register("dnd5e", "moduleArtConfiguration", {
name: "Module Art Configuration",
scope: "world",
config: false,
type: Object,
default: {
dnd5e: {
portraits: true,
tokens: true
}
}
});
// Primary Group
game.settings.register("dnd5e", "primaryParty", {
name: "Primary Party",
scope: "world",
config: false,
default: null,
type: PrimaryPartyData,
onChange: s => ui.actors.render()
});
// Token Rings
game.settings.register("dnd5e", "disableTokenRings", {
name: "SETTINGS.5eTokenRings.Name",
hint: "SETTINGS.5eTokenRings.Hint",
scope: "client",
config: true,
type: Boolean,
default: false,
requiresReload: true
});
}
/**
* Data model for tracking information on the primary party.
*
* @property {Actor5e} actor Group actor representing the primary party.
*/
class PrimaryPartyData extends foundry.abstract.DataModel {
static defineSchema() {
return { actor: new foundry.data.fields.ForeignDocumentField(foundry.documents.BaseActor) };
}
}