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:
@@ -1,10 +1,10 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import List, Tuple, Optional, Dict, Callable, Set
|
||||
from typing import Tuple, Optional
|
||||
|
||||
from ..mods.mod_data import ModNames
|
||||
from ..strings.food_names import Beverage
|
||||
from ..strings.generic_names import Generic
|
||||
from ..strings.region_names import Region, SVERegion, AlectoRegion, BoardingHouseRegion, LaceyRegion
|
||||
from ..strings.region_names import Region, SVERegion, AlectoRegion, BoardingHouseRegion, LaceyRegion, LogicRegion
|
||||
from ..strings.season_names import Season
|
||||
from ..strings.villager_names import NPC, ModNPC
|
||||
|
||||
@@ -36,7 +36,7 @@ carpenter = (Region.carpenter,)
|
||||
alex_house = (Region.alex_house,)
|
||||
elliott_house = (Region.elliott_house,)
|
||||
ranch = (Region.ranch,)
|
||||
mines_dwarf_shop = (Region.mines_dwarf_shop,)
|
||||
mines_dwarf_shop = (LogicRegion.mines_dwarf_shop,)
|
||||
desert = (Region.desert,)
|
||||
oasis = (Region.oasis,)
|
||||
sewers = (Region.sewer,)
|
||||
@@ -355,28 +355,10 @@ scarlett_loves = goat_cheese + duck_feather + goat_milk + cherry + maple_syrup +
|
||||
susan_loves = pancakes + chocolate_cake + pink_cake + ice_cream + cookie + pumpkin_pie + rhubarb_pie + \
|
||||
blueberry_tart + blackberry_cobbler + cranberry_candy + red_plate
|
||||
|
||||
all_villagers: List[Villager] = []
|
||||
villager_modifications_by_mod: Dict[str, Dict[str, Callable[[str, Villager], Villager]]] = {}
|
||||
|
||||
|
||||
def villager(name: str, bachelor: bool, locations: Tuple[str, ...], birthday: str, gifts: Tuple[str, ...],
|
||||
available: bool, mod_name: Optional[str] = None) -> Villager:
|
||||
npc = Villager(name, bachelor, locations, birthday, gifts, available, mod_name)
|
||||
all_villagers.append(npc)
|
||||
return npc
|
||||
|
||||
|
||||
def adapt_wizard_to_sve(mod_name: str, npc: Villager):
|
||||
if npc.mod_name:
|
||||
mod_name = npc.mod_name
|
||||
# The wizard leaves his tower on sunday, for like 1 hour... Good enough to meet him!
|
||||
return Villager(npc.name, True, npc.locations + forest, npc.birthday, npc.gifts, npc.available, mod_name)
|
||||
|
||||
|
||||
def register_villager_modification(mod_name: str, npc: Villager, modification_function):
|
||||
if mod_name not in villager_modifications_by_mod:
|
||||
villager_modifications_by_mod[mod_name] = {}
|
||||
villager_modifications_by_mod[mod_name][npc.name] = modification_function
|
||||
return Villager(name, bachelor, locations, birthday, gifts, available, mod_name)
|
||||
|
||||
|
||||
josh = villager(NPC.alex, True, town + alex_house, Season.summer, universal_loves + complete_breakfast + salmon_dinner, True)
|
||||
@@ -385,18 +367,18 @@ harvey = villager(NPC.harvey, True, town + hospital, Season.winter, universal_lo
|
||||
sam = villager(NPC.sam, True, town, Season.summer, universal_loves + sam_loves, True)
|
||||
sebastian = villager(NPC.sebastian, True, carpenter, Season.winter, universal_loves + sebastian_loves, True)
|
||||
shane = villager(NPC.shane, True, ranch, Season.spring, universal_loves + shane_loves, True)
|
||||
best_girl = villager(NPC.abigail, True, town, Season.fall, universal_loves + abigail_loves, True)
|
||||
abigail = villager(NPC.abigail, True, town, Season.fall, universal_loves + abigail_loves, True)
|
||||
emily = villager(NPC.emily, True, town, Season.spring, universal_loves + emily_loves, True)
|
||||
hoe = villager(NPC.haley, True, town, Season.spring, universal_loves_no_prismatic_shard + haley_loves, True)
|
||||
haley = villager(NPC.haley, True, town, Season.spring, universal_loves_no_prismatic_shard + haley_loves, True)
|
||||
leah = villager(NPC.leah, True, forest, Season.winter, universal_loves + leah_loves, True)
|
||||
nerd = villager(NPC.maru, True, carpenter + hospital + town, Season.summer, universal_loves + maru_loves, True)
|
||||
maru = villager(NPC.maru, True, carpenter + hospital + town, Season.summer, universal_loves + maru_loves, True)
|
||||
penny = villager(NPC.penny, True, town, Season.fall, universal_loves_no_rabbit_foot + penny_loves, True)
|
||||
caroline = villager(NPC.caroline, False, town, Season.winter, universal_loves + caroline_loves, True)
|
||||
clint = villager(NPC.clint, False, town, Season.winter, universal_loves + clint_loves, True)
|
||||
demetrius = villager(NPC.demetrius, False, carpenter, Season.summer, universal_loves + demetrius_loves, True)
|
||||
dwarf = villager(NPC.dwarf, False, mines_dwarf_shop, Season.summer, universal_loves + dwarf_loves, False)
|
||||
gilf = villager(NPC.evelyn, False, town, Season.winter, universal_loves + evelyn_loves, True)
|
||||
boomer = villager(NPC.george, False, town, Season.fall, universal_loves + george_loves, True)
|
||||
evelyn = villager(NPC.evelyn, False, town, Season.winter, universal_loves + evelyn_loves, True)
|
||||
george = villager(NPC.george, False, town, Season.fall, universal_loves + george_loves, True)
|
||||
gus = villager(NPC.gus, False, town, Season.summer, universal_loves + gus_loves, True)
|
||||
jas = villager(NPC.jas, False, ranch, Season.summer, universal_loves + jas_loves, True)
|
||||
jodi = villager(NPC.jodi, False, town, Season.fall, universal_loves + jodi_loves, True)
|
||||
@@ -408,7 +390,7 @@ linus = villager(NPC.linus, False, mountain, Season.winter, universal_loves + li
|
||||
marnie = villager(NPC.marnie, False, ranch, Season.fall, universal_loves + marnie_loves, True)
|
||||
pam = villager(NPC.pam, False, town, Season.spring, universal_loves + pam_loves, True)
|
||||
pierre = villager(NPC.pierre, False, town, Season.spring, universal_loves + pierre_loves, True)
|
||||
milf = villager(NPC.robin, False, carpenter, Season.fall, universal_loves + robin_loves, True)
|
||||
robin = villager(NPC.robin, False, carpenter, Season.fall, universal_loves + robin_loves, True)
|
||||
sandy = villager(NPC.sandy, False, oasis, Season.fall, universal_loves + sandy_loves, False)
|
||||
vincent = villager(NPC.vincent, False, town, Season.spring, universal_loves + vincent_loves, True)
|
||||
willy = villager(NPC.willy, False, beach, Season.summer, universal_loves + willy_loves, True)
|
||||
@@ -443,54 +425,10 @@ sophia = villager(ModNPC.sophia, True, bluemoon, Season.winter, universal_loves_
|
||||
victor = villager(ModNPC.victor, True, town, Season.summer, universal_loves + victor_loves, True, ModNames.sve)
|
||||
andy = villager(ModNPC.andy, False, forest, Season.spring, universal_loves + andy_loves, True, ModNames.sve)
|
||||
apples = villager(ModNPC.apples, False, aurora + junimo, Generic.any, starfruit, False, ModNames.sve)
|
||||
gunther = villager(ModNPC.gunther, False, museum, Season.winter, universal_loves + gunther_loves, True, ModNames.jasper_sve)
|
||||
gunther = villager(ModNPC.gunther, False, museum, Season.winter, universal_loves + gunther_loves, True, ModNames.sve)
|
||||
martin = villager(ModNPC.martin, False, town + jojamart, Season.summer, universal_loves + martin_loves, True, ModNames.sve)
|
||||
marlon = villager(ModNPC.marlon, False, adventurer, Season.winter, universal_loves + marlon_loves, False, ModNames.jasper_sve)
|
||||
marlon = villager(ModNPC.marlon, False, adventurer, Season.winter, universal_loves + marlon_loves, False, ModNames.sve)
|
||||
morgan = villager(ModNPC.morgan, False, forest, Season.fall, universal_loves_no_rabbit_foot + morgan_loves, False, ModNames.sve)
|
||||
scarlett = villager(ModNPC.scarlett, False, bluemoon, Season.summer, universal_loves + scarlett_loves, False, ModNames.sve)
|
||||
susan = villager(ModNPC.susan, False, railroad, Season.fall, universal_loves + susan_loves, False, ModNames.sve)
|
||||
morris = villager(ModNPC.morris, False, jojamart, Season.spring, universal_loves + morris_loves, True, ModNames.sve)
|
||||
|
||||
# Modified villagers; not included in all villagers
|
||||
|
||||
register_villager_modification(ModNames.sve, wizard, adapt_wizard_to_sve)
|
||||
|
||||
all_villagers_by_name: Dict[str, Villager] = {villager.name: villager for villager in all_villagers}
|
||||
all_villagers_by_mod: Dict[str, List[Villager]] = {}
|
||||
all_villagers_by_mod_by_name: Dict[str, Dict[str, Villager]] = {}
|
||||
|
||||
for npc in all_villagers:
|
||||
mod = npc.mod_name
|
||||
name = npc.name
|
||||
if mod in all_villagers_by_mod:
|
||||
all_villagers_by_mod[mod].append(npc)
|
||||
all_villagers_by_mod_by_name[mod][name] = npc
|
||||
else:
|
||||
all_villagers_by_mod[mod] = [npc]
|
||||
all_villagers_by_mod_by_name[mod] = {}
|
||||
all_villagers_by_mod_by_name[mod][name] = npc
|
||||
|
||||
|
||||
def villager_included_for_any_mod(npc: Villager, mods: Set[str]):
|
||||
if not npc.mod_name:
|
||||
return True
|
||||
for mod in npc.mod_name.split(","):
|
||||
if mod in mods:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_villagers_for_mods(mods: Set[str]) -> List[Villager]:
|
||||
villagers_for_current_mods = []
|
||||
for npc in all_villagers:
|
||||
if not villager_included_for_any_mod(npc, mods):
|
||||
continue
|
||||
modified_npc = npc
|
||||
for active_mod in mods:
|
||||
if (active_mod not in villager_modifications_by_mod or
|
||||
npc.name not in villager_modifications_by_mod[active_mod]):
|
||||
continue
|
||||
modification = villager_modifications_by_mod[active_mod][npc.name]
|
||||
modified_npc = modification(active_mod, modified_npc)
|
||||
villagers_for_current_mods.append(modified_npc)
|
||||
return villagers_for_current_mods
|
||||
|
||||
Reference in New Issue
Block a user