diff --git a/crates/coa-core/src/portable/compat.rs b/crates/coa-core/src/portable/compat.rs index fcb3d4f..51885e8 100644 --- a/crates/coa-core/src/portable/compat.rs +++ b/crates/coa-core/src/portable/compat.rs @@ -187,7 +187,9 @@ pub fn evaluate(i: &Inputs<'_>) -> CompatibilityReport { } if i.operation == Operation::RuntimeSession { - if content.supports(Feature::RuntimeSessions) { + if content.supports(Feature::RuntimeSessions) && content.session_protocol != super::session::protocol::PROTOCOL_VERSION { + out.push(Outcome::Blocking { topic: Topic::RuntimeSessions, reason: format!("the realm's Host speaks session protocol {} and this Owner speaks {}: neither reads the other's messages", content.session_protocol, super::session::protocol::PROTOCOL_VERSION) }); + } else if content.supports(Feature::RuntimeSessions) { out.push(Outcome::Compatible(Topic::RuntimeSessions)); } else { out.push(Outcome::Blocking { topic: Topic::RuntimeSessions, reason: "the realm has no portable session support (the core's session table or switch is missing)".into() }); @@ -338,6 +340,20 @@ mod tests { .unwrap() } + #[test] + fn a_host_of_another_session_protocol_is_refused_before_a_character_is_armed() { + let model = geared_level_eighty(); + let mut content = profile(&all(), &[2]).content; + let ok = RealmCapabilities::build(None, content.clone(), profile(&all(), &[2]).progression).unwrap(); + assert_eq!(run(Operation::RuntimeSession, &model, &ok, None, &[], None).verdict(), Verdict::Compatible); + content.session_protocol = 1; + let old = RealmCapabilities::build(None, content, profile(&all(), &[2]).progression).unwrap(); + let r = run(Operation::RuntimeSession, &model, &old, None, &[], None); + assert_eq!(r.verdict(), Verdict::Incompatible); + assert!(r.blocking()[0].to_string().contains("session protocol 1")); + assert_eq!(run(Operation::Update, &model, &old, None, &[], None).verdict(), Verdict::Compatible, "only sessions depend on it"); + } + fn all() -> Vec { vec![Feature::RuntimeSessions, Feature::Wardrobe, Feature::Collections] } diff --git a/crates/coa-core/src/portable/realm/live_profile.rs b/crates/coa-core/src/portable/realm/live_profile.rs index bb1600e..5075d12 100644 --- a/crates/coa-core/src/portable/realm/live_profile.rs +++ b/crates/coa-core/src/portable/realm/live_profile.rs @@ -28,19 +28,20 @@ fn caps(marker: u8, features: &[Feature], jobs: &[u32], ruleset: Ruleset, readab let mut catalog = ClientCatalog::new(); catalog.insert("Appearances.dbc".into(), CatalogEntry { sha256: format!("{marker:02x}").repeat(32), records: 9 }); Arc::new( - RealmCapabilities::new( + RealmCapabilities::build( None, ContentProfile { ruleset, character_formats: CharacterFormats { readable, writable: FormatRange::single(2) }, online_import_job_formats: jobs.to_vec(), - session_protocol: 1, - collection_protocol: 1, + session_protocol: 2, + collection_protocol: 2, features: features.iter().copied().collect(), collection_kinds: ["coa:appearance".to_string(), "coa:vanity".to_string()].into_iter().collect(), extensions: vec![], client_catalog: catalog, }, + Some(crate::portable::capabilities::Progression { max_player_level: 80, projection_protocol: 1, projection_policy_version: 1, progression_signature: "ee".repeat(32), scaling_enabled: true }), ) .unwrap(), ) diff --git a/crates/coa-core/src/portable/session/live_session.rs b/crates/coa-core/src/portable/session/live_session.rs index 0d31c1c..588356f 100644 --- a/crates/coa-core/src/portable/session/live_session.rs +++ b/crates/coa-core/src/portable/session/live_session.rs @@ -467,7 +467,7 @@ fn the_core_reports_what_it_is_the_manager_evaluates_before_it_writes_and_the_co let id = make(&r, &mut store, profile, 1005); let mut other = caps.content.clone(); other.online_import_job_formats = vec![3]; - let other = RealmCapabilities::new(None, other).unwrap(); + let other = RealmCapabilities::build(None, other, caps.progression.clone()).unwrap(); let mut o = opts(); o.capabilities = Some(std::sync::Arc::new(other)); let before = number(&r.b, "SELECT COUNT(*) FROM acore_characters.characters");