Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Latest commit

 

History

History
1008 lines (726 loc) · 30.1 KB

API.md

File metadata and controls

1008 lines (726 loc) · 30.1 KB

Classes

CombatTrack

Attach a track or playlist to combat encounters that plays when the combat begins

CombatTrackForm

A FormApplication for managing the combat's track

HypeTrackActorForm

A FormApplication for setting the Actor's Hype Track

ItemTrack

Attach a track to an item that plays when the item is rolled

ItemTrackForm

A FormApplication for managing the item's track

Conductor

Orchestrates (pun) module functionality

Functions

_checkForHypeTracksPlaylist()

Checks for the presence of the Hype Tracks playlist, creates one if none exist

_createHypeTracksPlaylist()

Create the Hype Tracks playlist if the create param is true

_processHype(combat, update)

Checks for the existence of the Hype Track actor flag, then plays the track

_resumeOthers()

Resumes previously paused sounds

_getActorHypeTrack(actor)

Get the Hype Track flag if it exists on an actor

_setActorHypeTrack(trackId)

Sets the Hype Track

_getActorHypeFlags(actor)Object

Gets the Hype Flags

_setActorHypeFlags(trackId)

Sets the Hype Flags

_addHypeButton(app, html, data)

Adds a button to the Actor sheet to open the Hype Track form

_openTrackForm(actor, track, options)

Opens the Hype Track form

playHype(actor)

Plays a hype track for the provided actor

_migratePlaylistMode()
_migrateActorFlags()
_migrateItemFlags()
_migrateActorOwnedItemFlags()
_migrateTokenOwnedItemFlags()
_addPlaylistLoopToggle(html)

Adds a new toggle for loop to the playlist controls

_onPreUpdatePlaylistSound(playlist, update)

PreUpdate Playlist Sound handler

_onPreCreateChatMessage()

PreCreate Chat Message handler

_onRenderChatMessage(message, html, data)

Render Chat Message handler

playCriticalSuccessFailure(message)

Process Critical Success/Failure for a given message

checkRollSuccessFailure(roll)

Play a sound for critical success or failure on d20 rolls Adapted from highlightCriticalSuccessFailure in the dnd5e system

_checkForCriticalPlaylist()

Checks for the presence of the Critical playlist, creates one if none exist

_createCriticalPlaylist(create)

Create the Critical playlist if the create param is true

_checkForFailurePlaylist()

Checks for the presence of the Failure playlist, creates one if none exist

_createFailurePlaylist(create)

Create the Failure playlist if the create param is true

getFirstActiveGM()User | undefined

Gets the first (sorted by userId) active GM user

isFirstGM()Boolean

Checks if the current user is the first active GM user

getPlaylistSounds()

Get all the sounds in a specific playlist

getPlaylistSound(trackId)

For a given trackId get the corresponding playlist sound

playTrack(playlistId, trackId)

Play a playlist sound based on the given trackId

playPlaylist(playlistId)

Play a playlist using its default playback method

findPlaylistSound(name)

Finds a Playlist sound by its name

playSoundByName(name, options)

Play a sound by its name rather than id

pauseSounds(sounds)

Pauses a playing howl

resumeSounds(sounds)

Resume playback on one or many howls

pauseAll()

Pauses all active playlist sounds

CombatTrack

Attach a track or playlist to combat encounters that plays when the combat begins

Kind: global class

combatTrack._checkForCombatTracksPlaylist()

Checks for the presence of the Hype Tracks playlist, creates one if none exist

Kind: instance method of CombatTrack

combatTrack._createCombatTracksPlaylist()

Create the Hype Tracks playlist if the create param is true

Kind: instance method of CombatTrack

combatTrack._getCombatTrack(combat, update)

Checks for the existence of a Combat Track and initiates playback

Kind: instance method of CombatTrack

Param
combat
update

combatTrack._stopCombatTrack(combat)

Stops any playing combat tracks

Kind: instance method of CombatTrack

Param Type
combat *

combatTrack._resumeOtherSounds()

Resume any paused Sounds

Kind: instance method of CombatTrack

combatTrack.setCombatFlags(combat, playlistId, trackId)

Sets the Combat Track flags on an Combat instance Handled as an update so all flags can be set at once

Kind: instance method of CombatTrack

Param Type Description
combat Object the combat to set flags on
playlistId String the playlist id to set
trackId String the trackId or playback mode to set

combatTrack._setDefaultCombatTrack(defaults)

Kind: instance method of CombatTrack

Param Type
defaults *

CombatTrack._checkCombatStart(combat, update, options)

Checks the updating Combat instance to determine if it just starting (round 0 => round 1)

Kind: static method of CombatTrack

Param Type
combat *
update *
options *

CombatTrack._addCombatTrackButton(app, html, data)

Adds a button to the Combat sheet to open the Combat Track form

Kind: static method of CombatTrack

Param Type
app Object
html Object
data Object

CombatTrack._onCombatTrackButtonClick(event)

Click handler for Combat Track button

Kind: static method of CombatTrack

Param Type
event *

CombatTrack._openTrackForm(combat, track, options)

Builds data object and opens the Combat Track form

Kind: static method of CombatTrack

Param Type Description
combat Object the reference combat
track String any existing track
options Object form options

CombatTrack.getCombatFlags(combat) ⇒ Object

Gets the combat Track flags on an combat

Kind: static method of CombatTrack
Returns: Object - flags - an object containing the flags

Param Type Description
combat Object the combat to get flags from

CombatTrackForm

A FormApplication for managing the combat's track

Kind: global class

combatTrackForm.getData()

Provide data to the handlebars template

Kind: instance method of CombatTrackForm

combatTrackForm._updateObject(event, formData)

Executes on form submission. Set the Hype Track flag on the specified Actor

Kind: instance method of CombatTrackForm

Param Type Description
event Object the form submission event
formData Object the form data

combatTrackForm.activateListeners(html)

Activates listeners on the form html

Kind: instance method of CombatTrackForm

Param Type
html *

CombatTrackForm.defaultOptions

Default Options for this FormApplication

Kind: static property of CombatTrackForm

HypeTrackActorForm

A FormApplication for setting the Actor's Hype Track

Kind: global class

hypeTrackActorForm.getData()

Provide data to the handlebars template

Kind: instance method of HypeTrackActorForm

hypeTrackActorForm._updateObject(event, formData)

Executes on form submission. Set the Hype Track flag on the specified Actor

Kind: instance method of HypeTrackActorForm

Param Type Description
event Object the form submission event
formData Object the form data

hypeTrackActorForm.activateListeners(html)

Activates listeners on the form html

Kind: instance method of HypeTrackActorForm

Param Type
html *

hypeTrackActorForm._onPlaylistChange(event)

Playlist select change handler

Kind: instance method of HypeTrackActorForm

Param Type
event *

HypeTrackActorForm.defaultOptions

Default Options for this FormApplication

Kind: static property of HypeTrackActorForm

ItemTrack

Attach a track to an item that plays when the item is rolled

Kind: global class

itemTrack._checkForItemTracksPlaylist()

Checks for the presence of the Hype Tracks playlist, creates one if none exist

Kind: instance method of ItemTrack

itemTrack._createItemTracksPlaylist()

Create the Hype Tracks playlist if the create param is true

Kind: instance method of ItemTrack

itemTrack._chatMessageHandler(message, html, data)

Handles module logic for chat message card

Kind: instance method of ItemTrack

Param Type Description
message Object the chat message object
html Object the jquery object
data Object the data in the message update

itemTrack._addItemTrackButton(app, html, data)

Adds a button to the Item sheet to open the Item Track form

Kind: instance method of ItemTrack

Param Type
app Object
html Object
data Object

itemTrack._openTrackForm(item, track, options)

Builds data object and opens the Item Track form

Kind: instance method of ItemTrack

Param Type Description
item Object the reference item
track String any existing track
options Object form options

itemTrack.getItemFlags(item) ⇒ Promise

Gets the Item Track flags on an Item

Kind: instance method of ItemTrack
Returns: Promise - flags - an object containing the flags

Param Type Description
item Object the item to get flags from

itemTrack.setItemFlags(item, playlistId, trackId)

Sets the Item Track flags on an Item instance Handled as an update so all flags can be set at once

Kind: instance method of ItemTrack

Param Type Description
item Object the item to set flags on
playlistId String the playlist id to set
trackId String the trackId or playback mode to set

itemTrack._setChatMessageFlag(message)

Sets a flag on a chat message

Kind: instance method of ItemTrack

Param Type Description
message Object the message to set a flag on

ItemTrackForm

A FormApplication for managing the item's track

Kind: global class

itemTrackForm.getData()

Provide data to the handlebars template

Kind: instance method of ItemTrackForm

itemTrackForm._updateObject(event, formData)

Executes on form submission. Set the Hype Track flag on the specified Actor

Kind: instance method of ItemTrackForm

Param Type Description
event Object the form submission event
formData Object the form data

itemTrackForm.activateListeners(html)

Activates listeners on the form html

Kind: instance method of ItemTrackForm

Param Type
html *

ItemTrackForm.defaultOptions

Default Options for this FormApplication

Kind: static property of ItemTrackForm

Conductor

Orchestrates (pun) module functionality

Kind: global class

Conductor._hookOnInit()

Init Hook

Kind: static method of Conductor

Conductor._hookOnReady()

Ready Hook

Kind: static method of Conductor

Conductor._initHookRegistrations()

Init Hook Registrations

Kind: static method of Conductor

Conductor._readyHookRegistrations()

Ready Hook Registrations

Kind: static method of Conductor

Conductor._hookOnPreUpdatePlaylist()

PreUpdate Playlist Hook

Kind: static method of Conductor

Conductor._hookOnPreUpdatePlaylistSound()

PreUpdate Playlist Sound Hook

Kind: static method of Conductor

Conductor._hookOnPreCreateChatMessage()

PreCreate Chat Message Hook

Kind: static method of Conductor

Conductor._hookOnPreUpdateCombat()

PreUpdate Combat Hook

Kind: static method of Conductor

Conductor._hookOnUpdateCombat()

Update Combat Hook

Kind: static method of Conductor

Conductor._hookOnDeleteCombat()

Delete Combat Hook

Kind: static method of Conductor

Conductor._hookOnRenderActorSheet()

Render Actor SheetsHook

Kind: static method of Conductor

Conductor._hookOnRenderChatMessage()

RenderChatMessage Hook

Kind: static method of Conductor

Conductor._hookOnRenderPlaylistDirectory()

RenderPlaylistDirectory Hook

Kind: static method of Conductor

Conductor._hookOnRenderCombatTrackerConfig()

Render CombatTrackerConfig Hook

Kind: static method of Conductor

Conductor._hookOnRenderItemSheet()

Render Item Sheet Hook

Kind: static method of Conductor

_checkForHypeTracksPlaylist()

Checks for the presence of the Hype Tracks playlist, creates one if none exist

Kind: global function

_createHypeTracksPlaylist()

Create the Hype Tracks playlist if the create param is true

Kind: global function

_processHype(combat, update)

Checks for the existence of the Hype Track actor flag, then plays the track

Kind: global function

Param Type Description
combat Object the combat instance
update * the update data

_resumeOthers()

Resumes previously paused sounds

Kind: global function

_getActorHypeTrack(actor)

Get the Hype Track flag if it exists on an actor

Kind: global function

Param Type
actor *

_setActorHypeTrack(trackId)

Sets the Hype Track

Kind: global function

Param Type Description
trackId Number Id of the track in the playlist

_getActorHypeFlags(actor) ⇒ Object

Gets the Hype Flags

Kind: global function
Returns: Object - the Hype flags object

Param Type
actor Actor

_setActorHypeFlags(trackId)

Sets the Hype Flags

Kind: global function

Param Type Description
trackId String Id of the track in the playlist

_addHypeButton(app, html, data)

Adds a button to the Actor sheet to open the Hype Track form

Kind: global function

Param Type
app Object
html Object
data Object

_openTrackForm(actor, track, options)

Opens the Hype Track form

Kind: global function

Param Type Description
actor Object the actor object
track Object any existing track for this actor
options Object form options

playHype(actor)

Plays a hype track for the provided actor

Kind: global function

Param Type
actor *

_migratePlaylistMode()

Kind: global function

_migrateActorFlags()

Kind: global function

_migrateItemFlags()

Kind: global function

_migrateActorOwnedItemFlags()

Kind: global function

_migrateTokenOwnedItemFlags()

Kind: global function

_addPlaylistLoopToggle(html)

Adds a new toggle for loop to the playlist controls

Kind: global function

Param Type
html *

_onPreUpdatePlaylistSound(playlist, update)

PreUpdate Playlist Sound handler

Kind: global function
Todo

  • maybe return early if no flag set?
Param Type
playlist *
update *

_onPreCreateChatMessage()

PreCreate Chat Message handler

Kind: global function

_onRenderChatMessage(message, html, data)

Render Chat Message handler

Kind: global function

Param Type
message *
html *
data *

playCriticalSuccessFailure(message)

Process Critical Success/Failure for a given message

Kind: global function

Param Type
message *

checkRollSuccessFailure(roll)

Play a sound for critical success or failure on d20 rolls Adapted from highlightCriticalSuccessFailure in the dnd5e system

Kind: global function

Param Type
roll *

_checkForCriticalPlaylist()

Checks for the presence of the Critical playlist, creates one if none exist

Kind: global function

_createCriticalPlaylist(create)

Create the Critical playlist if the create param is true

Kind: global function

Param Type Description
create Boolean whether or not to create the playlist

_checkForFailurePlaylist()

Checks for the presence of the Failure playlist, creates one if none exist

Kind: global function

_createFailurePlaylist(create)

Create the Failure playlist if the create param is true

Kind: global function

Param Type Description
create Boolean whether or not to create the playlist

getFirstActiveGM() ⇒ User | undefined

Gets the first (sorted by userId) active GM user

Kind: global function
Returns: User | undefined - the GM user document or undefined if none found

isFirstGM() ⇒ Boolean

Checks if the current user is the first active GM user

Kind: global function
Returns: Boolean - Boolean indicating whether the user is the first active GM or not

getPlaylistSounds()

Get all the sounds in a specific playlist

Kind: global function

getPlaylistSound(trackId)

For a given trackId get the corresponding playlist sound

Kind: global function

Param Type
trackId String

playTrack(playlistId, trackId)

Play a playlist sound based on the given trackId

Kind: global function

Param Type Description
playlistId String the playlist id
trackId String the track Id or playback mode

playPlaylist(playlistId)

Play a playlist using its default playback method

Kind: global function

Param Type
playlistId String

findPlaylistSound(name)

Finds a Playlist sound by its name

Kind: global function

Param Type
name *

playSoundByName(name, options)

Play a sound by its name rather than id

Kind: global function

Param Type
name *
options *

pauseSounds(sounds)

Pauses a playing howl

Kind: global function

Param Type
sounds *

resumeSounds(sounds)

Resume playback on one or many howls

Kind: global function

Param Type
sounds *

pauseAll()

Pauses all active playlist sounds

Kind: global function