public void Write(WorldPacket data)
 {
     data.WritePackedGuid(ID);
     data.WriteVector3(Origin);
     data.WriteVector3(Direction);
     data.WriteUInt32(TransportID);
     data.WriteFloat(Magnitude);
     data.WriteBits(Type, 2);
     data.FlushBits();
 }
示例#2
0
 public void Write(WorldPacket data)
 {
     data.WriteInt32(SpellID);
     data.WriteUInt8(Flags);
     data.WriteUInt32(ActiveFlags);
     data.WriteInt32(Points.Count);
     foreach (float points in Points)
     {
         data.WriteFloat(points);
     }
 }
示例#3
0
 public void Write(WorldPacket data)
 {
     data.WriteUInt8(MyFlags);
     data.WriteUInt32(Slot);
     data.WriteUInt32(MyRandomSlot);
     data.WriteUInt8(MyPartialClear);
     data.WriteFloat(MyGearDiff);
     data.WriteUInt8(MyStrangerCount);
     data.WriteUInt8(MyKickVoteCount);
     data.WriteUInt8(BootCount);
     data.WriteBit(Aborted);
     data.WriteBit(MyFirstReward);
     data.FlushBits();
 }
示例#4
0
 public void Write(WorldPacket data)
 {
     data.WriteUInt64(DbID);
     data.WriteUInt32(MissionRecID);
     data.WriteUInt32((uint)OfferTime);
     data.WriteUInt32(OfferDuration);
     data.WriteUInt32((uint)StartTime);
     data.WriteUInt32(TravelDuration);
     data.WriteUInt32(MissionDuration);
     data.WriteUInt32(MissionState);
     data.WriteUInt32(SuccessChance);
     data.WriteUInt32(Flags);
     data.WriteFloat(MissionScalar);
 }
示例#5
0
        public static void WriteMovementForceWithDirection(MovementForce movementForce, WorldPacket data, Position objectPosition = null)
        {
            data.WritePackedGuid(movementForce.ID);
            data.WriteVector3(movementForce.Origin);
            if (movementForce.Type == 1 && objectPosition != null) // gravity
            {
                Vector3 direction = Vector3.Zero;
                if (movementForce.Magnitude != 0.0f)
                {
                    Position tmp = new Position(movementForce.Origin.X - objectPosition.GetPositionX(),
                                                movementForce.Origin.Y - objectPosition.GetPositionY(),
                                                movementForce.Origin.Z - objectPosition.GetPositionZ());
                    float lengthSquared = tmp.GetExactDistSq(0.0f, 0.0f, 0.0f);
                    if (lengthSquared > 0.0f)
                    {
                        float mult = 1.0f / (float)Math.Sqrt(lengthSquared) * movementForce.Magnitude;
                        tmp.posX *= mult;
                        tmp.posY *= mult;
                        tmp.posZ *= mult;
                        float minLengthSquared = (tmp.GetPositionX() * tmp.GetPositionX() * 0.04f) +
                                                 (tmp.GetPositionY() * tmp.GetPositionY() * 0.04f) +
                                                 (tmp.GetPositionZ() * tmp.GetPositionZ() * 0.04f);
                        if (lengthSquared > minLengthSquared)
                        {
                            direction = new Vector3(tmp.posX, tmp.posY, tmp.posZ);
                        }
                    }
                }

                data.WriteVector3(direction);
            }
            else
            {
                data.WriteVector3(movementForce.Direction);
            }

            data.WriteUInt32(movementForce.TransportID);
            data.WriteFloat(movementForce.Magnitude);
            data.WriteBits(movementForce.Type, 2);
            data.FlushBits();
        }
示例#6
0
 public void Write(WorldPacket data)
 {
     data.WriteFloat(HitRoll);
     data.WriteFloat(HitRollNeeded);
 }
示例#7
0
        public override void Write()
        {
            WorldPacket attackRoundInfo = new WorldPacket();

            attackRoundInfo.WriteUInt32((uint)hitInfo);
            attackRoundInfo.WritePackedGuid(AttackerGUID);
            attackRoundInfo.WritePackedGuid(VictimGUID);
            attackRoundInfo.WriteInt32(Damage);
            attackRoundInfo.WriteInt32(OriginalDamage);
            attackRoundInfo.WriteInt32(OverDamage);
            attackRoundInfo.WriteUInt8((byte)(SubDmg.HasValue ? 1 : 0));

            if (SubDmg.HasValue)
            {
                attackRoundInfo.WriteInt32(SubDmg.Value.SchoolMask);
                attackRoundInfo.WriteFloat(SubDmg.Value.FDamage);
                attackRoundInfo.WriteInt32(SubDmg.Value.Damage);
                if (hitInfo.HasAnyFlag(HitInfo.FullAbsorb | HitInfo.PartialAbsorb))
                {
                    attackRoundInfo.WriteInt32(SubDmg.Value.Absorbed);
                }
                if (hitInfo.HasAnyFlag(HitInfo.FullResist | HitInfo.PartialResist))
                {
                    attackRoundInfo.WriteInt32(SubDmg.Value.Resisted);
                }
            }

            attackRoundInfo.WriteUInt8(VictimState);
            attackRoundInfo.WriteUInt32(AttackerState);
            attackRoundInfo.WriteUInt32(MeleeSpellID);

            if (hitInfo.HasAnyFlag(HitInfo.Block))
            {
                attackRoundInfo.WriteInt32(BlockAmount);
            }

            if (hitInfo.HasAnyFlag(HitInfo.RageGain))
            {
                attackRoundInfo.WriteInt32(RageGained);
            }

            if (hitInfo.HasAnyFlag(HitInfo.Unk1))
            {
                attackRoundInfo.WriteUInt32(UnkState.State1);
                attackRoundInfo.WriteFloat(UnkState.State2);
                attackRoundInfo.WriteFloat(UnkState.State3);
                attackRoundInfo.WriteFloat(UnkState.State4);
                attackRoundInfo.WriteFloat(UnkState.State5);
                attackRoundInfo.WriteFloat(UnkState.State6);
                attackRoundInfo.WriteFloat(UnkState.State7);
                attackRoundInfo.WriteFloat(UnkState.State8);
                attackRoundInfo.WriteFloat(UnkState.State9);
                attackRoundInfo.WriteFloat(UnkState.State10);
                attackRoundInfo.WriteFloat(UnkState.State11);
                attackRoundInfo.WriteUInt32(UnkState.State12);
            }

            if (hitInfo.HasAnyFlag(HitInfo.Block | HitInfo.Unk12))
            {
                attackRoundInfo.WriteFloat(Unk);
            }

            attackRoundInfo.WriteUInt8((byte)ContentTuning.TuningType);
            attackRoundInfo.WriteUInt8(ContentTuning.TargetLevel);
            attackRoundInfo.WriteUInt8(ContentTuning.Expansion);
            attackRoundInfo.WriteUInt8(ContentTuning.TargetMinScalingLevel);
            attackRoundInfo.WriteUInt8(ContentTuning.TargetMaxScalingLevel);
            attackRoundInfo.WriteInt16(ContentTuning.PlayerLevelDelta);
            attackRoundInfo.WriteInt8(ContentTuning.TargetScalingLevelDelta);
            attackRoundInfo.WriteUInt16(ContentTuning.PlayerItemLevel);
            attackRoundInfo.WriteUInt16(ContentTuning.ScalingHealthItemLevelCurveID);
            attackRoundInfo.WriteUInt8((byte)(ContentTuning.ScalesWithItemLevel ? 1 : 0));

            WriteLogDataBit();
            FlushBits();
            WriteLogData();

            _worldPacket.WriteUInt32(attackRoundInfo.GetSize());
            _worldPacket.WriteBytes(attackRoundInfo);
        }
示例#8
0
        public static void WriteCreateObjectSplineDataBlock(MoveSpline moveSpline, WorldPacket data)
        {
            data.WriteUInt32(moveSpline.GetId());                                       // ID

            if (!moveSpline.isCyclic())                                                 // Destination
            {
                data.WriteVector3(moveSpline.FinalDestination());
            }
            else
            {
                data.WriteVector3(Vector3.Zero);
            }

            bool hasSplineMove = data.WriteBit(!moveSpline.Finalized() && !moveSpline.splineIsFacingOnly);

            data.FlushBits();

            if (hasSplineMove)
            {
                data.WriteUInt32((uint)moveSpline.splineflags.Flags);  // SplineFlags
                data.WriteInt32(moveSpline.timePassed());              // Elapsed
                data.WriteInt32(moveSpline.Duration());                // Duration
                data.WriteFloat(1.0f);                                 // DurationModifier
                data.WriteFloat(1.0f);                                 // NextDurationModifier
                data.WriteBits((byte)moveSpline.facing.type, 2);       // Face
                bool hasFadeObjectTime = data.WriteBit(moveSpline.splineflags.hasFlag(SplineFlag.FadeObject) && moveSpline.effect_start_time < moveSpline.Duration());
                data.WriteBits(moveSpline.getPath().Length, 16);
                data.WriteBits((byte)moveSpline.spline.m_mode, 2);                   // Mode
                data.WriteBit(0);                                                    // HasSplineFilter
                data.WriteBit(moveSpline.spell_effect_extra.HasValue);               // HasSpellEffectExtraData
                data.WriteBit(moveSpline.splineflags.hasFlag(SplineFlag.Parabolic)); // HasJumpExtraData
                data.FlushBits();

                //if (HasSplineFilterKey)
                //{
                //    data << uint32(FilterKeysCount);
                //    for (var i = 0; i < FilterKeysCount; ++i)
                //    {
                //        data << float(In);
                //        data << float(Out);
                //    }

                //    data.WriteBits(FilterFlags, 2);
                //    data.FlushBits();
                //}

                switch (moveSpline.facing.type)
                {
                case MonsterMoveType.FacingSpot:
                    data.WriteVector3(moveSpline.facing.f);             // FaceSpot
                    break;

                case MonsterMoveType.FacingTarget:
                    data.WritePackedGuid(moveSpline.facing.target);     // FaceGUID
                    break;

                case MonsterMoveType.FacingAngle:
                    data.WriteFloat(moveSpline.facing.angle);           // FaceDirection
                    break;
                }

                if (hasFadeObjectTime)
                {
                    data.WriteInt32(moveSpline.effect_start_time);     // FadeObjectTime
                }
                foreach (var vec in moveSpline.getPath())
                {
                    data.WriteVector3(vec);
                }

                if (moveSpline.spell_effect_extra.HasValue)
                {
                    data.WritePackedGuid(moveSpline.spell_effect_extra.Value.Target);
                    data.WriteUInt32(moveSpline.spell_effect_extra.Value.SpellVisualId);
                    data.WriteUInt32(moveSpline.spell_effect_extra.Value.ProgressCurveId);
                    data.WriteUInt32(moveSpline.spell_effect_extra.Value.ParabolicCurveId);
                }

                if (moveSpline.splineflags.hasFlag(SplineFlag.Parabolic))
                {
                    data.WriteFloat(moveSpline.vertical_acceleration);
                    data.WriteInt32(moveSpline.effect_start_time);
                    data.WriteUInt32(0);                                                  // Duration (override)
                }
            }
        }
示例#9
0
 public void Write(WorldPacket data)
 {
     data.WriteFloat(HorzSpeed);
     data.WriteFloat(VertSpeed);
 }
示例#10
0
        public void Write(WorldPacket data)
        {
            data.WriteUInt32(Flags);
            data.WriteUInt8(AnimTier);
            data.WriteUInt32(TierTransStartTime);
            data.WriteInt32(Elapsed);
            data.WriteUInt32(MoveTime);
            data.WriteUInt32(FadeObjectTime);
            data.WriteUInt8(Mode);
            data.WriteUInt8(VehicleExitVoluntary);
            data.WritePackedGuid(TransportGUID);
            data.WriteInt8(VehicleSeat);
            data.WriteBits((byte)Face, 2);
            data.WriteBits(Points.Count, 16);
            data.WriteBits(PackedDeltas.Count, 16);
            data.WriteBit(SplineFilter.HasValue);
            data.WriteBit(SpellEffectExtraData.HasValue);
            data.WriteBit(JumpExtraData.HasValue);
            data.FlushBits();

            if (SplineFilter.HasValue)
            {
                SplineFilter.Value.Write(data);
            }

            switch (Face)
            {
            case MonsterMoveType.FacingSpot:
                data.WriteVector3(FaceSpot);
                break;

            case MonsterMoveType.FacingTarget:
                data.WriteFloat(FaceDirection);
                data.WritePackedGuid(FaceGUID);
                break;

            case MonsterMoveType.FacingAngle:
                data.WriteFloat(FaceDirection);
                break;
            }

            foreach (Vector3 pos in Points)
            {
                data.WriteVector3(pos);
            }

            foreach (Vector3 pos in PackedDeltas)
            {
                data.WritePackXYZ(pos);
            }

            if (SpellEffectExtraData.HasValue)
            {
                SpellEffectExtraData.Value.Write(data);
            }

            if (JumpExtraData.HasValue)
            {
                JumpExtraData.Value.Write(data);
            }
        }
示例#11
0
 public void Write(WorldPacket data)
 {
     data.WriteFloat(JumpGravity);
     data.WriteUInt32(StartTime);
     data.WriteUInt32(Duration);
 }