 9b22458f44
			
		
	
	9b22458f44
	
	
	
		
			
			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
		
			
				
	
	
		
			68 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| from copy import deepcopy
 | |
| from dataclasses import dataclass, field
 | |
| from enum import IntFlag
 | |
| from typing import Optional, List, Set
 | |
| 
 | |
| connector_keyword = " to "
 | |
| 
 | |
| 
 | |
| class ModificationFlag(IntFlag):
 | |
|     NOT_MODIFIED = 0
 | |
|     MODIFIED = 1
 | |
| 
 | |
| 
 | |
| class RandomizationFlag(IntFlag):
 | |
|     NOT_RANDOMIZED = 0b0
 | |
|     PELICAN_TOWN = 0b00011111
 | |
|     NON_PROGRESSION = 0b00011110
 | |
|     BUILDINGS = 0b00011100
 | |
|     EVERYTHING = 0b00011000
 | |
|     GINGER_ISLAND = 0b00100000
 | |
|     LEAD_TO_OPEN_AREA = 0b01000000
 | |
|     MASTERIES = 0b10000000
 | |
| 
 | |
| 
 | |
| @dataclass(frozen=True)
 | |
| class RegionData:
 | |
|     name: str
 | |
|     exits: List[str] = field(default_factory=list)
 | |
|     flag: ModificationFlag = ModificationFlag.NOT_MODIFIED
 | |
|     is_ginger_island: bool = False
 | |
| 
 | |
|     def get_merged_with(self, exits: List[str]):
 | |
|         merged_exits = []
 | |
|         merged_exits.extend(self.exits)
 | |
|         if exits is not None:
 | |
|             merged_exits.extend(exits)
 | |
|         merged_exits = list(set(merged_exits))
 | |
|         return RegionData(self.name, merged_exits, is_ginger_island=self.is_ginger_island)
 | |
| 
 | |
|     def get_without_exits(self, exits_to_remove: Set[str]):
 | |
|         exits = [exit_ for exit_ in self.exits if exit_ not in exits_to_remove]
 | |
|         return RegionData(self.name, exits, is_ginger_island=self.is_ginger_island)
 | |
| 
 | |
|     def get_clone(self):
 | |
|         return deepcopy(self)
 | |
| 
 | |
| 
 | |
| @dataclass(frozen=True)
 | |
| class ConnectionData:
 | |
|     name: str
 | |
|     destination: str
 | |
|     origin: Optional[str] = None
 | |
|     reverse: Optional[str] = None
 | |
|     flag: RandomizationFlag = RandomizationFlag.NOT_RANDOMIZED
 | |
| 
 | |
|     def __post_init__(self):
 | |
|         if connector_keyword in self.name:
 | |
|             origin, destination = self.name.split(connector_keyword)
 | |
|             if self.reverse is None:
 | |
|                 super().__setattr__("reverse", f"{destination}{connector_keyword}{origin}")
 | |
| 
 | |
| 
 | |
| @dataclass(frozen=True)
 | |
| class ModRegionData:
 | |
|     mod_name: str
 | |
|     regions: List[RegionData]
 | |
|     connections: List[ConnectionData]
 |