diff --git a/CHANGELOG.md b/CHANGELOG.md index fd2d26b..a52d9f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## Version 12.04 + +Fix issue with code to fix a DSD issue. + +Fixed issue with strange repositioning bug. + +Attempting to cut down on the number of people having issues while using an older version of D&D. + ## Version 12.03 Tried to fix the issue with Dice So Nice not revealing roll. diff --git a/apps/tokenbar.js b/apps/tokenbar.js index 8e47424..c3fdca4 100644 --- a/apps/tokenbar.js +++ b/apps/tokenbar.js @@ -159,15 +159,6 @@ export class TokenBar extends Application { game.user.setFlag("monks-tokenbar", "position", this.pos); } - let checkLeft = Math.clamp(this.pos.left, 0, window.innerWidth - 200); - let checkTop = Math.clamp(this.pos.top, 0, window.innerHeight - 20); - - if (checkLeft != this.pos.left || checkTop != this.pos.top) { - this.pos.left = checkLeft; - this.pos.top = checkTop; - game.user.setFlag("monks-tokenbar", "position", this.pos); - } - let result = ''; if (this.pos != undefined) { result = Object.entries(this.pos).filter(k => { @@ -494,7 +485,7 @@ export class TokenBar extends Application { super.activateListeners(html); if (game.user.isGM) { - for (let group of this.buttons) { + for (let group of (this.buttons || [])) { for (let button of group) { if (button.click) $('#' + button.id).on('click', $.proxy(button.click, this)); @@ -573,9 +564,6 @@ export class TokenBar extends Application { //else position.left = xPos;// + 1; - position.left = Math.clamp(position.left, 0, window.innerWidth - 200); - position.top = Math.clamp(position.top, 0, window.innerHeight - 20); - elmnt.style.bottom = (position.bottom ? position.bottom + "px" : null); elmnt.style.right = (position.right ? position.right + "px" : null); diff --git a/module.json b/module.json index 8fb7a0f..3f2bca4 100644 --- a/module.json +++ b/module.json @@ -1,7 +1,7 @@ { "title": "Monk's TokenBar", "description": "Add a bar with all the current player tokens. Limit movement, roll saving throws, assign XP.", - "version": "12.03", + "version": "12.04", "authors": [ { "name": "IronMonk", @@ -82,7 +82,7 @@ "css/tokenbar.css" ], "url": "https://github.com/ironmonk88/monks-tokenbar", - "download": "https://github.com/ironmonk88/monks-tokenbar/archive/12.03.zip", + "download": "https://github.com/ironmonk88/monks-tokenbar/archive/12.04.zip", "manifest": "https://github.com/ironmonk88/monks-tokenbar/releases/latest/download/module.json", "bugs": "https://github.com/ironmonk88/monks-tokenbar/issues", "id": "monks-tokenbar", diff --git a/monks-tokenbar.js b/monks-tokenbar.js index 3709db6..9efb393 100644 --- a/monks-tokenbar.js +++ b/monks-tokenbar.js @@ -303,11 +303,11 @@ export class MonksTokenBar { } } else { if (game.system.id == "burningwheel") { - const a = RegExp.escape(Handlebars.escapeExpression(choices)) - , s = new RegExp(` value=["']${a}["']`); - return options.fn(this).replace(s, "$& selected") - } else - Object.entries(choices).forEach(e => option(...e)); + const a = RegExp.escape(Handlebars.escapeExpression(choices)) + , s = new RegExp(` value=["']${a}["']`); + return options.fn(this).replace(s, "$& selected") + } else + Object.entries(choices).forEach(e => option(...e)); } return new Handlebars.SafeString(html); } @@ -1866,7 +1866,7 @@ Hooks.on("updateUser", (user, data, options, userId) => { Hooks.on("diceSoNiceRollComplete", (messageid) => { if (game.user.isGM) { let message = game.messages.find(m => m.id == messageid); - if (message != undefined && message.hasFlag("monks-tokenbar")) { + if (message != undefined) { let flags = {}; for (let key of Object.keys(foundry.utils.getProperty(message, "flags.monks-tokenbar") || {})) { if (key.startsWith('token')) { diff --git a/systems/dnd5e-rolls.js b/systems/dnd5e-rolls.js index 12c6176..65751e3 100644 --- a/systems/dnd5e-rolls.js +++ b/systems/dnd5e-rolls.js @@ -66,6 +66,8 @@ export class DnD5eRolls extends BaseRolls { } get showXP() { + if (!foundry.utils.isNewerVersion(game.system.version, "4.0")) + return !game.settings.get('dnd5e', 'disableExperienceTracking'); return game.settings.get('dnd5e', 'levelingMode') != "noxp"; }