UNPKG

node-csgo-parser

Version:

Extract Items/Skins/... from raw VDF data files

1,635 lines (398 loc) 19.3 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CSGODataParser - Documentation</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="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="global.html#Collection">Collection</a></li><li><a href="CSGODataParser.html">CSGODataParser</a><ul class='methods'><li data-type='method'><a href="CSGODataParser.html#getCaseKeys">getCaseKeys</a></li><li data-type='method'><a href="CSGODataParser.html#getCases">getCases</a></li><li data-type='method'><a href="CSGODataParser.html#getCollections">getCollections</a></li><li data-type='method'><a href="CSGODataParser.html#getExteriors">getExteriors</a></li><li data-type='method'><a href="CSGODataParser.html#getLangValue">getLangValue</a></li><li data-type='method'><a href="CSGODataParser.html#getLogger">getLogger</a></li><li data-type='method'><a href="CSGODataParser.html#getMusicKits">getMusicKits</a></li><li data-type='method'><a href="CSGODataParser.html#getRaritiesIndex">getRaritiesIndex</a></li><li data-type='method'><a href="CSGODataParser.html#getStickers">getStickers</a></li><li data-type='method'><a href="CSGODataParser.html#getWeapons">getWeapons</a></li><li data-type='method'><a href="CSGODataParser.html#isDatasInitialized">isDatasInitialized</a></li><li data-type='method'><a href="CSGODataParser.html#isLangInitialized">isLangInitialized</a></li></ul></li><li><a href="global.html#MusicKit">MusicKit</a></li><li><a href="global.html#Prefab">Prefab</a></li><li><a href="global.html#Rarity">Rarity</a></li><li><a href="global.html#SkinPaint">SkinPaint</a></li><li><a href="global.html#Sticker">Sticker</a></li><li><a href="global.html#Weapon">Weapon</a></li></ul><h3><a href="global.html">Global</a></h3> </nav> <div id="main"> <h1 class="page-title">CSGODataParser</h1> <section> <header> <h2> CSGODataParser </h2> <div class="class-description">Parser of CSGOData.</div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="CSGODataParser"><span class="type-signature"></span>new CSGODataParser<span class="signature">(schemaFilePath, langFilePath, itemsFilePath, logLevel, logFilePath)</span><span class="type-signature"></span></h4> <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>schemaFilePath</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Path to schema file.</td> </tr> <tr> <td class="name"><code>langFilePath</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Path to csgo_*lang* file.</td> </tr> <tr> <td class="name"><code>itemsFilePath</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Path to items_game file.</td> </tr> <tr> <td class="name"><code>logLevel</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Winston Log Level, if > info no timing data for generations.</td> </tr> <tr> <td class="name"><code>logFilePath</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Choosen file path to write logs.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line66">line 66</a> </li></ul></dd> <dt class="tag-todo">To Do:</dt> <dd class="tag-todo"> <ul> <li>Refactoring... This file will be too long</li> <li>Generalization isDatasInitialized</li> <li>Better handle of Little Endian for vdf / Hack dependency</li> <li>Datamining File for more informations</li> <li>DEBUG - Better Handle of Knifes and Rarities (My god, need so much hack ><. Volvo... that's not really clean ^^')</li> <li>To ES6</li> <li>Optimize Performances</li> <li>defindex to int ?</li> </ul> </dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="getCaseKeys"><span class="type-signature"></span>getCaseKeys<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Prefab">Prefab</a>>}</span></h4> <div class="description"> Generate Weapon/Stickers skin Case keys list. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line484">line 484</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of Object. One object represent one case key </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;<a href="global.html#Prefab">Prefab</a>></span> </dd> </dl> <h4 class="name" id="getCases"><span class="type-signature"></span>getCases<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Prefab">Prefab</a>>}</span></h4> <div class="description"> Generate Weapon/Stickers skin Case list. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line460">line 460</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of Object. One object represent one case </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;<a href="global.html#Prefab">Prefab</a>></span> </dd> </dl> <h4 class="name" id="getCollections"><span class="type-signature"></span>getCollections<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Collection">Collection</a>>}</span></h4> <div class="description"> Generate collection's data from itemsgame's data. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line388">line 388</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of Collections. One object represent one Collection. </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;<a href="global.html#Collection">Collection</a>></span> </dd> </dl> <h4 class="name" id="getExteriors"><span class="type-signature"></span>getExteriors<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;String>}</span></h4> <div class="description"> Generate exteriors. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line435">line 435</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> One string represent one exterior type - I18N Name </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;String></span> </dd> </dl> <h4 class="name" id="getLangValue"><span class="type-signature"></span>getLangValue<span class="signature">(keyLang)</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> Get the lang value from valve key i18n values. </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>keyLang</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">valve key i18n values (like #PaintKit_aa_fade_Tag)</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line327">line 327</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> traduction if langfile initialized and key is present, key otherwise </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="getLogger"><span class="type-signature"></span>getLogger<span class="signature">()</span><span class="type-signature"> &rarr; {winston.Logger}</span></h4> <div class="description"> Return the parser's logger. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line285">line 285</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Winston based Parser's Logger. </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">winston.Logger</span> </dd> </dl> <h4 class="name" id="getMusicKits"><span class="type-signature"></span>getMusicKits<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#MusicKit">MusicKit</a>>}</span></h4> <div class="description"> Generate MusicKits list. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line549">line 549</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of MusicKit. One object represent one music kit </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;<a href="global.html#MusicKit">MusicKit</a>></span> </dd> </dl> <h4 class="name" id="getRaritiesIndex"><span class="type-signature"></span>getRaritiesIndex<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Rarity">Rarity</a>>}</span></h4> <div class="description"> Generate Rarities index. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line587">line 587</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of Rarity objects. One object represent one rarity. </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;<a href="global.html#Rarity">Rarity</a>></span> </dd> </dl> <h4 class="name" id="getStickers"><span class="type-signature"></span>getStickers<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Sticker">Sticker</a>>}</span></h4> <div class="description"> Generate Stickers list. Note : Some unknown stickers are present in the item_game file so they have a rarity set to "default" (id 2 to 12) </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line506">line 506</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of Sticker. One object represent one sticker </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;<a href="global.html#Sticker">Sticker</a>></span> </dd> </dl> <h4 class="name" id="getWeapons"><span class="type-signature"></span>getWeapons<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;<a href="global.html#Weapon">Weapon</a>>}</span></h4> <div class="description"> Generate bases Weapons data from schema's data. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line346">line 346</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> List of Objects. One object represent one Weapon. </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array.&lt;<a href="global.html#Weapon">Weapon</a>></span> </dd> </dl> <h4 class="name" id="isDatasInitialized"><span class="type-signature"></span>isDatasInitialized<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> Check if datas files are OK. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line297">line 297</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> True if datas initialized, false otherwise </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id="isLangInitialized"><span class="type-signature"></span>isLangInitialized<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> Check if lang file is OK. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="csgo-data-parser.js.html">csgo-data-parser.js</a>, <a href="csgo-data-parser.js.html#line313">line 313</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> True if initialized, false otherwise </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Jan 14 2016 18:47:02 GMT+0100 (Paris, Madrid) using the Minami theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>