How to make a custom pack using C#

Updated 11 months ago

Pack Metacategories

Packs can be belong to any number of "metacategories" which define which scribe they are valid for. As of the time this was written, this will only matter if the player also has my P03 in Kaycee's Mod mod installed. Otherwise, every run through the game will be a Leshy run and only care about Leshy packs.

The metacategories are:

public enum PackInfo.PackMetacategory
{
    LeshyPack = 0,
    P03Pack = 1,
    GrimoraPack = 2,
    MagnificusPack = 3
}

Using the API directly

You can also create a card pack using this API directly. All you need to do is ask the PackManager to create a PackInfo object for the mod prefix associated with your cards.

using Infiniscryption.PackManagement;

public static void CreatePack()
{
    PackInfo incrediPack = PackManager.GetPackInfo("boom");
    incrediPack.Title = "Incredible Card Expansion";
    incrediPack.SetTexture(TextureHelper.GetImageAsTexture("Artwork/boom_pack.png");
    incrediPack.Description = "This card pack is full of cards that will blow your mind.";
    incrediPack.ValidFor.Add(PackInfo.PackMetacategory.LeshyPack);
}

It is strongly recommended however that you do not create a hard dependency between your card pack and this API. Instead, you can create a soft dependency using the following pattern:

private void Start() // Do this in your Plugin.cs file
{
    if (Chainloader.PluginInfos.ContainsKey("zorro.inscryption.infiniscryption.packmanager"))
        CreatePack()
}

Using this pattern will allow you to create the pack when the user has installed the Pack Manager API, but will not force the user to have installed that API if they do not want it.