public static void SetUpModConfigMenu(WateringGrantsXPConfig config, WateringGrantsXP mod)
        {
            GenericModConfigMenuAPI api = mod.Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("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);

            // this is a spacer due to the line break above
            api.RegisterLabel(manifest, string.Empty, null);
            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);
        }
Ejemplo n.º 2
0
        public static void SetUpModConfigMenu(HorseConfig config, HorseOverhaul mod)
        {
            GenericModConfigMenuAPI api = mod.Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

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

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

            api.RegisterSimpleOption(manifest, "Thin Horse", null, () => config.ThinHorse, (bool val) => config.ThinHorse = val);
            api.RegisterSimpleOption(manifest, "Saddle Bag", null, () => config.SaddleBag, (bool val) => config.SaddleBag = val);

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

            api.RegisterSimpleOption(manifest, "Movement Speed (MS)", null, () => config.MovementSpeed, (bool val) => config.MovementSpeed = val);
            api.RegisterSimpleOption(manifest, "Maximum MS Bonus", null, () => config.MaxMovementSpeedBonus, (float val) => config.MaxMovementSpeedBonus = val);
            api.RegisterSimpleOption(manifest, "Petting", null, () => config.Petting, (bool val) => config.Petting = val);
            api.RegisterSimpleOption(manifest, "Water", null, () => config.Water, (bool val) => config.Water       = val);
            api.RegisterSimpleOption(manifest, "Feeding", null, () => config.Feeding, (bool val) => config.Feeding = val);

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

            api.RegisterSimpleOption(manifest, "Disable Stable Sprites", null, () => config.DisableStableSpriteChanges, (bool val) => config.DisableStableSpriteChanges = val);
            api.RegisterSimpleOption(manifest, "Pet Feeding", null, () => config.PetFeeding, (bool val) => config.PetFeeding = val);

            api.RegisterLabel(manifest, "(Menu Key Rebinding Only Available In Config File)", null);
        }
        public static void SetUpModConfigMenu(TreeOverhaulConfig config, TreeOverhaul mod)
        {
            GenericModConfigMenuAPI api = mod.Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("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);
        }
        /// <summary>A SMAPI GameLaunched event that enables GMCM support if that mod is available.</summary>
        public void EnableGMCM(object sender, GameLaunchedEventArgs e)
        {
            try
            {
                GenericModConfigMenuAPI api = Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); //attempt to get GMCM's API instance

                if (api == null)                                                                                                       //if the API is not available
                {
                    return;
                }

                api.RegisterModConfig(ModManifest, () => Utility.MConfig = new ModConfig(), () => Helper.WriteConfig(Utility.MConfig)); //register "revert to default" and "write" methods for this mod's config

                //register an option for each of this mod's config settings
                api.RegisterSimpleOption(ModManifest, "Enable console commands", "Uncheck this box to disable FTM's console commands, e.g. for mod compatibility.\nNOTE: This will not take effect until Stardew Valley is restarted.", () => Utility.MConfig.EnableConsoleCommands, (bool val) => Utility.MConfig.EnableConsoleCommands = val);
                api.RegisterSimpleOption(ModManifest, "Enable content packs", "Uncheck this box to disable all FTM content packs.\nOnly the \"personal\" files in FarmTypeManager/data will be used.", () => Utility.MConfig.EnableContentPacks, (bool val) => Utility.MConfig.EnableContentPacks = val);
                api.RegisterSimpleOption(ModManifest, "Enable trace log messages", "Uncheck this box to disable FTM's [TRACE] message type in SMAPI's log files.\nLogs will be smaller but provide less info.", () => Utility.MConfig.EnableTraceLogMessages, (bool val) => Utility.MConfig.EnableTraceLogMessages = val);
                api.RegisterSimpleOption(ModManifest, "Monster limit per location", "The maximum number of monsters FTM will spawn on a single map.\nEnter NULL for unlimited monsters.", () => MonsterLimitAsString, (string val) => MonsterLimitAsString = val);
            }
            catch (Exception ex)
            {
                Utility.Monitor.Log($"An error happened while loading FTM's GMCM options menu. That menu might be missing or fail to work. The auto-generated error message has been added to the log.", LogLevel.Warn);
                Utility.Monitor.Log($"----------", LogLevel.Trace);
                Utility.Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
            }
        }
Ejemplo n.º 5
0
 protected override void InitializeApi(GenericModConfigMenuAPI api)
 {
     api.RegisterSimpleOption(ModManifest, "Disable Growth", "Whether grass growth & spreading should be suppressed entirely.", () => config.DisableGrowth, (bool val) => config.DisableGrowth = val);
     api.RegisterSimpleOption(ModManifest, "Grow Everywhere", "Whether grass spreads almost everywhere. If false, grass spreading is limited to tillable tiles.", () => config.GrowEverywhere, (bool val) => config.GrowEverywhere = val);
     api.RegisterClampedOption(ModManifest, "Growth Chance", "The chance that grass grows or spreads.", () => config.GrowthChance, (float val) => config.GrowthChance = val, 0, 1);
     api.RegisterClampedOption(ModManifest, "Spread Chance", "The chance for each neighbouring tile that the grass will spread there.", () => config.SpreadChance, (float val) => config.SpreadChance = val, 0, 1);
     api.RegisterClampedOption(ModManifest, "Daily Growth", "The number of iterations that grass growth is applied per day", () => config.DailyGrowth, (int val) => config.DailyGrowth = val, 0, 10);
     api.RegisterClampedOption(ModManifest, "Monthly Growth", "Additional iterations that grass growth is applied at the start of each month.", () => config.MonthlyGrowth, (int val) => config.MonthlyGrowth = val, 0, 100);
 }
Ejemplo n.º 6
0
        public void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            try
            {
                JsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets");
                this.Helper.Content.InvalidateCache("Data/mail");
            }
            catch (Exception ex)
            {
                Monitor.Log("Error loading JSON assets", LogLevel.Warn);
            }

            try
            {
                GenericModConfigMenuAPI api = this.Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

                if (api == null)
                {
                    return;
                }

                api.RegisterModConfig(ModManifest, () => Config = new UmbrellaConfig(), () => Helper.WriteConfig(Config));

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Enable wetness",
                    "",
                    () => Config.enableWetness,
                    (bool val) => Config.enableWetness = val
                );

                api.RegisterParagraph(ModManifest, "If this box is checked, the farmer will get wet when standing outside in the rain without an umbrella. When the farmer is wet, stamina will be slowly drained. More information about the wetness system can be found on the mod page.");

                api.RegisterSimpleOption(
                    ModManifest,
                    "Stamina drain rate",
                    "",
                    () => Config.staminaDrainRate,
                    (float val) => Config.staminaDrainRate = val
                    );

                api.RegisterParagraph(ModManifest, "How much stamina to drain every 10 minutes (in game time) when the farmer is wet.");
            }
            catch (Exception ex)
            {
                Monitor.Log($"An error happened while loading this mod's GMCM options menu. Its menu might be missing or fail to work. The auto-generated error message has been added to the log.", LogLevel.Warn);
                Monitor.Log($"----------", LogLevel.Trace);
                Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
            }
        }
Ejemplo n.º 7
0
 public static void RegisterConfigMenuOptions(Func <OverlayConfig> getThis, GenericModConfigMenuAPI api, GMCMOptionsAPI apiExt, IManifest modManifest)
 {
     api.AddSectionTitle(modManifest, I18n.Config_Overlay, I18n.Config_Overlay_Desc);
     api.AddBoolOption(
         mod: modManifest,
         name: I18n.Config_Overlay_Enabled,
         tooltip: I18n.Config_Overlay_Enabled_Desc,
         getValue: () => getThis().enabled,
         setValue: (bool val) => getThis().enabled = val);
     api.AddKeybind(
         mod: modManifest,
         name: I18n.Config_Overlay_Hotkey,
         tooltip: I18n.Config_Overlay_Hotkey_Desc,
         getValue: () => getThis().hotkey,
         setValue: (SButton val) => getThis().hotkey = val);
     api.AddBoolOption(
         mod: modManifest,
         name: I18n.Config_Overlay_HideAtFestivals,
         tooltip: I18n.Config_Overlay_HideAtFestivals_Desc,
         getValue: () => getThis().hideAtFestivals,
         setValue: (bool val) => getThis().hideAtFestivals = val);
     api.AddNumberOption(
         mod: modManifest,
         name: I18n.Config_Overlay_MaxWidth,
         tooltip: I18n.Config_Overlay_MaxWidth_Desc,
         getValue: () => getThis().maxWidth,
         setValue: (int val) => getThis().maxWidth = val);
     api.AddNumberOption(
         mod: modManifest,
         name: I18n.Config_Overlay_MaxItems,
         tooltip: I18n.Config_Overlay_MaxItems_Desc,
         getValue: () => getThis().maxItems,
         setValue: (int val) => getThis().maxItems = val);
     if (apiExt is not null)
     {
         apiExt.AddColorOption(
             mod: modManifest,
             name: I18n.Config_Overlay_BackgroundColor,
             tooltip: I18n.Config_Overlay_BackgroundColor_Desc,
             getValue: () => getThis().backgroundColor,
             setValue: (c) => getThis().backgroundColor = c,
             colorPickerStyle: (uint)(GMCMOptionsAPI.ColorPickerStyle.AllStyles | GMCMOptionsAPI.ColorPickerStyle.RadioChooser));
         apiExt.AddColorOption(
             mod: modManifest,
             name: I18n.Config_Overlay_TextColor,
             tooltip: I18n.Config_Overlay_TextColor_Desc,
             getValue: () => getThis().textColor,
             setValue: (c) => getThis().textColor = c,
             colorPickerStyle: (uint)(GMCMOptionsAPI.ColorPickerStyle.AllStyles | GMCMOptionsAPI.ColorPickerStyle.RadioChooser));
     }
 }
Ejemplo n.º 8
0
        /// <summary>A SMAPI GameLaunched event that enables GMCM support if that mod is available.</summary>
        public void EnableGMCM(object sender, GameLaunchedEventArgs e)
        {
            try
            {
                GenericModConfigMenuAPI api = Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); //attempt to get GMCM's API instance

                if (api == null)                                                                                                       //if the API is not available
                {
                    return;
                }

                api.RegisterModConfig(ModManifest, () => Config = new ModConfig(), () => Helper.WriteConfig(Config)); //register "revert to default" and "write" methods for this mod's config

                //register an option for each of this mod's config settings
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Enable cosmetic floating effect",
                    "Check this box to enable the cosmetic \"floating\" effect on items in water.\nDisabling this might improve performance on some systems.",
                    () => Config.EnableCosmeticFloatingEffect,
                    (bool val) =>
                {
                    if (val)                                                 //if this is being set to true
                    {
                        HarmonyPatch_FloatingItemVisualEffect.ApplyPatch();  //apply this patch if necessary
                    }
                    else                                                     //if this is being set to false
                    {
                        HarmonyPatch_FloatingItemVisualEffect.RemovePatch(); //remove this patch if necessary
                    }
                    Config.EnableCosmeticFloatingEffect = val;
                }
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Teleport floating items to player",
                    "Check this box to make items in water teleport to the nearest player whenever possible.\nEnabling this makes it easier to retrieve items.",
                    () => Config.TeleportItemsOutOfWater,
                    (bool val) => Config.TeleportItemsOutOfWater = val
                );
            }
            catch (Exception ex)
            {
                Monitor.Log($"An error happened while loading this mod's GMCM options menu. Its menu might be missing or fail to work. The auto-generated error message has been added to the log.", LogLevel.Warn);
                Monitor.Log($"----------", LogLevel.Trace);
                Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
            }
        }
        private void RegisterWithGmcm()
        {
            GenericModConfigMenuAPI configMenuApi =
                Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

            configMenuApi.RegisterModConfig(ModManifest,
                                            () => _config = new ModConfig(),
                                            () => Helper.WriteConfig(_config));

            configMenuApi.RegisterSimpleOption(ModManifest, _helper.Translation.Get("bettercrystalariums.debug-setting-title"),
                                               _helper.Translation.Get("bettercrystalariums.debug-setting-description"),
                                               () => _config.DebugMode,
                                               (bool value) => _config.DebugMode = value);
        }
Ejemplo n.º 10
0
 protected override void InitializeApi(GenericModConfigMenuAPI api)
 {
     api.RegisterLabel(ModManifest, "Each night", "How soil decays every night");
     api.RegisterClampedOption(ModManifest, "Drying Rate", "Chance that tilled soil will disappear. Normally this is 0.1 (=10%).", () => (float)config.EachNight.DryingRate, (float val) => config.EachNight.DryingRate = val, 0.0f, 1.0f);
     api.RegisterClampedOption(ModManifest, "Delay", "Number of consecutive days that the patch must have been without water, before it can disappear during the night.", () => config.EachNight.Delay, (int val) => config.EachNight.Delay = val, 0, 4);
     api.RegisterLabel(ModManifest, "Each Season", "How soil decays on the farm (and maps that have the `ClearEmptyDirtOnNewMonth` property) during nights between seasons");
     api.RegisterClampedOption(ModManifest, "Drying Rate", "Chance that tilled soil will disappear. Normally this is 0.8 (=80%).", () => (float)config.EachSeason.DryingRate, (float val) => config.EachSeason.DryingRate = val, 0.0f, 1.0f);
     api.RegisterClampedOption(ModManifest, "Delay", "Number of consecutive days that the patch must have been without water, before it can disappear during the night.", () => config.EachSeason.Delay, (int val) => config.EachSeason.Delay = val, 0, 4);
     api.RegisterLabel(ModManifest, "Greenhouse", "How soil decays inside the greenhouse");
     api.RegisterClampedOption(ModManifest, "Drying Rate", "Chance that tilled soil will disappear. Normally this is 1.0 (=100%).", () => (float)config.Greenhouse.DryingRate, (float val) => config.Greenhouse.DryingRate = val, 0.0f, 1.0f);
     api.RegisterClampedOption(ModManifest, "Delay", "Number of consecutive days that the patch must have been without water, before it can disappear during the night.", () => config.Greenhouse.Delay, (int val) => config.Greenhouse.Delay = val, 0, 4);
     api.RegisterLabel(ModManifest, "Island", "How soil decays on Ginger Island");
     api.RegisterClampedOption(ModManifest, "Drying Rate", "Chance that tilled soil will disappear. Normally this is 0.1 (=10%).", () => (float)config.Island.DryingRate, (float val) => config.Island.DryingRate = val, 0.0f, 1.0f);
     api.RegisterClampedOption(ModManifest, "Delay", "Number of consecutive days that the patch must have been without water, before it can disappear during the night.", () => config.Island.Delay, (int val) => config.Island.Delay = val, 0, 4);
     api.RegisterLabel(ModManifest, "Non-farm", "How soil decays outside the farm");
     api.RegisterClampedOption(ModManifest, "Drying Rate", "Chance that tilled soil will disappear. Normally this is 1.0 (=100%).", () => (float)config.NonFarm.DryingRate, (float val) => config.NonFarm.DryingRate = val, 0.0f, 1.0f);
     api.RegisterClampedOption(ModManifest, "Delay", "Number of consecutive days that the patch must have been without water, before it can disappear during the night.", () => config.NonFarm.Delay, (int val) => config.NonFarm.Delay = val, 0, 4);
 }
Ejemplo n.º 11
0
        private void RegisterWithGmcm()
        {
            GenericModConfigMenuAPI configMenuApi =
                Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

            configMenuApi.RegisterModConfig(ModManifest,
                                            () => _config = new ModConfig(),
                                            () => Helper.WriteConfig(_config));

            configMenuApi.RegisterSimpleOption(ModManifest, "Toggle Tracking Target",
                                               "Whether or not you want the log to specify whether the player or cursor was the source of this co-ordinate.",
                                               () => _config.LogTrackingTarget,
                                               (bool value) => _config.LogTrackingTarget = value);
            configMenuApi.RegisterSimpleOption(ModManifest, "HUD Toggle",
                                               "The key used to toggle the co-ordinate HUD.",
                                               () => _config.CoordinateHUDToggle,
                                               (button) => _config.CoordinateHUDToggle = button);
            configMenuApi.RegisterSimpleOption(ModManifest, "Log Co-ordinates",
                                               "The key used to log the current co-ordinates to file.",
                                               () => _config.LogCoordinates,
                                               (button) => _config.LogCoordinates = button);
            configMenuApi.RegisterSimpleOption(ModManifest, "Toggle Tracking Target",
                                               "The key used to toggle between tracking the cursor and the player's co-ordinates.",
                                               () => _config.SwitchToCursorCoords,
                                               (button) => _config.SwitchToCursorCoords = button);
            configMenuApi.RegisterSimpleOption(ModManifest, "HUD X Co-ordinate:",
                                               "The X co-ordinate of the HUD",
                                               () => _config.HudXCoord,
                                               (int value) => _config.HudXCoord = value);
            configMenuApi.RegisterSimpleOption(ModManifest, "HUD Y Co-ordinate:",
                                               "The Y co-ordinate of the HUD",
                                               () => _config.HudYCoord,
                                               (int value) => _config.HudYCoord = value);

// Since I can't think of a way to log co-ordinates on Android, a toggle to make the HUD movable is
// also out of the question until I figure that out.
#if ANDROID
#else
            configMenuApi.RegisterSimpleOption(ModManifest, "Unlock HUD Position",
                                               "Press this key to toggle the HUD to be unlocked so you can move it around.",
                                               () => _config.HudUnlock,
                                               (button) => _config.HudUnlock = button);
#endif
        }
Ejemplo n.º 12
0
        protected override void InitializeApi(GenericModConfigMenuAPI api)
        {
            api.RegisterSimpleOption(ModManifest, "Harvest With Sword", "Whether a sword can be used instead of a normal scythe.", () => config.HarvestWithSword, (bool val) => config.HarvestWithSword = val);

            string[] options      = { "Hand", "Scythe", "Both", "Gold" };
            string   options_desc =
                " · Hand: only pluckable;\n" +
                " · Scythe: only scythable;\n" +
                " · Both: both pluckable and scythable;\n" +
                " · Gold: like 'both', but requires the golden scythe.";

            api.RegisterLabel(ModManifest, "HarvestMode", null);
            api.RegisterParagraph(ModManifest, options_desc);
            api.RegisterChoiceOption(ModManifest, "PluckableCrops", "How crops that normally can only be harvested by hand can be harvested.", () => writeEnum(config.HarvestMode.PluckableCrops), (string val) => config.HarvestMode.PluckableCrops       = parseEnum(val), options);
            api.RegisterChoiceOption(ModManifest, "ScythableCrops", "How crops that normally can only be harvested with a scythe can be harvested.", () => writeEnum(config.HarvestMode.ScythableCrops), (string val) => config.HarvestMode.ScythableCrops = parseEnum(val), options);
            api.RegisterChoiceOption(ModManifest, "Flowers", "How flowers can be harvested.", () => writeEnum(config.HarvestMode.Flowers), (string val) => config.HarvestMode.Flowers = parseEnum(val), options);
            api.RegisterChoiceOption(ModManifest, "Forage", "How forage can be harvested.", () => writeEnum(config.HarvestMode.Forage), (string val) => config.HarvestMode.Forage     = parseEnum(val), options);
            api.RegisterChoiceOption(ModManifest, "SpringOnion", "How spring onions can be harvested.", () => writeEnum(config.HarvestMode.SpringOnion), (string val) => config.HarvestMode.SpringOnion = parseEnum(val), options);
        }
Ejemplo n.º 13
0
        public void EnableGMCM(object sender, GameLaunchedEventArgs e)
        {
            GenericModConfigMenuAPI api = Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); //attempt to get GMCM's API instance

            if (api == null)                                                                                                       //if the API is not available
            {
                return;
            }

            api.RegisterModConfig(ModManifest, () => MConfig = new ModConfig(), () => Helper.WriteConfig(MConfig)); //register "revert to default" and "write" methods for this mod's config

            //register an option for each of this mod's config settings
            api.RegisterSimpleOption(ModManifest, "Enable trackers without profession", "If this box is checked, you won't need the Foraging skill's \"Tracker\" perk to see trackers.", () => MConfig.EnableTrackersWithoutProfession, (bool val) => MConfig.EnableTrackersWithoutProfession = val);
            api.RegisterSimpleOption(ModManifest, "Replace trackers with forage icons", "If this box is checked, trackers will display the objects they're pointing to.", () => MConfig.ReplaceTrackersWithForageIcons, (bool val) => MConfig.ReplaceTrackersWithForageIcons    = val);
            api.RegisterSimpleOption(ModManifest, "Draw trackers behind interface", "If this box is checked, trackers will be drawn behind the game's interface, making it easier to see the UI.", () => MConfig.DrawBehindInterface, (bool val) => MConfig.DrawBehindInterface = val);
            api.RegisterSimpleOption(ModManifest, "Tracker pixel scale", "The size of the tracker icon's pixels (default 4). Increase this to make trackers easier to see.", () => MConfig.TrackerPixelScale, (float val) => MConfig.TrackerPixelScale = val);

            api.RegisterSimpleOption(ModManifest, "Track default forage", "If this box is checked, the mod will track most types of forage spawned by the base game.", () => MConfig.TrackDefaultForage, (bool val) => MConfig.TrackDefaultForage = val);
            api.RegisterSimpleOption(ModManifest, "Track artifact spots", "If this box is checked, the mod will track buried artifact locations.", () => MConfig.TrackArtifactSpots, (bool val) => MConfig.TrackArtifactSpots               = val);
            api.RegisterSimpleOption(ModManifest, "Track panning spots", "If this box is checked, the mod will track ore panning locations in the water.", () => MConfig.TrackPanningSpots, (bool val) => MConfig.TrackPanningSpots         = val);
            api.RegisterSimpleOption(ModManifest, "Track spring onions", "If this box is checked, the mod will track harvestable spring onions.", () => MConfig.TrackSpringOnions, (bool val) => MConfig.TrackSpringOnions                  = val);
            api.RegisterSimpleOption(ModManifest, "Track berry bushes", "If this box is checked, the mod will track harvestable salmonberry and blackberry bushes.", () => MConfig.TrackBerryBushes, (bool val) => MConfig.TrackBerryBushes = val);
        }
        public static void SetUpModConfigMenu(ForageFantasyConfig config, ForageFantasy mod)
        {
            GenericModConfigMenuAPI api = mod.Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

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

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

            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, "Other Features", null);

            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);

            // this is a spacer
            api.RegisterLabel(manifest, string.Empty, null);
            api.RegisterLabel(manifest, "1: Restart Needed For Changes To Take Effect", null);
        }
Ejemplo n.º 15
0
 protected override void InitializeApi(GenericModConfigMenuAPI api)
 {
     api.RegisterClampedOption(ModManifest, "Seed Chance", "Chance that a tree will have a seed. Normally this is 0.05 (=5%).", () => config.SeedChance, (float val) => config.SeedChance           = val, 0, 1);
     api.RegisterSimpleOption(ModManifest, "Only Prevent Tapped", "Whether only tapped trees are prevented from spreading.", () => config.OnlyPreventTapped, (bool val) => config.OnlyPreventTapped = val);
     api.RegisterSimpleOption(ModManifest, "Retain Seed", "Whether the tree should keep its seed during the night, to compensate for trees not spreading. Vanilla SDV removes seeds during the night.", () => config.RetainSeed, (bool val) => config.RetainSeed = val);
 }
        // <summary>A SMAPI GameLaunched event that enables GMCM support if that mod is available.</summary>
        public void EnableGMCM(object sender, GameLaunchedEventArgs e)
        {
            try
            {
                GenericModConfigMenuAPI api = Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); //attempt to get GMCM's API instance

                if (api == null)                                                                                                       //if the API is not available
                {
                    return;
                }

                api.RegisterModConfig(ModManifest, () => Config = new ModConfig(), () => Helper.WriteConfig(Config)); //register "revert to default" and "write" methods for this mod's config

                //register an option for each of this mod's config settings
                api.RegisterSimpleOption
                (
                    ModManifest,
                    Helper.Translation.Get("BuildOnAllTerrainFeatures.Name"),
                    Helper.Translation.Get("BuildOnAllTerrainFeatures.Description"),
                    () => Config.BuildOnAllTerrainFeatures,
                    (bool val) => Config.BuildOnAllTerrainFeatures = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    Helper.Translation.Get("BuildOnOtherBuildings.Name"),
                    Helper.Translation.Get("BuildOnOtherBuildings.Description"),
                    () => Config.BuildOnOtherBuildings,
                    (bool val) => Config.BuildOnOtherBuildings = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    Helper.Translation.Get("BuildOnWater.Name"),
                    Helper.Translation.Get("BuildOnWater.Description"),
                    () => Config.BuildOnWater,
                    (bool val) => Config.BuildOnWater = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    Helper.Translation.Get("BuildOnImpassableTiles.Name"),
                    Helper.Translation.Get("BuildOnImpassableTiles.Description"),
                    () => Config.BuildOnImpassableTiles,
                    (bool val) => Config.BuildOnImpassableTiles = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    Helper.Translation.Get("BuildOnNoFurnitureTiles.Name"),
                    Helper.Translation.Get("BuildOnNoFurnitureTiles.Description"),
                    () => Config.BuildOnNoFurnitureTiles,
                    (bool val) => Config.BuildOnNoFurnitureTiles = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    Helper.Translation.Get("BuildOnCaveAndShippingZones.Name"),
                    Helper.Translation.Get("BuildOnCaveAndShippingZones.Description"),
                    () => Config.BuildOnCaveAndShippingZones,
                    (bool val) => Config.BuildOnCaveAndShippingZones = val
                );
            }
            catch (Exception ex)
            {
                Monitor.Log($"An error happened while loading this mod's GMCM options menu. Its menu might be missing or fail to work. The auto-generated error message has been added to the log.", LogLevel.Warn);
                Monitor.Log($"----------", LogLevel.Trace);
                Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
            }
        }
Ejemplo n.º 17
0
 protected override void InitializeApi(GenericModConfigMenuAPI api)
 {
     api.RegisterClampedOption(ModManifest, "Movement Speed Multiplier", "The movement speed is multiplied by this amount. The mod's default is 1.5, meaning 50% faster movement. Set this to 1 to disable the increase in movement speed.", () => config.MovementSpeedMultiplier, (float val) => config.MovementSpeedMultiplier    = val, 0, 5);
     api.RegisterClampedOption(ModManifest, "Tool Charge Delay", "Time required for charging the hoe or watering can in ms. Normally this is 600ms. The default is 600/1.5 = 400, meaning 50% faster charging. Set this to 600 to disable faster tool charging.", () => config.ToolChargeDelay, (int val) => config.ToolChargeDelay = val, 100, 600);
 }
Ejemplo n.º 18
0
        public static void SetUpModConfigMenu(AnimalsDieConfig config, AnimalsDie mod, bool isWaterModInstalled)
        {
            GenericModConfigMenuAPI api = mod.Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu");

            if (api == null)
            {
                return;
            }

            var manifest = mod.ModManifest;

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

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

            foreach (var prop in typeof(AnimalsDieConfig).GetProperties())
            {
                if (prop.PropertyType == typeof(bool))
                {
                    string betterName = Regex.Replace(prop.Name, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");
                    if (prop.Name == nameof(config.DeathByDehydrationWithAnimalsNeedWaterMod))
                    {
                        if (!isWaterModInstalled)
                        {
                            continue;
                        }
                        else
                        {
                            betterName = Regex.Replace(prop.Name.Remove(prop.Name.Length - "WithAnimalsNeedWaterMod".Length), "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");
                        }
                    }

                    api.RegisterSimpleOption(manifest, betterName, null, () => (bool)prop.GetValue(config), (bool b) => prop.SetValue(config, b));
                }
                else
                {
                    if (prop.Name == nameof(config.DaysToDieDueToStarvation) || prop.Name == nameof(config.IllnessScoreToDie))
                    {
                        string betterName = Regex.Replace(prop.Name, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");

                        api.RegisterSimpleOption(manifest, betterName, null, () => (int)prop.GetValue(config), (int b) => prop.SetValue(config, b));
                    }

                    if (prop.Name == nameof(config.DaysToDieDueToDehydrationWithAnimalsNeedWaterMod))
                    {
                        string betterName = string.Empty;

                        if (!isWaterModInstalled)
                        {
                            continue;
                        }
                        else
                        {
                            betterName = Regex.Replace(prop.Name.Remove(prop.Name.Length - "WithAnimalsNeedWaterMod".Length), "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");
                        }

                        api.RegisterSimpleOption(manifest, betterName, null, () => (int)prop.GetValue(config), (int b) => prop.SetValue(config, b));
                    }
                }
            }

            api.RegisterLabel(manifest, "Ages (in years)", null);

            foreach (var prop in typeof(AnimalsDieConfig).GetProperties())
            {
                if (prop.Name.StartsWith("Min"))
                {
                    if (prop.PropertyType == typeof(int))
                    {
                        string betterName = Regex.Replace(prop.Name, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");

                        api.RegisterSimpleOption(manifest, betterName, "must at least 0 and smaller or equal to maximum age, otherwise it's reset", () => (int)prop.GetValue(config), (int i) => prop.SetValue(config, i));

                        var maxProp = typeof(AnimalsDieConfig).GetProperty("Max" + prop.Name.Substring(3));

                        betterName = Regex.Replace(maxProp.Name, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ");

                        api.RegisterSimpleOption(manifest, betterName, "must be larger or equal to the minimum age, otherwise it's reset", () => (int)maxProp.GetValue(config), (int i) => maxProp.SetValue(config, i));
                    }
                }
            }
        }
Ejemplo n.º 19
0
 protected override void InitializeApi(GenericModConfigMenuAPI api)
 {
     api.RegisterSimpleOption(ModManifest, "Enabled indoors", "Always scroll map indoors", () => config.EnabledIndoors, (bool val) => config.EnabledIndoors     = val);
     api.RegisterSimpleOption(ModManifest, "Enabled outdoors", "Always scroll map outdoors", () => config.EnabledOutdoors, (bool val) => config.EnabledOutdoors = val);
     api.RegisterSimpleOption(ModManifest, "Toggle", "Toggle scrolling in current location", () => config.ToggleScroll, (SButton val) => config.ToggleScroll    = val);
 }
Ejemplo n.º 20
0
 protected override void InitializeApi(GenericModConfigMenuAPI api)
 {
     api.RegisterClampedOption(ModManifest, "Rings", "How many ring slots are available.", () => config.Rings, (int val) => config.Rings = val, 0, 20);
 }
Ejemplo n.º 21
0
        public static void EnableGMCM(object sender, GameLaunchedEventArgs e)
        {
            IManifest manifest = ModEntry.Instance.ModManifest;                                                                                      //get this mod's manifest

            GenericModConfigMenuAPI api = ModEntry.Instance.Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); //attempt to get GMCM's API instance

            if (api == null)                                                                                                                         //if the API is not available
            {
                return;
            }

            api.RegisterModConfig(manifest, () => ModEntry.ModConfig = new ModConfig(), () => ModEntry.Instance.Helper.WriteConfig(ModEntry.ModConfig)); //register "revert to default" and "write" methods for this mod's config

            //register an option for each of this mod's config settings
            api.RegisterSimpleOption(
                manifest,
                "Enable slow debuff",
                "If this box is checked, Pollen Sprites will apply a slow effect when they touch you.\nIn multiplayer, this option only affects you.",
                () => ModEntry.ModConfig.EnableSlowDebuff,
                (bool val) => ModEntry.ModConfig.EnableSlowDebuff = val
                );

            api.RegisterSimpleOption(
                manifest,
                "Enable energy drain",
                "If this box is checked, Pollen Sprites will slowly drain your energy when they touch you (but never below 10 points).\nIn multiplayer, this option only affects you.",
                () => ModEntry.ModConfig.EnableEnergyDrain,
                (bool val) => ModEntry.ModConfig.EnableEnergyDrain = val
                );

            api.RegisterLabel(
                manifest,
                "Seed drop chances",
                "When Pollen Sprites are defeated, these options decide how often they drop seeds.\nUse 0 for a 0% chance, 0.45 for 45%, 1 for 100%, etc."
                );

            api.RegisterSimpleOption(
                manifest,
                "Mixed seeds",
                "The chance that Pollen Sprites will drop mixed seeds.\nUse 0 for a 0% chance, 0.45 for 45%, 1 for 100%, etc.",
                () => ModEntry.ModConfig.SeedDropChances.MixedSeeds.ToString(), //read this setting as a string
                (string val) =>
            {
                if (double.TryParse(val, out double result))                //if the string can be parsed to a double
                {
                    ModEntry.ModConfig.SeedDropChances.MixedSeeds = result; //use the parsed value
                }
            }
                );

            api.RegisterSimpleOption(manifest,
                                     "Flower seeds",
                                     "The chance that Pollen Sprites will drop random flower seeds.\nUse 0 for a 0% chance, 0.45 for 45%, 1 for 100%, etc.",
                                     () => ModEntry.ModConfig.SeedDropChances.FlowerSeeds.ToString(), //read this setting as a string
                                     (string val) =>
            {
                if (double.TryParse(val, out double result))                 //if the string can be parsed to a double
                {
                    ModEntry.ModConfig.SeedDropChances.FlowerSeeds = result; //use the parsed value
                }
            }
                                     );

            api.RegisterSimpleOption(
                manifest,
                "All seeds",
                "The chance that Pollen Sprites will drop ANY random seeds, including from modded crops.\nUse 0 for a 0% chance, 0.45 for 45%, 1 for 100%, etc.",
                () => ModEntry.ModConfig.SeedDropChances.AllSeeds.ToString(), //read this setting as a string
                (string val) =>
            {
                if (double.TryParse(val, out double result))              //if the string can be parsed to a double
                {
                    ModEntry.ModConfig.SeedDropChances.AllSeeds = result; //use the parsed value
                }
            }
                );
        }
Ejemplo n.º 22
0
 abstract protected void InitializeApi(GenericModConfigMenuAPI api);
Ejemplo n.º 23
0
        // <summary>A SMAPI GameLaunched event that enables GMCM support if that mod is available.</summary>
        public void EnableGMCM(object sender, GameLaunchedEventArgs e)
        {
            try
            {
                GenericModConfigMenuAPI api = Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); //attempt to get GMCM's API instance

                if (api == null)                                                                                                       //if the API is not available
                {
                    return;
                }

                api.RegisterModConfig(ModManifest, () => Config = new ModConfig(), () => Helper.WriteConfig(Config)); //register "revert to default" and "write" methods for this mod's config
                api.SetDefaultIngameOptinValue(ModManifest, true);                                                    //allow in-game setting changes (rather than just at the main menu)

                //register an option for each of this mod's config settings

                //buildings
                api.RegisterLabel
                (
                    ModManifest,
                    "Building settings",
                    "Transparency settings for player-constructed farm buildings.\nNote: These settings only affect buildings that can be constructed or moved by players."
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Enable",
                    "Check this box to enable custom settings for building transparency.\nUncheck this box to use Stardew's default transparency.",
                    () => Config.BuildingSettings.Enable,
                    (bool val) => Config.BuildingSettings.Enable = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Below player only",
                    "If this box is checked, buildings will only be transparent if they're vertically lower than your character.",
                    () => Config.BuildingSettings.BelowPlayerOnly,
                    (bool val) => Config.BuildingSettings.BelowPlayerOnly = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Tile distance",
                    "If the number of tiles between your character and a building is less than this setting, the building will be transparent.",
                    () => Config.BuildingSettings.TileDistance,
                    (int val) => Config.BuildingSettings.TileDistance = val
                );

                //bushes
                api.RegisterLabel
                (
                    ModManifest,
                    "Bush settings",
                    "Transparency settings for bushes.\nNote: These settings only affect bushes that players can interact with."
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Enable",
                    "Check this box to enable custom settings for bush transparency.\nUncheck this box to use Stardew's default transparency.",
                    () => Config.BushSettings.Enable,
                    (bool val) => Config.BushSettings.Enable = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Below player only",
                    "If this box is checked, bushes will only be transparent if they're vertically lower than your character.",
                    () => Config.BushSettings.BelowPlayerOnly,
                    (bool val) => Config.BushSettings.BelowPlayerOnly = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Tile distance",
                    "If the number of tiles between your character and a bush is less than this setting, the bush will be transparent.",
                    () => Config.BushSettings.TileDistance,
                    (int val) => Config.BushSettings.TileDistance = val
                );

                //trees
                api.RegisterLabel
                (
                    ModManifest,
                    "Tree settings",
                    "Transparency settings for trees.\nNote: These settings only affect trees that players can interact with."
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Enable",
                    "Check this box to enable custom settings for tree transparency.\nUncheck this box to use Stardew's default transparency.",
                    () => Config.TreeSettings.Enable,
                    (bool val) => Config.TreeSettings.Enable = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Below player only",
                    "If this box is checked, trees will only be transparent if they're vertically lower than your character.",
                    () => Config.TreeSettings.BelowPlayerOnly,
                    (bool val) => Config.TreeSettings.BelowPlayerOnly = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Tile distance",
                    "If the number of tiles between your character and a tree is less than this setting, the tree will be transparent.",
                    () => Config.TreeSettings.TileDistance,
                    (int val) => Config.TreeSettings.TileDistance = val
                );

                //keybinds
                api.RegisterLabel
                (
                    ModManifest,
                    "Key bindings",
                    "Keybind settings for this mod's optional toggle controls."
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Disable transparency",
                    "A list of keybinds that toggle between this mod's settings and normal Stardew transparency.\n\nSee the wiki for info about multi-key bindings: https://stardewvalleywiki.com/Modding:Player_Guide/Key_Bindings",
                    () => Config.KeyBindings.DisableTransparency,
                    (KeybindList val) => Config.KeyBindings.DisableTransparency = val
                );

                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Full transparency",
                    "A list of keybinds that toggle between this mod's settings and maximum transparency on all objects.\n\nSee the wiki for info about multi-key bindings: https://stardewvalleywiki.com/Modding:Player_Guide/Key_Bindings",
                    () => Config.KeyBindings.FullTransparency,
                    (KeybindList val) => Config.KeyBindings.FullTransparency = val
                );
            }
            catch (Exception ex)
            {
                Monitor.Log($"An error happened while loading this mod's GMCM options menu. Its menu might be missing or fail to work. The auto-generated error message has been added to the log.", LogLevel.Warn);
                Monitor.Log($"----------", LogLevel.Trace);
                Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
            }
        }
Ejemplo n.º 24
0
        /// <summary>A SMAPI GameLaunched event that enables GMCM support if that mod is available.</summary>
        public void EnableGMCM(object sender, GameLaunchedEventArgs e)
        {
            try
            {
                GenericModConfigMenuAPI api = Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); //attempt to get GMCM's API instance

                if (api == null)                                                                                                       //if the API is not available
                {
                    return;
                }

                api.RegisterModConfig(ModManifest, () => Config = new ModConfig(), () => Helper.WriteConfig(Config)); //register "revert to default" and "write" methods for this mod's config
                api.SetDefaultIngameOptinValue(ModManifest, true);                                                    //allow in-game setting changes (rather than just at the main menu)

                //register an option for each of this mod's config settings
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "When bushes regrow",
                    "The amount of time before destroyed bushes will regrow.\nType a number and then a unit of time (Days, Seasons, Years).\nLeave this blank to never respawn bushes.\nExamples: \"3 days\" \"1 season\" \"1 year\"",
                    () => Config.WhenBushesRegrow ?? "null", //return the string "null" if the setting is null
                    (string val) => Config.WhenBushesRegrow = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Destroyable bush locations",
                    "A list of locations where bushes should be destroyable.\nIf the list is empty, all locations will be allowed.\nSeparate each name with a comma.\nExample: \"Farm, BusStop, Forest, Woods\"",
                    () => GMCMLocationList,
                    (string val) => GMCMLocationList = val
                );

                api.RegisterLabel
                (
                    ModManifest,
                    "Destroyable bush types",
                    "The types of bush that are allowed to be destroyed."
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Small bushes",
                    "Check this box to make small bushes destroyable.",
                    () => Config.DestroyableBushTypes.SmallBushes,
                    (bool val) => Config.DestroyableBushTypes.SmallBushes = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Medium bushes",
                    "Check this box to make medium bushes destroyable. These are the type that can produce berries.",
                    () => Config.DestroyableBushTypes.MediumBushes,
                    (bool val) => Config.DestroyableBushTypes.MediumBushes = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Large bushes",
                    "Check this box to make large bushes destroyable.",
                    () => Config.DestroyableBushTypes.LargeBushes,
                    (bool val) => Config.DestroyableBushTypes.LargeBushes = val
                );

                api.RegisterLabel
                (
                    ModManifest,
                    "Amount of wood dropped",
                    "The number of wood pieces dropped when each type of bush is destroyed."
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Small bushes",
                    "The number of wood pieces dropped when a small bush is destroyed.",
                    () => Config.AmountOfWoodDropped.SmallBushes,
                    (int val) => Config.AmountOfWoodDropped.SmallBushes = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Medium bushes",
                    "The number of wood pieces dropped when a medium bush is destroyed.",
                    () => Config.AmountOfWoodDropped.MediumBushes,
                    (int val) => Config.AmountOfWoodDropped.MediumBushes = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Large bushes",
                    "The number of wood pieces dropped when a large bush is destroyed.",
                    () => Config.AmountOfWoodDropped.LargeBushes,
                    (int val) => Config.AmountOfWoodDropped.LargeBushes = val
                );
                api.RegisterSimpleOption
                (
                    ModManifest,
                    "Green tea bushes",
                    "The number of wood pieces dropped when a green tea bush is destroyed.",
                    () => Config.AmountOfWoodDropped.GreenTeaBushes,
                    (int val) => Config.AmountOfWoodDropped.GreenTeaBushes = val
                );
            }
            catch (Exception ex)
            {
                Monitor.Log($"An error happened while loading this mod's GMCM options menu. Its menu might be missing or fail to work. The auto-generated error message has been added to the log.", LogLevel.Warn);
                Monitor.Log($"----------", LogLevel.Trace);
                Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
            }
        }