Skip to content

Commit

Permalink
Merge branch 'ArchipelagoMW:main' into mlss
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbrq authored Apr 21, 2024
2 parents 7176e53 + e22ac85 commit 5f3a1b1
Show file tree
Hide file tree
Showing 45 changed files with 1,025 additions and 1,120 deletions.
1 change: 0 additions & 1 deletion BaseClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def __init__(self, players: int):
self.random = ThreadBarrierProxy(random.Random())
self.players = players
self.player_types = {player: NetUtils.SlotType.player for player in self.player_ids}
self.glitch_triforce = False
self.algorithm = 'balanced'
self.groups = {}
self.regions = self.RegionManager(players)
Expand Down
3 changes: 1 addition & 2 deletions Fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,10 +495,9 @@ def mark_for_locking(location: Location):
if unplaced or unfilled:
logging.warning(
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)
items_counter = Counter(location.item.player for location in multiworld.get_filled_locations())
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})")

Expand Down
1 change: 0 additions & 1 deletion Generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ def main(args=None, callback=ERmain):
erargs = parse_arguments(['--multi', str(args.multi)])
erargs.seed = seed
erargs.plando_options = args.plando
erargs.glitch_triforce = options.generator.glitch_triforce_room
erargs.spoiler = args.spoiler
erargs.race = args.race
erargs.outputname = seed_name
Expand Down
2 changes: 1 addition & 1 deletion Launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def update_settings():
Component("Open Patch", func=open_patch),
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("Unrated/18+ Discord Server", icon="discord", func=lambda: webbrowser.open("https://discord.gg/fqvNCCRsu4")),
Component("Browse Files", func=browse_files),
])

Expand Down
1 change: 0 additions & 1 deletion Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
multiworld.player_name = args.name.copy()
multiworld.sprite = args.sprite.copy()
multiworld.sprite_pool = args.sprite_pool.copy()
multiworld.glitch_triforce = args.glitch_triforce # This is enabled/disabled globally, no per player option.

multiworld.set_options(args)
multiworld.set_item_links()
Expand Down
14 changes: 13 additions & 1 deletion MultiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1905,7 +1905,7 @@ def _cmd_exit(self) -> bool:
@mark_raw
def _cmd_alias(self, player_name_then_alias_name):
"""Set a player's alias, by listing their base name and then their intended alias."""
player_name, alias_name = player_name_then_alias_name.split(" ", 1)
player_name, _, alias_name = player_name_then_alias_name.partition(" ")
player_name, usable, response = get_intended_text(player_name, self.ctx.player_names.values())
if usable:
for (team, slot), name in self.ctx.player_names.items():
Expand Down Expand Up @@ -2163,6 +2163,18 @@ def value_type(input_text: str):
self.ctx.broadcast_all([{"cmd": "RoomUpdate", option_name: getattr(self.ctx, option_name)}])
return True

def _cmd_datastore(self):
"""Debug Tool: list writable datastorage keys and approximate the size of their values with pickle."""
total: int = 0
texts = []
for key, value in self.ctx.stored_data.items():
size = len(pickle.dumps(value))
total += size
texts.append(f"Key: {key} | Size: {size}B")
texts.insert(0, f"Found {len(self.ctx.stored_data)} keys, "
f"approximately totaling {Utils.format_SI_prefix(total, power=1024)}B")
self.output("\n".join(texts))


async def console(ctx: Context):
import sys
Expand Down
3 changes: 2 additions & 1 deletion Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ class Toggle(NumericOption):
default = 0

def __init__(self, value: int):
assert value == 0 or value == 1, "value of Toggle can only be 0 or 1"
# if user puts in an invalid value, make it valid
value = int(bool(value))
self.value = value

@classmethod
Expand Down
1 change: 1 addition & 0 deletions SNIClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def _cmd_snes_close(self) -> bool:
"""Close connection to a currently connected snes"""
self.ctx.snes_reconnect_address = None
self.ctx.cancel_snes_autoreconnect()
self.ctx.snes_state = SNESState.SNES_DISCONNECTED
if self.ctx.snes_socket and not self.ctx.snes_socket.closed:
async_start(self.ctx.snes_socket.close())
return True
Expand Down
2 changes: 1 addition & 1 deletion WebHost.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def get_app():
from WebHostLib import register, cache, app as raw_app
from WebHostLib.models import db

register()
app = raw_app
if os.path.exists(configpath) and not app.config["TESTING"]:
import yaml
Expand All @@ -34,6 +33,7 @@ def get_app():
app.config["HOST_ADDRESS"] = Utils.get_public_ipv4()
logging.info(f"HOST_ADDRESS was set to {app.config['HOST_ADDRESS']}")

register()
cache.init_app(app)
db.bind(**app.config["PONY"])
db.generate_mapping(create_tables=True)
Expand Down
3 changes: 2 additions & 1 deletion WebHostLib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
app.config["MAX_ROLL"] = 20
app.config["CACHE_TYPE"] = "SimpleCache"
app.config["HOST_ADDRESS"] = ""
app.config["ASSET_RIGHTS"] = False

cache = Cache()
Compress(app)
Expand Down Expand Up @@ -82,6 +83,6 @@ def register():

from WebHostLib.customserver import run_server_process
# to trigger app routing picking up on it
from . import tracker, upload, landing, check, generate, downloads, api, stats, misc
from . import tracker, upload, landing, check, generate, downloads, api, stats, misc, robots

app.register_blueprint(api.api_endpoints)
14 changes: 14 additions & 0 deletions WebHostLib/robots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from WebHostLib import app
from flask import abort
from . import cache


@cache.cached()
@app.route('/robots.txt')
def robots():
# If this host is not official, do not allow search engine crawling
if not app.config["ASSET_RIGHTS"]:
return app.send_static_file('robots.txt')

# Send 404 if the host has affirmed this to be the official WebHost
abort(404)
20 changes: 0 additions & 20 deletions WebHostLib/static/assets/lttp-tracker.js

This file was deleted.

20 changes: 20 additions & 0 deletions WebHostLib/static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
User-agent: Googlebot
Disallow: /

User-agent: APIs-Google
Disallow: /

User-agent: AdsBot-Google-Mobile
Disallow: /

User-agent: AdsBot-Google-Mobile
Disallow: /

User-agent: Mediapartners-Google
Disallow: /

User-agent: Google-Safety
Disallow: /

User-agent: *
Disallow: /
75 changes: 0 additions & 75 deletions WebHostLib/static/styles/lttp-tracker.css

This file was deleted.

142 changes: 142 additions & 0 deletions WebHostLib/static/styles/tracker__ALinkToThePast.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
@import url('https://fonts.googleapis.com/css2?family=Lexend+Deca:[email protected]&display=swap');

.tracker-container {
width: 440px;
box-sizing: border-box;
font-family: "Lexend Deca", Arial, Helvetica, sans-serif;
border: 2px solid black;
border-radius: 4px;
resize: both;

background-color: #42b149;
color: white;
}

.hidden {
visibility: hidden;
}

/** Inventory Grid ****************************************************************************************************/
.inventory-grid {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
padding: 1rem;
gap: 1rem;
}

.inventory-grid .item {
position: relative;
display: flex;
justify-content: center;
height: 48px;
}

.inventory-grid .dual-item {
display: flex;
justify-content: center;
}

.inventory-grid .missing {
/* Missing items will be in full grayscale to signify "uncollected". */
filter: grayscale(100%) contrast(75%) brightness(75%);
}

.inventory-grid .item img,
.inventory-grid .dual-item img {
display: flex;
align-items: center;
text-align: center;
font-size: 0.8rem;
text-shadow: 0 1px 2px black;
font-weight: bold;
image-rendering: crisp-edges;
background-size: contain;
background-repeat: no-repeat;
}

.inventory-grid .dual-item img {
height: 48px;
margin: 0 -4px;
}

.inventory-grid .dual-item img:first-child {
align-self: flex-end;
}

.inventory-grid .item .quantity {
position: absolute;
bottom: 0;
right: 0;
text-align: right;
font-weight: 600;
font-size: 1.75rem;
line-height: 1.75rem;
text-shadow:
-1px -1px 0 #000,
1px -1px 0 #000,
-1px 1px 0 #000,
1px 1px 0 #000;
user-select: none;
}

/** Regions List ******************************************************************************************************/
.regions-list {
padding: 1rem;
}

.regions-list summary {
list-style: none;
display: flex;
gap: 0.5rem;
cursor: pointer;
}

.regions-list summary::before {
content: "⯈";
width: 1em;
flex-shrink: 0;
}

.regions-list details {
font-weight: 300;
}

.regions-list details[open] > summary::before {
content: "⯆";
}

.regions-list .region {
width: 100%;
display: grid;
grid-template-columns: 20fr 8fr 2fr 2fr;
align-items: center;
gap: 4px;
text-align: center;
font-weight: 300;
box-sizing: border-box;
}

.regions-list .region :first-child {
text-align: left;
font-weight: 500;
}

.regions-list .region.region-header {
margin-left: 24px;
width: calc(100% - 24px);
padding: 2px;
}

.regions-list .location-rows {
border-top: 1px solid white;
display: grid;
grid-template-columns: auto 32px;
font-weight: 300;
padding: 2px 8px;
margin-top: 4px;
font-size: 0.8rem;
}

.regions-list .location-rows :nth-child(even) {
text-align: right;
}
Loading

0 comments on commit 5f3a1b1

Please sign in to comment.