diff --git a/src/packet/messages.rs b/src/packet/messages.rs index e8d4903..1dc12de 100644 --- a/src/packet/messages.rs +++ b/src/packet/messages.rs @@ -19,23 +19,25 @@ pub struct PlayerWalking { } - -pub enum Message { +#[derive(Debug, Clone, PartialEq)] +pub enum GameMessage { PlayerWalking(PlayerWalking), } -impl PSOPacketData for Message { +impl PSOPacketData for GameMessage { fn from_bytes(mut cur: &mut R) -> Result { let mut byte = [0u8; 1]; cur.read(&mut byte); cur.seek(SeekFrom::Current(-1)); // Cursor doesn't implement Peek? match byte[0] { - PlayerWalking::CMD => Ok(Message::PlayerWalking(PlayerWalking::from_bytes(&mut cur)?)), + PlayerWalking::CMD => Ok(GameMessage::PlayerWalking(PlayerWalking::from_bytes(&mut cur)?)), _ => Err(PacketParseError::WrongPacketCommand), } } fn as_bytes(&self) -> Vec { - Vec::new() + match self { + GameMessage::PlayerWalking(data) => data.as_bytes(), + } } }