Skip to content

Commit

Permalink
Merge branch 'main' into py312
Browse files Browse the repository at this point in the history
  • Loading branch information
black-sliver authored Jul 22, 2024
2 parents fb542ce + 9c2933f commit c83aed0
Show file tree
Hide file tree
Showing 39 changed files with 426 additions and 323 deletions.
14 changes: 7 additions & 7 deletions UndertaleClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _cmd_resync(self):
def _cmd_patch(self):
"""Patch the game. Only use this command if /auto_patch fails."""
if isinstance(self.ctx, UndertaleContext):
os.makedirs(name=os.path.join(os.getcwd(), "Undertale"), exist_ok=True)
os.makedirs(name=Utils.user_path("Undertale"), exist_ok=True)
self.ctx.patch_game()
self.output("Patched.")

Expand All @@ -43,7 +43,7 @@ def _cmd_savepath(self, directory: str):
def _cmd_auto_patch(self, steaminstall: typing.Optional[str] = None):
"""Patch the game automatically."""
if isinstance(self.ctx, UndertaleContext):
os.makedirs(name=os.path.join(os.getcwd(), "Undertale"), exist_ok=True)
os.makedirs(name=Utils.user_path("Undertale"), exist_ok=True)
tempInstall = steaminstall
if not os.path.isfile(os.path.join(tempInstall, "data.win")):
tempInstall = None
Expand All @@ -62,7 +62,7 @@ def _cmd_auto_patch(self, steaminstall: typing.Optional[str] = None):
for file_name in os.listdir(tempInstall):
if file_name != "steam_api.dll":
shutil.copy(os.path.join(tempInstall, file_name),
os.path.join(os.getcwd(), "Undertale", file_name))
Utils.user_path("Undertale", file_name))
self.ctx.patch_game()
self.output("Patching successful!")

Expand Down Expand Up @@ -111,12 +111,12 @@ def __init__(self, server_address, password):
self.save_game_folder = os.path.expandvars(r"%localappdata%/UNDERTALE")

def patch_game(self):
with open(os.path.join(os.getcwd(), "Undertale", "data.win"), "rb") as f:
with open(Utils.user_path("Undertale", "data.win"), "rb") as f:
patchedFile = bsdiff4.patch(f.read(), undertale.data_path("patch.bsdiff"))
with open(os.path.join(os.getcwd(), "Undertale", "data.win"), "wb") as f:
with open(Utils.user_path("Undertale", "data.win"), "wb") as f:
f.write(patchedFile)
os.makedirs(name=os.path.join(os.getcwd(), "Undertale", "Custom Sprites"), exist_ok=True)
with open(os.path.expandvars(os.path.join(os.getcwd(), "Undertale", "Custom Sprites",
os.makedirs(name=Utils.user_path("Undertale", "Custom Sprites"), exist_ok=True)
with open(os.path.expandvars(Utils.user_path("Undertale", "Custom Sprites",
"Which Character.txt")), "w") as f:
f.writelines(["// Put the folder name of the sprites you want to play as, make sure it is the only "
"line other than this one.\n", "frisk"])
Expand Down
2 changes: 2 additions & 0 deletions WebHostLib/customserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,12 @@ def _done(self, task: asyncio.Future):
def run(self):
while 1:
next_room = rooms_to_run.get(block=True, timeout=None)
gc.collect(0)
task = asyncio.run_coroutine_threadsafe(start_room(next_room), loop)
self._tasks.append(task)
task.add_done_callback(self._done)
logging.info(f"Starting room {next_room} on {name}.")
del task # delete reference to task object

starter = Starter()
starter.daemon = True
Expand Down
6 changes: 5 additions & 1 deletion kvui.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,8 @@ def command_button_action(self, button):
"!help for server commands.")

def connect_button_action(self, button):
self.ctx.username = None
if self.ctx.server:
self.ctx.username = None
async_start(self.ctx.disconnect())
else:
async_start(self.ctx.connect(self.server_connect_bar.text.replace("/connect ", "")))
Expand Down Expand Up @@ -836,6 +836,10 @@ def _handle_color(self, node: JSONMessagePart):
return self._handle_text(node)

def _handle_text(self, node: JSONMessagePart):
# All other text goes through _handle_color, and we don't want to escape markup twice,
# or mess up text that already has intentional markup applied to it
if node.get("type", "text") == "text":
node["text"] = escape_markup(node["text"])
for ref in node.get("refs", []):
node["text"] = f"[ref={self.ref_count}|{ref}]{node['text']}[/ref]"
self.ref_count += 1
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# This is a bit jank. We need cx-Freeze to be able to run anything from this script, so install it
try:
requirement = 'cx-Freeze==7.0.0'
requirement = 'cx-Freeze==7.2.0'
import pkg_resources
try:
pkg_resources.require(requirement)
Expand Down
3 changes: 3 additions & 0 deletions worlds/ahit/Regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@
# See above comment
"Time Rift - Deep Sea": ["Alpine Free Roam", "Nyakuza Free Roam", "Contractual Obligations",
"Murder on the Owl Express"],

# was causing test failures
"Time Rift - Balcony": ["Alpine Free Roam"],
}


Expand Down
3 changes: 3 additions & 0 deletions worlds/ahit/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,8 @@ def set_rift_rules(world: "HatInTimeWorld", regions: Dict[str, Region]):
if world.is_dlc1():
for entrance in regions["Time Rift - Balcony"].entrances:
add_rule(entrance, lambda state: can_clear_required_act(state, world, "The Arctic Cruise - Finale"))
reg_act_connection(world, world.multiworld.get_entrance("The Arctic Cruise - Finale",
world.player).connected_region, entrance)

for entrance in regions["Time Rift - Deep Sea"].entrances:
add_rule(entrance, lambda state: has_relic_combo(state, world, "Cake"))
Expand Down Expand Up @@ -939,6 +941,7 @@ def set_default_rift_rules(world: "HatInTimeWorld"):
if world.is_dlc1():
for entrance in world.multiworld.get_region("Time Rift - Balcony", world.player).entrances:
add_rule(entrance, lambda state: can_clear_required_act(state, world, "The Arctic Cruise - Finale"))
reg_act_connection(world, "Rock the Boat", entrance.name)

for entrance in world.multiworld.get_region("Time Rift - Deep Sea", world.player).entrances:
add_rule(entrance, lambda state: has_relic_combo(state, world, "Cake"))
Expand Down
2 changes: 1 addition & 1 deletion worlds/alttp/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def global_rules(multiworld: MultiWorld, player: int):
set_rule(multiworld.get_location('Turtle Rock - Roller Room - Right', player), lambda state: state.has('Cane of Somaria', player) and state.has('Fire Rod', player))
set_rule(multiworld.get_location('Turtle Rock - Big Chest', player), lambda state: state.has('Big Key (Turtle Rock)', player) and (state.has('Cane of Somaria', player) or state.has('Hookshot', player)))
set_rule(multiworld.get_entrance('Turtle Rock (Big Chest) (North)', player), lambda state: state.has('Cane of Somaria', player) or state.has('Hookshot', player))
set_rule(multiworld.get_entrance('Turtle Rock Big Key Door', player), lambda state: state.has('Big Key (Turtle Rock)', player) and can_kill_most_things(state, player, 10))
set_rule(multiworld.get_entrance('Turtle Rock Big Key Door', player), lambda state: state.has('Big Key (Turtle Rock)', player) and can_kill_most_things(state, player, 10) and can_bomb_or_bonk(state, player))
set_rule(multiworld.get_location('Turtle Rock - Chain Chomps', player), lambda state: can_use_bombs(state, player) or can_shoot_arrows(state, player)
or has_beam_sword(state, player) or state.has_any(["Blue Boomerang", "Red Boomerang", "Hookshot", "Cane of Somaria", "Fire Rod", "Ice Rod"], player))
set_rule(multiworld.get_entrance('Turtle Rock (Dark Room) (North)', player), lambda state: state.has('Cane of Somaria', player))
Expand Down
2 changes: 1 addition & 1 deletion worlds/bomb_rush_cyberfunk/Locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ class EventDict(TypedDict):
'game_id': "graf385"},
{'name': "Tagged 389 Graffiti Spots",
'stage': Stages.Misc,
'game_id': "graf379"},
'game_id': "graf389"},
]


Expand Down
1 change: 0 additions & 1 deletion worlds/lingo/data/LL1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3265,7 +3265,6 @@
door: Traveled Entrance
Color Hallways:
door: Color Hallways Entrance
warp: True
panels:
Achievement:
id: Countdown Panels/Panel_traveled_traveled
Expand Down
Binary file modified worlds/lingo/data/generated.dat
Binary file not shown.
2 changes: 1 addition & 1 deletion worlds/lingo/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def create_regions(world: "LingoWorld") -> None:
RoomAndDoor("Pilgrim Antechamber", "Sun Painting"), EntranceType.PAINTING, False, world)

if early_color_hallways:
connect_entrance(regions, regions["Starting Room"], regions["Outside The Undeterred"], "Early Color Hallways",
connect_entrance(regions, regions["Starting Room"], regions["Color Hallways"], "Early Color Hallways",
None, EntranceType.PAINTING, False, world)

if painting_shuffle:
Expand Down
8 changes: 4 additions & 4 deletions worlds/pokemon_emerald/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ def get_location(location: str):
get_location("NPC_GIFT_GOT_BASEMENT_KEY_FROM_WATTSON"),
lambda state: state.has("EVENT_DEFEAT_NORMAN", world.player)
)
set_rule(
get_location("NPC_GIFT_RECEIVED_COIN_CASE"),
lambda state: state.has("EVENT_BUY_HARBOR_MAIL", world.player)
)

# Route 117
set_rule(
Expand Down Expand Up @@ -1638,10 +1642,6 @@ def get_location(location: str):
get_location("NPC_GIFT_GOT_TM_THUNDERBOLT_FROM_WATTSON"),
lambda state: state.has("EVENT_DEFEAT_NORMAN", world.player) and state.has("EVENT_TURN_OFF_GENERATOR", world.player)
)
set_rule(
get_location("NPC_GIFT_RECEIVED_COIN_CASE"),
lambda state: state.has("EVENT_BUY_HARBOR_MAIL", world.player)
)

# Fallarbor Town
set_rule(
Expand Down
31 changes: 17 additions & 14 deletions worlds/raft/Options.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from Options import Range, Toggle, DefaultOnToggle, Choice, DeathLink
from dataclasses import dataclass
from Options import Range, Toggle, DefaultOnToggle, Choice, DeathLink, PerGameCommonOptions

class MinimumResourcePackAmount(Range):
"""The minimum amount of resources available in a resource pack"""
Expand Down Expand Up @@ -47,6 +48,8 @@ class IslandFrequencyLocations(Choice):
option_progressive = 4
option_anywhere = 5
default = 2
def is_filling_frequencies_in_world(self):
return self.value <= self.option_random_on_island_random_order

class IslandGenerationDistance(Choice):
"""Sets how far away islands spawn from you when you input their coordinates into the Receiver."""
Expand Down Expand Up @@ -76,16 +79,16 @@ class PaddleboardMode(Toggle):
"""Sets later story islands to be in logic without an Engine or Steering Wheel. May require lots of paddling."""
display_name = "Paddleboard Mode"

raft_options = {
"minimum_resource_pack_amount": MinimumResourcePackAmount,
"maximum_resource_pack_amount": MaximumResourcePackAmount,
"duplicate_items": DuplicateItems,
"filler_item_types": FillerItemTypes,
"island_frequency_locations": IslandFrequencyLocations,
"island_generation_distance": IslandGenerationDistance,
"expensive_research": ExpensiveResearch,
"progressive_items": ProgressiveItems,
"big_island_early_crafting": BigIslandEarlyCrafting,
"paddleboard_mode": PaddleboardMode,
"death_link": DeathLink
}
@dataclass
class RaftOptions(PerGameCommonOptions):
minimum_resource_pack_amount: MinimumResourcePackAmount
maximum_resource_pack_amount: MaximumResourcePackAmount
duplicate_items: DuplicateItems
filler_item_types: FillerItemTypes
island_frequency_locations: IslandFrequencyLocations
island_generation_distance: IslandGenerationDistance
expensive_research: ExpensiveResearch
progressive_items: ProgressiveItems
big_island_early_crafting: BigIslandEarlyCrafting
paddleboard_mode: PaddleboardMode
death_link: DeathLink
4 changes: 2 additions & 2 deletions worlds/raft/Rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

class RaftLogic(LogicMixin):
def raft_paddleboard_mode_enabled(self, player):
return self.multiworld.paddleboard_mode[player].value
return bool(self.multiworld.worlds[player].options.paddleboard_mode)

def raft_big_islands_available(self, player):
return self.multiworld.big_island_early_crafting[player].value or self.raft_can_access_radio_tower(player)
return bool(self.multiworld.worlds[player].options.big_island_early_crafting) or self.raft_can_access_radio_tower(player)

def raft_can_smelt_items(self, player):
return self.has("Smelter", player)
Expand Down
Loading

0 comments on commit c83aed0

Please sign in to comment.