diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ca0ef09..d0e1434 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -73,3 +73,5 @@ v1.6.5 Bug fix for item import from compendiums v1.6.6 Add tooltips to traumas, bug fixes for tooltips v1.6.7 ALL THE TOOLTIPS, fixes for tooltips in dialogs, fix for class icon changes not persisting + +v1.6.8 Fixes for clock HUDs diff --git a/module/sav-clock-sheet.js b/module/sav-clock-sheet.js index 4520039..14ffb22 100644 --- a/module/sav-clock-sheet.js +++ b/module/sav-clock-sheet.js @@ -227,7 +227,7 @@ export default { newClock = oldClock.cycleSize(); } else if (target.classList.contains("cycle-theme")) { newClock = oldClock.cycleTheme(); - } else if (target.classList.contains("config")) { + } else if (target.dataset.action) { return; } else { return error("ERROR: Unknown TokenHUD Button"); @@ -307,7 +307,7 @@ export default { newClock = oldClock.increment(); } else if (target.classList.contains("progress-down")) { newClock = oldClock.decrement(); - } else if (target.classList.contains("visibility")) { + } else if (target.dataset.action) { return; } else { return error("ERROR: Unknown TokenHUD Button"); diff --git a/module/sav-clock-tiles.js b/module/sav-clock-tiles.js index a8acdeb..aa46ab5 100644 --- a/module/sav-clock-tiles.js +++ b/module/sav-clock-tiles.js @@ -52,10 +52,21 @@ export default { }); }, - renderTileHUD: async (_hud, html, tile) => { + renderTileHUD: async (_hud, html, tileData) => { log("Render") - let t = canvas.tiles.get(tile._id); - if (!t.data.flags['scum-and-villainy'].clocks) { + let t, b, f; + if( game.majorVersion > 7 ) { + b = canvas.background.tiles.find( tile => tile.id === tileData._id ); + f = canvas.foreground.tiles.find( tile => tile.id === tileData._id ); + if( b?.id === tileData._id ) { + t = b; + } else if ( f?.id === tileData._id ) { + t = f; + } else { return false } + } else { + t = canvas.tiles.get( tileData._id ); + } + if (!t?.data?.flags['scum-and-villainy']?.clocks) { return; } @@ -63,7 +74,17 @@ export default { html.find("div.left").append(buttonHTML).click(async (event) => { log("HUD Clicked") // re-get in case there has been an update - t = canvas.tiles.get(tile._id); + if( game.majorVersion > 7 ) { + b = canvas.background.tiles.find( tile => tile.id === tileData._id ); + f = canvas.foreground.tiles.find( tile => tile.id === tileData._id ); + if( b?.id === tileData._id ) { + t = b; + } else if ( f?.id === tileData._id ) { + t = f; + } + } else { + t = canvas.tiles.get(tileData._id); + } const oldClock = new SaVClock(t.data.flags['scum-and-villainy'].clocks); let newClock; @@ -79,9 +100,12 @@ export default { newClock = oldClock.increment(); } else if (target.classList.contains("progress-down")) { newClock = oldClock.decrement(); + } else if (target.dataset.action) { + return; } else { - return error("ERROR: Unknown TileHUD Button"); + return error("ERROR: Unknown TileHUD Button"); } + if( game.majorVersion > 7 ) { await TileDocument.updateDocuments([{ _id: t.id, diff --git a/system.json b/system.json index 9b62934..8ce6a19 100644 --- a/system.json +++ b/system.json @@ -5,14 +5,14 @@ "authors": ["megastruktur", "Andrew Garinger [agaringer#6498]"], "url": "https://github.com/drewg13/foundryvtt-scum-and-villainy/", "flags": {}, - "version": "1.6.7", + "version": "1.6.8", "minimumCoreVersion": "0.7.2", "compatibleCoreVersion": "0.8.6", "system": [], "dependencies": [], "socket": false, "manifest": "https://raw.githubusercontent.com/drewg13/foundryvtt-scum-and-villainy/master/system.json", - "download": "https://github.com/drewg13/foundryvtt-scum-and-villainy/archive/v1.6.7.zip", + "download": "https://github.com/drewg13/foundryvtt-scum-and-villainy/archive/v1.6.8.zip", "protected": false, "scripts": [], "esmodules": [