mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-20 06:37:45 +00:00
Add inventory modification packet
The size isn't quite right yet, but whatever.
This commit is contained in:
parent
1a7da9d662
commit
1bdacaaede
5 changed files with 66 additions and 0 deletions
|
@ -256,6 +256,11 @@
|
||||||
"name": "Unk19",
|
"name": "Unk19",
|
||||||
"opcode": 379,
|
"opcode": 379,
|
||||||
"size": 16
|
"size": 16
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "InventoryModify",
|
||||||
|
"opcode": 318,
|
||||||
|
"size": 112
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"ServerLobbyIpcType": [
|
"ServerLobbyIpcType": [
|
||||||
|
|
BIN
resources/tests/inventory_modify.bin
Normal file
BIN
resources/tests/inventory_modify.bin
Normal file
Binary file not shown.
|
@ -813,6 +813,9 @@ async fn client_loop(
|
||||||
ClientZoneIpcData::Unk19 { .. } => {
|
ClientZoneIpcData::Unk19 { .. } => {
|
||||||
tracing::info!("Recieved Unk19!");
|
tracing::info!("Recieved Unk19!");
|
||||||
}
|
}
|
||||||
|
ClientZoneIpcData::InventoryModify(action) => {
|
||||||
|
tracing::info!("Client is modifying inventory! {action:#?}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SegmentType::KeepAlive { id, timestamp } => {
|
SegmentType::KeepAlive { id, timestamp } => {
|
||||||
|
|
53
src/world/ipc/inventory_modify.rs
Normal file
53
src/world/ipc/inventory_modify.rs
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
use binrw::binrw;
|
||||||
|
|
||||||
|
#[binrw]
|
||||||
|
#[derive(Debug, Clone, Default)]
|
||||||
|
pub struct InventoryModify {
|
||||||
|
context_id: u32,
|
||||||
|
operation_type: u8,
|
||||||
|
#[brw(pad_before = 3)]
|
||||||
|
src_actor_id: u32,
|
||||||
|
src_storage_id: u32,
|
||||||
|
src_container_index: i16,
|
||||||
|
#[brw(pad_before = 4)]
|
||||||
|
src_stack: u32,
|
||||||
|
src_catalog_id: u32,
|
||||||
|
dst_actor_id: u32,
|
||||||
|
dst_storage_id: u32,
|
||||||
|
dst_container_index: i16,
|
||||||
|
#[brw(pad_before = 2)]
|
||||||
|
dst_stack: u32,
|
||||||
|
dst_catalog_id: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use std::{fs::read, io::Cursor, path::PathBuf};
|
||||||
|
|
||||||
|
use binrw::BinRead;
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn read_inventory_modify() {
|
||||||
|
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||||
|
d.push("resources/tests/inventory_modify.bin");
|
||||||
|
|
||||||
|
let buffer = read(d).unwrap();
|
||||||
|
let mut buffer = Cursor::new(&buffer);
|
||||||
|
|
||||||
|
let modify_inventory = InventoryModify::read_le(&mut buffer).unwrap();
|
||||||
|
assert_eq!(modify_inventory.context_id, 0x10000002);
|
||||||
|
assert_eq!(modify_inventory.operation_type, 70);
|
||||||
|
assert_eq!(modify_inventory.src_actor_id, 0);
|
||||||
|
assert_eq!(modify_inventory.src_storage_id, 1000);
|
||||||
|
assert_eq!(modify_inventory.src_container_index, 4);
|
||||||
|
assert_eq!(modify_inventory.src_stack, 0);
|
||||||
|
assert_eq!(modify_inventory.src_catalog_id, 0);
|
||||||
|
assert_eq!(modify_inventory.dst_actor_id, 209911808);
|
||||||
|
assert_eq!(modify_inventory.dst_storage_id, 0);
|
||||||
|
assert_eq!(modify_inventory.dst_container_index, 96);
|
||||||
|
assert_eq!(modify_inventory.dst_stack, 0);
|
||||||
|
assert_eq!(modify_inventory.dst_catalog_id, 4194304);
|
||||||
|
}
|
||||||
|
}
|
|
@ -68,6 +68,9 @@ pub use actor_move::ActorMove;
|
||||||
mod actor_set_pos;
|
mod actor_set_pos;
|
||||||
pub use actor_set_pos::ActorSetPos;
|
pub use actor_set_pos::ActorSetPos;
|
||||||
|
|
||||||
|
mod inventory_modify;
|
||||||
|
pub use inventory_modify::InventoryModify;
|
||||||
|
|
||||||
use crate::common::Position;
|
use crate::common::Position;
|
||||||
use crate::common::read_string;
|
use crate::common::read_string;
|
||||||
use crate::common::write_string;
|
use crate::common::write_string;
|
||||||
|
@ -334,6 +337,8 @@ pub enum ClientZoneIpcData {
|
||||||
Unk19 {
|
Unk19 {
|
||||||
unk: [u8; 16], // TODO: unknown
|
unk: [u8; 16], // TODO: unknown
|
||||||
},
|
},
|
||||||
|
#[br(pre_assert(*magic == ClientZoneIpcType::InventoryModify))]
|
||||||
|
InventoryModify(InventoryModify),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue