Class

RotatingPlaylist

RotatingPlaylist(playlistDatanon-null, seasonData)

Playlist class for modes which rotate through a collection of maps at set intervals, e.g. the default 'Play Apex' mode.

Constructor

# new RotatingPlaylist(playlistDatanon-null, seasonData)

Create a rotating playlist from playlistData.

Parameters:
Name Type Description
playlistData object

data for this playlist parsed from /data/seasons.json

seasonData object

data for this season parsed from /data/seasons.json

View Source classes/RotatingPlaylist.js, line 12

Extends

Members

Date

# baseTime Optional

The time to use as base for calculating rotation times. This is needed for some playlists as they appear to start at odd times that don't align with the season start, mode start, or even each other.

Overrides:

View Source classes/Playlist.js, line 64

number

# readonly currentIndex

Calculate the current index position of rotations – i.e. how many PlaylistItems deep we are into the current rotations cycle, minus 1.

View Source classes/RotatingPlaylist.js, line 85

# readonly currentMap

Returns the current map rotation in this playlist.

View Source classes/RotatingPlaylist.js, line 96

Date

# endTime

The time at which this playlist ends.

Overrides:

View Source classes/Playlist.js, line 87

boolean

# LTM Optional

Whether this playlist is a Limited Time Mode.

Overrides:

View Source classes/Playlist.js, line 27

Array.<string>

# maps

Array of maps used in this playlist.

Overrides:

View Source classes/Playlist.js, line 95

string

# mode

The mode of the playlist (e.g. Play Apex, Ranked Leagues)

Overrides:

View Source classes/Playlist.js, line 25

ScheduledPlaylistItem

# readonly nullable nextMap

Calculate the next map rotation in this playlist. Returns the first item of the playlist if before this playlist's start time, or null if the current map is the last item before endTime or if called after the playlist has ended.

View Source classes/RotatingPlaylist.js, line 110

number

# readonly playlistRotationsDuration

Calculate the total duration of one complete cycle of all PlaylistItems in this playlist, in milliseconds.

View Source classes/RotatingPlaylist.js, line 69

boolean

# ranked Optional

Whether this is a ranked playlist.

Overrides:

View Source classes/Playlist.js, line 55

string

# replaces Optional

The 'standard' playlist that a takeover LTM replaces.

Overrides:

View Source classes/Playlist.js, line 45

Date

# readonly rotationBaseTime

Returns the baseTime of the playlist - a time before startTime when a cycle of the rotations array begins. This is needed in some cases where for whatever reason the start time of the playlist is offset from when it became available to play. Returns startTime if not explicitly set in /data/seasons.json.

Deprecated:
  • Yes
To Do:
  • refactor this into #getPlaylistTimeElapsed, only place it is used and is confusing next to baseTime.

View Source classes/RotatingPlaylist.js, line 55

Array.<PlaylistItem>

# rotations

The map rotations for this playlist

View Source classes/RotatingPlaylist.js, line 33

Date

# startTime

The time at which this playlist starts.

Overrides:

View Source classes/Playlist.js, line 79

boolean

# takeover Optional

Whether this playlist is a takeover-style limited time mode (i.e. that it replaces a 'regular' mode for its duration).

Overrides:

View Source classes/Playlist.js, line 36

Methods

# getIndexByOffset(offset) → {number}

Calculate the index of the position in RotatingPlaylist#rotations for a given millisecond offset from the start of a cycle of rotations.

Parameters:
Name Type Description
offset number

offset in milliseconds

View Source classes/RotatingPlaylist.js, line 124

index position in RotatingPlaylist#rotations

number

# getMapByDate(dateopt) → {ScheduledPlaylistItem}

Get the map active for the given date, or the current date if not provided.

Parameters:
Name Type Attributes Default Description
date parseableDate <optional>
new Date()

the date to query

View Source classes/RotatingPlaylist.js, line 186

the map for the requested date

# getOffsetByIndex(index) → {number}

Calculate the offset in milliseconds for a given index of rotations from the start of the rotation cycle.

Parameters:
Name Type Description
index number

index from RotatingPlaylist#rotations

View Source classes/RotatingPlaylist.js, line 142

offset in milliseconds from the start of this rotation cycle

number

# getPlaylistTimeElapsed(date) → {number}

Returns the milliseconds elapsed since the start of this rotation cycle.

Parameters:
Name Type Description
date parseableDate

the date to query

View Source classes/RotatingPlaylist.js, line 170

milliseconds since this rotation cycle began

number

# normaliseIndex(target) → {number}

Takes a potentially overflowed index for RotatingPlaylist#rotations and returns a valid index.

Parameters:
Name Type Description
target number

number of items elapsed in playlist, minus 1

To Do:
  • move this to a utility function

View Source classes/RotatingPlaylist.js, line 159

the normalised current index position

number