@@ -210,10 +210,9 @@ class Postgres {
210210 buf . writeFloatBE ( item . floatvalue , 0 ) ;
211211 item . paintwear = buf . readInt32BE ( 0 ) ;
212212
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
217216 continue ;
218217 }
219218
@@ -253,11 +252,17 @@ class Postgres {
253252
254253 const keychains = item . keychains . length > 0 ? item . keychains . map ( ( s ) => {
255254 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 ;
258263 }
259- if ( s . name ) {
260- res . name = s . name ;
264+ if ( s . tint_id ) {
265+ res . tint_id = s . tint_id ;
261266 }
262267 if ( s . offset_x ) {
263268 res . x = s . offset_x ;
@@ -268,6 +273,9 @@ class Postgres {
268273 if ( s . offset_z ) {
269274 res . z = s . offset_z ;
270275 }
276+ if ( s . pattern ) {
277+ res . pattern = s . pattern ;
278+ }
271279 return res ;
272280 } ) : null ;
273281
@@ -288,7 +296,7 @@ class Postgres {
288296 }
289297
290298 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 ] ) ;
292300 }
293301
294302 if ( values . length === 0 ) {
@@ -308,13 +316,13 @@ class Postgres {
308316 const values = [ ] ;
309317 let i = 1 ;
310318
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 )
312320 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 ++ } )` ) ;
314322 }
315323
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() ` ;
318326 }
319327
320328 updateItemPrice ( assetId , price ) {
@@ -385,11 +393,14 @@ class Postgres {
385393 return {
386394 sticker_id : s . i ,
387395 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 ,
390400 offset_x : s . x ,
391401 offset_y : s . y ,
392402 offset_z : s . z ,
403+ pattern : s . pattern ,
393404 }
394405 } ) ;
395406
0 commit comments