Stardew Valley: Generate proper filler for item links (#2069)

Co-authored-by: Zach Parks <zach@alliware.com>
This commit is contained in:
agilbert1412
2023-11-22 11:04:33 -05:00
committed by GitHub
parent cfd2e9c47f
commit 0f98cf525f
4 changed files with 150 additions and 14 deletions

View File

@@ -468,10 +468,6 @@ def fill_with_resource_packs_and_traps(item_factory: StardewItemFactory, options
items_already_added: List[Item],
number_locations: int) -> List[Item]:
include_traps = options.trap_items != TrapItems.option_no_traps
all_filler_packs = [pack for pack in items_by_group[Group.RESOURCE_PACK]]
all_filler_packs.extend(items_by_group[Group.TRASH])
if include_traps:
all_filler_packs.extend(items_by_group[Group.TRAP])
items_already_added_names = [item.name for item in items_already_added]
useful_resource_packs = [pack for pack in items_by_group[Group.RESOURCE_PACK_USEFUL]
if pack.name not in items_already_added_names]
@@ -484,8 +480,9 @@ def fill_with_resource_packs_and_traps(item_factory: StardewItemFactory, options
if include_traps:
priority_filler_items.extend(trap_items)
all_filler_packs = remove_excluded_packs(all_filler_packs, options)
priority_filler_items = remove_excluded_packs(priority_filler_items, options)
exclude_ginger_island = options.exclude_ginger_island == ExcludeGingerIsland.option_true
all_filler_packs = get_all_filler_items(include_traps, exclude_ginger_island)
priority_filler_items = remove_excluded_packs(priority_filler_items, exclude_ginger_island)
number_priority_items = len(priority_filler_items)
required_resource_pack = number_locations - len(items_already_added)
@@ -519,8 +516,21 @@ def fill_with_resource_packs_and_traps(item_factory: StardewItemFactory, options
return items
def remove_excluded_packs(packs, options: StardewValleyOptions):
def remove_excluded_packs(packs, exclude_ginger_island: bool):
included_packs = [pack for pack in packs if Group.DEPRECATED not in pack.groups]
if options.exclude_ginger_island == ExcludeGingerIsland.option_true:
if exclude_ginger_island:
included_packs = [pack for pack in included_packs if Group.GINGER_ISLAND not in pack.groups]
return included_packs
def remove_limited_amount_packs(packs):
return [pack for pack in packs if Group.MAXIMUM_ONE not in pack.groups and Group.EXACTLY_TWO not in pack.groups]
def get_all_filler_items(include_traps: bool, exclude_ginger_island: bool):
all_filler_packs = [pack for pack in items_by_group[Group.RESOURCE_PACK]]
all_filler_packs.extend(items_by_group[Group.TRASH])
if include_traps:
all_filler_packs.extend(items_by_group[Group.TRAP])
all_filler_packs = remove_excluded_packs(all_filler_packs, exclude_ginger_island)
return all_filler_packs