@juice789/tf2items 1.0.1 → 1.0.4
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/api.js +4 -1
- package/app.js +4 -1
- package/blanket.js +10 -6
- package/options.json +1 -3
- package/package.json +1 -1
- package/sku.js +3 -3
- package/skuLinks.js +177 -0
package/api.js
CHANGED
package/app.js
CHANGED
|
@@ -8,8 +8,9 @@ const sagaHelpers = require('./sagaHelpers')
|
|
|
8
8
|
const items = require('./schemaItems.js')
|
|
9
9
|
const sku = require('./sku.js')
|
|
10
10
|
const skuBp = require('./skuBp.js')
|
|
11
|
+
const skuLinks = require('./skuLinks.js')
|
|
11
12
|
|
|
12
|
-
const createApi = require('./api.js')
|
|
13
|
+
const { createApi, api } = require('./api.js')
|
|
13
14
|
|
|
14
15
|
const sagas = require('./sagas.js')
|
|
15
16
|
const { saveSchemaSaga } = require('./saveSchema.js')
|
|
@@ -43,9 +44,11 @@ module.exports = {
|
|
|
43
44
|
...skuBp,
|
|
44
45
|
...sagas,
|
|
45
46
|
...sagaHelpers,
|
|
47
|
+
...skuLinks,
|
|
46
48
|
saveSchemaSaga,
|
|
47
49
|
getInstance,
|
|
48
50
|
createApi,
|
|
51
|
+
api,
|
|
49
52
|
fromEconItem,
|
|
50
53
|
fromListingV1,
|
|
51
54
|
fromListingV2,
|
package/blanket.js
CHANGED
|
@@ -24,7 +24,8 @@ const {
|
|
|
24
24
|
concat,
|
|
25
25
|
of,
|
|
26
26
|
unnest,
|
|
27
|
-
pick
|
|
27
|
+
pick,
|
|
28
|
+
mergeRight
|
|
28
29
|
} = require('ramda')
|
|
29
30
|
const { renameKeys } = require('ramda-adjunct')
|
|
30
31
|
|
|
@@ -101,17 +102,20 @@ const remaps = compose(
|
|
|
101
102
|
|
|
102
103
|
const propListDefault = ['killstreakTier', 'elevated', 'festivized', 'effect', 'texture', 'wear', 'craft', 'series']
|
|
103
104
|
|
|
104
|
-
const blanketify = uncurryN(3, (propList, skus,
|
|
105
|
-
map(
|
|
106
|
-
|
|
105
|
+
const blanketify = uncurryN(3, (propList, skus, item) => compose(
|
|
106
|
+
map(compose(
|
|
107
|
+
mergeRight(item),//merge the props with the item, keeping the assetid for use later
|
|
108
|
+
pick(['sku', 'originalSku']),
|
|
109
|
+
renameKeys({ _sku: 'sku', sku: 'originalSku' })//reset the sku, save the original sku
|
|
110
|
+
)),
|
|
107
111
|
filter(compose(includes(__, skus), prop('_sku'))),//find every new combination in the sku list
|
|
108
112
|
map(chain(assoc('_sku'), skuFromItem)),//save the new sku
|
|
109
113
|
unnest,
|
|
110
114
|
map(remaps),//decode defindices that are not possible anymore
|
|
111
|
-
map(omit(__, itemFromSku(sku))),//create items from the combinations
|
|
115
|
+
map(omit(__, itemFromSku(item.sku))),//create items from the combinations
|
|
112
116
|
concat([[]]),//create the last combination where no prop is removed. If the skus includes the sku we can return it.
|
|
113
117
|
chain(compose(getCombos(0), length), identity),//create every possible combination
|
|
114
|
-
filter(compose(Boolean, prop(__, itemFromSku(sku))))//remove every prop from proplist that is not present in the item
|
|
118
|
+
filter(compose(Boolean, prop(__, itemFromSku(item.sku))))//remove every prop from proplist that is not present in the item
|
|
115
119
|
)(propList || propListDefault))
|
|
116
120
|
|
|
117
121
|
module.exports = {
|
package/options.json
CHANGED
package/package.json
CHANGED
package/sku.js
CHANGED
|
@@ -113,7 +113,7 @@ const getName = ({
|
|
|
113
113
|
craft && '#' + craft,
|
|
114
114
|
uncraftable && 'Non-Craftable',
|
|
115
115
|
elevated && 'Strange',
|
|
116
|
-
quality && !['6', '15'].includes(quality.toString()) && (qualityBpStyle ? effect : true) && qualityNames[quality],
|
|
116
|
+
quality && !['6', '15'].includes(quality.toString()) && (qualityBpStyle ? !effect : true) && qualityNames[quality],
|
|
117
117
|
oq && oq.toString() !== '6' && qualityNames[oq],
|
|
118
118
|
target && killstreakTier && killstreakTiers[killstreakTier],
|
|
119
119
|
target && safeItems[target].item_name,
|
|
@@ -129,9 +129,9 @@ const getName = ({
|
|
|
129
129
|
series && '#' + series
|
|
130
130
|
].filter(Boolean).join(' ')
|
|
131
131
|
|
|
132
|
-
const itemNameFromSku = (sku) => {
|
|
132
|
+
const itemNameFromSku = (sku, ...params) => {
|
|
133
133
|
const item = itemFromSku(sku)
|
|
134
|
-
return getName(item)
|
|
134
|
+
return getName(item, ...params)
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
module.exports = {
|
package/skuLinks.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
const {
|
|
2
|
+
itemFromSku
|
|
3
|
+
} = require('./sku.js')
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
toBpQuality,
|
|
7
|
+
toBpName,
|
|
8
|
+
toBpPriceIndex
|
|
9
|
+
} = require('./skuBp.js')
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
qualityNames,
|
|
13
|
+
killstreakTiers,
|
|
14
|
+
wears
|
|
15
|
+
} = require('./schemaHelper.json')
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
safeItems: items
|
|
19
|
+
} = require('./schemaItems.js')
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
particleEffects,
|
|
23
|
+
textures
|
|
24
|
+
} = require('./schema.json')
|
|
25
|
+
|
|
26
|
+
const manncoUrl = (sku) => {
|
|
27
|
+
const {
|
|
28
|
+
defindex,
|
|
29
|
+
quality,
|
|
30
|
+
uncraftable,
|
|
31
|
+
killstreakTier,
|
|
32
|
+
target,
|
|
33
|
+
output,
|
|
34
|
+
oq,
|
|
35
|
+
elevated,
|
|
36
|
+
festivized,
|
|
37
|
+
texture,
|
|
38
|
+
wear,
|
|
39
|
+
australium,
|
|
40
|
+
series,
|
|
41
|
+
effect
|
|
42
|
+
} = itemFromSku(sku)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
const chemSeries = {
|
|
46
|
+
20000: 1,
|
|
47
|
+
20005: 2
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const manncoUrl = [
|
|
51
|
+
440,
|
|
52
|
+
uncraftable && 'uncraftable',
|
|
53
|
+
oq && oq !== '6' && qualityNames[oq],
|
|
54
|
+
effect && particleEffects[effect],
|
|
55
|
+
elevated && 'strange',
|
|
56
|
+
['6', '15'].includes(quality) === false && qualityNames[quality],
|
|
57
|
+
festivized && 'festivized',
|
|
58
|
+
killstreakTier && killstreakTiers[killstreakTier],
|
|
59
|
+
australium && 'australium',
|
|
60
|
+
texture && textures[texture],
|
|
61
|
+
target && items[target].item_name,
|
|
62
|
+
output && items[output].item_name,
|
|
63
|
+
items[defindex].item_name.replace('\\n', ' '),
|
|
64
|
+
wear && wears[wear],
|
|
65
|
+
chemSeries[defindex] && 'series-' + chemSeries[defindex],
|
|
66
|
+
series && (!items[defindex].seriesHidden || ['111', '112', '113', '114', '115', '116'].includes(series)) && 'series-' + series
|
|
67
|
+
].filter(Boolean).join('-').replaceAll(/[^0-9a-zA-Z -]/g, '').replaceAll(' ', '-').toLowerCase()
|
|
68
|
+
|
|
69
|
+
return 'https://mannco.store/item/' + manncoUrl
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const scmUrl = (sku) => {
|
|
73
|
+
|
|
74
|
+
const {
|
|
75
|
+
defindex,
|
|
76
|
+
quality,
|
|
77
|
+
killstreakTier,
|
|
78
|
+
target,
|
|
79
|
+
output,
|
|
80
|
+
oq,
|
|
81
|
+
elevated,
|
|
82
|
+
festivized,
|
|
83
|
+
texture,
|
|
84
|
+
wear,
|
|
85
|
+
australium,
|
|
86
|
+
series
|
|
87
|
+
} = itemFromSku(sku)
|
|
88
|
+
|
|
89
|
+
const chemSeries = {
|
|
90
|
+
20000: 1,
|
|
91
|
+
20005: 2
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const scmUrl = [
|
|
95
|
+
oq && oq !== '6' && qualityNames[oq],
|
|
96
|
+
elevated && 'Strange',
|
|
97
|
+
!['6', '15'].includes(quality) && qualityNames[quality],
|
|
98
|
+
festivized && 'Festivized',
|
|
99
|
+
killstreakTier && killstreakTiers[killstreakTier],
|
|
100
|
+
australium && 'Australium',
|
|
101
|
+
texture && textures[texture],
|
|
102
|
+
target && items[target].item_name,
|
|
103
|
+
output && items[output].item_name,
|
|
104
|
+
items[defindex].item_name,
|
|
105
|
+
wear && '(' + wears[wear] + ')',
|
|
106
|
+
chemSeries[defindex] && 'Series%20%23' + chemSeries[defindex],
|
|
107
|
+
series && !items[defindex].seriesHidden && 'Series%20%23' + series
|
|
108
|
+
].filter(Boolean).join(' ')
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
return 'https://steamcommunity.com/market/listings/440/' + scmUrl
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const bpUrl = (sku) => {
|
|
115
|
+
|
|
116
|
+
const {
|
|
117
|
+
uncraftable
|
|
118
|
+
} = itemFromSku(sku)
|
|
119
|
+
|
|
120
|
+
const bpUrl = [
|
|
121
|
+
toBpQuality(sku),
|
|
122
|
+
toBpName(sku),
|
|
123
|
+
'Tradable',
|
|
124
|
+
uncraftable === true ? 'Non-Craftable' : 'Craftable',
|
|
125
|
+
toBpPriceIndex(sku)
|
|
126
|
+
].filter(Boolean).join('/').replace('%', '%25').replace('%250A', '%0A')
|
|
127
|
+
|
|
128
|
+
return 'https://backpack.tf/stats/' + bpUrl
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const marketplaceUrl = (sku) => {
|
|
132
|
+
const {
|
|
133
|
+
defindex,
|
|
134
|
+
quality,
|
|
135
|
+
uncraftable,
|
|
136
|
+
killstreakTier,
|
|
137
|
+
target,
|
|
138
|
+
output,
|
|
139
|
+
oq,
|
|
140
|
+
elevated,
|
|
141
|
+
festivized,
|
|
142
|
+
texture,
|
|
143
|
+
wear,
|
|
144
|
+
australium,
|
|
145
|
+
series,
|
|
146
|
+
craft,
|
|
147
|
+
effect
|
|
148
|
+
} = itemFromSku(sku)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
const marketplaceSku = [
|
|
152
|
+
defindex,
|
|
153
|
+
quality,
|
|
154
|
+
effect && 'u' + effect,
|
|
155
|
+
wear && 'w' + wear,
|
|
156
|
+
texture && 'pk' + texture,
|
|
157
|
+
elevated && 'strange',
|
|
158
|
+
series && 'c' + series,
|
|
159
|
+
craft && 'n' + craft,
|
|
160
|
+
uncraftable && 'uncraftable',
|
|
161
|
+
australium && 'australium',
|
|
162
|
+
killstreakTier && 'kt-' + killstreakTier,
|
|
163
|
+
festivized && 'festive',
|
|
164
|
+
target && 'td-' + target,
|
|
165
|
+
output && 'od-' + output,
|
|
166
|
+
oq && 'oq-' + oq
|
|
167
|
+
].filter(Boolean).join(';')
|
|
168
|
+
|
|
169
|
+
return 'https://marketplace.tf/items/tf2/' + marketplaceSku
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
module.exports = {
|
|
173
|
+
manncoUrl,
|
|
174
|
+
marketplaceUrl,
|
|
175
|
+
bpUrl,
|
|
176
|
+
scmUrl
|
|
177
|
+
}
|