koc
Version:
Library to parse data from the online MMORPG Kings of Chaos
2,115 lines (666 loc) • 24.5 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: parser</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Module: parser</h1>
<section>
<header>
<h2>
parser
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line5">line 5</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="getTuring"><span class="type-signature"><static> </span>getTuring<span class="signature">(html)</span><span class="type-signature"> → {String}</span></h4>
</dt>
<dd>
<div class="description">
Parse and return the turing from given HTML content
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">HTML content to be parsed</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line14">line 14</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
Turing, if found, empty if not
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="guessAge"><span class="type-signature"><static> </span>guessAge<span class="signature">(html)</span><span class="type-signature"> → {Number}</span></h4>
</dt>
<dd>
<div class="description">
Guess the age from the HTML on the page
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">HTML content of the page to parse</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line470">line 470</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
KoC Age
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseArmory"><span class="type-signature"><static> </span>parseArmory<span class="signature">(html)</span><span class="type-signature"> → {Object}</span></h4>
</dt>
<dd>
<div class="description">
Parse the armory from HTML to an object
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line744">line 744</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
parsed armory
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseBannedMessage"><span class="type-signature"><static> </span>parseBannedMessage<span class="signature">(html)</span><span class="type-signature"> → {String}</span></h4>
</dt>
<dd>
<div class="description">
Get the reason for being banned from a KoC bansuspend.php page
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">the HTML page to parse the error from</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line49">line 49</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the reason, if found, "Unknown Reason" otherwise
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseBase"><span class="type-signature"><static> </span>parseBase<span class="signature">(baseHtml)</span><span class="type-signature"> → {Object}</span></h4>
</dt>
<dd>
<div class="description">
Get user info from the base HTML page
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>baseHtml</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">HTML content of the Base page</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line132">line 132</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
an object containing user information
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseBattlefield"><span class="type-signature"><static> </span>parseBattlefield<span class="signature">(html)</span><span class="type-signature"> → {Object}</span></h4>
</dt>
<dd>
<div class="description">
Parses a battlefield page in HTML format and returns an array of players
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">the content of the HTML page to parse</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line63">line 63</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
an object with an array of the players information found on that page
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseCommanderChange"><span class="type-signature"><static> </span>parseCommanderChange<span class="signature">()</span><span class="type-signature"> → {Object}</span></h4>
</dt>
<dd>
<div class="description">
Get the number of times we can change the commander
and the statement to copy (image)
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line506">line 506</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
If succeeded, returns an object with 'success',
'nbTimesCanChangeCommander', 'errorMessage' and 'statement' properties
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseErrorMessage"><span class="type-signature"><static> </span>parseErrorMessage<span class="signature">(html)</span><span class="type-signature"> → {String}</span></h4>
</dt>
<dd>
<div class="description">
Get the error message from a KoC error.php page
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">the HTML page to parse the error from</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line35">line 35</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
the error message, if found, "Unknown Error" otherwise
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseForgotPass"><span class="type-signature"><static> </span>parseForgotPass<span class="signature">(html)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Parse the error message on a forgot pass page
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">the HTML page to parse</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line536">line 536</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseIntelFile"><span class="type-signature"><static> </span>parseIntelFile<span class="signature">(html)</span><span class="type-signature"> → {Object}</span></h4>
</dt>
<dd>
<div class="description">
Parse the intelligence log of a particular user, listing all the intel reports
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line1400">line 1400</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
an object with success, reports, currentPage, maxPage and total
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseLeftSideBox"><span class="type-signature"><static> </span>parseLeftSideBox<span class="signature">(html)</span><span class="type-signature"> → {Object}</span></h4>
</dt>
<dd>
<div class="description">
Parse the box on the left-side of each page with the stats
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">the HTML content of the page to parse</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line343">line 343</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
an object containing gold, experience, turns, rank,
lastAttacked, mails and newMails if found
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseMenu"><span class="type-signature"><static> </span>parseMenu<span class="signature">(html)</span><span class="type-signature"> → {Array}</span></h4>
</dt>
<dd>
<div class="description">
Parse the menu on the left side
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">HTML content of the page to parse</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line484">line 484</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
all the items in the menu (containing page, image and title)
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseNewUserAdvisor"><span class="type-signature"><static> </span>parseNewUserAdvisor<span class="signature">(html)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Get the New User Advisor content, when available
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">HTML content of the page to parse</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line448">line 448</a>
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseQuickStats"><span class="type-signature"><static> </span>parseQuickStats<span class="signature">(html)</span><span class="type-signature"> → {Object}</span></h4>
</dt>
<dd>
<div class="description">
Parse the quick stats (xhr from the battlefield)
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line674">line 674</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
parsed quick stats
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="parseRacesInfo"><span class="type-signature"><static> </span>parseRacesInfo<span class="signature">(html)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Get available races information
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>html</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">HTML content of the page to parse</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line395">line 395</a>
</li></ul></dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-helpers.html">helpers</a></li><li><a href="module-koc.html">koc</a></li><li><a href="module-parser.html">parser</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha5</a> on Sun Apr 12 2015 08:47:16 GMT+0900 (Tokyo Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>