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
This commit is contained in:
@@ -3,7 +3,8 @@ from __future__ import annotations
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
|
||||
from ..options import StardewValleyOptions, ExcludeGingerIsland, FestivalLocations
|
||||
from ..content import StardewContent
|
||||
from ..options import StardewValleyOptions, ExcludeGingerIsland, FestivalLocations, SkillProgression
|
||||
from ..strings.crop_names import Fruit
|
||||
from ..strings.currency_names import Currency
|
||||
from ..strings.quality_names import CropQuality, FishQuality, ForageQuality
|
||||
@@ -30,27 +31,50 @@ class FestivalItemSource(BundleItemSource):
|
||||
return options.festival_locations != FestivalLocations.option_disabled
|
||||
|
||||
|
||||
class MasteryItemSource(BundleItemSource):
|
||||
def can_appear(self, options: StardewValleyOptions) -> bool:
|
||||
return options.skill_progression == SkillProgression.option_progressive_with_masteries
|
||||
|
||||
|
||||
class ContentItemSource(BundleItemSource):
|
||||
"""This is meant to be used for items that are managed by the content packs."""
|
||||
|
||||
def can_appear(self, options: StardewValleyOptions) -> bool:
|
||||
raise ValueError("This should not be called, check if the item is in the content instead.")
|
||||
|
||||
|
||||
@dataclass(frozen=True, order=True)
|
||||
class BundleItem:
|
||||
class Sources:
|
||||
vanilla = VanillaItemSource()
|
||||
island = IslandItemSource()
|
||||
festival = FestivalItemSource()
|
||||
masteries = MasteryItemSource()
|
||||
content = ContentItemSource()
|
||||
|
||||
item_name: str
|
||||
amount: int = 1
|
||||
quality: str = CropQuality.basic
|
||||
source: BundleItemSource = Sources.vanilla
|
||||
flavor: str = None
|
||||
can_have_quality: bool = True
|
||||
|
||||
@staticmethod
|
||||
def money_bundle(amount: int) -> BundleItem:
|
||||
return BundleItem(Currency.money, amount)
|
||||
|
||||
def get_item(self) -> str:
|
||||
if self.flavor is None:
|
||||
return self.item_name
|
||||
return f"{self.item_name} [{self.flavor}]"
|
||||
|
||||
def as_amount(self, amount: int) -> BundleItem:
|
||||
return BundleItem(self.item_name, amount, self.quality, self.source)
|
||||
return BundleItem(self.item_name, amount, self.quality, self.source, self.flavor)
|
||||
|
||||
def as_quality(self, quality: str) -> BundleItem:
|
||||
return BundleItem(self.item_name, self.amount, quality, self.source)
|
||||
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)
|
||||
|
||||
def as_quality_crop(self) -> BundleItem:
|
||||
amount = 5
|
||||
@@ -67,7 +91,11 @@ class BundleItem:
|
||||
|
||||
def __repr__(self):
|
||||
quality = "" if self.quality == CropQuality.basic else self.quality
|
||||
return f"{self.amount} {quality} {self.item_name}"
|
||||
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
|
||||
|
||||
def can_appear(self, options: StardewValleyOptions) -> bool:
|
||||
return self.source.can_appear(options)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user