From b3ece7ad81be8013f45cb701085da3428693f9bc Mon Sep 17 00:00:00 2001 From: Gtker Date: Sat, 30 Mar 2024 19:47:11 +0100 Subject: [PATCH] Inline some new type size functions --- .../cmd_auth_logon_challenge_server.rs | 21 +-- .../version_5/cmd_auth_logon_proof_client.rs | 17 +-- .../cmd_auth_logon_challenge_server.rs | 29 +--- .../version_8/cmd_auth_logon_proof_client.rs | 17 +-- .../src/logon/version_8/realm.rs | 8 +- .../rust_printer/rust_view/rust_enumerator.rs | 13 ++ .../src/rust_printer/rust_view/rust_member.rs | 3 + .../src/rust_printer/rust_view/rust_type.rs | 37 ++++- .../rust_printer/structs/print_new_types.rs | 22 ++- wow_message_parser/tests/flag_if_else_if.txt | 18 +-- wow_message_parser/tests/simple_if_flag.txt | 8 +- .../src/world/tbc/movement_block.rs | 48 +----- .../src/world/tbc/movement_info.rs | 21 +-- wow_world_messages/src/world/tbc/relation.rs | 8 +- .../src/world/tbc/smsg_party_member_stats.rs | 129 ++--------------- .../world/tbc/smsg_party_member_stats_full.rs | 129 ++--------------- .../src/world/tbc/smsg_spell_go.rs | 9 +- .../src/world/tbc/smsg_spell_start.rs | 9 +- .../src/world/tbc/spell_cast_targets.rs | 16 +- .../src/world/vanilla/movement_block.rs | 53 +------ .../src/world/vanilla/movement_info.rs | 27 +--- .../world/vanilla/smsg_party_member_stats.rs | 129 ++--------------- .../vanilla/smsg_party_member_stats_full.rs | 129 ++--------------- .../src/world/vanilla/smsg_spell_go.rs | 9 +- .../src/world/vanilla/smsg_spell_start.rs | 9 +- .../src/world/vanilla/spell_cast_targets.rs | 16 +- .../src/world/wrath/aura_update.rs | 9 +- .../src/world/wrath/lfg_list_group.rs | 8 +- .../src/world/wrath/lfg_list_player.rs | 73 +--------- .../src/world/wrath/movement_block.rs | 64 ++------ .../src/world/wrath/movement_info.rs | 21 +-- .../src/world/wrath/relation.rs | 8 +- .../world/wrath/smsg_attackerstateupdate.rs | 51 +------ .../src/world/wrath/smsg_monster_move.rs | 18 +-- .../wrath/smsg_monster_move_transport.rs | 18 +-- .../world/wrath/smsg_party_member_stats.rs | 137 +++--------------- .../wrath/smsg_party_member_stats_full.rs | 137 +++--------------- .../src/world/wrath/smsg_spell_go.rs | 53 +------ .../src/world/wrath/smsg_spell_start.rs | 26 +--- .../src/world/wrath/spell_cast_targets.rs | 16 +- 40 files changed, 245 insertions(+), 1328 deletions(-) diff --git a/wow_login_messages/src/logon/version_5/cmd_auth_logon_challenge_server.rs b/wow_login_messages/src/logon/version_5/cmd_auth_logon_challenge_server.rs index faba911e5f..9c7194bbf1 100644 --- a/wow_login_messages/src/logon/version_5/cmd_auth_logon_challenge_server.rs +++ b/wow_login_messages/src/logon/version_5/cmd_auth_logon_challenge_server.rs @@ -795,14 +795,14 @@ impl CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag { 1 // inner + { if let Some(s) = &self.pin { - s.size() + 20 } else { 0 } } + { if let Some(s) = &self.matrix_card { - s.size() + 12 } else { 0 } @@ -816,13 +816,6 @@ pub struct CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_Pin { pub pin_salt: [u8; 16], } -impl CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_Pin { - pub(crate) const fn size(&self) -> usize { - 4 // pin_grid_seed: u32 - + 16 // pin_salt: u8[16] - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_MatrixCard { pub challenge_count: u8, @@ -832,16 +825,6 @@ pub struct CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_MatrixCard { pub width: u8, } -impl CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_MatrixCard { - pub(crate) const fn size(&self) -> usize { - 1 // challenge_count: u8 - + 1 // digit_count: u8 - + 1 // height: u8 - + 8 // seed: u64 - + 1 // width: u8 - } -} - impl Default for CMD_AUTH_LOGON_CHALLENGE_Server { fn default() -> Self { // First enumerator without any fields diff --git a/wow_login_messages/src/logon/version_5/cmd_auth_logon_proof_client.rs b/wow_login_messages/src/logon/version_5/cmd_auth_logon_proof_client.rs index 862bcac3d6..1d7e7302c3 100644 --- a/wow_login_messages/src/logon/version_5/cmd_auth_logon_proof_client.rs +++ b/wow_login_messages/src/logon/version_5/cmd_auth_logon_proof_client.rs @@ -558,14 +558,14 @@ impl CMD_AUTH_LOGON_PROOF_Client_SecurityFlag { 1 // inner + { if let Some(s) = &self.pin { - s.size() + 36 } else { 0 } } + { if let Some(s) = &self.matrix_card { - s.size() + 20 } else { 0 } @@ -579,24 +579,11 @@ pub struct CMD_AUTH_LOGON_PROOF_Client_SecurityFlag_Pin { pub pin_salt: [u8; 16], } -impl CMD_AUTH_LOGON_PROOF_Client_SecurityFlag_Pin { - pub(crate) const fn size(&self) -> usize { - 20 // pin_hash: u8[20] - + 16 // pin_salt: u8[16] - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct CMD_AUTH_LOGON_PROOF_Client_SecurityFlag_MatrixCard { pub matrix_card_proof: [u8; 20], } -impl CMD_AUTH_LOGON_PROOF_Client_SecurityFlag_MatrixCard { - pub(crate) const fn size(&self) -> usize { - 20 // matrix_card_proof: u8[20] - } -} - #[cfg(test)] mod test_version_5 { #![allow(clippy::missing_const_for_fn)] diff --git a/wow_login_messages/src/logon/version_8/cmd_auth_logon_challenge_server.rs b/wow_login_messages/src/logon/version_8/cmd_auth_logon_challenge_server.rs index 78bd764d04..78338fbc16 100644 --- a/wow_login_messages/src/logon/version_8/cmd_auth_logon_challenge_server.rs +++ b/wow_login_messages/src/logon/version_8/cmd_auth_logon_challenge_server.rs @@ -881,21 +881,21 @@ impl CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag { 1 // inner + { if let Some(s) = &self.pin { - s.size() + 20 } else { 0 } } + { if let Some(s) = &self.matrix_card { - s.size() + 12 } else { 0 } } + { if let Some(s) = &self.authenticator { - s.size() + 1 } else { 0 } @@ -909,13 +909,6 @@ pub struct CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_Pin { pub pin_salt: [u8; 16], } -impl CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_Pin { - pub(crate) const fn size(&self) -> usize { - 4 // pin_grid_seed: u32 - + 16 // pin_salt: u8[16] - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_MatrixCard { pub challenge_count: u8, @@ -925,27 +918,11 @@ pub struct CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_MatrixCard { pub width: u8, } -impl CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_MatrixCard { - pub(crate) const fn size(&self) -> usize { - 1 // challenge_count: u8 - + 1 // digit_count: u8 - + 1 // height: u8 - + 8 // seed: u64 - + 1 // width: u8 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_Authenticator { pub required: u8, } -impl CMD_AUTH_LOGON_CHALLENGE_Server_SecurityFlag_Authenticator { - pub(crate) const fn size(&self) -> usize { - 1 // required: u8 - } -} - impl Default for CMD_AUTH_LOGON_CHALLENGE_Server { fn default() -> Self { // First enumerator without any fields diff --git a/wow_login_messages/src/logon/version_8/cmd_auth_logon_proof_client.rs b/wow_login_messages/src/logon/version_8/cmd_auth_logon_proof_client.rs index 2e65ccaa84..ef936c6ec5 100644 --- a/wow_login_messages/src/logon/version_8/cmd_auth_logon_proof_client.rs +++ b/wow_login_messages/src/logon/version_8/cmd_auth_logon_proof_client.rs @@ -652,14 +652,14 @@ impl CMD_AUTH_LOGON_PROOF_Client_SecurityFlag { 1 // inner + { if let Some(s) = &self.pin { - s.size() + 36 } else { 0 } } + { if let Some(s) = &self.matrix_card { - s.size() + 20 } else { 0 } @@ -680,24 +680,11 @@ pub struct CMD_AUTH_LOGON_PROOF_Client_SecurityFlag_Pin { pub pin_salt: [u8; 16], } -impl CMD_AUTH_LOGON_PROOF_Client_SecurityFlag_Pin { - pub(crate) const fn size(&self) -> usize { - 20 // pin_hash: u8[20] - + 16 // pin_salt: u8[16] - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct CMD_AUTH_LOGON_PROOF_Client_SecurityFlag_MatrixCard { pub matrix_card_proof: [u8; 20], } -impl CMD_AUTH_LOGON_PROOF_Client_SecurityFlag_MatrixCard { - pub(crate) const fn size(&self) -> usize { - 20 // matrix_card_proof: u8[20] - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct CMD_AUTH_LOGON_PROOF_Client_SecurityFlag_Authenticator { pub authenticator: String, diff --git a/wow_login_messages/src/logon/version_8/realm.rs b/wow_login_messages/src/logon/version_8/realm.rs index 6632543f40..333b05ec5c 100644 --- a/wow_login_messages/src/logon/version_8/realm.rs +++ b/wow_login_messages/src/logon/version_8/realm.rs @@ -472,7 +472,7 @@ impl Realm_RealmFlag { 1 // inner + { if let Some(s) = &self.specify_build { - s.size() + 5 } else { 0 } @@ -485,9 +485,3 @@ pub struct Realm_RealmFlag_SpecifyBuild { pub version: Version, } -impl Realm_RealmFlag_SpecifyBuild { - pub(crate) const fn size(&self) -> usize { - 5 // version: Version - } -} - diff --git a/wow_message_parser/src/rust_printer/rust_view/rust_enumerator.rs b/wow_message_parser/src/rust_printer/rust_view/rust_enumerator.rs index e8935f2ca0..68763e04af 100644 --- a/wow_message_parser/src/rust_printer/rust_view/rust_enumerator.rs +++ b/wow_message_parser/src/rust_printer/rust_view/rust_enumerator.rs @@ -23,6 +23,19 @@ impl RustEnumerator { v } + pub(crate) fn is_constant(&self) -> Option { + let mut size = 0; + for m in self.members() { + if let Some(i) = m.is_constant() { + size += i; + } else { + return None; + } + } + + Some(size) + } + pub(crate) fn name(&self) -> &str { &self.name } diff --git a/wow_message_parser/src/rust_printer/rust_view/rust_member.rs b/wow_message_parser/src/rust_printer/rust_view/rust_member.rs index 883e5a02fb..96391fda23 100644 --- a/wow_message_parser/src/rust_printer/rust_view/rust_member.rs +++ b/wow_message_parser/src/rust_printer/rust_view/rust_member.rs @@ -30,6 +30,9 @@ impl RustMember { v.push(self); v } + pub(crate) fn is_constant(&self) -> Option { + self.ty().is_constant() + } pub(crate) fn is_single_rust_definer(&self) -> bool { matches!( diff --git a/wow_message_parser/src/rust_printer/rust_view/rust_type.rs b/wow_message_parser/src/rust_printer/rust_view/rust_type.rs index 7093eb603a..44b7a67988 100644 --- a/wow_message_parser/src/rust_printer/rust_view/rust_type.rs +++ b/wow_message_parser/src/rust_printer/rust_view/rust_type.rs @@ -71,6 +71,37 @@ pub(crate) enum RustType { } impl RustType { + pub(crate) fn is_constant(&self) -> Option { + match self { + RustType::Enum { + int_ty, + enumerators, + .. + } + | RustType::Flag { + int_ty, + enumerators, + .. + } => { + let mut size = 0; + + for enumerator in enumerators { + if let Some(i) = enumerator.is_constant() { + if i > size { + size = i; + } + } else { + return None; + } + } + + Some(size + int_ty.sizes().is_constant().unwrap()) + } + RustType::Struct { sizes, .. } => sizes.is_constant(), + _ => self.to_type().sizes().is_constant(), + } + } + pub(crate) fn str(&self) -> String { match self { RustType::Array { array, .. } => array.str(), @@ -119,11 +150,9 @@ impl RustType { RustType::IpAddress => Type::IpAddress, RustType::Seconds => Type::Seconds, RustType::Milliseconds => Type::Milliseconds, + RustType::Array { array, .. } => Type::Array(array.clone()), - RustType::Array { .. } - | RustType::Enum { .. } - | RustType::Flag { .. } - | RustType::Struct { .. } => { + RustType::Enum { .. } | RustType::Flag { .. } | RustType::Struct { .. } => { panic!("invalid conversion") } RustType::Population => Type::Population, diff --git a/wow_message_parser/src/rust_printer/structs/print_new_types.rs b/wow_message_parser/src/rust_printer/structs/print_new_types.rs index 62cfe77278..1e32c3f69e 100644 --- a/wow_message_parser/src/rust_printer/structs/print_new_types.rs +++ b/wow_message_parser/src/rust_printer/structs/print_new_types.rs @@ -306,7 +306,11 @@ fn print_size_for_new_flag(s: &mut Writer, rd: &RustDefiner) { name = enumerator.name().to_lowercase() ), |s| { - s.wln("s.size()"); + if let Some(size) = enumerator.is_constant() { + s.wln(size.to_string()); + } else { + s.wln("s.size()"); + } }, |s| { s.wln("0"); @@ -335,13 +339,15 @@ fn print_types_for_new_flag(s: &mut Writer, rd: &RustDefiner) { } }); - let const_fn = enumerator - .members_in_struct() - .iter() - .all(|a| a.ty().size_is_const_fn()); - variable_size(s, &new_type_name, "size", const_fn, |s| { - print_rust_members_sizes(s, enumerator.members(), None, "self."); - }); + if enumerator.is_constant().is_none() { + let const_fn = enumerator + .members_in_struct() + .iter() + .all(|a| a.ty().size_is_const_fn()); + variable_size(s, &new_type_name, "size", const_fn, |s| { + print_rust_members_sizes(s, enumerator.members(), None, "self."); + }); + } } } diff --git a/wow_message_parser/tests/flag_if_else_if.txt b/wow_message_parser/tests/flag_if_else_if.txt index 60941e09bc..70631eec47 100644 --- a/wow_message_parser/tests/flag_if_else_if.txt +++ b/wow_message_parser/tests/flag_if_else_if.txt @@ -242,7 +242,7 @@ impl FlagIfElseIf_SimpleFlag { 1 // inner + { if let Some(s) = &self.one { - s.size() + 1 } else { 0 } @@ -255,12 +255,6 @@ pub struct FlagIfElseIf_SimpleFlag_One { pub if_one: u8, } -impl FlagIfElseIf_SimpleFlag_One { - pub(crate) const fn size(&self) -> usize { - 1 // if_one: u8 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum FlagIfElseIf_UpdateFlag_OneIf { OneIf { @@ -412,14 +406,14 @@ impl FlagIfElseIf_UpdateFlag { 1 // inner + { if let Some(s) = &self.one_if { - s.size() + 3 } else { 0 } } + { if let Some(s) = &self.eight_if { - s.size() + 1 } else { 0 } @@ -432,9 +426,3 @@ pub struct FlagIfElseIf_UpdateFlag_EightIf { pub last_if: u8, } -impl FlagIfElseIf_UpdateFlag_EightIf { - pub(crate) const fn size(&self) -> usize { - 1 // last_if: u8 - } -} - diff --git a/wow_message_parser/tests/simple_if_flag.txt b/wow_message_parser/tests/simple_if_flag.txt index cdf61d2d3e..77aceffbee 100644 --- a/wow_message_parser/tests/simple_if_flag.txt +++ b/wow_message_parser/tests/simple_if_flag.txt @@ -148,7 +148,7 @@ impl SimpleIfFlag_SimpleFlag { 1 // inner + { if let Some(s) = &self.zero { - s.size() + 1 } else { 0 } @@ -161,9 +161,3 @@ pub struct SimpleIfFlag_SimpleFlag_Zero { pub basic: u8, } -impl SimpleIfFlag_SimpleFlag_Zero { - pub(crate) const fn size(&self) -> usize { - 1 // basic: u8 - } -} - diff --git a/wow_world_messages/src/world/tbc/movement_block.rs b/wow_world_messages/src/world/tbc/movement_block.rs index a2fe835684..9ee21f5507 100644 --- a/wow_world_messages/src/world/tbc/movement_block.rs +++ b/wow_world_messages/src/world/tbc/movement_block.rs @@ -1441,7 +1441,7 @@ impl MovementBlock_SplineFlag { 4 // inner + { if let Some(s) = &self.final_angle { - s.size() + 16 } else { 0 } @@ -2166,21 +2166,21 @@ impl MovementBlock_MovementFlags { } + { if let Some(s) = &self.jumping { - s.size() + 16 } else { 0 } } + { if let Some(s) = &self.swimming { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.spline_elevation { - s.size() + 4 } else { 0 } @@ -2214,26 +2214,11 @@ pub struct MovementBlock_MovementFlags_Jumping { pub z_speed: f32, } -impl MovementBlock_MovementFlags_Jumping { - pub(crate) const fn size(&self) -> usize { - 4 // cos_angle: f32 - + 4 // sin_angle: f32 - + 4 // xy_speed: f32 - + 4 // z_speed: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct MovementBlock_MovementFlags_SplineElevation { pub spline_elevation: f32, } -impl MovementBlock_MovementFlags_SplineElevation { - pub(crate) const fn size(&self) -> usize { - 4 // spline_elevation: f32 - } -} - #[derive(Debug, Clone, PartialEq, PartialOrd, Default)] pub struct MovementBlock_MovementFlags_SplineEnabled { pub duration: u32, @@ -2557,7 +2542,7 @@ impl MovementBlock_UpdateFlag { 1 // inner + { if let Some(s) = &self.transport { - s.size() + 4 } else { 0 } @@ -2571,14 +2556,14 @@ impl MovementBlock_UpdateFlag { } + { if let Some(s) = &self.high_guid { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.all { - s.size() + 4 } else { 0 } @@ -2598,12 +2583,6 @@ pub struct MovementBlock_UpdateFlag_Transport { pub transport_progress_in_ms: u32, } -impl MovementBlock_UpdateFlag_Transport { - pub(crate) const fn size(&self) -> usize { - 4 // transport_progress_in_ms: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct MovementBlock_UpdateFlag_MeleeAttacking { pub guid: Guid, @@ -2621,21 +2600,8 @@ pub struct MovementBlock_UpdateFlag_HighGuid { pub unknown1: u32, } -impl MovementBlock_UpdateFlag_HighGuid { - pub(crate) const fn size(&self) -> usize { - 4 // unknown0: u32 - + 4 // unknown1: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct MovementBlock_UpdateFlag_All { pub unknown2: u32, } -impl MovementBlock_UpdateFlag_All { - pub(crate) const fn size(&self) -> usize { - 4 // unknown2: u32 - } -} - diff --git a/wow_world_messages/src/world/tbc/movement_info.rs b/wow_world_messages/src/world/tbc/movement_info.rs index 2029a1485a..f1b2c1de5e 100644 --- a/wow_world_messages/src/world/tbc/movement_info.rs +++ b/wow_world_messages/src/world/tbc/movement_info.rs @@ -968,21 +968,21 @@ impl MovementInfo_MovementFlags { } + { if let Some(s) = &self.jumping { - s.size() + 16 } else { 0 } } + { if let Some(s) = &self.swimming { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.spline_elevation { - s.size() + 4 } else { 0 } @@ -1009,23 +1009,8 @@ pub struct MovementInfo_MovementFlags_Jumping { pub z_speed: f32, } -impl MovementInfo_MovementFlags_Jumping { - pub(crate) const fn size(&self) -> usize { - 4 // cos_angle: f32 - + 4 // sin_angle: f32 - + 4 // xy_speed: f32 - + 4 // z_speed: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct MovementInfo_MovementFlags_SplineElevation { pub spline_elevation: f32, } -impl MovementInfo_MovementFlags_SplineElevation { - pub(crate) const fn size(&self) -> usize { - 4 // spline_elevation: f32 - } -} - diff --git a/wow_world_messages/src/world/tbc/relation.rs b/wow_world_messages/src/world/tbc/relation.rs index 5597dd3477..8bc94b7af2 100644 --- a/wow_world_messages/src/world/tbc/relation.rs +++ b/wow_world_messages/src/world/tbc/relation.rs @@ -335,7 +335,7 @@ impl Relation_RelationType { 4 // inner + { if let Some(s) = &self.friend { - s.size() + 13 } else { 0 } @@ -348,9 +348,3 @@ pub struct Relation_RelationType_Friend { pub status: Relation_FriendStatus, } -impl Relation_RelationType_Friend { - pub(crate) const fn size(&self) -> usize { - self.status.size() // status: Relation_FriendStatus - } -} - diff --git a/wow_world_messages/src/world/tbc/smsg_party_member_stats.rs b/wow_world_messages/src/world/tbc/smsg_party_member_stats.rs index ce4f0c9bb9..c076408db2 100644 --- a/wow_world_messages/src/world/tbc/smsg_party_member_stats.rs +++ b/wow_world_messages/src/world/tbc/smsg_party_member_stats.rs @@ -1627,63 +1627,63 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { 4 // inner + { if let Some(s) = &self.status { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.level { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.zone { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.position { - s.size() + 4 } else { 0 } @@ -1697,7 +1697,7 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { } + { if let Some(s) = &self.pet_guid { - s.size() + 8 } else { 0 } @@ -1711,42 +1711,42 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { } + { if let Some(s) = &self.pet_model_id { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_cur_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.pet_cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_power { - s.size() + 2 } else { 0 } @@ -1766,102 +1766,47 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Status { pub status: GroupMemberOnlineStatus, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Status { - pub(crate) const fn size(&self) -> usize { - 1 // status: GroupMemberOnlineStatus - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurHp { pub current_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurHp { - pub(crate) const fn size(&self) -> usize { - 2 // current_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxHp { pub max_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxHp { - pub(crate) const fn size(&self) -> usize { - 2 // max_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PowerType { pub power: Power, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PowerType { - pub(crate) const fn size(&self) -> usize { - 1 // power: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurPower { pub current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurPower { - pub(crate) const fn size(&self) -> usize { - 2 // current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxPower { pub max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Level { pub level: Level, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Level { - pub(crate) const fn size(&self) -> usize { - 2 // level: Level16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Zone { pub area: Area, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Zone { - pub(crate) const fn size(&self) -> usize { - 4 // area: Area - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Position { pub position_x: u16, pub position_y: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Position { - pub(crate) const fn size(&self) -> usize { - 2 // position_x: u16 - + 2 // position_y: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Auras { pub auras: AuraMask, @@ -1878,12 +1823,6 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetGuid { pub pet: Guid, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetGuid { - pub(crate) const fn size(&self) -> usize { - 8 // pet: Guid - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetName { pub pet_name: String, @@ -1900,67 +1839,31 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetModelId { pub pet_display_id: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetModelId { - pub(crate) const fn size(&self) -> usize { - 2 // pet_display_id: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurHp { pub pet_current_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurHp { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxHp { pub pet_max_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxHp { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetPowerType { pub pet_power_type: Power, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetPowerType { - pub(crate) const fn size(&self) -> usize { - 1 // pet_power_type: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurPower { pub pet_current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxPower { pub pet_max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetAuras { pub pet_auras: AuraMask, diff --git a/wow_world_messages/src/world/tbc/smsg_party_member_stats_full.rs b/wow_world_messages/src/world/tbc/smsg_party_member_stats_full.rs index 398043e778..3409dd268f 100644 --- a/wow_world_messages/src/world/tbc/smsg_party_member_stats_full.rs +++ b/wow_world_messages/src/world/tbc/smsg_party_member_stats_full.rs @@ -1627,63 +1627,63 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { 4 // inner + { if let Some(s) = &self.status { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.level { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.zone { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.position { - s.size() + 4 } else { 0 } @@ -1697,7 +1697,7 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { } + { if let Some(s) = &self.pet_guid { - s.size() + 8 } else { 0 } @@ -1711,42 +1711,42 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { } + { if let Some(s) = &self.pet_model_id { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_cur_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.pet_cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_power { - s.size() + 2 } else { 0 } @@ -1766,102 +1766,47 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Status { pub status: GroupMemberOnlineStatus, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Status { - pub(crate) const fn size(&self) -> usize { - 1 // status: GroupMemberOnlineStatus - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurHp { pub current_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurHp { - pub(crate) const fn size(&self) -> usize { - 2 // current_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxHp { pub max_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxHp { - pub(crate) const fn size(&self) -> usize { - 2 // max_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PowerType { pub power: Power, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PowerType { - pub(crate) const fn size(&self) -> usize { - 1 // power: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurPower { pub current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurPower { - pub(crate) const fn size(&self) -> usize { - 2 // current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxPower { pub max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Level { pub level: Level, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Level { - pub(crate) const fn size(&self) -> usize { - 2 // level: Level16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Zone { pub area: Area, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Zone { - pub(crate) const fn size(&self) -> usize { - 4 // area: Area - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Position { pub position_x: u16, pub position_y: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Position { - pub(crate) const fn size(&self) -> usize { - 2 // position_x: u16 - + 2 // position_y: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Auras { pub auras: AuraMask, @@ -1878,12 +1823,6 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetGuid { pub pet: Guid, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetGuid { - pub(crate) const fn size(&self) -> usize { - 8 // pet: Guid - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetName { pub pet_name: String, @@ -1900,67 +1839,31 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetModelId { pub pet_display_id: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetModelId { - pub(crate) const fn size(&self) -> usize { - 2 // pet_display_id: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurHp { pub pet_current_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurHp { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxHp { pub pet_max_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxHp { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetPowerType { pub pet_power_type: Power, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetPowerType { - pub(crate) const fn size(&self) -> usize { - 1 // pet_power_type: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurPower { pub pet_current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxPower { pub pet_max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetAuras { pub pet_auras: AuraMask, diff --git a/wow_world_messages/src/world/tbc/smsg_spell_go.rs b/wow_world_messages/src/world/tbc/smsg_spell_go.rs index 90006dfedc..19ab80d235 100644 --- a/wow_world_messages/src/world/tbc/smsg_spell_go.rs +++ b/wow_world_messages/src/world/tbc/smsg_spell_go.rs @@ -738,7 +738,7 @@ impl SMSG_SPELL_GO_CastFlags { 2 // inner + { if let Some(s) = &self.ammo { - s.size() + 8 } else { 0 } @@ -752,10 +752,3 @@ pub struct SMSG_SPELL_GO_CastFlags_Ammo { pub ammo_inventory_type: u32, } -impl SMSG_SPELL_GO_CastFlags_Ammo { - pub(crate) const fn size(&self) -> usize { - 4 // ammo_display_id: u32 - + 4 // ammo_inventory_type: u32 - } -} - diff --git a/wow_world_messages/src/world/tbc/smsg_spell_start.rs b/wow_world_messages/src/world/tbc/smsg_spell_start.rs index 8bfb75adcc..7a4d1e9392 100644 --- a/wow_world_messages/src/world/tbc/smsg_spell_start.rs +++ b/wow_world_messages/src/world/tbc/smsg_spell_start.rs @@ -643,7 +643,7 @@ impl SMSG_SPELL_START_CastFlags { 2 // inner + { if let Some(s) = &self.ammo { - s.size() + 8 } else { 0 } @@ -657,10 +657,3 @@ pub struct SMSG_SPELL_START_CastFlags_Ammo { pub ammo_inventory_type: u32, } -impl SMSG_SPELL_START_CastFlags_Ammo { - pub(crate) const fn size(&self) -> usize { - 4 // ammo_display_id: u32 - + 4 // ammo_inventory_type: u32 - } -} - diff --git a/wow_world_messages/src/world/tbc/spell_cast_targets.rs b/wow_world_messages/src/world/tbc/spell_cast_targets.rs index 34d96fc4de..0510986c9e 100644 --- a/wow_world_messages/src/world/tbc/spell_cast_targets.rs +++ b/wow_world_messages/src/world/tbc/spell_cast_targets.rs @@ -961,14 +961,14 @@ impl SpellCastTargets_SpellCastTargetFlags { } + { if let Some(s) = &self.source_location { - s.size() + 12 } else { 0 } } + { if let Some(s) = &self.dest_location { - s.size() + 12 } else { 0 } @@ -1002,23 +1002,11 @@ pub struct SpellCastTargets_SpellCastTargetFlags_SourceLocation { pub source: Vector3d, } -impl SpellCastTargets_SpellCastTargetFlags_SourceLocation { - pub(crate) const fn size(&self) -> usize { - 12 // source: Vector3d - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct SpellCastTargets_SpellCastTargetFlags_DestLocation { pub destination: Vector3d, } -impl SpellCastTargets_SpellCastTargetFlags_DestLocation { - pub(crate) const fn size(&self) -> usize { - 12 // destination: Vector3d - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SpellCastTargets_SpellCastTargetFlags_String { pub target_string: String, diff --git a/wow_world_messages/src/world/vanilla/movement_block.rs b/wow_world_messages/src/world/vanilla/movement_block.rs index e76f6cb0cf..b68b851250 100644 --- a/wow_world_messages/src/world/vanilla/movement_block.rs +++ b/wow_world_messages/src/world/vanilla/movement_block.rs @@ -1350,7 +1350,7 @@ impl MovementBlock_SplineFlag { 4 // inner + { if let Some(s) = &self.final_angle { - s.size() + 16 } else { 0 } @@ -2075,14 +2075,14 @@ impl MovementBlock_MovementFlags { } + { if let Some(s) = &self.jumping { - s.size() + 16 } else { 0 } } + { if let Some(s) = &self.swimming { - s.size() + 4 } else { 0 } @@ -2096,7 +2096,7 @@ impl MovementBlock_MovementFlags { } + { if let Some(s) = &self.spline_elevation { - s.size() + 4 } else { 0 } @@ -2127,26 +2127,11 @@ pub struct MovementBlock_MovementFlags_Jumping { pub z_speed: f32, } -impl MovementBlock_MovementFlags_Jumping { - pub(crate) const fn size(&self) -> usize { - 4 // cos_angle: f32 - + 4 // sin_angle: f32 - + 4 // xy_speed: f32 - + 4 // z_speed: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct MovementBlock_MovementFlags_Swimming { pub pitch: f32, } -impl MovementBlock_MovementFlags_Swimming { - pub(crate) const fn size(&self) -> usize { - 4 // pitch: f32 - } -} - #[derive(Debug, Clone, PartialEq, PartialOrd, Default)] pub struct MovementBlock_MovementFlags_SplineEnabled { pub duration: u32, @@ -2174,12 +2159,6 @@ pub struct MovementBlock_MovementFlags_SplineElevation { pub spline_elevation: f32, } -impl MovementBlock_MovementFlags_SplineElevation { - pub(crate) const fn size(&self) -> usize { - 4 // spline_elevation: f32 - } -} - #[derive(Debug, Clone, PartialEq, PartialOrd)] pub enum MovementBlock_UpdateFlag_Living { Living { @@ -2475,7 +2454,7 @@ impl MovementBlock_UpdateFlag { 1 // inner + { if let Some(s) = &self.transport { - s.size() + 4 } else { 0 } @@ -2489,14 +2468,14 @@ impl MovementBlock_UpdateFlag { } + { if let Some(s) = &self.high_guid { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.all { - s.size() + 4 } else { 0 } @@ -2516,12 +2495,6 @@ pub struct MovementBlock_UpdateFlag_Transport { pub transport_progress_in_ms: u32, } -impl MovementBlock_UpdateFlag_Transport { - pub(crate) const fn size(&self) -> usize { - 4 // transport_progress_in_ms: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct MovementBlock_UpdateFlag_MeleeAttacking { pub guid: Guid, @@ -2538,20 +2511,8 @@ pub struct MovementBlock_UpdateFlag_HighGuid { pub unknown0: u32, } -impl MovementBlock_UpdateFlag_HighGuid { - pub(crate) const fn size(&self) -> usize { - 4 // unknown0: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct MovementBlock_UpdateFlag_All { pub unknown1: u32, } -impl MovementBlock_UpdateFlag_All { - pub(crate) const fn size(&self) -> usize { - 4 // unknown1: u32 - } -} - diff --git a/wow_world_messages/src/world/vanilla/movement_info.rs b/wow_world_messages/src/world/vanilla/movement_info.rs index 8dfaf2faed..bdbd59b8d3 100644 --- a/wow_world_messages/src/world/vanilla/movement_info.rs +++ b/wow_world_messages/src/world/vanilla/movement_info.rs @@ -886,21 +886,21 @@ impl MovementInfo_MovementFlags { } + { if let Some(s) = &self.jumping { - s.size() + 16 } else { 0 } } + { if let Some(s) = &self.swimming { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.spline_elevation { - s.size() + 4 } else { 0 } @@ -927,34 +927,13 @@ pub struct MovementInfo_MovementFlags_Jumping { pub z_speed: f32, } -impl MovementInfo_MovementFlags_Jumping { - pub(crate) const fn size(&self) -> usize { - 4 // cos_angle: f32 - + 4 // sin_angle: f32 - + 4 // xy_speed: f32 - + 4 // z_speed: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct MovementInfo_MovementFlags_Swimming { pub pitch: f32, } -impl MovementInfo_MovementFlags_Swimming { - pub(crate) const fn size(&self) -> usize { - 4 // pitch: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct MovementInfo_MovementFlags_SplineElevation { pub spline_elevation: f32, } -impl MovementInfo_MovementFlags_SplineElevation { - pub(crate) const fn size(&self) -> usize { - 4 // spline_elevation: f32 - } -} - diff --git a/wow_world_messages/src/world/vanilla/smsg_party_member_stats.rs b/wow_world_messages/src/world/vanilla/smsg_party_member_stats.rs index d919c795fc..db747e983b 100644 --- a/wow_world_messages/src/world/vanilla/smsg_party_member_stats.rs +++ b/wow_world_messages/src/world/vanilla/smsg_party_member_stats.rs @@ -1808,63 +1808,63 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { 4 // inner + { if let Some(s) = &self.status { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.level { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.zone { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.position { - s.size() + 4 } else { 0 } @@ -1885,7 +1885,7 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { } + { if let Some(s) = &self.pet_guid { - s.size() + 8 } else { 0 } @@ -1899,42 +1899,42 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { } + { if let Some(s) = &self.pet_model_id { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_cur_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.pet_cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_power { - s.size() + 2 } else { 0 } @@ -1954,102 +1954,47 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Status { pub status: GroupMemberOnlineStatus, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Status { - pub(crate) const fn size(&self) -> usize { - 1 // status: GroupMemberOnlineStatus - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurHp { pub current_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurHp { - pub(crate) const fn size(&self) -> usize { - 2 // current_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxHp { pub max_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxHp { - pub(crate) const fn size(&self) -> usize { - 2 // max_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PowerType { pub power: Power, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PowerType { - pub(crate) const fn size(&self) -> usize { - 1 // power: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurPower { pub current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurPower { - pub(crate) const fn size(&self) -> usize { - 2 // current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxPower { pub max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Level { pub level: Level, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Level { - pub(crate) const fn size(&self) -> usize { - 2 // level: Level16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Zone { pub area: Area, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Zone { - pub(crate) const fn size(&self) -> usize { - 4 // area: Area - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Position { pub position_x: u16, pub position_y: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Position { - pub(crate) const fn size(&self) -> usize { - 2 // position_x: u16 - + 2 // position_y: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Auras { pub auras: AuraMask, @@ -2077,12 +2022,6 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetGuid { pub pet: Guid, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetGuid { - pub(crate) const fn size(&self) -> usize { - 8 // pet: Guid - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetName { pub pet_name: String, @@ -2099,67 +2038,31 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetModelId { pub pet_display_id: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetModelId { - pub(crate) const fn size(&self) -> usize { - 2 // pet_display_id: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurHp { pub pet_current_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurHp { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxHp { pub pet_max_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxHp { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetPowerType { pub pet_power_type: Power, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetPowerType { - pub(crate) const fn size(&self) -> usize { - 1 // pet_power_type: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurPower { pub pet_current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxPower { pub pet_max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetAuras { pub pet_auras: AuraMask, diff --git a/wow_world_messages/src/world/vanilla/smsg_party_member_stats_full.rs b/wow_world_messages/src/world/vanilla/smsg_party_member_stats_full.rs index 9b9db6087d..515824fc5c 100644 --- a/wow_world_messages/src/world/vanilla/smsg_party_member_stats_full.rs +++ b/wow_world_messages/src/world/vanilla/smsg_party_member_stats_full.rs @@ -1750,63 +1750,63 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { 4 // inner + { if let Some(s) = &self.status { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.level { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.zone { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.position { - s.size() + 4 } else { 0 } @@ -1820,7 +1820,7 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { } + { if let Some(s) = &self.pet_guid { - s.size() + 8 } else { 0 } @@ -1834,42 +1834,42 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { } + { if let Some(s) = &self.pet_model_id { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_cur_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_hp { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.pet_cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_power { - s.size() + 2 } else { 0 } @@ -1889,102 +1889,47 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Status { pub status: GroupMemberOnlineStatus, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Status { - pub(crate) const fn size(&self) -> usize { - 1 // status: GroupMemberOnlineStatus - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurHp { pub current_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurHp { - pub(crate) const fn size(&self) -> usize { - 2 // current_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxHp { pub max_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxHp { - pub(crate) const fn size(&self) -> usize { - 2 // max_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PowerType { pub power: Power, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PowerType { - pub(crate) const fn size(&self) -> usize { - 1 // power: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurPower { pub current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurPower { - pub(crate) const fn size(&self) -> usize { - 2 // current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxPower { pub max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Level { pub level: Level, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Level { - pub(crate) const fn size(&self) -> usize { - 2 // level: Level16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Zone { pub area: Area, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Zone { - pub(crate) const fn size(&self) -> usize { - 4 // area: Area - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Position { pub position_x: u16, pub position_y: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Position { - pub(crate) const fn size(&self) -> usize { - 2 // position_x: u16 - + 2 // position_y: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Auras { pub auras: AuraMask, @@ -2001,12 +1946,6 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetGuid { pub pet: Guid, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetGuid { - pub(crate) const fn size(&self) -> usize { - 8 // pet: Guid - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetName { pub pet_name: String, @@ -2023,67 +1962,31 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetModelId { pub pet_display_id: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetModelId { - pub(crate) const fn size(&self) -> usize { - 2 // pet_display_id: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurHp { pub pet_current_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurHp { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxHp { pub pet_max_health: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxHp { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_health: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetPowerType { pub pet_power_type: Power, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetPowerType { - pub(crate) const fn size(&self) -> usize { - 1 // pet_power_type: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurPower { pub pet_current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxPower { pub pet_max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetAuras { pub pet_auras: AuraMask, diff --git a/wow_world_messages/src/world/vanilla/smsg_spell_go.rs b/wow_world_messages/src/world/vanilla/smsg_spell_go.rs index be10d3e62d..fd23f26750 100644 --- a/wow_world_messages/src/world/vanilla/smsg_spell_go.rs +++ b/wow_world_messages/src/world/vanilla/smsg_spell_go.rs @@ -676,7 +676,7 @@ impl SMSG_SPELL_GO_CastFlags { 2 // inner + { if let Some(s) = &self.ammo { - s.size() + 8 } else { 0 } @@ -690,10 +690,3 @@ pub struct SMSG_SPELL_GO_CastFlags_Ammo { pub ammo_inventory_type: u32, } -impl SMSG_SPELL_GO_CastFlags_Ammo { - pub(crate) const fn size(&self) -> usize { - 4 // ammo_display_id: u32 - + 4 // ammo_inventory_type: u32 - } -} - diff --git a/wow_world_messages/src/world/vanilla/smsg_spell_start.rs b/wow_world_messages/src/world/vanilla/smsg_spell_start.rs index bafe76dfdf..90ba03b7bc 100644 --- a/wow_world_messages/src/world/vanilla/smsg_spell_start.rs +++ b/wow_world_messages/src/world/vanilla/smsg_spell_start.rs @@ -599,7 +599,7 @@ impl SMSG_SPELL_START_CastFlags { 2 // inner + { if let Some(s) = &self.ammo { - s.size() + 8 } else { 0 } @@ -613,10 +613,3 @@ pub struct SMSG_SPELL_START_CastFlags_Ammo { pub ammo_inventory_type: u32, } -impl SMSG_SPELL_START_CastFlags_Ammo { - pub(crate) const fn size(&self) -> usize { - 4 // ammo_display_id: u32 - + 4 // ammo_inventory_type: u32 - } -} - diff --git a/wow_world_messages/src/world/vanilla/spell_cast_targets.rs b/wow_world_messages/src/world/vanilla/spell_cast_targets.rs index deaf40c9dc..cd49d12932 100644 --- a/wow_world_messages/src/world/vanilla/spell_cast_targets.rs +++ b/wow_world_messages/src/world/vanilla/spell_cast_targets.rs @@ -889,14 +889,14 @@ impl SpellCastTargets_SpellCastTargetFlags { } + { if let Some(s) = &self.source_location { - s.size() + 12 } else { 0 } } + { if let Some(s) = &self.dest_location { - s.size() + 12 } else { 0 } @@ -941,23 +941,11 @@ pub struct SpellCastTargets_SpellCastTargetFlags_SourceLocation { pub source: Vector3d, } -impl SpellCastTargets_SpellCastTargetFlags_SourceLocation { - pub(crate) const fn size(&self) -> usize { - 12 // source: Vector3d - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct SpellCastTargets_SpellCastTargetFlags_DestLocation { pub destination: Vector3d, } -impl SpellCastTargets_SpellCastTargetFlags_DestLocation { - pub(crate) const fn size(&self) -> usize { - 12 // destination: Vector3d - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SpellCastTargets_SpellCastTargetFlags_String { pub target_string: String, diff --git a/wow_world_messages/src/world/wrath/aura_update.rs b/wow_world_messages/src/world/wrath/aura_update.rs index 4a3cf77ee7..0a0d7a2a5f 100644 --- a/wow_world_messages/src/world/wrath/aura_update.rs +++ b/wow_world_messages/src/world/wrath/aura_update.rs @@ -405,7 +405,7 @@ impl AuraUpdate_AuraFlag { } + { if let Some(s) = &self.duration { - s.size() + 8 } else { 0 } @@ -430,10 +430,3 @@ pub struct AuraUpdate_AuraFlag_Duration { pub time_left: u32, } -impl AuraUpdate_AuraFlag_Duration { - pub(crate) const fn size(&self) -> usize { - 4 // duration: u32 - + 4 // time_left: u32 - } -} - diff --git a/wow_world_messages/src/world/wrath/lfg_list_group.rs b/wow_world_messages/src/world/wrath/lfg_list_group.rs index 8bfcd95a56..89fa6a9f16 100644 --- a/wow_world_messages/src/world/wrath/lfg_list_group.rs +++ b/wow_world_messages/src/world/wrath/lfg_list_group.rs @@ -375,7 +375,7 @@ impl LfgListGroup_LfgUpdateFlag { } + { if let Some(s) = &self.roles { - s.size() + 3 } else { 0 } @@ -399,9 +399,3 @@ pub struct LfgListGroup_LfgUpdateFlag_Roles { pub roles: [u8; 3], } -impl LfgListGroup_LfgUpdateFlag_Roles { - pub(crate) const fn size(&self) -> usize { - 3 // roles: u8[3] - } -} - diff --git a/wow_world_messages/src/world/wrath/lfg_list_player.rs b/wow_world_messages/src/world/wrath/lfg_list_player.rs index 25d9657aff..60c2469ce5 100644 --- a/wow_world_messages/src/world/wrath/lfg_list_player.rs +++ b/wow_world_messages/src/world/wrath/lfg_list_player.rs @@ -745,7 +745,7 @@ impl LfgListPlayer_LfgUpdateFlag { 4 // inner + { if let Some(s) = &self.character_info { - s.size() + 86 } else { 0 } @@ -759,35 +759,35 @@ impl LfgListPlayer_LfgUpdateFlag { } + { if let Some(s) = &self.group_leader { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.group_guid { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.roles { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.area { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.status { - s.size() + 1 } else { 0 } @@ -825,37 +825,6 @@ pub struct LfgListPlayer_LfgUpdateFlag_CharacterInfo { pub talents2: u8, } -impl LfgListPlayer_LfgUpdateFlag_CharacterInfo { - pub(crate) const fn size(&self) -> usize { - 4 // agility: u32 - + 4 // armor: u32 - + 4 // attack_power: u32 - + 4 // average_item_level: u32 - + 4 // block_rating: u32 - + 1 // class: Class - + 4 // crit_rating_melee: u32 - + 4 // crit_rating_ranged: u32 - + 4 // crit_rating_spell: u32 - + 4 // defense_skill: u32 - + 4 // dodge_rating: u32 - + 4 // expertise_rating: u32 - + 4 // haste_rating: u32 - + 4 // health: u32 - + 1 // level: Level - + 4 // mana: u32 - + 4 // mana_per_5_seconds: f32 - + 4 // mana_per_5_seconds_combat: f32 - + 4 // online: Bool32 - + 4 // parry_rating: u32 - + 1 // race: Race - + 4 // spell_damage: u32 - + 4 // spell_heal: u32 - + 1 // talents0: u8 - + 1 // talents1: u8 - + 1 // talents2: u8 - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct LfgListPlayer_LfgUpdateFlag_Comment { pub comment: String, @@ -872,53 +841,23 @@ pub struct LfgListPlayer_LfgUpdateFlag_GroupLeader { pub is_looking_for_more: bool, } -impl LfgListPlayer_LfgUpdateFlag_GroupLeader { - pub(crate) const fn size(&self) -> usize { - 1 // is_looking_for_more: Bool - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct LfgListPlayer_LfgUpdateFlag_GroupGuid { pub group: Guid, } -impl LfgListPlayer_LfgUpdateFlag_GroupGuid { - pub(crate) const fn size(&self) -> usize { - 8 // group: Guid - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct LfgListPlayer_LfgUpdateFlag_Roles { pub roles: u8, } -impl LfgListPlayer_LfgUpdateFlag_Roles { - pub(crate) const fn size(&self) -> usize { - 1 // roles: u8 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct LfgListPlayer_LfgUpdateFlag_Area { pub area: Area, } -impl LfgListPlayer_LfgUpdateFlag_Area { - pub(crate) const fn size(&self) -> usize { - 4 // area: Area - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct LfgListPlayer_LfgUpdateFlag_Status { pub unknown1: u8, } -impl LfgListPlayer_LfgUpdateFlag_Status { - pub(crate) const fn size(&self) -> usize { - 1 // unknown1: u8 - } -} - diff --git a/wow_world_messages/src/world/wrath/movement_block.rs b/wow_world_messages/src/world/wrath/movement_block.rs index 17eb92ec02..c9b3003e1a 100644 --- a/wow_world_messages/src/world/wrath/movement_block.rs +++ b/wow_world_messages/src/world/wrath/movement_block.rs @@ -1597,7 +1597,7 @@ impl MovementBlock_SplineFlag { 4 // inner + { if let Some(s) = &self.final_angle { - s.size() + 16 } else { 0 } @@ -2933,21 +2933,21 @@ impl MovementBlock_MovementFlags { 6 // inner + { if let Some(s) = &self.falling { - s.size() + 16 } else { 0 } } + { if let Some(s) = &self.swimming { - s.size() + 10 } else { 0 } } + { if let Some(s) = &self.spline_elevation { - s.size() + 4 } else { 0 } @@ -2977,26 +2977,11 @@ pub struct MovementBlock_MovementFlags_Falling { pub z_speed: f32, } -impl MovementBlock_MovementFlags_Falling { - pub(crate) const fn size(&self) -> usize { - 4 // cos_angle: f32 - + 4 // sin_angle: f32 - + 4 // xy_speed: f32 - + 4 // z_speed: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct MovementBlock_MovementFlags_SplineElevation { pub spline_elevation: f32, } -impl MovementBlock_MovementFlags_SplineElevation { - pub(crate) const fn size(&self) -> usize { - 4 // spline_elevation: f32 - } -} - #[derive(Debug, Clone, PartialEq, PartialOrd, Default)] pub struct MovementBlock_MovementFlags_SplineEnabled { pub duration: u32, @@ -3420,7 +3405,7 @@ impl MovementBlock_UpdateFlag { 2 // inner + { if let Some(s) = &self.transport { - s.size() + 4 } else { 0 } @@ -3434,14 +3419,14 @@ impl MovementBlock_UpdateFlag { } + { if let Some(s) = &self.low_guid { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.high_guid { - s.size() + 4 } else { 0 } @@ -3455,14 +3440,14 @@ impl MovementBlock_UpdateFlag { } + { if let Some(s) = &self.vehicle { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.rotation { - s.size() + 8 } else { 0 } @@ -3475,12 +3460,6 @@ pub struct MovementBlock_UpdateFlag_Transport { pub transport_progress_in_ms: u32, } -impl MovementBlock_UpdateFlag_Transport { - pub(crate) const fn size(&self) -> usize { - 4 // transport_progress_in_ms: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct MovementBlock_UpdateFlag_HasAttackingTarget { pub guid: Guid, @@ -3497,44 +3476,19 @@ pub struct MovementBlock_UpdateFlag_LowGuid { pub unknown1: u32, } -impl MovementBlock_UpdateFlag_LowGuid { - pub(crate) const fn size(&self) -> usize { - 4 // unknown1: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct MovementBlock_UpdateFlag_HighGuid { pub unknown0: u32, } -impl MovementBlock_UpdateFlag_HighGuid { - pub(crate) const fn size(&self) -> usize { - 4 // unknown0: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct MovementBlock_UpdateFlag_Vehicle { pub vehicle_id: u32, pub vehicle_orientation: f32, } -impl MovementBlock_UpdateFlag_Vehicle { - pub(crate) const fn size(&self) -> usize { - 4 // vehicle_id: u32 - + 4 // vehicle_orientation: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct MovementBlock_UpdateFlag_Rotation { pub packed_local_rotation: u64, } -impl MovementBlock_UpdateFlag_Rotation { - pub(crate) const fn size(&self) -> usize { - 8 // packed_local_rotation: u64 - } -} - diff --git a/wow_world_messages/src/world/wrath/movement_info.rs b/wow_world_messages/src/world/wrath/movement_info.rs index b98803a44d..c2767de9fd 100644 --- a/wow_world_messages/src/world/wrath/movement_info.rs +++ b/wow_world_messages/src/world/wrath/movement_info.rs @@ -1615,21 +1615,21 @@ impl MovementInfo_MovementFlags { 6 // inner + { if let Some(s) = &self.falling { - s.size() + 16 } else { 0 } } + { if let Some(s) = &self.swimming { - s.size() + 10 } else { 0 } } + { if let Some(s) = &self.spline_elevation { - s.size() + 4 } else { 0 } @@ -1652,23 +1652,8 @@ pub struct MovementInfo_MovementFlags_Falling { pub z_speed: f32, } -impl MovementInfo_MovementFlags_Falling { - pub(crate) const fn size(&self) -> usize { - 4 // cos_angle: f32 - + 4 // sin_angle: f32 - + 4 // xy_speed: f32 - + 4 // z_speed: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct MovementInfo_MovementFlags_SplineElevation { pub spline_elevation: f32, } -impl MovementInfo_MovementFlags_SplineElevation { - pub(crate) const fn size(&self) -> usize { - 4 // spline_elevation: f32 - } -} - diff --git a/wow_world_messages/src/world/wrath/relation.rs b/wow_world_messages/src/world/wrath/relation.rs index 990e82530a..de73ba74cb 100644 --- a/wow_world_messages/src/world/wrath/relation.rs +++ b/wow_world_messages/src/world/wrath/relation.rs @@ -335,7 +335,7 @@ impl Relation_RelationType { 4 // inner + { if let Some(s) = &self.friend { - s.size() + 13 } else { 0 } @@ -348,9 +348,3 @@ pub struct Relation_RelationType_Friend { pub status: Relation_FriendStatus, } -impl Relation_RelationType_Friend { - pub(crate) const fn size(&self) -> usize { - self.status.size() // status: Relation_FriendStatus - } -} - diff --git a/wow_world_messages/src/world/wrath/smsg_attackerstateupdate.rs b/wow_world_messages/src/world/wrath/smsg_attackerstateupdate.rs index 66d3196fcd..e3e16ec8aa 100644 --- a/wow_world_messages/src/world/wrath/smsg_attackerstateupdate.rs +++ b/wow_world_messages/src/world/wrath/smsg_attackerstateupdate.rs @@ -1288,35 +1288,35 @@ impl SMSG_ATTACKERSTATEUPDATE_HitInfo { 4 // inner + { if let Some(s) = &self.unk1 { - s.size() + 48 } else { 0 } } + { if let Some(s) = &self.all_absorb { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.all_resist { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.block { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.unk19 { - s.size() + 4 } else { 0 } @@ -1340,64 +1340,23 @@ pub struct SMSG_ATTACKERSTATEUPDATE_HitInfo_Unk1 { pub unknown9: f32, } -impl SMSG_ATTACKERSTATEUPDATE_HitInfo_Unk1 { - pub(crate) const fn size(&self) -> usize { - 4 // unknown10: f32 - + 4 // unknown11: f32 - + 4 // unknown12: f32 - + 4 // unknown13: f32 - + 4 // unknown14: f32 - + 4 // unknown15: u32 - + 4 // unknown4: u32 - + 4 // unknown5: f32 - + 4 // unknown6: f32 - + 4 // unknown7: f32 - + 4 // unknown8: f32 - + 4 // unknown9: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_ATTACKERSTATEUPDATE_HitInfo_AllAbsorb { pub absorb: u32, } -impl SMSG_ATTACKERSTATEUPDATE_HitInfo_AllAbsorb { - pub(crate) const fn size(&self) -> usize { - 4 // absorb: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_ATTACKERSTATEUPDATE_HitInfo_AllResist { pub resist: u32, } -impl SMSG_ATTACKERSTATEUPDATE_HitInfo_AllResist { - pub(crate) const fn size(&self) -> usize { - 4 // resist: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_ATTACKERSTATEUPDATE_HitInfo_Block { pub blocked_amount: u32, } -impl SMSG_ATTACKERSTATEUPDATE_HitInfo_Block { - pub(crate) const fn size(&self) -> usize { - 4 // blocked_amount: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_ATTACKERSTATEUPDATE_HitInfo_Unk19 { pub unknown3: u32, } -impl SMSG_ATTACKERSTATEUPDATE_HitInfo_Unk19 { - pub(crate) const fn size(&self) -> usize { - 4 // unknown3: u32 - } -} - diff --git a/wow_world_messages/src/world/wrath/smsg_monster_move.rs b/wow_world_messages/src/world/wrath/smsg_monster_move.rs index 8b068d223f..ab69753e8c 100644 --- a/wow_world_messages/src/world/wrath/smsg_monster_move.rs +++ b/wow_world_messages/src/world/wrath/smsg_monster_move.rs @@ -1297,14 +1297,14 @@ impl SMSG_MONSTER_MOVE_SplineFlag { 4 // inner + { if let Some(s) = &self.parabolic { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.enter_cycle { - s.size() + 8 } else { 0 } @@ -1318,23 +1318,9 @@ pub struct SMSG_MONSTER_MOVE_SplineFlag_Parabolic { pub vertical_acceleration: f32, } -impl SMSG_MONSTER_MOVE_SplineFlag_Parabolic { - pub(crate) const fn size(&self) -> usize { - 4 // effect_start_time: u32 - + 4 // vertical_acceleration: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_MONSTER_MOVE_SplineFlag_EnterCycle { pub animation_id: u32, pub animation_start_time: u32, } -impl SMSG_MONSTER_MOVE_SplineFlag_EnterCycle { - pub(crate) const fn size(&self) -> usize { - 4 // animation_id: u32 - + 4 // animation_start_time: u32 - } -} - diff --git a/wow_world_messages/src/world/wrath/smsg_monster_move_transport.rs b/wow_world_messages/src/world/wrath/smsg_monster_move_transport.rs index c7919b52c4..ac12060ab8 100644 --- a/wow_world_messages/src/world/wrath/smsg_monster_move_transport.rs +++ b/wow_world_messages/src/world/wrath/smsg_monster_move_transport.rs @@ -1309,14 +1309,14 @@ impl SMSG_MONSTER_MOVE_TRANSPORT_SplineFlag { 4 // inner + { if let Some(s) = &self.parabolic { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.enter_cycle { - s.size() + 8 } else { 0 } @@ -1330,23 +1330,9 @@ pub struct SMSG_MONSTER_MOVE_TRANSPORT_SplineFlag_Parabolic { pub vertical_acceleration: f32, } -impl SMSG_MONSTER_MOVE_TRANSPORT_SplineFlag_Parabolic { - pub(crate) const fn size(&self) -> usize { - 4 // effect_start_time: u32 - + 4 // vertical_acceleration: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_MONSTER_MOVE_TRANSPORT_SplineFlag_EnterCycle { pub animation_id: u32, pub animation_start_time: u32, } -impl SMSG_MONSTER_MOVE_TRANSPORT_SplineFlag_EnterCycle { - pub(crate) const fn size(&self) -> usize { - 4 // animation_id: u32 - + 4 // animation_start_time: u32 - } -} - diff --git a/wow_world_messages/src/world/wrath/smsg_party_member_stats.rs b/wow_world_messages/src/world/wrath/smsg_party_member_stats.rs index 6f427c4b7a..2523896ce6 100644 --- a/wow_world_messages/src/world/wrath/smsg_party_member_stats.rs +++ b/wow_world_messages/src/world/wrath/smsg_party_member_stats.rs @@ -1724,63 +1724,63 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { 4 // inner + { if let Some(s) = &self.status { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_hp { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.max_hp { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.level { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.zone { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.position { - s.size() + 4 } else { 0 } @@ -1794,7 +1794,7 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { } + { if let Some(s) = &self.pet_guid { - s.size() + 8 } else { 0 } @@ -1808,42 +1808,42 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { } + { if let Some(s) = &self.pet_model_id { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_cur_hp { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.pet_max_hp { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.pet_power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.pet_cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_power { - s.size() + 2 } else { 0 } @@ -1857,7 +1857,7 @@ impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags { } + { if let Some(s) = &self.vehicle_seat { - s.size() + 4 } else { 0 } @@ -1870,102 +1870,47 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Status { pub status: GroupMemberOnlineStatus, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Status { - pub(crate) const fn size(&self) -> usize { - 1 // status: GroupMemberOnlineStatus - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurHp { pub current_health: u32, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurHp { - pub(crate) const fn size(&self) -> usize { - 4 // current_health: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxHp { pub max_health: u32, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxHp { - pub(crate) const fn size(&self) -> usize { - 4 // max_health: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PowerType { pub power: Power, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PowerType { - pub(crate) const fn size(&self) -> usize { - 1 // power: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurPower { pub current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_CurPower { - pub(crate) const fn size(&self) -> usize { - 2 // current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxPower { pub max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_MaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Level { pub level: Level, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Level { - pub(crate) const fn size(&self) -> usize { - 2 // level: Level16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Zone { pub area: Area, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Zone { - pub(crate) const fn size(&self) -> usize { - 4 // area: Area - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Position { pub position_x: u16, pub position_y: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Position { - pub(crate) const fn size(&self) -> usize { - 2 // position_x: u16 - + 2 // position_y: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_Auras { pub auras: AuraMask, @@ -1982,12 +1927,6 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetGuid { pub pet: Guid, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetGuid { - pub(crate) const fn size(&self) -> usize { - 8 // pet: Guid - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetName { pub pet_name: String, @@ -2004,67 +1943,31 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetModelId { pub pet_display_id: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetModelId { - pub(crate) const fn size(&self) -> usize { - 2 // pet_display_id: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurHp { pub pet_current_health: u32, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurHp { - pub(crate) const fn size(&self) -> usize { - 4 // pet_current_health: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxHp { pub pet_max_health: u32, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxHp { - pub(crate) const fn size(&self) -> usize { - 4 // pet_max_health: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetPowerType { pub pet_power_type: Power, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetPowerType { - pub(crate) const fn size(&self) -> usize { - 1 // pet_power_type: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurPower { pub pet_current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetCurPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxPower { pub pet_max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetMaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_PetAuras { pub pet_auras: AuraMask, @@ -2081,9 +1984,3 @@ pub struct SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_VehicleSeat { pub transport: u32, } -impl SMSG_PARTY_MEMBER_STATS_GroupUpdateFlags_VehicleSeat { - pub(crate) const fn size(&self) -> usize { - 4 // transport: u32 - } -} - diff --git a/wow_world_messages/src/world/wrath/smsg_party_member_stats_full.rs b/wow_world_messages/src/world/wrath/smsg_party_member_stats_full.rs index b273cbc471..fd5e4f2a33 100644 --- a/wow_world_messages/src/world/wrath/smsg_party_member_stats_full.rs +++ b/wow_world_messages/src/world/wrath/smsg_party_member_stats_full.rs @@ -1724,63 +1724,63 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { 4 // inner + { if let Some(s) = &self.status { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_hp { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.max_hp { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.max_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.level { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.zone { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.position { - s.size() + 4 } else { 0 } @@ -1794,7 +1794,7 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { } + { if let Some(s) = &self.pet_guid { - s.size() + 8 } else { 0 } @@ -1808,42 +1808,42 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { } + { if let Some(s) = &self.pet_model_id { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_cur_hp { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.pet_max_hp { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.pet_power_type { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.pet_cur_power { - s.size() + 2 } else { 0 } } + { if let Some(s) = &self.pet_max_power { - s.size() + 2 } else { 0 } @@ -1857,7 +1857,7 @@ impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags { } + { if let Some(s) = &self.vehicle_seat { - s.size() + 4 } else { 0 } @@ -1870,102 +1870,47 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Status { pub status: GroupMemberOnlineStatus, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Status { - pub(crate) const fn size(&self) -> usize { - 1 // status: GroupMemberOnlineStatus - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurHp { pub current_health: u32, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurHp { - pub(crate) const fn size(&self) -> usize { - 4 // current_health: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxHp { pub max_health: u32, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxHp { - pub(crate) const fn size(&self) -> usize { - 4 // max_health: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PowerType { pub power: Power, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PowerType { - pub(crate) const fn size(&self) -> usize { - 1 // power: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurPower { pub current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_CurPower { - pub(crate) const fn size(&self) -> usize { - 2 // current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxPower { pub max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_MaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Level { pub level: Level, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Level { - pub(crate) const fn size(&self) -> usize { - 2 // level: Level16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Zone { pub area: Area, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Zone { - pub(crate) const fn size(&self) -> usize { - 4 // area: Area - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Position { pub position_x: u16, pub position_y: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Position { - pub(crate) const fn size(&self) -> usize { - 2 // position_x: u16 - + 2 // position_y: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_Auras { pub auras: AuraMask, @@ -1982,12 +1927,6 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetGuid { pub pet: Guid, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetGuid { - pub(crate) const fn size(&self) -> usize { - 8 // pet: Guid - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetName { pub pet_name: String, @@ -2004,67 +1943,31 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetModelId { pub pet_display_id: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetModelId { - pub(crate) const fn size(&self) -> usize { - 2 // pet_display_id: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurHp { pub pet_current_health: u32, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurHp { - pub(crate) const fn size(&self) -> usize { - 4 // pet_current_health: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxHp { pub pet_max_health: u32, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxHp { - pub(crate) const fn size(&self) -> usize { - 4 // pet_max_health: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetPowerType { pub pet_power_type: Power, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetPowerType { - pub(crate) const fn size(&self) -> usize { - 1 // pet_power_type: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurPower { pub pet_current_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetCurPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_current_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxPower { pub pet_max_power: u16, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetMaxPower { - pub(crate) const fn size(&self) -> usize { - 2 // pet_max_power: u16 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_PetAuras { pub pet_auras: AuraMask, @@ -2081,9 +1984,3 @@ pub struct SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_VehicleSeat { pub transport: u32, } -impl SMSG_PARTY_MEMBER_STATS_FULL_GroupUpdateFlags_VehicleSeat { - pub(crate) const fn size(&self) -> usize { - 4 // transport: u32 - } -} - diff --git a/wow_world_messages/src/world/wrath/smsg_spell_go.rs b/wow_world_messages/src/world/wrath/smsg_spell_go.rs index 974952593e..16cbd1aabe 100644 --- a/wow_world_messages/src/world/wrath/smsg_spell_go.rs +++ b/wow_world_messages/src/world/wrath/smsg_spell_go.rs @@ -1265,42 +1265,42 @@ impl SMSG_SPELL_GO_GameobjectCastFlags { 4 // inner + { if let Some(s) = &self.ammo { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.dest_location { - s.size() + 1 } else { 0 } } + { if let Some(s) = &self.power_update { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.adjust_missile { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.visual_chain { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.rune_update { - s.size() + 8 } else { 0 } @@ -1314,61 +1314,28 @@ pub struct SMSG_SPELL_GO_GameobjectCastFlags_Ammo { pub ammo_inventory_type: u32, } -impl SMSG_SPELL_GO_GameobjectCastFlags_Ammo { - pub(crate) const fn size(&self) -> usize { - 4 // ammo_display_id: u32 - + 4 // ammo_inventory_type: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_SPELL_GO_GameobjectCastFlags_DestLocation { pub unknown3: u8, } -impl SMSG_SPELL_GO_GameobjectCastFlags_DestLocation { - pub(crate) const fn size(&self) -> usize { - 1 // unknown3: u8 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_SPELL_GO_GameobjectCastFlags_PowerUpdate { pub power: Power, } -impl SMSG_SPELL_GO_GameobjectCastFlags_PowerUpdate { - pub(crate) const fn size(&self) -> usize { - 4 // power: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct SMSG_SPELL_GO_GameobjectCastFlags_AdjustMissile { pub delay_trajectory: u32, pub elevation: f32, } -impl SMSG_SPELL_GO_GameobjectCastFlags_AdjustMissile { - pub(crate) const fn size(&self) -> usize { - 4 // delay_trajectory: u32 - + 4 // elevation: f32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_SPELL_GO_GameobjectCastFlags_VisualChain { pub unknown1: u32, pub unknown2: u32, } -impl SMSG_SPELL_GO_GameobjectCastFlags_VisualChain { - pub(crate) const fn size(&self) -> usize { - 4 // unknown1: u32 - + 4 // unknown2: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_SPELL_GO_GameobjectCastFlags_RuneUpdate { pub rune_cooldowns: [u8; 6], @@ -1376,11 +1343,3 @@ pub struct SMSG_SPELL_GO_GameobjectCastFlags_RuneUpdate { pub rune_mask_initial: u8, } -impl SMSG_SPELL_GO_GameobjectCastFlags_RuneUpdate { - pub(crate) const fn size(&self) -> usize { - 6 // rune_cooldowns: u8[6] - + 1 // rune_mask_after_cast: u8 - + 1 // rune_mask_initial: u8 - } -} - diff --git a/wow_world_messages/src/world/wrath/smsg_spell_start.rs b/wow_world_messages/src/world/wrath/smsg_spell_start.rs index b012080112..93af83c13e 100644 --- a/wow_world_messages/src/world/wrath/smsg_spell_start.rs +++ b/wow_world_messages/src/world/wrath/smsg_spell_start.rs @@ -1278,21 +1278,21 @@ impl SMSG_SPELL_START_CastFlags { 4 // inner + { if let Some(s) = &self.ammo { - s.size() + 8 } else { 0 } } + { if let Some(s) = &self.power_left_self { - s.size() + 4 } else { 0 } } + { if let Some(s) = &self.unknown_23 { - s.size() + 8 } else { 0 } @@ -1306,34 +1306,14 @@ pub struct SMSG_SPELL_START_CastFlags_Ammo { pub ammo_inventory_type: u32, } -impl SMSG_SPELL_START_CastFlags_Ammo { - pub(crate) const fn size(&self) -> usize { - 4 // ammo_display_id: u32 - + 4 // ammo_inventory_type: u32 - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_SPELL_START_CastFlags_PowerLeftSelf { pub power: Power, } -impl SMSG_SPELL_START_CastFlags_PowerLeftSelf { - pub(crate) const fn size(&self) -> usize { - 4 // power: Power - } -} - #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SMSG_SPELL_START_CastFlags_Unknown23 { pub unknown1: u32, pub unknown2: u32, } -impl SMSG_SPELL_START_CastFlags_Unknown23 { - pub(crate) const fn size(&self) -> usize { - 4 // unknown1: u32 - + 4 // unknown2: u32 - } -} - diff --git a/wow_world_messages/src/world/wrath/spell_cast_targets.rs b/wow_world_messages/src/world/wrath/spell_cast_targets.rs index 40c4b80f22..af02f71eeb 100644 --- a/wow_world_messages/src/world/wrath/spell_cast_targets.rs +++ b/wow_world_messages/src/world/wrath/spell_cast_targets.rs @@ -903,14 +903,14 @@ impl SpellCastTargets_SpellCastTargetFlags { } + { if let Some(s) = &self.source_location { - s.size() + 12 } else { 0 } } + { if let Some(s) = &self.dest_location { - s.size() + 12 } else { 0 } @@ -930,23 +930,11 @@ pub struct SpellCastTargets_SpellCastTargetFlags_SourceLocation { pub source: Vector3d, } -impl SpellCastTargets_SpellCastTargetFlags_SourceLocation { - pub(crate) const fn size(&self) -> usize { - 12 // source: Vector3d - } -} - #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct SpellCastTargets_SpellCastTargetFlags_DestLocation { pub destination: Vector3d, } -impl SpellCastTargets_SpellCastTargetFlags_DestLocation { - pub(crate) const fn size(&self) -> usize { - 12 // destination: Vector3d - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default)] pub struct SpellCastTargets_SpellCastTargetFlags_String { pub target_string: String,