From 45b6a251ca954cae2a099b151bee14cdf21d7f91 Mon Sep 17 00:00:00 2001 From: Veilza Date: Wed, 7 Aug 2024 23:50:45 -0500 Subject: [PATCH] Make things a little more consistent across the board and update the name of the macro function --- system/actor/ghoul-actor-sheet.js | 11 ++------ system/actor/group-actor-sheet.js | 5 ++-- system/actor/hunter-actor-sheet.js | 12 +++------ system/actor/mortal-actor-sheet.js | 10 ++----- system/actor/spc-actor-sheet.js | 10 +++---- system/actor/vampire-actor-sheet.js | 12 +++------ system/actor/werewolf-actor-sheet.js | 12 +++------ system/actor/wod-v5-sheet.js | 23 ++++++++++++++++ system/main.js | 39 +++++++++++++++------------- 9 files changed, 62 insertions(+), 72 deletions(-) diff --git a/system/actor/ghoul-actor-sheet.js b/system/actor/ghoul-actor-sheet.js index 03386d94..1425de9e 100644 --- a/system/actor/ghoul-actor-sheet.js +++ b/system/actor/ghoul-actor-sheet.js @@ -13,18 +13,11 @@ export class GhoulActorSheet extends MortalActorSheet { /** @override */ static get defaultOptions () { // Define the base list of CSS classes - const classList = ['wod5e', 'sheet', 'actor', 'ghoul-sheet', 'vampire'] + const classList = ['ghoul-sheet', 'vampire'] return foundry.utils.mergeObject(super.defaultOptions, { classes: classList, - template: 'systems/vtm5e/display/vtm/actors/ghoul-sheet.hbs', - width: 1000, - height: 700, - tabs: [{ - navSelector: '.sheet-tabs', - contentSelector: '.sheet-body', - initial: 'stats' - }] + template: 'systems/vtm5e/display/vtm/actors/ghoul-sheet.hbs' }) } diff --git a/system/actor/group-actor-sheet.js b/system/actor/group-actor-sheet.js index 3bf56edb..69f0e5a9 100644 --- a/system/actor/group-actor-sheet.js +++ b/system/actor/group-actor-sheet.js @@ -11,12 +11,11 @@ export class GroupActorSheet extends WoDActor { /** @override */ static get defaultOptions () { // Define the base list of CSS classes - const classList = ['wod5e', 'sheet', 'actor', 'group-sheet'] + const classList = ['group-sheet'] + classList.push(...super.defaultOptions.classes) return foundry.utils.mergeObject(super.defaultOptions, { classes: classList, - width: 700, - height: 700, tabs: [{ navSelector: '.sheet-tabs', contentSelector: '.sheet-body', diff --git a/system/actor/hunter-actor-sheet.js b/system/actor/hunter-actor-sheet.js index 176cb9ed..c99885a0 100644 --- a/system/actor/hunter-actor-sheet.js +++ b/system/actor/hunter-actor-sheet.js @@ -13,18 +13,12 @@ export class HunterActorSheet extends WoDActor { /** @override */ static get defaultOptions () { // Define the base list of CSS classes - const classList = ['wod5e', 'sheet', 'actor', 'hunter-sheet', 'hunter'] + const classList = ['hunter-sheet', 'hunter'] + classList.push(...super.defaultOptions.classes) return foundry.utils.mergeObject(super.defaultOptions, { classes: classList, - template: 'systems/vtm5e/display/htr/actors/hunter-sheet.hbs', - width: 1000, - height: 700, - tabs: [{ - navSelector: '.sheet-tabs', - contentSelector: '.sheet-body', - initial: 'stats' - }] + template: 'systems/vtm5e/display/htr/actors/hunter-sheet.hbs' }) } diff --git a/system/actor/mortal-actor-sheet.js b/system/actor/mortal-actor-sheet.js index be920f14..2afb360e 100644 --- a/system/actor/mortal-actor-sheet.js +++ b/system/actor/mortal-actor-sheet.js @@ -12,18 +12,12 @@ export class MortalActorSheet extends WoDActor { /** @override */ static get defaultOptions () { // Define the base list of CSS classes - const classList = ['wod5e', 'sheet', 'actor', 'mortal-sheet', 'mortal'] + const classList = ['mortal-sheet', 'mortal'] + classList.push(...super.defaultOptions.classes) return foundry.utils.mergeObject(super.defaultOptions, { classes: classList, template: 'systems/vtm5e/display/shared/actors/mortal-sheet.hbs', - width: 1000, - height: 700, - tabs: [{ - navSelector: '.sheet-tabs', - contentSelector: '.sheet-body', - initial: 'stats' - }] }) } diff --git a/system/actor/spc-actor-sheet.js b/system/actor/spc-actor-sheet.js index 0b550c9f..27ae0c97 100644 --- a/system/actor/spc-actor-sheet.js +++ b/system/actor/spc-actor-sheet.js @@ -12,18 +12,14 @@ export class SPCActorSheet extends WoDActor { /** @override */ static get defaultOptions () { // Define the base list of CSS classes - const classList = ['wod5e', 'sheet', 'actor', 'spc-sheet'] + const classList = ['spc-sheet'] + classList.push(...super.defaultOptions.classes) return foundry.utils.mergeObject(super.defaultOptions, { classes: classList, template: 'systems/vtm5e/display/shared/actors/spc-sheet.hbs', width: 850, - height: 500, - tabs: [{ - navSelector: '.sheet-tabs', - contentSelector: '.sheet-body', - initial: 'stats' - }] + height: 500 }) } diff --git a/system/actor/vampire-actor-sheet.js b/system/actor/vampire-actor-sheet.js index 00ad3db3..954cc474 100644 --- a/system/actor/vampire-actor-sheet.js +++ b/system/actor/vampire-actor-sheet.js @@ -13,18 +13,12 @@ export class VampireActorSheet extends GhoulActorSheet { /** @override */ static get defaultOptions () { // Define the base list of CSS classes - const classList = ['wod5e', 'sheet', 'actor', 'vampire-sheet', 'vampire'] + const classList = ['vampire-sheet'] + classList.push(...super.defaultOptions.classes) return foundry.utils.mergeObject(super.defaultOptions, { classes: classList, - template: 'systems/vtm5e/display/vtm/actors/vampire-sheet.hbs', - width: 1000, - height: 700, - tabs: [{ - navSelector: '.sheet-tabs', - contentSelector: '.sheet-body', - initial: 'stats' - }] + template: 'systems/vtm5e/display/vtm/actors/vampire-sheet.hbs' }) } diff --git a/system/actor/werewolf-actor-sheet.js b/system/actor/werewolf-actor-sheet.js index 83f788ff..bd78bbed 100644 --- a/system/actor/werewolf-actor-sheet.js +++ b/system/actor/werewolf-actor-sheet.js @@ -13,18 +13,12 @@ export class WerewolfActorSheet extends WoDActor { /** @override */ static get defaultOptions () { // Define the base list of CSS classes - const classList = ['wod5e', 'actor', 'sheet', 'werewolf-sheet', 'werewolf'] + const classList = ['werewolf-sheet', 'werewolf'] + classList.push(...super.defaultOptions.classes) return foundry.utils.mergeObject(super.defaultOptions, { classes: classList, - template: 'systems/vtm5e/display/wta/actors/werewolf-sheet.hbs', - width: 1000, - height: 700, - tabs: [{ - navSelector: '.sheet-tabs', - contentSelector: '.sheet-body', - initial: 'stats' - }] + template: 'systems/vtm5e/display/wta/actors/werewolf-sheet.hbs' }) } diff --git a/system/actor/wod-v5-sheet.js b/system/actor/wod-v5-sheet.js index f10fb88d..319417d6 100644 --- a/system/actor/wod-v5-sheet.js +++ b/system/actor/wod-v5-sheet.js @@ -12,6 +12,27 @@ import { WOD5eDice } from '../scripts/system-rolls.js' * @extends {ActorSheet} */ export class WoDActor extends ActorSheet { + /** @override */ + static get defaultOptions () { + // Define the base list of CSS classes + const classList = ['wod5e', 'sheet', 'actor'] + + return foundry.utils.mergeObject(super.defaultOptions, { + classes: classList, + width: 1000, + height: 700, + tabs: [{ + navSelector: '.sheet-tabs', + contentSelector: '.sheet-body', + initial: 'stats' + }], + dragDrop: [{ + dragSelector: '.item', + dropSelector: null + }] + }) + } + /** @override */ async _render (...args) { // Override _render so that we can save and restore the scroll position during rendering @@ -560,6 +581,8 @@ export class WoDActor extends ActorSheet { itemName = game.i18n.format('WOD5E.WTA.NewStringGift', { string: itemName }) } break + case 'edgepool': + itemName = game.i18n.format('WOD5E.HTR.NewStringEdgePool', { string: itemName }) case 'feature': selectLabel = game.i18n.localize('WOD5E.ItemsList.SelectFeature') itemOptions = WOD5E.Features.getList() diff --git a/system/main.js b/system/main.js index 0f16acb2..1ded4749 100644 --- a/system/main.js +++ b/system/main.js @@ -127,7 +127,7 @@ Hooks.once('ready', async function () { } // Wait to register hotbar drop hook on ready so that modules could register earlier if they want to - Hooks.on('hotbarDrop', (bar, data, slot) => createVampireMacro(data, slot)) + Hooks.on('hotbarDrop', (bar, data, slot) => createRollableMacro(data, slot)) // Migration functions migrateWorld() @@ -187,25 +187,28 @@ Hooks.on('getChatLogEntryContext', (html, options) => { * @param {number} slot The hotbar slot to use * @returns {Promise} */ -async function createVampireMacro (data, slot) { +async function createRollableMacro (data, slot) { if (data.type !== 'Item') return - if (!('data' in data)) return ui.notifications.warn('You can only create macro buttons for owned Items') - const item = data.system - - // Create the macro command - const command = `game.WOD5E.RollListItemMacro("${item.name}")` - let macro = game.macros.entities.find(m => (m.name === item.name) && (m.command === command)) - if (!macro) { - macro = await Macro.create({ - name: item.name, - type: 'script', - img: item.img, - command, - flags: { 'vtm5e.itemMacro': true } - }) + + // Create a rollable macro for this item + if (data.system.rollable) { + const item = data.system + + // Create the macro command + const command = `game.WOD5E.RollListItemMacro("${item.name}")` + let macro = game.macros.entities.find(m => (m.name === item.name) && (m.command === command)) + if (!macro) { + macro = await Macro.create({ + name: item.name, + type: 'script', + img: item.img, + command, + flags: { 'vtm5e.itemMacro': true } + }) + } + game.user.assignHotbarMacro(macro, slot) + return false } - game.user.assignHotbarMacro(macro, slot) - return false } /**