Update cards per page to be 9
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
366bf08d3e
commit
3c3381847b
2 changed files with 6 additions and 4 deletions
|
@ -84,7 +84,7 @@ export class CoreClient extends Client {
|
||||||
console.log(`Registered Events: ${CoreClient._eventItems.flatMap(x => x.EventType).join(", ")}`);
|
console.log(`Registered Events: ${CoreClient._eventItems.flatMap(x => x.EventType).join(", ")}`);
|
||||||
console.log(`Registered Buttons: ${CoreClient._buttonEvents.flatMap(x => x.ButtonId).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);
|
console.log(page);
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,16 @@ interface InventoryPageCards {
|
||||||
|
|
||||||
export default class InventoryHelper {
|
export default class InventoryHelper {
|
||||||
public static async GenerateInventoryPage(userid: string, page: number): Promise<{ embed: EmbedBuilder, row: ActionRowBuilder<ButtonBuilder> }> {
|
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 inventory = await Inventory.FetchAllByUserId(userid);
|
||||||
|
|
||||||
const allSeriesClaimed = CoreClient.Cards
|
const allSeriesClaimed = CoreClient.Cards
|
||||||
.sort((a, b) => a.id - b.id)
|
.sort((a, b) => a.id - b.id)
|
||||||
.filter(x => {
|
.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;
|
return x;
|
||||||
});
|
});
|
||||||
|
@ -36,7 +38,7 @@ export default class InventoryHelper {
|
||||||
const pages: InventoryPage[] = [];
|
const pages: InventoryPage[] = [];
|
||||||
|
|
||||||
for (let series of allSeriesClaimed) {
|
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) {
|
for (let i = 0; i < seriesCards.length; i+= cardsPerPage) {
|
||||||
const cards = series.cards.slice(i, i + cardsPerPage);
|
const cards = series.cards.slice(i, i + cardsPerPage);
|
||||||
|
|
Loading…
Reference in a new issue