From 8983aa83046c100659910dff327a28c21b3223e7 Mon Sep 17 00:00:00 2001 From: ironmonk88 <75920956+ironmonk88@users.noreply.github.com> Date: Sun, 14 May 2023 10:32:55 -0700 Subject: [PATCH] 10.11 changes --- CHANGELOG.md | 18 +++++ apps/assignxp.js | 2 +- apps/lootables.js | 2 +- css/tokenbar.css | 141 +++++++++++++++++++++++++++++++++++++++ lang/en.json | 1 + module.json | 4 +- monks-tokenbar.js | 16 +++-- systems/coc7-rolls.js | 2 +- systems/dnd5e-rolls.js | 4 +- systems/pf2e-rolls.js | 2 +- systems/swade-rolls.js | 2 +- templates/levelup.html | 2 +- templates/lootables.html | 2 +- 13 files changed, 180 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9db34f5..e533008 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +## Version 10.11 + +Allow drag and drop of items to the assign loot dialog if there are no items there. + +Fixed issues with the configure settings when Enhanced Journal is not installed + +Use the last roll when using the key press to open the request roll dialog. + +Fixed support for changes with Active Tiles. + +Fixed issue with checking XP when there are two GMs in the game. + +Fixed issues with some systems when checking for tools, if the actor isn't allowed items. + +Fixed issue with default loot image. + +Fixed issue with group actors and assigning XP. + ## Version 10.10 Fixed issue where an alternate requested roll wasn't being reported correctly to the chat message diff --git a/apps/assignxp.js b/apps/assignxp.js index 0dbeced..17a272d 100644 --- a/apps/assignxp.js +++ b/apps/assignxp.js @@ -341,7 +341,7 @@ export class AssignXP { } await message.setFlag('monks-tokenbar', 'actors', actors); } else { - $(e.target).hide(); + //$(e.target).hide(); MonksTokenBar.emit('assignxp', { actorid: actorid, msgid: message.id }); } } diff --git a/apps/lootables.js b/apps/lootables.js index ca02e91..395c041 100644 --- a/apps/lootables.js +++ b/apps/lootables.js @@ -133,7 +133,7 @@ export class LootablesApp extends Application { template: "./modules/monks-tokenbar/templates/lootables.html", width: 500, popOut: true, - dragDrop: [{ dropSelector: ".entry-list" }], + dragDrop: [{ dropSelector: ".dialog-content" }], scrollY: [".entry-list"] }); } diff --git a/css/tokenbar.css b/css/tokenbar.css index fb8ad35..f1fd3aa 100644 --- a/css/tokenbar.css +++ b/css/tokenbar.css @@ -1261,4 +1261,145 @@ a.inline-request-roll { #assignexperience .sheet-body .items-list .item-list { height: 200px; overflow-y: auto; +} + +/* Select with Folders */ +.journal-select { + position: relative; + width: 100%; + height: 27px; + background: rgba(0, 0, 0, 0.05); + border: 1px solid #7a7971; + border-radius: 3px; + padding: 0 3px; + text-overflow: ellipsis; +} + +.journal-select:focus { + box-shadow: 0 0 5px #ff0000; + outline: none; +} + +.journal-select > div > span { + line-height: 26px !important; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + display: inline-block; +} + +.journal-select > div > i { + flex: 0 0 12px; + text-align: center; + line-height: 24px; + font-size: 11px; + color: #000; +} + +.journal-list { + display: none; + max-height: 250px; + overflow-y: auto; + margin: 0px 5px; + color: black; + position: absolute; + float: left; + left: -1px; + top: 100%; + background: url(../../../ui/parchment.jpg) repeat; + border: 1px solid #808080; + width: calc(100% + 2px); + border-bottom-right-radius: 5px; + border-bottom-left-radius: 5px; + list-style: none; + margin: 0; + padding: 0; + z-index: 100; +} + +.scene-sheet .journal-list { + max-height: 250px; +} + +.journal-select.open .journal-list, +.journal-list.open { + display: block; +} + +.journal-list .journal-item .journal-title { + padding: 4px; + cursor: pointer; + min-height: 25px; + width: 100%; + overflow-x: hidden; + white-space: nowrap; + text-overflow: ellipsis; + border-bottom: 1px solid rgba(0, 0, 0, 0.1); +} + +.journal-list .journal-item.note-item .journal-title { + padding: 1px 4px; + overflow: hidden; +} + +.journal-list .journal-item .journal-icon { + width: 30px; + height: 30px; + border-radius: 4px; + border: 2px solid #000000; + background: rgba(0, 0, 0, 0.4); + padding: 2px; + flex: 0 0 30px; +} + +.journal-list .journal-item .journal-text { + line-height: 30px; + padding-left: 4px; +} + +.journal-list .journal-item .journal-text.custom-text { + color: #333333; +} + +.journal-list .journal-item:not(.folder):hover, +.journal-list .journal-item.selected { + background-color: #1e90ff; + color: #fff; +} + +.journal-list .journal-item.folder > .journal-title { + background: rgba(0, 0, 0, 0.1); + font-weight: bold; +} + +.journal-list .journal-item.folder > .journal-title:hover { + background: rgba(0, 0, 0, 0.3); +} + +.journal-list .subfolder { + border-left: 4px solid #c0c0c0; + border-bottom: 4px solid #c0c0c0; +} + +.journal-list .subfolder .journal-item { + margin-left: 5px; +} + +.journal-list .journal-item.folder .journal-title i { + margin-right: 8px; +} + +.journal-list .journal-item.folder.collapse .journal-title i.fa-folder-open:before { + content: '\f07b'; +} + +.journal-list .journal-item.folder.collapse > ul { + display: none; +} + +.journal-select .journal-list .subfolder { + padding-left: 1px; + margin-top: 0px; + list-style-type: none; + margin-bottom: 0px; } \ No newline at end of file diff --git a/lang/en.json b/lang/en.json index ad91423..1257ee7 100644 --- a/lang/en.json +++ b/lang/en.json @@ -237,6 +237,7 @@ "MonksTokenBar.IncreaseLevel": "Increase Level", "MonksTokenBar.Creatures": "Creatures", "MonksTokenBar.Tokenbar": "Tokenbar", + "MonksTokenBar.ReadyToUpdate": "{name} has enough xp to level up!", "MonksTokenBar.None": "No one", "MonksTokenBar.GMOnly": "GM Only", diff --git a/module.json b/module.json index 8c7e0a7..bee3c58 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": "10.10", + "version": "10.11", "authors": [ { "name": "IronMonk", @@ -67,7 +67,7 @@ "css/tokenbar.css" ], "url": "https://github.com/ironmonk88/monks-tokenbar", - "download": "https://github.com/ironmonk88/monks-tokenbar/archive/10.10.zip", + "download": "https://github.com/ironmonk88/monks-tokenbar/archive/10.11.zip", "manifest": "https://github.com/ironmonk88/monks-tokenbar/releases/latest/download/module.json", "bugs": "https://github.com/ironmonk88/monks-tokenbar/issues", "allowBugReporter": true, diff --git a/monks-tokenbar.js b/monks-tokenbar.js index 95423d4..e99dd24 100644 --- a/monks-tokenbar.js +++ b/monks-tokenbar.js @@ -114,7 +114,9 @@ export class MonksTokenBar { editable: [{ key: 'KeyR', modifiers: [KeyboardManager.MODIFIER_KEYS?.ALT] }], restricted: true, onDown: (data) => { - new SavingThrowApp().render(true); + let roll = game.user.getFlag("monks-tokenbar", "lastmodeST"); + if (roll == "selfroll") roll = "blindroll"; + new SavingThrowApp(null, { rollmode: roll }).render(true); }, }); @@ -1232,7 +1234,7 @@ Hooks.on("setupTileActions", (app) => { name: "Select Entity", type: "select", subtype: "entity", - options: { showToken: true, showWithin: true, showPlayers: true, showPrevious: true }, + options: { show: ['token', 'within', 'players', 'previous'] }, restrict: (entity) => { return (entity instanceof Token); }, conditional: (app) => { return !$('input[name="data.global"]', app.element).prop('checked'); @@ -1278,7 +1280,7 @@ Hooks.on("setupTileActions", (app) => { name: "Select Entity", type: "select", subtype: "entity", - options: { showTile: false, showToken: true, showWithin: true, showPlayers: true, showPrevious: true, showTagger: true }, + options: { show: ['tile', 'token', 'within', 'players', 'previous', 'tagger'] }, restrict: (entity) => { return (entity instanceof Token); } }, { @@ -1417,7 +1419,7 @@ Hooks.on("setupTileActions", (app) => { type: "select", subtype: "entity", required: true, - options: { showTile: false, showToken: true, showWithin: true, showPlayers: true, showPrevious: true }, + options: { show: ['tile', 'token', 'within', 'players', 'previous'] }, restrict: (entity) => { return (entity instanceof Token); }, defaultType: 'tokens', placeholder: "Please select a token" @@ -1435,7 +1437,7 @@ Hooks.on("setupTileActions", (app) => { type: "select", subtype: "entity", required: true, - options: { showTile: false, showToken: true, showWithin: true, showPlayers: true }, + options: { show: ['tile', 'token', 'within', 'players'] }, restrict: (entity) => { return (entity instanceof Token); }, defaultType: 'tokens', placeholder: "Please select a token" @@ -1617,7 +1619,7 @@ Hooks.on("setupTileActions", (app) => { name: "Select Entity", type: "select", subtype: "entity", - options: { showTile: false, showToken: true, showWithin: true, showPlayers: true, showPrevious: true }, + options: { show: ['tile', 'token', 'within', 'players', 'previous'] }, restrict: (entity) => { return (entity instanceof Token); } }, { @@ -1700,7 +1702,7 @@ Hooks.on("preUpdateChatMessage", (message, data, dif, userId) => { }); Hooks.on("updateActor", (actor, data, dif, userId) => { - if (getProperty(data, "system.details.xp") != undefined) { + if (getProperty(data, "system.details.xp") != undefined && game.user.isTheGM) { MonksTokenBar.system.checkXP(actor); } }); diff --git a/systems/coc7-rolls.js b/systems/coc7-rolls.js index 03d43c9..b344209 100644 --- a/systems/coc7-rolls.js +++ b/systems/coc7-rolls.js @@ -56,7 +56,7 @@ export class CoC7Rolls extends BaseRolls { dynamicRequest(entries) { let skills = {}; for (let entry of entries) { - for (let item of entry.token.actor?.items) { + for (let item of (entry.token.actor?.items || [])) { if (item.type == 'skill') { let sourceID = item.getFlag("core", "sourceId") || MonksTokenBar.slugify(item.name); if (skills[sourceID] == undefined) { diff --git a/systems/dnd5e-rolls.js b/systems/dnd5e-rolls.js index 223d99c..33f5f0c 100644 --- a/systems/dnd5e-rolls.js +++ b/systems/dnd5e-rolls.js @@ -66,7 +66,7 @@ export class DnD5eRolls extends BaseRolls { } getXP(actor) { - return actor?.system.details.xp; + return actor?.system?.details?.xp || 0; } calcXP(actors, monsters) { @@ -116,7 +116,7 @@ export class DnD5eRolls extends BaseRolls { let tools = {}; for (let entry of entries) { - for (let item of entry.token.actor?.items) { + for (let item of (entry.token.actor?.items || [])) { if (item.type == 'tool') { let sourceID = item.getFlag("core", "sourceId") || MonksTokenBar.slugify(item.name); if (tools[sourceID] == undefined) { diff --git a/systems/pf2e-rolls.js b/systems/pf2e-rolls.js index bd84249..bd5e28d 100644 --- a/systems/pf2e-rolls.js +++ b/systems/pf2e-rolls.js @@ -59,7 +59,7 @@ export class PF2eRolls extends BaseRolls { let lore = {}; //get the first token's tools for (let entry of entries) { - for (let item of entry.token.actor?.items) { + for (let item of (entry.token.actor?.items || [])) { if (item.type == 'lore') { let sourceID = MonksTokenBar.slugify(item.name); if (lore[sourceID] == undefined) { diff --git a/systems/swade-rolls.js b/systems/swade-rolls.js index cfcd5c4..2d408f9 100644 --- a/systems/swade-rolls.js +++ b/systems/swade-rolls.js @@ -55,7 +55,7 @@ export class SwadeRolls extends BaseRolls { dynamicRequest(entries) { let skills = {}; for (let entry of entries) { - for (let item of entry.token.actor?.items) { + for (let item of (entry.token.actor?.items || [])) { if (item.type == 'skill') { let sourceID = MonksTokenBar.slugify(item.name); if (skills[sourceID] == undefined) { diff --git a/templates/levelup.html b/templates/levelup.html index e19219f..8041a8d 100644 --- a/templates/levelup.html +++ b/templates/levelup.html @@ -1,6 +1,6 @@