internal static void saveHoeDirt() { hoeDirtChache = new Dictionary <GameLocation, List <Vector2> >(); foreach (GameLocation location in PyUtils.getAllLocationsAndBuidlings()) { if (location is GameLocation) { if (!hoeDirtChache.ContainsKey(location)) { hoeDirtChache.Add(location, new List <Vector2>()); } hoeDirtChache[location] = location.terrainFeatures.Keys .Where(t => location.terrainFeatures[t] is HoeDirt) .ToList(); } } string savestring = string.Join(";", hoeDirtChache.toList(l => l.Key.Name + ":" + string.Join(",", l.Value.toList(v => $"{v.X}-{v.Y}")))); int index = savetiles.save.FindIndex(s => s.StartsWith(player + ">")); if (index == -1) { savetiles.save.Add(player + ">" + savestring); } else { savetiles.save[index] = player + ">" + savestring; } helper.WriteConfig(savetiles); }
public static List <string> ReorderSpousesForRooms(List <string> spousesWithRooms) { List <string> configSpouses = ModEntry.config.SpouseRoomOrder.Split(',').Where(s => s.Length > 0).ToList(); List <string> spouses = new List <string>(); foreach (string s in configSpouses) { if (spousesWithRooms.Contains(s)) { spouses.Add(s); } } foreach (string s in spousesWithRooms) { if (!spouses.Contains(s)) { spouses.Add(s); configSpouses.Add(s); } } string configString = string.Join(",", configSpouses); if (configString != ModEntry.config.SpouseRoomOrder) { ModEntry.config.SpouseRoomOrder = configString; Helper.WriteConfig(ModEntry.config); } return(spouses); }
private static void SetSkin(string skinName) { if (!skinDict.ContainsKey(skinName) || skinDict[skinName][0] == null || skinDict[skinName][1] == null) { return; } ModEntry.phoneTexture = skinDict[skinName][0]; ModEntry.phoneRotatedTexture = skinDict[skinName][1]; Config.PhoneSkinPath = skinName; Helper.WriteConfig(Config); }
public static void SaveRecoveryConfig(Farmer player, bool enableRecoveryService, bool?recoveryAllItems = null, bool?recoveryForFree = null) { RecoveryConfig recoveryConfig = GetRecoveryConfig(player); if (!recoveryConfig.DisableRecoveryConfigInGameChanges) { recoveryConfig.EnableRecoveryService = enableRecoveryService; recoveryConfig.RecoverAllItems = recoveryAllItems ?? recoveryConfig.RecoverAllItems; recoveryConfig.RecoverForFree = recoveryForFree ?? recoveryConfig.RecoverForFree; Helper.WriteConfig <ModConfig>(DataLoader.ModConfig); } }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { ModConfig config = helper.ReadConfig <ModConfig>(); eatAtStaminaAmount = config.StaminaThreshold; if (eatAtStaminaAmount < 0) { eatAtStaminaAmount = config.StaminaThreshold = 0; helper.WriteConfig(config); } eatAtHealthAmount = config.HealthThreshold; if (eatAtHealthAmount < 0) { eatAtHealthAmount = config.HealthThreshold = 20; helper.WriteConfig(config); } autoEatFood = config.AutoEatFood; if (!autoEatFood) { autoEatFood = config.AutoEatFood = false; helper.WriteConfig(config); } eatCheapestFood = config.EatCheapestFood; if (!eatCheapestFood) { eatCheapestFood = config.EatCheapestFood = false; helper.WriteConfig(config); } instantEatKey = config.InstantEatKey; if (instantEatKey <= 0) { instantEatKey = config.InstantEatKey = SButton.Q; helper.WriteConfig(config); } helper.ConsoleCommands.Add("player_setstaminathreshold", "Sets the stamina threshold at which the player will automatically consume food.\nUsage: player_setstaminathreshold <value>\n- value: the float/integer amount.", this.SetStaminaThreshold); //command that sets when to automatically eat (i.e. 25 energy instead of 0) helper.ConsoleCommands.Add("player_sethealththreshold", "Sets the health threshold at which the player will automatically consume food.\nUsage: player_sethealththreshold <value>\n- value: the float/integer amount.", this.SetHealthThreshold); //command that sets when to automatically eat (i.e. 25 energy instead of 0) helper.Events.Input.ButtonPressed += this.OnButtonPressed; helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked; //adding the method with the same name below to the corresponding event in order to make them connect helper.Events.GameLoop.Saving += this.OnSaving; helper.Events.GameLoop.DayStarted += this.OnDayStarted; }
/********* ** Public methods *********/ /// <inheritdoc /> public override void Entry(IModHelper helper) { I18n.Init(helper.Translation); // read config this.Config = helper.ReadConfig <ModConfig>(); if (this.Config.Normalize(this.Monitor)) { helper.WriteConfig(this.Config); } // read data this.ProfessionMap = this.GetProfessionMap(this.Helper.Data.ReadJsonFile <ModData>("assets/data.json")).ToArray(); if (!this.ProfessionMap.Any()) { this.Monitor.Log("The data.json file is missing or invalid; try reinstalling the mod.", LogLevel.Error); return; } // log if data.json is customized string dataPath = Path.Combine(this.Helper.DirectoryPath, "assets", "data.json"); if (File.Exists(dataPath)) { string hash = this.GetFileHash(dataPath); if (hash != this.DataFileHash) { this.Monitor.Log($"Using a custom data.json file (MD5 hash: {hash})."); } } // hook event helper.Events.GameLoop.GameLaunched += this.OnGameLaunched; helper.Events.GameLoop.DayStarted += this.OnDayStarted; }
public override void Entry(IModHelper helper) { ModConfig = helper.ReadConfig <ModConfig>(); helper.WriteConfig(ModConfig); HarmonyInstance harmony = HarmonyInstance.Create("zaneyork.CustomToolEffect"); harmony.Patch( original: AccessTools.DeclaredMethod(typeof(Tree), "performToolAction"), prefix: new HarmonyMethod(typeof(TreeRewrites.PerformToolActionRewrite), nameof(TreeRewrites.PerformToolActionRewrite.Prefix)) ); harmony.Patch( original: AccessTools.DeclaredMethod(typeof(FruitTree), "performToolAction"), prefix: new HarmonyMethod(typeof(FruitTreeRewrites.PerformToolActionRewrite), nameof(FruitTreeRewrites.PerformToolActionRewrite.Prefix)) ); harmony.Patch( original: AccessTools.DeclaredMethod(typeof(ResourceClump), "performToolAction"), prefix: new HarmonyMethod(typeof(ResourceClumpRewrites.PerformToolActionRewrite), nameof(ResourceClumpRewrites.PerformToolActionRewrite.Prefix)) ); harmony.Patch( original: AccessTools.DeclaredMethod(typeof(Pickaxe), "DoFunction"), prefix: new HarmonyMethod(typeof(PickaxeRewrites.DoFunctionRewrite), nameof(PickaxeRewrites.DoFunctionRewrite.Prefix)) ); harmony.Patch( original: AccessTools.DeclaredMethod(typeof(Tool), "tilesAffected"), prefix: new HarmonyMethod(typeof(ToolRewrites.TilesAffectedRewrite), nameof(ToolRewrites.TilesAffectedRewrite.Prefix)) ); AccessTools.GetDeclaredConstructors(typeof(TemporaryAnimatedSprite)).ForEach(ctor => { harmony.Patch( original: ctor, postfix: new HarmonyMethod(typeof(ToolRewrites.TilesAffectedRewrite), nameof(TemporaryAnimatedSpriteRewrites.ConstructorRewrite.Postfix)) ); }); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { foreach (var checkbox in Checkboxes) { if (checkbox.containsPoint(x, y)) { ToggleOption(checkbox.name); } } foreach (var setbutton in SetButtons) { if (setbutton.containsPoint(x, y)) { Game1.activeClickableMenu = new OptionsKeyListener <TOptions>(_config, setbutton.name, this); } } foreach (var slider in Sliders) { if (slider.containsPoint(x, y)) { SliderHeld = slider; Sliding = true; } } if (upperRightCloseButton.containsPoint(x, y)) { _helper.WriteConfig(_config); base.receiveLeftClick(x, y, playSound); Game1.activeClickableMenu = _returnMenu; } }
public override void Entry(IModHelper helper) { this.config = this.Helper.ReadConfig <ModConfig>(); helper.WriteConfig(this.config); IModEvents events = helper.Events; events.Display.MenuChanged += this.Display_MenuChanged; events.Input.ButtonPressed += this.Input_ButtonPressed; events.GameLoop.SaveLoaded += this.GameLoop_SaveLoaded; events.GameLoop.Saved += this.GameLoop_Saved; events.GameLoop.DayStarted += this.GameLoop_DayStarted; events.Display.RenderingHud += this.Display_RenderingHud; events.GameLoop.OneSecondUpdateTicked += this.UpdatePaths; events.Player.Warped += this.UpdatePaths; OverlayTextures.LoadTextures(this.Helper.DirectoryPath); try { this.openMenuKey = (Keys)Enum.Parse(typeof(Keys), this.config.OpenMenuKey); } catch { // use default value } }
/// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { // Only run if the master game if (!Game1.IsMasterGame) { return; } Config = helper.ReadConfig <ModConfig>(); Util.Config = Config; Util.Reflection = helper.Reflection; Util.Abilities = new JunimoAbilities(Config.JunimoAbilites); helper.WriteConfig(Config); Util.Payments = new JunimoPayments(Config.JunimoPayment); Util.MaxRadius = Config.JunimoPayment.WorkForWages ? Util.UnpaidRadius : Config.JunimoHuts.MaxRadius; helper.Content.AssetEditors.Add(new JunimoEditor(helper.Content)); helper.Content.AssetEditors.Add(new BlueprintEditor()); helper.Events.Input.ButtonPressed += OnButtonPressed; helper.Events.Display.MenuChanged += OnMenuChanged; helper.Events.GameLoop.DayStarted += OnDayStarted; helper.Events.GameLoop.SaveLoaded += OnSaveLoaded; helper.Events.GameLoop.Saved += OnSaved; helper.Events.World.BuildingListChanged += OnBuildingListChanged; DoHarmonyRegistration(); }
public override void Entry(IModHelper helper) { config = helper.ReadConfig <Config>(); helper.WriteConfig(config); helper.Events.GameLoop.Saving += OnSaving; helper.Events.GameLoop.SaveLoaded += OnSaveLoaded; helper.Events.GameLoop.DayStarted += OnDayStarted; responses = new List <Response>(); responses.Add(new Response("ATM_Deposit", i18n.Get("ATM_Deposit"))); responses.Add(new Response("ATM_Daily_Deposit", i18n.Get("ATM_Daily_Deposit"))); responses.Add(new Response("ATM_Withdraw", i18n.Get("ATM_Withdraw"))); responses.Add(new Response("ATM_Close", i18n.Get("ATM_Close"))); var openATMAction = new TileAction("OpenATM", openATM); openATMAction.register(); var atmWinterCheck = new TileAction("ATMWinterCheck", checkSeason); atmWinterCheck.register(); var atm = TMXContent.Load(Path.Combine("Assets", "atm.tmx"), Helper); atm.injectInto(@"Maps/" + config.Map, new Vector2(config.Position[0], config.Position[1]), null); }
///<summary>Tasks performed when the mod initially loads.</summary> public override void Entry(IModHelper helper) { //tell SMAPI to run event methods when necessary Helper.Events.GameLoop.DayStarted += DayStarted; Helper.Events.GameLoop.DayEnding += DayEnding; Helper.Events.GameLoop.ReturnedToTitle += ReturnedToTitle; Utility.Monitor.IMonitor = Monitor; //pass the monitor for use by other areas of this mod's code //attempt to load the config.json ModConfig file and activate its settings try { Utility.MConfig = helper.ReadConfig <ModConfig>(); //create or load the config.json file if (Utility.MConfig.EnableWhereAmICommand == true) //if enabled, add the WhereAmI method as a console command { helper.ConsoleCommands.Add("whereami", "Outputs coordinates and other information about the player's current location.", WhereAmI); } helper.WriteConfig <ModConfig>(Utility.MConfig); //update the config.json file (e.g. to add settings from new versions of the mod) } catch (Exception ex) //if the config.json file can't be parsed correctly, try to explain it in the user's log & then skip any config-related behaviors { Utility.Monitor.Log($"Warning: This mod's config.json file could not be parsed correctly. Related settings will be disabled. Please edit the file, or delete it and reload the game to generate a new config file. The auto-generated error message is displayed below:", LogLevel.Warn); Utility.Monitor.Log($"----------", LogLevel.Warn); //visual break to slightly improve clarity, based on user feedback Utility.Monitor.Log($"{ex.Message}", LogLevel.Warn); } }
/// <inheritdoc /> /// <summary>Initialize the mod.</summary> /// <param name="helper">Provides methods for interacting with the mod directory, such as read/writing a config file or custom JSON files.</param> public override void Entry(IModHelper helper) { // Load configs this.Config = helper.ReadConfig <ConfigMain>(); this.TreasureConfig = helper.ReadJsonFile <ConfigTreasure>("treasure.json") ?? new ConfigTreasure(); this.FishConfig = helper.ReadJsonFile <ConfigFish>("fish.json") ?? new ConfigFish(); // Make sure the extra configs are generated helper.WriteJsonFile("treasure.json", this.TreasureConfig); helper.WriteJsonFile("fish.json", this.FishConfig); this.Config.AdditionalLootChance = (float)Math.Min(this.Config.AdditionalLootChance, 0.99); helper.WriteConfig(this.Config); this.OnLanguageChange(LocalizedContentManager.CurrentLanguageCode); // Stop here if the mod is disabled if (!this.Config.ModEnabled) { return; } // Events GameEvents.UpdateTick += this.UpdateTick; ControlEvents.KeyPressed += this.KeyPressed; LocalizedContentManager.OnLanguageChange += this.OnLanguageChange; }
/// <summary>Update known achievements and save them into config.</summary> private void SaveAwards(object sender, EventArgs args) { SaveProfessions(); SaveStardrops(); SaveCraftingRecipes(); SaveCookingRecipes(); SaveExperience(); if (Helper.Reflection.GetMethod((Game1.getLocationFromName("Town") as Town), "checkJojaCompletePrerequisite").Invoke <Boolean>()) { ModConfig.SetFlag("ccJoja", true); } if (Game1.player.hasCompletedCommunityCenter()) { ModConfig.SetFlag("ccJunimo", true); } ModConfig.SetFlagIfGreater("grandpaScore", (Game1.getLocationFromName("Farm") as Farm).grandpaScore); ModConfig.SetFlagIfGreater("money", Game1.player.money); if (Game1.player.achievements.Contains(34)) { ModConfig.SetFlag("fullShipment", true); } if (Game1.player.mailReceived.Contains("QiChallengeComplete")) { ModConfig.SetFlag("QiChallengeComplete", true); } if (StardewValley.Locations.AdventureGuild.areAllMonsterSlayerQuestsComplete()) { ModConfig.SetFlag("areAllMonsterSlayerQuestsComplete", true); } Helper.WriteConfig(ModConfig); }
/********* ** Public methods *********/ /// <inheritdoc /> public override void Entry(IModHelper helper) { ReflectionHelper = helper.Reflection; EventsHelper = helper.Events; InputHelper = helper.Input; Config = helper.ReadConfig <ModConfig>(); if (Config.Check(Monitor)) { helper.WriteConfig(Config); } SetupTasks(); helper.Events.GameLoop.ReturnedToTitle += GameLoop_ReturnedToTitle; helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded; helper.Events.GameLoop.DayStarted += GameLoop_DayStarted; // In-game Events helper.Events.Input.ButtonPressed += Input_ButtonPressed; helper.Events.Display.MenuChanged += Display_MenuChanged; SettingsMenu.ReportConfigChanged += SettingsMenu_ReportConfigChanged; // Draw Events helper.Events.Display.RenderingHud += Display_RenderingHud; }
public VirtualToggle(IModHelper helper, IMonitor monitor) { this.Monitor = monitor; this.helper = helper; this.texture = this.helper.Content.Load <Texture2D>("assets/togglebutton.png", ContentSource.ModFolder); this.modConfig = helper.ReadConfig <ModConfig>(); for (int i = 0; i < this.modConfig.buttons.Length; i++) { this.keyboard.Add(new KeyButton(helper, this.modConfig.buttons[i], this.Monitor)); } for (int i = 0; i < this.modConfig.buttonsExtend.Length; i++) { this.keyboardExtend.Add(new KeyButton(helper, this.modConfig.buttonsExtend[i], this.Monitor)); } if (this.modConfig.vToggle.rectangle.X != 36 || this.modConfig.vToggle.rectangle.Y != 12) { this.isDefault = false; } this.autoHidden = this.modConfig.vToggle.autoHidden; this.virtualToggleButton = new ClickableTextureComponent(new Rectangle(Game1.toolbarPaddingX + 64, 12, 128, 128), this.texture, new Rectangle(0, 0, 16, 16), 5.75f, false); helper.WriteConfig(this.modConfig); this.helper.Events.Display.Rendered += this.OnRendered; this.helper.Events.Display.MenuChanged += this.OnMenuChanged; this.helper.Events.Input.ButtonPressed += this.VirtualToggleButtonPressed; }
// Add an admin public void addAdmin(Farmer farmer) { if (farmer is null) { return; } Monitor.Log($"Adding {farmer.Name} ({farmer.UniqueMultiplayerID}) to admin list", LogLevel.Debug); SavedConfig.Admin newAdmin = new SavedConfig.Admin(); newAdmin.id = farmer.UniqueMultiplayerID; newAdmin.name = farmer.Name; json.admins.Add(newAdmin); Helper.WriteConfig <SavedConfig>(json); }
// save config.json and invalidate caches internal static void SaveConfig() { SHelper.WriteConfig(Config); SHelper.GameContent.InvalidateCache("Characters/Junimo"); SHelper.GameContent.InvalidateCache($"Characters/Junimo.{SHelper.Translation.Locale}"); SHelper.GameContent.InvalidateCache("Data/Blueprints"); SHelper.GameContent.InvalidateCache($"Data/Blueprints.{SHelper.Translation.Locale}"); }
/// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { config = helper.ReadConfig <Config>(); helper.Events.GameLoop.OneSecondUpdateTicked += OnOneSecondUpdateTicked; helper.Events.Input.ButtonPressed += OnButtonPressed; CorrectHealingValue(); helper.WriteConfig(config); }
/// <summary>Initializes this mod's GMCM menu if available.</summary> /// <param name="helper">The helper instance to use for API access.</param> /// <param name="monitor">The monitor instance to use for console/log messages.</param> /// <param name="manifest">This mod's manifest for use by GMCM.</param> public static void Initialize(IModHelper helper, IMonitor monitor, IManifest manifest) { try { var api = helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (api == null) { if (monitor.IsVerbose) { monitor.Log($"GMCM does not seem to be available. Skipping menu setup.", LogLevel.Trace); } return; } // register mod api.Register( mod: manifest, reset: () => ModConfig.Instance = new ModConfig(), save: () => helper.WriteConfig(ModConfig.Instance) ); api.AddBoolOption ( mod: manifest, name: () => helper.Translation.Get("Config.PlaceBedsAnywhere.Name"), tooltip: () => helper.Translation.Get("Config.PlaceBedsAnywhere.Description"), getValue: () => ModConfig.Instance.AllowBedPlacementEverywhere, setValue: value => ModConfig.Instance.AllowBedPlacementEverywhere = value ); api.AddBoolOption ( mod: manifest, name: () => helper.Translation.Get("Config.PlaceMiniFridgesAnywhere.Name"), tooltip: () => helper.Translation.Get("Config.PlaceMiniFridgesAnywhere.Description"), getValue: () => ModConfig.Instance.AllowMiniFridgesEverywhere, setValue: value => ModConfig.Instance.AllowMiniFridgesEverywhere = value ); api.AddBoolOption ( mod: manifest, name: () => helper.Translation.Get("Config.PassOutSafelyEverywhere.Name"), tooltip: () => helper.Translation.Get("Config.PassOutSafelyEverywhere.Description"), getValue: () => ModConfig.Instance.PassOutSafelyEverywhere, setValue: value => ModConfig.Instance.PassOutSafelyEverywhere = value ); if (monitor.IsVerbose) { monitor.Log($"GMCM menu setup complete.", LogLevel.Trace); } } catch (Exception ex) { monitor.Log($"Error while setting up in-game menu with Generic Mod Config Menu (GMCM). The menu might be missing or incomplete. Full error message: \n{ex}", LogLevel.Warn); } }
public void RegisterModConfigMenu(IModHelper helper, IManifest manifest) { if (!helper.ModRegistry.IsLoaded("spacechase0.GenericModConfigMenu")) { return; } IGMCMAPI api = helper.ModRegistry.GetApi <IGMCMAPI>("spacechase0.GenericModConfigMenu"); api.RegisterModConfig(manifest, ResetToDefault, () => helper.WriteConfig(this)); api.SetDefaultIngameOptinValue(manifest, true); api.RegisterLabel(manifest, manifest.Name, manifest.Description); api.RegisterChoiceOption( manifest, helper.Translation.Get("cfg-warpsenabled.label"), helper.Translation.Get("cfg-warpsenabled.desc"), () => VanillaWarpsEnabled.ToString(), (string c) => VanillaWarpsEnabled = Utils.ParseEnum <WarpEnabled>(c), Enum.GetNames(typeof(WarpEnabled)) ); api.RegisterChoiceOption( manifest, helper.Translation.Get("cfg-farmenabled.label"), helper.Translation.Get("cfg-farmenabled.desc"), () => FarmWarpEnabled.ToString(), (string c) => FarmWarpEnabled = Utils.ParseEnum <WarpEnabled>(c), Enum.GetNames(typeof(WarpEnabled)) ); api.RegisterSimpleOption( manifest, helper.Translation.Get("cfg-accessdisabled.label"), helper.Translation.Get("cfg-accessdisabled.desc"), () => AccessFromDisabled, (bool b) => AccessFromDisabled = b ); api.RegisterSimpleOption( manifest, helper.Translation.Get("cfg-accesswand.label"), helper.Translation.Get("cfg-accesswand.desc"), () => AccessFromWand, (bool b) => AccessFromWand = b ); api.RegisterSimpleOption( manifest, helper.Translation.Get("cfg-obeliskpatch.label"), helper.Translation.Get("cfg-obeliskpatch.desc"), () => PatchObelisks, (bool b) => PatchObelisks = b ); api.RegisterSimpleOption( manifest, helper.Translation.Get("cfg-menu.label"), helper.Translation.Get("cfg-menu.desc"), () => MenuEnabled, (bool b) => MenuEnabled = b ); }
public override void Entry(IModHelper helper) { config = helper.ReadConfig<Config>(); GameEvents.OneSecondTick += OnGameUpdate; InputEvents.ButtonPressed += OnButtonPressed; CorrectHealingValue(); helper.WriteConfig(config); Log("Finished initialization."); }
internal static void saveProfileChoice() { Game1.playSound("coin"); string author = _activeProfile.author == "none" ? "" : " by " + _activeProfile.author; Game1.hudMessages.Clear(); Game1.addHUDMessage(new HUDMessage("Profile: " + _activeProfile.name + author, 1)); _config.activeProfile = _activeProfile.id; _helper.WriteConfig <Config>(_config); }
public override void Entry(IModHelper helper) { base.Entry(helper); Config = helper.ReadConfig <Config>(); helper.WriteConfig(Config); Monitor.Log(Config.FasterSpeed.ToString()); SaveEvents.AfterLoad += this.SaveEvents_AfterLoad; }
public override void Entry(IModHelper helper) { helper.Events.Input.ButtonPressed += Input_ButtonPressed; helper.Events.Input.ButtonReleased += Input_ButtonReleased; helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded; Config = helper.ReadConfig <DAConfig>(); helper.WriteConfig <DAConfig>(Config); }
private void ChangeTooltipConfig(bool incre = true) { if (incre) { if (++config.NameTooltipMode > 3) { config.NameTooltipMode = 1; } modHelper.WriteConfig(config); } else { if (--config.NameTooltipMode < 1) { config.NameTooltipMode = 3; } modHelper.WriteConfig(config); } }
private void ReadConfig() { Config = (LCPConfig)Helper.ReadConfig <LCPConfig>(); if (!(Config.UnlockKey == "control")) { return; } Config.UnlockKey = "leftcontrol,rightcontrol"; Helper.WriteConfig <LCPConfig>(Config); }
private void LoadConfig() { ModConfig ReadConfig = Helper.ReadConfig <ModConfig>(); if (ReadConfig.Equals(new ModConfig())) { Helper.WriteConfig(ReadConfig); } Config = ReadConfig; }
/// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { HarmonyInstance instance = HarmonyInstance.Create(this.Helper.ModRegistry.ModID); if (ValidateConfig(helper.ReadConfig <ModConfig>(), out Config)) { helper.WriteConfig(Config); } instance.PatchAll(Assembly.GetExecutingAssembly()); }
public override void Entry(IModHelper helper) { HarmonyInstance instance = HarmonyInstance.Create("cat.customtransparency"); if (ValidateConfig(helper.ReadConfig <CustomTransparencyModConfig>(), out Config)) { helper.WriteConfig(Config); } instance.PatchAll(Assembly.GetExecutingAssembly()); }