Skip to content

Commit

Permalink
Merge pull request #5 from yaspo/QOL
Browse files Browse the repository at this point in the history
Add attributes to collection view
  • Loading branch information
minetoblend authored Aug 28, 2024
2 parents af5287a + 98009dd commit c1c7d3e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/commands/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ export class CollectionCommand extends Command {
wishlist = ` · ◆${card.mapper.wishlistEntries.length} `;
}

return `\`${card.id}\` · ${conditionEmoji} ${wishlist}· ${card.mapper.username} (${card.burnValue} gold)`;
let attributes = [...card.getAttributes()].map(it => `\`${it}\``).join(' · ')
attributes = attributes ? ' · ' + attributes : ''

return `\`${card.id}\` · ${conditionEmoji} ${wishlist}· ${card.mapper.username} (${card.burnValue} gold)${attributes}`;
})
.join('\n') + `\n\nSorting by: \`${orderByReadable}\``
);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/drop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class DropCommand extends Command {
const buttons = cards.map((card) => {
let name = card.mapper.username;

if (card.attributes.length > 0) {
if (card.foil) {
name += ' (Foil)';
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class UseCommand extends Command {
const buttons = cards.map((card) => {
let name = card.mapper.username;

if (card.attributes.length > 0) {
if (card.foil) {
name += ' (Foil)';
}

Expand Down
13 changes: 6 additions & 7 deletions src/entities/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,12 @@ export class Card {
}[this.condition.id]!;
}

get attributes() {
const attributes: string[] = [];

if (this.foil) attributes.push('Foil');

return attributes;
}
* getAttributes(): Generator<string> {
if (this.foil)
yield 'foil'
if (this.jobMindblocked)
yield 'mindblocked'
}

get jobEffort() {
return Math.round(
Expand Down

0 comments on commit c1c7d3e

Please sign in to comment.