public static void ResetMutationCosts() { foreach (MutationCategory mc in Egcb_MutableMutations.MutationData) { foreach (MutationEntry me in mc.Entries) { //reset all mutation costs to the value specified in the core Mutations.xml file string opName = Egcb_MutableMutations.GetOptionNameForMutationCost(me); Options.SetOption(opName, Egcb_MutableMutations.GetDefaultCostForMutationValueArray(me)); } } Debug.Log("Mutable Mutations Mod - Reset all mutation costs to default."); }
private static void CreateOptionsList() { Egcb_MutableMutations.OptionsList.Clear(); //create a reset option to restore game defaults GameOption resetOp = new GameOption(); resetOp.ID = Egcb_MutableMutations.ResetMutationValueOptionID; resetOp.DisplayText = "Reset all mutation costs to default (after closing Options)"; resetOp.Category = Egcb_MutableMutations.OptionsCategoryName; resetOp.Type = "Checkbox"; resetOp.Default = "No"; Egcb_MutableMutations.OptionsList.Add(resetOp.ID); Egcb_MutableMutations.AddNewGameOption(resetOp); foreach (MutationCategory mc in Egcb_MutableMutations.MutationData) { string mutationCategoryName = ConsoleLib.Console.ColorUtility.StripFormatting(mc.DisplayName).TrimEnd('s'); foreach (MutationEntry me in mc.Entries) { string optionName = Egcb_MutableMutations.GetOptionNameForMutationCost(me); Egcb_MutableMutations.OptionsList.Add(optionName); if (Options.OptionsByID.ContainsKey(optionName) || me.Cost == 0) //also skip 0 cost vanilla entries, if they exist, because we won't really know what Values range to use { continue; } //option doesn't exist, so we'll create it GameOption gameOption = new GameOption(); gameOption.ID = optionName; gameOption.DisplayText = Egcb_MutableMutations.GetMutationCostOptionDisplayText(me); gameOption.Category = Egcb_MutableMutations.OptionsCategoryName; gameOption.Type = "Combo"; gameOption.Values = Egcb_MutableMutations.GetCostValueArrayForMutation(me); gameOption.Default = Egcb_MutableMutations.GetDefaultCostForMutationValueArray(me); //add to game Options Egcb_MutableMutations.AddNewGameOption(gameOption); } } }