Ejemplo n.º 1
0
        private void AdvancedSelection(IGenericModConfigMenuApi configMenu)
        {
            configMenu.AddSectionTitle(
                mod: this.ModManifest,
                text: () => "Advanced Options"
                );

            configMenu.AddParagraph(
                mod: this.ModManifest,
                text: () => "Only modify these values if you absolutely have to."
                );

            configMenu.AddBoolOption(
                mod: this.ModManifest,
                name: () => "Use Input Box vs Dialog Boxes",
                tooltip: () => "Uses input box to enter a custom amount of money to borrow.",
                getValue: () => this.Config.CustomMoneyInput,
                setValue: value => this.Config.CustomMoneyInput = value
                );

            configMenu.AddBoolOption(
                mod: this.ModManifest,
                name: () => "Reset Loan Profile",
                tooltip: () => "Resets the loan profile on the next save file you load.",
                getValue: () => this.Config.Reset,
                setValue: value => this.Config.Reset = value
                );
        }
Ejemplo n.º 2
0
        internal override void RegisterOptions(
            IGenericModConfigMenuApi configApi,
            IManifest manifest,
            ITranslationHelper translations
            )
        {
            Translation Name(string key) => translations.Get($"text.config.chances.treasure.{key}.name");
            Translation Desc(string key) => translations.Get($"text.config.chances.treasure.{key}.desc");

            base.RegisterOptions(configApi, manifest, translations);

            configApi.AddNumberOption(
                manifest,
                () => (float)this.MagnetFactor,
                val => this.MagnetFactor = val,
                () => Name("magnetFactor"),
                () => Desc("magnetFactor"),
                0f,
                1f
                );
            configApi.AddNumberOption(
                manifest,
                () => (float)this.TreasureHunterFactor,
                val => this.TreasureHunterFactor = val,
                () => Name("treasureHunterFactor"),
                () => Desc("treasureHunterFactor"),
                0f,
                1f
                );
        }
Ejemplo n.º 3
0
        private void MainSection(IGenericModConfigMenuApi configMenu)
        {
            configMenu.AddSectionTitle(
                mod: this.ModManifest,
                text: () => "Main Options"
                );

            configMenu.AddKeybind(
                mod: this.ModManifest,
                getValue: () => this.Config.LoanButton,
                setValue: value => this.Config.LoanButton = value,
                name: () => "Change Keybind",
                tooltip: () => "Change the button to press to open the loan menu."
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.LatePaymentChargeRate,
                setValue: value => this.Config.LatePaymentChargeRate = (float)value,
                name: () => "Late Payment Interest Rate",
                min: 0f,
                interval: 100f
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.MaxBorrowAmount,
                setValue: value => this.Config.MaxBorrowAmount = (int)value,
                name: () => "Maximum Borrow Amount",
                min: 100f,
                interval: 100f
                );
        }
        public static void AddMultiSelectTextOption <T>(
            this IGenericModConfigMenuApi api,
            IManifest mod,
            Func <IReadOnlySet <T> > getValues,
            Action <IReadOnlySet <T> > setValues,
            Func <string> name,
            Func <float, int> columns,
            T[] allowedValues,
            Func <string>?tooltip = null,
            Func <T, string>?formatAllowedValue = null
            )
        {
            Lazy <IReadOnlySet <T> > originalValues = new(() => getValues());
            Lazy <ISet <T> >         currentValues  = new(() => originalValues.Value.ToHashSet());

            AddMultiSelectTextOption(
                api: api,
                mod: mod,
                getValue: originalValues.Value.Contains,
                addValue: value => currentValues.Value.Add(value),
                removeValue: value => currentValues.Value.Remove(value),
                name: name,
                columns: columns,
                allowedValues: allowedValues,
                tooltip: tooltip,
                formatAllowedValue: formatAllowedValue,
                afterValuesUpdated: () => setValues((IReadOnlySet <T>)currentValues.Value)
                );
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Setup the Generic Mod Config Menu API.
        /// </summary>
        public static void SetUpModConfigMenu(ModConfig config, ModEntry mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () =>
            {
                config = new ModConfig();
                mod.SaveConfig(config);
            }, () => mod.SaveConfig(config));

            api.SetDefaultIngameOptinValue(manifest, true);

            api.RegisterLabel(manifest, "General", null);

            api.RegisterSimpleOption(manifest, "Item To Catch If All Fish Is Excluded", "The ID of the item to catch if all possible fish for this water body / season / weather is excluded.", () => config.ItemToCatchIfAllFishIsExcluded, (int val) => config.ItemToCatchIfAllFishIsExcluded = val);
            api.RegisterClampedOption(manifest, "Times To Retry", "The number of times to retry the 'fish choosing' algorithm before giving up and catching the item specified above.", () => config.TimesToRetry, (int val) => config.TimesToRetry = val, 5, 50);

            api.RegisterParagraph(manifest, "To edit the actual excluded fish, please use the config file. For instructions on how to add the exclusions, refer to the mod description on Nexus. Thanks!");
        }
        public static void SetUpModConfigMenu(WateringGrantsXPConfig config, WateringGrantsXP mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () => config = new WateringGrantsXPConfig(), delegate { mod.Helper.WriteConfig(config); VerifyConfigValues(config, mod); });

            api.RegisterLabel(manifest, "Watering Grants XP", null);

            api.RegisterSimpleOption(manifest, "Amount Of Experience", null, () => config.WateringExperienceAmount, (int val) => config.WateringExperienceAmount = val);
            api.RegisterClampedOption(manifest, "Chance To Get XP", null, () => config.WateringChanceToGetXP, (int val) => config.WateringChanceToGetXP          = val, 0, 100);
            api.RegisterSimpleOption(manifest, "Forage Seed Watering\nGrants Foraging XP", null, () => config.ForageSeedWateringGrantsForagingXP, (bool val) => config.ForageSeedWateringGrantsForagingXP = val);

            api.RegisterLabel(manifest, "Crops Die Without Water", null);

            api.RegisterSimpleOption(manifest, "Withering Feature Enabled", null, () => config.CropsCanDieWithoutWater, (bool val) => config.CropsCanDieWithoutWater = val);
            api.RegisterSimpleOption(manifest, "Days For Chance Of Withering", null, () => config.DaysWithoutWaterForChanceToDie, (int val) => config.DaysWithoutWaterForChanceToDie = val);
            api.RegisterClampedOption(manifest, "Chance For Withering", null, () => config.ChanceToDieWhenLeftForTooLong, (int val) => config.ChanceToDieWhenLeftForTooLong          = val, 0, 100);

            api.RegisterLabel(manifest, "Other", null);

            api.RegisterSimpleOption(manifest, "Can't Refill Watering Can\nWith Salt Water", null, () => config.CantRefillCanWithSaltWater, (bool val) => config.CantRefillCanWithSaltWater = val);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Setup the Generic Mod Config Menu API.
        /// </summary>
        public static void SetUpModConfigMenu(ModConfig config, ModEntry mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () =>
            {
                config = new ModConfig();
                mod.SaveConfig(config);
            }, () => mod.SaveConfig(config));

            api.SetDefaultIngameOptinValue(manifest, true);

            api.RegisterLabel(manifest, "Appearance", null);

            api.RegisterSimpleOption(manifest, "Darker Background In Winter", "Whether to show a darker gradient background in winter for better text readability.", () => config.DarkerBackgroundInWinter, (bool val) => config.DarkerBackgroundInWinter = val);
            api.RegisterSimpleOption(manifest, "Show Portrait On The Left", "Whether to move the character portrait to the left of the text.", () => config.ShowPortraitOnTheLeft, (bool val) => config.ShowPortraitOnTheLeft = val);
            api.RegisterSimpleOption(manifest, "Show Speaker Name", "Whether to show the speaker's name above the portrait.", () => config.ShowSpeakerName, (bool val) => config.ShowSpeakerName = val);
            api.RegisterSimpleOption(manifest, "Show Friendship Jewel", "Whether to show the friendship jewel.", () => config.ShowFriendshipJewel, (bool val) => config.ShowFriendshipJewel      = val);
        }
        public static void SetUpModConfigMenu(TreeOverhaulConfig config, TreeOverhaul mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () => config = new TreeOverhaulConfig(), delegate { mod.Helper.WriteConfig(config); VerifyConfigValues(config, mod); });

            api.RegisterLabel(manifest, "General Tweaks", null);

            api.RegisterSimpleOption(manifest, "Stop Seed Growth In Shade", "Seeds don't sprout in the 8 surrounding tiles of a tree", () => config.StopShadeSaplingGrowth, (bool val) => config.StopShadeSaplingGrowth = val);
            api.RegisterSimpleOption(manifest, "Growth Ignores Stumps", "Trees can grow even if a small stump is next to them", () => config.GrowthIgnoresStumps, (bool val) => config.GrowthIgnoresStumps = val);
            api.RegisterChoiceOption(manifest, "Save Sprouts From Tools", "Normal and fruit trees can't be killed by the selected tools", () => GetElementFromConfig(SSChoices, config.SaveSprouts), (string val) => config.SaveSprouts = GetIndexFromArrayElement(SSChoices, val), SSChoices);

            api.RegisterLabel(manifest, "Winter Tweaks", null);

            api.RegisterSimpleOption(manifest, "Normal Trees Grow In Winter", null, () => config.NormalTreesGrowInWinter, (bool val) => config.NormalTreesGrowInWinter            = val);
            api.RegisterSimpleOption(manifest, "Mushroom Trees Grow In Winter", null, () => config.MushroomTreesGrowInWinter, (bool val) => config.MushroomTreesGrowInWinter      = val);
            api.RegisterSimpleOption(manifest, "Fruit Trees Don't Grow In Winter", null, () => config.FruitTreesDontGrowInWinter, (bool val) => config.FruitTreesDontGrowInWinter = val);

            api.RegisterLabel(manifest, "Buffs And Nerfs", null);

            api.RegisterSimpleOption(manifest, "Buff Mahogany Tree Growth", "20% unfertilized and 100% fertilized (from 15% and 60%)", () => config.BuffMahoganyTrees, (bool val) => config.BuffMahoganyTrees = val);
            api.RegisterClampedOption(manifest, "Seed Chance From Shaking", "Chance that a seed drops from shaking a tree (default: 5%, chance depends on host)", () => config.ShakingSeedChance, (int val) => config.ShakingSeedChance     = val, 0, 100);
            api.RegisterSimpleOption(manifest, "Faster Normal Tree Growth", "Normal trees try to grow twice every day, still random whether they succeed", () => config.FasterNormalTreeGrowth, (bool val) => config.FasterNormalTreeGrowth = val);
            api.RegisterChoiceOption(manifest, "Fruit Tree Growth Options", null, () => GetElementFromConfig(FTChoices, config.FruitTreeGrowth), (string val) => config.FruitTreeGrowth = GetIndexFromArrayElement(FTChoices, val), FTChoices);
        }
Ejemplo n.º 9
0
        public void InitializeMenu(IManifest manifest, ModConfig config)
        {
            IGenericModConfigMenuApi api = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api != null)
            {
                api.RegisterModConfig(manifest, () => config = new ModConfig(), () => Helper.WriteConfig <ModConfig>(config));

                api.RegisterLabel(manifest, "Auto Animal Doors", "");

                api.RegisterSimpleOption(manifest, "Auto Open Enabled",
                                         "Enables or disables the auto opening of animal doors.",
                                         () => config.AutoOpenEnabled,
                                         (bool autoOpenEnabled) => config.AutoOpenEnabled = autoOpenEnabled);

                api.RegisterSimpleOption(manifest, "Animal Door Open Time",
                                         "The time animal doors are scheduled to open (730 -> 7:30 am, 1310 -> 1:10 pm).",
                                         () => config.AnimalDoorOpenTime,
                                         (int newOpenTime) => config.AnimalDoorOpenTime = newOpenTime);

                api.RegisterSimpleOption(manifest, "Animal Door Close Time",
                                         "The time animal doors are scheduled to close (730 -> 7:30 am, 1310 -> 1:10 pm).",
                                         () => config.AnimalDoorCloseTime,
                                         (int newOpenTime) => config.AnimalDoorCloseTime = newOpenTime);

                api.RegisterChoiceOption(manifest, "Coop Required Upgrade Level",
                                         "The coop upgrade level required for auto open/close.",
                                         () => GetAnimalBuildingUpgradeLevelName(config.CoopRequiredUpgradeLevel),
                                         (string newLevel) => config.CoopRequiredUpgradeLevel = GetAnimalBuildingUpgradeLevel(newLevel), animalBuildingLevelNames);

                api.RegisterChoiceOption(manifest, "Barn Required Upgrade Level",
                                         "The barn upgrade level required for auto open/close.",
                                         () => GetAnimalBuildingUpgradeLevelName(config.BarnRequiredUpgradeLevel),
                                         (string newLevel) => config.BarnRequiredUpgradeLevel = GetAnimalBuildingUpgradeLevel(newLevel),
                                         animalBuildingLevelNames);

                api.RegisterChoiceOption(manifest, "Door Sound Setting",
                                         "When to play/not play the door sound when doors are opened and closed.",
                                         () => config.DoorSoundSetting.Name(),
                                         (string doorSoundSettingName) => config.DoorSoundSetting = DoorSoundSettingUtils.FromName(doorSoundSettingName),
                                         DoorSoundSettingUtils.Names);


                api.RegisterSimpleOption(manifest, "Open Doors When Raining",
                                         "Enables or disables opening doors when raining/lightning.",
                                         () => config.OpenDoorsWhenRaining,
                                         (bool autoOpenEnabled) => config.OpenDoorsWhenRaining = autoOpenEnabled);

                api.RegisterSimpleOption(manifest, "Open Doors During Winter",
                                         "Enables or disables opening doors during winter.",
                                         () => config.OpenDoorsDuringWinter,
                                         (bool autoOpenEnabled) => config.OpenDoorsDuringWinter = autoOpenEnabled);
            }
        }
Ejemplo n.º 10
0
        internal bool HookIntoGenericModConfigMenu(IModHelper helper)
        {
            _genericModConfigMenuApi = helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (_genericModConfigMenuApi is null)
            {
                _monitor.Log("Failed to hook into spacechase0.GenericModConfigMenu.", LogLevel.Error);
                return(false);
            }

            _monitor.Log("Successfully hooked into spacechase0.GenericModConfigMenu.", LogLevel.Debug);
            return(true);
        }
Ejemplo n.º 11
0
        /*********
        ** Public methods
        *********/
        /// <summary>Add a config UI to Generic Mod Config Menu if it's installed.</summary>
        /// <param name="manifest">The mod manifest.</param>
        /// <param name="modRegistry">The mod registry from which to get the API.</param>
        /// <param name="monitor">The monitor with which to log errors.</param>
        /// <param name="professionData">The professions by skill and level requirement.</param>
        /// <param name="getConfig">Get the current mod configuration.</param>
        /// <param name="reset">Reset the config to its default values.</param>
        /// <param name="save">Save the current config to the <c>config.json</c> file.</param>
        public static void Register(IManifest manifest, IModRegistry modRegistry, IMonitor monitor, ModDataProfessions[] professionData, Func <ModConfig> getConfig, Action reset, Action save)
        {
            // get API
            IGenericModConfigMenuApi api = IntegrationHelper.GetGenericModConfigMenu(modRegistry, monitor);

            if (api == null)
            {
                return;
            }

            // add config UI based on profession map
            api.Register(manifest, reset, save);
            api.AddParagraph(manifest, I18n.Config_Intro);
            foreach ((Skill skill, int level, Profession[] professions) in GenericModConfigMenuIntegration.GetProfessionMappings(professionData))
Ejemplo n.º 12
0
        private void LegacyMoneySection(IGenericModConfigMenuApi configMenu)
        {
            configMenu.AddSectionTitle(
                mod: this.ModManifest,
                text: () => "Money Amount Dialog"
                );

            configMenu.AddParagraph(
                mod: this.ModManifest,
                text: () => "Only modify these values if you DO NOT have \"Use Input Box\" checked."
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.MoneyAmount1,
                setValue: value => this.Config.MoneyAmount1 = (int)value,
                name: () => "Money Amount 1",
                min: 0f,
                interval: 100f
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.MoneyAmount2,
                setValue: value => this.Config.MoneyAmount2 = (int)value,
                name: () => "Money Amount 2",
                min: 0f,
                interval: 100f
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.MoneyAmount3,
                setValue: value => this.Config.MoneyAmount3 = (int)value,
                name: () => "Money Amount 3",
                min: 0f,
                interval: 100f
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.MoneyAmount4,
                setValue: value => this.Config.MoneyAmount4 = (int)value,
                name: () => "Money Amount 4",
                min: 0f,
                interval: 100f
                );
        }
        public static void SetUpModConfigMenu(MaritimeSecretsConfig config, MaritimeSecrets mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () => config = new MaritimeSecretsConfig(), delegate { mod.Helper.WriteConfig(config); VerifyConfigValues(config, mod); });

            api.AddTextOption(manifest, () => GetElementFromConfig(SpeechChoices, config.MarinerSpeechType), (string val) => config.MarinerSpeechType = GetIndexFromArrayElement(SpeechChoices, val), () => mod.Helper.Translation.Get("ConfigMarinerSpeechType"), null, SpeechChoices, (s) => TranslateSpeechChoice(s, mod));
            api.AddBoolOption(manifest, () => config.ChangePendantPriceToPearl, (bool val) => config.ChangePendantPriceToPearl = val, () => mod.Helper.Translation.Get("ConfigChangePendantPriceToPearl"));
        }
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="modRegistry">An API for fetching metadata about loaded mods.</param>
        /// <param name="monitor">Encapsulates monitoring and logging.</param>
        /// <param name="consumerManifest">The manifest for the mod consuming the API.</param>
        /// <param name="getConfig">Get the current config model.</param>
        /// <param name="reset">Reset the config model to the default values.</param>
        /// <param name="saveAndApply">Save and apply the current config model.</param>
        public GenericModConfigMenuIntegration(IModRegistry modRegistry, IMonitor monitor, IManifest consumerManifest, Func <TConfig> getConfig, Action reset, Action saveAndApply)
            : base("Generic Mod Config Menu", "spacechase0.GenericModConfigMenu", "1.1.0", modRegistry, monitor)
        {
            // init
            this.ConsumerManifest = consumerManifest;
            this.GetConfig        = getConfig;
            this.Reset            = reset;
            this.SaveAndApply     = saveAndApply;

            // get mod API
            if (this.IsLoaded)
            {
                this.ModApi   = this.GetValidatedApi <IGenericModConfigMenuApi>();
                this.IsLoaded = this.ModApi != null;
            }
        }
Ejemplo n.º 15
0
        void IModConfig.RegisterOptions(
            IGenericModConfigMenuApi configApi,
            IManifest manifest,
            ITranslationHelper translations
            )
        {
            Translation Name(string key) => translations.Get($"text.config.hud.{key}.name");
            Translation Desc(string key) => translations.Get($"text.config.hud.{key}.desc");

            configApi.AddBoolOption(
                manifest,
                () => this.ShowFishingHud,
                val => this.ShowFishingHud = val,
                () => Name("showFishingHud"),
                () => Desc("showFishingHud")
                );
            configApi.AddNumberOption(
                manifest,
                () => this.TopLeftX,
                val => this.TopLeftX = val,
                () => Name("topLeftX"),
                () => Desc("topLeftX")
                );
            configApi.AddNumberOption(
                manifest,
                () => this.TopLeftY,
                val => this.TopLeftY = val,
                () => Name("topLeftY"),
                () => Desc("topLeftY")
                );
            configApi.AddNumberOption(
                manifest,
                () => this.MaxFishTypes,
                val => this.MaxFishTypes = val,
                () => Name("maxFishTypes"),
                () => Desc("maxFishTypes"),
                0,
                20
                );
            configApi.AddBoolOption(
                manifest,
                () => this.ShowTrash,
                val => this.ShowTrash = val,
                () => Name("showTrash"),
                () => Desc("showTrash")
                );
        }
Ejemplo n.º 16
0
        public static void SetUpModConfigMenu(MushroomRancherConfig config, MushroomRancher mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () => config = new MushroomRancherConfig(), delegate { mod.Helper.WriteConfig(config); VerifyConfigValues(config, mod); });

            api.AddTextOption(manifest, () => GetElementFromConfig(InteriorChoices, config.HutchInterior), (string val) => config.HutchInterior = GetIndexFromArrayElement(InteriorChoices, val), () => mod.Helper.Translation.Get("ConfigHutchInterior"), null, InteriorChoices, (s) => TranslateSpeechChoice(s, mod));
            api.AddBoolOption(manifest, () => config.RemovableSlimeHutchIncubator, (bool val) => config.RemovableSlimeHutchIncubator            = val, () => mod.Helper.Translation.Get("ConfigRemovableSlimeHutchIncubator"));
            api.AddBoolOption(manifest, () => config.RandomizeMonsterPositionInHutch, (bool val) => config.RandomizeMonsterPositionInHutch      = val, () => mod.Helper.Translation.Get("ConfigRandomizeMonsterPositionInHutch"));
        }
Ejemplo n.º 17
0
 internal void AddToGMCM(IGenericModConfigMenuApi api, IManifest mod)
 {
     api.AddComplexOption(
         mod: mod,
         name: Name,
         tooltip: Tooltip,
         draw: (b, position) => Draw(b, position),
         height: () => GetHeight(),
         beforeMenuOpened: () =>
     {
         LastMouseLeftPressed = null;
         LastHoverPosition    = null;
     },
         beforeMenuClosed: () => { },
         afterReset: () => { },
         beforeSave: () => { }
         );
 }
Ejemplo n.º 18
0
        /// <summary>Set up Generic Mod Config Menu integration.</summary>
        public static void SetUpModConfigMenu(ModConfig config, Mod mod)
        {
            // Get the Generic Mod Config Menu API
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api is null)
            {
                return;
            }
            var manifest = mod.ModManifest;

            // Register the Generic Mod Config Menu API
            api.Register(manifest, () => config = new ModConfig(), delegate { mod.Helper.WriteConfig(config); VerifyConfigValues(config, mod); });

            // Options to display
            api.AddNumberOption(manifest, () => config.Example, (int val) => config.Example = val,
                                name: () => "Example config", tooltip: () => "Example tooltip");
        }
        public static void AddMultiSelectTextOption <T>(
            this IGenericModConfigMenuApi api,
            IManifest mod,
            Func <T, bool> getValue,
            Action <T> addValue,
            Action <T> removeValue,
            Func <string> name,
            Func <float, int> columns,
            T[] allowedValues,
            Func <string>?tooltip = null,
            Func <T, string>?formatAllowedValue = null,
            Action?afterValuesUpdated           = null
            )
        {
            var option = new MultiSelectTextOption <T>(getValue, addValue, removeValue, name, columns, allowedValues, tooltip, formatAllowedValue, afterValuesUpdated);

            option.AddToGMCM(api, mod);
        }
Ejemplo n.º 20
0
        public static void SetUpModConfigMenu(RingConfig config, RingOverhaul mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () => config = new RingConfig(), delegate { mod.Helper.WriteConfig(config); VerifyConfigValues(mod, config); });

            api.AddSectionTitle(manifest, () => mod.Helper.Translation.Get("ConfigCraftableGemRings"));

            api.AddBoolOption(manifest, () => config.CraftableGemRings, (bool val) => config.CraftableGemRings = val, () => mod.Helper.Translation.Get("ConfigCraftableGemRings"));

            api.AddTextOption(manifest, () => GetElementFromConfig(ProgressionChoices, config.CraftableGemRingsMetalBar), (string val) => config.CraftableGemRingsMetalBar         = GetIndexFromArrayElement(ProgressionChoices, val), () => mod.Helper.Translation.Get("ConfigCraftableGemRingsMetalBar"), null, ProgressionChoices, (s) => TranslateProgressionChoice(s, mod));
            api.AddTextOption(manifest, () => GetElementFromConfig(UnlockLevelChoices, config.CraftableGemRingsUnlockLevels), (string val) => config.CraftableGemRingsUnlockLevels = GetIndexFromArrayElement(UnlockLevelChoices, val), () => mod.Helper.Translation.Get("ConfigCraftableGemRingsUnlockLevel"), null, UnlockLevelChoices);

            if (mod.Helper.ModRegistry.IsLoaded("BBR.BetterRings"))
            {
                api.AddParagraph(manifest, () => mod.Helper.Translation.Get("ConfigCraftableGemRingsCustomSpritesBetterRings"));
            }
            else
            {
                api.AddBoolOption(manifest, () => config.CraftableGemRingsCustomSprites, (bool val) => config.CraftableGemRingsCustomSprites = val, () => mod.Helper.Translation.Get("ConfigCraftableGemRingsCustomSprites"));
            }

            api.AddSectionTitle(manifest, () => mod.Helper.Translation.Get("ConfigOtherCategory"));

            api.AddBoolOption(manifest, () => config.JukeboxRingEnabled, (bool val) => config.JukeboxRingEnabled         = val, () => mod.Helper.Translation.Get("ConfigJukeboxRing"));
            api.AddBoolOption(manifest, () => config.JukeboxRingWorksInRain, (bool val) => config.JukeboxRingWorksInRain = val, () => mod.Helper.Translation.Get("ConfigJukeboxRingWorksInRain"));

            api.AddBoolOption(manifest, () => config.MinorRingCraftingChanges, (bool val) => config.MinorRingCraftingChanges = val, () => mod.Helper.Translation.Get("ConfigMinorRingCraftingChanges"));
            api.AddBoolOption(manifest, () => config.RemoveCrabshellRingAndImmunityBandTooltipFromCombinedRing, (bool val) => config.RemoveCrabshellRingAndImmunityBandTooltipFromCombinedRing = val, () => mod.Helper.Translation.Get("ConfigRemoveCITooltip"));
            api.AddBoolOption(manifest, () => config.RemoveLuckyTooltipFromCombinedRing, (bool val) => config.RemoveLuckyTooltipFromCombinedRing = val, () => mod.Helper.Translation.Get("ConfigRemoveLTooltip"));
            api.AddBoolOption(manifest, () => config.OldGlowStoneRingRecipe, (bool val) => config.OldGlowStoneRingRecipe = val, () => mod.Helper.Translation.Get("ConfigOldGlowStoneRingRecipe"));
            api.AddBoolOption(manifest, () => config.OldIridiumBandRecipe, (bool val) => config.OldIridiumBandRecipe     = val, () => mod.Helper.Translation.Get("ConfigOldIridiumBandRecipe"));

            api.AddParagraph(manifest, () => mod.Helper.Translation.Get("ConfigFeedback"));
        }
Ejemplo n.º 21
0
        /*********
        ** Public methods
        *********/
        /// <summary>Set up Generic Mod Config Menu integration.</summary>
        public static void SetUpModConfigMenu(ModConfig config, Mod mod)
        {
            // Get the Generic Mod Config Menu API
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api is null)
            {
                return;
            }
            var manifest = mod.ModManifest;

            // Register the Generic Mod Config Menu API
            api.Register(manifest, () => config = new ModConfig(), delegate { mod.Helper.WriteConfig(config); }, true);

            // Options to display
            api.AddBoolOption(manifest, () => config.DisableAllModEffects, (bool val) => config.DisableAllModEffects = val,
                              name: () => "Disable mod", tooltip: () => null);
            api.AddParagraph(manifest, text: () => "Will not affect newly loaded saves if true.\n" +
                             "This does NOT reverse the effects if the greenhouse has already been unlocked in an existing save, even if it was through this mod.");
        }
Ejemplo n.º 22
0
        private void DurationSection(IGenericModConfigMenuApi configMenu)
        {
            configMenu.AddSectionTitle(
                mod: this.ModManifest,
                text: () => "Loan Duration Menu Options"
                );

            configMenu.AddParagraph(
                mod: this.ModManifest,
                text: () => "Value in days that define the duration of the loan."
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.DayLength1,
                setValue: value => this.Config.DayLength1 = (int)value,
                name: () => "Duration Option 1"
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.DayLength2,
                setValue: value => this.Config.DayLength2 = (int)value,
                name: () => "Duration Option 2"
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.DayLength3,
                setValue: value => this.Config.DayLength3 = (int)value,
                name: () => "Duration Option 3"
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.DayLength4,
                setValue: value => this.Config.DayLength4 = (int)value,
                name: () => "Duration Option 4"
                );
        }
Ejemplo n.º 23
0
        private void InterestSection(IGenericModConfigMenuApi configMenu)
        {
            configMenu.AddSectionTitle(
                mod: this.ModManifest,
                text: () => "Interest Menu Options"
                );

            configMenu.AddParagraph(
                mod: this.ModManifest,
                text: () => "Each value corresponds to the Loan Duration menu above."
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.InterestModifier1,
                setValue: value => this.Config.InterestModifier1 = (float)value,
                name: () => "Interest Modifier 1"
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.InterestModifier2,
                setValue: value => this.Config.InterestModifier2 = (float)value,
                name: () => "Interest Modifier 2"
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.InterestModifier3,
                setValue: value => this.Config.InterestModifier3 = (float)value,
                name: () => "Interest Modifier 3"
                );

            configMenu.AddNumberOption(
                mod: this.ModManifest,
                getValue: () => this.Config.InterestModifier4,
                setValue: value => this.Config.InterestModifier4 = (float)value,
                name: () => "Interest Modifier 4"
                );
        }
        public static void SetUpModConfigMenu(RingConfig config, RingOverhaul mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () => config = new RingConfig(), delegate { mod.Helper.WriteConfig(config); VerifyConfigValues(mod); });

            api.AddBoolOption(manifest, () => config.CraftableGemRings, (bool val) => config.CraftableGemRings = val, () => mod.Helper.Translation.Get("ConfigCraftableGemRings"));
            api.AddBoolOption(manifest, () => config.MinorRingCraftingChanges, (bool val) => config.MinorRingCraftingChanges = val, () => mod.Helper.Translation.Get("ConfigMinorRingCraftingChanges"));
            api.AddBoolOption(manifest, () => config.RemoveCrabshellRingAndImmunityBandTooltipFromCombinedRing, (bool val) => config.RemoveCrabshellRingAndImmunityBandTooltipFromCombinedRing = val, () => mod.Helper.Translation.Get("ConfigRemoveCITooltip"));
            api.AddBoolOption(manifest, () => config.RemoveLuckyTooltipFromCombinedRing, (bool val) => config.RemoveLuckyTooltipFromCombinedRing = val, () => mod.Helper.Translation.Get("ConfigRemoveLTooltip"));
            api.AddBoolOption(manifest, () => config.OldGlowStoneRingRecipe, (bool val) => config.OldGlowStoneRingRecipe = val, () => mod.Helper.Translation.Get("ConfigOldGlowStoneRingRecipe"));
            api.AddBoolOption(manifest, () => config.OldIridiumBandRecipe, (bool val) => config.OldIridiumBandRecipe     = val, () => mod.Helper.Translation.Get("ConfigOldIridiumBandRecipe"));

            api.AddParagraph(manifest, () => mod.Helper.Translation.Get("ConfigFeedback"));
        }
        /*********
        ** Public methods
        *********/
        /// <summary>Add a config UI to Generic Mod Config Menu if it's installed.</summary>
        /// <param name="manifest">The mod manifest.</param>
        /// <param name="modRegistry">The mod registry from which to get the API.</param>
        /// <param name="monitor">The monitor with which to log errors.</param>
        /// <param name="getConfig">Get the current mod configuration.</param>
        /// <param name="reset">Reset the config to its default values.</param>
        /// <param name="save">Save the current config to the <c>config.json</c> file.</param>
        public static void Register(IManifest manifest, IModRegistry modRegistry, IMonitor monitor, Func <ModConfig> getConfig, Action reset, Action save)
        {
            // get API
            IGenericModConfigMenuApi api = IntegrationHelper.GetGenericModConfigMenu(modRegistry, monitor);

            if (api == null)
            {
                return;
            }

            // register config UI
            api.Register(manifest, reset, save);

            // add options
            api.AddSectionTitle(manifest, I18n.Config_Controls);
            api.AddKeybindList(
                manifest,
                name: I18n.Config_ToggleKey_Name,
                tooltip: I18n.Config_ToggleKey_Desc,
                getValue: () => getConfig().ToggleKey,
                setValue: value => getConfig().ToggleKey = value
                );
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Setup the Generic Mod Config Menu API.
        /// </summary>
        public static void SetUpModConfigMenu(ModConfig config, ModEntry mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () =>
            {
                config = new ModConfig();
                mod.SaveConfig(config);
            }, () => mod.SaveConfig(config));

            api.SetDefaultIngameOptinValue(manifest, true);

            api.RegisterLabel(manifest, "Visual", null);

            api.RegisterSimpleOption(manifest, "Show Love Bubbles", "Whether to show \"love\" bubbles over animals inside the building when watered the trough.", () => config.ShowLoveBubblesOverAnimalsWhenWateredTrough, (bool val) => config.ShowLoveBubblesOverAnimalsWhenWateredTrough = val);
            api.RegisterSimpleOption(manifest, "Replace Coop Texture If Trough Is Empty", "Whether to replace coop's and big coop's textures when troughs inside them are empty.", () => config.ReplaceCoopTextureIfTroughIsEmpty, (bool val) => config.ReplaceCoopTextureIfTroughIsEmpty    = val);
            api.RegisterSimpleOption(manifest, "Cleaner Troughs", "Whether troughs should have a cleaner texture. Note: Won't change until a day update.", () => config.CleanerTroughs, (bool val) => config.CleanerTroughs = val);

            api.RegisterLabel(manifest, "Functionality", null);

            api.RegisterSimpleOption(manifest, "Watering System In Deluxe Buildings", "Whether to enable the watering system in Deluxe Coops and Deluxe Barns.", () => config.WateringSystemInDeluxeBuildings, (bool val) => config.WateringSystemInDeluxeBuildings = val);
            api.RegisterSimpleOption(manifest, "Animals Can Drink Outside", "Whether animals can drink outside.", () => config.AnimalsCanDrinkOutside, (bool val) => config.AnimalsCanDrinkOutside = val);
            api.RegisterSimpleOption(manifest, "Animals Can Only Drink From Water Bodies", "Whether animals can only drink from lakes/rivers/seas etc. If set to false, animals will drink from any place you can refill your watering can at (well, troughs, water bodies etc.).", () => config.AnimalsCanOnlyDrinkFromWaterBodies, (bool val) => config.AnimalsCanOnlyDrinkFromWaterBodies = val);

            api.RegisterLabel(manifest, "Friendship", null);

            api.RegisterSimpleOption(manifest, "Watered Trough", "The amount of friendship points player gets for watering a trough.", () => config.FriendshipPointsForWateredTrough, (int val) => config.FriendshipPointsForWateredTrough = val);
            api.RegisterSimpleOption(manifest, "Watered Trough With Animals Inside", "The amount of friendship points player gets for watering a trough with animals inside the building.", () => config.AdditionalFriendshipPointsForWateredTroughWithAnimalsInsideBuilding, (int val) => config.AdditionalFriendshipPointsForWateredTroughWithAnimalsInsideBuilding = val);
            api.RegisterSimpleOption(manifest, "Negative; Not Watered Trough", "The amount of friendship points player loses for not watering a trough.", () => config.NegativeFriendshipPointsForNotWateredTrough, (int val) => config.NegativeFriendshipPointsForNotWateredTrough = val);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Setup the Generic Mod Config Menu API.
        /// </summary>
        public static void SetUpModConfigMenu(ModConfig config, ModEntry mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(manifest, () =>
            {
                config = new ModConfig();
                mod.SaveConfig(config);
            }, () => mod.SaveConfig(config));

            api.SetDefaultIngameOptinValue(manifest, true);

            api.RegisterLabel(manifest, "Appearance", null);

            api.RegisterClampedOption(manifest, "Bar Height Percentage", "The percentage of the height of the screen for a bar to take up.", () => (float)config.BarHeightPercentage, val => config.BarHeightPercentage = val, 1f, 49f, 0.1f);
            api.RegisterSimpleOption(manifest, "Move Bars In Smoothly", "Whether to gradually move the bars in when an event starts, or have them fully out right away.", () => config.MoveBarsInSmoothly, val => config.MoveBarsInSmoothly = val);
        }
Ejemplo n.º 28
0
        public static void SetUpModConfigMenu(ForageFantasyConfig config, ForageFantasy mod)
        {
            IGenericModConfigMenuApi api = mod.Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

            api.RegisterModConfig(
                manifest,
                delegate
            {
                // if the world is ready, then we are not in the main menu, so reset should only reset the keybindings and calendar
                if (Context.IsWorldReady)
                {
                    config.TreeMenuKey            = TreeMenuKeyDefault;
                    config.MushroomTapperCalendar = false;
                }
                else
                {
                    config = new ForageFantasyConfig();
                }
            },
                delegate
            {
                mod.Helper.WriteConfig(config);
                VerifyConfigValues(config, mod);
            }
                );

            api.SetTitleScreenOnlyForNextOptions(manifest, true);

            api.RegisterLabel(manifest, "Quality Tweaks", null);

            if (mod.Helper.ModRegistry.IsLoaded("thelion.AwesomeProfessions"))
            {
                api.RegisterLabel(manifest, "Berry Bush Quality Disabled (Walk Of Life)", null);
                api.RegisterLabel(manifest, "Mushroom Box Quality Disabled (Walk Of Life)", null);
            }
            else
            {
                api.RegisterSimpleOption(manifest, "Berry Bush Quality", "Salmonberries and blackberries have quality based\non forage level even without botanist perk.", () => config.BerryBushQuality, (bool val) => config.BerryBushQuality = val);
                api.RegisterSimpleOption(manifest, "Mushroom Box Quality", "Mushrooms have quality based on forage level and botanist perk.", () => config.MushroomBoxQuality, (bool val) => config.MushroomBoxQuality = val);
            }

            api.RegisterChoiceOption(manifest, "Tapper Quality Options", null, () => GetElementFromConfig(TQChoices, config.TapperQualityOptions), (string val) => config.TapperQualityOptions = GetIndexFromArrayElement(TQChoices, val), TQChoices);
            api.RegisterSimpleOption(manifest, "Tapper Perk Is Required", null, () => config.TapperQualityRequiresTapperPerk, (bool val) => config.TapperQualityRequiresTapperPerk             = val);

            api.RegisterLabel(manifest, "XP Rewards", null);

            api.RegisterClampedOption(manifest, "Berry Bush Chance To Get XP", "Chance to get foraging experience when harvesting bushes.\nSet to 0 to disable feature.", () => config.BerryBushChanceToGetXP, (int val) => config.BerryBushChanceToGetXP = val, 0, 100);
            api.RegisterSimpleOption(manifest, "Berry Bush XP Amount", "Amount of XP gained per bush. For reference:\nChopping down a tree is 12XP, a foraging good is 7XP\nNegative values will be reset to 0.", () => config.BerryBushXPAmount, (int val) => config.BerryBushXPAmount = val);
            api.RegisterSimpleOption(manifest, "Mushroom Box XP Amount", "For reference:\nChopping down a tree is 12XP, a foraging good is 7XP\nNegative values will be reset to 0.", () => config.MushroomXPAmount, (int val) => config.MushroomXPAmount = val);
            api.RegisterSimpleOption(manifest, "Tapper XP Amount", "For reference:\nChopping down a tree is 12XP, a foraging good is 7XP\nNegative values will be reset to 0.", () => config.TapperXPAmount, (int val) => config.TapperXPAmount           = val);
            api.RegisterSimpleOption(manifest, "Automation Harvests Grant XP", "Whether automatic harvests with the Automate, Deluxe\nGrabber Redux or One Click Shed Reloader should grant XP.\nKeep in mind that some of those only affect the host.", () => config.AutomationHarvestsGrantXP, (bool val) => config.AutomationHarvestsGrantXP = val);

            api.RegisterLabel(manifest, "Tapper Days Needed Changes", null);

            api.RegisterSimpleOption(manifest, "Days Needed Changes Enabled", "If this is disabled, then all features\nin this category don't do anything", () => config.TapperDaysNeededChangesEnabled, (bool val) => config.TapperDaysNeededChangesEnabled = val);
            api.RegisterSimpleOption(manifest, "Maple Tree Days Needed", "default: 9 days, recommended: 7 days", () => config.MapleDaysNeeded, (int val) => config.MapleDaysNeeded = val);
            api.RegisterSimpleOption(manifest, "Oak Tree Days Needed", "default: 7 days, recommended: 7 days", () => config.OakDaysNeeded, (int val) => config.OakDaysNeeded       = val);
            api.RegisterSimpleOption(manifest, "Pine Tree Days Needed", "default: 5 days, recommended: 7 days", () => config.PineDaysNeeded, (int val) => config.PineDaysNeeded    = val);
            api.RegisterSimpleOption(manifest, "Mushroom Tree Heavy Tapper Fix", null, () => config.MushroomTreeHeavyTappersFix, (bool val) => config.MushroomTreeHeavyTappersFix  = val);
            api.RegisterSimpleOption(manifest, "Mushroom Tree Tapper\nConsistency Change", null, () => config.MushroomTreeTappersConsistencyChange, (bool val) => config.MushroomTreeTappersConsistencyChange = val);

            api.RegisterLabel(manifest, "Other Features", null);

            api.RegisterSimpleOption(manifest, "Mushroom Tree Seeds Drop", null, () => config.MushroomTreeSeedsDrop, (bool val) => config.MushroomTreeSeedsDrop = val);
            api.RegisterSimpleOption(manifest, "Common Fiddlehead Fern", "Fiddlehead fern is available outside of the secret forest\nand added to the wild seeds pack and summer foraging bundle.", () => config.CommonFiddleheadFern, (bool val) => config.CommonFiddleheadFern = val);
            api.RegisterSimpleOption(manifest, "Forage Survival Burger", "Forage based early game crafting recipes\nand even more efficient cooking recipes.", () => config.ForageSurvivalBurger, (bool val) => config.ForageSurvivalBurger = val);

            api.SetTitleScreenOnlyForNextOptions(manifest, false);

            api.RegisterSimpleOption(manifest, "Mushroom Tapper Calendar", null, () => config.MushroomTapperCalendar, (bool val) => config.MushroomTapperCalendar = val);

            api.AddKeybindList(manifest, () => config.TreeMenuKey, (KeybindList keybindList) => config.TreeMenuKey = keybindList, () => "Tree Menu Key");

            api.SetTitleScreenOnlyForNextOptions(manifest, true);

            if (GrapeLogic.AreGrapeJsonModsInstalled(mod))
            {
                api.RegisterLabel(manifest, "Fine Grapes Feature Installed And Enabled", "Remove the Json Assets mod pack to disable this option");
            }
        }
Ejemplo n.º 29
0
        /*********
        ** Public methods
        *********/
        /// <summary>Add a config UI to Generic Mod Config Menu if it's installed.</summary>
        /// <param name="manifest">The mod manifest.</param>
        /// <param name="modRegistry">The mod registry from which to get the API.</param>
        /// <param name="monitor">The monitor with which to log errors.</param>
        /// <param name="getConfig">Get the current mod configuration.</param>
        /// <param name="reset">Reset the config to its default values.</param>
        /// <param name="save">Save the current config to the <c>config.json</c> file.</param>
        public static void Register(IManifest manifest, IModRegistry modRegistry, IMonitor monitor, Func <ModConfig> getConfig, Action reset, Action save)
        {
            // get API
            IGenericModConfigMenuApi api = IntegrationHelper.GetGenericModConfigMenu(modRegistry, monitor);

            if (api == null)
            {
                return;
            }

            // register config UI
            api.Register(manifest, reset, save);

            // fruit tree section
            api.AddSectionTitle(manifest, I18n.Config_FruitTrees);
            api.AddBoolOption(
                manifest,
                name: I18n.Config_FruitTrees_InstantlyAge_Name,
                tooltip: I18n.Config_FruitTrees_InstantlyAge_Desc,
                getValue: () => getConfig().FruitTrees.InstantlyAge,
                setValue: value => getConfig().FruitTrees.InstantlyAge = value
                );
            api.AddBoolOption(
                manifest,
                name: I18n.Config_FruitTrees_InstantlyGrow_Name,
                tooltip: I18n.Config_FruitTrees_InstantlyGrow_Desc,
                getValue: () => getConfig().FruitTrees.InstantlyGrow,
                setValue: value => getConfig().FruitTrees.InstantlyGrow = value
                );
            api.AddBoolOption(
                manifest,
                name: I18n.Config_FruitTrees_InstantlyGrowInWinter_Name,
                tooltip: I18n.Config_FruitTrees_InstantlyGrowInWinter_Desc,
                getValue: () => getConfig().FruitTrees.InstantlyGrowInWinter,
                setValue: value => getConfig().FruitTrees.InstantlyGrowInWinter = value
                );
            api.AddBoolOption(
                manifest,
                name: I18n.Config_FruitTrees_InstantlyGrowWhenInvalid_Name,
                tooltip: I18n.Config_FruitTrees_InstantlyGrowWhenInvalid_Desc,
                getValue: () => getConfig().FruitTrees.InstantlyGrowWhenInvalid,
                setValue: value => getConfig().FruitTrees.InstantlyGrowWhenInvalid = value
                );

            // non-fruit tree section
            api.AddSectionTitle(manifest, I18n.Config_Trees);
            api.AddBoolOption(
                manifest,
                name: I18n.Config_Trees_InstantlyGrow_Name,
                tooltip: I18n.Config_Trees_InstantlyGrow_Desc,
                getValue: () => getConfig().NonFruitTrees.InstantlyGrow,
                setValue: value => getConfig().NonFruitTrees.InstantlyGrow = value
                );
            api.AddBoolOption(
                manifest,
                name: I18n.Config_Trees_InstantlyGrowInWinter_Name,
                tooltip: I18n.Config_Trees_InstantlyGrowInWinter_Desc,
                getValue: () => getConfig().NonFruitTrees.InstantlyGrowInWinter,
                setValue: value => getConfig().NonFruitTrees.InstantlyGrowInWinter = value
                );
            api.AddBoolOption(
                manifest,
                name: I18n.Config_Trees_InstantlyGrowWhenInvalid_Name,
                tooltip: I18n.Config_Trees_InstantlyGrowWhenInvalid_Desc,
                getValue: () => getConfig().NonFruitTrees.InstantlyGrowWhenInvalid,
                setValue: value => getConfig().NonFruitTrees.InstantlyGrowWhenInvalid = value
                );
        }
Ejemplo n.º 30
0
        private void RegisterWithGmcm()
        {
            // Get our API reference.
            IGenericModConfigMenuApi configMenuApi =
                Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu");

            // If this is null, GMCM wasn't installed.
            if (configMenuApi == null)
            {
                logger.Log("The user doesn't have GMCM installed. This is not an error.");

                return;
            }

            // Register with GMCM
            configMenuApi.Register(ModManifest,
                                   reset: () => config = new ModConfig(),
                                   save: () => Helper.WriteConfig(config));

            // The toggle for whether or not we want Multiple Mini-Obelisks support.
            configMenuApi.AddBoolOption(
                mod: ModManifest,
                name: () => "Multiple Mini-Obelisks mod support",
                tooltip: () => "If the Multiple Mini-Obelisks mod is installed, the keybind will work when the scepter is selected to open the warp menu.",
                getValue: () => config.EnableMultiObeliskSupport,
                setValue: value => config.EnableMultiObeliskSupport = value);

            // Whether or not to count using MMO's warp menu as using the return scepter.
            configMenuApi.AddBoolOption(
                mod: ModManifest,
                name: () => "Count warp menu as using scepter",
                tooltip: () => "Whether or not you want to be able to warp back to where you last used the scepter's integration with Multiple Mini-Obelisks's warp menu.",
                getValue: () => config.CountWarpMenuAsScepterUsage,
                setValue: value => config.CountWarpMenuAsScepterUsage = value);

            // Add a nice title for prettiness.
            configMenuApi.AddSectionTitle(
                mod: ModManifest,
                text: () => "Keybinds");

            // The bind for opening MMO's warp menu.
            configMenuApi.AddKeybindList(
                mod: ModManifest,
                name: () => "Open warp menu",
                getValue: () => config.OpenObeliskWarpMenuKbm,
                setValue: value => config.OpenObeliskWarpMenuKbm = value);

            // Add a nice title for prettiness.
            configMenuApi.AddSectionTitle(
                mod: ModManifest,
                text: () => "Controller Keybinds");

            // The controller bind for warping to our last point.
            configMenuApi.AddKeybindList(
                mod: ModManifest,
                name: () => "Warp to last point",
                getValue: () => config.ReturnToLastPoint,
                setValue: value => config.ReturnToLastPoint = value);

            // The controller bind for opening MMO's warp menu.
            configMenuApi.AddKeybindList(
                mod: ModManifest,
                name: () => "Open warp menu",
                getValue: () => config.OpenObeliskWarpMenuController,
                setValue: value => config.OpenObeliskWarpMenuController = value);
        }