public static void FarmerTeam_NewDay_Postfix(FarmerTeam __instance, NetCollection <Item> __state) { __instance.grangeDisplay.Clear(); foreach (Item item in __state) { __instance.grangeDisplay.Add(item); } }
protected virtual string[] getWeeklyRecipe() { string[] text = new string[2]; int whichWeek = (int)(Game1.stats.DaysPlayed % 224u / 7u); if (Game1.stats.DaysPlayed % 224u == 0) { whichWeek = 32; } Dictionary <string, string> cookingRecipeChannel = Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\TV\\CookingChannel"); FarmerTeam team = Game1.player.team; if (Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth).Equals("Wed")) { if ((int)team.lastDayQueenOfSauceRerunUpdated != Game1.Date.TotalDays) { team.lastDayQueenOfSauceRerunUpdated.Set(Game1.Date.TotalDays); team.queenOfSauceRerunWeek.Set(getRerunWeek()); } whichWeek = team.queenOfSauceRerunWeek.Value; } try { string recipeName2 = cookingRecipeChannel[string.Concat(whichWeek)].Split('/')[0]; text[0] = cookingRecipeChannel[string.Concat(whichWeek)].Split('/')[1]; if (CraftingRecipe.cookingRecipes.ContainsKey(recipeName2)) { string[] split = CraftingRecipe.cookingRecipes[recipeName2].Split('/'); text[1] = ((LocalizedContentManager.CurrentLanguageCode != 0) ? (Game1.player.cookingRecipes.ContainsKey(cookingRecipeChannel[string.Concat(whichWeek)].Split('/')[0]) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13151", split[split.Length - 1]) : Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13153", split[split.Length - 1])) : (Game1.player.cookingRecipes.ContainsKey(cookingRecipeChannel[string.Concat(whichWeek)].Split('/')[0]) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13151", recipeName2) : Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13153", recipeName2))); } else { text[1] = ((LocalizedContentManager.CurrentLanguageCode != 0) ? (Game1.player.cookingRecipes.ContainsKey(cookingRecipeChannel[string.Concat(whichWeek)].Split('/')[0]) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13151", cookingRecipeChannel[string.Concat(whichWeek)].Split('/').Last()) : Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13153", cookingRecipeChannel[string.Concat(whichWeek)].Split('/').Last())) : (Game1.player.cookingRecipes.ContainsKey(cookingRecipeChannel[string.Concat(whichWeek)].Split('/')[0]) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13151", recipeName2) : Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13153", recipeName2))); } if (Game1.player.cookingRecipes.ContainsKey(recipeName2)) { return(text); } Game1.player.cookingRecipes.Add(recipeName2, 0); return(text); } catch (Exception) { string recipeName = cookingRecipeChannel["1"].Split('/')[0]; text[0] = cookingRecipeChannel["1"].Split('/')[1]; text[1] = ((LocalizedContentManager.CurrentLanguageCode != 0) ? (Game1.player.cookingRecipes.ContainsKey(cookingRecipeChannel["1"].Split('/')[0]) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13151", cookingRecipeChannel["1"].Split('/').Last()) : Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13153", cookingRecipeChannel["1"].Split('/').Last())) : (Game1.player.cookingRecipes.ContainsKey(cookingRecipeChannel["1"].Split('/')[0]) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13151", recipeName) : Game1.content.LoadString("Strings\\StringsFromCSFiles:TV.cs.13153", recipeName))); if (Game1.player.cookingRecipes.ContainsKey(recipeName)) { return(text); } Game1.player.cookingRecipes.Add(recipeName, 0); return(text); } }
/* * Recipes */ private static string GetQueenOfSauce() { int num = (int)(Game1.stats.DaysPlayed % 224U / 7U); if (Game1.stats.DaysPlayed % 224U == 0U) { num = 32; } FarmerTeam team = Game1.player.team; switch (Game1.dayOfMonth % 7) { case 0: // Sunday break; case 3: // Wednesday if (Game1.stats.DaysPlayed <= 3) { return(null); } else if (team.lastDayQueenOfSauceRerunUpdated.Value != Game1.Date.TotalDays) { team.lastDayQueenOfSauceRerunUpdated.Set(Game1.Date.TotalDays); team.queenOfSauceRerunWeek.Set(ModEvents.TELEVISION.GetRerunWeek()); } num = team.queenOfSauceRerunWeek.Value; break; default: return(null); } // Dictionary of recipes Dictionary <string, string> dictionary = Game1.temporaryContent.Load <Dictionary <string, string> >("Data\\TV\\CookingChannel"); if (!dictionary.TryGetValue($"{num}", out string translation)) { return(null); } // Split the translation info string[] recipeInfo = translation.Split('/'); if (recipeInfo.Length <= 0) { return(null); } // Get the recipe name string recipeName = recipeInfo[0]; return($"[{(ModEntry.PlayerHasRecipe(recipeName) ? "135" : "132")}]Learn to make \"{recipeName}\""); }
public static void FarmerTeam_NewDay_Prefix(FarmerTeam __instance, ref NetCollection <Item> __state) { __state = new NetCollection <Item>(__instance.grangeDisplay); ModEntry.context.Monitor.Log($"new day Grange display items: {__instance.grangeDisplay.Count} {__state.Count}"); __instance.grangeDisplay.Clear(); }
public FarmerTeamWrapper(FarmerTeam item) => GetBaseType = item;
public static void Postfix(FarmerTeam __instance) { __instance.NetFields.AddFields(__instance.get_hasLunarKey()); }