@juice789/tf2items 1.0.28 → 1.0.30

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/app.js CHANGED
@@ -14,7 +14,7 @@ const { createApi, api } = require('./api.js')
14
14
  const sagas = require('./sagas.js')
15
15
  const { saveSchema } = require('./saveSchema.js')
16
16
 
17
- const { fromEconItem } = require('./fromEconItem.js')
17
+ const { fromEconItem, fromEconItemOptions } = require('./fromEconItem.js')
18
18
  const { fromListingV1 } = require('./fromListingV1.js')
19
19
  const { fromListingV2 } = require('./fromListingV2.js')
20
20
  const { blanketify } = require('./blanket.js')
@@ -49,6 +49,7 @@ module.exports = {
49
49
  createApi,
50
50
  api,
51
51
  fromEconItem,
52
+ fromEconItemOptions,
52
53
  fromListingV1,
53
54
  fromListingV2,
54
55
  blanketify,
package/fromEconItem.js CHANGED
@@ -36,12 +36,16 @@ const {
36
36
  path,
37
37
  equals,
38
38
  pick,
39
- assocPath
39
+ assocPath,
40
+ isEmpty,
41
+ join,
42
+ filter,
43
+ omit
40
44
  } = require('ramda')
41
45
 
42
46
  const { safeItems: items } = require('./schemaItems.js')
43
47
  const { particleEffects, textures } = require('./schema.json')
44
- const { qualityNames, wears } = require('./schemaHelper.json')
48
+ const { qualityNames, wears, paintDefindex, spellDefindex } = require('./schemaHelper.json')
45
49
  const { skuFromItem } = require('./sku.js')
46
50
  const { renameKeys } = require('ramda-adjunct')
47
51
 
@@ -63,23 +67,15 @@ const findTag = uncurryN(2, (tagName) => compose(
63
67
  propOr([], 'tags')
64
68
  ))
65
69
 
66
- const old_id = ifElse(
67
- has('new_assetid'),
68
- prop('assetid'),
69
- always(null)
70
- )
70
+ const old_id = ({ new_assetid, rollback_new_assetid, assetid }) => (new_assetid || rollback_new_assetid) ? assetid : null
71
71
 
72
- const id = chain(
73
- propOr(__, 'new_assetid'),
74
- prop('assetid')
75
- )
72
+ const id = ({ new_assetid, rollback_new_assetid, assetid }) => new_assetid || rollback_new_assetid || assetid
76
73
 
77
74
  const recipe = compose(
78
75
  find(__, ['Fabricator', 'Strangifier Chemistry Set', 'Chemistry Set']),
79
76
  flip(marketHashIncludes),
80
77
  )
81
78
 
82
-
83
79
  const series = ifElse(
84
80
  compose(equals('Crate'), findTag('Type')),
85
81
  ifElse(
@@ -185,6 +181,24 @@ const uncraftable = compose(
185
181
  propOr([], 'descriptions')
186
182
  )
187
183
 
184
+ const paintOptions = Object.keys(paintDefindex).map(paintName => `Paint Color: ${paintName}`)
185
+
186
+ const paintColor = compose(
187
+ when(Boolean, ({ value }) => paintDefindex[value.split('Paint Color: ')[1]]),
188
+ find(compose(includes(__, paintOptions), prop('value'))),
189
+ propOr([], 'descriptions')
190
+ )
191
+
192
+ const spellOptions = Object.keys(spellDefindex).map(spellName => `Halloween: ${spellName} (spell only active during event)`)
193
+
194
+ const halloweenSpell = compose(
195
+ when(isEmpty, always(null)),
196
+ join('_'),
197
+ map(({ value }) => spellDefindex[value.split('Halloween: ')[1].replace(' (spell only active during event)', '')]),
198
+ filter(compose(includes(__, spellOptions), prop('value'))),
199
+ propOr([], 'descriptions')
200
+ )
201
+
188
202
  const market_hash_name = prop('market_hash_name')
189
203
 
190
204
  const setQuality = when(
@@ -213,6 +227,8 @@ const propsTf2_1 = {
213
227
  series,
214
228
  craft,
215
229
  recipe,
230
+ halloweenSpell,
231
+ paintColor,
216
232
  id,
217
233
  old_id
218
234
  }
@@ -305,16 +321,12 @@ const keyRemap = when(
305
321
  String,
306
322
  prop('defindex')
307
323
  ),
308
- compose(
309
- assoc('defindex', '5021'),
310
- assoc('uncraftable', false)
311
- )
324
+ assoc('defindex', '5021')
312
325
  )
313
326
 
314
- //725 tour of duty ticket
315
- const uncraftRemap = when(
327
+ const uncraftRemap = (uncraftRemapDefindex) => when(
316
328
  compose(
317
- includes(__, ['725']),
329
+ includes(__, uncraftRemapDefindex),
318
330
  String,
319
331
  prop('defindex')
320
332
  ),
@@ -344,35 +356,43 @@ const otherRemap = when(
344
356
  chain(assoc('defindex'), compose(prop(__, otherIndex), prop('defindex')))
345
357
  )
346
358
 
347
- const remaps = compose(
348
- kitRemap,
349
- keyRemap,
350
- uncraftRemap,
351
- otherRemap
352
- )
359
+ const defaultOptions440 = {
360
+ omitProps: ['paintColor', 'halloweenSpell'],
361
+ uncraftRemapDefindex: ['5021']
362
+ }
353
363
 
354
- const fromEconItem440 = compose(
364
+ const fromEconItem440 = ({ omitProps = [], uncraftRemapDefindex = [] } = defaultOptions440) => compose(
355
365
  pick(['sku', 'id', 'old_id']),
356
366
  chain(assoc('sku'), skuFromItem),
357
- remaps,
367
+ uncraftRemap(uncraftRemapDefindex),
368
+ kitRemap,
369
+ keyRemap,
370
+ otherRemap,
358
371
  chain(mergeRight, compose(map(__, propsTf2_2), applyTo)),
359
- map(__, propsTf2_1),
372
+ map(__, omit(omitProps, propsTf2_1)),
360
373
  unary(applyTo),
361
374
  setQuality
362
375
  )
363
376
 
364
- const fromEconItemOther = compose(
377
+ const fromEconItemOther = (options = {}) => compose(
365
378
  map(__, propsOtherGame),
366
379
  unary(applyTo)
367
380
  )
368
381
 
369
382
  const fromEconItem = ifElse(
370
383
  propEq(440, 'appid'),
371
- fromEconItem440,
372
- fromEconItemOther
384
+ fromEconItem440(),
385
+ fromEconItemOther()
373
386
  )
374
387
 
388
+ const fromEconItemOptions = curry((options, econItem) => ifElse(
389
+ propEq(440, 'appid'),
390
+ fromEconItem440(options),
391
+ fromEconItemOther(options)
392
+ )(econItem))
393
+
375
394
  module.exports = {
376
395
  fromEconItem,
396
+ fromEconItemOptions,
377
397
  kitRemap
378
398
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juice789/tf2items",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "tf2 item schema thingys",
5
5
  "main": "app.js",
6
6
  "scripts": {
package/schemaHelper.json CHANGED
@@ -91,6 +91,151 @@
91
91
  "supply_crate": "supply_crate",
92
92
  "tool": "tool"
93
93
  },
94
+ "paintHex": {
95
+ "5027": [
96
+ "729E42"
97
+ ],
98
+ "5028": [
99
+ "424F3B"
100
+ ],
101
+ "5029": [
102
+ "51384A"
103
+ ],
104
+ "5030": [
105
+ "D8BED8"
106
+ ],
107
+ "5031": [
108
+ "7D4071"
109
+ ],
110
+ "5032": [
111
+ "CF7336"
112
+ ],
113
+ "5033": [
114
+ "A57545"
115
+ ],
116
+ "5034": [
117
+ "C5AF91"
118
+ ],
119
+ "5035": [
120
+ "694D3A"
121
+ ],
122
+ "5036": [
123
+ "7C6C57"
124
+ ],
125
+ "5037": [
126
+ "E7B53B"
127
+ ],
128
+ "5038": [
129
+ "7E7E7E"
130
+ ],
131
+ "5039": [
132
+ "E6E6E6"
133
+ ],
134
+ "5040": [
135
+ "141414"
136
+ ],
137
+ "5046": [
138
+ "B8383B",
139
+ "5885A2"
140
+ ],
141
+ "5051": [
142
+ "FF69B4"
143
+ ],
144
+ "5052": [
145
+ "2F4F4F"
146
+ ],
147
+ "5053": [
148
+ "808000"
149
+ ],
150
+ "5054": [
151
+ "32CD32"
152
+ ],
153
+ "5055": [
154
+ "F0E68C"
155
+ ],
156
+ "5056": [
157
+ "E9967A"
158
+ ],
159
+ "5060": [
160
+ "483838",
161
+ "384248"
162
+ ],
163
+ "5061": [
164
+ "A89A8C",
165
+ "839FA3"
166
+ ],
167
+ "5062": [
168
+ "3B1F23",
169
+ "18233D"
170
+ ],
171
+ "5063": [
172
+ "654740",
173
+ "28394D"
174
+ ],
175
+ "5064": [
176
+ "803020",
177
+ "256D8D"
178
+ ],
179
+ "5065": [
180
+ "C36C2D",
181
+ "B88035"
182
+ ],
183
+ "5076": [
184
+ "BCDDB3"
185
+ ],
186
+ "5077": [
187
+ "2D2D24"
188
+ ]
189
+ },
190
+ "paintDefindex": {
191
+ "Indubitably Green": "5027",
192
+ "Zepheniah's Greed": "5028",
193
+ "Noble Hatter's Violet": "5029",
194
+ "Color No. 216-190-216": "5030",
195
+ "A Deep Commitment to Purple": "5031",
196
+ "Mann Co. Orange": "5032",
197
+ "Muskelmannbraun": "5033",
198
+ "Peculiarly Drab Tincture": "5034",
199
+ "Radigan Conagher Brown": "5035",
200
+ "Ye Olde Rustic Colour": "5036",
201
+ "Australium Gold": "5037",
202
+ "Aged Moustache Grey": "5038",
203
+ "An Extraordinary Abundance of Tinge": "5039",
204
+ "A Distinctive Lack of Hue": "5040",
205
+ "Team Spirit": "5046",
206
+ "Pink as Hell": "5051",
207
+ "A Color Similar to Slate": "5052",
208
+ "Drably Olive": "5053",
209
+ "The Bitter Taste of Defeat and Lime": "5054",
210
+ "The Color of a Gentlemann's Business Pants": "5055",
211
+ "Dark Salmon Injustice": "5056",
212
+ "Operator's Overalls": "5060",
213
+ "Waterlogged Lab Coat": "5061",
214
+ "Balaclavas Are Forever": "5062",
215
+ "An Air of Debonair": "5063",
216
+ "The Value of Teamwork": "5064",
217
+ "Cream Spirit": "5065",
218
+ "A Mann's Mint": "5076",
219
+ "After Eight": "5077"
220
+ },
221
+ "spellDefindex": {
222
+ "Halloween Fire": "8925",
223
+ "Pumpkin Bombs": "8922",
224
+ "Exorcism": "8921",
225
+ "Headless Horseshoes": "8920",
226
+ "Bruised Purple Footprints": "8919",
227
+ "Rotten Orange Footprints": "8918",
228
+ "Violent Violet Footprints": "8917",
229
+ "Corpse Gray Footprints": "8916",
230
+ "Gangreen Footprints": "8915",
231
+ "Team Spirit Footprints": "8914",
232
+ "Voices from Below": "8906",
233
+ "Sinister Staining": "8904",
234
+ "Spectral Spectrum": "8903",
235
+ "Chromatic Corruption": "8902",
236
+ "Die Job": "8901",
237
+ "Putrescent Pigmentation": "8900"
238
+ },
94
239
  "cosmeticCollections": [
95
240
  "Gun Mettle Cosmetics Collection",
96
241
  "Quarantined Collection Case",
package/sku.js CHANGED
@@ -32,7 +32,9 @@ const skuFromItem = ({
32
32
  wear,
33
33
  australium,
34
34
  series,
35
- craft
35
+ craft,
36
+ paintColor,
37
+ halloweenSpell
36
38
  }) => [
37
39
  defindex,
38
40
  quality,
@@ -49,6 +51,8 @@ const skuFromItem = ({
49
51
  ['1', true].includes(australium) && 'australium',
50
52
  series && isNaN(series) === false && 'c-' + parseInt(series),
51
53
  craft && isNaN(craft) === false && 'no-' + parseInt(craft),
54
+ paintColor && 'pc-' + paintColor,
55
+ halloweenSpell && 'hs-' + halloweenSpell
52
56
  ].filter(Boolean).join(';')
53
57
 
54
58
  const rules = {
@@ -64,7 +68,9 @@ const rules = {
64
68
  w: "wear",
65
69
  australium: 'australium',
66
70
  c: "series",
67
- no: "craft"
71
+ no: "craft",
72
+ pc: "paintColor",
73
+ hs: "halloweenSpell"
68
74
  }
69
75
 
70
76
  const decodeRules = compose(