>>> LackeyCCG Tutorial: Plugin Creation - How to define packs of cards

 

To begin, here is an example what a complete packdefinitions1.xml file might look like:

<packdefinitions version="1.0">

<pack>
     <packtitle>30 Fixed Cards</packtitle>
     <packimage>samplebooster</packimage>
     <packformat>normal</packformat>
     <packkind>YourLabel</packkind>
     <packdoubles>yes</packdoubles>
     <packcommoncrit><field>Set</field><eval>IS</eval><data>alpha</packcommoncrit>
     <chance>
          <kind><qty>10</qty><crit><field>Name</field><eval>IS</eval><data>Gross Ghoul</data></crit></kind>
          <kind><qty>10</qty><crit><field>Name</field><eval>IS</eval><data>Meat Stalker</data></crit></kind>
          <kind><qty>10</qty><crit><field>Name</field><eval>IS</eval><data>Kyle Bjorn</data></crit></kind>
     </chance>
</pack>

<pack>
     <packtitle>Random Pack</packtitle>
     <packimage>samplebooster</packimage>
     <packformat>normal</packformat>
     <packkind>AnotherLabel</packkind>
     <packcommoncrit><field>Set</field><eval>IS</eval><data>alpha</data></packcommoncrit>
     <chance>
          <prob>90</prob>
          <kind><qty>1</qty><crit><field>Rarity</field><eval>IS</eval><data>R</data></crit></kind>
          <kind><qty>2</qty><crit><field>Rarity</field><eval>IS</eval><data>U</data></crit></kind>
          <kind><qty>10</qty><crit><field>Rarity</field><eval>IS</eval><data>C</data></crit></kind>
     </chance>
     <chance>
          <prob>10</prob>
          <kind><qty>1</qty><crit><field>Rarity</field><eval>IS</eval><data>S</data></crit></kind>
          <kind><qty>2</qty><crit><field>Rarity</field><eval>IS</eval><data>U</data></crit></kind>
          <kind><qty>10</qty><crit><field>Rarity</field><eval>IS</eval><data>C</data></crit></kind>
     </chance>
</pack>

</packdefinitions>

The above example defines 2 pack definitions.

 

The new packdefinitions format is an .xml file, which you should be able to open and edit with any text editor. You can include between 0 to 10 packdefinitions files in your plugin. If you have 0, people will not be able to open packs.

Just name the files "packdefinitions1.xml", "packdefinitions2.xml", "packdefinitions3.xml", and so on, and Lackey will discover them. Instead of multiple files, you can put them all into a single file. The option to split them into multiple files is only for your convenience, should you decide to do it that way. These files should be put in your plugins packs/ folder. For the purpose of this tutorial, I will assume the plugin you are creating is called zombie.

Create a text file and save it to plugins/zombie/packs/packdefinitions1.xml

Each pack definitions file must begin with <packdefinitions version="1.0"> and end with </packdefinitions>, and all of the pack definitions should go between them. Each pack definition should similarly begin with <pack> and end with </pack>, and all of that pack's information should go between them.


How to define a pack

Each pack consists of data, which is in between start and stop tags. Some data is optional, some is required for that pack to be valid. Every pack must begin with a pack title, defined like

<packtitle>Funky Booster</packtitle>

Then you can define 4 more optional pack information tags. Here are the 5 pack information definitions, and what they mean.

<packtitle>Funky Booster</packtitle> This is the title of the pack. This entry is not optional.
<packimage>boosterfunky</packimage> This defines the name of the image file associated with this pack, excluding the .jpg which is implicit.
<packformat>standard</packformat> You can define what play format this pack is for. This is helpful when browsing for packs.
<packkind>booster</packkind> You can define what kind of pack this is, be it a booster pack, preconstructed deck, or whatever. This is helpful when browsing for packs.
<packdoubles>yes</packdoubles> This defines whether the pack allows doubles, i.e., more than one card of the same name in it. By default, doubles are not allowed, so if you don't want doubles in packs, you can omit this entry from the pack definition.

 

Next, you can define any number of <packcommoncrit> entries. These are criteria that each item in the pack must fullfil to be included. You don't need to include any <packcommoncrit> entries, because you can include them elsewhere, as I will talk about shortly. A <packcommoncrit> entry might look like:

<packcommoncrit><field>Set</field><eval>IS</eval><data>Alpha</data></packcommoncrit>


<chance></chance>

Next you define <chance> entries. You can have any number of them, and each of them must begin with <chance> and end with </chance>. A chance is used when a pack's structure is random. For example, if your pack consists of 1 rare, 3 uncommons, and 10 commons, but there is a 10% chance that the rare will be replaced by an ultra-rare, you would need to define 2 chances.

<chance>

<prob>90</prob>
Chance criteria goes here (<kind> entries)...

</chance>

<chance>

<prob>10</prob>
Chance criteria goes here (<kind> entries)...
</chance>

If the structure of your pack is not random, you just need to include 1 chance, and you can omit the probability tag (which is by default 100%). The probability of all of the seperate chances should total to 100%.


<kind></kind>

Each chance consists of several kinds of cards in it. A kind entry contains both the quantity of that kind included in the pack, as well as any number of criteria entries which define what that kind is. A simple kind entry may include a quantity and a single criterion, and look like:

<kind><qty>3</qty><crit><field>Rarity</field><eval>IS</eval><data>U</data></crit></kind>

This <kind> entry says to include 3 cards whose rarity is "U". You can make a criterion for anything, and each kind can have any number of them. Going back to the previous example, if you also want those 3 uncommons to come from a specific set, "alpha" for example, you could define the kind like:

<kind>

<qty>3</qty>

<crit><field>Rarity</field><eval>IS</eval><data>U</data></crit>

<crit><field>Set</field><eval>IS</eval><data>alpha</data></crit>

</kind>


<crit></crit>

A <crit> entry begins with <crit> and ends with </crit>. In between, you must define <field>, <eval> and <data> entries. The field entry is the column of data, as define in the plugininfo.txt file. The <eval> entry defines how the criterion is evaluated. It can be IS, CONTAINS, DOESNTCONTAIN,ISGREATERTHAN, among others. The <data> entry is what is being compared. For example,

<crit><field>Rarity</field><eval>IS</eval><data>U</data></crit>

should be read as The rarity column of the card data file must be "U".

Suppose each card in the entire pack must be from the set called "alpha". You could add a <crit> entry for every kind in the entire pack, but you can also use a single <packcommoncrit> entry, which you put immediately before you define the first <chance> entry.

 

Summing up, here is a sample packdefinitions1.xml file that contains 2 packs. Note that you can indent and add as much white space as you want outside of <tag> entries. Line it up however it makes it easy for you to read.

<packdefinitions version="1.0">

<pack>
     <packtitle>30 Fixed Cards</packtitle>
     <packimage>samplebooster</packimage>
     <packformat>normal</packformat>
     <packkind>YourLabel</packkind>
     <packdoubles>yes</packdoubles>
     <packcommoncrit><field>Set</field><eval>IS</eval><data>alpha</packcommoncrit>
     <chance>
          <kind><qty>10</qty><crit><field>Name</field><eval>IS</eval><data>Gross Ghoul</data></crit></kind>
          <kind><qty>10</qty><crit><field>Name</field><eval>IS</eval><data>Meat Stalker</data></crit></kind>
          <kind><qty>10</qty><crit><field>Name</field><eval>IS</eval><data>Kyle Bjorn</data></crit></kind>
     </chance>
</pack>

<pack>
     <packtitle>Random Pack</packtitle>
     <packimage>samplebooster</packimage>
     <packformat>normal</packformat>
     <packkind>AnotherLabel</packkind>
     <packcommoncrit><field>Set</field><eval>IS</eval><data>alpha</data></packcommoncrit>
     <chance>
          <prob>90</prob>
          <kind><qty>1</qty><crit><field>Rarity</field><eval>IS</eval><data>R</data></crit></kind>
          <kind><qty>2</qty><crit><field>Rarity</field><eval>IS</eval><data>U</data></crit></kind>
          <kind><qty>10</qty><crit><field>Rarity</field><eval>IS</eval><data>C</data></crit></kind>
     </chance>
     <chance>
          <prob>10</prob>
          <kind><qty>1</qty><crit><field>Rarity</field><eval>IS</eval><data>S</data></crit></kind>
          <kind><qty>2</qty><crit><field>Rarity</field><eval>IS</eval><data>U</data></crit></kind>
          <kind><qty>10</qty><crit><field>Rarity</field><eval>IS</eval><data>C</data></crit></kind>
     </chance>
</pack>

</packdefinitions>

 

 

Back to the LackeyCCG Tutorial Page