| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from random import Random | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | from typing import List, Tuple | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | from .bundle import Bundle | 
					
						
							|  |  |  | from .bundle_room import BundleRoom, BundleRoomTemplate | 
					
						
							|  |  |  | from ..content import StardewContent | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from ..data.bundle_data import pantry_vanilla, crafts_room_vanilla, fish_tank_vanilla, boiler_room_vanilla, bulletin_board_vanilla, vault_vanilla, \ | 
					
						
							|  |  |  |     pantry_thematic, crafts_room_thematic, fish_tank_thematic, boiler_room_thematic, bulletin_board_thematic, vault_thematic, pantry_remixed, \ | 
					
						
							|  |  |  |     crafts_room_remixed, fish_tank_remixed, boiler_room_remixed, bulletin_board_remixed, vault_remixed, all_bundle_items_except_money, \ | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |     abandoned_joja_mart_thematic, abandoned_joja_mart_vanilla, abandoned_joja_mart_remixed, raccoon_vanilla, raccoon_thematic, raccoon_remixed, \ | 
					
						
							|  |  |  |     community_center_remixed_anywhere | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from ..logic.logic import StardewLogic | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | from ..options import BundleRandomization, StardewValleyOptions | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | def get_all_bundles(random: Random, logic: StardewLogic, content: StardewContent, options: StardewValleyOptions) -> List[BundleRoom]: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     if options.bundle_randomization == BundleRandomization.option_vanilla: | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |         return get_vanilla_bundles(random, content, options) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     elif options.bundle_randomization == BundleRandomization.option_thematic: | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |         return get_thematic_bundles(random, content, options) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     elif options.bundle_randomization == BundleRandomization.option_remixed: | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |         return get_remixed_bundles(random, content, options) | 
					
						
							|  |  |  |     elif options.bundle_randomization == BundleRandomization.option_remixed_anywhere: | 
					
						
							|  |  |  |         return get_remixed_bundles_anywhere(random, content, options) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     elif options.bundle_randomization == BundleRandomization.option_shuffled: | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |         return get_shuffled_bundles(random, logic, content, options) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     raise NotImplementedError | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | def get_vanilla_bundles(random: Random, content: StardewContent, options: StardewValleyOptions) -> List[BundleRoom]: | 
					
						
							|  |  |  |     pantry = pantry_vanilla.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     crafts_room = crafts_room_vanilla.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     fish_tank = fish_tank_vanilla.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     boiler_room = boiler_room_vanilla.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     bulletin_board = bulletin_board_vanilla.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     vault = vault_vanilla.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     abandoned_joja_mart = abandoned_joja_mart_vanilla.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     raccoon = raccoon_vanilla.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     fix_raccoon_bundle_names(raccoon) | 
					
						
							|  |  |  |     return [pantry, crafts_room, fish_tank, boiler_room, bulletin_board, vault, abandoned_joja_mart, raccoon] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def get_thematic_bundles(random: Random, content: StardewContent, options: StardewValleyOptions) -> List[BundleRoom]: | 
					
						
							|  |  |  |     pantry = pantry_thematic.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     crafts_room = crafts_room_thematic.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     fish_tank = fish_tank_thematic.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     boiler_room = boiler_room_thematic.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     bulletin_board = bulletin_board_thematic.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     vault = vault_thematic.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     abandoned_joja_mart = abandoned_joja_mart_thematic.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     raccoon = raccoon_thematic.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     fix_raccoon_bundle_names(raccoon) | 
					
						
							|  |  |  |     return [pantry, crafts_room, fish_tank, boiler_room, bulletin_board, vault, abandoned_joja_mart, raccoon] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def get_remixed_bundles(random: Random, content: StardewContent, options: StardewValleyOptions) -> List[BundleRoom]: | 
					
						
							|  |  |  |     pantry = pantry_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     crafts_room = crafts_room_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     fish_tank = fish_tank_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     boiler_room = boiler_room_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     bulletin_board = bulletin_board_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     vault = vault_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     abandoned_joja_mart = abandoned_joja_mart_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     raccoon = raccoon_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     fix_raccoon_bundle_names(raccoon) | 
					
						
							|  |  |  |     return [pantry, crafts_room, fish_tank, boiler_room, bulletin_board, vault, abandoned_joja_mart, raccoon] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def get_remixed_bundles_anywhere(random: Random, content: StardewContent, options: StardewValleyOptions) -> List[BundleRoom]: | 
					
						
							|  |  |  |     big_room = community_center_remixed_anywhere.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     all_chosen_bundles = big_room.bundles | 
					
						
							|  |  |  |     random.shuffle(all_chosen_bundles) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     end_index = 0 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pantry, end_index = create_room_from_bundles(pantry_remixed, all_chosen_bundles, end_index) | 
					
						
							|  |  |  |     crafts_room, end_index = create_room_from_bundles(crafts_room_remixed, all_chosen_bundles, end_index) | 
					
						
							|  |  |  |     fish_tank, end_index = create_room_from_bundles(fish_tank_remixed, all_chosen_bundles, end_index) | 
					
						
							|  |  |  |     boiler_room, end_index = create_room_from_bundles(boiler_room_remixed, all_chosen_bundles, end_index) | 
					
						
							|  |  |  |     bulletin_board, end_index = create_room_from_bundles(bulletin_board_remixed, all_chosen_bundles, end_index) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     vault = vault_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     abandoned_joja_mart = abandoned_joja_mart_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     raccoon = raccoon_remixed.create_bundle_room(random, content, options) | 
					
						
							|  |  |  |     fix_raccoon_bundle_names(raccoon) | 
					
						
							|  |  |  |     return [pantry, crafts_room, fish_tank, boiler_room, bulletin_board, vault, abandoned_joja_mart, raccoon] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def create_room_from_bundles(template: BundleRoomTemplate, all_bundles: List[Bundle], end_index: int) -> Tuple[BundleRoom, int]: | 
					
						
							|  |  |  |     start_index = end_index | 
					
						
							|  |  |  |     end_index += template.number_bundles | 
					
						
							|  |  |  |     return BundleRoom(template.name, all_bundles[start_index:end_index]), end_index | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def get_shuffled_bundles(random: Random, logic: StardewLogic, content: StardewContent, options: StardewValleyOptions) -> List[BundleRoom]: | 
					
						
							|  |  |  |     valid_bundle_items = [bundle_item for bundle_item in all_bundle_items_except_money if bundle_item.can_appear(content, options)] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     rooms = [room for room in get_remixed_bundles(random, content, options) if room.name != "Vault"] | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     required_items = 0 | 
					
						
							|  |  |  |     for room in rooms: | 
					
						
							|  |  |  |         for bundle in room.bundles: | 
					
						
							|  |  |  |             required_items += len(bundle.items) | 
					
						
							|  |  |  |         random.shuffle(room.bundles) | 
					
						
							|  |  |  |     random.shuffle(rooms) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |     # Remove duplicates of the same item | 
					
						
							|  |  |  |     valid_bundle_items = [item1 for i, item1 in enumerate(valid_bundle_items) | 
					
						
							|  |  |  |                           if not any(item1.item_name == item2.item_name and item1.quality == item2.quality for item2 in valid_bundle_items[:i])] | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     chosen_bundle_items = random.sample(valid_bundle_items, required_items) | 
					
						
							|  |  |  |     for room in rooms: | 
					
						
							|  |  |  |         for bundle in room.bundles: | 
					
						
							|  |  |  |             num_items = len(bundle.items) | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |             bundle.items = chosen_bundle_items[:num_items] | 
					
						
							|  |  |  |             chosen_bundle_items = chosen_bundle_items[num_items:] | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  |     vault = vault_remixed.create_bundle_room(random, content, options) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     return [*rooms, vault] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												Stardew Valley 6.x.x: The Content Update (#3478)
Focus of the Update: Compatibility with Stardew Valley 1.6 Released on March 19th 2024
This includes randomization for pretty much all of the new content, including but not limited to
- Raccoon Bundles
- Booksanity
- Skill Masteries
- New Recipes, Craftables, Fish, Maps, Farm Type, Festivals and Quests
This also includes a significant reorganisation of the code into "Content Packs", to allow for easier modularity of various game mechanics between the settings and the supported mods. This improves maintainability quite a bit.
In addition to that, a few **very** requested new features have been introduced, although they weren't the focus of this update
- Walnutsanity
- Player Buffs
- More customizability in settings, such as shorter special orders, ER without farmhouse
- New Remixed Bundles
											
										 
											2024-07-07 16:04:25 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | def fix_raccoon_bundle_names(raccoon): | 
					
						
							|  |  |  |     for i in range(len(raccoon.bundles)): | 
					
						
							|  |  |  |         raccoon_bundle = raccoon.bundles[i] | 
					
						
							|  |  |  |         raccoon_bundle.name = f"Raccoon Request {i + 1}" |