Skip to content

Commit

Permalink
11.03 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ironmonk88 committed Aug 21, 2023
1 parent 4bfa2e9 commit f2d89bf
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Version 11.03

Updated combat view to alter the view field to include targeted tokens.

Cleaned up warning associated with changes made to Combat Details.

# Version 11.02

Fixed issue where a blank setting wasn't defaulting the icon properly.
Expand Down
4 changes: 4 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
"MonksCommonDisplay.per-scene.hint": "Store the settings per scene so each scene can have different display",
"MonksCommonDisplay.hide-ui.name": "Hide UI",
"MonksCommonDisplay.hide-ui.hint": "Hide the UI for the common display",
"MonksCommonDisplay.focus-padding.name": "Focus Padding",
"MonksCommonDisplay.focus-padding.hint": "Padding around the focused token",
"MonksCommonDisplay.show-vertical.name": "Show Vertical",
"MonksCommonDisplay.show-vertical.hint": "Show common display interface vertically",

"MonksCommonDisplay.change-settings": "Change Settings",
"MonksCommonDisplay.mirror-screen": "Mirror Screen",
Expand Down
4 changes: 2 additions & 2 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Monk's Common Display",
"description": "Set up a display without all the ui so that it can be displayed on an alternate screen",
"version": "11.02",
"version": "11.03",
"socket": true,
"authors": [
{
Expand Down Expand Up @@ -29,7 +29,7 @@
"css/monks-common-display.css"
],
"url": "https://github.com/ironmonk88/monks-common-display",
"download": "https://github.com/ironmonk88/monks-common-display/archive/11.02.zip",
"download": "https://github.com/ironmonk88/monks-common-display/archive/11.03.zip",
"manifest": "https://github.com/ironmonk88/monks-common-display/releases/latest/download/module.json",
"bugs": "https://github.com/ironmonk88/monks-common-display/issues",
"allowBugReporter": true,
Expand Down
31 changes: 22 additions & 9 deletions monks-common-display.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ export let i18n = key => {
export let setting = key => {
return game.settings.get("monks-common-display", key);
};
export let combatposition = () => {
return game.settings.get("monks-common-display", "combat-position");
};

export let patchFunc = (prop, func, type = "WRAPPER") => {
if (game.modules.get("lib-wrapper")?.active) {
Expand Down Expand Up @@ -310,10 +307,13 @@ export class MonksCommonDisplay {
if (setting("show-toolbar") && game.user.isGM)
MonksCommonDisplay.toolbar = new CommonToolbar().render(true);

let oldDragMouseUp = Draggable.prototype._onDragMouseUp;
Draggable.prototype._onDragMouseUp = function (event) {
Hooks.call(`dragEnd${this.app.constructor.name}`, this.app);
return oldDragMouseUp.call(this, event);
if (!game.modules.get('monks-combat-details')?.active && !game.modules.get('monks-enhanced-journal')?.active) {
patchFunc("Draggable.prototype._onDragMouseUp", async function (wrapped, ...args) {
for (const cls of this.app.constructor._getInheritanceChain()) {
Hooks.callAll(`dragEnd${cls.name}`, this.app, this.app.position);
}
return wrapped(...args);
});
}
}

Expand Down Expand Up @@ -587,8 +587,10 @@ export class MonksCommonDisplay {
}

static getTokens(value) {
if (value == "combat" && game.combats.active && game.combats.active.started && game.combats.active.combatant?.token && !game.combats.active.combatant?.token.hidden)
return [game.combats.active.combatant?.token];
if (value == "combat" && game.combats.active && game.combats.active.started && game.combats.active.combatant?.token && !game.combats.active.combatant?.token.hidden) {
let targets = Array.from(game.user.targets).map(t => t.document);
return [game.combats.active.combatant?.token, ...targets];
}

if (value == "party")
return canvas.scene.tokens.filter(t => t.testUserPermission(game.user, "LIMITED") && !t.hidden && !MonksCommonDisplay.isDefeated(t));
Expand Down Expand Up @@ -844,3 +846,14 @@ Hooks.on("updateCombat", async function (combat, delta) {
}
}
});

Hooks.on("targetToken", async function (user, token, targeted) {
if (game.combats.viewed.started &&
game.combats.viewed.active &&
MonksCommonDisplay.screenValue == "combat")
{
window.setTimeout(() => {
MonksCommonDisplay.changeScreen();
}, 100);
}
});
8 changes: 4 additions & 4 deletions settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export const registerSettings = function () {
});

game.settings.register(modulename, "focus-padding", {
name: game.i18n.localize("MonksTokenBar.focus-padding.name"),
hint: game.i18n.localize("MonksTokenBar.focus-padding.hint"),
name: i18n("MonksCommonDisplay.focus-padding.name"),
hint: i18n("MonksCommonDisplay.focus-padding.hint"),
scope: "world",
config: true,
range: {
Expand Down Expand Up @@ -164,8 +164,8 @@ export const registerSettings = function () {
});

game.settings.register(modulename, "show-vertical", {
name: game.i18n.localize("MonksTokenBar.show-vertical.name"),
hint: game.i18n.localize("MonksTokenBar.show-vertical.hint"),
name: i18n("MonksCommonDisplay.show-vertical.name"),
hint: i18n("MonksCommonDisplay.show-vertical.hint"),
scope: "world",
config: false,
default: false,
Expand Down

0 comments on commit f2d89bf

Please sign in to comment.