Namespace: DataManager

DataManager

The static class that manages the database and game objects.

Methods

DataManager.checkError()static

Check if there are any errors, throw a retry screen error if any exist
Throws:
Retry screen error

DataManager.correctDataErrors()static

Tries to correct any bad data

DataManager.createGameObjects()static

Creates $gameTemp and the other game objects

DataManager.earliestSavefileId()numberstatic

Gets the earliest save file
Returns:
TypeDescription
numberThe index of the earliest save file

DataManager.emptySavefileId()numberstatic

Gets the index of an empty save file
Returns:
TypeDescription
numberThe index of the empty save file

DataManager.extractArrayMetadata(array)static

Extract metadata from an array object
NameTypeDescription
arrayArrayThe array to extract metadata from

DataManager.extractMetadata(data)static

Extract metadata from an individual object
NameTypeDescription
data*The data that might have a meta property in its note

DataManager.extractSaveContents(contents)static

Extracts the content from a save file to the various game objects
NameTypeDescription
contentsObjectThe save file contents

DataManager.isAnySavefileExists()booleanstatic

Check if there are any save files
Returns:
TypeDescription
booleanTrue if any save files exist

DataManager.isArmor(item)booleanstatic

Check if the given object is an armor from the database
NameTypeDescription
item*Item to check for inclusion in $dataArmors
Returns:
TypeDescription
booleanTrue if the object is an armor

DataManager.isBattleTest()booleanstatic

Check if the game is in battle test mode
Returns:
TypeDescription
booleanTrue if the game is in battle test mode

DataManager.isDatabaseLoaded()booleanstatic

Check if all of the database files are loaded
Returns:
TypeDescription
booleanTrue if all database files are loaded

DataManager.isEventTest()booleanstatic

Check if the game is in event test mode
Returns:
TypeDescription
booleanTrue if the game is in event test mode

DataManager.isGlobalInfoLoaded()booleanstatic

Check if global info is loaded
Returns:
TypeDescription
booleanTrue if global info is loaded.

DataManager.isItem(item)booleanstatic

Check if the given object is an item from the database
NameTypeDescription
item*Item to check for inclusion in $dataItems
Returns:
TypeDescription
booleanTrue if the object is an item

DataManager.isMapLoaded()booleanstatic

Check if the map is loaded
Returns:
TypeDescription
booleanTrue if map data is loaded

DataManager.isMapObject(object)booleanstatic

Check if an object represents map data
NameTypeDescription
object*The object to check for map info
Returns:
TypeDescription
booleanTrue if the object represents a map

DataManager.isSkill(item)booleanstatic

Check if the given object is a skill from the database
NameTypeDescription
item*Item to check for inclusion in $dataSkills
Returns:
TypeDescription
booleanTrue if the object is a skill

DataManager.isTitleSkip()booleanstatic

Check if title skip option is enabled
Since:
  • Version 1.7.0
Returns:
TypeDescription
booleanTrue if title skip is on

DataManager.isWeapon(item)booleanstatic

Check if the given object is a weapon from the database
NameTypeDescription
item*Item to check for inclusion in $dataWeapons
Returns:
TypeDescription
booleanTrue if the object is a weapon

DataManager.latestSavefileId()numberstatic

Gets the last used save file
Returns:
TypeDescription
numberThe index of the last save file

DataManager.loadAllSavefileImages()static

Loads the images needed for display in the file select screen

DataManager.loadDataFile(name, src)static

Loads the database file with the given name and src
NameTypeDescription
namestringThe name of the data object to store loaded data in
srcstringThe path to the data file to load

DataManager.loadDatabase()static

Loads each of the database files

DataManager.loadGame(savefileId)static

Tries to load game info from the given save file id slot
NameTypeDescription
savefileIdnumberThe id of the save file slot to load

DataManager.loadGlobalInfo()static

Loads the "global" object

DataManager.loadMapData(mapId)static

Loads a map data file by the map's id
NameTypeDescription
mapIdnumberThe ID of the map to load

DataManager.loadSavefileImages(info)static

Loads the images needed for display in the file select screen from a specific save file
NameTypeDescription
info*The save file info with image data to load

DataManager.makeEmptyMap()static

Makes an empty map with no data or events, stored in $dataMap

DataManager.makeSaveContents()Objectstatic

Creates save file contents
Returns:
TypeDescription
ObjectThe save file contents

DataManager.makeSavefileInfo()Objectstatic

Creates save file info for the file select screen
Returns:
TypeDescription
ObjectThe save file info contents

DataManager.makeSavename(savefileId)stringstatic

Creates the file name of the save file from the save file id slot
NameTypeDescription
savefileIdnumberThe id of the save file slot
Returns:
TypeDescription
stringThe save file name

DataManager.maxSavefiles()numberstatic

Determines the maximum number of save files allowed
Returns:
TypeDescription
numberThe maximum number of save files allowed

DataManager.onLoad(object)static

Handling for when a data object is loaded
NameTypeDescription
object*The object that was loaded

DataManager.onXhrError(name, src, url)static

Handling for when the xhr object encounters an error
NameTypeDescription
namestringThe name of the data object to store loaded data in
srcstringThe path to the data file to load
urlstringThe full path to the data file to load

DataManager.onXhrLoad(xhr, name, src, url)static

Handling for when the xhr object is loaded
NameTypeDescription
xhrXMLHttpRequestThe XMLHttpRequest object
namestringThe name of the data object to store loaded data in
srcstringThe path to the data file to load
urlstringThe full path to the data file to load

DataManager.removeInvalidGlobalInfo()static

Check for and remove invalid global info if any exists

DataManager.saveGame(savefileId)static

Tries to save the game in the given save file id slot
NameTypeDescription
savefileIdnumberThe id of the save file slot to save

DataManager.saveGlobalInfo()static

Saves the "global" object

DataManager.savefileExists(savefileId)booleanstatic

Checks if a given save file exists by save file id
NameTypeDescription
savefileIdnumberThe id of the save file to check
Returns:
TypeDescription
booleanTrue if save data exists for that file id

DataManager.savefileInfo(savefileId)Object | nullstatic

Gets the save file info for a specific save file id
NameTypeDescription
savefileIdnumberThe id of the save file to load
Returns:
TypeDescription
Object|nullEither the save file info if exists, or null

DataManager.selectSavefileForNewGame()static

Selects the initial save file slot for a new game

DataManager.setupBattleTest()static

Handles setting up a battle test

DataManager.setupEventTest()static

Handles setting up an event test

DataManager.setupNewGame()static

Handles setting up a new game