Adding new packs to the box. - Pepper0ni/TTS-PTCG-Pack-Simulator GitHub Wiki

The box can be expanded to add new sets as they are added to the API. you do this by adding new entries to the massive setData table in APIBox.lua. The entries in the table are in the order the box will move between them. the Data Structure is as follows.

  • setName: The name of the set. This much match the name of the set in the API's data so it can find it. Check the name of sets on their data github
  • size: The size of the set. This is optional and defaults to 300. Entering this ensures that the parallel API searches are as efficient as they can be, but this should be left undeclared for sets likely to expand in future (such as the latest gen's promos)
  • setID: The id of the Set on the API
  • unordered: Optional. If for whatever reason the sort of the cards returned is problematic, set this to true to use a different sort
  • SMEnergy: Optional. If true, adds the 9 Sun and Moon Basic Energies to the bottom of the set deck.
  • subSet: If a pack needs to call more than 1 set, you can add a subSet. A subSet is a second set which is added to the end of the main set before caching. subSet is a table with 3 entries.
    • setName: The name of the subSet
    • setID: The id of the subSet on the API
    • size: Optional. The size of the subSet
  • custom: Data for the appearance of the box. Is a table with the following entries.
    • mesh: the mesh of the box. Note that several common Meshes are declared as constants at the top of the script.
    • diffuse: The texture of the box.
    • normal: The normal of the box. Not optional, but you can refuse to declare a normal by declaring an empty string.
  • packData: Contains the data that applies to the cards pack. this is optional, and not declaring this will cause the box to refuse to spawn packs. Is a table with the following entries
    • art: A table containing the booster pack diffuses. Can be any number of entries long.
    • dropSlots: A String containing the data for a table in the same format it would be entered into a script. This and pullRate are directly copied into the pack's script during generation. The format of dropSlots is a table containing any number of "slots", which are ordered in the order the cards should appear in the back, where the first entry is the top card when the contents of the pack are face-down. These slots are also tables with the following entries.
      • cards: a table containing a list of numbers and/or tables, where each sub-table contains 2 numbers. These numbers refer to the cards within the loaded set by position in the spawned deck (usually the set number). The sub-tables declare an inclusive range for easily declaring blocks of cards.
      • num: The number of cards from that slot to put in the pack every time it is opened. Does not include the cards added by pullRate.
      • size: the size of the slot, only needed if cards includes at least 1 range.
      • energy: optional. When present and set to true the slot is declared energy and will be skipped if energy is disabled.
  • pullRate: A String containing the data for a table in the same format it would be entered into a script. pullRate is a table containing any number of sub-tables, each containing a single random card slot. The data is arranged as for each follows.
    • rates: A table containing a number of sub-tables. The slots are processed in the order they are declared.
      • slot: The slot from which to take a card from.
      • odds: The chance of the slot to be hit out of 1. putting x/y will cause the computer to divide x by y, making it a way to enter "odds" into table.
      • remaining: If true, instead of subtracting the odds from the current roll, takes them from the original roll. This means that you can have a chance that is the stated odds - the chance of hitting another card before this. Useful for Rare Holos when you know the White Code rate
      • flag: if true, set the flag. This flag persists for the rest of the pack.
      • flagExclude: if true, and if the flag has been set earlier in the pack, prevent this slot from being processed.
    • num: The number of times to process this pullRate.

Practical Set adding guide.

  • Copy another sets table and change the name, setid, diffuse and pack art to that of the new set. Remove the size for now.
  • if you need to add a subSet, do so, but to not define size.
  • Update the box script and navigate to the new set, then get the whole set to ensure the name works correctly
  • Set the size to the size of the spawned deck
  • If the deck is out of order, set unsorted to true.
  • Get the rarity getter and enter the ID of the set into the textbox, then use it. A list of cards in each rarity should soon appear in your notes. Copy it elsewhere for later. If you have a subSet, you'll have to run it separately and add the number of cards in the main set to all the returned numbers.
  • Populate the slots with the cards of the correct rarity. for simple rarities you may be able to just copy the whole table but there are often several rarities within "ultra rare" at minimum, and energies of often listed as common. You do not need to declare a size as this does not use ranges (ranges do not make the code more efficient, they are for the coders benefit). You may have to reorder, add or delete slots in some cases.
  • Research the pack's pull rates and card order, changing, adding and removing pullRates and the order and num in slots as required. Remember that each pullRate run adds the card it generates.
  • Populate the reverse slot. The reverse slot is usually the commons, uncommons, rares and rare holos only. Sometimes other rarities may appear in the reverse slot as an abnormal rate, in which case create a pullRate to handle it.
  • Update the box script, reload the script by changing sets and going back to the one you are testing with, and pull out packs to test.