Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how invention materials command is displayed #5769

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib/invention/MaterialBank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ export class MaterialBank {
return 'No materials';
}
const res = [];
for (const [type, qty] of entries.sort((a, b) => b[1] - a[1])) {
res.push(`${qty.toLocaleString()}x ${toTitleCase(type)}`);
for (const [type, qty] of entries.sort((a, b) => a[0].localeCompare(b[0]))) {
res.push(`${toTitleCase(type)}: ${qty.toLocaleString()}`);
}

return res.join(', ');
return `${res.join('\n')}`;
}

public values() {
Expand Down
2 changes: 1 addition & 1 deletion src/mahoji/commands/invention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
.filter(
i =>
allItemsThatCanBeDisassembledIDs.has(i[0].id) &&
(!value ? true : i[0].name.toLowerCase().includes(value.toLowerCase()))

Check warning on line 48 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required

Check warning on line 48 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required
)
.filter(i => {
const data = findDisassemblyGroup(i[0]);
Expand Down Expand Up @@ -95,7 +95,7 @@
required: true,
autocomplete: async value => {
return Inventions.filter(i =>
!value ? true : i.name.toLowerCase().includes(value.toLowerCase())

Check warning on line 98 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required

Check warning on line 98 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required
).map(i => ({
name: i.name,
value: i.name
Expand Down Expand Up @@ -151,7 +151,7 @@
required: true,
autocomplete: async value => {
return Inventions.filter(i =>
!value ? true : i.name.toLowerCase().includes(value.toLowerCase())

Check warning on line 154 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required

Check warning on line 154 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required
)
.map(i => ({ name: i.name, value: i.name }))
.sort((a, b) => a.name.localeCompare(b.name));
Expand All @@ -176,7 +176,7 @@
required: true,
autocomplete: async value => {
return DisassemblySourceGroups.filter(i =>
!value ? true : i.name.toLowerCase().includes(value.toLowerCase())

Check warning on line 179 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required

Check warning on line 179 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

Unexpected string value in conditional. An explicit empty string check is required
).map(i => ({ name: i.name, value: i.name }));
}
}
Expand Down Expand Up @@ -215,7 +215,7 @@
return str;
}
if (options.materials) {
return `You own: ${user.materialsOwned()}`;
return { content: `You own:\n${user.materialsOwned()}`, ephemeral: true };
}

if (options.group) {
Expand Down Expand Up @@ -349,7 +349,7 @@
.join(', ')})
${group.items
.map(i => {
return `${Array.isArray(i.item) ? i.item.map(i => i.name).join(', ') : i.item.name} - ${Math.floor(

Check warning on line 352 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v18.12.0 - ubuntu-latest

'i' is already declared in the upper scope on line 351 column 9

Check warning on line 352 in src/mahoji/commands/invention.ts

View workflow job for this annotation

GitHub Actions / Node v20 - ubuntu-latest

'i' is already declared in the upper scope on line 351 column 9
calcJunkChance(i.lvl, false)
)}% Junk Chance - Level/Weighting ${i.lvl}`;
})
Expand Down
Loading