private void DayStart(object sender, DayStartedEventArgs d) { int Crops = Game1.getFarm().terrainFeatures.Values.Count((tf) => tf is StardewValley.TerrainFeatures.HoeDirt hd && hd.crop != null); if (config.showcrops.Equals(true)) { Game1.addHUDMessage(new HUDMessage($"Crops on Farm: {Crops}", 2)); if (Game1.dayOfMonth.Equals(28)) { } } if (config.sendrecipes.Equals(true)) { // string[] weeklyRecipe = Helper.Reflection.GetMethod(new TV(), "getWeeklyRecipe").Invoke<string[]>(); // string Recipe = weeklyRecipe[1].Replace(".", ""); // string.Join("", weeklyRecipe).Substring(0, string.Join("", weeklyRecipe).IndexOf("!") + 1).Replace("!", ""); // if (!Recipe.StartsWith("You already know how to cook ")) // this.Monitor.Log($"Recipe: {Recipe}", LogLevel.Debug); string Recipe = GetCurrentRecipeId(); this.Monitor.Log($"Recipe: {Recipe}", LogLevel.Debug); if (Recipe != "") { MailDao.SaveLetter( new Letter( $"{Recipe}", $"Weekly Recipe: {Recipe}^Instructions to cook included^^-Queen of the sauce leader", $"{Recipe}", (l) => !Game1.player.cookingRecipes.ContainsKey(l.Recipe) ) ); } } }
public DataLoader(IModHelper helper) { Helper = helper; I18N = helper.Translation; ModConfig = helper.ReadConfig <ModConfig>(); CrystalariumData = DataLoader.Helper.Data.ReadJsonFile <Dictionary <int, int> >("data\\CrystalariumData.json") ?? new Dictionary <int, int>() { { 74, 20160 } }; DataLoader.Helper.Data.WriteJsonFile("data\\CrystalariumData.json", CrystalariumData); if (!ModConfig.DisableLetter) { MailDao.SaveLetter ( new Letter ( "CustomCrystalarium" , I18N.Get("CustomCrystalarium.Letter") , (l) => !Game1.player.mailReceived.Contains(l.Id) , (l) => Game1.player.mailReceived.Add(l.Id) ) { Title = I18N.Get("CustomCrystalarium.Letter.Title") } ); } }
public DataLoader(IModHelper helper, IManifest manifest) { Helper = helper; I18N = helper.Translation; ModConfig = helper.ReadConfig <ModConfig>(); MailDao.SaveLetter ( new Letter ( "CropTransplantLetter" , I18N.Get("CropTransplant.Letter") , (l) => !Game1.player.mailReceived.Contains(l.Id) && !Game1.player.mailReceived.Contains("CropTransplantPotLetter") && Game1.player.craftingRecipes.ContainsKey("Garden Pot") && !ModConfig.GetGardenPotEarlier , (l) => Game1.player.mailReceived.Add(l.Id) ) ); MailDao.SaveLetter ( new Letter ( "CropTransplantPotLetter" , I18N.Get("CropTransplantPot.Letter") , new List <Item>() { new Object(Vector2.Zero, 62, false) } , (l) => !Game1.player.mailReceived.Contains(l.Id) && !Game1.player.mailReceived.Contains("CropTransplantLetter") && GetNpcFriendship("Evelyn") >= 2 * 250 && ModConfig.GetGardenPotEarlier , (l) => Game1.player.mailReceived.Add(l.Id) ) ); CreateConfigMenu(manifest); }
public static void SendMail(Farmer recipient, string orderID, string message, List <Item> packagedItems) { monitor.Log($"Sending out mail order {orderID}", LogLevel.Debug); Letter letter = new Letter(orderID, message, packagedItems, l => !recipient.mailReceived.Contains(l.Id), l => recipient.mailReceived.Add(l.Id)) { LetterTexture = JojaResources.GetJojaMailBackground(), TextColor = 7 }; MailDao.SaveLetter(letter); }
private static void LoadOneMail(string mailKey) { var deserializeKey = $"Mail/{mailKey}"; var Text = MarketDay.GetSharedString($"{deserializeKey}/Text"); var player = MarketDay.GetSharedString($"{deserializeKey}/Player"); var TextColor = MarketDay.GetSharedValue($"{deserializeKey}/TextColor"); var whichBG = MarketDay.GetSharedValue($"{deserializeKey}/BG"); var ObjName = MarketDay.GetSharedString($"{deserializeKey}/ObjName"); var Flavor = MarketDay.GetSharedString($"{deserializeKey}/Flavor"); var Stack = MarketDay.GetSharedValue($"{deserializeKey}/Stack"); var Quality = MarketDay.GetSharedValue($"{deserializeKey}/Quality"); if (player is not null && Game1.player.Name != player) { return; } if (ObjName is not null) { MarketDay.Log($"Loading prize mail {mailKey}", LogLevel.Trace); var attachment = AttachmentForPrizeMail(ObjName, Flavor, Stack, Quality); MailDao.SaveLetter( new Letter(mailKey, Text, new List <Item> { attachment }, l => !Game1.player.mailReceived.Contains(l.Id), l => Game1.player.mailReceived.Add(l.Id), whichBG ) { TextColor = TextColor } ); } else { MarketDay.Log($"Loading non-prize mail {mailKey}", LogLevel.Trace); MailDao.SaveLetter( new Letter(mailKey, Text, l => !Game1.player.mailReceived.Contains(l.Id), l => Game1.player.mailReceived.Add(l.Id), whichBG ) { TextColor = TextColor } ); } }
public DataLoader(IModHelper helper) { Helper = helper; I18N = helper.Translation; Letter letter = new Letter("WaterRetainingFieldLetter" , I18N.Get("WaterRetainingFieldResolution.Letter") , (l) => { return(!Game1.player.mailReceived.Contains(l.Id) && (Game1.player.farmingLevel.Value >= 4 || SDate.Now() >= new SDate(15, "spring", 1))); }, (l) => Game1.player.mailReceived.Add(l.Id) ); MailDao.SaveLetter(letter); }
public void LoadMails() { MailDao.SaveLetter(new Letter("meatloafRecipe", DataLoader.i18n.Get("Cooking.Meatloaf.Letter"), Cooking.Meatloaf.GetDescription(), (letter) => !Game1.player.cookingRecipes.ContainsKey(letter.Recipe) && GetNpcFriendship("Lewis") >= 9 * 250 && GetNpcFriendship("Marnie") >= 7 * 250, (l) => Game1.player.mailReceived.Add(l.Id)) { GroupId = "AHM.CookingRecipe", Title = DataLoader.i18n.Get("Cooking.Meatloaf.Letter.Title") }); MailDao.SaveLetter(new Letter("baconCheeseburgerRecipe", DataLoader.i18n.Get("Cooking.BaconCheeseburger.Letter"), Cooking.BaconCheeseburger.GetDescription(), (letter) => !Game1.player.cookingRecipes.ContainsKey(letter.Recipe) && GetNpcFriendship("Gus") >= 9 * 250 && SDate.Now() > new SDate(16, "fall", 1), (l) => Game1.player.mailReceived.Add(l.Id)) { GroupId = "AHM.CookingRecipe", Title = DataLoader.i18n.Get("Cooking.BaconCheeseburger.Letter.Title") }); MailDao.SaveLetter(new Letter("sweetAndSourPorkRecipe", DataLoader.i18n.Get("Cooking.SweetAndSourPork.Letter"), Cooking.SweetAndSourPork.GetDescription(), (letter) => !Game1.player.cookingRecipes.ContainsKey(letter.Recipe) && GetNpcFriendship("Jodi") >= 9 * 250 && GetNpcFriendship("Kent") >= 9 * 250, (l) => Game1.player.mailReceived.Add(l.Id)) { GroupId = "AHM.CookingRecipe", Title = DataLoader.i18n.Get("Cooking.SweetAndSourPork.Letter.Title") }); Func <Letter, bool> glazedHamCondition = (letter) => !Game1.player.cookingRecipes.ContainsKey(letter.Recipe) && GetNpcFriendship("Clint") >= 9 && Game1.stats.GeodesCracked > 80; MailDao.SaveLetter(new Letter("glazedHamRecipe", DataLoader.i18n.Get("Cooking.GlazedHam.Letter"), Cooking.GlazedHam.GetDescription(), glazedHamCondition, (l) => Game1.player.mailReceived.Add(l.Id)) { GroupId = "AHM.CookingRecipe", Title = DataLoader.i18n.Get("Cooking.GlazedHam.Letter.Title") }); MailDao.SaveLetter(new Letter("cowboyDinnerkRecipe", DataLoader.i18n.Get("Cooking.CowboyDinner.Letter"), Cooking.CowboyDinner.GetDescription(), (letter) => !Game1.player.cookingRecipes.ContainsKey(letter.Recipe) && (Game1.getLocationFromName("ArchaeologyHouse") as LibraryMuseum)?.museumPieces.Count() >= 70, (l) => Game1.player.mailReceived.Add(l.Id)) { GroupId = "AHM.CookingRecipe", Title = DataLoader.i18n.Get("Cooking.CowboyDinner.Letter.Title") }); MailDao.SaveLetter(new Letter("rabbitStewRecipe", DataLoader.i18n.Get("Cooking.RabbitStew.Letter"), Cooking.RabbitStew.GetDescription(), (letter) => !Game1.player.cookingRecipes.ContainsKey(letter.Recipe) && GetNpcFriendship("Linus") >= 9 * 250 && (Game1.stats.TimesUnconscious >= 1 || Game1.player.deepestMineLevel >= 100), (l) => Game1.player.mailReceived.Add(l.Id)) { GroupId = "AHM.CookingRecipe", Title = DataLoader.i18n.Get("Cooking.RabbitStew.Letter.Title") }); MailDao.SaveLetter(new Letter("monteCristoRecipe", DataLoader.i18n.Get("Cooking.MonteCristo.Letter"), Cooking.MonteCristo.GetDescription(), (letter) => !Game1.player.cookingRecipes.ContainsKey(letter.Recipe) && GetNpcFriendship("Leah") >= 8 * 250 && Game1.stats.ItemsForaged >= 1200, (l) => Game1.player.mailReceived.Add(l.Id)) { GroupId = "AHM.CookingRecipe", Title = DataLoader.i18n.Get("Cooking.MonteCristo.Letter.Title") }); MailDao.SaveLetter(new Letter("steakWithMushroomsRecipe", DataLoader.i18n.Get("Cooking.SteakWithMushrooms.Letter"), Cooking.SteakWithMushrooms.GetDescription(), (letter) => !Game1.player.cookingRecipes.ContainsKey(letter.Recipe) && GetNpcFriendship("Alex") >= 8 * 250 && Game1.stats.MonstersKilled >= 1000, (l) => Game1.player.mailReceived.Add(l.Id)) { GroupId = "AHM.CookingRecipe", Title = DataLoader.i18n.Get("Cooking.SteakWithMushrooms.Letter.Title") }); }
public DataLoader(IModHelper helper, IManifest manifest) { Helper = helper; I18N = helper.Translation; ModConfig = helper.ReadConfig <ModConfig>(); Dictionary <object, int> CrystalariumData = DataLoader.Helper.Data.ReadJsonFile <Dictionary <object, int> >(CrystalariumDataJson) ?? DefaultCystalariumData; DataLoader.Helper.Data.WriteJsonFile(CrystalariumDataJson, CrystalariumData); Dictionary <int, string> objects = DataLoader.Helper.Content.Load <Dictionary <int, string> >("Data\\ObjectInformation", ContentSource.GameContent); CrystalariumData.ToList().ForEach(d => { int?id = GetId(d.Key, objects); if (id.HasValue && !CrystalariumDataId.ContainsKey(id.Value)) { CrystalariumDataId[id.Value] = d.Value; } }); DataLoader.LoadContentPacksCommand(); if (!ModConfig.DisableLetter) { MailDao.SaveLetter ( new Letter ( "CustomCrystalarium" , I18N.Get("CustomCrystalarium.Letter") , (l) => !Game1.player.mailReceived.Contains(l.Id) , (l) => Game1.player.mailReceived.Add(l.Id) ) { Title = I18N.Get("CustomCrystalarium.Letter.Title") } ); } CreateConfigMenu(manifest); }
private void GameLoopOnOneSecondUpdateTicked(object sender, OneSecondUpdateTickedEventArgs e) { //var WhatIsthis = Game1.objectInformation[20]; //Monitor.Log(WhatIsthis, LogLevel.Info); //Every Second, Draw a random number and if it hits, the spouse has spent a bit of money. // var tempItem = getRandomItem(); //Monitor.Log(tempItem.DisplayName + tempItem.salePrice(), LogLevel.Info); if (!Context.IsWorldReady) { return; } if (!Game1.player.isMarried()) { return; } int hit = 250; //When the spouse makes a purchase if (rand.Next(0, 500) == hit) { int randomInteger = rand.Next(); var Spouse = GetSpouse(); var item = getRandomItem(); ShowNotification(Spouse.Name + " has spent " + item.salePrice() + " on " + item.DisplayName, 1); string letterId = "SpousePurchase" + item.DisplayName + randomInteger; MailDao.SaveLetter( new Letter( letterId, "Your Joja Prime Package has Arrived!", new List <Item> { item }, (l => Game1.player.mailReceived.Contains(l.Id)) )); } }
public DataLoader(IModHelper helper) { Helper = helper; I18N = helper.Translation; ModConfig = helper.ReadConfig <ModConfig>(); CaskData = DataLoader.Helper.Data.ReadJsonFile <Dictionary <object, float> >("data\\CaskData.json") ?? new Dictionary <object, float>() { { 342, 2.66f }, { 724, 2f } }; DataLoader.Helper.Data.WriteJsonFile("data\\CaskData.json", CaskData); DataLoader.LoadContentPacksCommand(); if (!ModConfig.DisableLetter) { MailDao.SaveLetter ( new Letter ( "CustomCaskRecipe" , I18N.Get("CustomCask.RecipeLetter") , "Cask" , (l) => !Game1.player.mailReceived.Contains(l.Id) && !Game1.player.mailReceived.Contains("CustomCask.Letter") && (Utility.getHomeOfFarmer(Game1.player).upgradeLevel >= 3 || ModConfig.EnableCasksAnywhere) && !Game1.player.craftingRecipes.ContainsKey("Cask") , (l) => Game1.player.mailReceived.Add(l.Id) ) ); MailDao.SaveLetter ( new Letter ( "CustomCask" , I18N.Get("CustomCask.Letter") , (l) => !Game1.player.mailReceived.Contains(l.Id) && !Game1.player.mailReceived.Contains("CustomCask.RecipeLetter") && (Utility.getHomeOfFarmer(Game1.player).upgradeLevel >= 3 || ModConfig.EnableCasksAnywhere) && Game1.player.craftingRecipes.ContainsKey("Cask") , (l) => Game1.player.mailReceived.Add(l.Id) ) ); } }
/// <summary> /// Adds all letters for getting recipes to MailFrameworkMod. /// </summary> /// <param name="machines"></param> public static void SetupMail() { string idPrefix = "JacquePott.MP."; string textFormat = "@:^^Congratulations on the progress of your farm. In the interest of helping you continue to bring prosperity to the valley, " + "we would like to give you these blueprints to help with production.^^- The Ferngill Industrial Co-Operative"; Dictionary <string, string> craftingData = ModEntry.Instance.Helper.Content.Load <Dictionary <string, string> >("Data\\CraftingRecipes", ContentSource.GameContent); foreach (MPMSettings setting in ModEntry.MPMSettings.Values) { if (!craftingData.ContainsKey(setting.UpgradeObject)) { ModEntry.Instance.Monitor.Log(string.Format("Could not find recipe for {0} when adding mail - skipping.", setting.UpgradeObject), LogLevel.Warn); continue; } string id = idPrefix + setting.UpgradeObject.Replace(" ", "").Replace("(", "").Replace(")", ""); Letter letter = new Letter(id, textFormat, setting.UpgradeObject, setting.CheckIfRecipeCanBeLearned); letter.GroupId = "MassProduction.Blueprints"; MailDao.SaveLetter(letter); } }
public void LoadMail() { string meatCleaverText = DataLoader.i18n.Get(DataLoader.ModConfig.Softmode ? "Tool.MeatCleaver.Letter.Soft" : "Tool.MeatCleaver.Letter"); string meatCleaverTitle = DataLoader.i18n.Get(DataLoader.ModConfig.Softmode ? "Tool.MeatCleaver.Letter.Soft.Title" : "Tool.MeatCleaver.Letter.Title"); bool HasAnimal() { return(Game1.locations.Any((location) => { if (location is Farm farm) { return farm.buildings .Any((b => (b.indoors.Value as AnimalHouse)?.animalsThatLiveHere.Count > 0)); } return false; })); } bool MeatCleaverCondition(Letter l) { return(!DataLoader.ModConfig.DisableMeatToolLetter && HasAnimal() && (!ItemUtility.HasModdedItem(MeatCleaverOverrides.MeatCleaverKey) || !Game1.player.mailReceived.Contains(l.Id))); } List <string> validBuildingsForInsemination = new List <string>(new string[] { "Deluxe Barn", "Big Barn", "Deluxe Coop" }); bool InseminationSyringeCondition(Letter l) { bool hasAnimalInValidBuildings = Game1.locations.Any((location) => { if (location is Farm farm) { return(farm.buildings .Any((b) => (b.indoors.Value as AnimalHouse)?.animalsThatLiveHere.Count > 0 && validBuildingsForInsemination.Contains(((AnimalHouse)b.indoors.Value)?.Name))); } return(false); }); return(hasAnimalInValidBuildings && (!ItemUtility.HasModdedItem(InseminationSyringeOverrides.InseminationSyringeKey) || !Game1.player.mailReceived.Contains(l.Id))); } bool FeedingBasketCondition(Letter l) { return(!Game1.player.mailReceived.Contains(l.Id) && Game1.player.getFriendshipHeartLevelForNPC("Marnie") >= 2 && (Game1.player.hasPet() || HasAnimal())); } bool FeedingBasketRedeliveryCondition(Letter l) { return(Game1.player.mailReceived.Contains("feedingBasket") && !ItemUtility.HasModdedItem(FeedingBasketOverrides.FeedingBasketKey) && Game1.player.getFriendshipHeartLevelForNPC("Marnie") >= 6); } if (!DataLoader.ModConfig.DisableMeat) { Letter meatCleaverLetter = new Letter("meatCleaver", meatCleaverText, new List <Item> { ToolsFactory.GetMeatCleaver() }, MeatCleaverCondition, (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } }) { GroupId = "AHM.InterdimentionalFriend", Title = meatCleaverTitle }; meatCleaverLetter.LetterTexture = _customLetterBG; meatCleaverLetter.TextColor = 4; MailDao.SaveLetter(meatCleaverLetter); } if (!DataLoader.ModConfig.DisablePregnancy) { Letter inseminationSyringeLetter = new Letter("inseminationSyringe", DataLoader.i18n.Get("Tool.InseminationSyringe.Letter"), new List <Item> { ToolsFactory.GetInseminationSyringe() }, InseminationSyringeCondition, (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } }) { GroupId = "AHM.InterdimentionalFriend", Title = DataLoader.i18n.Get("Tool.InseminationSyringe.Letter.Title") }; inseminationSyringeLetter.LetterTexture = _customLetterBG; inseminationSyringeLetter.TextColor = 4; MailDao.SaveLetter(inseminationSyringeLetter); } if (!DataLoader.ModConfig.DisableAnimalContest) { MailDao.SaveLetter ( new Letter ( "participantRibbon" , DataLoader.i18n.Get("Tool.ParticipantRibbon.Letter") , new List <Item> { ToolsFactory.GetParticipantRibbon() } , (l) => SDate.Now().AddDays(1).Equals(AnimalContestController.GetNextContestDate()) && AnimalContestController.GetContestCount() == 0 && !Game1.player.mailReceived.Contains(l.Id + AnimalContestController.GetNextContestDateKey()) , (l) => { Game1.player.mailReceived.Add(l.Id + AnimalContestController.GetNextContestDateKey()); if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } }) { Title = DataLoader.i18n.Get("Tool.ParticipantRibbon.Letter.Title") } ); MailDao.SaveLetter ( new Letter ( "participantRibbonRedelivery" , DataLoader.i18n.Get("Tool.ParticipantRibbon.LetterRedelivery") , new List <Item> { ToolsFactory.GetParticipantRibbon() } , (l) => SDate.Now().AddDays(1).Equals(AnimalContestController.GetNextContestDate()) && AnimalContestController.GetContestCount() > 0 && !Game1.player.mailReceived.Contains(l.Id + AnimalContestController.GetNextContestDateKey()) , (l) => { Game1.player.mailReceived.Add(l.Id + AnimalContestController.GetNextContestDateKey()); if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } }) { Title = DataLoader.i18n.Get("Tool.ParticipantRibbon.LetterRedelivery.Title") } ); } if (!DataLoader.ModConfig.DisableTreats) { MailDao.SaveLetter ( new Letter ( "feedingBasket", DataLoader.i18n.Get("Tool.FeedingBasket.Letter"), new List <Item> { ToolsFactory.GetFeedingBasket() }, FeedingBasketCondition, (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } } ) { Title = DataLoader.i18n.Get("Tool.FeedingBasket.Letter.Title") } ); MailDao.SaveLetter ( new Letter ( "feedingBasketRedelivery", DataLoader.i18n.Get("Tool.FeedingBasket.LetterRedelivery"), new List <Item> { ToolsFactory.GetFeedingBasket() }, FeedingBasketRedeliveryCondition, (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } } ) { Title = DataLoader.i18n.Get("Tool.FeedingBasket.LetterRedelivery.Title") } ); } }
public DataLoader(IModHelper helper) { Helper = helper; I18N = helper.Translation; ModConfig = helper.ReadConfig <ModConfig>(); CraftingData = DataLoader.Helper.Data.ReadJsonFile <CraftingData>("data\\CraftingRecipes.json") ?? new CraftingData(); DataLoader.Helper.Data.WriteJsonFile("data\\CraftingRecipes.json", CraftingData); var editors = Helper.Content.AssetEditors; editors.Add(this); if (!ModConfig.DisableIridiumQualityFish) { MailDao.SaveLetter ( new Letter ( "IridiumQualityFishWithWildBait" , I18N.Get("IridiumQualityFishWithWildBait.Letter") , (l) => !Game1.player.mailReceived.Contains(l.Id) && Game1.player.craftingRecipes.ContainsKey("Wild Bait") && Game1.player.FishingLevel >= 4 , (l) => Game1.player.mailReceived.Add(l.Id) ) ); } AddLetter(BaitTackle.EverlastingBait, (l) => Game1.player.FishingLevel >= 10 && GetNpcFriendship("Willy") >= 10 * 250 && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.EverlastingBait.GetDescription())); AddLetter(BaitTackle.EverlastingWildBait, (l) => Game1.player.craftingRecipes.ContainsKey("Wild Bait") && Game1.player.craftingRecipes.ContainsKey(BaitTackle.EverlastingBait.GetDescription()) && Game1.player.craftingRecipes[BaitTackle.EverlastingBait.GetDescription()] > 0 && GetNpcFriendship("Linus") >= 10 * 250 && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.EverlastingWildBait.GetDescription())); AddLetter(BaitTackle.EverlastingMagnet, (l) => Game1.player.FishingLevel >= 10 && GetNpcFriendship("Wizard") >= 10 * 250 && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.EverlastingMagnet.GetDescription()), null, 2); MailDao.SaveLetter ( new Letter ( "UnbreakableTackleIntroduction" , I18N.Get("UnbreakableTackleIntroduction.Letter") , (l) => !Game1.player.mailReceived.Contains(l.Id) && Game1.player.achievements.Contains(21) && Game1.player.FishingLevel >= 8 && GetNpcFriendship("Willy") >= 6 * 250 && GetNpcFriendship("Clint") >= 6 * 250 , (l) => Game1.player.mailReceived.Add(l.Id) ) ); AddLetter ( BaitTackle.UnbreakableSpinner , (l) => Game1.player.achievements.Contains(21) && Game1.player.FishingLevel >= 8 && GetNpcFriendship("Willy") >= 6 * 250 && GetNpcFriendship("Clint") >= 6 * 250 && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.UnbreakableSpinner.GetDescription()) , (l) => LoadTackleQuest(BaitTackle.UnbreakableSpinner) ); AddLetter ( BaitTackle.UnbreakableLeadBobber , (l) => Game1.player.mailReceived.Contains(BaitTackle.UnbreakableSpinner.GetQuestName()) && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.UnbreakableLeadBobber.GetDescription()) , (l) => LoadTackleQuest(BaitTackle.UnbreakableLeadBobber) ); AddLetter ( BaitTackle.UnbreakableTrapBobber , (l) => Game1.player.mailReceived.Contains(BaitTackle.UnbreakableLeadBobber.GetQuestName()) && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.UnbreakableTrapBobber.GetDescription()) , (l) => LoadTackleQuest(BaitTackle.UnbreakableTrapBobber) ); AddLetter ( BaitTackle.UnbreakableCorkBobber , (l) => Game1.player.mailReceived.Contains(BaitTackle.UnbreakableTrapBobber.GetQuestName()) && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.UnbreakableCorkBobber.GetDescription()) , (l) => LoadTackleQuest(BaitTackle.UnbreakableCorkBobber) ); AddLetter ( BaitTackle.UnbreakableTreasureHunter , (l) => Game1.player.mailReceived.Contains(BaitTackle.UnbreakableCorkBobber.GetQuestName()) && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.UnbreakableTreasureHunter.GetDescription()) , (l) => LoadTackleQuest(BaitTackle.UnbreakableTreasureHunter) ); AddLetter ( BaitTackle.UnbreakableBarbedHook , (l) => Game1.player.mailReceived.Contains(BaitTackle.UnbreakableTreasureHunter.GetQuestName()) && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.UnbreakableBarbedHook.GetDescription()) , (l) => LoadTackleQuest(BaitTackle.UnbreakableBarbedHook) ); AddLetter ( BaitTackle.UnbreakableDressedSpinner , (l) => Game1.player.mailReceived.Contains(BaitTackle.UnbreakableBarbedHook.GetQuestName()) && !Game1.player.craftingRecipes.ContainsKey(BaitTackle.UnbreakableDressedSpinner.GetDescription()) , (l) => LoadTackleQuest(BaitTackle.UnbreakableDressedSpinner) ); MailDao.SaveLetter ( new Letter ( "UnbreakableTackleReward" , I18N.Get("UnbreakableTackleReward.Letter") , new List <Item> { new StardewValley.Object(74, 1) } , (l) => Game1.player.mailReceived.Contains(BaitTackle.UnbreakableDressedSpinner.GetQuestName()) && !Game1.player.mailReceived.Contains(l.Id) , (l) => { Game1.player.mailReceived.Add(l.Id); } ) ); }
public DataLoader(IModHelper modHelper) { Helper = modHelper; I18N = modHelper.Translation; ModConfig = Helper.ReadConfig <ModConfig>(); MailDao.SaveLetter( new Letter( "MailServiceMod.DeliveryQuestsInfo" , I18N.Get("Shipment.Quest.DeliveryQuestsLetter") , (l) => !DataLoader.ModConfig.DisableQuestService && !Game1.player.mailReceived.Contains(l.Id) && SDate.Now() >= new SDate(2, "spring", 1) , (l) => Game1.player.mailReceived.Add(l.Id) ) { Title = I18N.Get("Shipment.Quest.DeliveryQuestsLetter.Title") } ); MailDao.SaveLetter( new Letter( "MailServiceMod.ToolUpgradeInfo" , I18N.Get("Shipment.Clint.UpgradeLetter") , (l) => !DataLoader.ModConfig.DisableToolShipmentService && !Game1.player.mailReceived.Contains(l.Id) && SDate.Now() >= new SDate(6, "spring", 1) , (l) => Game1.player.mailReceived.Add(l.Id) ) { Title = I18N.Get("Shipment.Clint.UpgradeLetter.Title") } ); MailDao.SaveLetter( new Letter( "MailServiceMod.GiftShipmentInfo" , I18N.Get("Shipment.Wizard.GiftShipmentLetter") , (l) => !DataLoader.ModConfig.DisableGiftService && !Game1.player.mailReceived.Contains(l.Id) && Game1.player.eventsSeen.Contains(112) , (l) => Game1.player.mailReceived.Add(l.Id) ) { Title = I18N.Get("Shipment.Wizard.GiftShipmentLetter.Title"), WhichBG = 2 } ); MailDao.SaveLetter( new Letter( "MailServiceMod.MarlonRecoveryReward" , I18N.Get("Delivery.Marlon.RecoveryRewardLetter") , (l) => !Game1.player.mailReceived.Contains(l.Id) && Game1.player.hasCompletedAllMonsterSlayerQuests.Value && !GetRecoveryConfig(Game1.player).DisableRecoveryConfigInGameChanges , (l) => { Game1.player.mailReceived.Add(l.Id); SaveRecoveryConfig(Game1.player, true, true, true); } ) { Title = I18N.Get("Delivery.Marlon.RecoveryRewardLetter.Title"), GroupId = "MailServicesMod.GuildRecovery" } ); MailDao.SaveLetter( new Letter( "MailServicesMod.MarlonRecoveryOffer" , I18N.Get("Delivery.Marlon.RecoveryOfferLetter") , (l) => !Game1.player.mailReceived.Contains(l.Id) && !Game1.player.mailReceived.Contains("MailServiceMod.MarlonRecoveryReward") && Game1.player.mailReceived.Contains("guildMember") && !DataLoader.GetRecoveryConfig(Game1.player).EnableRecoveryService&& !GetRecoveryConfig(Game1.player).DisableRecoveryConfigInGameChanges , (l) => { Game1.player.mailReceived.Add(l.Id); GuildRecoveryController.OpenOfferDialog(); } ) { Title = I18N.Get("Delivery.Marlon.RecoveryOfferLetter.Title"), GroupId = "MailServicesMod.GuildRecovery" } ); Letter upgradeLetter = new Letter( ToolUpgradeMailId , I18N.Get("Delivery.Clint.UpgradeLetter") , (l) => !DataLoader.ModConfig.DisableToolDeliveryService && Game1.player.toolBeingUpgraded.Value != null && Game1.player.daysLeftForToolUpgrade.Value <= 0 , (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } if (Game1.player.toolBeingUpgraded.Value != null) { Tool tool = Game1.player.toolBeingUpgraded.Value; Game1.player.toolBeingUpgraded.Value = null; Game1.player.hasReceivedToolUpgradeMessageYet = false; Game1.player.holdUpItemThenMessage(tool); if (tool is GenericTool) { tool.actionWhenClaimed(); } if (Game1.player.team.useSeparateWallets.Value && tool.UpgradeLevel == 4) { Multiplayer multiplayer = Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue(); multiplayer.globalChatInfoMessage("IridiumToolUpgrade", Game1.player.Name, tool.DisplayName); } } } ) { Title = I18N.Get("Delivery.Clint.UpgradeLetter.Title"), DynamicItems = (l) => Game1.player.toolBeingUpgraded.Value != null ? new List <Item> { Game1.player.toolBeingUpgraded.Value } : new List <Item>() }; MailDao.SaveLetter(upgradeLetter); Letter recoveryLetter = new Letter( ItemRecoveryMailId , I18N.Get("Delivery.Marlon.RecoveryLetter") , (l) => GetRecoveryConfig(Game1.player).EnableRecoveryService&& GuildRecoveryController.GetItemsToRecover()?.Count > 0 , (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } GuildRecoveryController.ItemsRecovered(); } ) { Title = I18N.Get("Delivery.Marlon.RecoveryLetter.Title"), DynamicItems = (l) => GuildRecoveryController.GetItemsToRecover() }; MailDao.SaveLetter(recoveryLetter); }
public void LoadMail() { string meatCleaverText; if (DataLoader.ModConfig.Softmode) { meatCleaverText = DataLoader.i18n.Get("Tool.MeatCleaver.Letter.Soft"); } else { meatCleaverText = DataLoader.i18n.Get("Tool.MeatCleaver.Letter"); } bool HasAnimal() { return(Game1.locations.Any((location) => { if (location is Farm farm) { return farm.buildings .Any((b => (b.indoors.Value as AnimalHouse)?.animalsThatLiveHere.Count > 0)); } return false; })); } bool MeatCleaverCondition(Letter l) { return(HasAnimal() && !HasTool(typeof(MeatCleaver))); } List <string> validBuildingsForInsemination = new List <string>(new string[] { "Deluxe Barn", "Big Barn", "Deluxe Coop" }); bool InseminationSyringeCondition(Letter l) { bool hasAnimalInValidBuildings = Game1.locations.Any((location) => { if (location is Farm farm) { return(farm.buildings .Any((b) => (b.indoors.Value as AnimalHouse)?.animalsThatLiveHere.Count > 0 && validBuildingsForInsemination.Contains(((AnimalHouse)b.indoors.Value)?.Name))); } return(false); }); return(Context.IsMainPlayer && hasAnimalInValidBuildings && !HasTool(typeof(InseminationSyringe))); } bool FeedingBasketCondition(Letter l) { return(Context.IsMainPlayer && !Game1.player.mailReceived.Contains("feedingBasket") && Game1.player.getFriendshipHeartLevelForNPC("Marnie") >= 2 && (Game1.player.hasPet() || HasAnimal())); } bool FeedingBasketRedeliveryCondition(Letter l) { return(Context.IsMainPlayer && Game1.player.mailReceived.Contains("feedingBasket") && !HasTool(typeof(FeedingBasket)) && Game1.player.getFriendshipHeartLevelForNPC("Marnie") >= 6); } if (!DataLoader.ModConfig.DisableMeat) { Letter meatCleaverLetter = new Letter("meatCleaver", meatCleaverText, new List <Item> { new MeatCleaver() }, MeatCleaverCondition); meatCleaverLetter.LetterTexture = _customLetterBG; meatCleaverLetter.TextColor = 4; MailDao.SaveLetter(meatCleaverLetter); } if (!DataLoader.ModConfig.DisablePregnancy) { Letter inseminationSyringeLetter = new Letter("inseminationSyringe", DataLoader.i18n.Get("Tool.InseminationSyringe.Letter"), new List <Item> { new InseminationSyringe() }, InseminationSyringeCondition); inseminationSyringeLetter.LetterTexture = _customLetterBG; inseminationSyringeLetter.TextColor = 4; MailDao.SaveLetter(inseminationSyringeLetter); } //MailDao.SaveLetter(new Letter("participantRibbon", DataLoader.i18n.Get("Tool.ParticipantRibbon.Letter"), new List<Item> { new ParticipantRibbon() }, (l)=> true)); if (!DataLoader.ModConfig.DisableTreats) { MailDao.SaveLetter ( new Letter ( "feedingBasket", DataLoader.i18n.Get("Tool.FeedingBasket.Letter"), new List <Item> { new FeedingBasket() }, FeedingBasketCondition, (l) => Game1.player.mailReceived.Add(l.Id) ) ); MailDao.SaveLetter ( new Letter ( "feedingBasketRedelivery", DataLoader.i18n.Get("Tool.FeedingBasket.LetterRedelivery"), new List <Item> { new FeedingBasket() }, FeedingBasketRedeliveryCondition ) ); } }
public DataLoader(IModHelper modHelper) { Helper = modHelper; I18N = modHelper.Translation; ModConfig = Helper.ReadConfig <ModConfig>(); MailDao.SaveLetter( new Letter( "MailServiceMod.DeliveryQuestsInfo" , I18N.Get("Shipment.Quest.DeliveryQuestsLetter") , (l) => !Game1.player.mailReceived.Contains(l.Id) && SDate.Now() >= new SDate(2, "spring", 1) , (l) => Game1.player.mailReceived.Add(l.Id) ) { Title = I18N.Get("Shipment.Quest.DeliveryQuestsLetter.Title") } ); MailDao.SaveLetter( new Letter( "MailServiceMod.ToolUpgradeInfo" , I18N.Get("Shipment.Clint.UpgradeLetter") , (l) => !Game1.player.mailReceived.Contains(l.Id) && SDate.Now() >= new SDate(6, "spring", 1) , (l) => Game1.player.mailReceived.Add(l.Id) ) { Title = I18N.Get("Shipment.Clint.UpgradeLetter.Title") } ); Letter upgradeLetter = new Letter( ToolUpgradeMailId , I18N.Get("Delivery.Clint.UpgradeLetter") , (l) => Game1.player.toolBeingUpgraded.Value != null && Game1.player.daysLeftForToolUpgrade.Value <= 0 , (l) => { if (!Game1.player.mailReceived.Contains(l.Id)) { Game1.player.mailReceived.Add(l.Id); } if (Game1.player.toolBeingUpgraded.Value != null) { Tool tool = Game1.player.toolBeingUpgraded.Value; Game1.player.toolBeingUpgraded.Value = null; Game1.player.hasReceivedToolUpgradeMessageYet = false; Game1.player.holdUpItemThenMessage(tool); if (tool is GenericTool) { tool.actionWhenClaimed(); } if (Game1.player.team.useSeparateWallets.Value && tool.UpgradeLevel == 4) { Multiplayer multiplayer = Helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue(); multiplayer.globalChatInfoMessage("IridiumToolUpgrade", Game1.player.Name, tool.DisplayName); } } } ) { Title = I18N.Get("Delivery.Clint.UpgradeLetter.Title") }; upgradeLetter.DynamicItems = (l) => Game1.player.toolBeingUpgraded.Value != null ? new List <Item> { Game1.player.toolBeingUpgraded.Value } : new List <Item>(); MailDao.SaveLetter(upgradeLetter); }
private void AddLetter(BaitTackle baitTackle, Func <Letter, bool> condition, Action <Letter> callback = null, int whichBG = 0) { MailDao.SaveLetter(new Letter(baitTackle.ToString() + "Recipe", I18N.Get(baitTackle.ToString() + ".Letter"), baitTackle.GetDescription(), condition, callback, whichBG)); }