private void OnGameLaunched(object sender, GameLaunchedEventArgs e) { var configMenu = this.Helper.ModRegistry.GetGenericModConfigMenuApi(this.Monitor); if (configMenu != null) { configMenu.Register( mod: this.ModManifest, reset: () => this.Config = new Configuration(), save: () => this.Helper.WriteConfig(this.Config), titleScreenOnly: true ); configMenu.AddBoolOption( mod: this.ModManifest, name: I18n.Config_FlashingUfo_Name, tooltip: I18n.Config_FlashingUfo_Description, getValue: () => this.Config.FlashingUfo, setValue: value => this.Config.FlashingUfo = value ); } var sc = Helper.ModRegistry.GetApi <ISpaceCoreApi>("spacechase0.SpaceCore"); sc.RegisterSerializerType(typeof(MountainTop)); sc.RegisterSerializerType(typeof(LunarLocation)); sc.RegisterSerializerType(typeof(MoonLandingArea)); sc.RegisterSerializerType(typeof(AsteroidsEntrance)); sc.RegisterSerializerType(typeof(AsteroidsDungeon)); sc.RegisterSerializerType(typeof(BoomEye)); sc.RegisterSerializerType(typeof(BoomProjectile)); sc.RegisterSerializerType(typeof(AsteroidProjectile)); sc.RegisterSerializerType(typeof(LunarFarm)); sc.RegisterSerializerType(typeof(LunarFarmCave)); sc.RegisterSerializerType(typeof(LunarAnimal)); sc.RegisterSerializerType(typeof(AnimalGauntlets)); sc.RegisterSerializerType(typeof(Necklace)); sc.RegisterSerializerType(typeof(MoonPlanetOverlook)); sc.RegisterSerializerType(typeof(UfoInterior)); sc.RegisterSerializerType(typeof(LunarFarmHouse)); sc.RegisterSerializerType(typeof(MoonInfuserRoom)); sc.RegisterSerializerType(typeof(LunarSlime)); sc.RegisterCustomLocationContext("Moon", getLocationWeatherForTomorrowFunc: (r) => { LocationWeather lw = new(); lw.weatherForTomorrow.Value = 0; lw.isRaining.Value = false; return(lw); } /*, * passoutWakeupLocationFunc: ( who ) => "Custom_MM_MoonLandingArea", * passoutWakeupPointFunc: ( who ) => new Point( 9, 30 ) // TODO: Inside farm house if unlocked */ ); sc.RegisterCustomProperty(typeof(FarmerTeam), "hasLunarKey", typeof(NetBool), AccessTools.Method(typeof(FarmerTeam_LunarKey), nameof(FarmerTeam_LunarKey.get_hasLunarKey)), AccessTools.Method(typeof(FarmerTeam_LunarKey), nameof(FarmerTeam_LunarKey.set_hasLunarKey))); sc.RegisterCustomProperty(typeof(Farmer), "necklaceItem", typeof(NetRef <Item>), AccessTools.Method(typeof(Farmer_Necklace), nameof(Farmer_Necklace.get_necklaceItem)), AccessTools.Method(typeof(Farmer_Necklace), nameof(Farmer_Necklace.set_necklaceItem))); dga = Helper.ModRegistry.GetApi <IDynamicGameAssetsApi>("spacechase0.DynamicGameAssets"); dga.AddEmbeddedPack(this.ModManifest, Path.Combine(Helper.DirectoryPath, "assets", "dga")); dgaPack = DynamicGameAssets.Mod.GetPacks().First(cp => cp.GetManifest().UniqueID == ModManifest.UniqueID); }
private void OnGameLaunched(object sender, GameLaunchedEventArgs e) { var sc = Helper.ModRegistry.GetApi <ISpaceCoreApi>("spacechase0.SpaceCore"); sc.RegisterSerializerType(typeof(NullObject)); sc.RegisterSerializerType(typeof(Drill)); sc.RegisterSerializerType(typeof(ConveyorBelt)); sc.RegisterSerializerType(typeof(Unhopper)); sc.RegisterSerializerType(typeof(WireCutter)); sc.RegisterSerializerType(typeof(ConnectorBase)); sc.RegisterSerializerType(typeof(LogicConnector)); sc.RegisterSerializerType(typeof(LeverBlock)); sc.RegisterCustomProperty(typeof(GameLocation), "BelowGroundObjects", typeof(NetVector2Dictionary <StardewValley.Object, NetRef <StardewValley.Object> >), AccessTools.Method(typeof(GameLocation_BelowGroundObjects), nameof(GameLocation_BelowGroundObjects.get_BelowGroundObjects)), AccessTools.Method(typeof(GameLocation_BelowGroundObjects), nameof(GameLocation_BelowGroundObjects.set_BelowGroundObjects))); sc.RegisterCustomProperty(typeof(GameLocation), "ElevatedObjects", typeof(NetVector2Dictionary <StardewValley.Object, NetRef <StardewValley.Object> >), AccessTools.Method(typeof(GameLocation_ElevatedObjects), nameof(GameLocation_ElevatedObjects.get_ElevatedObjects)), AccessTools.Method(typeof(GameLocation_ElevatedObjects), nameof(GameLocation_ElevatedObjects.set_ElevatedObjects))); dga = Helper.ModRegistry.GetApi <IDynamicGameAssetsApi>("spacechase0.DynamicGameAssets"); dga.AddEmbeddedPack(this.ModManifest, Path.Combine(Helper.DirectoryPath, "assets", "dga")); dgaPack = DynamicGameAssets.Mod.GetPacks().First(cp => cp.GetManifest().UniqueID == ModManifest.UniqueID); var gmcm = Helper.ModRegistry.GetApi <IGenericModConfigMenuApi>("spacechase0.GenericModConfigMenu"); gmcm.Register(ModManifest, () => Config = new Configuration(), () => Helper.WriteConfig(Config)); gmcm.AddKeybindList(ModManifest, () => Config.PlacementModifier, (kl) => Config.PlacementModifier = kl, () => Helper.Translation.Get("config.placement-modifier.name"), () => Helper.Translation.Get("config.placement-modifier.tooltip")); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { apiDGA = Helper.ModRegistry.GetApi <IDynamicGameAssetsApi>("spacechase0.DynamicGameAssets"); IManifest manifest = new MyManifest("aedenthorn.CoinCollectorDGA", "CoinCollectorDGA", "aedenthorn", "CoinCollectorDGA", new SemanticVersion("0.1.0")) { ContentPackFor = new MyManifestContentPackFor { UniqueID = "spacechase0.DynamicGameAssets" }, ExtraFields = new Dictionary <string, object>() { { "DGA.FormatVersion", 2 }, { "DGA.ConditionsFormatVersion", "1.23.0" } } }; apiDGA.AddEmbeddedPack(manifest, $"{Helper.DirectoryPath}/dga"); if (config.BlipAudioPath.Length > 0) { try { blipEffectCenter = SoundEffect.FromStream(new FileStream($"{Helper.DirectoryPath}/{config.BlipAudioPath}", FileMode.Open)); blipEffectLeft = SoundEffect.FromStream(new FileStream($"{Helper.DirectoryPath}/{config.BlipAudioPathLeft}", FileMode.Open)); blipEffectRight = SoundEffect.FromStream(new FileStream($"{Helper.DirectoryPath}/{config.BlipAudioPathRight}", FileMode.Open)); } catch { } } totalRarities = 0; foreach (IContentPack contentPack in Helper.ContentPacks.GetOwned()) { CoinDataDict dict = contentPack.ReadJsonFile <CoinDataDict>("content.json") ?? new CoinDataDict(); foreach (CoinData data in dict.data) { try { coinDataDict.Add(data.id, data); totalRarities += data.rarity; } catch (Exception ex) { Monitor.Log($"Exception getting data for {data.id} in content pack {contentPack.Manifest.Name}:\n{ex}", LogLevel.Error); } } } Monitor.Log($"Loaded coin data for {coinDataDict.Count} coins."); }
private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e) { apiDGA = Helper.ModRegistry.GetApi <IDynamicGameAssetsApi>("spacechase0.DynamicGameAssets"); IManifest manifest = new MyManifest("aedenthorn.TentDGA", "TentDGA", "aedenthorn", "TentDGA", new SemanticVersion("0.1.0")) { ContentPackFor = new MyManifestContentPackFor { UniqueID = "spacechase0.DynamicGameAssets" }, ExtraFields = new Dictionary <string, object>() { { "DGA.FormatVersion", 2 }, { "DGA.ConditionsFormatVersion", "1.23.0" } } }; apiDGA.AddEmbeddedPack(manifest, $"{Helper.DirectoryPath}/dga"); // 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: () => "Save On Tent?", getValue: () => Config.SaveOnTent, setValue: value => Config.SaveOnTent = value ); }