Skip to content

Commit

Permalink
Merge branch 'main' into DocsPKMRedBlue
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLynk authored Nov 13, 2023
2 parents 2b701e9 + 81cc016 commit bc13646
Show file tree
Hide file tree
Showing 105 changed files with 28,633 additions and 311 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.apmc
*.apz5
*.aptloz
*.apemerald
*.pyc
*.pyd
*.sfc
Expand Down
7 changes: 6 additions & 1 deletion CommonClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ async def process_server_cmd(ctx: CommonContext, args: dict):
ctx.slot_info = {int(pid): data for pid, data in args["slot_info"].items()}
ctx.hint_points = args.get("hint_points", 0)
ctx.consume_players_package(args["players"])
ctx.stored_data_notification_keys.add(f"_read_hints_{ctx.team}_{ctx.slot}")
msgs = []
if ctx.locations_checked:
msgs.append({"cmd": "LocationChecks",
Expand Down Expand Up @@ -836,10 +837,14 @@ async def process_server_cmd(ctx: CommonContext, args: dict):

elif cmd == "Retrieved":
ctx.stored_data.update(args["keys"])
if ctx.ui and f"_read_hints_{ctx.team}_{ctx.slot}" in args["keys"]:
ctx.ui.update_hints()

elif cmd == "SetReply":
ctx.stored_data[args["key"]] = args["value"]
if args["key"].startswith("EnergyLink"):
if ctx.ui and f"_read_hints_{ctx.team}_{ctx.slot}" == args["key"]:
ctx.ui.update_hints()
elif args["key"].startswith("EnergyLink"):
ctx.current_energy_link_value = args["value"]
if ctx.ui:
ctx.ui.set_new_energy_link_value()
Expand Down
2 changes: 1 addition & 1 deletion Fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def fill_restrictive(world: MultiWorld, base_state: CollectionState, locations:

location.item = None
placed_item.location = None
swap_state = sweep_from_pool(base_state, [placed_item] if unsafe else [])
swap_state = sweep_from_pool(base_state, [placed_item, *item_pool] if unsafe else item_pool)
# unsafe means swap_state assumes we can somehow collect placed_item before item_to_place
# by continuing to swap, which is not guaranteed. This is unsafe because there is no mechanic
# to clean that up later, so there is a chance generation fails.
Expand Down
2 changes: 1 addition & 1 deletion Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def find_common_pool(players: Set[int], shared_pool: Set[str]) -> Tuple[
if any(world.item_links.values()):
world._all_state = None

logger.info("Running Item Plando")
logger.info("Running Item Plando.")

distribute_planned(world)

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Currently, the following games are supported:
* Muse Dash
* DOOM 1993
* Terraria
* Lingo
* Pokémon Emerald

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 Down
6 changes: 3 additions & 3 deletions UndertaleClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def _cmd_resync(self):
self.ctx.syncing = True

def _cmd_patch(self):
"""Patch the game."""
"""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)
self.ctx.patch_game()
self.output("Patched.")

def _cmd_savepath(self, directory: str):
"""Redirect to proper save data folder. (Use before connecting!)"""
"""Redirect to proper save data folder. This is necessary for Linux users to use before connecting."""
if isinstance(self.ctx, UndertaleContext):
self.ctx.save_game_folder = directory
self.output("Changed to the following directory: " + self.ctx.save_game_folder)
Expand Down Expand Up @@ -67,7 +67,7 @@ def _cmd_auto_patch(self, steaminstall: typing.Optional[str] = None):
self.output("Patching successful!")

def _cmd_online(self):
"""Makes you no longer able to see other Undertale players."""
"""Toggles seeing other Undertale players."""
if isinstance(self.ctx, UndertaleContext):
self.ctx.update_online_mode(not ("Online" in self.ctx.tags))
if "Online" in self.ctx.tags:
Expand Down
10 changes: 7 additions & 3 deletions Utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,16 @@ def user_path(*path: str) -> str:
if user_path.cached_path != local_path():
import filecmp
if not os.path.exists(user_path("manifest.json")) or \
not os.path.exists(local_path("manifest.json")) or \
not filecmp.cmp(local_path("manifest.json"), user_path("manifest.json"), shallow=True):
import shutil
for dn in ("Players", "data/sprites"):
for dn in ("Players", "data/sprites", "data/lua"):
shutil.copytree(local_path(dn), user_path(dn), dirs_exist_ok=True)
for fn in ("manifest.json",):
shutil.copy2(local_path(fn), user_path(fn))
if not os.path.exists(local_path("manifest.json")):
warnings.warn(f"Upgrading {user_path()} from something that is not a proper install")
else:
shutil.copy2(local_path("manifest.json"), user_path("manifest.json"))
os.makedirs(user_path("worlds"), exist_ok=True)

return os.path.join(user_path.cached_path, *path)

Expand Down
24 changes: 14 additions & 10 deletions WebHostLib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,20 @@ def get_html_doc(option_type: type(Options.Option)) -> str:
option["defaultValue"] = "random"

weighted_options["baseOptions"]["game"][game_name] = 0
weighted_options["games"][game_name] = {}
weighted_options["games"][game_name]["gameSettings"] = game_options
weighted_options["games"][game_name]["gameItems"] = tuple(world.item_names)
weighted_options["games"][game_name]["gameItemGroups"] = [
group for group in world.item_name_groups.keys() if group != "Everything"
]
weighted_options["games"][game_name]["gameLocations"] = tuple(world.location_names)
weighted_options["games"][game_name]["gameLocationGroups"] = [
group for group in world.location_name_groups.keys() if group != "Everywhere"
]
weighted_options["games"][game_name] = {
"gameSettings": game_options,
"gameItems": tuple(world.item_names),
"gameItemGroups": [
group for group in world.item_name_groups.keys() if group != "Everything"
],
"gameItemDescriptions": world.item_descriptions,
"gameLocations": tuple(world.location_names),
"gameLocationGroups": [
group for group in world.location_name_groups.keys() if group != "Everywhere"
],
"gameLocationDescriptions": world.location_descriptions,
}

with open(os.path.join(target_folder, 'weighted-options.json'), "w") as f:
json.dump(weighted_options, f, indent=2, separators=(',', ': '))

2 changes: 1 addition & 1 deletion WebHostLib/static/assets/trackerCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ window.addEventListener('load', () => {
render: function (data, type, row) {
if (type === "sort" || type === 'type') {
if (data === "None")
return -1;
return Number.MAX_VALUE;

return parseInt(data);
}
Expand Down
40 changes: 34 additions & 6 deletions WebHostLib/static/assets/weighted-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -1024,12 +1024,18 @@ class GameSettings {

// Builds a div for a setting whose value is a list of locations.
#buildLocationsDiv(setting) {
return this.#buildListDiv(setting, this.data.gameLocations, this.data.gameLocationGroups);
return this.#buildListDiv(setting, this.data.gameLocations, {
groups: this.data.gameLocationGroups,
descriptions: this.data.gameLocationDescriptions,
});
}

// Builds a div for a setting whose value is a list of items.
#buildItemsDiv(setting) {
return this.#buildListDiv(setting, this.data.gameItems, this.data.gameItemGroups);
return this.#buildListDiv(setting, this.data.gameItems, {
groups: this.data.gameItemGroups,
descriptions: this.data.gameItemDescriptions
});
}

// Builds a div for a setting named `setting` with a list value that can
Expand All @@ -1038,12 +1044,15 @@ class GameSettings {
// The `groups` option can be a list of additional options for this list
// (usually `item_name_groups` or `location_name_groups`) that are displayed
// in a special section at the top of the list.
#buildListDiv(setting, items, groups = []) {
//
// The `descriptions` option can be a map from item names or group names to
// descriptions for the user's benefit.
#buildListDiv(setting, items, {groups = [], descriptions = {}} = {}) {
const div = document.createElement('div');
div.classList.add('simple-list');

groups.forEach((group) => {
const row = this.#addListRow(setting, group);
const row = this.#addListRow(setting, group, descriptions[group]);
div.appendChild(row);
});

Expand All @@ -1052,15 +1061,17 @@ class GameSettings {
}

items.forEach((item) => {
const row = this.#addListRow(setting, item);
const row = this.#addListRow(setting, item, descriptions[item]);
div.appendChild(row);
});

return div;
}

// Builds and returns a row for a list of checkboxes.
#addListRow(setting, item) {
//
// If `help` is passed, it's displayed as a help tooltip for this list item.
#addListRow(setting, item, help = undefined) {
const row = document.createElement('div');
row.classList.add('list-row');

Expand All @@ -1081,6 +1092,23 @@ class GameSettings {

const name = document.createElement('span');
name.innerText = item;

if (help) {
const helpSpan = document.createElement('span');
helpSpan.classList.add('interactive');
helpSpan.setAttribute('data-tooltip', help);
helpSpan.innerText = '(?)';
name.innerText += ' ';
name.appendChild(helpSpan);

// Put the first 7 tooltips below their rows. CSS tooltips in scrolling
// containers can't be visible outside those containers, so this helps
// ensure they won't be pushed out the top.
if (helpSpan.parentNode.childNodes.length < 7) {
helpSpan.classList.add('tooltip-bottom');
}
}

label.appendChild(name);

row.appendChild(label);
Expand Down
75 changes: 70 additions & 5 deletions data/client.kv
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@
color: "FFFFFF"
<TabbedPanel>:
tab_width: root.width / app.tab_count
<TooltipLabel>:
text_size: self.width, None
size_hint_y: None
height: self.texture_size[1]
font_size: dp(20)
markup: True
<SelectableLabel>:
canvas.before:
Color:
rgba: (.0, 0.9, .1, .3) if self.selected else (0.2, 0.2, 0.2, 1)
Rectangle:
size: self.size
pos: self.pos
text_size: self.width, None
size_hint_y: None
height: self.texture_size[1]
font_size: dp(20)
markup: True
<UILog>:
messages: 1000 # amount of messages stored in client logs.
cols: 1
Expand All @@ -44,6 +45,70 @@
height: self.minimum_height
orientation: 'vertical'
spacing: dp(3)
<HintLabel>:
canvas.before:
Color:
rgba: (.0, 0.9, .1, .3) if self.selected else (0.2, 0.2, 0.2, 1) if self.striped else (0.18, 0.18, 0.18, 1)
Rectangle:
size: self.size
pos: self.pos
height: self.minimum_height
receiving_text: "Receiving Player"
item_text: "Item"
finding_text: "Finding Player"
location_text: "Location"
entrance_text: "Entrance"
found_text: "Found?"
TooltipLabel:
id: receiving
text: root.receiving_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: item
text: root.item_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: finding
text: root.finding_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: location
text: root.location_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: entrance
text: root.entrance_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
TooltipLabel:
id: found
text: root.found_text
halign: 'center'
valign: 'center'
pos_hint: {"center_y": 0.5}
<HintLog>:
cols: 1
viewclass: 'HintLabel'
scroll_y: self.height
scroll_type: ["content", "bars"]
bar_width: dp(12)
effect_cls: "ScrollEffect"
SelectableRecycleBoxLayout:
default_size: None, dp(20)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
spacing: dp(3)
<ServerLabel>:
text: "Server:"
size_hint_x: None
Expand Down
6 changes: 6 additions & 0 deletions docs/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
# Kingdom Hearts 2
/worlds/kh2/ @JaredWeakStrike

# Lingo
/worlds/lingo/ @hatkirby

# Links Awakening DX
/worlds/ladx/ @zig-for

Expand Down Expand Up @@ -92,6 +95,9 @@
# Overcooked! 2
/worlds/overcooked2/ @toasterparty

# Pokemon Emerald
/worlds/pokemon_emerald/ @Zunawe

# Pokemon Red and Blue
/worlds/pokemon_rb/ @Alchav

Expand Down
Loading

0 comments on commit bc13646

Please sign in to comment.