Skip to content

Commit

Permalink
Make things a little more consistent across the board and update the …
Browse files Browse the repository at this point in the history
…name of the macro function
  • Loading branch information
Veilza committed Aug 8, 2024
1 parent 78d2ecc commit 45b6a25
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 72 deletions.
11 changes: 2 additions & 9 deletions system/actor/ghoul-actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
}

Expand Down
5 changes: 2 additions & 3 deletions system/actor/group-actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
12 changes: 3 additions & 9 deletions system/actor/hunter-actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
}

Expand Down
10 changes: 2 additions & 8 deletions system/actor/mortal-actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}]
})
}

Expand Down
10 changes: 3 additions & 7 deletions system/actor/spc-actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}

Expand Down
12 changes: 3 additions & 9 deletions system/actor/vampire-actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
}

Expand Down
12 changes: 3 additions & 9 deletions system/actor/werewolf-actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
}

Expand Down
23 changes: 23 additions & 0 deletions system/actor/wod-v5-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
39 changes: 21 additions & 18 deletions system/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
}

/**
Expand Down

0 comments on commit 45b6a25

Please sign in to comment.