node-csgo-parser
node-csgo-parser copied to clipboard
Extract Items/Skins/... from raw VDF data files
Node-CSGO-Parser
Extract Items/Skins/... from raw VDF data files
TODOs
- [ ] Refactoring... This file will be too long
- [ ] Generalization isDatasInitialized
- [ ] Better handle of Little Endian for vdf / Hack dependency
- [ ] Datamining File for more informations
- [ ] DEBUG - Better Handle of Knifes and Rarities (My god, need so much hack ><. Volvo... that's not really clean ^^')
- [ ] To ES6
- [ ] Optimize Performances
- [ ] defindex to int ?
Installation
npm install node-csgo-parser --save
Usage
var parser = require('./csgo-data-parser'),
var schemaFilePath = './test/test-data/schema.txt',
langFilePath = './test/test-data/csgo_english.txt',
itemsFilePath = './test/test-data/items_game.txt',
outLogFilePath = './out/logs/parser.log';
var csgoDataParser = new parser(schemaFilePath, langFilePath, itemsFilePath, 'debug', outLogFilePath);
Must pass schema file (like schema.txt), language file (like csgo_english.txt) and item file (like item_data.txt) at VDF format
- Schema file can be find in Steam API
- Language file can be find in game data files (steam-data/csgo/resource/csgo_language.txt)
- Items File can be find both in game data files () and in Steam API (Note : You need do get the items_game_url information)
Example
A sample script is at example.js
.
API Documentation
-
CSGODataParser
- new CSGODataParser(schemaFilePath, langFilePath, itemsFilePath, logLevel, logFilePath)
-
.getLogger() ⇒
winston.Logger
-
.isDatasInitialized() ⇒
boolean
-
.isLangInitialized() ⇒
boolean
-
.getLangValue(keyLang) ⇒
String
-
.getWeapons() ⇒
Array.<Weapon>
-
.getCollections() ⇒
Array.<Collection>
-
.getExteriors() ⇒
Array.<String>
-
.getCases() ⇒
Array.<Prefab>
-
.getCaseKeys() ⇒
Array.<Prefab>
-
.getStickers() ⇒
Array.<Sticker>
-
.getMusicKits() ⇒
Array.<MusicKit>
-
.getRaritiesIndex() ⇒
Array.<Rarity>
new CSGODataParser(schemaFilePath, langFilePath, itemsFilePath, logLevel, logFilePath)
Param | Type | Description |
---|---|---|
schemaFilePath | String |
Path to schema file. |
langFilePath | String |
Path to csgo_lang file. |
itemsFilePath | String |
Path to items_game file. |
logLevel | String |
Winston Log Level, if > info no timing data for generations. |
logFilePath | String |
Choosen file path to write logs. |
csgoDataParser.getLogger() ⇒ winston.Logger
Return the parser's logger.
Kind: instance method of CSGODataParser
Returns: winston.Logger
- Winston based Parser's Logger.
Access: public
csgoDataParser.isDatasInitialized() ⇒ boolean
Check if datas files are OK.
Kind: instance method of CSGODataParser
Returns: boolean
- True if datas initialized, false otherwise
Access: public
csgoDataParser.isLangInitialized() ⇒ boolean
Check if lang file is OK.
Kind: instance method of CSGODataParser
Returns: boolean
- True if initialized, false otherwise
Access: public
csgoDataParser.getLangValue(keyLang) ⇒ String
Get the lang value from valve key i18n values.
Kind: instance method of CSGODataParser
Returns: String
- traduction if langfile initialized and key is present, key otherwise
Access: public
Param | Type | Description |
---|---|---|
keyLang | String |
valve key i18n values (like #PaintKit_aa_fade_Tag) |
csgoDataParser.getWeapons() ⇒ Array.<Weapon>
Generate bases Weapons data from schema's data.
Kind: instance method of CSGODataParser
Returns: Array.<Weapon>
- List of Objects. One object represent one Weapon.
Access: public
csgoDataParser.getCollections() ⇒ Array.<Collection>
Generate collection's data from itemsgame's data.
Kind: instance method of CSGODataParser
Returns: Array.<Collection>
- List of Collections. One object represent one Collection.
Access: public
csgoDataParser.getExteriors() ⇒ Array.<String>
Generate exteriors.
Kind: instance method of CSGODataParser
Returns: Array.<String>
- One string represent one exterior type - I18N Name
Access: public
csgoDataParser.getCases() ⇒ Array.<Prefab>
Generate Weapon/Stickers skin Case list.
Kind: instance method of CSGODataParser
Returns: Array.<Prefab>
- List of Object. One object represent one case
Access: public
csgoDataParser.getCaseKeys() ⇒ Array.<Prefab>
Generate Weapon/Stickers skin Case keys list.
Kind: instance method of CSGODataParser
Returns: Array.<Prefab>
- List of Object. One object represent one case key
Access: public
csgoDataParser.getStickers() ⇒ Array.<Sticker>
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)
Kind: instance method of CSGODataParser
Returns: Array.<Sticker>
- List of Sticker. One object represent one sticker
Access: public
csgoDataParser.getMusicKits() ⇒ Array.<MusicKit>
Generate MusicKits list.
Kind: instance method of CSGODataParser
Returns: Array.<MusicKit>
- List of MusicKit. One object represent one music kit
Access: public
csgoDataParser.getRaritiesIndex() ⇒ Array.<Rarity>
Generate Rarities index.
Kind: instance method of CSGODataParser
Returns: Array.<Rarity>
- List of Rarity objects. One object represent one rarity.
Access: public