/// <summary> /// Randomize fruit tree information /// </summary> /// <param name="editedObjectInfo">The edited object information</param> private static void RandomizeFruitTrees(EditedObjectInformation editedObjectInfo) { int[] fruitTreesIds = new int[] { (int)ObjectIndexes.CherrySapling, (int)ObjectIndexes.ApricotSapling, (int)ObjectIndexes.OrangeSapling, (int)ObjectIndexes.PeachSapling, (int)ObjectIndexes.PomegranateSapling, (int)ObjectIndexes.AppleSapling }; List <Item> allPotentialTreesItems = ItemList.Items.Values.Where(x => fruitTreesIds.Contains(x.Id) || x.DifficultyToObtain < ObtainingDifficulties.Impossible ).ToList(); List <Item> treeItems = Globals.RNGGetRandomValuesFromList(allPotentialTreesItems, 6); string[] seasons = { "spring", "spring", "summer", "summer", "fall", "fall" }; seasons[Globals.RNG.Next(0, 6)] = "winter"; int[] prices = treeItems.Select(x => x.GetPriceForObtainingDifficulty(0.2)).ToArray(); if (!Globals.Config.RandomizeFruitTrees) { return; } // Fruit tree asset replacements var fruitTreeReplacements = new Dictionary <int, string>(); // The Trees are incremented starting with cherry for (int i = 0; i < treeItems.Count; i++) { int price = prices[i]; string season = seasons[i]; string seasonDisplay = Globals.GetTranslation($"seasons-{season}"); Item treeItem = treeItems[i]; string treeItemName = treeItem.DisplayName; string fruitTreeName = treeItem.Id == fruitTreesIds[i] ? Globals.GetTranslation("item-recursion-sapling-name") : Globals.GetTranslation("sapling-text", new { itemName = treeItemName }); string fruitTreeEnglishName = treeItem.Id == fruitTreesIds[i] ? "Recursion Sapling" : $"{treeItem.Name} Sapling"; int fruitTreeId = fruitTreesIds[i]; string fruitTreeValue = $"{i}/{season}/{treeItem.Id}/{price}"; editedObjectInfo.FruitTreeReplacements[fruitTreeId] = fruitTreeValue; ItemList.Items[fruitTreeId].OverrideName = fruitTreeEnglishName; string fruitTreeObjectValue = $"{fruitTreeName}/{price / 2}/-300/Basic -74/{fruitTreeName}/{Globals.GetTranslation("sapling-description", new { itemName = treeItemName, season = seasonDisplay })}"; editedObjectInfo.ObjectInformationReplacements[fruitTreeId] = fruitTreeObjectValue; } }
/// <summary> /// Sets up the rice objects /// </summary> /// <param name="editedObjectInfo">The object info containing changes to apply</param> public static void SetUpRice(EditedObjectInformation editedObjectInfo) { CropItem unmilledRice = (CropItem)ItemList.Items[(int)ObjectIndexes.UnmilledRice]; string riceName = unmilledRice.OverrideName; unmilledRice.OverrideName = $"Unmilled {riceName}"; unmilledRice.OverrideDisplayName = Globals.GetTranslation("unmilled-rice-name", new { itemName = riceName }); editedObjectInfo.ObjectInformationReplacements[(int)ObjectIndexes.UnmilledRice] = unmilledRice.ToString(); Item rice = ItemList.Items[(int)ObjectIndexes.Rice]; rice.OverrideName = riceName; editedObjectInfo.ObjectInformationReplacements[(int)ObjectIndexes.Rice] = $"{riceName}/100/5/Basic/{riceName}/{Globals.GetTranslation("item-rice-description")}"; }
/// <summary> /// Sets up the coffee beans and coffee objects /// </summary> /// <param name="editedObjectInfo">The object info containing changes to apply</param> /// <param name="coffeeName">The name of the coffee item</param> private static void SetUpCoffee(EditedObjectInformation editedObjectInfo, string coffeeName) { if (!Globals.Config.RandomizeCrops) { return; } Item coffee = ItemList.Items[(int)ObjectIndexes.Coffee]; coffee.OverrideName = $"Hot {coffeeName}"; coffee.CoffeeIngredient = coffeeName; editedObjectInfo.ObjectInformationReplacements[(int)ObjectIndexes.Coffee] = coffee.ToString(); Item coffeeBean = ItemList.Items[(int)ObjectIndexes.CoffeeBean]; coffeeBean.OverrideName = $"{coffeeName} Bean"; coffeeBean.OverrideDisplayName = Globals.GetTranslation("coffee-bean-name", new { itemName = coffeeName }); editedObjectInfo.ObjectInformationReplacements[(int)ObjectIndexes.CoffeeBean] = coffeeBean.ToString(); }
public void CalculateEdits() { ItemList.Initialize(); ValidateItemList(); EditedObjectInformation editedObjectInfo = new EditedObjectInformation(); FishRandomizer.Randomize(editedObjectInfo); _fishReplacements = editedObjectInfo.FishReplacements; CropRandomizer.Randomize(editedObjectInfo); _fruitTreeReplacements = editedObjectInfo.FruitTreeReplacements; _cropReplacements = editedObjectInfo.CropsReplacements; _objectInformationReplacements = editedObjectInfo.ObjectInformationReplacements; _blueprintReplacements = BlueprintRandomizer.Randomize(); _monsterReplacements = MonsterRandomizer.Randomize(); // Must be done before recipes since rarities of drops change _locationsReplacements = LocationRandomizer.Randomize(); // Must be done before recipes because of wild seeds _recipeReplacements = CraftingRecipeRandomizer.Randomize(); _stringReplacements = StringsAdjustments.GetCSFileStringReplacements(); _locationStringReplacements = StringsAdjustments.GetLocationStringReplacements(); _bundleReplacements = BundleRandomizer.Randomize(); MusicReplacements = MusicRandomizer.Randomize(); QuestInformation questInfo = QuestRandomizer.Randomize(); _questReplacements = questInfo.QuestReplacements; _mailReplacements = questInfo.MailReplacements; CraftingRecipeAdjustments.FixCookingRecipeDisplayNames(); _cookingChannelReplacements = CookingChannel.GetTextEdits(); _weaponReplacements = WeaponRandomizer.Randomize(); _bootReplacements = BootRandomizer.Randomize(); _birthdayReplacements = BirthdayRandomizer.Randomize(); }
public static void Randomize(EditedObjectInformation editedObjectInfo) { List <FishItem> legendaryFish = FishItem.GetLegendaries().Cast <FishItem>().ToList(); List <FishItem> normalFish = FishItem.Get().Cast <FishItem>().ToList(); List <FishItem> normalFishCopy = new List <FishItem>(); foreach (FishItem fish in normalFish) { FishItem fishInfo = new FishItem(fish.Id, true); CopyFishInfo(fish, fishInfo); normalFishCopy.Add(fishInfo); } List <string> fishNames = NameAndDescriptionRandomizer.GenerateFishNames(normalFish.Count + legendaryFish.Count); foreach (FishItem fish in normalFish) { FishItem fishToReplace = Globals.RNGGetAndRemoveRandomValueFromList(normalFishCopy); int newDartChance = GenerateRandomFishDifficulty(); FishBehaviorType newBehaviorType = Globals.RNGGetRandomValueFromList( Enum.GetValues(typeof(FishBehaviorType)).Cast <FishBehaviorType>().ToList()); string newName = Globals.RNGGetAndRemoveRandomValueFromList(fishNames); if (!Globals.Config.Fish.Randomize) { continue; } CopyFishInfo(fishToReplace, fish); fish.DartChance = newDartChance; fish.BehaviorType = newBehaviorType; fish.OverrideName = newName; if (fish.IsMinesFish) { if (!fish.AvailableLocations.Contains(Locations.UndergroundMine)) { fish.AvailableLocations.Add(Locations.UndergroundMine); } } if (Globals.Config.Fish.Randomize) { if (fish.IsSubmarineOnlyFish) { fish.DifficultyToObtain = ObtainingDifficulties.RareItem; } else { fish.DifficultyToObtain = ObtainingDifficulties.LargeTimeRequirements; } } editedObjectInfo.FishReplacements.Add(fish.Id, fish.ToString()); editedObjectInfo.ObjectInformationReplacements.Add(fish.Id, GetFishObjectInformation(fish)); } foreach (FishItem fish in legendaryFish) { FishBehaviorType newBehaviorType = Globals.RNGGetRandomValueFromList( Enum.GetValues(typeof(FishBehaviorType)).Cast <FishBehaviorType>().ToList()); string newName = Globals.RNGGetAndRemoveRandomValueFromList(fishNames); if (!Globals.Config.Fish.Randomize) { continue; } fish.BehaviorType = newBehaviorType; fish.OverrideName = newName; editedObjectInfo.FishReplacements.Add(fish.Id, fish.ToString()); editedObjectInfo.ObjectInformationReplacements.Add(fish.Id, GetFishObjectInformation(fish)); } WriteToSpoilerLog(); }
/// <summary> /// Randomizes the crops - currently only does prices, and only for seasonal crops /// </summary> /// <param name="editedObjectInfo">The edited object information</param> /// crop format: name/price/-300/Seeds -74/name/tooltip private static void RandomizeCrops(EditedObjectInformation editedObjectInfo) { List <int> regrowableSeedIdsToRandomize = ItemList.GetSeeds().Cast <SeedItem>() .Where(x => x.Randomize && x.CropGrowthInfo.RegrowsAfterHarvest) .Select(x => x.Id) .ToList(); List <int> regrowableSeedIdsToRandomizeCopy = new List <int>(regrowableSeedIdsToRandomize); List <int> nonRegrowableSeedIdsToRandomize = ItemList.GetSeeds().Cast <SeedItem>() .Where(x => x.Randomize && !x.CropGrowthInfo.RegrowsAfterHarvest) .Select(x => x.Id) .ToList(); List <int> nonRegrowableSeedIdsToRandomizeCopy = new List <int>(nonRegrowableSeedIdsToRandomize); // Fill up a dictionary to remap the seed values Dictionary <int, int> seedMappings = new Dictionary <int, int>(); // Original value, new value foreach (int originalRegrowableSeedId in regrowableSeedIdsToRandomize) { seedMappings.Add(originalRegrowableSeedId, Globals.RNGGetAndRemoveRandomValueFromList(regrowableSeedIdsToRandomizeCopy)); } foreach (int originalNonRegrowableSeedId in nonRegrowableSeedIdsToRandomize) { seedMappings.Add(originalNonRegrowableSeedId, Globals.RNGGetAndRemoveRandomValueFromList(nonRegrowableSeedIdsToRandomizeCopy)); } // Loop through the dictionary and reassign the values, keeping the seasons the same as before foreach (KeyValuePair <int, int> seedMapping in seedMappings) { int originalValue = seedMapping.Key; int newValue = seedMapping.Value; CropGrowthInformation cropInfoToAdd = CropGrowthInformation.ParseString(CropGrowthInformation.DefaultStringData[newValue]); cropInfoToAdd.GrowingSeasons = CropGrowthInformation.ParseString(CropGrowthInformation.DefaultStringData[originalValue]).GrowingSeasons; cropInfoToAdd.GrowthStages = GetRandomGrowthStages(cropInfoToAdd.GrowthStages.Count); cropInfoToAdd.CanScythe = Globals.RNGGetNextBoolean(10); cropInfoToAdd.DaysToRegrow = cropInfoToAdd.RegrowsAfterHarvest ? Range.GetRandomValue(1, 7) : -1; if (!Globals.Config.RandomizeCrops) { continue; } // Preserve the original seasons/etc CropGrowthInformation.CropIdsToInfo[originalValue] = cropInfoToAdd; } // Set the object info List <CropItem> randomizedCrops = ItemList.GetCrops(true).Cast <CropItem>() .Where(x => nonRegrowableSeedIdsToRandomize.Union(regrowableSeedIdsToRandomize).Contains(x.MatchingSeedItem.Id)) .ToList(); List <CropItem> vegetables = randomizedCrops.Where(x => !x.IsFlower).ToList(); List <CropItem> flowers = randomizedCrops.Where(x => x.IsFlower).ToList(); List <string> vegetableNames = NameAndDescriptionRandomizer.GenerateVegetableNames(vegetables.Count + 1); List <string> cropDescriptions = NameAndDescriptionRandomizer.GenerateCropDescriptions(randomizedCrops.Count); SetCropAndSeedInformation( editedObjectInfo, vegetables, vegetableNames, cropDescriptions); // Note: It removes the descriptions it uses from the list after assigning them- may want to edit later SetUpCoffee(editedObjectInfo, vegetableNames[vegetableNames.Count - 1]); SetUpRice(editedObjectInfo); SetCropAndSeedInformation( editedObjectInfo, flowers, NameAndDescriptionRandomizer.GenerateFlowerNames(flowers.Count), cropDescriptions); // Note: It removes the descriptions it uses from the list after assigning them- may want to edit later SetUpCookedFood(editedObjectInfo); }
/// <summary> /// Changes the names of the cooked food to match those of the objects themselves /// </summary> /// <param name="editedObjectInfo">The object info containing changes to apply</param> private static void SetUpCookedFood(EditedObjectInformation editedObjectInfo) { if (!Globals.Config.RandomizeCrops) { return; } string cauliflower = ItemList.Items[(int)ObjectIndexes.Cauliflower].Name; string parsnip = ItemList.Items[(int)ObjectIndexes.Parsnip].Name; string greenbean = ItemList.Items[(int)ObjectIndexes.GreenBean].Name; string yam = ItemList.Items[(int)ObjectIndexes.Yam].Name; string hotpepper = ItemList.Items[(int)ObjectIndexes.HotPepper].Name; string rhubarb = ItemList.Items[(int)ObjectIndexes.Rhubarb].Name; string eggplant = ItemList.Items[(int)ObjectIndexes.Eggplant].Name; string blueberry = ItemList.Items[(int)ObjectIndexes.Blueberry].Name; string pumpkin = ItemList.Items[(int)ObjectIndexes.Pumpkin].Name; string cranberry = ItemList.Items[(int)ObjectIndexes.Cranberries].Name; string radish = ItemList.Items[(int)ObjectIndexes.Radish].Name; string poppyseed = ItemList.Items[(int)ObjectIndexes.Poppy].Name; string artichoke = ItemList.Items[(int)ObjectIndexes.Artichoke].Name; string rice = ItemList.Items[(int)ObjectIndexes.Rice].Name; string carp = ItemList.Items[(int)ObjectIndexes.Carp].Name; string salmon = ItemList.Items[(int)ObjectIndexes.Salmon].Name; string bass = ItemList.Items[(int)ObjectIndexes.LargemouthBass].Name.Split(' ').Last(); string trout = ItemList.Items[(int)ObjectIndexes.RainbowTrout].Name; string eel = ItemList.Items[(int)ObjectIndexes.Eel].Name; SetIngredientAndOverrideName((int)ObjectIndexes.CheeseCauliflower, cauliflower, "Cheese {0}"); SetIngredientAndOverrideName((int)ObjectIndexes.ParsnipSoup, parsnip, "{0} Soup"); SetIngredientAndOverrideName((int)ObjectIndexes.BeanHotpot, greenbean, "{0} Hotpot"); SetIngredientAndOverrideName((int)ObjectIndexes.GlazedYams, yam, "Glazed {0} Platter"); SetIngredientAndOverrideName((int)ObjectIndexes.PepperPoppers, hotpepper, "{0} Poppers"); SetIngredientAndOverrideName((int)ObjectIndexes.RhubarbPie, rhubarb, "{0} Pie"); SetIngredientAndOverrideName((int)ObjectIndexes.EggplantParmesan, eggplant, "{0} Parmesan"); SetIngredientAndOverrideName((int)ObjectIndexes.BlueberryTart, blueberry, "{0} Tart"); SetIngredientAndOverrideName((int)ObjectIndexes.PumpkinSoup, pumpkin, "{0} Soup"); SetIngredientAndOverrideName((int)ObjectIndexes.CranberrySauce, cranberry, "{0} Sauce"); SetIngredientAndOverrideName((int)ObjectIndexes.PumpkinPie, pumpkin, "{0} Pie"); SetIngredientAndOverrideName((int)ObjectIndexes.RadishSalad, radish, "{0} Salad"); SetIngredientAndOverrideName((int)ObjectIndexes.CranberryCandy, cranberry, "{0} Candy"); SetIngredientAndOverrideName((int)ObjectIndexes.PoppyseedMuffin, poppyseed, "{0} Muffin"); SetIngredientAndOverrideName((int)ObjectIndexes.ArtichokeDip, artichoke, "{0} Dip"); SetIngredientAndOverrideName((int)ObjectIndexes.FruitSalad, "", "{0} Candy"); SetIngredientAndOverrideName((int)ObjectIndexes.RicePudding, rice, "{0} Pudding"); SetIngredientAndOverrideName((int)ObjectIndexes.CarpSurprise, carp, "{0} Surprise"); SetIngredientAndOverrideName((int)ObjectIndexes.SalmonDinner, salmon, "{0} Dinner"); SetIngredientAndOverrideName((int)ObjectIndexes.CrispyBass, bass, "Crispy {0}"); SetIngredientAndOverrideName((int)ObjectIndexes.TroutSoup, trout, "{0} Soup"); SetIngredientAndOverrideName((int)ObjectIndexes.FriedEel, eel, "Fried {0}"); SetIngredientAndOverrideName((int)ObjectIndexes.SpicyEel, eel, "Spicy {0}"); var cropItemReplacements = new Dictionary <int, string> { { (int)ObjectIndexes.CheeseCauliflower, $"Cheese {cauliflower}/300/55/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.CheeseCauliflower, cauliflower)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.ParsnipSoup, $"{parsnip} Soup/120/34/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.ParsnipSoup, parsnip)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.BeanHotpot, $"{greenbean} Hotpot/100/50/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.BeanHotpot, greenbean)}/food/0 0 0 0 0 0 2 0 0 0 0/600" }, { (int)ObjectIndexes.GlazedYams, $"Glazed {yam} Platter/200/80/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.GlazedYams, yam)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.PepperPoppers, $"{hotpepper} Poppers/200/52/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.PepperPoppers, hotpepper)}/food/2 0 0 0 0 0 0 0 0 1 0/600" }, { (int)ObjectIndexes.RhubarbPie, $"{rhubarb} Pie/400/86/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.RhubarbPie, rhubarb)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.EggplantParmesan, $"{eggplant} Parmesan/200/70/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.EggplantParmesan, eggplant)}/food/0 0 1 0 0 0 0 0 0 0 3/400" }, { (int)ObjectIndexes.RicePudding, $"{rice} Pudding/260/46/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.RicePudding, rice)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.BlueberryTart, $"{blueberry} Tart/150/50/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.BlueberryTart, blueberry)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.PumpkinSoup, $"{pumpkin} Soup/300/80/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.PumpkinSoup, pumpkin)}/food/0 0 0 0 2 0 0 0 0 0 2/660" }, { (int)ObjectIndexes.CranberrySauce, $"{cranberry} Sauce/120/50/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.CranberrySauce, cranberry)}/food/0 0 2 0 0 0 0 0 0 0 0/300" }, { (int)ObjectIndexes.ArtichokeDip, $"{artichoke} Dip/210/40/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.ArtichokeDip, artichoke)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.PumpkinPie, $"{pumpkin} Pie/385/90/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.PumpkinPie, pumpkin)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.RadishSalad, $"{radish} Salad/300/80/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.RadishSalad, radish)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.CranberryCandy, $"{cranberry} Candy/175/50/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.CranberryCandy, cranberry)}/drink/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.PoppyseedMuffin, $"{poppyseed} Muffin/250/60/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.PoppyseedMuffin, poppyseed)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.FruitSalad, $"Harvest Salad/450/105/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.FruitSalad, "")}/food/0 0 0 0 0 0 0 0 0 0 0/0" } }; var fishItemReplacements = new Dictionary <int, string> { { (int)ObjectIndexes.CarpSurprise, $"{carp} Surprise/150/36/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.CarpSurprise, carp)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.SalmonDinner, $"{salmon} Dinner/300/50/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.SalmonDinner, salmon)}/food/0 0 0 0 0 0 0 0 0 0 0/0" }, { (int)ObjectIndexes.CrispyBass, $"Crispy {bass}/150/36/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.CrispyBass, bass)}/food/0 0 0 0 0 0 0 0 64 0 0/600" }, { (int)ObjectIndexes.TroutSoup, $"{trout} Soup/100/40/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.TroutSoup, trout)}/food/0 1 0 0 0 0 0 0 0 0 0/400" }, { (int)ObjectIndexes.FriedEel, $"Fried {eel}/120/30/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.FriedEel, eel)}/food/0 0 0 0 1 0 0 0 0 0 0/600" }, { (int)ObjectIndexes.SpicyEel, $"Spicy {eel}/175/46/Cooking -7/{GetRecipeNameAndDescription((int)ObjectIndexes.SpicyEel, eel)}/food/0 0 0 0 1 0 0 0 0 1 0/600" } }; if (Globals.Config.RandomizeCrops) { foreach (KeyValuePair <int, string> pair in cropItemReplacements) { editedObjectInfo.ObjectInformationReplacements[pair.Key] = pair.Value; } } if (Globals.Config.RandomizeFish) { foreach (KeyValuePair <int, string> pair in fishItemReplacements) { editedObjectInfo.ObjectInformationReplacements[pair.Key] = pair.Value; } } }
public static void Randomize(EditedObjectInformation editedObjectInfo) { RandomizeCrops(editedObjectInfo); RandomizeFruitTrees(editedObjectInfo); WriteToSpoilerLog(); }