Class: MapManager

MapManager


new MapManager()

Use this to manage the map

Source:

Members


<private> _arrowConditions :Object

Type:
  • Object
Source:

currentMap :string

The id of the current map the player is on.

Type:
  • string
Source:

Methods


<private> _addToQueue(callback)

Parameters:
Name Type Description
callback Promise
Source:

<private> _doArrowConditions(mapID)

Parameters:
Name Type Description
mapID string
Source:

<private> _playMapConditions()

Source:

<private> _popQueue(resolve)

Parameters:
Name Type Description
resolve function
Source:

addBuilding(mapID, buildingID, building)

Add a new building to the map

Parameters:
Name Type Description
mapID string
buildingID string
building MapManager.building
Source:

addMapCondition(mapID, callback)

Map conditions are functions called whenever a player goes to that map. For example, when the girls go to the Morass after recruiting Esxea, a dialogue plays. That is a map condition.
The callback function should return a promise function if the condition is met to prevent two conditions from playing at the same time.

Parameters:
Name Type Description
mapID string
callback Promise

Should return a promise if the condition is met

Source:

clearQueue()

Clears the map condition queue, preventing the remaining conditions to play

Source:

getBuildings(mapID)

Parameters:
Name Type Description
mapID string

Get all of the buildings for the map

Source:
Returns:
Type
object.<MapManager.building> | boolean

getMap(mapID)

Parameters:
Name Type Description
mapID string

If no id is given, it will return the entire game map

Source:
Returns:
Type
MapManager.map | boolean

getMapConditions(mapID)

Returns the array of map conditions.

Parameters:
Name Type Description
mapID string
Source:
Returns:
Type
Array

removeBuilding(mapID, buildingID)

Removes the building from the game entirely

Parameters:
Name Type Description
mapID string
buildingID string
Source:

removeMapCondition(mapID, index)

Use MapManager.getMapConditions to find the index of the condition you want to remove

Parameters:
Name Type Description
mapID string
index number
Source:

setArrow(direction)

Sets the arrow visibility to false.
All arrows are visible by default if there is a map location available there. You will only ever need to disable them temporarily for quests or other conditions

Parameters:
Name Type Description
direction 'north' | 'south' | 'east' | 'west'

Direction of the arrow

Source:

setArrowCondition(mapID, callback)

Adds an arrow condition to the map. Anything you need to do to the arrows should be inside the callback function. Use MapManager#_arrowConditions as a template

Parameters:
Name Type Description
mapID string
callback function

This function should disable arrows inside of it. Use the default values as a template.

Source:

switchMap(mapID)

Switches to a map

Parameters:
Name Type Description
mapID string
Source:

Type Definitions


building

Type:
  • object
Properties:
Name Type Argument Description
key string

texture key of the building

x number

x location of the building

y number

y location of the building

callback function

function called when clicking the building

visible function | boolean <optional>

If you want to display this building only when a condition is met. The function should return true or false. It is called each time the map is created.

Source:
Examples
{
    key: "House",
    x: 375,
    y: 486,
    callback: () => {
         GAME.openMenu('house');
    }
}
{
    key: "Brothel",
    x: 375,
    y: 486,
    callback: () => {
         GAME.openMenu('brothel');
    },
    visible: () => {
         // This building will only be visible if the townFuckQuest 'Complete' subquest is true
         return GAME.quest.isComplete('townFuckQuest','Completed');
    }
}

map

Type:
  • object
Properties:
Name Type Description
north boolean | string

id of the map north of this map or false

south boolean | string

id of the map south of this map or false

east boolean | string

id of the map eest of this map or false

west boolean | string

id of the map west of this map or false

Source:
Example
{
    "north": false,
    "south": false,
    "east": "Greenhaven",
    "west": false
}