Class: TemplateParser

TemplateParser()

This class parses and stores parsed template data.

Constructor

new TemplateParser()

Source:

Members

auras

Parsed Data Stores
Source:

Methods

getActualPhase(phaseName) → {string}

Returns the actual phase a certain phase tech represents or stands in for. For example, passing `phase_city_athen` would result in `phase_city`.
Parameters:
Name Type Description
phaseName string
Source:
Returns:
Type
string

getActualUpgradeData()

Provided with an array containing basic information about possible upgrades, such as that generated by globalscript's GetTemplateDataHelper, this function loads the actual template data of the upgrades, overwrites certain values within, then passes an array containing the template data back to caller.
Source:

getEntity(templateName, civCode) → {object|null}

Load and parse a structure, unit, resource, etc from its entity template file.
Parameters:
Name Type Description
templateName string
civCode string
Source:
Returns:
Sanitized object about the requested template or null if entity template doesn't exist.
Type
object | null

getPhase(phaseCode, civCode) → {Object}

Parameters:
Name Type Description
phaseCode string
civCode string
Source:
Returns:
Sanitized object containing phase data
Type
Object

getPhaseOfTechnology(techName, civCode)

Determines and returns the phase in which a given technology can be first researched. Works recursively through the given tech's pre-requisite and superseded techs if necessary.
Parameters:
Name Type Description
techName string The Technology's name
civCode string
Source:
Returns:
The name of the phase the technology belongs to, or false if the current civ can't research this tech

getPlayer()

Load and parse the relevant player_{civ}.xml template.
Source:

getTechnology(technologyName, civCode) → {Object}

Load and parse technology from json template.
Parameters:
Name Type Description
technologyName string
civCode string
Source:
Returns:
Sanitized data about the requested technology.
Type
Object