private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { fluteBlockApi = Helper.ModRegistry.GetApi <IAdvancedFluteBlocksApi>("aedenthorn.AdvancedFluteBlocks"); trainTrackApi = Helper.ModRegistry.GetApi <ITrainTracksApi>("aedenthorn.TrainTracks"); // get Generic Mod Config Menu's API (if it's installed) var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (configMenu is null) { return; } // register mod configMenu.Register( mod: ModManifest, reset: () => Config = new ModConfig(), save: () => Helper.WriteConfig(Config) ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Mod Enabled?", getValue: () => Config.EnableMod, setValue: value => Config.EnableMod = value ); configMenu.AddTextOption( mod : ModManifest, name : () => "Import Key", getValue : () => Config.ImportKey.ToString(), setValue : delegate(string value) { try { Config.ImportKey = KeybindList.Parse(value); } catch { } } ); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { foreach (IContentPack contentPack in Helper.ContentPacks.GetOwned()) { FloorsData floorsData = contentPack.ReadJsonFile <FloorsData>("content.json") ?? new FloorsData(); foreach (Floor floor in floorsData.floors) { try { for (int i = 0; i < config.FloorNames.Count; i++) { if (floor.name == config.FloorNames[i]) { Monitor.Log($"Setting floor {i} map to {floor.name}."); floorMaps[i] = contentPack.LoadAsset <Map>(floor.mapPath); } } floorsList.Add(floor.name, floor); } catch (Exception ex) { Monitor.Log($"Exception getting map at {floor.mapPath} for {floor.name} in content pack {contentPack.Manifest.Name}:\n{ex}", LogLevel.Error); } } } Monitor.Log($"Loaded {floorsList.Count} floors."); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { ObjectManager.loadInItems(); //Adds in recipes to the mod. VanillaRecipeBook = new VanillaRecipeBook(); CraftingRecipeBook.CraftingRecipesByGroup = new Dictionary <string, CraftingRecipeBook>(); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { apiDGA = Helper.ModRegistry.GetApi <IDynamicGameAssetsApi>("spacechase0.DynamicGameAssets"); apiJA = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets"); // get Generic Mod Config Menu's API (if it's installed) var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (configMenu is null) { return; } // register mod configMenu.Register( mod: ModManifest, reset: () => Config = new ModConfig(), save: () => Helper.WriteConfig(Config) ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Mod Enabled?", getValue: () => Config.EnableMod, setValue: value => Config.EnableMod = value ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Reset Farm Cave Event", tooltip: () => "Will reset the cave the next time you load a save. REMOVES ALL OBJECTS IN CAVE", getValue: () => Config.ResetEvent, setValue: value => Config.ResetEvent = value ); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { // get Generic Mod Config Menu's API (if it's installed) var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (configMenu is null) { return; } // register mod configMenu.Register( mod: ModManifest, reset: () => Config = new ModConfig(), save: () => Helper.WriteConfig(Config) ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Mod Enabled?", getValue: () => Config.EnableMod, setValue: value => Config.EnableMod = value ); string path = Path.Combine(Helper.DirectoryPath, "assets", "silent.wav"); FileStream fs = new FileStream(path, FileMode.Open); silentSound = SoundEffect.FromStream(fs); fs.Dispose(); }
private void SetCompatOptions(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { if (Helper.ModRegistry.IsLoaded("DigitalCarbide.SpriteMaster")) { CompatOptions.Add("SpriteMaster"); } }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { API api = (API)GetApi(); api.registerCritterPack(typeof(StardewValley.BellsAndWhistles.Critter)); api.registerCritterPack(typeof(Critters.PackagedCritters.HornedOwl)); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { // get Generic Mod Config Menu's API (if it's installed) var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (configMenu is null) { return; } // register mod configMenu.Register( mod: ModManifest, reset: () => Config = new ModConfig(), save: () => Helper.WriteConfig(Config) ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Mod Enabled?", getValue: () => Config.Enabled, setValue: value => Config.Enabled = value ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Allow Seed Shop on Wed?", getValue: () => Config.AllowSeedShopWed, setValue: value => Config.AllowSeedShopWed = value ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Allow Outside Hours?", getValue: () => Config.AllowOutsideTime, setValue: value => Config.AllowOutsideTime = value ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Allow Stranger Home Entry?", getValue: () => Config.AllowStrangerHomeEntry, setValue: value => Config.AllowStrangerHomeEntry = value ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Allow Stranger Room Entry?", getValue: () => Config.AllowStrangerRoomEntry, setValue: value => Config.AllowStrangerRoomEntry = value ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Allow Adventure Guild Entry?", getValue: () => Config.AllowAdventureGuildEntry, setValue: value => Config.AllowAdventureGuildEntry = value ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Ignore Events?", getValue: () => Config.IgnoreEvents, setValue: value => Config.IgnoreEvents = value ); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { // get Generic Mod Config Menu's API (if it's installed) var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (configMenu is null) { return; } // register mod configMenu.Register( mod: ModManifest, reset: () => Config = new ModConfig(), save: () => Helper.WriteConfig(Config) ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Mod Enabled?", getValue: () => Config.EnableMod, setValue: value => Config.EnableMod = value ); configMenu.AddKeybind( mod: ModManifest, name: () => "Toggle Mod Key", getValue: () => Config.ToggleModKey, setValue: value => Config.ToggleModKey = value ); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { var api = Helper.ModRegistry.GetApi <IDeluxeGrabberReduxApi>("ferdaber.DeluxeGrabberRedux"); api.GetBerryBushHarvest = GetBerryBushHarvest; api.GetBerryBushHarvest = GetBerryBushHarvestToo; }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { CustomChestTypeData data; int id = 424000; foreach (IContentPack contentPack in Helper.ContentPacks.GetOwned()) { try { int add = 0; Monitor.Log($"Reading content pack: {contentPack.Manifest.Name} {contentPack.Manifest.Version} from {contentPack.DirectoryPath}"); data = contentPack.ReadJsonFile <CustomChestTypeData>("content.json"); foreach (CustomChestType chestInfo in data.chestTypes) { try { chestInfo.id = id++; chestInfo.texture = contentPack.LoadAsset <Texture2D>(chestInfo.texturePath); customChestTypesDict.Add(chestInfo.id, chestInfo); add++; } catch (Exception ex) { SMonitor.Log($"Error parsing chest {chestInfo.name}: {ex}", LogLevel.Error); } } Monitor.Log($"Got {add} chest types from content pack {contentPack.Manifest.Name}", LogLevel.Debug); } catch (Exception ex) { SMonitor.Log($"Error processing content.json in content pack {contentPack.Manifest.Name} {ex}", LogLevel.Error); } } Monitor.Log($"Got {customChestTypesDict.Count} chest types total", LogLevel.Debug); }
private void OnLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { var configApi = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (configApi != null) { configApi.RegisterModConfig(ModManifest, () => Config = new ModConfig(), () => Helper.WriteConfig(Config)); configApi.RegisterLabel(ModManifest, "Crop Harvesting", "These options are only considered if 'Harvest Crops' is enabled"); configApi.RegisterSimpleOption(ModManifest, "Harvest Crops", "", () => Config.harvestCrops, v => Config.harvestCrops = v); configApi.RegisterSimpleOption(ModManifest, "Harvest Crops Inside Pots", "This is ignored if 'Harvest Crops' is disabled", () => Config.harvestCropsIndoorPots, v => Config.harvestCropsIndoorPots = v); configApi.RegisterSimpleOption(ModManifest, "Harvest Flowers", "This is ignored if 'Harvest crops' is disabled", () => Config.flowers, v => Config.flowers = v); configApi.RegisterSimpleOption(ModManifest, "Harvest Range", "This is ignored if 'Harvest Crops' is disabled. Set to -1 to use infinite range. This ONLY affects crop harvesting.", () => Config.harvestCropsRange, v => Config.harvestCropsRange = Math.Max(-1, v)); configApi.RegisterChoiceOption(ModManifest, "Harvest Range Mode", "'Walk': the distance is the walking distance (in four directions) from the grabber, becoming a diamond shape. 'Square': the distance is a square like a sprinkler. Covers more area than 'Walk'.", () => Config.harvestCropsRangeMode, v => Config.harvestCropsRangeMode = v, ModConfig.HarvestCropsRangeMode); configApi.RegisterLabel(ModManifest, "Other Harvesting", ""); configApi.RegisterSimpleOption(ModManifest, "Harvest Fruit Trees", "", () => Config.fruitTrees, v => Config.fruitTrees = v); configApi.RegisterSimpleOption(ModManifest, "Harvest Berry Bushes", "", () => Config.bushes, v => Config.bushes = v); configApi.RegisterSimpleOption(ModManifest, "Shake Seed Trees", "", () => Config.seedTrees, v => Config.seedTrees = v); configApi.RegisterSimpleOption(ModManifest, "Grab Slime Balls", "", () => Config.slimeHutch, v => Config.slimeHutch = v); configApi.RegisterSimpleOption(ModManifest, "Grab Farm Cave Mushrooms", "This will also work for mushroom boxes placed outside the farm cave", () => Config.farmCaveMushrooms, v => Config.farmCaveMushrooms = v); configApi.RegisterSimpleOption(ModManifest, "Dig Up Artifact Spots", "Note that lost books and secret notes will not be dug up", () => Config.artifactSpots, v => Config.artifactSpots = v); configApi.RegisterSimpleOption(ModManifest, "Collect Ore From Panning Sites", "", () => Config.orePan, v => Config.orePan = v); configApi.RegisterSimpleOption(ModManifest, "Fell Stumps in Secret Woods", "", () => Config.fellSecretWoodsStumps, v => Config.fellSecretWoodsStumps = v); configApi.RegisterSimpleOption(ModManifest, "Search Garbage Cans in Town", "", () => Config.garbageCans, v => Config.garbageCans = v); configApi.RegisterLabel(ModManifest, "Miscellaneous", ""); configApi.RegisterSimpleOption(ModManifest, "Report Yield", "Logs to the SMAPI console the yield of each auto grabber", () => Config.reportYield, v => Config.reportYield = v); configApi.RegisterSimpleOption(ModManifest, "Gain Experience", "Gain appropriate experience as if you foraged or harvested yourself", () => Config.gainExperience, v => Config.gainExperience = v); } }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { ConditionsChecker = Helper.ModRegistry.GetApi <IConditionsChecker>("Cherry.ExpandedPreconditionsUtility"); var verboseMode = false; ConditionsChecker.Initialize(verboseMode, ModManifest.UniqueID); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { ObjectIDHelper.init(); //FarmHouseStates.harmony.Patch( // original: Helper.Reflection.GetMethod(new FarmHouse(), "doSetVisibleFloor").MethodInfo, // prefix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_doSetVisibleFloor_Patch), nameof(FarmHouse_doSetVisibleFloor_Patch.Prefix))) //); //Farmer Patches //FarmHouseStates.harmony.Patch( // original: typeof(Farmer).GetConstructor(new Type[] // { // typeof(FarmerSprite), // typeof(Vector2), // typeof(int), // typeof(string), // typeof(List<Item>), // typeof(bool) // }), // postfix: new HarmonyMethod(AccessTools.Method(typeof(Farmer_Ctor_Patch), nameof(Farmer_Ctor_Patch.Postfix))) //); FarmState.init(); FarmHouseStates.init(); OtherLocations.DecoratableStates.init(); OtherLocations.FakeDecor.FakeDecorHandler.init(); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { treasureChestsExpandedApi = context.Helper.ModRegistry.GetApi <ITreasureChestsExpandedApi>("aedenthorn.TreasureChestsExpanded"); if (treasureChestsExpandedApi != null) { Monitor.Log($"loaded TreasureChestsExpanded API", LogLevel.Debug); } }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { //string soundbankPath=Path.Combine(Game1.content.RootDirectory, "XACT", "Sound Bank.xsb"); //Directory.CreateDirectory(Path.Combine(this.Helper.DirectoryPath, "ProcessedGameFiles")); //this.Monitor.Log(Utilities.HexDumper.HexDumpString(soundbankPath), LogLevel.Info); //Utilities.HexDumper.StripSoundCuesToFile(Path.Combine(this.Helper.DirectoryPath, "ProcessedGameFiles", "SoundCues.json"),Utilities.HexDumper.StripSoundCuesFromHex(Utilities.HexDumper.HexDumpString(soundbankPath))); //Utilities.HexDumper.HexDumpFile(soundbankPath, Path.Combine(this.Helper.DirectoryPath, "ProcessedGameFiles", "SoundCuesRaw.json")); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { CustomOreNodes.Clear(); CustomOreData data; try { data = Helper.Content.Load <CustomOreData>("custom_ore_nodes.json", ContentSource.ModFolder); foreach (string nodeInfo in data.nodes) { CustomOreNode node = new CustomOreNode(nodeInfo); if (node.spriteType == "mod") { node.texture = Helper.Content.Load <Texture2D>(node.spritePath, ContentSource.ModFolder); } else { node.texture = this.Helper.Content.Load <Texture2D>(node.spritePath, ContentSource.GameContent); } CustomOreNodes.Add(node); } Monitor.Log($"Got {CustomOreNodes.Count} ores from mod", LogLevel.Debug); } catch (Exception ex) { SMonitor.Log("custom_ore_nodes.json error." + ex, LogLevel.Debug); } foreach (IContentPack contentPack in this.Helper.ContentPacks.GetOwned()) { try { this.Monitor.Log($"Reading content pack: {contentPack.Manifest.Name} {contentPack.Manifest.Version} from {contentPack.DirectoryPath}"); data = contentPack.ReadJsonFile <CustomOreData>("custom_ore_nodes.json"); foreach (string nodeInfo in data.nodes) { CustomOreNode node = new CustomOreNode(nodeInfo); if (node.spriteType == "mod") { node.texture = contentPack.LoadAsset <Texture2D>(node.spritePath); } else { node.texture = Helper.Content.Load <Texture2D>(node.spritePath, ContentSource.GameContent); } CustomOreNodes.Add(node); } Monitor.Log($"Got {data.nodes.Count} ores from content pack {contentPack.Manifest.Name}", LogLevel.Debug); } catch { SMonitor.Log($"custom_ore_nodes.json file not found in content pack {contentPack.Manifest.Name}", LogLevel.Debug); } } Monitor.Log($"Got {CustomOreNodes.Count} ores total", LogLevel.Debug); Helper.Content.InvalidateCache("Maps/springobjects"); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { JsonAssets = Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets"); JsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, "data")); SpaceCore = Helper.ModRegistry.GetApi <ISpaceCoreAPI>("spacechase0.SpaceCore"); SpaceCore.AddEventCommand("GiveAquariumTrophy1", typeof(ModEntry).GetMethod(nameof(GiveAquariumTrophy1))); SpaceCore.AddEventCommand("GiveAquariumTrophy2", typeof(ModEntry).GetMethod(nameof(GiveAquariumTrophy2))); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { var api = Plato.ModHelper.ModRegistry.GetApi <PlatoTK.APIs.IContentPatcher>("Pathoschild.ContentPatcher"); api.RegisterToken(Plato.ModHelper.ModRegistry.Get(Plato.ModHelper.ModRegistry.ModID).Manifest, "Shops", new ShopToken()); api.RegisterToken(Plato.ModHelper.ModRegistry.Get(Plato.ModHelper.ModRegistry.ModID).Manifest, "ShopInventories", new ShopInventoryToken()); api.RegisterToken(Plato.ModHelper.ModRegistry.Get(Plato.ModHelper.ModRegistry.ModID).Manifest, "ShopPortraits", new ShopPortraitsToken()); api.RegisterToken(Plato.ModHelper.ModRegistry.Get(Plato.ModHelper.ModRegistry.ModID).Manifest, "LuaScripts", new LuaScriptsToken()); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { var harmony = new Harmony("Platonymous.MapTK.FestivalSpots"); Helper.GetPlatoHelper().Events.CalledEventCommand += Events_CalledEventCommand; var api = Helper.ModRegistry.GetApi <PlatoTK.APIs.IContentPatcher>("Pathoschild.ContentPatcher"); api.RegisterToken(Helper.ModRegistry.Get(Helper.ModRegistry.ModID).Manifest, "FestivalSpots", new FestivalSpotsToken()); }
private void OnGameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { ClimateAPI = SDVUtilities.GetModApi <Integrations.IClimatesOfFerngillAPI>(Monitor, Helper, "KoihimeNakamura.ClimatesOfFerngill", "1.5.0-beta.14"); if (ClimateAPI is null) { Monitor.Log("This mod has encountered a error with the API being missing", LogLevel.Alert); DoNothing = true; } }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { api = Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone"); if (api != null) { Texture2D appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "app_icon.png")); bool success = api.AddApp(Helper.ModRegistry.ModID, "Random Quote", ShowRandomQuote, appIcon); Monitor.Log($"loaded phone app successfully: {success}", LogLevel.Debug); } }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { advancedLootFrameworkApi = context.Helper.ModRegistry.GetApi <IAdvancedLootFrameworkApi>("aedenthorn.AdvancedLootFramework"); if (advancedLootFrameworkApi != null) { Monitor.Log($"loaded AdvancedLootFramework API", LogLevel.Debug); } treasuresList = advancedLootFrameworkApi.LoadPossibleTreasures(Config.ItemListChances.Where(p => p.Value > 0).ToDictionary(s => s.Key, s => s.Value).Keys.ToArray(), Config.MinItemValue, Config.MaxItemValue); Monitor.Log($"Got {treasuresList.Count} possible treasures"); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { // get Generic Mod Config Menu's API (if it's installed) var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (configMenu is null) { return; } // register mod configMenu.Register( mod: ModManifest, reset: () => Config = new ModConfig(), save: () => Helper.WriteConfig(Config) ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Mod Enabled?", getValue: () => Config.EnableMod, setValue: value => Config.EnableMod = value ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Water Adjacent", tooltip: () => "When charging, fill adjacent tiles instead of creating rectangle area", getValue: () => Config.FillAdjacent, setValue: value => Config.EnableMod = value ); configMenu.AddTextOption( mod : ModManifest, name : () => "Volume Mult", tooltip : () => "Multiply watering can volume by this amount", getValue : () => "" + Config.VolumeMult, setValue : delegate(string value) { try { Config.VolumeMult = float.Parse(value, CultureInfo.InvariantCulture); } catch { } } ); configMenu.AddTextOption( mod : ModManifest, name : () => "Water Mult", tooltip : () => "Multiply number of tiles to water by this amount.", getValue : () => "" + Config.WaterMult, setValue : delegate(string value) { try { Config.WaterMult = float.Parse(value, CultureInfo.InvariantCulture); } catch { } } ); configMenu.AddTextOption( mod : ModManifest, name : () => "Charged Stamina Mult", tooltip : () => "Multiply stamina used for charged watering by this amount (only if Water Adjacent is enabled)", getValue : () => "" + Config.ChargedStaminaMult, setValue : delegate(string value) { try { Config.ChargedStaminaMult = float.Parse(value, CultureInfo.InvariantCulture); } catch { } } ); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { // get Generic Mod Config Menu's API (if it's installed) var configMenu = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); if (configMenu is null) { return; } // register mod configMenu.Register( mod: ModManifest, reset: () => Config = new ModConfig(), save: () => Helper.WriteConfig(Config) ); configMenu.AddBoolOption( mod: ModManifest, name: () => "Mod Enabled?", getValue: () => Config.EnableMod, setValue: value => Config.EnableMod = value ); configMenu.AddNumberOption( mod: ModManifest, name: () => "Minutes To Hungry", tooltip: () => "Minutes since last meal", getValue: () => Config.MinutesToHungry, setValue: value => Config.MinutesToHungry = value ); configMenu.AddTextOption( mod : ModManifest, name : () => "Points Mult", tooltip : () => "Friendship point multiplier for spouses and roommates", getValue : () => "" + Config.PointsMult, setValue : delegate(string value) { try { Config.PointsMult = float.Parse(value, CultureInfo.InvariantCulture); } catch { } } ); configMenu.AddTextOption( mod : ModManifest, name : () => "Move To Food % Chance", tooltip : () => "Percent chance per tick to move to food if hungry", getValue : () => "" + Config.MoveToFoodChance, setValue : delegate(string value) { try { Config.MoveToFoodChance = float.Parse(value, CultureInfo.InvariantCulture); } catch { } } ); configMenu.AddTextOption( mod : ModManifest, name : () => "Max Distance to Eat", tooltip : () => "Max distance in tiles from food to eat it", getValue : () => "" + Config.MaxDistanceToEat, setValue : delegate(string value) { try { Config.MaxDistanceToEat = float.Parse(value, CultureInfo.InvariantCulture); } catch { } } ); fdfAPI = SHelper.ModRegistry.GetApi <IFurnitureDisplayFrameworkAPI>("aedenthorn.FurnitureDisplayFramework"); }
public static void HookToMobilePhoneMod(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { IMobilePhoneApi api = Data.Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone"); if (api != null) { Texture2D appIcon = Data.Helper.Content.Load <Texture2D>(System.IO.Path.Combine("assets", "mpmIcon.png")); bool success = api.AddApp(Data.Helper.ModRegistry.ModID, "Recurring Reminders", ModEntry.ShowReminderMenu, appIcon); Data.Monitor.Log($"Loaded phone app successfully: {success}", LogLevel.Debug); } }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { //Read data file, and create a default List <CustomBundleData> var = Helper.Data.ReadJsonFile <List <CustomBundleData> >(BundleDatafile); if (var is null || var.Count == 0) { var = DefaultBundleData.GetDefaults(); Helper.Data.WriteJsonFile(BundleDatafile, var); } }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { TSApi = _helper.ModRegistry.GetApi <ITrainStationAPI>("Cherry.TrainStation"); if (TSApi == null) { _monitor.Log("The train station API was not found. Warps back to the Railroad will default to a map warp.", LogLevel.Warn); return; } _helper.Events.GameLoop.UpdateTicked += GameLoop_UpdateTicked; }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { mJsonAssets = base.Helper.ModRegistry.GetApi <IJsonAssetsApi>("spacechase0.JsonAssets"); if (mJsonAssets == null) { Monitor.Log("Can't load Json Assets API for Moveable Mailbox", LogLevel.Warn); } else { mJsonAssets.LoadAssets(Path.Combine(Helper.DirectoryPath, "json-assets")); } }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { var api = Helper.ModRegistry.GetApi <GenericModConfigMenuAPI>("spacechase0.GenericModConfigMenu"); if (api == null) { return; } api.RegisterModConfig(ModManifest, () => _config = new Config(), () => Helper.WriteConfig(_config)); api.RegisterSimpleOption(ModManifest, "Instance Build", "Whether cabins are instantly upgraded", () => _config.InstantBuild, val => _config.InstantBuild = val); }