- Macro: Request fear check specialization macro
- Macro: Fear Table to call the new fearTable api endpoint
- API: rulesVersion property
- API: fearTable(actor) calls the relevant premium core rules module's fear
table
- API: added requestFearRollFromTokens special helper
- Trait roll hooks for:
- Glow/Shroud
- Range modifiers
- added a summary chat message for the roll results to requested rolls.
- added a target number option to requested rolls.
91 lines
2.8 KiB
JavaScript
91 lines
2.8 KiB
JavaScript
import { api } from './api.js'
|
|
import { requestTokenRoll } from './helpers.js'
|
|
import { preDamageRollModifiers, preTraitRollModifiers } from './rollHelpers.js'
|
|
import { shapeChangeOnDismiss } from './powerEffects.js'
|
|
import { log, shim } from './shim.js'
|
|
|
|
const moduleName = 'swade-mb-helpers'
|
|
|
|
function _checkModule (name) {
|
|
if (!game.modules.get(name)?.active && game.user.isGM) {
|
|
let action = 'install and activate'
|
|
if (game.modules.get(name)) action = 'activate'
|
|
ui.notifications.error(
|
|
`SWADE MB Helpers requires the ${name} module. Please ${action} it.`)
|
|
}
|
|
}
|
|
|
|
Hooks.on('setup', api.registerFunctions)
|
|
|
|
Hooks.on('init', () => {
|
|
log('INIT VISION')
|
|
CONFIG.Canvas.visionModes.basic = new VisionMode({
|
|
id: 'basic',
|
|
label: 'VISION.ModeBasicVision',
|
|
canvas: {
|
|
shader: ColorAdjustmentsSamplerShader,
|
|
uniforms: { contrast: 0, saturation: -0.85, brightness: -1.0 }
|
|
},
|
|
lighting: {
|
|
background: { visibility: VisionMode.LIGHTING_VISIBILITY.REQUIRED }
|
|
},
|
|
vision: {
|
|
darkness: { adaptive: false },
|
|
defaults: { attenuation: 0, contrast: 0, saturation: -0.85, brightness: -1.0 },
|
|
preferred: true
|
|
}
|
|
})
|
|
CONFIG.Canvas.visionModes.darkvision = new VisionMode({
|
|
id: 'darkvision',
|
|
label: 'VISION.ModeDarkvision',
|
|
canvas: {
|
|
shader: ColorAdjustmentsSamplerShader,
|
|
uniforms: { contrast: 0, saturation: 0, brightness: 0.75, tint: [0.8, 0.8, 1.0] }
|
|
},
|
|
lighting: {
|
|
background: { visibility: VisionMode.LIGHTING_VISIBILITY.REQUIRED },
|
|
levels: {
|
|
[VisionMode.LIGHTING_LEVELS.DIM]: VisionMode.LIGHTING_LEVELS.BRIGHT
|
|
}
|
|
},
|
|
vision: {
|
|
darkness: { adaptive: false },
|
|
defaults: { attenuation: 0.1, contrast: 0, saturation: 0, brightness: 0.75 },
|
|
preferred: false
|
|
}
|
|
})
|
|
CONFIG.Canvas.visionModes.lowlight = new VisionMode({
|
|
id: 'lowlight',
|
|
label: 'Low Light Vision',
|
|
canvas: {
|
|
shader: ColorAdjustmentsSamplerShader,
|
|
uniforms: { contrast: 0, saturation: -0.5, brightness: -0.2 }
|
|
},
|
|
lighting: {
|
|
background: { visibility: VisionMode.LIGHTING_VISIBILITY.REQUIRED }
|
|
},
|
|
vision: {
|
|
darkness: { adaptive: false },
|
|
defaults: { attenuation: 0.1, contrast: 0, saturation: -0.5, brightness: -0.2 },
|
|
preferred: false
|
|
}
|
|
})
|
|
})
|
|
|
|
Hooks.on('swadePreRollAttribute', preTraitRollModifiers)
|
|
Hooks.on('swadePreRollSkill', preTraitRollModifiers)
|
|
Hooks.on('swadeRollDamage', preDamageRollModifiers)
|
|
|
|
Hooks.on('ready', () => {
|
|
_checkModule('warpgate')
|
|
_checkModule('socketlib')
|
|
log('Initialized SWADE MB Helpers')
|
|
warpgate.event.watch(warpgate.EVENT.DISMISS, shapeChangeOnDismiss)
|
|
})
|
|
|
|
Hooks.on('socketlib.ready', () => {
|
|
const socket = socketlib.registerModule('swade-mb-helpers')
|
|
socket.register('requestTokenRoll', requestTokenRoll)
|
|
shim._socket = socket
|
|
})
|