@@ -69,6 +69,8 @@ export const FetchInspectInfo = new SimpleHandler<FetchInspectInfoRequest, Fetch
6969 let weaponType : string | undefined ;
7070 let itemName : string | undefined ;
7171 let rarityName : string | undefined ;
72+ let stickers : Sticker [ ] = [ ] ;
73+ let keychains : Keychain [ ] = [ ] ;
7274
7375 try {
7476 const schema = await gSchemaFetcher . getSchema ( ) ;
@@ -83,23 +85,35 @@ export const FetchInspectInfo = new SimpleHandler<FetchInspectInfoRequest, Fetch
8385 min = paint . min ;
8486 max = paint . max ;
8587 }
86- } catch ( error ) {
87- console . error ( 'Failed to fetch schema item metadata:' , error ) ;
88- }
8988
90- return {
91- iteminfo : {
92- stickers : decoded . stickers . map ( ( sticker ) => ( {
89+ stickers = decoded . stickers . map ( ( sticker ) => {
90+ const schemaSticker = schema . stickers [ sticker . stickerId ?. toString ( ) ?? '' ] ;
91+ return {
9392 slot : sticker . slot ?? 0 ,
9493 stickerId : sticker . stickerId ?? 0 ,
9594 wear : sticker . wear ,
96- } ) ) ,
97- keychains : decoded . keychains . map ( ( keychain ) => ( {
95+ name : schemaSticker ?. market_hash_name ,
96+ } ;
97+ } ) ;
98+
99+ keychains = decoded . keychains . map ( ( keychain ) => {
100+ const schemaKeychain = schema . keychains [ keychain . stickerId ?. toString ( ) ?? '' ] ;
101+ return {
98102 slot : keychain . slot ?? 0 ,
99103 stickerId : keychain . stickerId ?? 0 ,
100104 wear : keychain . wear ,
101105 pattern : keychain . pattern ?? 0 ,
102- } ) ) ,
106+ name : schemaKeychain ?. market_hash_name ,
107+ } ;
108+ } ) ;
109+ } catch ( error ) {
110+ console . error ( 'Failed to fetch schema item metadata:' , error ) ;
111+ }
112+
113+ return {
114+ iteminfo : {
115+ stickers,
116+ keychains,
103117 itemid : decoded . itemid ?. toString ( ) ?? '' ,
104118 defindex,
105119 paintindex,
@@ -120,9 +134,9 @@ export const FetchInspectInfo = new SimpleHandler<FetchInspectInfoRequest, Fetch
120134 }
121135) ;
122136
123- function getSchemaPaint ( weapon : ItemSchema . RawWeapon | undefined , paintIndex : number ) {
137+ function getSchemaPaint ( weapon : ItemSchema . RawWeapon | undefined , paintIndex : number ) : ItemSchema . RawPaint | undefined {
124138 if ( ! weapon ) {
125- return ;
139+ return undefined ;
126140 }
127141
128142 if ( weapon . paints [ paintIndex ] !== undefined ) {
0 commit comments