1
Fork 0
mirror of https://github.com/redstrate/Kawari.git synced 2025-07-17 10:47:44 +00:00

Add ObjectSpawn IPC opcode

The struct itself is all kinds of wrong as I blindly copied it from
Sapphire, so I wouldn't depend on it just yet.
This commit is contained in:
Joshua Goins 2025-07-13 08:56:15 -04:00
parent 7cfa20052d
commit c04cfdf5da
3 changed files with 46 additions and 0 deletions

View file

@ -259,6 +259,11 @@
"name": "ContentFinderFound2",
"opcode": 619,
"size": 812
},
{
"name": "ObjectSpawn",
"opcode": 425,
"size": 64
}
],
"ClientZoneIpcType": [

View file

@ -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<u8>,
@ -872,6 +877,10 @@ mod tests {
unk4: 0,
},
),
(
ServerZoneIpcType::ObjectSpawn,
ServerZoneIpcData::ObjectSpawn(ObjectSpawn::default()),
),
];
for (opcode, data) in &ipc_types {

View file

@ -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,
}