Skip to content

Commit 0ad918f

Browse files
authored
Merge pull request #26 from Norc/dev
beta release prep
2 parents 1e514f8 + e65c86e commit 0ad918f

11 files changed

+541
-26
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Foundry VTT module to add an extra, fully functional macro hotbar above the core
1212

1313
## Features
1414
1. Adds easy access to 10 additional macros in a separate visual grouping
15+
1. Provides color and position control over both the existing core hotbar and new custom hotbars
1516
1. Fully system agnostic
1617
1. Tested with 5E, PF2E, and WFRP
1718
1. Requests for features that would help support specfic systems are welcomed
@@ -25,6 +26,11 @@ Foundry VTT module to add an extra, fully functional macro hotbar above the core
2526
1. Does not interfere with the operation of the original Macro Hotbar
2627

2728
## Changelog
29+
*Version 2.0* (2020/07/09)
30+
1. Added settings to control Custom Hotbar coloring and position settings
31+
1. Added settings to provide the same control to the Core Hotbar
32+
1. Added localization strings for the new settings
33+
2834
*INITIAL RELEASE v1.5* (2020/07/05)
2935
1. Added ability to automatically handle dragging from character sheet onto custom hotbar, including full MQoL and BetterRolls support.
3036
1. Added support for all reamining dragging and dropping scenarios, including between Core and Custom Hotbars.
@@ -39,11 +45,11 @@ Initial version to attempt to display the hotbar in any fashion.
3945

4046
## Roadmap:
4147
_Next major version:_
42-
1. Add better control for location of hotbar, including full popout mode with drag and drop.
43-
1. Add color customization options for both Core and Custom Hotbar via Color Picker library
48+
1. Add option to popout hotbars for positioning by dragging and dropping
49+
1. Add option to unlock Custom Hotbar pages 2-5, just like Core Hotbar
50+
1. Misc bugfixes, minor features and settings improvements
4451

4552
_Future versions:_
46-
1. Add option to unlock Custom Hotbar pages 2-5, just like Core Hotbar
4753
1. Add ability to create multiple Custom Hotbars, not just one
4854
1. Add ability to highlight hotbar if various flags/system values are present
4955

core-hotbar-settings-form.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
//import { CustomHotbarSettings } from './custom-hotbar-settings.js';
2+
3+
export class CoreHotbarSettingsForm extends FormApplication {
4+
5+
constructor(object, options = {}) {
6+
super(object, options);
7+
}
8+
9+
/**
10+
* Default Options for this FormApplication
11+
*/
12+
static get defaultOptions() {
13+
return mergeObject(super.defaultOptions, {
14+
id: "core-hotbar-settings-form",
15+
title: "Core Hotbar Modification Settings",
16+
template: "./modules/custom-hotbar/templates/coreHotbarSettings.html",
17+
classes: ["sheet"],
18+
width: 500,
19+
closeOnSubmit: true
20+
});
21+
}
22+
23+
getData() {
24+
25+
26+
const data = "core Hotbar Test";
27+
28+
console.debug("Custom Hotbar | Getting settings form data");
29+
console.debug(data);
30+
31+
return data;
32+
}
33+
34+
/**
35+
* Executes on form submission.
36+
* @param {Object} e - the form submission event
37+
* @param {Object} d - the form data
38+
*
39+
* 'name': entry.metadata.label+' ['+entry.metadata.package+']',
40+
* 'type':'pack',
41+
* 'submenu':submenu.toLowerCase(),
42+
* 'key':entry.metadata.package+'.'+entry.metadata.name
43+
*/
44+
async _updateObject(e, d) {
45+
console.debug("Custom Hotbar | Core settings updated");
46+
}
47+
48+
49+
activateListeners(html) {
50+
super.activateListeners(html);
51+
console.debug("Custom Hotbar | Attempted to activate Core Settings Menu listeners");
52+
}
53+
}

css/custom-hotbar.css

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,5 @@
11
/*Global styles*/
22

3-
/* Only adjustment needed to core hotbar styling.
4-
Prevents it from accidentally catching macro drops */
5-
6-
#hotbar .macro .tooltip {
7-
font-size: 72;
8-
}
9-
10-
#hotbar .macro .tooltip:hover {
11-
display: none;
12-
}
13-
143
#custom-hotbar {
154
z-index: 69;
165
position: fixed;
@@ -55,18 +44,6 @@ pointer-events: all;
5544
border-radius: 3px;
5645
}
5746

58-
#custom-hotbar .bar-controls {
59-
flex: 0 0 32px;
60-
height: 100%;
61-
margin: 0 2px;
62-
text-align: center;
63-
color: #c9c7b8;
64-
background: rgba(0, 0, 200, 0.5);
65-
border: 1px solid #0000ff;
66-
box-shadow: 0 0 3px #444 inset;
67-
border-radius: 3px;
68-
}
69-
7047
#custom-hotbar .macro {
7148
position: relative;
7249
flex: 0 0 50px;

custom-hotbar-settings-form.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { CustomHotbarSettings } from './custom-hotbar-settings.js';
2+
3+
export class CustomHotbarSettingsForm extends FormApplication {
4+
5+
constructor(object, options = {}) {
6+
super(object, options);
7+
}
8+
9+
/**
10+
* Default Options for this FormApplication
11+
*/
12+
static get defaultOptions() {
13+
return mergeObject(super.defaultOptions, {
14+
id: "custom-hotbar-settings-form",
15+
title: "Custom Hotbar Settings",
16+
template: "./modules/custom-hotbar/templates/customHotbarSettings.html",
17+
classes: ["sheet"],
18+
width: 500,
19+
closeOnSubmit: true
20+
});
21+
}
22+
23+
getData() {
24+
25+
26+
const data = "Custom Hotbar Test";
27+
28+
console.debug("Custom Hotbar | Getting settings form data");
29+
console.debug(data);
30+
31+
return data;
32+
}
33+
34+
/**
35+
* Executes on form submission.
36+
* @param {Object} e - the form submission event
37+
* @param {Object} d - the form data
38+
*
39+
* 'name': entry.metadata.label+' ['+entry.metadata.package+']',
40+
* 'type':'pack',
41+
* 'submenu':submenu.toLowerCase(),
42+
* 'key':entry.metadata.package+'.'+entry.metadata.name
43+
*/
44+
async _updateObject(e, d) {
45+
console.debug("Custom Hotbar | settings updated");
46+
}
47+
48+
49+
activateListeners(html) {
50+
super.activateListeners(html);
51+
console.debug("Custom Hotbar | Attempted to activate Settings Menu listeners");
52+
}
53+
}

custom-hotbar-settings.js

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
import { CustomHotbarSettingsForm } from './custom-hotbar-settings-form.js';
2+
import { CoreHotbarSettingsForm } from './core-hotbar-settings-form.js';
3+
4+
export class CustomHotbarSettings {
5+
6+
static register(){
7+
//EXPERIMENTAL ATTEMPT AT SUBMENU
8+
game.settings.registerMenu("custom-hotbar", 'chbSettingsMenu', {
9+
name: 'Custom Hotbar Settings',
10+
label: 'Custom Hotbar',
11+
icon: 'fas fa-bars',
12+
type: CustomHotbarSettingsForm,
13+
restricted: true
14+
});
15+
16+
game.settings.registerMenu("custom-hotbar", 'coreSettingsMenu', {
17+
name: 'Core Foundry Hotbar Modification Settings',
18+
label: 'Core Hotbar',
19+
icon: 'fas fa-minus',
20+
type: CoreHotbarSettingsForm,
21+
restricted: true
22+
});
23+
24+
25+
//CUSTOM HOTBAR SETTINGS
26+
27+
// module key options
28+
new window.Ardittristan.ColorSetting("custom-hotbar", "chbPrimaryColor", {
29+
name: "customHotbar.settings.chbPrimaryColor.name", // The name of the setting in the settings menu
30+
hint: "customHotbar.settings.chbPrimaryColor.nameHint", // A description of the registered setting and its behavior
31+
label: "Color Picker", // The text label used in the button
32+
restricted: false, // Restrict this setting to gamemaster only?
33+
defaultColor: "#0000FF80", // The default color of the setting
34+
scope: "client", // The scope of the setting
35+
onChange: (value) => {ui.customHotbar.render();} // A callback function which triggers when the setting is changed
36+
})
37+
38+
// module key options
39+
new window.Ardittristan.ColorSetting("custom-hotbar", "chbBorderColor", {
40+
name: "customHotbar.settings.chbBorderColor.name", // The name of the setting in the settings menu
41+
hint: "customHotbar.settings.chbBorderColor.nameHint", // A description of the registered setting and its behavior
42+
label: "Color Picker", // The text label used in the button
43+
restricted: false, // Restrict this setting to gamemaster only?
44+
defaultColor: "#0000FFff", // The default color of the setting
45+
scope: "client", // The scope of the setting
46+
onChange: (value) => {ui.customHotbar.render();} // A callback function which triggers when the setting is changed
47+
})
48+
49+
// module key options
50+
new window.Ardittristan.ColorSetting("custom-hotbar", "chbBorderColorActive", {
51+
name: "customHotbar.settings.chbBorderColorActive.name", // The name of the setting in the settings menu
52+
hint: "customHotbar.settings.chbBorderColorActive.nameHint", // A description of the registered setting and its behavior
53+
label: "Color Picker", // The text label used in the button
54+
restricted: false, // Restrict this setting to gamemaster only?
55+
defaultColor: "#FFFFFFff", // The default color of the setting
56+
scope: "client", // The scope of the setting
57+
onChange: (value) => {ui.customHotbar.render();} // A callback function which triggers when the setting is changed
58+
})
59+
60+
// module key options
61+
new window.Ardittristan.ColorSetting("custom-hotbar", "chbBorderColorInactive", {
62+
name: "customHotbar.settings.chbBorderColorInactive.name", // The name of the setting in the settings menu
63+
hint: "customHotbar.settings.chbBorderColorInactive.nameHint", // A description of the registered setting and its behavior
64+
label: "Color Picker", // The text label used in the button
65+
restricted: false, // Restrict this setting to gamemaster only?
66+
defaultColor: "#939799ff", // The default color of the setting
67+
scope: "client", // The scope of the setting
68+
onChange: (value) => {ui.customHotbar.render();} // A callback function which triggers when the setting is changed
69+
})
70+
71+
game.settings.register("custom-hotbar", "chbXPos", {
72+
name: "customHotbar.settings.chbXPos.name",
73+
hint: "customHotbar.settings.chbXPos.nameHint",
74+
scope: "world",
75+
config: true,
76+
default: "220",
77+
type: Number,
78+
//choices: {
79+
//"default": "customHotbar.Settings.chbColor.value.default",
80+
//"onlyCurrent": "customHotbar.Settings.chbColor.value.onlyCurrent",
81+
//"no": "ForienQuestLog.Settings.showTasks.no"
82+
//},
83+
onChange: value => {
84+
ui.customHotbar.render();
85+
}
86+
});
87+
88+
game.settings.register("custom-hotbar", "chbYPos", {
89+
name: "customHotbar.settings.chbYPos.name",
90+
hint: "customHotbar.settings.chbYPos.nameHint",
91+
scope: "world",
92+
config: true,
93+
default: "63",
94+
type: Number,
95+
//choices: {
96+
//"default": "customHotbar.Settings.chbColor.value.default",
97+
//"onlyCurrent": "customHotbar.Settings.chbColor.value.onlyCurrent",
98+
//"no": "ForienQuestLog.Settings.showTasks.no"
99+
//},
100+
onChange: value => {
101+
ui.customHotbar.render();
102+
}
103+
});
104+
105+
//Add ZPos set to uneditable?
106+
107+
//CORE HOTBAR SETTINGS
108+
// module key options
109+
new window.Ardittristan.ColorSetting("custom-hotbar", "corePrimaryColor", {
110+
name: "customHotbar.settings.corePrimaryColor.name", // The name of the setting in the settings menu
111+
hint: "customHotbar.settings.corePrimaryColor.nameHint", // A description of the registered setting and its behavior
112+
label: "Color Picker", // The text label used in the button
113+
restricted: false, // Restrict this setting to gamemaster only?
114+
defaultColor: "#00000080", // The default color of the setting
115+
scope: "client", // The scope of the setting
116+
onChange: (value) => {ui.hotbar.render();} // A callback function which triggers when the setting is changed
117+
})
118+
119+
// module key options
120+
new window.Ardittristan.ColorSetting("custom-hotbar", "coreBorderColor", {
121+
name: "customHotbar.settings.coreBorderColor.name", // The name of the setting in the settings menu
122+
hint: "customHotbar.settings.coreBorderColor.nameHint", // A description of the registered setting and its behavior
123+
label: "Color Picker", // The text label used in the button
124+
restricted: false, // Restrict this setting to gamemaster only?
125+
defaultColor: "#000000ff", // The default color of the setting
126+
scope: "client", // The scope of the setting
127+
onChange: (value) => {ui.hotbar.render();} // A callback function which triggers when the setting is changed
128+
})
129+
130+
// module key options
131+
new window.Ardittristan.ColorSetting("custom-hotbar", "coreBorderColorActive", {
132+
name: "customHotbar.settings.coreBorderColorActive.name", // The name of the setting in the settings menu
133+
hint: "customHotbar.settings.coreBorderColorActive.nameHint", // A description of the registered setting and its behavior
134+
label: "Color Picker", // The text label used in the button
135+
restricted: false, // Restrict this setting to gamemaster only?
136+
defaultColor: "#ff6400", // The default color of the setting
137+
scope: "client", // The scope of the setting
138+
onChange: (value) => {ui.hotbar.render();} // A callback function which triggers when the setting is changed
139+
})
140+
141+
// module key options
142+
new window.Ardittristan.ColorSetting("custom-hotbar", "coreBorderColorInactive", {
143+
name: "customHotbar.settings.coreBorderColorInactive.name", // The name of the setting in the settings menu
144+
hint: "customHotbar.settings.coreBorderColorInactive.nameHint", // A description of the registered setting and its behavior
145+
label: "Color Picker", // The text label used in the button
146+
restricted: false, // Restrict this setting to gamemaster only?
147+
defaultColor: "#939799ff", // The default color of the setting
148+
scope: "client", // The scope of the setting
149+
onChange: (value) => {ui.hotbar.render();} // A callback function which triggers when the setting is changed
150+
})
151+
152+
game.settings.register("custom-hotbar", "coreXPos", {
153+
name: "customHotbar.settings.coreXPos.name",
154+
hint: "customHotbar.settings.coreXPos.nameHint",
155+
scope: "world",
156+
config: true,
157+
default: "220",
158+
type: Number,
159+
/*choices: {
160+
"default": "customHotbar.Settings.chbColor.value.default",
161+
"onlyCurrent": "customHotbar.Settings.chbColor.value.onlyCurrent",
162+
"no": "ForienQuestLog.Settings.showTasks.no"
163+
}, */
164+
onChange: value => {
165+
ui.hotbar.render();
166+
}
167+
});
168+
169+
game.settings.register("custom-hotbar", "coreYPos", {
170+
name: "customHotbar.settings.coreYPos.name",
171+
hint: "customHotbar.settings.coreYPos.nameHint",
172+
scope: "world",
173+
config: true,
174+
default: "10",
175+
type: Number,
176+
/*choices: {
177+
"default": "customHotbar.Settings.chbColor.value.default",
178+
"onlyCurrent": "customHotbar.Settings.chbColor.value.onlyCurrent",
179+
"no": "ForienQuestLog.Settings.showTasks.no"
180+
}, */
181+
onChange: value => {
182+
ui.hotbar.render();
183+
}
184+
});
185+
}
186+
}

custom-hotbar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ export class CustomHotbar extends Hotbar {
314314
*/
315315
async _onClickMacro(event) {
316316
console.debug("custom macro click detected!");
317+
317318
event.preventDefault();
318319
const li = event.currentTarget;
319320

0 commit comments

Comments
 (0)