wow_world_messages/world/tbc/
msg_query_guild_bank_text_client.rs1use std::io::{Read, Write};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)]
10pub struct MSG_QUERY_GUILD_BANK_TEXT_Client {
11 pub tab: u8,
12}
13
14impl crate::private::Sealed for MSG_QUERY_GUILD_BANK_TEXT_Client {}
15impl MSG_QUERY_GUILD_BANK_TEXT_Client {
16 fn read_inner(mut r: &mut &[u8], body_size: u32) -> Result<Self, crate::errors::ParseErrorKind> {
17 if body_size != 1 {
18 return Err(crate::errors::ParseErrorKind::InvalidSize);
19 }
20
21 let tab = crate::util::read_u8_le(&mut r)?;
23
24 Ok(Self {
25 tab,
26 })
27 }
28
29}
30
31impl crate::Message for MSG_QUERY_GUILD_BANK_TEXT_Client {
32 const OPCODE: u32 = 0x0409;
33
34 #[cfg(feature = "print-testcase")]
35 fn message_name(&self) -> &'static str {
36 "MSG_QUERY_GUILD_BANK_TEXT_Client"
37 }
38
39 #[cfg(feature = "print-testcase")]
40 fn to_test_case_string(&self) -> Option<String> {
41 use std::fmt::Write;
42 use crate::traits::Message;
43
44 let mut s = String::new();
45
46 writeln!(s, "test MSG_QUERY_GUILD_BANK_TEXT_Client {{").unwrap();
47 writeln!(s, " tab = {};", self.tab).unwrap();
49
50 writeln!(s, "}} [").unwrap();
51
52 let [a, b] = 5_u16.to_be_bytes();
53 writeln!(s, " {a:#04X}, {b:#04X}, /* size */").unwrap();
54 let [a, b, c, d] = 1033_u32.to_le_bytes();
55 writeln!(s, " {a:#04X}, {b:#04X}, {c:#04X}, {d:#04X}, /* opcode */").unwrap();
56 let mut bytes: Vec<u8> = Vec::new();
57 self.write_into_vec(&mut bytes).unwrap();
58 let mut bytes = bytes.into_iter();
59
60 crate::util::write_bytes(&mut s, &mut bytes, 1, "tab", " ");
61
62
63 writeln!(s, "] {{").unwrap();
64 writeln!(s, " versions = \"{}\";", std::env::var("WOWM_TEST_CASE_WORLD_VERSION").unwrap_or("2.4.3".to_string())).unwrap();
65 writeln!(s, "}}\n").unwrap();
66
67 Some(s)
68 }
69
70 fn size_without_header(&self) -> u32 {
71 1
72 }
73
74 fn write_into_vec(&self, mut w: impl Write) -> Result<(), std::io::Error> {
75 w.write_all(&self.tab.to_le_bytes())?;
77
78 Ok(())
79 }
80
81 fn read_body<S: crate::private::Sealed>(r: &mut &[u8], body_size: u32) -> Result<Self, crate::errors::ParseError> {
82 Self::read_inner(r, body_size).map_err(|a| crate::errors::ParseError::new(1033, "MSG_QUERY_GUILD_BANK_TEXT_Client", body_size, a))
83 }
84
85}
86
87#[cfg(feature = "tbc")]
88impl crate::tbc::ClientMessage for MSG_QUERY_GUILD_BANK_TEXT_Client {}
89