Skip to content

Commit

Permalink
add coops to content packs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouramie committed Oct 14, 2024
1 parent 87b3984 commit d0a56db
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
1 change: 1 addition & 0 deletions worlds/stardew_valley/content/game_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class StardewContent:
game_items: Dict[str, GameItem] = field(default_factory=dict)
fishes: Dict[str, FishItem] = field(default_factory=dict)
villagers: Dict[str, Villager] = field(default_factory=dict)
farm_buildings: Dict[str, Building] = field(default_factory=dict)
skills: Dict[str, Skill] = field(default_factory=dict)
quests: Dict[str, Any] = field(default_factory=dict)

Expand Down
4 changes: 4 additions & 0 deletions worlds/stardew_valley/content/unpacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def register_pack(content: StardewContent, pack: ContentPack):
content.villagers[villager.name] = villager
pack.villager_hook(content)

for building in pack.farm_buildings:
content.farm_buildings[building.name] = building
pack.farm_building_hook(content)

for skill in pack.skills:
content.skills[skill.name] = skill
pack.skill_hook(content)
Expand Down
37 changes: 37 additions & 0 deletions worlds/stardew_valley/content/vanilla/pelican_town.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from ..game_content import ContentPack
from ...data import villagers_data, fish_data
from ...data.building import Building
from ...data.game_item import GenericSource, ItemTag, Tag, CustomRuleSource
from ...data.harvest import ForagingSource, SeasonalForagingSource, ArtifactSpotSource
from ...data.requirement import ToolRequirement, BookRequirement, SkillRequirement, RegionRequirement
from ...data.shop import ShopSource, MysteryBoxSource, ArtifactTroveSource, PrizeMachineSource, FishingTreasureChestSource
from ...strings.book_names import Book
from ...strings.building_names import Building as BuildingNames
from ...strings.crop_names import Fruit
from ...strings.fish_names import WaterItem
from ...strings.food_names import Beverage, Meal
Expand Down Expand Up @@ -385,5 +387,40 @@
villagers_data.vincent,
villagers_data.willy,
villagers_data.wizard,
),
farm_buildings=(
Building(
BuildingNames.coop,
sources=(
ShopSource(
shop_region=Region.carpenter,
money_price=4000,
items_price=((300, Material.wood), (100, Material.stone))
),
# TODO add source for meadowslands farm
),
),
Building(
BuildingNames.big_coop,
sources=(
ShopSource(
shop_region=Region.carpenter,
money_price=10_000,
items_price=((400, Material.wood), (150, Material.stone))
),
),
upgrade_from=BuildingNames.coop,
),
Building(
BuildingNames.deluxe_coop,
sources=(
ShopSource(
shop_region=Region.carpenter,
money_price=20_000,
items_price=((500, Material.wood), (200, Material.stone))
),
),
upgrade_from=BuildingNames.big_coop,
),
)
)
8 changes: 4 additions & 4 deletions worlds/stardew_valley/data/building.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from dataclasses import dataclass
from dataclasses import dataclass, field
from typing import Optional, Tuple

from .game_item import Source
from .game_item import Source, kw_only


@dataclass(frozen=True)
class Building:
name: str
sources: Tuple[Source, ...]
upgrade_from: Optional[str] = None
sources: Tuple[Source, ...] = field(**kw_only)
upgrade_from: Optional[str] = field(default=None, **kw_only)

0 comments on commit d0a56db

Please sign in to comment.