Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion archipelago/ootrr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 4 additions & 0 deletions archipelago/ootrr/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)


Expand Down
15 changes: 15 additions & 0 deletions randomizer/core/src/ap/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ fn keep(p: &Plan, kind: &str) -> Option<crate::slice::support::Keep> {
/// 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());
}
Expand Down Expand Up @@ -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);
}
}
}
Loading