Esempio n. 1
0
        public static void Dump()
        {
            SL.LogWarning("[Dataminer] Starting full dump!");

            // setup tags
            for (int i = 1; i < 500; i++)
            {
                if (TagSourceManager.Instance.GetTag(i.ToString()) is Tag tag)
                {
                    ListManager.AddTagSource(tag, null);
                }
            }

            DM_Item.ParseAllItems();

            DM_StatusEffect.ParseAllEffects();

            DM_Recipe.ParseAllRecipes();

            DM_EnchantmentRecipe.ParseAllRecipes();

            SL.LogWarning("Saving early lists...");
            ListManager.SaveEarlyLists();

            SL.LogWarning("Finished prefab dumping.");
        }
        public static void ParseAllRecipes()
        {
            var recipes = (Dictionary <int, EnchantmentRecipe>)At.GetField(RecipeManager.Instance, "m_enchantmentRecipes");

            if (recipes == null)
            {
                SL.Log("null enchantment dict!");
                return;
            }

            SL.Log("Parsing Enchantments...");

            foreach (var recipe in recipes.Values)
            {
                if (recipe.RecipeID <= 0)
                {
                    recipe.InitID();
                }

                var enchantment = ResourcesPrefabManager.Instance.GetEnchantmentPrefab(recipe.RecipeID);

                if (!enchantment)
                {
                    SL.Log("null enchantment!");
                    continue;
                }

                var template = new DM_EnchantmentRecipe();
                template.Serialize(recipe, enchantment);

                string dir      = Serializer.Folders.Enchantments;
                string saveName = template.Name + " (" + template.RecipeID + ")";

                ListManager.EnchantmentRecipes.Add(template.RecipeID.ToString(), template);
                Serializer.SaveToXml(dir, saveName, template);
            }
        }