2023-07-19 14:26:38 -04:00
import logging
2025-03-08 12:13:33 -05:00
import typing
2024-07-26 05:33:14 -04:00
from random import Random
2025-04-20 10:51:03 -04:00
from typing import Dict , Any , Iterable , Optional , List , TextIO
2023-02-26 19:19:15 -05: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 BaseClasses import Region , Entrance , Location , Item , Tutorial , ItemClassification , MultiWorld , CollectionState
2024-12-08 21:00:30 -05:00
from Options import PerGameCommonOptions
2023-02-26 19:19:15 -05:00
from worlds . AutoWorld import World , WebWorld
2024-03-15 15:05:14 +03:00
from . bundles . bundle_room import BundleRoom
from . bundles . bundles import get_all_bundles
2025-01-12 11:01:02 -05:00
from . content import StardewContent , create_content
2024-03-15 15:05:14 +03:00
from . early_items import setup_early_items
2025-05-10 17:57:24 -04:00
from . items import item_table , ItemData , Group , items_by_group
from . items . item_creation import create_items , get_all_filler_items , remove_limited_amount_packs , \
generate_filler_choice_pool
2024-03-15 15:05:14 +03:00
from . locations import location_table , create_locations , LocationData , locations_by_tag
from . logic . logic import StardewLogic
2025-05-10 17:57:24 -04:00
from . options import StardewValleyOptions , SeasonRandomization , Goal , BundleRandomization , EnabledFillerBuffs , \
NumberOfMovementBuffs , BuildingProgression , EntranceRandomization , FarmType
2024-12-08 21:00:30 -05:00
from . options . forced_options import force_change_options_if_incompatible
from . options . option_groups import sv_option_groups
from . options . presets import sv_options_presets
2025-03-08 12:13:33 -05:00
from . options . worlds_group import apply_most_restrictive_options
2023-02-26 19:19:15 -05:00
from . regions import create_regions
from . rules import set_rules
2025-01-12 11:01:02 -05:00
from . stardew_rule import True_ , StardewRule , HasProgressionPercent
2024-03-15 15:05:14 +03:00
from . strings . ap_names . event_names import Event
2023-10-10 15:30:20 -05:00
from . strings . goal_names import Goal as GoalName
2023-02-26 19:19:15 -05:00
2024-07-26 05:33:14 -04:00
logger = logging . getLogger ( __name__ )
STARDEW_VALLEY = " Stardew Valley "
UNIVERSAL_TRACKER_SEED_PROPERTY = " ut_seed "
2023-02-26 19:19:15 -05:00
client_version = 0
class StardewLocation ( Location ) :
2024-07-26 05:33:14 -04:00
game : str = STARDEW_VALLEY
2023-02-26 19:19:15 -05:00
class StardewItem ( Item ) :
2024-07-26 05:33:14 -04:00
game : str = STARDEW_VALLEY
2023-02-26 19:19:15 -05:00
class StardewWebWorld ( WebWorld ) :
theme = " dirt "
bug_report_page = " https://github.com/agilbert1412/StardewArchipelago/issues/new?labels=bug&title= % 5BBug % 5D % 3A+Brief+Description+of+bug+here "
2023-11-18 13:35:57 -05:00
options_presets = sv_options_presets
2024-05-23 03:22:28 +03:00
option_groups = sv_option_groups
2023-02-26 19:19:15 -05:00
2023-07-28 22:08:22 -04:00
tutorials = [
Tutorial (
" Multiworld Setup Guide " ,
" A guide to playing Stardew Valley with Archipelago. " ,
" English " ,
" setup_en.md " ,
" setup/en " ,
[ " KaitoKid " , " Jouramie " , " Witchybun (Mod Support) " , " Exempt-Medic (Proofreading) " ]
) ]
2023-02-26 19:19:15 -05:00
class StardewValleyWorld ( World ) :
"""
2023-03-30 10:25:25 -04:00
Stardew Valley is an open - ended country - life RPG . You can farm , fish , mine , fight , complete quests ,
befriend villagers , and uncover dark secrets .
2023-02-26 19:19:15 -05:00
"""
2024-07-26 05:33:14 -04:00
game = STARDEW_VALLEY
2023-02-26 19:19:15 -05:00
topology_present = False
item_name_to_id = { name : data . code for name , data in item_table . items ( ) }
location_name_to_id = { name : data . code for name , data in location_table . items ( ) }
2024-03-15 15:05:14 +03:00
item_name_groups = {
group . name . replace ( " _ " , " " ) . title ( ) + ( " Group " if group . name . replace ( " _ " , " " ) . title ( ) in item_table else " " ) :
[ item . name for item in items ] for group , items in items_by_group . items ( )
}
location_name_groups = {
group . name . replace ( " _ " , " " ) . title ( ) + ( " Group " if group . name . replace ( " _ " , " " ) . title ( ) in locations_by_tag else " " ) :
[ location . name for location in locations ] for group , locations in locations_by_tag . items ( )
}
2023-04-10 19:44:59 -04:00
required_client_version = ( 0 , 4 , 0 )
2023-02-26 19:19:15 -05:00
2023-10-10 15:30:20 -05:00
options_dataclass = StardewValleyOptions
options : StardewValleyOptions
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
content : StardewContent
2023-02-26 19:19:15 -05:00
logic : StardewLogic
web = StardewWebWorld ( )
2024-03-15 15:05:14 +03:00
modified_bundles : List [ BundleRoom ]
2023-02-26 19:19:15 -05:00
randomized_entrances : Dict [ str , str ]
2024-03-15 15:05:14 +03:00
2024-11-29 19:46:35 -05:00
total_progression_items : int
2023-07-19 14:26:38 -04:00
2025-03-08 12:13:33 -05:00
@classmethod
def create_group ( cls , multiworld : MultiWorld , new_player_id : int , players : set [ int ] ) - > World :
world_group = super ( ) . create_group ( multiworld , new_player_id , players )
group_options = typing . cast ( StardewValleyOptions , world_group . options )
worlds_options = [ typing . cast ( StardewValleyOptions , multiworld . worlds [ player ] . options ) for player in players ]
apply_most_restrictive_options ( group_options , worlds_options )
return world_group
2024-03-15 15:05:14 +03:00
def __init__ ( self , multiworld : MultiWorld , player : int ) :
super ( ) . __init__ ( multiworld , player )
2023-11-22 11:04:33 -05:00
self . filler_item_pool_names = [ ]
2024-03-15 15:05:14 +03:00
self . total_progression_items = 0
2023-02-26 19:19:15 -05:00
2024-07-26 05:33:14 -04:00
# Taking the seed specified in slot data for UT, otherwise just generating the seed.
self . seed = getattr ( multiworld , " re_gen_passthrough " , { } ) . get ( STARDEW_VALLEY , self . random . getrandbits ( 64 ) )
self . random = Random ( self . seed )
def interpret_slot_data ( self , slot_data : Dict [ str , Any ] ) - > Optional [ int ] :
# If the seed is not specified in the slot data, this mean the world was generated before Universal Tracker support.
seed = slot_data . get ( UNIVERSAL_TRACKER_SEED_PROPERTY )
if seed is None :
logger . warning ( f " World was generated before Universal Tracker support. Tracker might not be accurate. " )
return seed
2023-02-26 19:19:15 -05:00
def generate_early ( self ) :
2024-12-08 21:00:30 -05:00
force_change_options_if_incompatible ( self . options , self . player , self . player_name )
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
self . content = create_content ( self . options )
2023-07-19 14:26:38 -04:00
2023-02-26 19:19:15 -05:00
def create_regions ( self ) :
def create_region ( name : str , exits : Iterable [ str ] ) - > Region :
region = Region ( name , self . player , self . multiworld )
region . exits = [ Entrance ( self . player , exit_name , region ) for exit_name in exits ]
return region
2024-11-30 21:52:07 -05:00
world_regions , world_entrances , self . randomized_entrances = create_regions ( create_region , self . random , self . options , self . content )
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
self . logic = StardewLogic ( self . player , self . options , self . content , world_regions . keys ( ) )
2024-03-15 15:05:14 +03:00
self . modified_bundles = get_all_bundles ( self . random ,
self . logic ,
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
self . content ,
2024-03-15 15:05:14 +03:00
self . options )
2023-02-26 19:19:15 -05:00
def add_location ( name : str , code : Optional [ int ] , region : str ) :
2025-02-01 16:07:08 -05:00
region : Region = world_regions [ region ]
2023-02-26 19:19:15 -05:00
location = StardewLocation ( self . player , name , code , region )
region . locations . append ( location )
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
create_locations ( add_location , self . modified_bundles , self . options , self . content , self . random )
2023-10-27 05:12:17 -05:00
self . multiworld . regions . extend ( world_regions . values ( ) )
2023-02-26 19:19:15 -05:00
def create_items ( self ) :
2023-04-10 19:44:59 -04:00
self . precollect_starting_season ( )
2025-04-08 12:37:45 -04:00
self . precollect_building_items ( )
2023-02-26 19:19:15 -05:00
items_to_exclude = [ excluded_items
for excluded_items in self . multiworld . precollected_items [ self . player ]
2025-04-20 10:51:03 -04:00
if item_table [ excluded_items . name ] . has_any_group ( Group . MAXIMUM_ONE )
or not item_table [ excluded_items . name ] . has_any_group ( Group . RESOURCE_PACK , Group . FRIENDSHIP_PACK ) ]
2023-04-10 19:44:59 -04:00
2023-10-10 15:30:20 -05:00
if self . options . season_randomization == SeasonRandomization . option_disabled :
2023-04-10 19:44:59 -04:00
items_to_exclude = [ item for item in items_to_exclude
if item_table [ item . name ] not in items_by_group [ Group . SEASON ] ]
locations_count = len ( [ location
for location in self . multiworld . get_locations ( self . player )
2024-04-14 13:37:48 -05:00
if location . address is not None ] )
2023-04-10 19:44:59 -04:00
2024-11-29 19:46:35 -05:00
created_items = create_items ( self . create_item , locations_count , items_to_exclude , self . options , self . content , self . random )
2023-02-26 19:19:15 -05:00
2023-04-10 19:44:59 -04:00
self . multiworld . itempool + = created_items
2023-02-26 19:19:15 -05:00
2024-11-30 21:52:07 -05:00
setup_early_items ( self . multiworld , self . options , self . content , self . player , self . random )
2025-01-12 11:01:02 -05:00
self . setup_logic_events ( )
2023-02-26 19:19:15 -05:00
self . setup_victory ( )
2024-11-29 19:46:35 -05:00
# This is really a best-effort to get the total progression items count. It is mostly used to spread grinds across spheres are push back locations that
# only become available after months or years in game. In most cases, not having the exact count will not impact the logic.
#
# The actual total can be impacted by the start_inventory_from_pool, when items are removed from the pool but not from the total. The is also a bug
# with plando where additional progression items can be created without being accounted for, which impact the real amount of progression items. This can
# ultimately create unwinnable seeds where some items (like Blueberry seeds) are locked in Shipsanity: Blueberry, but world is deemed winnable as the
# winning rule only check the count of collected progression items.
self . total_progression_items + = sum ( 1 for i in self . multiworld . precollected_items [ self . player ] if i . advancement )
self . total_progression_items + = sum ( 1 for i in self . multiworld . get_filled_locations ( self . player ) if i . advancement )
self . total_progression_items + = sum ( 1 for i in created_items if i . advancement )
self . total_progression_items - = 1 # -1 for the victory event
2024-03-15 15:05:14 +03:00
def precollect_starting_season ( self ) :
2023-10-10 15:30:20 -05:00
if self . options . season_randomization == SeasonRandomization . option_progressive :
2023-04-10 19:44:59 -04:00
return
2023-02-26 19:19:15 -05:00
2023-04-10 19:44:59 -04:00
season_pool = items_by_group [ Group . SEASON ]
2023-02-26 19:19:15 -05:00
2023-10-10 15:30:20 -05:00
if self . options . season_randomization == SeasonRandomization . option_disabled :
2023-04-10 19:44:59 -04:00
for season in season_pool :
2025-01-18 20:36:01 -05:00
self . multiworld . push_precollected ( self . create_item ( season ) )
2023-04-10 19:44:59 -04:00
return
if [ item for item in self . multiworld . precollected_items [ self . player ]
if item . name in { season . name for season in items_by_group [ Group . SEASON ] } ] :
return
2023-10-10 15:30:20 -05:00
if self . options . season_randomization == SeasonRandomization . option_randomized_not_winter :
2023-04-10 19:44:59 -04:00
season_pool = [ season for season in season_pool if season . name != " Winter " ]
2025-01-18 20:36:01 -05:00
starting_season = self . create_item ( self . random . choice ( season_pool ) )
2023-04-10 19:44:59 -04:00
self . multiworld . push_precollected ( starting_season )
2025-04-08 12:37:45 -04:00
def precollect_building_items ( self ) :
building_progression = self . content . features . building_progression
# Not adding items when building are vanilla because the buildings are already placed in the world.
if not building_progression . is_progressive :
return
2025-04-18 17:41:46 +01:00
# starting_buildings is a set, so sort for deterministic order.
for building in sorted ( building_progression . starting_buildings ) :
2025-04-08 12:37:45 -04:00
item , quantity = building_progression . to_progressive_item ( building )
for _ in range ( quantity ) :
self . multiworld . push_precollected ( self . create_item ( item ) )
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 setup_logic_events ( self ) :
def register_event ( name : str , region : str , rule : StardewRule ) :
event_location = LocationData ( None , region , name )
self . create_event_location ( event_location , rule , name )
self . logic . setup_events ( register_event )
2023-02-26 19:19:15 -05:00
def setup_victory ( self ) :
2023-10-10 15:30:20 -05:00
if self . options . goal == Goal . option_community_center :
self . create_event_location ( location_table [ GoalName . community_center ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_community_center ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
2023-10-10 15:30:20 -05:00
elif self . options . goal == Goal . option_grandpa_evaluation :
self . create_event_location ( location_table [ GoalName . grandpa_evaluation ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_finish_grandpa_evaluation ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
2023-10-10 15:30:20 -05:00
elif self . options . goal == Goal . option_bottom_of_the_mines :
self . create_event_location ( location_table [ GoalName . bottom_of_the_mines ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_bottom_of_the_mines ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
2023-10-10 15:30:20 -05:00
elif self . options . goal == Goal . option_cryptic_note :
self . create_event_location ( location_table [ GoalName . cryptic_note ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_cryptic_note ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
2023-10-10 15:30:20 -05:00
elif self . options . goal == Goal . option_master_angler :
self . create_event_location ( location_table [ GoalName . master_angler ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_master_angler ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
2023-10-10 15:30:20 -05:00
elif self . options . goal == Goal . option_complete_collection :
self . create_event_location ( location_table [ GoalName . complete_museum ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_complete_collection ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
2023-10-10 15:30:20 -05:00
elif self . options . goal == Goal . option_full_house :
self . create_event_location ( location_table [ GoalName . full_house ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_full_house ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
2023-10-10 15:30:20 -05:00
elif self . options . goal == Goal . option_greatest_walnut_hunter :
self . create_event_location ( location_table [ GoalName . greatest_walnut_hunter ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_greatest_walnut_hunter ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
elif self . options . goal == Goal . option_protector_of_the_valley :
self . create_event_location ( location_table [ GoalName . protector_of_the_valley ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_protector_of_the_valley ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
elif self . options . goal == Goal . option_full_shipment :
self . create_event_location ( location_table [ GoalName . full_shipment ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_full_shipment ( self . get_all_location_names ( ) ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
elif self . options . goal == Goal . option_gourmet_chef :
self . create_event_location ( location_table [ GoalName . gourmet_chef ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_gourmet_chef ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
elif self . options . goal == Goal . option_craft_master :
self . create_event_location ( location_table [ GoalName . craft_master ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_craft_master ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
elif self . options . goal == Goal . option_legend :
self . create_event_location ( location_table [ GoalName . legend ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_legend ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
elif self . options . goal == Goal . option_mystery_of_the_stardrops :
self . create_event_location ( location_table [ GoalName . mystery_of_the_stardrops ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_mystery_of_the_stardrop ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
elif self . options . goal == Goal . option_allsanity :
self . create_event_location ( location_table [ GoalName . allsanity ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_allsanity ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
2023-10-10 15:30:20 -05:00
elif self . options . goal == Goal . option_perfection :
self . create_event_location ( location_table [ GoalName . perfection ] ,
2025-03-22 15:29:16 -04:00
self . logic . goal . can_complete_perfection ( ) ,
2024-03-15 15:05:14 +03:00
Event . victory )
self . multiworld . completion_condition [ self . player ] = lambda state : state . has ( Event . victory , self . player )
def get_all_location_names ( self ) - > List [ str ] :
return list ( location . name for location in self . multiworld . get_locations ( self . player ) )
2025-01-18 20:36:01 -05:00
def create_item ( self , item : str | ItemData , override_classification : ItemClassification = None ) - > StardewItem :
2024-03-15 15:05:14 +03:00
if isinstance ( item , str ) :
item = item_table [ item ]
if override_classification is None :
override_classification = item . classification
return StardewItem ( item . name , override_classification , item . code , self . player )
2023-02-26 19:19:15 -05:00
2025-04-28 18:12:52 -04:00
def create_event_location ( self , location_data : LocationData , rule : StardewRule , item : str ) :
2023-02-26 19:19:15 -05:00
region = self . multiworld . get_region ( location_data . region , self . player )
2025-04-28 18:12:52 -04:00
region . add_event ( location_data . name , item , rule , StardewLocation , StardewItem )
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
2023-04-10 19:44:59 -04:00
def set_rules ( self ) :
2023-10-10 15:30:20 -05:00
set_rules ( self )
2023-04-10 19:44:59 -04:00
def generate_basic ( self ) :
pass
2023-02-26 19:19:15 -05:00
def get_filler_item_name ( self ) - > str :
2023-11-22 11:04:33 -05:00
if not self . filler_item_pool_names :
2025-03-08 12:13:33 -05:00
self . filler_item_pool_names = generate_filler_choice_pool ( self . options )
2023-11-22 11:04:33 -05:00
return self . random . choice ( self . filler_item_pool_names )
2024-03-15 15:05:14 +03:00
def write_spoiler_header ( self , spoiler_handle : TextIO ) - > None :
""" Write to the spoiler header. If individual it ' s right at the end of that player ' s options,
if as stage it ' s right under the common header before per-player options. " " "
self . add_entrances_to_spoiler_log ( )
def write_spoiler ( self , spoiler_handle : TextIO ) - > None :
""" Write to the spoiler " middle " , this is after the per-player options and before locations,
meant for useful or interesting info . """
self . add_bundles_to_spoiler_log ( spoiler_handle )
2023-02-26 19:19:15 -05:00
2024-03-15 15:05:14 +03:00
def add_bundles_to_spoiler_log ( self , spoiler_handle : TextIO ) :
if self . options . bundle_randomization == BundleRandomization . option_vanilla :
return
player_name = self . multiworld . get_player_name ( self . player )
spoiler_handle . write ( f " \n \n Community Center ( { player_name } ): \n " )
for room in self . modified_bundles :
for bundle in room . bundles :
spoiler_handle . write ( f " \t [ { room . name } ] { bundle . name } ( { bundle . number_required } required): \n " )
for i , item in enumerate ( bundle . items ) :
if " Basic " in item . quality :
quality = " "
else :
quality = f " ( { item . quality . split ( ' ' ) [ 0 ] } ) "
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
spoiler_handle . write ( f " \t \t { item . amount } x { item . get_item ( ) } { quality } \n " )
2024-03-15 15:05:14 +03:00
def add_entrances_to_spoiler_log ( self ) :
if self . options . entrance_randomization == EntranceRandomization . option_disabled :
return
for original_entrance , replaced_entrance in self . randomized_entrances . items ( ) :
self . multiworld . spoiler . set_entrance ( original_entrance , replaced_entrance , " entrance " , self . player )
2023-02-26 19:19:15 -05:00
2024-03-15 15:05:14 +03:00
def fill_slot_data ( self ) - > Dict [ str , Any ] :
bundles = dict ( )
for room in self . modified_bundles :
bundles [ room . name ] = dict ( )
for bundle in room . bundles :
bundles [ room . name ] [ bundle . name ] = { " number_required " : bundle . number_required }
for i , item in enumerate ( 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
bundles [ room . name ] [ bundle . name ] [ i ] = f " { item . get_item ( ) } | { item . amount } | { item . quality } "
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
excluded_options = [ BundleRandomization , NumberOfMovementBuffs , EnabledFillerBuffs ]
2023-10-10 15:30:20 -05:00
excluded_option_names = [ option . internal_name for option in excluded_options ]
generic_option_names = [ option_name for option_name in PerGameCommonOptions . type_hints ]
excluded_option_names . extend ( generic_option_names )
included_option_names : List [ str ] = [ option_name for option_name in self . options_dataclass . type_hints if option_name not in excluded_option_names ]
slot_data = self . options . as_dict ( * included_option_names )
2023-04-10 19:44:59 -04:00
slot_data . update ( {
2024-07-26 05:33:14 -04:00
UNIVERSAL_TRACKER_SEED_PROPERTY : self . seed ,
2024-03-15 15:05:14 +03:00
" seed " : self . random . randrange ( 1000000000 ) , # Seed should be max 9 digits
2023-02-26 19:19:15 -05:00
" randomized_entrances " : self . randomized_entrances ,
2024-03-15 15:05:14 +03:00
" modified_bundles " : bundles ,
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
" client_version " : " 6.0.0 " ,
2023-04-10 19:44:59 -04:00
} )
return slot_data
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 collect ( self , state : CollectionState , item : StardewItem ) - > bool :
change = super ( ) . collect ( state , item )
2024-11-29 19:46:35 -05:00
if not change :
return False
2025-01-18 20:36:01 -05:00
player_state = state . prog_items [ self . player ]
received_progression_count = player_state [ Event . received_progression_item ]
received_progression_count + = 1
if self . total_progression_items :
# Total progression items is not set until all items are created, but collect will be called during the item creation when an item is precollected.
# We can't update the percentage if we don't know the total progression items, can't divide by 0.
player_state [ Event . received_progression_percent ] = received_progression_count * 100 / / self . total_progression_items
player_state [ Event . received_progression_item ] = received_progression_count
2024-11-29 19:46:35 -05:00
walnut_amount = self . get_walnut_amount ( item . name )
if walnut_amount :
2025-01-18 20:36:01 -05:00
player_state [ Event . received_walnuts ] + = walnut_amount
2024-11-29 19:46:35 -05:00
return True
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 remove ( self , state : CollectionState , item : StardewItem ) - > bool :
change = super ( ) . remove ( state , item )
2024-11-29 19:46:35 -05:00
if not change :
return False
2025-01-18 20:36:01 -05:00
player_state = state . prog_items [ self . player ]
received_progression_count = player_state [ Event . received_progression_item ]
received_progression_count - = 1
if self . total_progression_items :
# We can't update the percentage if we don't know the total progression items, can't divide by 0.
player_state [ Event . received_progression_percent ] = received_progression_count * 100 / / self . total_progression_items
player_state [ Event . received_progression_item ] = received_progression_count
2024-11-29 19:46:35 -05:00
walnut_amount = self . get_walnut_amount ( item . name )
if walnut_amount :
2025-01-18 20:36:01 -05:00
player_state [ Event . received_walnuts ] - = walnut_amount
2024-11-29 19:46:35 -05:00
return True
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
@staticmethod
def get_walnut_amount ( item_name : str ) - > int :
if item_name == " Golden Walnut " :
return 1
if item_name == " 3 Golden Walnuts " :
return 3
if item_name == " 5 Golden Walnuts " :
return 5
return 0