Browse Source

trade request cancel

pull/16/head
jake 3 years ago
parent
commit
1713c30bc4
  1. 22
      src/packet/messages.rs

22
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();
}
}
Loading…
Cancel
Save