@@ -210,10 +210,9 @@ class Postgres {
210
210
buf . writeFloatBE ( item . floatvalue , 0 ) ;
211
211
item . paintwear = buf . readInt32BE ( 0 ) ;
212
212
213
- if ( item . floatvalue <= 0 && item . defindex !== 507 && item . defindex !== 1355 ) {
214
- // Only insert weapons and keychains, naive check
215
- // Special case for the 0 float Karambit and keychains.
216
- // The keychains has a unique pattern
213
+ if ( item . floatvalue <= 0 && item . defindex !== 507 ) {
214
+ // Only insert weapons, naive check
215
+ // Special case for the 0 float Karambit
217
216
continue ;
218
217
}
219
218
@@ -253,11 +252,17 @@ class Postgres {
253
252
254
253
const keychains = item . keychains . length > 0 ? item . keychains . map ( ( s ) => {
255
254
const res = { s : s . slot , i : s . sticker_id } ;
256
- if ( s . pattern ) {
257
- res . pattern = s . pattern ;
255
+ if ( s . wear ) {
256
+ res . w = s . wear ;
257
+ }
258
+ if ( s . scale ) {
259
+ res . scale = s . scale ;
260
+ }
261
+ if ( s . rotation ) {
262
+ res . r = s . rotation ;
258
263
}
259
- if ( s . name ) {
260
- res . name = s . name ;
264
+ if ( s . tint_id ) {
265
+ res . tint_id = s . tint_id ;
261
266
}
262
267
if ( s . offset_x ) {
263
268
res . x = s . offset_x ;
@@ -268,6 +273,9 @@ class Postgres {
268
273
if ( s . offset_z ) {
269
274
res . z = s . offset_z ;
270
275
}
276
+ if ( s . pattern ) {
277
+ res . pattern = s . pattern ;
278
+ }
271
279
return res ;
272
280
} ) : null ;
273
281
@@ -288,7 +296,7 @@ class Postgres {
288
296
}
289
297
290
298
values . push ( [ ms , item . a , item . d , item . paintseed , item . paintwear , item . defindex , item . paintindex , isStattrak ,
291
- isSouvenir , props , JSON . stringify ( stickers ) , item . rarity , price , JSON . stringify ( keychains ) ] ) ;
299
+ isSouvenir , props , JSON . stringify ( stickers ) , JSON . stringify ( keychains ) , item . rarity , price ] ) ;
292
300
}
293
301
294
302
if ( values . length === 0 ) {
@@ -308,13 +316,13 @@ class Postgres {
308
316
const values = [ ] ;
309
317
let i = 1 ;
310
318
311
- // Builds binding pattern such as ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11::jsonb, now(), $12 , NULL, $13 )
319
+ // Builds binding pattern such as ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11::jsonb, $12::jsonb, now(), $13 , NULL, $14 )
312
320
for ( let c = 0 ; c < itemCount ; c ++ ) {
313
- values . push ( `($${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } ::jsonb, now(), $${ i ++ } , NULL , $${ i ++ } , $${ i ++ } ::jsonb )` ) ;
321
+ values . push ( `($${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } , $${ i ++ } ::jsonb, $${ i ++ } ::jsonb, now() , $${ i ++ } , NULL, $${ i ++ } )` ) ;
314
322
}
315
323
316
- return `INSERT INTO items (ms, a, d, paintseed, paintwear, defindex, paintindex, stattrak, souvenir, props, stickers, updated, rarity, floatid, price, keychains )
317
- VALUES ${ values . join ( ', ' ) } ON CONFLICT(defindex, paintindex, paintwear, paintseed) DO UPDATE SET ms=excluded.ms, a=excluded.a, d=excluded.d, stickers=excluded.stickers, updated=now(), keychains=excluded.keychains` ;
324
+ return `INSERT INTO items (ms, a, d, paintseed, paintwear, defindex, paintindex, stattrak, souvenir, props, stickers, keychains, updated, rarity, floatid, price)
325
+ VALUES ${ values . join ( ', ' ) } ON CONFLICT(defindex, paintindex, paintwear, paintseed) DO UPDATE SET ms=excluded.ms, a=excluded.a, d=excluded.d, stickers=excluded.stickers, keychains=excluded.keychains, updated=now() ` ;
318
326
}
319
327
320
328
updateItemPrice ( assetId , price ) {
@@ -385,11 +393,14 @@ class Postgres {
385
393
return {
386
394
sticker_id : s . i ,
387
395
slot : s . s ,
388
- pattern : s . pattern ,
389
- name : s . name ,
396
+ wear : s . w ,
397
+ scale : s . scale ,
398
+ rotation : s . r ,
399
+ tint_id : s . tint_id ,
390
400
offset_x : s . x ,
391
401
offset_y : s . y ,
392
402
offset_z : s . z ,
403
+ pattern : s . pattern ,
393
404
}
394
405
} ) ;
395
406
0 commit comments