@tf2-automatic/tf2-format 8.1.0 → 8.2.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 +4 -0
- package/package.json +2 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/naming/index.d.ts +6 -0
- package/src/lib/naming/index.js +134 -0
- package/src/lib/naming/index.js.map +1 -0
- package/src/lib/types.d.ts +89 -3
package/README.md
CHANGED
|
@@ -17,3 +17,7 @@ For parsing items, e.g. econ items from inventories and trades, or TF2 items fro
|
|
|
17
17
|
### SKU
|
|
18
18
|
|
|
19
19
|
For working with SKUs, use the [SKU](./src/lib/sku) class.
|
|
20
|
+
|
|
21
|
+
### Generating names
|
|
22
|
+
|
|
23
|
+
For generating the name of items, use the [NameGenerator](./src/lib/naming) class.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tf2-automatic/tf2-format",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.7.0",
|
|
6
6
|
"protobufjs": "^7.4.0"
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/tf2-automatic/tf2-automatic.git"
|
|
12
12
|
},
|
|
13
|
+
"license": "MIT",
|
|
13
14
|
"types": "./src/index.d.ts",
|
|
14
15
|
"main": "./src/index.js",
|
|
15
16
|
"type": "commonjs"
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -4,4 +4,5 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
tslib_1.__exportStar(require("./lib/types"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./lib/parsing"), exports);
|
|
6
6
|
tslib_1.__exportStar(require("./lib/sku"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./lib/naming"), exports);
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/tf2-format/src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,wDAA8B;AAC9B,oDAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/tf2-format/src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,wDAA8B;AAC9B,oDAA0B;AAC1B,uDAA6B"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NameGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const KILLSTREAKS = [
|
|
6
|
+
'Killstreak',
|
|
7
|
+
'Specialized Killstreak',
|
|
8
|
+
'Professional Killstreak',
|
|
9
|
+
];
|
|
10
|
+
const WEAR = [
|
|
11
|
+
'Factory New',
|
|
12
|
+
'Minimal Wear',
|
|
13
|
+
'Field-Tested',
|
|
14
|
+
'Well-Worn',
|
|
15
|
+
'Battle Scarred',
|
|
16
|
+
];
|
|
17
|
+
class NameGenerator {
|
|
18
|
+
constructor(schema) {
|
|
19
|
+
this.schema = schema;
|
|
20
|
+
}
|
|
21
|
+
getName(item_1) {
|
|
22
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* (item, proper = true) {
|
|
23
|
+
let name = '';
|
|
24
|
+
let schemaItem = this.schema.getItemByDefindex(item.defindex);
|
|
25
|
+
if (schemaItem === undefined) {
|
|
26
|
+
schemaItem = yield this.schema.fetchItemByDefindex(item.defindex);
|
|
27
|
+
}
|
|
28
|
+
else if (schemaItem instanceof Error) {
|
|
29
|
+
throw schemaItem;
|
|
30
|
+
}
|
|
31
|
+
if (item.tradable === false) {
|
|
32
|
+
name += 'Non-Tradable ';
|
|
33
|
+
}
|
|
34
|
+
if (item.craftable === false) {
|
|
35
|
+
name += 'Non-Craftable ';
|
|
36
|
+
}
|
|
37
|
+
if (item.elevated === true) {
|
|
38
|
+
let quality = this.schema.getQualityById(11);
|
|
39
|
+
if (quality === undefined) {
|
|
40
|
+
quality = yield this.schema.fetchQualityById(11);
|
|
41
|
+
}
|
|
42
|
+
else if (quality instanceof Error) {
|
|
43
|
+
throw quality;
|
|
44
|
+
}
|
|
45
|
+
name += quality + ' ';
|
|
46
|
+
}
|
|
47
|
+
if ((item.quality === 6 && item.elevated === true) ||
|
|
48
|
+
(item.quality !== 6 && item.quality !== 15 && item.quality !== 5) ||
|
|
49
|
+
(item.quality === 5 && !item.effect) ||
|
|
50
|
+
schemaItem.item_quality == 5) {
|
|
51
|
+
let quality = this.schema.getQualityById(item.quality);
|
|
52
|
+
if (quality === undefined) {
|
|
53
|
+
quality = yield this.schema.fetchQualityById(item.quality);
|
|
54
|
+
}
|
|
55
|
+
else if (quality instanceof Error) {
|
|
56
|
+
throw quality;
|
|
57
|
+
}
|
|
58
|
+
name += quality + ' ';
|
|
59
|
+
}
|
|
60
|
+
if (item.effect) {
|
|
61
|
+
let effect = this.schema.getEffectById(item.effect);
|
|
62
|
+
if (effect === undefined) {
|
|
63
|
+
effect = yield this.schema.fetchEffectById(item.effect);
|
|
64
|
+
}
|
|
65
|
+
else if (effect instanceof Error) {
|
|
66
|
+
throw effect;
|
|
67
|
+
}
|
|
68
|
+
name += effect + ' ';
|
|
69
|
+
}
|
|
70
|
+
if (item.festivized) {
|
|
71
|
+
name += 'Festivized ';
|
|
72
|
+
}
|
|
73
|
+
if (item.killstreak !== undefined && item.killstreak !== 0) {
|
|
74
|
+
name += KILLSTREAKS[item.killstreak - 1] + ' ';
|
|
75
|
+
}
|
|
76
|
+
if (item.target) {
|
|
77
|
+
let target = this.schema.getItemByDefindex(item.target);
|
|
78
|
+
if (target === undefined) {
|
|
79
|
+
target = yield this.schema.fetchItemByDefindex(item.target);
|
|
80
|
+
}
|
|
81
|
+
else if (target instanceof Error) {
|
|
82
|
+
throw target;
|
|
83
|
+
}
|
|
84
|
+
name += target.item_name + ' ';
|
|
85
|
+
}
|
|
86
|
+
if (item.outputQuality && item.outputQuality !== 6) {
|
|
87
|
+
let quality = this.schema.getQualityById(item.outputQuality);
|
|
88
|
+
if (quality === undefined) {
|
|
89
|
+
quality = yield this.schema.fetchQualityById(item.outputQuality);
|
|
90
|
+
}
|
|
91
|
+
else if (quality instanceof Error) {
|
|
92
|
+
throw quality;
|
|
93
|
+
}
|
|
94
|
+
name += quality + ' ';
|
|
95
|
+
}
|
|
96
|
+
if (item.output) {
|
|
97
|
+
let output = this.schema.getItemByDefindex(item.output);
|
|
98
|
+
if (output === undefined) {
|
|
99
|
+
output = yield this.schema.fetchItemByDefindex(item.output);
|
|
100
|
+
}
|
|
101
|
+
else if (output instanceof Error) {
|
|
102
|
+
throw output;
|
|
103
|
+
}
|
|
104
|
+
name += output.item_name + ' ';
|
|
105
|
+
}
|
|
106
|
+
if (item.australium) {
|
|
107
|
+
name += 'Australium ';
|
|
108
|
+
}
|
|
109
|
+
if (item.paintkit) {
|
|
110
|
+
let paintkit = this.schema.getPaintkitById(item.paintkit);
|
|
111
|
+
if (paintkit === undefined) {
|
|
112
|
+
paintkit = yield this.schema.fetchPaintkitById(item.paintkit);
|
|
113
|
+
}
|
|
114
|
+
else if (paintkit instanceof Error) {
|
|
115
|
+
throw paintkit;
|
|
116
|
+
}
|
|
117
|
+
name += paintkit + ' ';
|
|
118
|
+
}
|
|
119
|
+
if (proper === true && name === '' && schemaItem.proper_name === true) {
|
|
120
|
+
name = 'The ';
|
|
121
|
+
}
|
|
122
|
+
name += schemaItem.item_name;
|
|
123
|
+
if (item.wear) {
|
|
124
|
+
name += ' (' + WEAR[item.wear - 1] + ')';
|
|
125
|
+
}
|
|
126
|
+
if (item.crateSeries) {
|
|
127
|
+
name += ' #' + item.crateSeries;
|
|
128
|
+
}
|
|
129
|
+
return name;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.NameGenerator = NameGenerator;
|
|
134
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/tf2-format/src/lib/naming/index.ts"],"names":[],"mappings":";;;;AAEA,MAAM,WAAW,GAAG;IAClB,YAAY;IACZ,wBAAwB;IACxB,yBAAyB;CAC1B,CAAC;AACF,MAAM,IAAI,GAAG;IACX,aAAa;IACb,cAAc;IACd,cAAc;IACd,WAAW;IACX,gBAAgB;CACjB,CAAC;AAEF,MAAa,aAAa;IACxB,YAA6B,MAAwB;QAAxB,WAAM,GAAN,MAAM,CAAkB;IAAG,CAAC;IAEnD,OAAO;qEAAC,IAA4B,EAAE,MAAM,GAAG,IAAI;YACvD,IAAI,IAAI,GAAG,EAAE,CAAC;YAEd,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC9D,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;gBAC7B,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACpE,CAAC;iBAAM,IAAI,UAAU,YAAY,KAAK,EAAE,CAAC;gBACvC,MAAM,UAAU,CAAC;YACnB,CAAC;YAED,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;gBAC5B,IAAI,IAAI,eAAe,CAAC;YAC1B,CAAC;YAED,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,EAAE,CAAC;gBAC7B,IAAI,IAAI,gBAAgB,CAAC;YAC3B,CAAC;YAED,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAC3B,IAAI,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;gBAC7C,IAAI,O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AE7B,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;gBACd,IAAI,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;YAC3C,CAAC;YAED,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACrB,IAAI,IAAI,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;YAClC,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;CACF;AAnID,sCAmIC"}
|
package/src/lib/types.d.ts
CHANGED
|
@@ -60,7 +60,12 @@ export interface ItemsGameItem {
|
|
|
60
60
|
value: string;
|
|
61
61
|
}>;
|
|
62
62
|
}
|
|
63
|
-
interface
|
|
63
|
+
export interface SchemaItem {
|
|
64
|
+
item_name: string;
|
|
65
|
+
proper_name: boolean;
|
|
66
|
+
item_quality: number;
|
|
67
|
+
}
|
|
68
|
+
interface GetItemsGameItem {
|
|
64
69
|
/**
|
|
65
70
|
* Synchronously get an item by its defindex from items_game.txt.
|
|
66
71
|
* @param defindex The defindex of the item.
|
|
@@ -81,11 +86,92 @@ interface GetItem {
|
|
|
81
86
|
*/
|
|
82
87
|
fetchItemByDefindex(defindex: number): Promise<ItemsGameItem>;
|
|
83
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Various information needs to be retrieved externally to name items.
|
|
91
|
+
* This schema is used to define the getters for this information.
|
|
92
|
+
*/
|
|
93
|
+
export interface ItemNamingSchema {
|
|
94
|
+
/**
|
|
95
|
+
* Syncronously get an item by its defindex from the TF2 GetItemsGame API.
|
|
96
|
+
* @param defindex The defindex of the item.
|
|
97
|
+
* @returns Returns the matching item, undefined if it is not possible to get
|
|
98
|
+
* the item synchronously or an error to exit early.
|
|
99
|
+
* @example schema.getItemByDefindex(5021) -> { item_name: "Mann Co. Supply Crate Key", ... }
|
|
100
|
+
* @example schema.getItemByDefindex(5021) -> undefined
|
|
101
|
+
* @example schema.getItemByDefindex(-1) -> new Error("Item not found")
|
|
102
|
+
*/
|
|
103
|
+
getItemByDefindex(defindex: number): SchemaItem | undefined | Error;
|
|
104
|
+
/**
|
|
105
|
+
* Asynchronously get an item by its defindex from the TF2 GetItemsGame API.
|
|
106
|
+
* @param defindex The defindex of the item.
|
|
107
|
+
* @returns Returns the matching item or throws an error if it was not found.
|
|
108
|
+
* @example schema.fetchItemByDefindex(5021) -> Promise.resolve({ item_name: "Mann Co. Supply Crate Key", ... })
|
|
109
|
+
* @example schema.fetchItemByDefindex(-1) -> Promise.reject(new Error("Item not found"))
|
|
110
|
+
*/
|
|
111
|
+
fetchItemByDefindex(defindex: number): Promise<SchemaItem>;
|
|
112
|
+
/**
|
|
113
|
+
* Syncronously get the name of an item by its defindex.
|
|
114
|
+
* @param id The id of the quality.
|
|
115
|
+
* @returns Returns the name of the quality, undefined if the quality cannot
|
|
116
|
+
* be found syncronously or an error to exit early.
|
|
117
|
+
* @example schema.getQualityById(6) -> "Unique"
|
|
118
|
+
* @example schema.getQualityById(6) -> undefined
|
|
119
|
+
* @example schema.getQualityById(-1) -> new Error("Quality not found")
|
|
120
|
+
*/
|
|
121
|
+
getQualityById(id: number): string | undefined | Error;
|
|
122
|
+
/**
|
|
123
|
+
* Asynchronously get the name of a quality by its id.
|
|
124
|
+
* @param id The id of the quality.
|
|
125
|
+
* @returns Returns the name of the quality or throws an error if the quality
|
|
126
|
+
* cannot be found.
|
|
127
|
+
* @example schema.fetchQualityById(6) -> Promise.resolve("Unique")
|
|
128
|
+
* @example schema.fetchQualityById(-1) -> Promise.reject(new Error("Quality not found"))
|
|
129
|
+
*/
|
|
130
|
+
fetchQualityById(id: number): Promise<string>;
|
|
131
|
+
/**
|
|
132
|
+
* Syncronously get the name of an effect by its id.
|
|
133
|
+
* @param id The id of the effect.
|
|
134
|
+
* @returns Returns the name of the effect, undefined if the effect cannot
|
|
135
|
+
* be found syncronously or an error to exit early.
|
|
136
|
+
* @example schema.getEffectById(13) -> "Burning Flames"
|
|
137
|
+
* @example schema.getEffectById(13) -> undefined
|
|
138
|
+
* @example schema.getEffectById(-1) -> new Error("Effect not found")
|
|
139
|
+
*/
|
|
140
|
+
getEffectById(id: number): string | undefined | Error;
|
|
141
|
+
/**
|
|
142
|
+
* Asynchronously get the name of an effect by its id.
|
|
143
|
+
* @param id The id of the effect.
|
|
144
|
+
* @returns Returns the name of the effect or throws an error if the effect
|
|
145
|
+
* cannot be found.
|
|
146
|
+
* @example schema.fetchEffectById(13) -> Promise.resolve("Burning Flames")
|
|
147
|
+
* @example schema.fetchEffectById(-1) -> Promise.reject(new Error("Effect not found"))
|
|
148
|
+
*/
|
|
149
|
+
fetchEffectById(id: number): Promise<string>;
|
|
150
|
+
/**
|
|
151
|
+
* Syncronously get the name of a texture by its id.
|
|
152
|
+
* @param id The id of the texture.
|
|
153
|
+
* @returns Returns the name of the texture, undefined if the texture cannot
|
|
154
|
+
* be found syncronously or an error to exit early.
|
|
155
|
+
* @example schema.getTextureById(14) -> "Night Owl"
|
|
156
|
+
* @example schema.getTextureById(14) -> undefined
|
|
157
|
+
* @example schema.getTextureById(-1) -> new Error("Texture not found")
|
|
158
|
+
*/
|
|
159
|
+
getPaintkitById(id: number): string | undefined | Error;
|
|
160
|
+
/**
|
|
161
|
+
* Asynchronously get the name of a texture by its id.
|
|
162
|
+
* @param id The id of the texture.
|
|
163
|
+
* @returns Returns the name of the texture or throws an error if the texture
|
|
164
|
+
* cannot be found.
|
|
165
|
+
* @example schema.fetchTextureById(14) -> Promise.resolve("Night Owl")
|
|
166
|
+
* @example schema.fetchTextureById(-1) -> Promise.reject(new Error("Texture not found"))
|
|
167
|
+
*/
|
|
168
|
+
fetchPaintkitById(id: number): Promise<string>;
|
|
169
|
+
}
|
|
84
170
|
/**
|
|
85
171
|
* Various information needs to be retrieved externally to format the Econ items.
|
|
86
172
|
* This schema is used to define the getters for this information.
|
|
87
173
|
*/
|
|
88
|
-
export interface EconParserSchema extends
|
|
174
|
+
export interface EconParserSchema extends GetItemsGameItem {
|
|
89
175
|
/**
|
|
90
176
|
* Syncronously get the defindex of an item by its `item_name` using the
|
|
91
177
|
* GetSchemaItems API.
|
|
@@ -249,7 +335,7 @@ export interface EconParserSchema extends GetItem {
|
|
|
249
335
|
* Various information needs to be retrieved externally to format the TF2 items.
|
|
250
336
|
* This schema is used to define the getters for this information.
|
|
251
337
|
*/
|
|
252
|
-
export interface TF2ParserSchema extends
|
|
338
|
+
export interface TF2ParserSchema extends GetItemsGameItem {
|
|
253
339
|
getSpellById(defindex: number, id: number): number | undefined | Error;
|
|
254
340
|
/**
|
|
255
341
|
* Asynchronously get the defindex of a spell by the attribute defindex and value.
|