Update cards per page to be 9
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ethan Lane 2023-12-19 16:01:03 +00:00
parent 366bf08d3e
commit 3c3381847b
2 changed files with 6 additions and 4 deletions

View file

@ -84,7 +84,7 @@ export class CoreClient extends Client {
console.log(`Registered Events: ${CoreClient._eventItems.flatMap(x => x.EventType).join(", ")}`);
console.log(`Registered Buttons: ${CoreClient._buttonEvents.flatMap(x => x.ButtonId).join(", ")}`);
const page = await InventoryHelper.GenerateInventoryPage('125776189666230272', 11);
const page = await InventoryHelper.GenerateInventoryPage('125776189666230272', 0);
console.log(page);

View file

@ -21,14 +21,16 @@ interface InventoryPageCards {
export default class InventoryHelper {
public static async GenerateInventoryPage(userid: string, page: number): Promise<{ embed: EmbedBuilder, row: ActionRowBuilder<ButtonBuilder> }> {
const cardsPerPage = 10;
const cardsPerPage = 9;
const inventory = await Inventory.FetchAllByUserId(userid);
const allSeriesClaimed = CoreClient.Cards
.sort((a, b) => a.id - b.id)
.filter(x => {
x.cards = x.cards.filter(y => inventory.find(z => z.CardNumber == y.id));
x.cards = x.cards
.sort((a, b) => b.type - a.type)
.filter(y => inventory.find(z => z.CardNumber == y.id));
return x;
});
@ -36,7 +38,7 @@ export default class InventoryHelper {
const pages: InventoryPage[] = [];
for (let series of allSeriesClaimed) {
const seriesCards = series.cards.sort((a, b) => b.type - a.type);
const seriesCards = series.cards;
for (let i = 0; i < seriesCards.length; i+= cardsPerPage) {
const cards = series.cards.slice(i, i + cardsPerPage);