| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from __future__ import annotations | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | from abc import ABC, abstractmethod | 
					
						
							|  |  |  | from dataclasses import dataclass | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-30 21:52:07 -05:00
										 |  |  | from ..content import StardewContent, content_packs | 
					
						
							|  |  |  | from ..options import StardewValleyOptions, FestivalLocations | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | from ..strings.crop_names import Fruit | 
					
						
							|  |  |  | from ..strings.currency_names import Currency | 
					
						
							|  |  |  | from ..strings.quality_names import CropQuality, FishQuality, ForageQuality | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class BundleItemSource(ABC): | 
					
						
							|  |  |  |     @abstractmethod | 
					
						
							| 
									
										
										
										
											2024-11-30 21:52:07 -05:00
										 |  |  |     def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         ... | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class VanillaItemSource(BundleItemSource): | 
					
						
							| 
									
										
										
										
											2024-11-30 21:52:07 -05:00
										 |  |  |     def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         return True | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class IslandItemSource(BundleItemSource): | 
					
						
							| 
									
										
										
										
											2024-11-30 21:52:07 -05:00
										 |  |  |     def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: | 
					
						
							|  |  |  |         return content_packs.ginger_island_content_pack.name in content.registered_packs | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class FestivalItemSource(BundleItemSource): | 
					
						
							| 
									
										
										
										
											2024-11-30 21:52:07 -05:00
										 |  |  |     def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |         return options.festival_locations != FestivalLocations.option_disabled | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-30 21:52:07 -05:00
										 |  |  | # FIXME remove this once recipes are in content packs | 
					
						
							| 
									
										
										
											
												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
										 |  |  | class MasteryItemSource(BundleItemSource): | 
					
						
							| 
									
										
										
										
											2024-11-30 21:52:07 -05:00
										 |  |  |     def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: | 
					
						
							|  |  |  |         return content.features.skill_progression.are_masteries_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
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ContentItemSource(BundleItemSource): | 
					
						
							|  |  |  |     """This is meant to be used for items that are managed by the content packs.""" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-30 21:52:07 -05:00
										 |  |  |     def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: | 
					
						
							| 
									
										
										
											
												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
										 |  |  |         raise ValueError("This should not be called, check if the item is in the content instead.") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | @dataclass(frozen=True, order=True) | 
					
						
							|  |  |  | class BundleItem: | 
					
						
							|  |  |  |     class Sources: | 
					
						
							|  |  |  |         vanilla = VanillaItemSource() | 
					
						
							|  |  |  |         island = IslandItemSource() | 
					
						
							|  |  |  |         festival = FestivalItemSource() | 
					
						
							| 
									
										
										
											
												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
										 |  |  |         masteries = MasteryItemSource() | 
					
						
							|  |  |  |         content = ContentItemSource() | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     item_name: str | 
					
						
							|  |  |  |     amount: int = 1 | 
					
						
							|  |  |  |     quality: str = CropQuality.basic | 
					
						
							|  |  |  |     source: BundleItemSource = Sources.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
										 |  |  |     flavor: str = None | 
					
						
							|  |  |  |     can_have_quality: bool = True | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     @staticmethod | 
					
						
							|  |  |  |     def money_bundle(amount: int) -> BundleItem: | 
					
						
							|  |  |  |         return BundleItem(Currency.money, amount) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												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_item(self) -> str: | 
					
						
							|  |  |  |         if self.flavor is None: | 
					
						
							|  |  |  |             return self.item_name | 
					
						
							|  |  |  |         return f"{self.item_name} [{self.flavor}]" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  |     def as_amount(self, amount: int) -> BundleItem: | 
					
						
							| 
									
										
										
											
												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 BundleItem(self.item_name, amount, self.quality, self.source, self.flavor) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def as_quality(self, quality: str) -> BundleItem: | 
					
						
							| 
									
										
										
											
												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
										 |  |  |         if self.can_have_quality: | 
					
						
							|  |  |  |             return BundleItem(self.item_name, self.amount, quality, self.source, self.flavor) | 
					
						
							|  |  |  |         return BundleItem(self.item_name, self.amount, self.quality, self.source, self.flavor) | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def as_quality_crop(self) -> BundleItem: | 
					
						
							|  |  |  |         amount = 5 | 
					
						
							|  |  |  |         difficult_crops = [Fruit.sweet_gem_berry, Fruit.ancient_fruit] | 
					
						
							|  |  |  |         if self.item_name in difficult_crops: | 
					
						
							|  |  |  |             amount = 1 | 
					
						
							|  |  |  |         return self.as_quality(CropQuality.gold).as_amount(amount) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def as_quality_fish(self) -> BundleItem: | 
					
						
							|  |  |  |         return self.as_quality(FishQuality.gold) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def as_quality_forage(self) -> BundleItem: | 
					
						
							|  |  |  |         return self.as_quality(ForageQuality.gold) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def __repr__(self): | 
					
						
							|  |  |  |         quality = "" if self.quality == CropQuality.basic else self.quality | 
					
						
							| 
									
										
										
											
												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 f"{self.amount} {quality} {self.get_item()}" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def can_appear(self, content: StardewContent, options: StardewValleyOptions) -> bool: | 
					
						
							|  |  |  |         if isinstance(self.source, ContentItemSource): | 
					
						
							|  |  |  |             return self.get_item() in content.game_items | 
					
						
							| 
									
										
										
										
											2024-03-15 15:05:14 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-30 21:52:07 -05:00
										 |  |  |         return self.source.can_appear(content, options) |