From 79e6beeec3fe11e5f7df716d9ddec3847f4755f6 Mon Sep 17 00:00:00 2001 From: agilbert1412 Date: Tue, 14 Jan 2025 12:47:12 -0500 Subject: [PATCH] Stardew Valley: Update Mod Content (#4416) --- worlds/stardew_valley/data/craftable_data.py | 10 +++++++- worlds/stardew_valley/data/locations.csv | 6 ++++- worlds/stardew_valley/locations.py | 9 +++++++- worlds/stardew_valley/options/options.py | 23 +++++++++++-------- .../stardew_valley/strings/craftable_names.py | 4 ++++ .../test/TestNumberLocations.py | 9 ++++---- worlds/stardew_valley/test/__init__.py | 7 ++++++ 7 files changed, 52 insertions(+), 16 deletions(-) diff --git a/worlds/stardew_valley/data/craftable_data.py b/worlds/stardew_valley/data/craftable_data.py index 713db473..1bb4b2be 100644 --- a/worlds/stardew_valley/data/craftable_data.py +++ b/worlds/stardew_valley/data/craftable_data.py @@ -11,7 +11,7 @@ from ..strings.craftable_names import Bomb, Fence, Sprinkler, WildSeeds, Floor, from ..strings.crop_names import Fruit, Vegetable from ..strings.currency_names import Currency from ..strings.fertilizer_names import Fertilizer, RetainingSoil, SpeedGro -from ..strings.fish_names import Fish, WaterItem, ModTrash +from ..strings.fish_names import Fish, WaterItem, ModTrash, Trash from ..strings.flower_names import Flower from ..strings.food_names import Meal from ..strings.forageable_names import Forageable, SVEForage, DistantLandsForageable, Mushroom @@ -378,4 +378,12 @@ recycling_bin = skill_recipe(ModMachine.recycling_bin, ModSkill.binning, 7, {Met advanced_recycling_machine = skill_recipe(ModMachine.advanced_recycling_machine, ModSkill.binning, 9, {MetalBar.iridium: 5, ArtisanGood.battery_pack: 2, MetalBar.quartz: 10}, ModNames.binning_skill) +coppper_slot_machine = skill_recipe(ModMachine.copper_slot_machine, ModSkill.luck, 2, {MetalBar.copper: 15, Material.stone: 1, Material.wood: 1, + Material.fiber: 1, Material.sap: 1, Loot.slime: 1, + Forageable.salmonberry: 1, Material.clay: 1, Trash.joja_cola: 1}, ModNames.luck_skill) + +gold_slot_machine = skill_recipe(ModMachine.gold_slot_machine, ModSkill.luck, 4, {MetalBar.gold: 15, ModMachine.copper_slot_machine: 1}, ModNames.luck_skill) +iridium_slot_machine = skill_recipe(ModMachine.iridium_slot_machine, ModSkill.luck, 4, {MetalBar.iridium: 15, ModMachine.gold_slot_machine: 1}, ModNames.luck_skill) +radioactive_slot_machine = skill_recipe(ModMachine.radioactive_slot_machine, ModSkill.luck, 4, {MetalBar.radioactive: 15, ModMachine.iridium_slot_machine: 1}, ModNames.luck_skill) + all_crafting_recipes_by_name = {recipe.item: recipe for recipe in all_crafting_recipes} diff --git a/worlds/stardew_valley/data/locations.csv b/worlds/stardew_valley/data/locations.csv index 680ddfcb..43883b86 100644 --- a/worlds/stardew_valley/data/locations.csv +++ b/worlds/stardew_valley/data/locations.csv @@ -2935,6 +2935,10 @@ id,region,name,tags,mod_name 7433,Farm,Craft Composter,CRAFTSANITY,Binning Skill 7434,Farm,Craft Recycling Bin,CRAFTSANITY,Binning Skill 7435,Farm,Craft Advanced Recycling Machine,CRAFTSANITY,Binning Skill +7440,Farm,Craft Copper Slot Machine,"CRAFTSANITY",Luck Skill +7441,Farm,Craft Gold Slot Machine,"CRAFTSANITY",Luck Skill +7442,Farm,Craft Iridium Slot Machine,"CRAFTSANITY",Luck Skill +7443,Farm,Craft Radioactive Slot Machine,"CRAFTSANITY",Luck Skill 7451,Adventurer's Guild,Magic Elixir Recipe,"CHEFSANITY,CHEFSANITY_PURCHASE",Magic 7452,Adventurer's Guild,Travel Core Recipe,CRAFTSANITY,Magic 7453,Alesia Shop,Haste Elixir Recipe,CRAFTSANITY,Stardew Valley Expanded @@ -3241,7 +3245,7 @@ id,region,name,tags,mod_name 8199,Shipping,Shipsanity: Hardwood Display,SHIPSANITY,Archaeology 8200,Shipping,Shipsanity: Wooden Display,SHIPSANITY,Archaeology 8201,Shipping,Shipsanity: Dwarf Gadget: Infinite Volcano Simulation,"SHIPSANITY,GINGER_ISLAND",Archaeology -8202,Shipping,Shipsanity: Water Shifter,SHIPSANITY,Archaeology +8202,Shipping,Shipsanity: Water Shifter,"SHIPSANITY,DEPRECATED",Archaeology 8203,Shipping,Shipsanity: Brown Amanita,"SHIPSANITY,SHIPSANITY_FULL_SHIPMENT",Distant Lands - Witch Swamp Overhaul 8204,Shipping,Shipsanity: Swamp Herb,"SHIPSANITY,SHIPSANITY_FULL_SHIPMENT",Distant Lands - Witch Swamp Overhaul 8205,Shipping,Shipsanity: Void Mint Seeds,SHIPSANITY,Distant Lands - Witch Swamp Overhaul diff --git a/worlds/stardew_valley/locations.py b/worlds/stardew_valley/locations.py index b3a8db6f..02c8a544 100644 --- a/worlds/stardew_valley/locations.py +++ b/worlds/stardew_valley/locations.py @@ -110,6 +110,8 @@ class LocationTags(enum.Enum): MAGIC_LEVEL = enum.auto() ARCHAEOLOGY_LEVEL = enum.auto() + DEPRECATED = enum.auto() + @dataclass(frozen=True) class LocationData: @@ -519,6 +521,10 @@ def create_locations(location_collector: StardewLocationCollector, location_collector(location_data.name, location_data.code, location_data.region) +def filter_deprecated_locations(locations: Iterable[LocationData]) -> Iterable[LocationData]: + return [location for location in locations if LocationTags.DEPRECATED not in location.tags] + + def filter_farm_type(options: StardewValleyOptions, locations: Iterable[LocationData]) -> Iterable[LocationData]: # On Meadowlands, "Feeding Animals" replaces "Raising Animals" if options.farm_type == FarmType.option_meadowlands: @@ -549,7 +555,8 @@ def filter_modded_locations(options: StardewValleyOptions, locations: Iterable[L def filter_disabled_locations(options: StardewValleyOptions, content: StardewContent, locations: Iterable[LocationData]) -> Iterable[LocationData]: - locations_farm_filter = filter_farm_type(options, locations) + locations_deprecated_filter = filter_deprecated_locations(locations) + locations_farm_filter = filter_farm_type(options, locations_deprecated_filter) locations_island_filter = filter_ginger_island(options, locations_farm_filter) locations_qi_filter = filter_qi_order_locations(options, locations_island_filter) locations_masteries_filter = filter_masteries_locations(content, locations_qi_filter) diff --git a/worlds/stardew_valley/options/options.py b/worlds/stardew_valley/options/options.py index db949718..f66ec3bd 100644 --- a/worlds/stardew_valley/options/options.py +++ b/worlds/stardew_valley/options/options.py @@ -757,6 +757,14 @@ class Gifting(Toggle): default = 1 +all_mods = {ModNames.deepwoods, ModNames.tractor, ModNames.big_backpack, + ModNames.luck_skill, ModNames.magic, ModNames.socializing_skill, ModNames.archaeology, + ModNames.cooking_skill, ModNames.binning_skill, ModNames.juna, + ModNames.jasper, ModNames.alec, ModNames.yoba, ModNames.eugene, + ModNames.wellwick, ModNames.ginger, ModNames.shiko, ModNames.delores, + ModNames.ayeisha, ModNames.riley, ModNames.skull_cavern_elevator, ModNames.sve, ModNames.distant_lands, + ModNames.alecto, ModNames.lacey, ModNames.boarding_house} + # These mods have been disabled because either they are not updated for the current supported version of Stardew Valley, # or we didn't find the time to validate that they work or fix compatibility issues if they do. # Once a mod is validated to be functional, it can simply be removed from this list @@ -766,8 +774,7 @@ disabled_mods = {ModNames.deepwoods, ModNames.magic, ModNames.wellwick, ModNames.shiko, ModNames.delores, ModNames.riley, ModNames.boarding_house} -if 'unittest' in sys.modules.keys() or 'pytest' in sys.modules.keys(): - disabled_mods = {} +enabled_mods = all_mods.difference(disabled_mods) class Mods(OptionSet): @@ -775,13 +782,11 @@ class Mods(OptionSet): visibility = Visibility.all & ~Visibility.simple_ui internal_name = "mods" display_name = "Mods" - valid_keys = {ModNames.deepwoods, ModNames.tractor, ModNames.big_backpack, - ModNames.luck_skill, ModNames.magic, ModNames.socializing_skill, ModNames.archaeology, - ModNames.cooking_skill, ModNames.binning_skill, ModNames.juna, - ModNames.jasper, ModNames.alec, ModNames.yoba, ModNames.eugene, - ModNames.wellwick, ModNames.ginger, ModNames.shiko, ModNames.delores, - ModNames.ayeisha, ModNames.riley, ModNames.skull_cavern_elevator, ModNames.sve, ModNames.distant_lands, - ModNames.alecto, ModNames.lacey, ModNames.boarding_house}.difference(disabled_mods) + valid_keys = enabled_mods + # In tests, we keep even the disabled mods active, because we expect some of them to eventually get updated for SV 1.6 + # In that case, we want to maintain content and logic for them, and therefore keep testing them + if 'unittest' in sys.modules.keys() or 'pytest' in sys.modules.keys(): + valid_keys = all_mods class BundlePlando(OptionSet): diff --git a/worlds/stardew_valley/strings/craftable_names.py b/worlds/stardew_valley/strings/craftable_names.py index 83445c70..891330c3 100644 --- a/worlds/stardew_valley/strings/craftable_names.py +++ b/worlds/stardew_valley/strings/craftable_names.py @@ -201,6 +201,10 @@ class ModMachine: composter = "Composter" recycling_bin = "Recycling Bin" advanced_recycling_machine = "Advanced Recycling Machine" + copper_slot_machine = "Copper Slot Machine" + gold_slot_machine = "Gold Slot Machine" + iridium_slot_machine = "Iridium Slot Machine" + radioactive_slot_machine = "Radioactive Slot Machine" class ModFloor: diff --git a/worlds/stardew_valley/test/TestNumberLocations.py b/worlds/stardew_valley/test/TestNumberLocations.py index ef552c10..a1c6a967 100644 --- a/worlds/stardew_valley/test/TestNumberLocations.py +++ b/worlds/stardew_valley/test/TestNumberLocations.py @@ -1,5 +1,6 @@ from . import SVTestBase, allsanity_no_mods_6_x_x, \ - allsanity_mods_6_x_x, minimal_locations_maximal_items, minimal_locations_maximal_items_with_island, get_minsanity_options, default_6_x_x + allsanity_mods_6_x_x, minimal_locations_maximal_items, minimal_locations_maximal_items_with_island, get_minsanity_options, default_6_x_x, \ + allsanity_mods_6_x_x_exclude_disabled from .. import location_table from ..items import Group, item_table @@ -70,7 +71,7 @@ class TestAllSanitySettingsHasAllExpectedLocations(SVTestBase): options = allsanity_no_mods_6_x_x() def test_allsanity_without_mods_has_at_least_locations(self): - expected_locations = 2238 + expected_locations = 2256 real_locations = self.get_real_locations() number_locations = len(real_locations) print(f"Stardew Valley - Allsanity Locations without mods: {number_locations}") @@ -83,10 +84,10 @@ class TestAllSanitySettingsHasAllExpectedLocations(SVTestBase): class TestAllSanityWithModsSettingsHasAllExpectedLocations(SVTestBase): - options = allsanity_mods_6_x_x() + options = allsanity_mods_6_x_x_exclude_disabled() def test_allsanity_with_mods_has_at_least_locations(self): - expected_locations = 3096 + expected_locations = 2908 real_locations = self.get_real_locations() number_locations = len(real_locations) print(f"Stardew Valley - Allsanity Locations with all mods: {number_locations}") diff --git a/worlds/stardew_valley/test/__init__.py b/worlds/stardew_valley/test/__init__.py index de0ed978..880a3fda 100644 --- a/worlds/stardew_valley/test/__init__.py +++ b/worlds/stardew_valley/test/__init__.py @@ -13,6 +13,7 @@ from .assertion import RuleAssertMixin from .options.utils import fill_namespace_with_default, parse_class_option_keys, fill_dataclass_with_default from .. import StardewValleyWorld, options, StardewItem from ..options import StardewValleyOption +from ..options.options import enabled_mods logger = logging.getLogger(__name__) @@ -98,6 +99,12 @@ def allsanity_mods_6_x_x(): return allsanity +def allsanity_mods_6_x_x_exclude_disabled(): + allsanity = allsanity_no_mods_6_x_x() + allsanity.update({options.Mods.internal_name: frozenset(enabled_mods)}) + return allsanity + + def get_minsanity_options(): return { options.ArcadeMachineLocations.internal_name: options.ArcadeMachineLocations.option_disabled,