Пример #1
0
        public static void SendLocationParticles(
            IEntity e, int itemID, int speed, int duration, int hue, int renderMode, int effect, int unknown
            )
        {
            var map = e.Map;

            if (map == null)
            {
                return;
            }

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

            particles.InitializePacket();

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

            if (itemID != 0)
            {
                regular.InitializePacket();
            }

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

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

                if (SendParticlesTo(state))
                {
                    if (particles[0] == 0)
                    {
                        OutgoingEffectPackets.CreateLocationParticleEffect(
                            particles,
                            e, itemID, speed, duration, hue, renderMode, effect, unknown
                            );
                    }

                    state.Send(particles);
                }
                else if (itemID != 0)
                {
                    if (regular[0] == 0)
                    {
                        OutgoingEffectPackets.CreateLocationHuedEffect(
                            regular,
                            e.Location, itemID, speed, duration, hue, renderMode
                            );
                    }

                    state.Send(regular);
                }
            }

            eable.Free();
        }
Пример #2
0
        public static void SendLocationEffect(
            Point3D p, Map map, int itemID, int duration, int speed = 10, int hue = 0, int renderMode = 0
            )
        {
            Span <byte> effect = stackalloc byte[OutgoingEffectPackets.HuedEffectLength].InitializePacket();

            OutgoingEffectPackets.CreateLocationHuedEffect(
                effect,
                p, itemID, speed, duration, hue, renderMode
                );

            SendPacket(p, map, effect);
        }