omardelarosa / obsidian-mtg

A plugin for managing Magic: The Gathering decks and card lists as Obsidian notes
MIT License
30 stars 5 forks source link

Add banlist support #2

Open omardelarosa opened 2 years ago

danielmmckeown commented 2 years ago

Hey there! What are you thinking when it comes to this feature? Do you want cards to be flagged/highlighted if someone has a banned card in their list?

omardelarosa commented 2 years ago

I was thinking something like adding a secondary CSV type like .banlist.csv which has a column for Name and Format.

Then perhaps adding format to the decklist block like this:

Screen Shot 2022-10-09 at 11 49 09 AM

And it could mark any cards that are banned in that format. I'm open to other ideas, though. What did you have in mind?

danielmmckeown commented 2 years ago

That makes a lot of sense. In the interest of transparency I am still very new to programming and collaborating via GitHub but this seems like a cool project and I’m willing to assist in any way that I can.

V/R,

-Dan On Oct 9, 2022, 11:50 AM -0400, omar @.***>, wrote:

I was thinking something like adding a secondary CSV type like .banlist.csv which has a column for Name and Format. Then perhaps something like this:

And it could mark any cards that are banned in that format. I'm open to other ideas, though. What did you have in mind? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

omardelarosa commented 2 years ago

@danielmmckeown I'm glad this project resonates with you and I'd appreciate your assistance! I probably won't have time to work on this much until maybe next weekend so feel free to give it a shot and just send over a pull request if you make progress.

You can see the createCountsMapping function for info about her the CSV file data is read.

All of the banlist data is available here:

https://magic.wizards.com/en/banned-restricted-list

There's also an API that has a lot of this information:

https://docs.magicthegathering.io/#documentationgetting_started

One way this could be implemented (without requiring CSV banlists) is just by making an API call to that service in the renderer.ts flow and check if each card is in the banlist of the given format. Just be mindful that it's limited to like 5000 requests per hour.

omardelarosa commented 2 years ago

@danielmmckeown update: I had some time to work on this this afternoon and I made a dev branch dev-1.0.1 associated with PR #9 . It does some of the integration with Scryfall API and this might making adding the banlist stuff easier.

If you end up working on this, I think all that needs to be done to add the banlist is:

  1. A way to mark your decklist as a particular format
  2. Use the legalities field from the CardData I'm adding in that branch