62 lines
1.3 KiB
JavaScript

export const CONST = {
SWADE: null,
FOUNDRY: null
}
export class shim {
static get folders () {
return game.folders
}
static get controlled () {
return canvas.tokens.controlled
}
static get targets () {
return game.user.targets
}
static get notifications () {
return ui.notifications
}
static get user () {
return game.user
}
static createEffectDocument (icon, name, durationRounds) {
return {
icon,
name,
duration: { rounds: durationRounds },
flags: {
swade: {
expiration: CONST.SWADE.STATUS_EFFECT_EXPIRATION.EndOfTurnPrompt
}
}
}
}
static async applyActiveEffects (token, effectDocuments) {
const mutation = {
embedded: { ActiveEffect: {} }
}
const mutateOptions = {
permanent: true,
description: effectDocuments[effectDocuments.length - 1]
}
for (const effectDocument of effectDocuments) {
mutation.embedded.ActiveEffect[effectDocument.name] = effectDocument
}
await warpgate.mutate(token.document, mutation, {}, mutateOptions)
}
static warpgateMenu (menuData, menuOptions) {
return warpgate.menu(menuData, menuOptions)
}
}
export function log (...args) {
console.log('SWADE MB HELPERS |', ...args)
}