Browse Source

Merge pull request 'trade request cancel' (#16) from trade_cancel into master

Reviewed-on: #16
pull/18/head
jake 3 years ago
parent
commit
0bd4396bd1
  1. 22
      src/packet/messages.rs

22
src/packet/messages.rs

@ -700,6 +700,7 @@ pub enum TradeRequestCommand {
RemoveItem(u32, u32), RemoveItem(u32, u32),
Confirm, Confirm,
FinalConfirm, FinalConfirm,
Cancel,
} }
impl PSOPacketData for TradeRequestCommand { impl PSOPacketData for TradeRequestCommand {
@ -737,6 +738,9 @@ impl PSOPacketData for TradeRequestCommand {
4 => { 4 => {
Ok(TradeRequestCommand::FinalConfirm) Ok(TradeRequestCommand::FinalConfirm)
}, },
5 => {
Ok(TradeRequestCommand::Cancel)
},
_ => { _ => {
Err(PacketParseError::InvalidValue) Err(PacketParseError::InvalidValue)
}, },
@ -784,6 +788,12 @@ impl PSOPacketData for TradeRequestCommand {
.chain(std::iter::repeat(0).take(11)) .chain(std::iter::repeat(0).take(11))
.collect() .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