Beispiel #1
0
 public void loadTable()
 {
     Entity.entities.Clear();
     XMLHelpers.currentFileName = this.entityFile.name;
     this.loadFromString((string)TDLHookClass.LoadTDLHook(new object[] { "loadEntityTable" }));
     XMLHelpers.currentFileName = this.entityAimFile.name;
     if (EntityTable.ensureAimXmlFileName())
     {
         try
         {
             string str = File.ReadAllText(EntityTable.aimXmlFileFullName);
             if (str.Length > 0)
             {
                 TDLLogging.LogRuntimeInfo("entity_table_aim_1", string.Concat("Loaded aim.xml data from SVN project location. ", EntityTable.aimXmlFileFullName));
                 this.loadAimFromString(str);
                 return;
             }
         }
         catch
         {
         }
     }
     TDLLogging.LogRuntimeInfo("entity_table_aim_2", "Loaded aim.xml data from normal TDL.exe bundle.");
     this.loadAimFromString(this.entityAimFile.text);
 }
Beispiel #2
0
        private void loadRecipes(string workingPath)
        {
            if (File.Exists(workingPath + "/recipies.xml"))
            {
                //We are modifying catagories, lets go
                XmlDocument craftingDoc = new XmlDocument();
                //Load the file
                craftingDoc.LoadXml(System.IO.File.ReadAllText(workingPath += "/recipies.xml"));


                //...Not gunna lie, lifted from TDL IL Code
                foreach (XmlNode current in craftingDoc.ChildNodes)
                {
                    if (current.Name != "crafting")
                    {
                        continue;
                    }
                    foreach (XmlNode xmlNodes in current.ChildNodes)
                    {
                        if (xmlNodes.Name != "recipe")
                        {
                            continue;
                        }
                        CraftingRecipe craftingRecipe = new CraftingRecipe();
                        craftingRecipe.Load(xmlNodes);
                        if (!CraftingDefinitions.recipes.ContainsKey(craftingRecipe.name))
                        {
                            CraftingDefinitions.recipes[craftingRecipe.name] = craftingRecipe;
                        }
                        else
                        {
                            TDLLogging.LogError("reci_1", string.Concat("ERROR - Duplicate recipe name in recipies.xml: ", craftingRecipe.name));
                            CraftingDefinitions.recipes[string.Concat(craftingRecipe.name, "_error")] = craftingRecipe;
                        }
                    }
                }
            }
        }