From d6e7c326f00ecc66b6f854247a76cd149124abf4 Mon Sep 17 00:00:00 2001 From: lcdr Date: Sun, 29 Oct 2023 10:11:59 +0100 Subject: [PATCH] Fix pet serialization (closes #17) --- src/raknet/client/replica/pet.rs | 14 +------------- .../client/replica/tests/PetSerialization.bin | Bin 25 -> 69 bytes .../client/replica/tests/PetSerialization.rs | 13 +++++++++---- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/raknet/client/replica/pet.rs b/src/raknet/client/replica/pet.rs index 9b887308..6064c8ec 100644 --- a/src/raknet/client/replica/pet.rs +++ b/src/raknet/client/replica/pet.rs @@ -45,19 +45,7 @@ impl ComponentConstruction for PetConstruction { } } -#[derive(Debug, PartialEq, ReplicaSerde)] -pub struct PetSerializationInfo { - /// todo: bitflag - pub pet_state: u32, - pub ability_in_use: PetAbilityType, - pub interaction_id: Option, - pub owner_id: Option, -} - -#[derive(BitVariantTests, Debug, PartialEq, ReplicaSerde)] -pub struct PetSerialization { - pub pet_serialization_info: Option, -} +pub type PetSerialization = PetConstruction; impl ComponentSerialization for PetSerialization { fn ser(&self, writer: &mut BEBitWriter>) -> Res<()> { diff --git a/src/raknet/client/replica/tests/PetSerialization.bin b/src/raknet/client/replica/tests/PetSerialization.bin index c8268665d1a27d0b485abd5df8f0703037e4174e..77d507e9b6617940537cdca4118aa2ef3d40b4a5 100644 GIT binary patch literal 69 zcmZo-0D=YvhQzPGgB=_gSPZ59u3VtNz$Bmm6c0CGcVG)(PhbmRcw)fTz&3#`fGvSl V0Z2Nq7O+iVU%)27uE6HN0021y4$%Mr literal 25 fcmZo+U|?Vb;>54NgB=_gSPZ59u3VtNz{CImO^60z diff --git a/src/raknet/client/replica/tests/PetSerialization.rs b/src/raknet/client/replica/tests/PetSerialization.rs index 2ac2b7df..3a0fe05d 100644 --- a/src/raknet/client/replica/tests/PetSerialization.rs +++ b/src/raknet/client/replica/tests/PetSerialization.rs @@ -1,8 +1,13 @@ -PetSerialization { - pet_serialization_info: Some(PetSerializationInfo { - pet_state: 8, - ability_in_use: PetAbilityType::JumpOnObject, +PetConstruction { + pet_construction_info: Some(PetConstructionInfo { + pet_state: 4, + ability_in_use: PetAbilityType::GoToObject, interaction_id: Some(1152921510209247111), owner_id: Some(1152921510209247112), + tamed_pet_info: Some(TamedPetInfo { + pet_name_moderation_status: PetModerationStatus::Accepted, + pet_name: lu!("steve"), + owner_name: lu!("ChiefRedWizard"), + }), }), }