diff --git a/resources/opcodes.json b/resources/opcodes.json index ea97761..3809a64 100644 --- a/resources/opcodes.json +++ b/resources/opcodes.json @@ -259,6 +259,11 @@ "name": "ContentFinderFound2", "opcode": 619, "size": 812 + }, + { + "name": "ObjectSpawn", + "opcode": 425, + "size": 64 } ], "ClientZoneIpcType": [ diff --git a/src/ipc/zone/mod.rs b/src/ipc/zone/mod.rs index eef5449..32e1036 100644 --- a/src/ipc/zone/mod.rs +++ b/src/ipc/zone/mod.rs @@ -88,6 +88,9 @@ pub use config::Config; mod event_yield_handler; pub use event_yield_handler::EventYieldHandler; +mod object_spawn; +pub use object_spawn::ObjectSpawn; + use crate::COMPLETED_QUEST_BITMASK_SIZE; use crate::common::ObjectTypeId; use crate::common::Position; @@ -436,6 +439,8 @@ pub enum ServerZoneIpcData { }, #[br(pre_assert(*magic == ServerZoneIpcType::ContentFinderFound2))] ContentFinderFound2 { unk1: [u8; 8] }, + #[br(pre_assert(*magic == ServerZoneIpcType::ObjectSpawn))] + ObjectSpawn(ObjectSpawn), Unknown { #[br(count = size - 32)] unk: Vec, @@ -872,6 +877,10 @@ mod tests { unk4: 0, }, ), + ( + ServerZoneIpcType::ObjectSpawn, + ServerZoneIpcData::ObjectSpawn(ObjectSpawn::default()), + ), ]; for (opcode, data) in &ipc_types { diff --git a/src/ipc/zone/object_spawn.rs b/src/ipc/zone/object_spawn.rs new file mode 100644 index 0000000..6e463c4 --- /dev/null +++ b/src/ipc/zone/object_spawn.rs @@ -0,0 +1,32 @@ +use binrw::binrw; + +use crate::common::{Position, read_quantized_rotation, write_quantized_rotation}; + +// TODO: this is all kinds of wrong, take the fields with a grain of salt +#[binrw] +#[brw(little)] +#[derive(Debug, Clone, Default)] +pub struct ObjectSpawn { + pub index: u8, + pub kind: u8, + #[brw(pad_after = 1)] // padding, or part of flag? + pub flag: u8, + pub base_id: u32, + pub entity_id: u32, + pub layout_id: u32, + pub content_id: u32, + pub owner_id: u32, + pub bind_layout_id: u32, + pub scale: f32, + pub shared_group_timeline_state: u16, + #[br(map = read_quantized_rotation)] + #[bw(map = write_quantized_rotation)] + pub rotation: f32, + pub fate: u16, + pub permission_invisibility: u8, + pub args1: u8, + pub args2: u32, + pub args3: u32, + pub unk1: u32, + pub position: Position, +}