public static void SendBoltEffect(IEntity e, bool sound, int hue)
        {
            Map map = e.Map;

            if (map == null)
            {
                return;
            }

            if (e is Item)
            {
                ((Item)e).ProcessDelta();
            }
            else if (e is Mobile)
            {
                ((Mobile)e).ProcessDelta();
            }

            Packet preEffect = null, boltEffect = null, playSound = null;

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

            foreach (NetState state in eable)
            {
                if (state.Mobile.CanSee(e))
                {
                    if (SendParticlesTo(state))
                    {
                        if (preEffect == null)
                        {
                            preEffect = new TargetParticleEffect(e, 0, 10, 5, 0, 0, 5031, 3, 0);
                        }

                        state.Send(preEffect);
                    }

                    if (boltEffect == null)
                    {
                        boltEffect = new BoltEffect(e, hue);
                    }

                    state.Send(boltEffect);

                    if (sound)
                    {
                        if (playSound == null)
                        {
                            playSound = new PlaySound(0x29, e);
                        }

                        state.Send(playSound);
                    }
                }
            }

            eable.Free();
        }
        public static void SendBoltEffect(IEntity e, bool sound, int hue)
        {
            Map map1 = e.Map;

            if (map1 == null)
            {
                return;
            }
            if ((e is Item))
            {
                ((Item)e).ProcessDelta();
            }
            else if ((e is Mobile))
            {
                ((Mobile)e).ProcessDelta();
            }
            Packet            packet1     = null;
            Packet            packet2     = null;
            Packet            packet3     = null;
            IPooledEnumerable enumerable1 = map1.GetClientsInRange(e.Location);

            foreach (NetState state1 in enumerable1)
            {
                if (state1.Mobile.CanSee(e))
                {
                    if (Effects.SendParticlesTo(state1))
                    {
                        if (packet1 == null)
                        {
                            packet1 = new TargetParticleEffect(e, 0, 10, 5, 0, 0, 5031, 3, 0);
                        }
                        state1.Send(packet1);
                    }
                    if (packet2 == null)
                    {
                        packet2 = new BoltEffect(e, hue);
                    }
                    state1.Send(packet2);
                    if (sound)
                    {
                        if (packet3 == null)
                        {
                            packet3 = new PlaySound(41, e);
                        }
                        state1.Send(packet3);
                    }
                }
            }
            enumerable1.Free();
        }
        public static void SendTargetParticles(IEntity target, int itemID, int speed, int duration, int hue, int renderMode, int effect, EffectLayer layer, int unknown)
        {
            if (target is Mobile)
            {
                ((Mobile)target).ProcessDelta();
            }

            Map map = target.Map;

            if (map != null)
            {
                Packet particles = null, regular = null;

                IPooledEnumerable eable = map.GetClientsInRange(target.Location);

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

                    if (SendParticlesTo(state))
                    {
                        if (particles == null)
                        {
                            particles = new TargetParticleEffect(target, itemID, speed, duration, hue, renderMode, effect, (int)layer, unknown);
                        }

                        state.Send(particles);
                    }
                    else if (itemID != 0)
                    {
                        if (regular == null)
                        {
                            regular = new TargetEffect(target, itemID, speed, duration, hue, renderMode);
                        }

                        state.Send(regular);
                    }
                }

                eable.Free();
            }

            //SendPacket( target.Location, target.Map, new TargetParticleEffect( target, itemID, speed, duration, hue, renderMode, effect, (int)layer, unknown ) );
        }
        public static void SendTargetParticles(IEntity target, int itemID, int speed, int duration, int hue, int renderMode, int effect, EffectLayer layer, int unknown)
        {
            if ((target is Mobile))
            {
                ((Mobile)target).ProcessDelta();
            }
            Map map1 = target.Map;

            if (map1 == null)
            {
                return;
            }
            Packet            packet1     = null;
            Packet            packet2     = null;
            IPooledEnumerable enumerable1 = map1.GetClientsInRange(target.Location);

            foreach (NetState state1 in enumerable1)
            {
                state1.Mobile.ProcessDelta();
                if (Effects.SendParticlesTo(state1))
                {
                    if (packet1 == null)
                    {
                        packet1 = new TargetParticleEffect(target, itemID, speed, duration, hue, renderMode, effect, layer, unknown);
                    }
                    state1.Send(packet1);
                    continue;
                }
                if (itemID != 0)
                {
                    if (packet2 == null)
                    {
                        packet2 = new TargetEffect(target, itemID, speed, duration, hue, renderMode);
                    }
                    state1.Send(packet2);
                }
            }
            enumerable1.Free();
        }