コード例 #1
0
        public void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ, SpellEffectExtraData spellEffectExtraData = null)
        {
            //this function may make players fall below map
            if (_owner.IsTypeId(TypeId.Player))
            {
                return;
            }

            if (speedXY < 0.01f)
            {
                return;
            }

            float x, y, z;
            float moveTimeHalf = (float)(speedZ / gravity);
            float dist         = 2 * moveTimeHalf * speedXY;
            float max_height   = -MoveSpline.ComputeFallElevation(moveTimeHalf, false, -speedZ);

            _owner.GetNearPoint(_owner, out x, out y, out z, _owner.GetObjectSize(), dist, _owner.GetAngle(srcX, srcY) + MathFunctions.PI);

            MoveSplineInit init = new MoveSplineInit(_owner);

            init.MoveTo(x, y, z);
            init.SetParabolic(max_height, 0);
            init.SetOrientationFixed(true);
            init.SetVelocity(speedXY);
            if (spellEffectExtraData != null)
            {
                init.SetSpellEffectExtraData(spellEffectExtraData);
            }

            init.Launch();
            StartMovement(new EffectMovementGenerator(0), MovementSlot.Controlled);
        }
コード例 #2
0
        public void MoveJump(float x, float y, float z, float o, float speedXY, float speedZ, uint id = EventId.Jump, bool hasOrientation = false,
                             JumpArrivalCastArgs arrivalCast = null, SpellEffectExtraData spellEffectExtraData = null)
        {
            Log.outDebug(LogFilter.Server, "Unit ({0}) jump to point (X: {1} Y: {2} Z: {3})", _owner.GetGUID().ToString(), x, y, z);
            if (speedXY < 0.01f)
            {
                return;
            }

            float moveTimeHalf = (float)(speedZ / gravity);
            float max_height   = -MoveSpline.ComputeFallElevation(moveTimeHalf, false, -speedZ);

            MoveSplineInit init = new MoveSplineInit(_owner);

            init.MoveTo(x, y, z, false);
            init.SetParabolic(max_height, 0);
            init.SetVelocity(speedXY);
            if (hasOrientation)
            {
                init.SetFacing(o);
            }
            if (spellEffectExtraData != null)
            {
                init.SetSpellEffectExtraData(spellEffectExtraData);
            }
            init.Launch();

            uint       arrivalSpellId         = 0;
            ObjectGuid arrivalSpellTargetGuid = ObjectGuid.Empty;

            if (arrivalCast != null)
            {
                arrivalSpellId         = arrivalCast.SpellId;
                arrivalSpellTargetGuid = arrivalCast.Target;
            }

            StartMovement(new EffectMovementGenerator(id, arrivalSpellId, arrivalSpellTargetGuid), MovementSlot.Controlled);
        }