@@ -32,21 +32,24 @@ onPage('Crafting', function craftMax() {
32
32
const rarity = cardHelper . rarity ( el ) ;
33
33
if ( rarity === 'DETERMINATION' ) return ;
34
34
const max = cardHelper . max ( rarity ) ;
35
- const limit = max - cardHelper . quantity ( el ) ;
36
- if ( limit <= 0 ) return ;
35
+ const amount = cardHelper . quantity ( el ) ;
36
+ if ( amount >= max ) return ;
37
37
const cost = cardHelper . dustCost ( el ) ;
38
38
const total = cardHelper . totalDust ( ) ;
39
- if ( cost > total ) return ;
39
+ if ( cost > total ) {
40
+ card . hover ( hover . show ( 'CTRL Click: insufficient dust' ) ) ;
41
+ return ;
42
+ }
40
43
card . hover ( hover . show ( `CTRL Click: Craft up to max(${ max } )` ) )
41
44
. off ( 'click' )
42
45
. on ( 'click.script' , ( e ) => {
43
46
const id = parseInt ( card . attr ( 'id' ) , 10 ) ;
44
47
const shiny = card . hasClass ( 'shiny' ) ;
45
48
if ( e . ctrlKey ) {
46
49
hover . hide ( ) ;
47
- const l = max - cardHelper . quantity ( el ) ;
48
- if ( l <= 0 ) return ;
49
- craftCards ( id , shiny , l , cost , total ) ;
50
+ const count = max - cardHelper . quantity ( el ) ;
51
+ if ( count <= 0 ) return ;
52
+ craftCards ( id , shiny , count , cost , total ) ;
50
53
} else {
51
54
global ( 'action' ) ( id , shiny ) ;
52
55
}
0 commit comments