File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
src/lib/components/trade_offer Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -233,12 +233,35 @@ export class AutoFill extends FloatElement {
233233
234234 const tradesToBuyer = this . pendingTradesResponse . trades . filter ( ( e ) => e . buyer_id === UserThem ?. strSteamId ) ;
235235
236+ const tradesWithoutOffersToBuyer = tradesToBuyer . filter ( ( e ) => ! e . steam_offer ?. state || ! e . steam_offer ?. id ) ;
237+ if ( tradesWithoutOffersToBuyer . length > 0 ) {
238+ // Disable them being able to select random items from their inventory (ensure asset IDs match up)
239+ this . disableInventoryPicker ( ) ;
240+ }
241+
236242 return html `
237243 ${ this . showPermissionWarningDialog ( tradesToBuyer ) } ${ this . renderBulkAutoFillDialog ( tradesToBuyer ) }
238244 ${ tradesToBuyer . map ( ( e ) => this . renderAutoFillDialog ( e ) ) } ${ this . showWarningDialog ( ) }
239245 ` ;
240246 }
241247
248+ disableInventoryPicker ( ) {
249+ if ( ! g_steamID ) {
250+ return ;
251+ }
252+
253+ const elem = document . getElementsByClassName ( 'trade_box_contents' ) ;
254+ if ( ! elem || elem . length === 0 ) {
255+ return ;
256+ }
257+
258+ // @ts -ignore
259+ elem . item ( 0 ) ?. style . opacity = '0.5' ;
260+
261+ // @ts -ignore
262+ elem . item ( 0 ) ?. style . pointerEvents = 'none' ;
263+ }
264+
242265 autoFillAll ( trades : Trade [ ] ) {
243266 for ( const trade of trades ) {
244267 this . autoFill ( trade ) ;
@@ -249,7 +272,9 @@ export class AutoFill extends FloatElement {
249272 $J ( '#inventory_select_your_inventory' ) . click ( ) ;
250273 const el = UserYou ?. findAsset ( AppId . CSGO , ContextId . PRIMARY , trade . contract . item . asset_id ) ?. element ;
251274 if ( ! el ) {
252- console . error ( 'failed to find asset element for id ' + trade . contract . item . asset_id ) ;
275+ alert (
276+ `Failed to auto-fill asset ${ trade . contract . item . asset_id } , you may have traded it away; skipping...`
277+ ) ;
253278 return ;
254279 }
255280
You can’t perform that action at this time.
0 commit comments