@tf2-automatic/tf2-format 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # tf2-format
2
+
3
+ This is a standard library for working with different formats in Team Fortress 2. It is designed with speed and interoperability in mind, and it is a many times faster than alternatives.
4
+
5
+ ## Why another library?
6
+
7
+ I created this library because I needed fast, simple, and reliable handling of different formats in Team Fortress 2. Other libraries are slow, complicated, and rely heavily on hard-coded values. This library can parse different formats into a single common format.
8
+
9
+ ## Guides
10
+
11
+ This library is organized into different classes, each made for working with specific formats. By separating functionality this way, you can easily find and work with the format you need without unnecessary complexity.
12
+
13
+ ### Item parsing
14
+
15
+ For parsing items, e.g. econ items from inventories and trades, or TF2 items from the TF2 GC ([node-tf2](https://github.com/DoctorMckay/node-tf2)), use one of the implementations of the `Parser` class. For parsing econ items, use the [EconParser](./src/lib/parsing/econ) class. For parsing tf2 items, use the [TF2Parser](./src/lib/parsing/tf2) class. See [here](./src/lib/parsing/) for the item parser documentation.
16
+
17
+ ### SKU
18
+
19
+ For working with SKUs, use the [SKU](./src/lib/sku) class.
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@tf2-automatic/tf2-format",
3
+ "version": "8.0.0",
4
+ "dependencies": {
5
+ "tslib": "^2.7.0",
6
+ "protobufjs": "^7.4.0"
7
+ },
8
+ "main": "./src/index.js",
9
+ "type": "commonjs",
10
+ "types": "./src/index.d.ts"
11
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from './lib/types';
2
+ export * from './lib/parsing';
3
+ export * from './lib/sku';
package/src/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib/types"), exports);
5
+ tslib_1.__exportStar(require("./lib/parsing"), exports);
6
+ tslib_1.__exportStar(require("./lib/sku"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/tf2-format/src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,wDAA8B;AAC9B,oDAA0B"}
@@ -0,0 +1,43 @@
1
+ import { Parser } from '../parser';
2
+ import { EconParserSchema, InventoryItem } from '../../types';
3
+ import { DescriptionAttributes, EconItem, ExtractedEconItem, TagAttributes } from './types';
4
+ declare enum IdentifiableDescription {
5
+ Skip = 0,
6
+ All = 1,
7
+ Paint = 1,
8
+ Spells = 1,
9
+ Parts = 1,
10
+ Effect = 2,
11
+ Festivized = 3,
12
+ Killstreaker = 4,
13
+ Sheen = 5,
14
+ Killstreak = 6,
15
+ Texture = 7,
16
+ Input = 8,
17
+ Output = 9,
18
+ Target = 10,
19
+ Uses = 11,
20
+ Craftable = 12
21
+ }
22
+ export declare class EconParser extends Parser<EconParserSchema, EconItem, ExtractedEconItem> {
23
+ extract(item: EconItem): ExtractedEconItem;
24
+ parse(raw: ExtractedEconItem): Promise<InventoryItem>;
25
+ private getPartByScoreType;
26
+ private getInputByName;
27
+ private fetchInputByName;
28
+ static getDefindex(item: EconItem): number | null;
29
+ static getKillstreak(descriptions: DescriptionAttributes): number;
30
+ static getCrateSeries(tags: TagAttributes, item: EconItem): number | null;
31
+ static getTagAttributes(item: EconItem): TagAttributes;
32
+ static isAustralium(item: EconItem, tags: TagAttributes): boolean;
33
+ /**
34
+ * This function tries to extract as much useful information as possible from
35
+ * the descriptions of an item.
36
+ * @param item The item to extract the information from
37
+ * @param tags The tags of the item
38
+ * @param start The description to start from
39
+ * @returns An object with the extracted information
40
+ */
41
+ static getDescriptionAttributes(item: EconItem, tags: TagAttributes, start?: IdentifiableDescription): DescriptionAttributes;
42
+ }
43
+ export * from './types';