wow_world_messages/world/wrath/
msg_move_stop_swim.rs1use std::io::{Read, Write};
2
3use crate::Guid;
4use crate::wrath::{
5 MovementFlags, MovementInfo, TransportInfo, Vector3d,
6};
7
8#[derive(Debug, Clone, PartialEq, PartialOrd, Default)]
16pub struct MSG_MOVE_STOP_SWIM {
17 pub guid: Guid,
18 pub info: MovementInfo,
19}
20
21impl crate::private::Sealed for MSG_MOVE_STOP_SWIM {}
22impl MSG_MOVE_STOP_SWIM {
23 fn read_inner(mut r: &mut &[u8], body_size: u32) -> Result<Self, crate::errors::ParseErrorKind> {
24 if !(31..=97).contains(&body_size) {
25 return Err(crate::errors::ParseErrorKind::InvalidSize);
26 }
27
28 let guid = crate::util::read_packed_guid(&mut r)?;
30
31 let info = MovementInfo::read(&mut r)?;
33
34 Ok(Self {
35 guid,
36 info,
37 })
38 }
39
40}
41
42impl crate::Message for MSG_MOVE_STOP_SWIM {
43 const OPCODE: u32 = 0x00cb;
44
45 #[cfg(feature = "print-testcase")]
46 fn message_name(&self) -> &'static str {
47 "MSG_MOVE_STOP_SWIM"
48 }
49
50 #[cfg(feature = "print-testcase")]
51 fn to_test_case_string(&self) -> Option<String> {
52 panic!("MSG types not supported");
53 }
54
55 fn size_without_header(&self) -> u32 {
56 self.size() as u32
57 }
58
59 fn write_into_vec(&self, mut w: impl Write) -> Result<(), std::io::Error> {
60 crate::util::write_packed_guid(&self.guid, &mut w)?;
62
63 self.info.write_into_vec(&mut w)?;
65
66 Ok(())
67 }
68
69 fn read_body<S: crate::private::Sealed>(r: &mut &[u8], body_size: u32) -> Result<Self, crate::errors::ParseError> {
70 Self::read_inner(r, body_size).map_err(|a| crate::errors::ParseError::new(203, "MSG_MOVE_STOP_SWIM", body_size, a))
71 }
72
73}
74
75#[cfg(feature = "wrath")]
76impl crate::wrath::ClientMessage for MSG_MOVE_STOP_SWIM {}
77
78#[cfg(feature = "wrath")]
79impl crate::wrath::ServerMessage for MSG_MOVE_STOP_SWIM {}
80
81impl MSG_MOVE_STOP_SWIM {
82 pub(crate) const fn size(&self) -> usize {
83 crate::util::packed_guid_size(&self.guid) + self.info.size() }
86}
87