Esempio n. 1
0
    public void LoadData()
    {
        ArrayList data = XMLHandler.LoadXML(dir+filename);

        if(data.Count > 0)
        {
            foreach(Hashtable entry in data)
            {
                if(entry[XMLHandler.NODE_NAME] as string == ItemRecipeData.ITEMRECIPES)
                {
                    if(entry.ContainsKey(XMLHandler.NODES))
                    {
                        ArrayList subs = entry[XMLHandler.NODES] as ArrayList;
                        icon = new string[subs.Count];
                        recipe = new ItemRecipe[subs.Count];

                        foreach(Hashtable val in subs)
                        {
                            if(val[XMLHandler.NODE_NAME] as string == ItemRecipeData.ITEMRECIPE)
                            {
                                int i = int.Parse((string)val["id"]);
                                icon[i] = "";
                                recipe[i] = new ItemRecipe();
                                recipe[i].outcome.SetData(val);
                                recipe[i].ingredient = new ItemShort[int.Parse((string)val["ingredients"])];

                                if(val.ContainsKey("formula"))
                                {
                                    recipe[i].useFormula = true;
                                    recipe[i].formulaID = int.Parse((string)val["formula"]);
                                }

                                ArrayList s = val[XMLHandler.NODES] as ArrayList;
                                foreach(Hashtable ht in s)
                                {
                                    this.LoadLanguages(ht, i, subs.Count);
                                    if(ht[XMLHandler.NODE_NAME] as string == ItemRecipeData.INGREDIENT)
                                    {
                                        recipe[i].ingredient[int.Parse((string)ht["id"])] = new ItemShort(ht);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Esempio n. 2
0
 public void AddRecipe(string n, string d, int count)
 {
     base.AddBaseData(n, d, count);
     this.recipe = ArrayHelper.Add(new ItemRecipe(), this.recipe);
 }
Esempio n. 3
0
 public override void Copy(int index)
 {
     base.Copy(index);
     this.recipe = ArrayHelper.Add(this.GetCopy(index), this.recipe);
 }
Esempio n. 4
0
 public override void RemoveData(int index)
 {
     base.RemoveData(index);
     this.recipe = ArrayHelper.Remove(index, this.recipe);
 }