Skip to content

Commit 8702fc8

Browse files
committed
chore: add more messages for craft max
1 parent b83ba90 commit 8702fc8

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/base/library/craft/max.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,24 @@ onPage('Crafting', function craftMax() {
3232
const rarity = cardHelper.rarity(el);
3333
if (rarity === 'DETERMINATION') return;
3434
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;
3737
const cost = cardHelper.dustCost(el);
3838
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+
}
4043
card.hover(hover.show(`CTRL Click: Craft up to max(${max})`))
4144
.off('click')
4245
.on('click.script', (e) => {
4346
const id = parseInt(card.attr('id'), 10);
4447
const shiny = card.hasClass('shiny');
4548
if (e.ctrlKey) {
4649
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);
5053
} else {
5154
global('action')(id, shiny);
5255
}

src/structures/base.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@ export default class Base {
1010
}
1111

1212
update(data) {}
13+
14+
toJSON() {
15+
return {
16+
id: this.id,
17+
};
18+
}
1319
}

src/structures/chat.local/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Base from '../base.js';
2-
import { DESIGNER, SUPPORTER } from '../constants/user.js';
2+
import { DESIGNER, SUPPORTER } from '../constants/roles.js';
33

44
export default class User extends Base {
55
constructor(data) {

0 commit comments

Comments
 (0)