Module: parser

parser

Source:

Methods

<static> getTuring(html) → {String}

Parse and return the turing from given HTML content
Parameters:
Name Type Description
html String HTML content to be parsed
Source:
Returns:
Turing, if found, empty if not
Type
String

<static> guessAge(html) → {Number}

Guess the age from the HTML on the page
Parameters:
Name Type Description
html String HTML content of the page to parse
Source:
Returns:
KoC Age
Type
Number

<static> parseBannedMessage(html) → {String}

Get the reason for being banned from a KoC bansuspend.php page
Parameters:
Name Type Description
html String the HTML page to parse the error from
Source:
Returns:
the reason, if found, "Unknown Reason" otherwise
Type
String

<static> parseBase(baseHtml) → {Object}

Get user info from the base HTML page
Parameters:
Name Type Description
baseHtml String HTML content of the Base page
Source:
Returns:
an object containing user information
Type
Object

<static> parseBattlefield(html) → {Object}

Parses a battlefield page in HTML format and returns an array of players
Parameters:
Name Type Description
html String the content of the HTML page to parse
Source:
Returns:
an object with an array of the players information found on that page
Type
Object

<static> parseCommanderChange() → {Object}

Get the number of times we can change the commander and the statement to copy (image)
Source:
Returns:
If succeeded, returns an object with 'success', 'nbTimesCanChangeCommander', 'errorMessage' and 'statement' properties
Type
Object

<static> parseErrorMessage(html) → {String}

Get the error message from a KoC error.php page
Parameters:
Name Type Description
html String the HTML page to parse the error from
Source:
Returns:
the error message, if found, "Unknown Error" otherwise
Type
String

<static> parseForgotPass(html)

Parse the error message on a forgot pass page
Parameters:
Name Type Description
html String the HTML page to parse
Source:

<static> parseIntelFile(html) → {Object}

Parse the intelligence log of a particular user, listing all the intel reports
Parameters:
Name Type Description
html String
Source:
Returns:
an object with success, reports, currentPage, maxPage and total
Type
Object

<static> parseLeftSideBox(html) → {Object}

Parse the box on the left-side of each page with the stats
Parameters:
Name Type Description
html String the HTML content of the page to parse
Source:
Returns:
an object containing gold, experience, turns, rank, lastAttacked, mails and newMails if found
Type
Object

<static> parseMenu(html) → {Array}

Parse the menu on the left side
Parameters:
Name Type Description
html String HTML content of the page to parse
Source:
Returns:
all the items in the menu (containing page, image and title)
Type
Array

<static> parseNewUserAdvisor(html)

Get the New User Advisor content, when available
Parameters:
Name Type Description
html String HTML content of the page to parse
Source:

<static> parseRacesInfo(html)

Get available races information
Parameters:
Name Type Description
html String HTML content of the page to parse
Source: