forked from Eriku33/Foundry-VTT-Image-Hover
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.js
145 lines (137 loc) · 5.07 KB
/
settings.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
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
export class Settings {
static createSettings() {
// Game master setting
game.settings.register("image-hover", "permissionOnHover", {
name: "Required actor permission", // Setting name
hint: "Required permission level of Actor to see handout.", // Setting description
scope: "world", // Global setting
config: true, // Show setting in configuration view
restricted: true, // Game master only
choices: {
// Choices
0: "None",
1: "Limited",
2: "Observer",
3: "Owner",
},
default: "0", // Default value
type: Number, // Value type
});
// Game master setting
game.settings.register("image-hover", "artType", {
name: "Art on hover", // Setting name
hint: "The type of art shown on hover", // Setting description
scope: "world", // Global setting
config: true, // Show setting in configuration view
restricted: true, // Game master only
choices: {
// Choices
character: "Character art",
token: "Token art",
wildcard: "Token art if wildcard",
linked: "Token art if unlinked",
},
default: "character", // Default value
type: String, // Value type
});
// Game master setting
game.keybindings.register("image-hover", "showAllKey", {
name: "Assign a keybind to show all users art.", // Setting name
restricted: true,
editable: [],
onDown: () => {
const hoveredToken = canvas.tokens.hover;
if (hoveredToken !== null) {
canvas.hud.imageHover.showToAll(hoveredToken); // apply to self
game.socket.emit("module.image-hover", hoveredToken.id); // emit to all other users
}
},
});
// Game master setting
game.settings.register("image-hover", "showArtTimer", {
name: "Show all users art duration", // Setting name
hint: 'Time (milliseconds) that art appears to users on the same scene when the "show all" keybind is pressed.', // Setting description
restricted: true, // Game master only
scope: "world", // Global setting
config: true, // Show setting in configuration view
range: {
// Choices
min: 1000,
max: 15000,
step: 200,
},
default: 6000, // Default Value
type: Number, // Value type
});
// client setting
game.settings.register("image-hover", "userEnableModule", {
name: "Enable/Disable Image Hover", // Setting name
hint: "Uncheck to disable Image Hover (per user).", // Setting description
scope: "client", // client-stored setting
config: true, // Show setting in configuration view
type: Boolean, // Value type
default: true, // The default value for the setting
onChange: (value) => {
canvas.hud.imageHover.clear();
},
});
// client setting
game.keybindings.register("image-hover", "userKeybindButton", {
name: "Assign a keybind requirement to show art while hovering over a token.", // Setting name
editable: [],
onDown: () => {
const hoveredToken = canvas.tokens.hover;
if (hoveredToken !== null) {
canvas.hud.imageHover.showArtworkRequirements(hoveredToken, true, 0);
}
},
});
// client setting
game.settings.register("image-hover", "userImagePosition", {
name: "Position of image", // Setting name
hint: "Set the location of the image on the screen (per user).", // Setting description
scope: "client", // Client-stored setting
config: true, // Show setting in configuration view
choices: {
// Choices
"Bottom left": "Bottom left",
"Bottom right": "Bottom right",
"Top left": "Top left",
"Top right": "Top right",
Centre: "Centre",
},
default: "Bottom left", // Default Value
type: String, // Value type
});
// client setting
game.settings.register("image-hover", "userImageSize", {
name: "Image to monitor width", // Setting name
hint: "Changes the size of the image (per user), smaller value implies larger image (1/value of your screen width).", // Setting description
scope: "client", // Client-stored setting
config: true, // Show setting in configuration view
range: {
// Choices
min: 3,
max: 20,
step: 0.5,
},
default: 7, // Default Value
type: Number, // Value type
});
// client setting
game.settings.register("image-hover", "userHoverDelay", {
name: "Mouse hover time requirement", // Setting name
hint: "Required hover time to show art work (milliseconds).", // Setting description
scope: "client", // Client-stored setting
config: true, // Show setting in configuration view
range: {
// Choices
min: 0,
max: 5000,
step: 100,
},
default: 0, // Default Value
type: Number, // Value type
});
}
}