Example #1
0
    private void removeIngrediences(BaseRecipe Recipe)
    {
        Hashtable neededResources = Recipe.getNeededIngredients();

        foreach(string name in neededResources.Keys)
        {
            int count = (int)neededResources[name];
            BaseIngredient item = Ingredients.Instance().GetSingleIngredient(name);
            PlayerModel.Instance().removeCountOfIngredience(item, count);
        }
    }
Example #2
0
        public override List <BaseRecipe> AddRecipes()
        {
            List <BaseRecipe> ret    = new List <BaseRecipe>();
            BaseRecipe        rec1   = new BaseRecipe("logtemperatehorizonal", true);
            InventoryItem     result = new InventoryItem("logtemperatehorizonal");

            rec1.Result.Add(result);
            InventoryItem requirements = new InventoryItem("logtemperate");

            rec1.Requirements.Add(requirements);
            ret.Add(rec1);
            return(ret);
        }
Example #3
0
    public bool createPhiole(BaseRecipe Recipe)
    {
        Hashtable itemsOfPlayer = PlayerModel.Instance().convertInventoryToHashTable();
        if(PlayerModel.Instance().phialSizeMax>PlayerModel.Instance().PhialInventory.Count)
        {
            if (Recipe.checkIfBrewingPossible(itemsOfPlayer))
            {

                PlayerModel.Instance().addPhialToinventory(Recipe.phialType);
                removeIngrediences(Recipe);
                return true;
            }
        }
        return false;
    }
Example #4
0
    private void InitRecipes()
    {
        BaseRecipe Healpotion = new BaseRecipe(PlayerModel.PhialType.Heal);
        Healpotion.addNeededIngredient(Strings.WATER, 1);
        Healpotion.addNeededIngredient(Strings.HERB, 1);
        ListOfRecipes.Add(PlayerModel.PhialType.Heal.ToString(), Healpotion);

        BaseRecipe Firepotion = new BaseRecipe(PlayerModel.PhialType.Fire);
        Firepotion.addNeededIngredient(Strings.OIL, 1);
        Firepotion.addNeededIngredient(Strings.PHOENIXASH, 1);
        ListOfRecipes.Add(PlayerModel.PhialType.Fire.ToString(), Firepotion);

        BaseRecipe Icepotion = new BaseRecipe(PlayerModel.PhialType.Ice);
        Icepotion.addNeededIngredient(Strings.WATER, 1);
        Icepotion.addNeededIngredient(Strings.CRISTALFLOWER, 1);
        ListOfRecipes.Add(PlayerModel.PhialType.Ice.ToString(), Icepotion);
    }
Example #5
0
    void InitializingArray()
    {
        string[]        FieldName;
        List <string[]> DataList;

        BaseRecipeList = new List <BaseRecipe>();
        FieldName      = new string[] { "Type", "Input", "Processor" };
        DataList       = new List <string[]>();

        int CurArr = 0;

        xmlReader.xmlReaderAccess.ReadXml("Data/Tech/XML/Recipeinfo", "RecipeInfo/Recipe", FieldName, DataList);

        foreach (string[] Data in DataList)
        {
            BaseRecipe newRecipe = new BaseRecipe();
            newRecipe.ObjectID  = CurArr++;
            newRecipe.Name      = Data[0];
            newRecipe.InputName = new List <string[]>();
            string[] InputStringArray = Data[1].Split(';');
            foreach (var Inputs in InputStringArray)
            {
                List <string> InputList = new List <string>();
                InputList.AddRange(Inputs.Split(','));
                InputList.Sort();
                newRecipe.InputName.Add(InputList.ToArray());
            }
            newRecipe.RequiredProcessor = Data[2];

            BaseRecipeList.Add(newRecipe);
        }

        RecipeArray = new List <Recipe>();

        string ObjectName;
        string outputName;

        string[]       inputName;
        string         requiredProcessor;
        Attractiveness attractiveness;

        ObjectName                   = "Silicon mass";
        outputName                   = "Silicon mass";
        inputName                    = null;
        requiredProcessor            = null;
        attractiveness               = new Attractiveness();
        attractiveness.MaterialPoint = 0.5f;
        attractiveness.TechPoint     = 0f;
        attractiveness.LookPoint     = 0f;
        attractiveness.TotalPoint    = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint;
        AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness);

        ObjectName                   = "Plastic mass";
        outputName                   = "Plastic mass";
        inputName                    = null;
        requiredProcessor            = null;
        attractiveness               = new Attractiveness();
        attractiveness.MaterialPoint = 0.5f;
        attractiveness.TechPoint     = 0f;
        attractiveness.LookPoint     = 0.5f;
        attractiveness.TotalPoint    = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint;
        AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness);

        ObjectName                   = "Steel mass";
        outputName                   = "Steel mass";
        inputName                    = null;
        requiredProcessor            = null;
        attractiveness               = new Attractiveness();
        attractiveness.MaterialPoint = 0.5f;
        attractiveness.TechPoint     = 0f;
        attractiveness.LookPoint     = 0f;
        attractiveness.TotalPoint    = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint;
        AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness);

        ObjectName                   = "Copper mass";
        outputName                   = "Copper mass";
        inputName                    = null;
        requiredProcessor            = null;
        attractiveness               = new Attractiveness();
        attractiveness.MaterialPoint = 0.5f;
        attractiveness.TechPoint     = 0f;
        attractiveness.LookPoint     = 0f;
        attractiveness.TotalPoint    = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint;
        AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness);

        ObjectName                   = "Paper roll";
        outputName                   = "Paper roll";
        inputName                    = null;
        requiredProcessor            = null;
        attractiveness               = new Attractiveness();
        attractiveness.MaterialPoint = 0.5f;
        attractiveness.TechPoint     = 0f;
        attractiveness.LookPoint     = 0f;
        attractiveness.TotalPoint    = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint;
        AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness);

        ObjectName                   = "Chemical mix";
        outputName                   = "Chemical mix";
        inputName                    = null;
        requiredProcessor            = null;
        attractiveness               = new Attractiveness();
        attractiveness.MaterialPoint = 0.5f;
        attractiveness.TechPoint     = 0f;
        attractiveness.LookPoint     = 0f;
        attractiveness.TotalPoint    = attractiveness.MaterialPoint * attractiveness.TechPoint + attractiveness.LookPoint;
        AddRecipeArray(ObjectName, outputName, inputName, requiredProcessor, attractiveness);
    }
Example #6
0
        public bool addRecipe(BaseRecipe recipe)
        {
            if (!getIsRecipeFounded(recipe.name))
            {
                FoundedRecipes.Add(recipe);
                return true;
            }

            return false;
        }
Example #7
0
 public BaseRecipe[] GetAllRecipes()
 {
     BaseRecipe[] Values = new BaseRecipe[ListOfRecipes.Count];
     ListOfRecipes.Values.CopyTo(Values, 0);
     return Values;
 }