4 ‐ Card Unlocks ‐ Levels - Decentraland-Community-Modules/DCL-TCG-Framework-SDK7 GitHub Wiki

This section covers how to set cards up to unlock and different levels.

/** data interface for defining an nft contract linkage */
export interface LevelUnlockDataObject {
    //indexing
    level:number; //level required to unlock card set//provided cards
    //added cards
    providedCards:CardProvisionDataObject[];
}

Here is a breakdown of what each parameter does:

  • level: Level at which cards will be unlocked
  • providedCards: Here we can set which cards are unlocked and the quantity that a player then has access to.

Here is a sample implementation unlocking some fire cards at level 3.

/** listing of all cards included in the game */
export const LevelUnlockData:LevelUnlockDataObject[] = [
    . . .
    {
        //indexing
        level: 3,
        //added cards
        providedCards:[
            //provide fire cards
            { id:CARD_DATA_ID.SPELL_FIREBOLT, count:3 },
            { id:CARD_DATA_ID.CHARACTER_FIRE_GOLEM, count:5 },        ],
    },
    . . .
];