CajunAvenger / LackeyBot

A MSEM card fetching and utility bot.
2 stars 2 forks source link

Condense cards.json #8

Open CajunAvenger opened 4 years ago

CajunAvenger commented 4 years ago

LackeyBot currently holds a separate entry for each unique printing of the cards in its database, which was fine when the system was originally coded for a dozen sets, but is starting to be unwieldy with MSEM growing and the canon database now online.

The two main improvements I want to make are a card.versions object and a card.faces array.

card.faces would replace the current double card tech, replacing card.cardName and card.cardName2 with card.faces[0].cardName and card.faces[1].cardName, etc. card.versions would contain the changes that are version specific, so card.versions[SET].rarity instead of a rarity slot on multiple cards. This does conflict at artist, probably the solution there is card.versions[SET].artists[0] and card.versions[SET].artists[1].

after that a new entry would look something like

    "Delver of Secrets // Insectile Aberration": {
        "fullName":"Delver of Secrets // Insectile Aberration",
        "notes":["transform"],
        "shape":"doubleface",
        "formats":["commander","legacy","modern","pauper","vintage"],
        "prints":["ISD","V17"],
        "rarities":["common","mythic rare"],
        "faces": [
            {"cardName":"Delver of Secrets",
            "manaCost":"{U}",
            "typeLine":"Creature — Human Wizard",
            "rulesText":"At the beginning of your upkeep, look at the top card of your library. You may reveal that card. If an instant or sorcery card is revealed this way, transform Delver of Secrets.\n",
            "power":1,
            "toughness":1,
            "loyalty":"",
            "color":"{Blue} ",
            "cmc":1,
            "cardType":"Creature "},
            {"cardName":"Insectile Aberration",
            "manaCost":"",
            "typeLine":"Creature — Human Insect",
            "rulesText":"Flying\n",
            "power":3,
            "toughness":2,
            "loyalty":"",
            "colors":"{Blue} ",
            "cmc":1,
            "cardType":"Creature "}
        ],
        "versions": {
            "ISD": {
                "rarity": "common",
                "setID": "ISD",
                "cardID": "51",
                "artists": ["Nils Hamm", "Nils Hamm"],
                "flavorTexts": ["", "*\"Unfortunately, all my test animals have died or escaped, so I shall be the final subject. I feel no fear. This is a momentous night.\"\n—Laboratory notes, final entry*\n"],,
                "scryfallID": ["11bf83bb-c95b-4b4f-9a56-ce7a1816307a", "11bf83bb-c95b-4b4f-9a56-ce7a1816307a"]
            },
            "V17": {
                "rarity": "mythic rare",
                "setID": "V17",
                "cardID": "7",
                "artists": ["Lius Lasahido", "Lius Lasahido"],
                "scryfallID": ["28059d09-2c7d-4c61-af55-8942107a7c1f", "28059d09-2c7d-4c61-af55-8942107a7c1f"]
            }
        }
    }

and prints and rarities may even be redundant at that point but they'll stay for now. would require a little bit of work on the Magic module to support this and the old version, because devDex does still want to be working on that, but should be worth the extra data available and speedier canon searches.

CajunAvenger commented 4 years ago

writeCard now working with help of Who//What//When//Where//Why as the test subject, now just the process of changing all the other references.

relevant regex for myself for later \.(cardName|manaCost|typeLine|rulesText|power|toughness|loyalty|color|cmc|cardType|rarity|setID|cardID|artist|scryID)2?

CajunAvenger commented 3 years ago

after some digging, this isn't gonna happen without some overly aggressive retuning, and is getting shelved for now.

CajunAvenger commented 2 years ago

main wibble here is needing to keep the SET key around (something like a [card, set_code] array)

an option is to have a default variable in the relevant scripts (which being on set-specific ids means isn't a huge number), base_set_code = card.prints[0]

also considering a library method that converts new_card_object to old_card_object for specific instances.

CajunAvenger commented 2 years ago

main wibble here is needing to keep the SET key around (something like a [card, set_code] array)

on second thought, cardWrapper object when the card object needs to be passed around

{
 data: library.cards[cardName],
 set: (library.cards[cardName].prints[0] || printKey),
 getVersionData: function(set) {
  if(!set)
   set = this.set;
  return this.data.versions[set];
 }
}

probably some other methods that would be useful to add as well (converting old Card_SET keys to new format maybe?). should thread the needle of getting the new stuff without being too bad to update