Skip to content

Commit a3369ef

Browse files
committed
a
1 parent a1fcf4a commit a3369ef

File tree

3 files changed

+85
-76
lines changed

3 files changed

+85
-76
lines changed

index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/config.js

+83-74
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function initConfig() {
2121
consumable: ["consumable", "equipment", "loot"],
2222
};
2323

24-
const mainBarFeatures = []
24+
const mainBarFeatures = [];
2525

2626
if (game.settings.get(MODULE_ID, "showWeaponsItems")) itemTypes.consumable.push("weapon");
2727
if (game.settings.get(MODULE_ID, "showClassActions")) mainBarFeatures.push("class");
@@ -221,7 +221,7 @@ export function initConfig() {
221221
}
222222

223223
class DND5eDrawerButton extends ARGON.DRAWER.DrawerButton {
224-
constructor (buttons, item, type) {
224+
constructor(buttons, item, type) {
225225
super(buttons);
226226
this.item = item;
227227
this.type = type;
@@ -231,7 +231,7 @@ export function initConfig() {
231231
return true;
232232
}
233233

234-
get tooltipOrientation(){
234+
get tooltipOrientation() {
235235
return TooltipManager.TOOLTIP_DIRECTIONS.RIGHT;
236236
}
237237

@@ -258,46 +258,57 @@ export function initConfig() {
258258

259259
const abilitiesButtons = Object.keys(abilities).map((ability) => {
260260
const abilityData = abilities[ability];
261-
return new DND5eDrawerButton([
262-
{
263-
label: CONFIG.DND5E.abilities[ability].label,
264-
onClick: (event) => this.actor.rollAbility(ability, { event }),
265-
},
266-
{
267-
label: addSign(abilityData.mod),
268-
onClick: (event) => this.actor.rollAbilityTest(ability, { event }),
269-
},
270-
{
271-
label: addSign(abilityData.save),
272-
onClick: (event) => this.actor.rollAbilitySave(ability, { event }),
273-
},
274-
], ability , "save");
261+
return new DND5eDrawerButton(
262+
[
263+
{
264+
label: CONFIG.DND5E.abilities[ability].label,
265+
onClick: (event) => this.actor.rollAbility(ability, { event }),
266+
},
267+
{
268+
label: addSign(abilityData.mod),
269+
onClick: (event) => this.actor.rollAbilityTest(ability, { event }),
270+
},
271+
{
272+
label: addSign(abilityData.save),
273+
onClick: (event) => this.actor.rollAbilitySave(ability, { event }),
274+
},
275+
],
276+
ability,
277+
"save",
278+
);
275279
});
276280

277281
const skillsButtons = Object.keys(skills).map((skill) => {
278282
const skillData = skills[skill];
279-
return new DND5eDrawerButton([
280-
{
281-
label: getProficiencyIcon(skillData.proficient) + CONFIG.DND5E.skills[skill].label,
282-
onClick: (event) => this.actor.rollSkill(skill, { event }),
283-
},
284-
{
285-
label: `${addSign(skillData.mod)}<span style="margin: 0 1rem; filter: brightness(0.8)">(${skillData.passive})</span>`,
286-
style: "display: flex; justify-content: flex-end;",
287-
},
288-
], skill , "skill");
283+
return new DND5eDrawerButton(
284+
[
285+
{
286+
label: getProficiencyIcon(skillData.proficient) + CONFIG.DND5E.skills[skill].label,
287+
onClick: (event) => this.actor.rollSkill(skill, { event }),
288+
},
289+
{
290+
label: `${addSign(skillData.mod)}<span style="margin: 0 1rem; filter: brightness(0.8)">(${skillData.passive})</span>`,
291+
style: "display: flex; justify-content: flex-end;",
292+
},
293+
],
294+
skill,
295+
"skill",
296+
);
289297
});
290298

291299
const toolButtons = tools.map((tool) => {
292-
return new DND5eDrawerButton([
293-
{
294-
label: getProficiencyIcon(tool.system.proficient) + tool.name,
295-
onClick: (event) => tool.rollToolCheck({ event }),
296-
},
297-
{
298-
label: addSign(abilities[tool.abilityMod].mod + tool.system.proficiencyMultiplier * this.actor.system.attributes.prof),
299-
},
300-
], tool);
300+
return new DND5eDrawerButton(
301+
[
302+
{
303+
label: getProficiencyIcon(tool.system.proficient) + tool.name,
304+
onClick: (event) => tool.rollToolCheck({ event }),
305+
},
306+
{
307+
label: addSign(abilities[tool.abilityMod].mod + tool.system.proficiencyMultiplier * this.actor.system.attributes.prof),
308+
},
309+
],
310+
tool,
311+
);
301312
});
302313

303314
return [
@@ -364,7 +375,7 @@ export function initConfig() {
364375
get maxActions() {
365376
return this.actor.inCombat ? 1 : null;
366377
}
367-
378+
368379
get currentActions() {
369380
return this.isActionUsed ? 0 : 1;
370381
}
@@ -382,12 +393,12 @@ export function initConfig() {
382393
const specialActions = Object.values(ECHItems);
383394

384395
const buttons = [new DND5eItemButton({ item: null, isWeaponSet: true, isPrimary: true }), new ARGON.MAIN.BUTTONS.SplitButton(new DND5eSpecialActionButton(specialActions[0]), new DND5eSpecialActionButton(specialActions[1])), new DND5eButtonPanelButton({ type: "spell", items: spellItems, color: 0 }), new DND5eButtonPanelButton({ type: "feat", items: featItems, color: 0 }), new ARGON.MAIN.BUTTONS.SplitButton(new DND5eSpecialActionButton(specialActions[2]), new DND5eSpecialActionButton(specialActions[3])), new ARGON.MAIN.BUTTONS.SplitButton(new DND5eSpecialActionButton(specialActions[4]), new DND5eSpecialActionButton(specialActions[5])), new DND5eButtonPanelButton({ type: "consumable", items: consumableItems, color: 0 })];
385-
386-
const barItems = this.actor.items.filter((item) => mainBarFeatures.includes(item.system.type?.value) && actionTypes.action.includes(item.system.activation?.type));
387-
for(const item of barItems) {
396+
397+
const barItems = this.actor.items.filter((item) => CoreHUD.DND5E.mainBarFeatures.includes(item.system.type?.value) && actionTypes.action.includes(item.system.activation?.type));
398+
for (const item of barItems) {
388399
buttons.push(new DND5eItemButton({ item, inActionPanel: true }));
389400
}
390-
401+
391402
return buttons.filter((button) => button.items == undefined || button.items.length);
392403
}
393404
}
@@ -404,7 +415,7 @@ export function initConfig() {
404415
get maxActions() {
405416
return this.actor.inCombat ? 1 : null;
406417
}
407-
418+
408419
get currentActions() {
409420
return this.isActionUsed ? 0 : 1;
410421
}
@@ -422,8 +433,8 @@ export function initConfig() {
422433
buttons.push(new DND5eButtonPanelButton({ type, items, color: 1 }));
423434
}
424435

425-
const barItems = this.actor.items.filter((item) => mainBarFeatures.includes(item.system.type?.value) && actionTypes.bonus.includes(item.system.activation?.type));
426-
for(const item of barItems) {
436+
const barItems = this.actor.items.filter((item) => CoreHUD.DND5E.mainBarFeatures.includes(item.system.type?.value) && actionTypes.bonus.includes(item.system.activation?.type));
437+
for (const item of barItems) {
427438
buttons.push(new DND5eItemButton({ item, inActionPanel: true }));
428439
}
429440

@@ -443,7 +454,7 @@ export function initConfig() {
443454
get maxActions() {
444455
return this.actor.inCombat ? 1 : null;
445456
}
446-
457+
447458
get currentActions() {
448459
return this.isActionUsed ? 0 : 1;
449460
}
@@ -462,8 +473,8 @@ export function initConfig() {
462473
buttons.push(new DND5eButtonPanelButton({ type, items, color: 3 }));
463474
}
464475

465-
const barItems = this.actor.items.filter((item) => mainBarFeatures.includes(item.system.type?.value) && actionTypes.reaction.includes(item.system.activation?.type));
466-
for(const item of barItems) {
476+
const barItems = this.actor.items.filter((item) => CoreHUD.DND5E.mainBarFeatures.includes(item.system.type?.value) && actionTypes.reaction.includes(item.system.activation?.type));
477+
for (const item of barItems) {
467478
buttons.push(new DND5eItemButton({ item, inActionPanel: true }));
468479
}
469480

@@ -483,7 +494,7 @@ export function initConfig() {
483494
get maxActions() {
484495
return this.actor.inCombat ? 1 : null;
485496
}
486-
497+
487498
get currentActions() {
488499
return this.isActionUsed ? 0 : 1;
489500
}
@@ -502,8 +513,8 @@ export function initConfig() {
502513
buttons.push(new DND5eButtonPanelButton({ type, items, color: 2 }));
503514
}
504515

505-
const barItems = this.actor.items.filter((item) => mainBarFeatures.includes(item.system.type?.value) && actionTypes.free.includes(item.system.activation?.type));
506-
for(const item of barItems) {
516+
const barItems = this.actor.items.filter((item) => CoreHUD.DND5E.mainBarFeatures.includes(item.system.type?.value) && actionTypes.free.includes(item.system.activation?.type));
517+
for (const item of barItems) {
507518
buttons.push(new DND5eItemButton({ item, inActionPanel: true }));
508519
}
509520

@@ -523,7 +534,7 @@ export function initConfig() {
523534
get maxActions() {
524535
return this.actor.inCombat ? this.actor.system.resources?.legact?.max ?? null : null;
525536
}
526-
537+
527538
get currentActions() {
528539
return this.actor.system.resources?.legact?.value ?? null;
529540
}
@@ -619,7 +630,7 @@ export function initConfig() {
619630
}
620631

621632
get quantity() {
622-
if(!this.item?.system) return null;
633+
if (!this.item?.system) return null;
623634
const showQuantityItemTypes = ["consumable"];
624635
const consumeType = this.item.system.consume?.type;
625636
if (consumeType === "ammo") {
@@ -661,11 +672,11 @@ export function initConfig() {
661672
get icon() {
662673
switch (this.type) {
663674
case "spell":
664-
return "modules/enhancedcombathud/icons/spell-book.svg";
675+
return "modules/enhancedcombathud/icons/spell-book.webp";
665676
case "feat":
666-
return "modules/enhancedcombathud/icons/mighty-force.svg";
677+
return "modules/enhancedcombathud/icons/mighty-force.webp";
667678
case "consumable":
668-
return "modules/enhancedcombathud/icons/drink-me.svg";
679+
return "modules/enhancedcombathud/icons/drink-me.webp";
669680
}
670681
}
671682

@@ -729,9 +740,11 @@ export function initConfig() {
729740
constructor(specialItem) {
730741
super();
731742
const actorItem = this.actor.items.getName(specialItem.name);
732-
this.item = actorItem ?? new CONFIG.Item.documentClass(specialItem, {
733-
parent: this.actor,
734-
});
743+
this.item =
744+
actorItem ??
745+
new CONFIG.Item.documentClass(specialItem, {
746+
parent: this.actor,
747+
});
735748
}
736749

737750
get label() {
@@ -826,7 +839,7 @@ function registerItems() {
826839
ECHItems[game.i18n.localize("enhancedcombathud-dnd5e.items.disengage.name")] = {
827840
name: game.i18n.localize("enhancedcombathud-dnd5e.items.disengage.name"),
828841
type: "feat",
829-
img: "modules/enhancedcombathud/icons/journey.svg",
842+
img: "modules/enhancedcombathud/icons/journey.webp",
830843
system: {
831844
description: {
832845
value: game.i18n.localize("enhancedcombathud-dnd5e.items.disengage.desc"),
@@ -892,7 +905,7 @@ function registerItems() {
892905
startTime: null,
893906
turns: 1,
894907
},
895-
icon: "modules/enhancedcombathud/icons/journey.svg",
908+
icon: "modules/enhancedcombathud/icons/journey.webp",
896909
label: "Disengage",
897910
origin: "Item.wyQkeuZkttllAFB1",
898911
transfer: false,
@@ -921,7 +934,7 @@ function registerItems() {
921934
ECHItems[game.i18n.localize("enhancedcombathud-dnd5e.items.dodge.name")] = {
922935
name: game.i18n.localize("enhancedcombathud-dnd5e.items.dodge.name"),
923936
type: "feat",
924-
img: "modules/enhancedcombathud/icons/armor-upgrade.svg",
937+
img: "modules/enhancedcombathud/icons/armor-upgrade.webp",
925938
system: {
926939
description: {
927940
value: game.i18n.localize("enhancedcombathud-dnd5e.items.dodge.desc"),
@@ -989,7 +1002,7 @@ function registerItems() {
9891002
startTime: null,
9901003
rounds: 1,
9911004
},
992-
icon: "modules/enhancedcombathud/icons/armor-upgrade.svg",
1005+
icon: "modules/enhancedcombathud/icons/armor-upgrade.webp",
9931006
label: "Dodge",
9941007
origin: "Item.pakEYcgLYxtKGv7J",
9951008
transfer: false,
@@ -1006,7 +1019,6 @@ function registerItems() {
10061019
],
10071020
sort: 0,
10081021
flags: {
1009-
10101022
"midi-qol": {
10111023
onUseMacroName: "",
10121024
},
@@ -1015,7 +1027,7 @@ function registerItems() {
10151027
ECHItems[game.i18n.localize("enhancedcombathud-dnd5e.items.ready.name")] = {
10161028
name: game.i18n.localize("enhancedcombathud-dnd5e.items.ready.name"),
10171029
type: "feat",
1018-
img: "modules/enhancedcombathud/icons/clockwork.svg",
1030+
img: "modules/enhancedcombathud/icons/clockwork.webp",
10191031
system: {
10201032
description: {
10211033
value: game.i18n.localize("enhancedcombathud-dnd5e.items.ready.desc"),
@@ -1083,7 +1095,7 @@ function registerItems() {
10831095
startTime: null,
10841096
turns: 1,
10851097
},
1086-
icon: "modules/enhancedcombathud/icons/clockwork.svg",
1098+
icon: "modules/enhancedcombathud/icons/clockwork.webp",
10871099
label: "Ready",
10881100
transfer: false,
10891101
flags: {
@@ -1099,7 +1111,6 @@ function registerItems() {
10991111
],
11001112
sort: 0,
11011113
flags: {
1102-
11031114
"midi-qol": {
11041115
onUseMacroName: "",
11051116
},
@@ -1108,7 +1119,7 @@ function registerItems() {
11081119
ECHItems[game.i18n.localize("enhancedcombathud-dnd5e.items.hide.name")] = {
11091120
name: game.i18n.localize("enhancedcombathud-dnd5e.items.hide.name"),
11101121
type: "feat",
1111-
img: "modules/enhancedcombathud/icons/cloak-dagger.svg",
1122+
img: "modules/enhancedcombathud/icons/cloak-dagger.webp",
11121123
system: {
11131124
description: {
11141125
value: game.i18n.localize("enhancedcombathud-dnd5e.items.hide.desc"),
@@ -1180,7 +1191,7 @@ function registerItems() {
11801191
startTime: null,
11811192
turns: 10,
11821193
},
1183-
icon: "modules/enhancedcombathud/icons/cloak-dagger.svg",
1194+
icon: "modules/enhancedcombathud/icons/cloak-dagger.webp",
11841195
label: "Hide",
11851196
transfer: false,
11861197
flags: {
@@ -1204,7 +1215,7 @@ function registerItems() {
12041215
ECHItems[game.i18n.localize("enhancedcombathud-dnd5e.items.dash.name")] = {
12051216
name: game.i18n.localize("enhancedcombathud-dnd5e.items.dash.name"),
12061217
type: "feat",
1207-
img: "modules/enhancedcombathud/icons/walking-boot.svg",
1218+
img: "modules/enhancedcombathud/icons/walking-boot.webp",
12081219
system: {
12091220
description: {
12101221
value: game.i18n.localize("enhancedcombathud-dnd5e.items.dash.desc"),
@@ -1272,7 +1283,7 @@ function registerItems() {
12721283
startTime: null,
12731284
rounds: 1,
12741285
},
1275-
icon: "modules/enhancedcombathud/icons/walking-boot.svg",
1286+
icon: "modules/enhancedcombathud/icons/walking-boot.webp",
12761287
label: "Dash",
12771288
transfer: false,
12781289
flags: {
@@ -1288,7 +1299,6 @@ function registerItems() {
12881299
],
12891300
sort: 0,
12901301
flags: {
1291-
12921302
"midi-qol": {
12931303
onUseMacroName: "",
12941304
},
@@ -1297,7 +1307,7 @@ function registerItems() {
12971307
ECHItems[game.i18n.localize("enhancedcombathud-dnd5e.items.shove.name")] = {
12981308
name: game.i18n.localize("enhancedcombathud-dnd5e.items.shove.name"),
12991309
type: "feat",
1300-
img: "modules/enhancedcombathud/icons/shield-bash.svg",
1310+
img: "modules/enhancedcombathud/icons/shield-bash.webp",
13011311
system: {
13021312
description: {
13031313
value: game.i18n.localize("enhancedcombathud-dnd5e.items.shove.desc"),
@@ -1359,7 +1369,6 @@ function registerItems() {
13591369
effects: [],
13601370
sort: 0,
13611371
flags: {
1362-
13631372
"midi-qol": {
13641373
onUseMacroName: "",
13651374
},
@@ -1371,4 +1380,4 @@ function registerItems() {
13711380
delete ECHItems[key].effects;
13721381
}
13731382
}
1374-
}
1383+
}

0 commit comments

Comments
 (0)