public override void ToBitStream(WriteOnlyBitStream packetStream, bool isInitialUpdate) { if (isInitialUpdate) { packetStream.Write0(); packetStream.Write0(); } }
public override void ToBitStream(WriteOnlyBitStream packetStream, bool isInitialUpdate) { if (isInitialUpdate) { if (IsInJetPackMode) { packetStream.Write1(); packetStream.Write(JetPackEffectId); packetStream.Write(JetPackFlying); packetStream.Write(JetPackBypassChecks); } else { packetStream.Write0(); } packetStream.Write1(); packetStream.Write(ImmuneToStunMove); packetStream.Write(ImmuneToStunJump); packetStream.Write(ImmuneToStunTurn); packetStream.Write(ImmuneToStunAttack); packetStream.Write(ImmuneToStunUseItem); packetStream.Write(ImmuneToStunEquip); packetStream.Write(ImmuneToStunInteract); } packetStream.Write(false); packetStream.Write(false); packetStream.Write(false); base.ToBitStream(packetStream, isInitialUpdate); }
public override void ToBitStream(WriteOnlyBitStream packetStream, bool isInitialUpdate) { packetStream.Write1(); if (PossessedObject != 0) { packetStream.Write1(); packetStream.Write(PossessedObject); } else { packetStream.Write0(); } packetStream.Write((byte)PossessionType); }
public void Serialize(WriteOnlyBitStream packetStream, bool isInitialUpdate) { if (isInitialUpdate) { packetStream.Write(ObjectId); packetStream.Write(Template); packetStream.Write((byte)Name.Length); if (Name.Length > 0) { packetStream.WriteWideString(Name, Name.Length); } packetStream.Write((uint)DateTime.Now.Subtract(Creation).TotalSeconds); packetStream.Write0(); // config data packetStream.Write0(); // trigger id if (SpawnerId != 0) { packetStream.Write1(); packetStream.Write(SpawnerId); } else { packetStream.Write0(); } if (SpawnerNodeId != -1) { packetStream.Write1(); packetStream.Write(SpawnerNodeId); } else { packetStream.Write0(); } if (Scale != 1.0f) { packetStream.Write1(); packetStream.Write(Scale); } else { packetStream.Write0(); } if (ObjectWorldState != ObjectWorldState.InWorld) { packetStream.Write1(); packetStream.Write((byte)ObjectWorldState); } else { packetStream.Write0(); } if (GmLevel != 0) { packetStream.Write1(); packetStream.Write(GmLevel); } else { packetStream.Write0(); } } packetStream.Write1(); if (ParentId != 0) { packetStream.Write1(); packetStream.Write(ParentId); packetStream.Write(UpdatePositionWithParent); } else { packetStream.Write0(); } long[] childIds = ChildIds; if (childIds.Length > 0) { packetStream.Write1(); packetStream.Write((ushort)childIds.Length); for (int i = 0; i < childIds.Length; i++) { packetStream.Write(childIds[i]); } } else { packetStream.Write0(); } bool statsComponentWritten = false; BaseReplicaComponent statsComponent = GetComponent(ReplicaComponentId.Stats); for (int i = 0; i < SerializationOrder.Length; i++) { ReplicaComponentId currentComponentId = SerializationOrder[i]; foreach (BaseReplicaComponent component in components) { if (component.ComponentId == currentComponentId) { if (!statsComponentWritten && statsComponent != null && (currentComponentId == ReplicaComponentId.COLLECTIBLE || currentComponentId == ReplicaComponentId.QUICKBUILD)) { statsComponent.ToBitStream(packetStream, isInitialUpdate); statsComponentWritten = true; } component.ToBitStream(packetStream, isInitialUpdate); if (!statsComponentWritten && statsComponent != null && (currentComponentId == ReplicaComponentId.Destroyable)) { statsComponent.ToBitStream(packetStream, isInitialUpdate); statsComponentWritten = true; } } } } }
public override void ToBitStream(WriteOnlyBitStream packetStream, bool isInitialUpdate) { packetStream.Write1(); packetStream.Write(Position.X); packetStream.Write(Position.Y); packetStream.Write(Position.Z); packetStream.Write(Rotation.X); packetStream.Write(Rotation.Y); packetStream.Write(Rotation.Z); packetStream.Write(Rotation.W); packetStream.Write(IsSupported); packetStream.Write(IsOnRail); if (LinearVelocity.LengthSquared() > JMath.Epsilon) { packetStream.Write1(); packetStream.Write(LinearVelocity.X); packetStream.Write(LinearVelocity.Y); packetStream.Write(LinearVelocity.Z); } else { packetStream.Write0(); } if (AngularVelocity.LengthSquared() > JMath.Epsilon) { packetStream.Write1(); packetStream.Write(AngularVelocity.X); packetStream.Write(AngularVelocity.Y); packetStream.Write(AngularVelocity.Z); } else { packetStream.Write0(); } if (LocalSpaceObjectId != 0) { packetStream.Write1(); packetStream.Write(LocalSpaceObjectId); packetStream.Write(LocalPosition.X); packetStream.Write(LocalPosition.Y); packetStream.Write(LocalPosition.Z); if (LocalLinearVelocity.LengthSquared() > JMath.Epsilon) { packetStream.Write1(); packetStream.Write(LocalLinearVelocity.X); packetStream.Write(LocalLinearVelocity.Y); packetStream.Write(LocalLinearVelocity.Z); } else { packetStream.Write0(); } } else { packetStream.Write0(); } if (!isInitialUpdate) { packetStream.Write(Teleport); } }
public override void ToBitStream(WriteOnlyBitStream packetStream, bool isInitialUpdate) { PossessionControlComponent.ToBitStream(packetStream, isInitialUpdate); LevelProgressionComponent.ToBitStream(packetStream, isInitialUpdate); PlayerForcedMovementComponent.ToBitStream(packetStream, isInitialUpdate); if (isInitialUpdate) { packetStream.Write0(); packetStream.Write0(); packetStream.Write0(); packetStream.Write0(); packetStream.Write(CharacterInfo.HairColor); packetStream.Write(CharacterInfo.HairStyle); packetStream.Write(CharacterInfo.Head); packetStream.Write(CharacterInfo.ChestColor); packetStream.Write(CharacterInfo.Legs); packetStream.Write(CharacterInfo.Chest); packetStream.Write(CharacterInfo.HeadColor); packetStream.Write(CharacterInfo.EyebrowStyle); packetStream.Write(CharacterInfo.EyesStyle); packetStream.Write(CharacterInfo.MouthStyle); packetStream.Write(AccountInfo.AccountId); packetStream.Write(CharacterInfo.LastLogout); packetStream.Write((ulong)0); packetStream.Write(CharacterInfo.UniverseScore); packetStream.Write(false); // this is only temporary for (int i = 0; i < 27; i++) { packetStream.Write((ulong)0); } packetStream.Write(IsLaunching); if (IsLanding) { packetStream.Write1(); packetStream.Write((ushort)LandingRocketTextLdf.Length); packetStream.WriteWideString(LandingRocketTextLdf, LandingRocketTextLdf.Length); } else { packetStream.Write0(); } } packetStream.Write1(); packetStream.Write(PvpEnabled); packetStream.Write(CharacterInfo.GmLevel > 0); packetStream.Write(CharacterInfo.GmLevel); packetStream.Write(CharacterInfo.EditorLevel > 0); packetStream.Write(CharacterInfo.EditorLevel); packetStream.Write1(); packetStream.Write((uint)CurrentActivity); packetStream.Write0(); }
public override void ToBitStream(WriteOnlyBitStream packetStream, bool isInitialUpdate) { if (isInitialUpdate) { packetStream.Write1(); packetStream.Write(ImmuneToBasicAttack); packetStream.Write(ImmuneToDot); packetStream.Write(ImmuneToKnockback); packetStream.Write(ImmuneToInterrupt); packetStream.Write(ImmuneToSpeed); packetStream.Write(ImmuneToImaginationGain); packetStream.Write(ImmuneToImaginationLoss); packetStream.Write(ImmuneToQuickbuildInterrupt); packetStream.Write(ImmuneToPullToPoint); } packetStream.Write1(); packetStream.Write(CurrentHealth); packetStream.Write(MaxHealth); packetStream.Write(CurrentArmor); packetStream.Write(MaxArmor); packetStream.Write(CurrentImagination); packetStream.Write(MaxImagination); packetStream.Write(DamageAbsorption); packetStream.Write(IsImmune); packetStream.Write(IsGmImmune); packetStream.Write(IsShielded); packetStream.Write(MaxHealth); packetStream.Write(MaxArmor); packetStream.Write(MaxImagination); packetStream.Write(FactionIds.Count); for (int i = 0; i < FactionIds.Count; i++) { packetStream.Write(FactionIds[i]); } packetStream.Write(IsSmashable); if (isInitialUpdate) { packetStream.Write(IsDead); packetStream.Write(IsSmashed); if (IsSmashable) { packetStream.Write(IsModuleAssembly); if (ExplodeFactor != 1.0f) { packetStream.Write1(); packetStream.Write(ExplodeFactor); } else { packetStream.Write0(); } } } packetStream.Write1(); packetStream.Write(EnemyThreats.Count > 0); }