API Docs for:
Show:

DataManager Class

Module: gs

Manages the game's data like loading documents. Documents are stored in the data folder of the game in JSON format. The UID is used as the file-name. A document has the following structure:

UID - Unique Identifier
Items -> An object containing all the items/fields of the document.
Items.Type -> The type of the document
Items.Name -> The name of the document

Methods

disposeDocumentsByType

(
  • type
)

Unloads all documents with a specified type.

Parameters:

  • type String
    • The document type.

getDocument

(
  • uid
)
gs.Document

Gets a document by its UID.

Parameters:

  • uid String
    • The UID of the document to get.

Returns:

gs.Document:

The document or null if a document with the specified UID doesn't exist.

getDocumentByType

(
  • type
)
gs.Document

Gets the first document with the specified type.

Parameters:

  • type String
    • The document type.

Returns:

gs.Document:

The document or null if a document with the specified type doesn't exist.

getDocumentsByType

(
  • type
)
gs.Document

Gets all documents with a specified type.

Parameters:

  • type String
    • The document type.

Returns:

gs.Document:

The documents.

getDocumentSummary

(
  • uid
)
gs.Document

Gets a document by its UID. If the document isn't already loaded this method only returned document only contains summary data.

Parameters:

  • uid String
    • The UID of the document to get.

Returns:

gs.Document:

The document or null if a document with the specified UID doesn't exist.

update

()

Updates the loading process of documents.

Properties

documents

gs.Document

Stores all documents.

documentsByUid

gs.Document

Stores all documents by UID.

documentsLoaded

Boolean

Indiciates if all requested documents are loaded.

events

gs.EventEmitter