Implement estate and marketplace services (#73)
All checks were successful
Native code generation / deterministic (push) Successful in 15m57s
Imaging and meshing gate / native (push) Successful in 5m16s
Native Rust workspace compile / compile (push) Successful in 5m11s

This commit is contained in:
2026-08-10 19:25:31 +00:00
parent c22eef5d0e
commit 763e9e5044
14 changed files with 3132 additions and 1202 deletions

View File

@@ -4,7 +4,7 @@
use super::*;
use libremetaverse_structured_data::{OSD, OSDMap};
use libremetaverse_types::UUID;
use libremetaverse_types::{UUID, Vector3};
use packets::{
EstateOwnerMessagePacket, EstateOwnerMessagePacketAgentDataBlock,
EstateOwnerMessagePacketMethodDataBlock, EstateOwnerMessagePacketParamListBlock,
@@ -144,6 +144,56 @@ fn set_experience_all_empty_lists_produces_empty_result() {
assert!(allowed.is_empty());
}
#[test]
fn land_stat_caps_reply_preserves_mono_score_and_emits_after_decode() {
let client = GridClient::new().expect("GridClient constructor");
let estate = client.estate();
let task_id = uuid();
let received = Arc::new(Mutex::new(None));
let captured = Arc::clone(&received);
let _subscription = estate.subscribe_top_scripts_reply(Arc::new(move |reply| {
*captured.lock().unwrap() = Some((reply.object_count(), reply.tasks()));
}));
let mut message =
messages::linden::LandStatReplyMessage::new().expect("LandStatReplyMessage constructor");
message.report_type = EstateToolsLandStatReportType::TopScripts as u32;
message.total_object_count = 1;
message.report_data_blocks = vec![messages::linden::LandStatReplyMessageReportDataBlock {
location: Vector3 {
x: 1.0,
y: 2.0,
z: 3.0,
},
mono_score: 4.5,
owner_name: "Owner Resident".into(),
score: 9.25,
task_id,
task_local_id: 17,
task_name: "Scripted object".into(),
time_stamp: std::time::SystemTime::UNIX_EPOCH,
}];
let encoded = message.serialize().expect("serialize LandStatReply");
let mut decoded =
messages::linden::LandStatReplyMessage::new().expect("LandStatReplyMessage constructor");
decoded
.deserialize(encoded)
.expect("deserialize LandStatReply");
client
.network()
.dispatch_caps_event("LandStatReply", &message, simulator());
let received = received.lock().unwrap();
let (count, tasks) = received.as_ref().expect("TopScriptsReply event");
assert_eq!(*count, 1);
let task = tasks.get(&task_id).expect("reported task");
assert_eq!(task.mono_score, 4.5);
assert_eq!(task.score, 9.25);
assert_eq!(task.task_local_id, 17);
assert_eq!(task.task_name, "Scripted object");
assert_eq!(task.owner_name, "Owner Resident");
}
// parity-case: LibreMetaverse.Tests/ExperiencePreferencesMessageTests.cs::ExperiencePreferencesMessageTests.ExtractExperiencePermission_Allowed_ReturnsAllow::test cf095ab428713004ebac6e1915a47ae0c03bd2958addbba2a39fd2f0edf51a74 translated
#[test]
fn extract_experience_permission_allowed_returns_allow() {