diff --git a/archipelago/ootrr/__init__.py b/archipelago/ootrr/__init__.py index 7af628a..b90a090 100644 --- a/archipelago/ootrr/__init__.py +++ b/archipelago/ootrr/__init__.py @@ -42,7 +42,12 @@ class Exe(settings.UserFilePath): def export_custom(exe: str, text: str, seed: str) -> Bundle: import Utils - key: str = hashlib.sha256(f"{text}\0{seed}".encode("utf-8")).hexdigest()[:20] + try: + st = os.stat(exe) + build: str = f"{st.st_size}:{st.st_mtime_ns}" + except OSError: + build = "" + key: str = hashlib.sha256(f"{text}\0{seed}\0{build}".encode("utf-8")).hexdigest()[:20] out: str = Utils.cache_path("ootrr", f"{key}.json") os.makedirs(os.path.dirname(out), exist_ok=True) if not os.path.isfile(out): diff --git a/archipelago/ootrr/client.py b/archipelago/ootrr/client.py index b14a498..205e1fa 100644 --- a/archipelago/ootrr/client.py +++ b/archipelago/ootrr/client.py @@ -236,6 +236,7 @@ def step(self) -> List[Dict[str, Any]]: async def game_loop(ctx: OOTRRContext) -> None: + shown = None while not ctx.exit_event.is_set(): try: msgs = await asyncio.to_thread(ctx.step) @@ -244,6 +245,9 @@ async def game_loop(ctx: OOTRRContext) -> None: except Exception as e: logger.exception(e) ctx.status = f"Error: {e}" + if ctx.status != shown: + shown = ctx.status + logger.info(f"OOTRR: {shown}") await asyncio.sleep(POLL) diff --git a/randomizer/core/src/ap/export.rs b/randomizer/core/src/ap/export.rs index 13c615d..a4cda47 100644 --- a/randomizer/core/src/ap/export.rs +++ b/randomizer/core/src/ap/export.rs @@ -162,6 +162,9 @@ fn keep(p: &Plan, kind: &str) -> Option { /// its setting is Anywhere and the mailbox can hand it over (crate::ap::mailbox::dungeon_item). fn local_only(d: &Data, p: &Plan, name: &str) -> bool { let Some(i) = d.item(name) else { return false }; + if crate::slice::silver::is_item(name) { + return true; + } if super::mailbox::LOCAL_KINDS.contains(&i.kind.as_str()) { return !(keep(p, &i.kind) == Some(crate::slice::support::Keep::Anywhere) && super::mailbox::dungeon_item(d, name).is_some()); } @@ -605,4 +608,16 @@ mod tests { let chest: Vec<&str> = arr(row(&b, "KF Midos Top Left Chest"), "deny").iter().map(|i| items[i.as_i64().unwrap() as usize].get("name").unwrap().as_str().unwrap()).collect(); assert!(!chest.contains(&"Bomb Bag")); } + /// A Silver Rupee is counted by the flow of the chest it is found in, which the mailbox + /// cannot run, so a Silver Rupee placed in another world left this slot unbuildable. + #[test] + fn silver_rupees_stay_in_their_own_world() { + let d: Data = Data::load().unwrap(); + let mut s: Settings = preset("full_shuffle"); + s.set("shuffle_silver_rupees", crate::settings::model::Value::Bool(true)).unwrap(); + let b: Json = export(&d, &s.finish().unwrap(), "custom").unwrap(); + for r in &crate::slice::silver::ROOMS { + assert!(local(&b, r.item), "{}", r.item); + } + } }