From 1713c30bc4922ed738cae3cef713245af2286419 Mon Sep 17 00:00:00 2001 From: jake Date: Mon, 27 Dec 2021 00:46:15 -0700 Subject: [PATCH] trade request cancel --- src/packet/messages.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/packet/messages.rs b/src/packet/messages.rs index 0a79e83..7d1ff8b 100644 --- a/src/packet/messages.rs +++ b/src/packet/messages.rs @@ -700,6 +700,7 @@ pub enum TradeRequestCommand { RemoveItem(u32, u32), Confirm, FinalConfirm, + Cancel, } impl PSOPacketData for TradeRequestCommand { @@ -737,6 +738,9 @@ impl PSOPacketData for TradeRequestCommand { 4 => { Ok(TradeRequestCommand::FinalConfirm) }, + 5 => { + Ok(TradeRequestCommand::Cancel) + }, _ => { Err(PacketParseError::InvalidValue) }, @@ -784,6 +788,12 @@ impl PSOPacketData for TradeRequestCommand { .chain(std::iter::repeat(0).take(11)) .collect() }, + TradeRequestCommand::Cancel=> { + vec![5u8] + .into_iter() + .chain(std::iter::repeat(0).take(11)) + .collect() + }, } } } @@ -1576,3 +1586,15 @@ impl PSOPacketData for GameMessage { } } } + + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_trade_request_cancel() { + let data = vec![166, 4, 0, 0, 5, 4, 0, 0, 157, 58, 113, 0, 1, 0, 0, 0]; + let _pkt = GameMessage::from_bytes(&mut std::io::Cursor::new(data)).unwrap(); + } +}