//::///////////////////////////////////////////////
//:: Name : Item Combination Set Up Script Revision 2
//:: FileName : chest_spawn
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*

*/
//:://////////////////////////////////////////////
//:: Created By: Giolon
//:: Created On: 9/16/02, Last Rev on 10/2/02
//:://////////////////////////////////////////////

#include "array_functions"


/* Ok, this basically sets up the chest the first time it is opened up.
    Here is a template for adding new recipes:

    // x is the number ID of the recipe.  All recipe numbers must be in
       sequence, starting from 1.

    case X: sRecipeName = "Recipe 1";  //Name your recipe whatever you want.

            SetLocalArrayString(oChest, "RECIPE", i, sRecipeName);

            nNumComponents = 2;  //The number of components in the recipe.
            SetLocalArrayInt(oChest, "NUM_COMPONENTS", i, nNumComponents);

            //Add one of these lines for each component in the recipe.
            // *WARNING* The first item of every recipe must be an item unique to that recipe!
            SetLocalArrayString(oChest, sRecipeName, 1, "ITEM_1_TAG");
            SetLocalArrayString(oChest, sRecipeName, 2, "ITEM_2_TAG");

            //This is blueprint resref of the reward item..
            SetLocalString(oChest, sRecipeName + "Reward", "reward_res_ref");

            //Set the first line below to 1 if you want this to be a 1 time recipe.
            SetLocalInt(oChest, sRecipeName + "ONE_TIME_RECIPE", 0);
            SetLocalInt(oChest, sRecipeName + "ALREADY_MADE", 0);
            break;

*/

void main()
{

    object oChest = OBJECT_SELF;

    int bAlreadySetUp = GetLocalInt(oChest, "IS_SET_UP");

    if (!bAlreadySetUp) {

        int nNumRecipes = 6;  // This is the number of recipes.  Be sure to update
                              // this value as you add recipes.

        SetLocalInt(oChest, "NUM_RECIPES", nNumRecipes);

        SetLocalInt(oChest, "ENABLE_ONE_TIME_RECIPES", 0);  //Set this to 0 if you don't need support for one time use recipes.

        string sRecipeName;
        int nNumComponents;

        int i;
        for (i = 1; i <= nNumRecipes; i ++) {

            switch (i) {

                /* Note that Recipe 1 and 2 share one of the same items.  This is ok
                   because the item is not the first (key) item in either recipe. */

                case 1: sRecipeName = "Invader Full Plate";
                        SetLocalArrayString(oChest, "RECIPE", i, sRecipeName);

                        nNumComponents = 2;
                        SetLocalArrayInt(oChest, "NUM_COMPONENTS", i, nNumComponents);

                        SetLocalArrayString(oChest, sRecipeName, 1, "ReliefSlashingArmor");
                        SetLocalArrayString(oChest, sRecipeName, 2, "ek_diamond");

                        SetLocalString(oChest, sRecipeName + "Reward", "InvadersFullplate");

                        SetLocalInt(oChest, sRecipeName + "ONE_TIME_RECIPE", 0);
                        SetLocalInt(oChest, sRecipeName + "ALREADY_MADE", 0);
                        break;

                case 2: sRecipeName = "Royal Hunter Longbow";
                        SetLocalArrayString(oChest, "RECIPE", i, sRecipeName);

                        nNumComponents = 2;
                        SetLocalArrayInt(oChest, "NUM_COMPONENTS", i, nNumComponents);

                        SetLocalArrayString(oChest, sRecipeName, 1, "StrongShortbow");
                        SetLocalArrayString(oChest, sRecipeName, 2, "ek_topaz");

                        SetLocalString(oChest, sRecipeName + "Reward", "RoyalHunterLongbow");

                        SetLocalInt(oChest, sRecipeName + "ONE_TIME_RECIPE", 0);
                        SetLocalInt(oChest, sRecipeName + "ALREADY_MADE", 0);
                        break;

                case 3: sRecipeName = "Invader Hide Armor";
                        SetLocalArrayString(oChest, "RECIPE", i, sRecipeName);

                        nNumComponents = 2;
                        SetLocalArrayInt(oChest, "NUM_COMPONENTS", i, nNumComponents);

                        SetLocalArrayString(oChest, sRecipeName, 1, "ReliefBludgeoningArmor");
                        SetLocalArrayString(oChest, sRecipeName, 2, "ek_diamond");

                        SetLocalString(oChest, sRecipeName + "Reward", "InvadersHideArmor");

                        SetLocalInt(oChest, sRecipeName + "ONE_TIME_RECIPE", 0);
                        SetLocalInt(oChest, sRecipeName + "ALREADY_MADE", 0);
                        break;

                case 4: sRecipeName = "Invader Helmet";
                        SetLocalArrayString(oChest, "RECIPE", i, sRecipeName);

                        nNumComponents = 2;
                        SetLocalArrayInt(oChest, "NUM_COMPONENTS", i, nNumComponents);

                        SetLocalArrayString(oChest, sRecipeName, 1, "TravellersHelm");
                        SetLocalArrayString(oChest, sRecipeName, 2, "ek_ruby");

                        SetLocalString(oChest, sRecipeName + "Reward", "InvadersHelmet");

                        SetLocalInt(oChest, sRecipeName + "ONE_TIME_RECIPE", 0);
                        SetLocalInt(oChest, sRecipeName + "ALREADY_MADE", 0);
                        break;

                case 5: sRecipeName = "RoyalPriestMagicStaff";
                        SetLocalArrayString(oChest, "RECIPE", i, sRecipeName);

                        nNumComponents = 2;
                        SetLocalArrayInt(oChest, "NUM_COMPONENTS", i, nNumComponents);

                        SetLocalArrayString(oChest, sRecipeName, 1, "LionheartsMagicStaff");
                        SetLocalArrayString(oChest, sRecipeName, 2, "ek_topaz");

                        SetLocalString(oChest, sRecipeName + "Reward", "RoyalPriestMagicStaff");

                        SetLocalInt(oChest, sRecipeName + "ONE_TIME_RECIPE", 0);
                        SetLocalInt(oChest, sRecipeName + "ALREADY_MADE", 0);
                        break;


                case 6: sRecipeName = "RoyalKnightGreataxe";
                        SetLocalArrayString(oChest, "RECIPE", i, sRecipeName);

                        nNumComponents = 2;
                        SetLocalArrayInt(oChest, "NUM_COMPONENTS", i, nNumComponents);

                        SetLocalArrayString(oChest, sRecipeName, 1, "ThrustGreataxe");
                        SetLocalArrayString(oChest, sRecipeName, 2, "ek_topaz");

                        SetLocalString(oChest, sRecipeName + "Reward", "RoyalKnightGreataxe");

                        SetLocalInt(oChest, sRecipeName + "ONE_TIME_RECIPE", 0);
                        SetLocalInt(oChest, sRecipeName + "ALREADY_MADE", 0);
                        break;



            }

        }
    }
    SetLocalInt(oChest, "IS_SET_UP", 1);
}