Skip to content

Commit

Permalink
Merge pull request #10 from ArchipelagoMW/main
Browse files Browse the repository at this point in the history
Merge main into branch
  • Loading branch information
GodlFire authored Apr 2, 2024
2 parents 8477d3c + 5e57920 commit 630a3bd
Show file tree
Hide file tree
Showing 241 changed files with 19,132 additions and 2,970 deletions.
2 changes: 1 addition & 1 deletion CommonClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,13 +643,13 @@ async def server_loop(ctx: CommonContext, address: typing.Optional[str] = None)
ctx.username = server_url.username
if server_url.password:
ctx.password = server_url.password
port = server_url.port or 38281

def reconnect_hint() -> str:
return ", type /connect to reconnect" if ctx.server_address else ""

logger.info(f'Connecting to Archipelago server at {address}')
try:
port = server_url.port or 38281 # raises ValueError if invalid
socket = await websockets.connect(address, port=port, ping_timeout=None, ping_interval=None,
ssl=get_ssl_context() if address.startswith("wss://") else None)
if ctx.ui is not None:
Expand Down
33 changes: 24 additions & 9 deletions Fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,16 @@ def fill_restrictive(multiworld: MultiWorld, base_state: CollectionState, locati
# There are leftover unplaceable items and locations that won't accept them
if multiworld.can_beat_game():
logging.warning(
f'Not all items placed. Game beatable anyway. (Could not place {unplaced_items})')
f"Not all items placed. Game beatable anyway.\nCould not place:\n"
f"{', '.join(str(item) for item in unplaced_items)}")
else:
raise FillError(f'No more spots to place {unplaced_items}, locations {locations} are invalid. '
f'Already placed {len(placements)}: {", ".join(str(place) for place in placements)}')
raise FillError(f"No more spots to place {len(unplaced_items)} items. Remaining locations are invalid.\n"
f"Unplaced items:\n"
f"{', '.join(str(item) for item in unplaced_items)}\n"
f"Unfilled locations:\n"
f"{', '.join(str(location) for location in locations)}\n"
f"Already placed {len(placements)}:\n"
f"{', '.join(str(place) for place in placements)}")

item_pool.extend(unplaced_items)

Expand Down Expand Up @@ -273,8 +279,13 @@ def remaining_fill(multiworld: MultiWorld,

if unplaced_items and locations:
# There are leftover unplaceable items and locations that won't accept them
raise FillError(f'No more spots to place {unplaced_items}, locations {locations} are invalid. '
f'Already placed {len(placements)}: {", ".join(str(place) for place in placements)}')
raise FillError(f"No more spots to place {len(unplaced_items)} items. Remaining locations are invalid.\n"
f"Unplaced items:\n"
f"{', '.join(str(item) for item in unplaced_items)}\n"
f"Unfilled locations:\n"
f"{', '.join(str(location) for location in locations)}\n"
f"Already placed {len(placements)}:\n"
f"{', '.join(str(place) for place in placements)}")

itempool.extend(unplaced_items)

Expand Down Expand Up @@ -457,7 +468,9 @@ def mark_for_locking(location: Location):
fill_restrictive(multiworld, multiworld.state, defaultlocations, progitempool, name="Progression")
if progitempool:
raise FillError(
f'Not enough locations for progress items. There are {len(progitempool)} more items than locations')
f"Not enough locations for progression items. "
f"There are {len(progitempool)} more progression items than there are available locations."
)
accessibility_corrections(multiworld, multiworld.state, defaultlocations)

for location in lock_later:
Expand All @@ -470,7 +483,9 @@ def mark_for_locking(location: Location):
remaining_fill(multiworld, excludedlocations, filleritempool, "Remaining Excluded")
if excludedlocations:
raise FillError(
f"Not enough filler items for excluded locations. There are {len(excludedlocations)} more locations than items")
f"Not enough filler items for excluded locations. "
f"There are {len(excludedlocations)} more excluded locations than filler or trap items."
)

restitempool = filleritempool + usefulitempool

Expand All @@ -481,13 +496,13 @@ def mark_for_locking(location: Location):

if unplaced or unfilled:
logging.warning(
f'Unplaced items({len(unplaced)}): {unplaced} - Unfilled Locations({len(unfilled)}): {unfilled}')
f"Unplaced items({len(unplaced)}): {unplaced} - Unfilled Locations({len(unfilled)}): {unfilled}")
items_counter = Counter(location.item.player for location in multiworld.get_locations() if location.item)
locations_counter = Counter(location.player for location in multiworld.get_locations())
items_counter.update(item.player for item in unplaced)
locations_counter.update(location.player for location in unfilled)
print_data = {"items": items_counter, "locations": locations_counter}
logging.info(f'Per-Player counts: {print_data})')
logging.info(f"Per-Player counts: {print_data})")


def flood_items(multiworld: MultiWorld) -> None:
Expand Down
7 changes: 6 additions & 1 deletion Generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from worlds.alttp.Text import TextTable
from worlds.AutoWorld import AutoWorldRegister
from worlds.generic import PlandoConnection
from worlds import failed_world_loads


def mystery_argparse():
Expand Down Expand Up @@ -458,7 +459,11 @@ def roll_settings(weights: dict, plando_options: PlandoOptions = PlandoOptions.b

ret.game = get_choice("game", weights)
if ret.game not in AutoWorldRegister.world_types:
picks = Utils.get_fuzzy_results(ret.game, AutoWorldRegister.world_types, limit=1)[0]
picks = Utils.get_fuzzy_results(ret.game, list(AutoWorldRegister.world_types) + failed_world_loads, limit=1)[0]
if picks[0] in failed_world_loads:
raise Exception(f"No functional world found to handle game {ret.game}. "
f"Did you mean '{picks[0]}' ({picks[1]}% sure)? "
f"If so, it appears the world failed to initialize correctly.")
raise Exception(f"No world found to handle game {ret.game}. Did you mean '{picks[0]}' ({picks[1]}% sure)? "
f"Check your spelling or installation of that world.")

Expand Down
2 changes: 1 addition & 1 deletion Launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def update_settings():
# Functions
Component("Open host.yaml", func=open_host_yaml),
Component("Open Patch", func=open_patch),
Component("Generate Template Settings", func=generate_yamls),
Component("Generate Template Options", func=generate_yamls),
Component("Discord Server", icon="discord", func=lambda: webbrowser.open("https://discord.gg/8Z65BR2")),
Component("18+ Discord Server", icon="discord", func=lambda: webbrowser.open("https://discord.gg/fqvNCCRsu4")),
Component("Browse Files", func=browse_files),
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Currently, the following games are supported:
* Kirby's Dream Land 3
* Celeste 64
* Zork Grand Inquisitor
* Castlevania 64
* A Short Hike
* Yoshi's Island

For setup and instructions check out our [tutorials page](https://archipelago.gg/tutorial/).
Downloads can be found at [Releases](https://github.com/ArchipelagoMW/Archipelago/releases), including compiled
Expand All @@ -83,9 +86,9 @@ We recognize that there is a strong community of incredibly smart people that ha
Archipelago was directly forked from bonta0's `multiworld_31` branch of ALttPEntranceRandomizer (this project has a long legacy of its own, please check it out linked above) on January 12, 2020. The repository was then named to _MultiWorld-Utilities_ to better encompass its intended function. As Archipelago matured, then known as "Berserker's MultiWorld" by some, we found it necessary to transform our repository into a root level repository (as opposed to a 'forked repo') and change the name (which came later) to better reflect our project.

## Running Archipelago
For most people all you need to do is head over to the [releases](https://github.com/ArchipelagoMW/Archipelago/releases) page then download and run the appropriate installer. The installers function on Windows only.
For most people, all you need to do is head over to the [releases](https://github.com/ArchipelagoMW/Archipelago/releases) page then download and run the appropriate installer, or AppImage for Linux-based systems.

If you are running Archipelago from a non-Windows system then the likely scenario is that you are comfortable running source code directly. Please see our doc on [running Archipelago from source](docs/running%20from%20source.md).
If you are a developer or are running on a platform with no compiled releases available, please see our doc on [running Archipelago from source](docs/running%20from%20source.md).

## Related Repositories
This project makes use of multiple other projects. We wouldn't be here without these other repositories and the contributions of their developers, past and present.
Expand Down
2 changes: 1 addition & 1 deletion WebHostLib/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def check():
results, _ = roll_options(options)
if len(options) > 1:
# offer combined file back
combined_yaml = "---\n".join(f"# original filename: {file_name}\n{file_content.decode('utf-8-sig')}"
combined_yaml = "\n---\n".join(f"# original filename: {file_name}\n{file_content.decode('utf-8-sig')}"
for file_name, file_content in options.items())
combined_yaml = base64.b64encode(combined_yaml.encode("utf-8-sig")).decode()
else:
Expand Down
14 changes: 8 additions & 6 deletions WebHostLib/templates/tracker__Starcraft2.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h3>{{ player_name }}&apos;s Starcraft 2 Tracker</h3>
<td>{{ sc2_icon('Neosteel Bunker (Bunker)') }}</td>
<td>{{ sc2_icon('Shrike Turret (Bunker)') }}</td>
<td>{{ sc2_icon('Fortified Bunker (Bunker)') }}</td>
<td colspan="3"></td>
<td></td>
<td>{{ sc2_icon('Missile Turret') }}</td>
<td>{{ sc2_icon('Titanium Housing (Missile Turret)') }}</td>
<td>{{ sc2_icon('Hellstorm Batteries (Missile Turret)') }}</td>
Expand All @@ -121,12 +121,13 @@ <h3>{{ player_name }}&apos;s Starcraft 2 Tracker</h3>
<td>{{ sc2_icon('Planetary Fortress') }}</td>
<td {% if augmented_thrusters_planetary_fortress_level == 1 %}class="tint-terran"{% endif %}>{{ sc2_progressive_icon_with_custom_name('Progressive Augmented Thrusters (Planetary Fortress)', augmented_thrusters_planetary_fortress_url, augmented_thrusters_planetary_fortress_name) }}</td>
<td>{{ sc2_icon('Advanced Targeting (Planetary Fortress)') }}</td>
<td colspan="2"></td>
<td>{{ sc2_icon('Micro-Filtering') }}</td>
<td>{{ sc2_icon('Automated Refinery') }}</td>
<td></td>
<td>{{ sc2_icon('Advanced Construction (SCV)') }}</td>
<td>{{ sc2_icon('Dual-Fusion Welders (SCV)') }}</td>
<td></td>
<td>{{ sc2_icon('Micro-Filtering') }}</td>
<td>{{ sc2_icon('Automated Refinery') }}</td>
<td>{{ sc2_icon('Hostile Environment Adaptation (SCV)') }}</td>
</tr>
<tr>
<td>{{ sc2_icon('Sensor Tower') }}</td>
Expand Down Expand Up @@ -180,7 +181,7 @@ <h3>{{ player_name }}&apos;s Starcraft 2 Tracker</h3>
<td>{{ sc2_icon('Nano Projector (Medic)') }}</td>
<td colspan="6"></td>
<td>{{ sc2_icon('Vulture') }}</td>
<td>{{ sc2_progressive_icon_with_custom_name('Progressive Replenishable Magazine (Vulture)', replenishable_magazine_vulture_url, replenishable_magazine_vulture_name) }}</td>
<td class="{{ sc2_tint_level(replenishable_magazine_vulture_level) }}">{{ sc2_progressive_icon_with_custom_name('Progressive Replenishable Magazine (Vulture)', replenishable_magazine_vulture_url, replenishable_magazine_vulture_name) }}</td>
<td>{{ sc2_icon('Ion Thrusters (Vulture)') }}</td>
<td>{{ sc2_icon('Auto Launchers (Vulture)') }}</td>
<td>{{ sc2_icon('Auto-Repair (Vulture)') }}</td>
Expand Down Expand Up @@ -293,7 +294,8 @@ <h3>{{ player_name }}&apos;s Starcraft 2 Tracker</h3>
<td>{{ sc2_icon('HERC') }}</td>
<td>{{ sc2_icon('Juggernaut Plating (HERC)') }}</td>
<td>{{ sc2_icon('Kinetic Foam (HERC)') }}</td>
<td colspan="5"></td>
<td>{{ sc2_icon('Resource Efficiency (HERC)') }}</td>
<td colspan="4"></td>
<td>{{ sc2_icon('Widow Mine') }}</td>
<td>{{ sc2_icon('Drilling Claws (Widow Mine)') }}</td>
<td>{{ sc2_icon('Concealment (Widow Mine)') }}</td>
Expand Down
30 changes: 19 additions & 11 deletions WebHostLib/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,13 @@ def get_player_received_items(self, team: int, player: int) -> List[NetworkItem]
@_cache_results
def get_player_inventory_counts(self, team: int, player: int) -> collections.Counter:
"""Retrieves a dictionary of all items received by their id and their received count."""
items = self.get_player_received_items(team, player)
received_items = self.get_player_received_items(team, player)
starting_items = self.get_player_starting_inventory(team, player)
inventory = collections.Counter()
for item in items:
for item in received_items:
inventory[item.item] += 1
for item in starting_items:
inventory[item] += 1

return inventory

Expand Down Expand Up @@ -358,10 +361,13 @@ def get_enabled_multiworld_trackers(room: Room) -> Dict[str, Callable]:
def render_generic_tracker(tracker_data: TrackerData, team: int, player: int) -> str:
game = tracker_data.get_player_game(team, player)

# Add received index to all received items, excluding starting inventory.
received_items_in_order = {}
for received_index, network_item in enumerate(tracker_data.get_player_received_items(team, player), start=1):
received_items_in_order[network_item.item] = received_index
starting_inventory = tracker_data.get_player_starting_inventory(team, player)
for index, item in enumerate(starting_inventory):
received_items_in_order[item] = index
for index, network_item in enumerate(tracker_data.get_player_received_items(team, player),
start=len(starting_inventory)):
received_items_in_order[network_item.item] = index

return render_template(
template_name_or_list="genericTracker.html",
Expand Down Expand Up @@ -1606,6 +1612,7 @@ def render_Starcraft2_tracker(tracker_data: TrackerData, team: int, player: int)
"Hellstorm Batteries (Missile Turret)": github_icon_base_url + "blizzard/btn-ability-stetmann-corruptormissilebarrage.png",
"Advanced Construction (SCV)": github_icon_base_url + "blizzard/btn-ability-mengsk-trooper-advancedconstruction.png",
"Dual-Fusion Welders (SCV)": github_icon_base_url + "blizzard/btn-upgrade-swann-scvdoublerepair.png",
"Hostile Environment Adaptation (SCV)": github_icon_base_url + "blizzard/btn-upgrade-swann-hellarmor.png",
"Fire-Suppression System Level 1": organics_icon_base_url + "Fire-SuppressionSystem.png",
"Fire-Suppression System Level 2": github_icon_base_url + "blizzard/btn-upgrade-swann-firesuppressionsystem.png",

Expand Down Expand Up @@ -1673,6 +1680,7 @@ def render_Starcraft2_tracker(tracker_data: TrackerData, team: int, player: int)
"Resource Efficiency (Spectre)": github_icon_base_url + "blizzard/btn-ability-hornerhan-salvagebonus.png",
"Juggernaut Plating (HERC)": organics_icon_base_url + "JuggernautPlating.png",
"Kinetic Foam (HERC)": organics_icon_base_url + "KineticFoam.png",
"Resource Efficiency (HERC)": github_icon_base_url + "blizzard/btn-ability-hornerhan-salvagebonus.png",

"Hellion": "https://static.wikia.nocookie.net/starcraft/images/5/56/Hellion_SC2_Icon1.jpg",
"Vulture": github_icon_base_url + "blizzard/btn-unit-terran-vulture.png",
Expand Down Expand Up @@ -2333,12 +2341,12 @@ def render_Starcraft2_tracker(tracker_data: TrackerData, team: int, player: int)
"Progressive Zerg Armor Upgrade": 106 + SC2HOTS_ITEM_ID_OFFSET,
"Progressive Zerg Ground Upgrade": 107 + SC2HOTS_ITEM_ID_OFFSET,
"Progressive Zerg Flyer Upgrade": 108 + SC2HOTS_ITEM_ID_OFFSET,
"Progressive Zerg Weapon/Armor Upgrade": 109 + SC2WOL_ITEM_ID_OFFSET,
"Progressive Protoss Weapon Upgrade": 105 + SC2HOTS_ITEM_ID_OFFSET,
"Progressive Protoss Armor Upgrade": 106 + SC2HOTS_ITEM_ID_OFFSET,
"Progressive Protoss Ground Upgrade": 107 + SC2HOTS_ITEM_ID_OFFSET,
"Progressive Protoss Air Upgrade": 108 + SC2HOTS_ITEM_ID_OFFSET,
"Progressive Protoss Weapon/Armor Upgrade": 109 + SC2WOL_ITEM_ID_OFFSET,
"Progressive Zerg Weapon/Armor Upgrade": 109 + SC2HOTS_ITEM_ID_OFFSET,
"Progressive Protoss Weapon Upgrade": 105 + SC2LOTV_ITEM_ID_OFFSET,
"Progressive Protoss Armor Upgrade": 106 + SC2LOTV_ITEM_ID_OFFSET,
"Progressive Protoss Ground Upgrade": 107 + SC2LOTV_ITEM_ID_OFFSET,
"Progressive Protoss Air Upgrade": 108 + SC2LOTV_ITEM_ID_OFFSET,
"Progressive Protoss Weapon/Armor Upgrade": 109 + SC2LOTV_ITEM_ID_OFFSET,
}
grouped_item_replacements = {
"Progressive Terran Weapon Upgrade": ["Progressive Terran Infantry Weapon",
Expand Down
11 changes: 10 additions & 1 deletion docs/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
# Bumper Stickers
/worlds/bumpstik/ @FelicitusNeko

# Castlevania 64
/worlds/cv64/ @LiquidCat64

# Celeste 64
/worlds/celeste64/ @PoryGone

Expand Down Expand Up @@ -131,6 +134,9 @@
# Shivers
/worlds/shivers/ @GodlFire

# A Short Hike
/worlds/shorthike/ @chandler05

# Sonic Adventure 2 Battle
/worlds/sa2b/ @PoryGone @RaspberrySpace

Expand Down Expand Up @@ -171,7 +177,7 @@
/worlds/tloz/ @Rosalie-A @t3hf1gm3nt

# TUNIC
/worlds/tunic/ @silent-destroyer
/worlds/tunic/ @silent-destroyer @ScipioWright

# Undertale
/worlds/undertale/ @jonloveslegos
Expand All @@ -185,6 +191,9 @@
# The Witness
/worlds/witness/ @NewSoupVi @blastron

# Yoshi's Island
/worlds/yoshisisland/ @PinkSwitch

# Zillion
/worlds/zillion/ @beauxq

Expand Down
Loading

0 comments on commit 630a3bd

Please sign in to comment.