Exemple #1
0
        public override void Serialize(BitWriter writer)
        {
            if (writer.Flag(HasPosition))
            {
                writer.Write(Transform.Position);
                writer.Write(Transform.Rotation);
            }

            writer.WriteBit(true);

            if (!writer.Flag(IsEffectActive))
            {
                return;
            }

            writer.Write(EffectType);
            writer.Write(EffectAmount);

            if (writer.Flag(AffectedByDistance))
            {
                writer.Write(MinDistance);
                writer.Write(MaxDistance);
            }

            if (!writer.Flag(EffectDirection != Vector3.Zero))
            {
                return;
            }

            writer.Write(EffectDirection * EffectAmount);
        }
Exemple #2
0
        public override void SerializeMessage(BitWriter writer)
        {
            if (writer.Flag(AiCombatWeight != default))
            {
                writer.Write(AiCombatWeight);
            }

            writer.WriteBit(FromSkillSet);

            if (writer.Flag(CastType != default))
            {
                writer.Write(CastType);
            }

            if (writer.Flag(Math.Abs(TimeSecs + 1) > 0.01f))
            {
                writer.Write(TimeSecs);
            }

            if (writer.Flag(TimesCanCast != -1))
            {
                writer.Write(TimesCanCast);
            }

            writer.Write(SkillId);

            if (writer.Flag(SlotId != BehaviorSlot.None))
            {
                writer.Write((int)SlotId);
            }

            writer.Write(Temporary);
        }
Exemple #3
0
        public override void SerializeMessage(BitWriter writer)
        {
            if (writer.Flag(IsFreeTrail))
            {
                writer.WriteBit(IsFreeTrail);
            }

            if (writer.Flag(IsLocal))
            {
                writer.WriteBit(IsLocal);
            }

            if (writer.Flag(NoLootOnDeath))
            {
                writer.WriteBit(NoLootOnDeath);
            }

            writer.Write(Player.Id);

            writer.WriteString(Player.Name, wide: true);

            writer.WriteBit(false);

            if (writer.Flag(Player.Zone.ZoneId != 0))
            {
                writer.Write((ushort)Player.Zone.ZoneId);
            }
        }
        public override void SerializeMessage(BitWriter writer)
        {
            if (writer.Flag(EffectId != -1))
            {
                writer.Write(EffectId);
            }

            writer.Write((uint)EffectType.Length);
            writer.WriteString(EffectType, EffectType.Length, true);

            if (writer.Flag(Math.Abs(Scale - 1) > 0.01f))
            {
                writer.Write(Scale);
            }

            writer.Write((uint)Name.Length);
            writer.WriteString(Name, Name.Length);

            if (writer.Flag(Math.Abs(Priority - 1) > 0.01f))
            {
                writer.Write(Priority);
            }

            if (writer.Flag(Secondary != default))
            {
                writer.Write(Secondary);
            }

            writer.WriteBit(Serialize);
        }
Exemple #5
0
        public override void SerializeMessage(BitWriter writer)
        {
            writer.WriteBit(UsedMouse);

            if (writer.Flag(ConsumableItem != default))
            {
                writer.Write(ConsumableItem);
            }

            if (writer.Flag(!CasterLatency.Equals(0)))
            {
                writer.Write(CasterLatency);
            }

            if (writer.Flag(CastType != default))
            {
                writer.Write(CastType);
            }

            if (writer.Flag(LastClickedPosition != Vector3.Zero))
            {
                writer.Write(LastClickedPosition);
            }

            writer.Write(OptionalOriginator);

            if (writer.Flag(OptionalTarget != default))
            {
                writer.Write(OptionalTarget);
            }

            if (writer.Flag(OriginatorRotation != Quaternion.Identity))
            {
                writer.Write(OriginatorRotation);
            }

            writer.Write((uint)Content.Length);

            foreach (var b in Content)
            {
                writer.Write(b);
            }

            writer.Write(SkillId);

            if (writer.Flag(SkillHandle != 0))
            {
                writer.Write(SkillHandle);
            }
        }
        public override void Construct(BitWriter writer)
        {
            if (writer.Flag(true))
            {
                if (writer.Flag(false))
                {
                    writer.Write((long)0); // Subkey
                }
                writer.WriteBit(false);    // Use optional Parts?

                var assemblyData = GetAssemblyData();
                writer.Write((ushort)assemblyData.Length);
                writer.WriteString(assemblyData, assemblyData.Length, true);
            }
        }
Exemple #7
0
        public void WritePhysics(BitWriter writer)
        {
            if (writer.Flag(!GravityMultiplier.Equals(1) || !SpeedMultiplier.Equals(1)))
            {
                writer.Write(GravityMultiplier);
                writer.Write(SpeedMultiplier);
            }

            writer.WriteBit(true);
            writer.Write <float>(0);
            writer.WriteBit(false);

            writer.WriteBit(true);
            writer.WriteBit(false);

            writer.WriteBit(HasPosition);

            if (!HasPosition)
            {
                return;
            }

            writer.Write(Transform.Position);
            writer.Write(Transform.Rotation);

            writer.WriteBit(IsOnGround);
            writer.WriteBit(NegativeAngularVelocity);

            writer.WriteBit(HasVelocity);

            if (HasVelocity)
            {
                writer.Write(Velocity);
            }

            writer.WriteBit(HasAngularVelocity);

            if (HasAngularVelocity)
            {
                writer.Write(AngularVelocity);
            }

            var hasPlatform = Platform != null;

            writer.WriteBit(hasPlatform);

            if (!hasPlatform)
            {
                return;
            }

            writer.Write(Platform);

            writer.Write(PlatformPosition);

            writer.WriteBit(false);
        }
        public override void SerializeMessage(BitWriter writer)
        {
            writer.WriteBit(DelayCameraSwitchIfInCinematic);

            writer.WriteBit(SwitchCamera);

            if (writer.Flag(ControlScheme != 0))
            {
                writer.Write(ControlScheme);
            }
        }
Exemple #9
0
        public override void SerializeMessage(BitWriter writer)
        {
            writer.Write((uint)AnimationsId.Length);
            writer.WriteString(AnimationsId, AnimationsId.Length, true);

            writer.WriteBit(ExpectAnimationToExist);
            writer.WriteBit(PlayImmediate);
            writer.WriteBit(TriggerOnCompleteMessage);

            // ReSharper disable once CompareOfFloatsByEqualityOperator
            if (writer.Flag(Priority != SecondaryPriority))
            {
                writer.Write(Priority);
            }

            if (writer.Flag(Math.Abs(Scale - 1) > 0.01f))
            {
                writer.Write(Scale);
            }
        }
Exemple #10
0
        public override void SerializeMessage(BitWriter writer)
        {
            writer.WriteBit(Start);

            writer.WriteBit(WarnVisitors);

            writer.WriteBit(ModePaused);

            if (writer.Flag(ModeValue != 1))
            {
                writer.Write(ModeValue);
            }

            writer.Write(Player);

            if (writer.Flag(StartPosition != Vector3.Zero))
            {
                writer.Write(StartPosition);
            }
        }
Exemple #11
0
        public override void SerializeMessage(BitWriter writer)
        {
            if (writer.Flag(Builder != default))
            {
                writer.Write(Builder);
            }

            if (writer.Flag(Math.Abs(Duration - 3f) > 0.01f))
            {
                writer.Write(Duration);
            }
        }
Exemple #12
0
        public override void Serialize(BitWriter writer)
        {
            if (writer.Flag(HasVelocity))
            {
                writer.Write(LinearVelocity);
                writer.Write(AngularVelocity);
            }

            if (writer.Flag(HasAirSpeed))
            {
                writer.Write(AirSpeed);
            }

            if (!writer.Flag(HasPosition))
            {
                return;
            }

            writer.Write(Transform.Position);
            writer.Write(Transform.Rotation);
        }
Exemple #13
0
        public override void SerializeMessage(BitWriter writer)
        {
            writer.WriteBit(Enable);
            writer.WriteBit(IsFail);
            writer.WriteBit(IsSuccess);

            if (writer.Flag(FailReason != RebuildFailReason.Canceled))
            {
                writer.Write((uint)FailReason);
            }

            writer.Write(Duration);
            writer.Write(Player);
        }
Exemple #14
0
        public override void SerializeMessage(BitWriter writer)
        {
            writer.Write((uint)Arguments.Length);
            writer.WriteString(Arguments, Arguments.Length, true);

            writer.Write(Target);

            if (writer.Flag(FirstParameter != default))
            {
                writer.Write(FirstParameter);
            }

            if (writer.Flag(SecondParameter != -1))
            {
                writer.Write(SecondParameter);
            }

            writer.Write(Sender);
        }
Exemple #15
0
        public override void Serialize(BitWriter writer)
        {
            writer.WriteBit(true);

            var items = Items.Values.ToArray();

            writer.Write((uint)items.Length);

            foreach (var item in items)
            {
                writer.Write(item.Id);
                writer.Write(item.Lot);

                writer.WriteBit(false);

                writer.WriteBit(false);

                writer.WriteBit(false);

                writer.WriteBit(false);

                var info = item.Id.FindItem();

                if (info == default)
                {
                    writer.WriteBit(false);
                }
                else
                {
                    if (writer.Flag(!string.IsNullOrWhiteSpace(info.ExtraInfo)))
                    {
                        writer.WriteLdfCompressed(LegoDataDictionary.FromString(info.ExtraInfo));
                    }
                }

                writer.WriteBit(true);
            }

            writer.WriteBit(false);
        }