Пример #1
0
        public static void SendMovingParticles(
            IEntity from, IEntity to, int itemID, int speed, int duration,
            bool fixedDirection, bool explodes, int hue, int renderMode, int effect, int explodeEffect, int explodeSound,
            EffectLayer layer, int unknown
            )
        {
            (from as Mobile)?.ProcessDelta();
            (to as Mobile)?.ProcessDelta();

            var map = from.Map;

            if (map == null)
            {
                return;
            }

            Span <byte> particles = stackalloc byte[OutgoingEffectPackets.ParticleEffectLength];

            OutgoingEffectPackets.CreateMovingParticleEffect(
                ref particles,
                from, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode, effect,
                explodeEffect, explodeSound, layer, unknown
                );

            Span <byte> regular = itemID != 0 ? stackalloc byte[OutgoingEffectPackets.HuedEffectLength] : null;

            if (itemID != 0)
            {
                OutgoingEffectPackets.CreateMovingHuedEffect(
                    ref regular,
                    from, to, itemID, speed, duration, fixedDirection, explodes, hue, renderMode
                    );
            }

            var eable = map.GetClientsInRange(from.Location);

            foreach (var state in eable)
            {
                state.Mobile.ProcessDelta();

                if (SendParticlesTo(state))
                {
                    state.Send(particles);
                }
                else if (itemID > 1)
                {
                    state.Send(regular);
                }
            }

            eable.Free();
        }
Пример #2
0
        public static void SendMovingEffect(
            Serial from, Serial to, Point3D origin, Map map, int itemID, Point3D fromLocation, Point3D toLocation,
            int speed, int duration, bool fixedDirection = false, bool explodes = false, int hue = 0, int renderMode = 0
            )
        {
            Span <byte> effect = stackalloc byte[OutgoingEffectPackets.HuedEffectLength];

            OutgoingEffectPackets.CreateMovingHuedEffect(
                effect,
                from, to, itemID, fromLocation, toLocation, speed, duration, fixedDirection,
                explodes, hue, renderMode
                );

            SendPacket(origin, map, effect);
        }