Esempio n. 1
0
        public void TestBoltEffect()
        {
            IEntity entity   = new Entity((Serial)0x1000, new Point3D(1000, 100, -10), Map.Felucca);
            var     hue      = 0x1024;
            var     expected = new BoltEffect(entity, hue).Compile();

            Span <byte> actual = stackalloc byte[OutgoingEffectPackets.BoltEffectLength];

            OutgoingEffectPackets.CreateBoltEffect(actual, entity, hue);

            AssertThat.Equal(actual, expected);
        }
Esempio n. 2
0
        public static void SendBoltEffect(IEntity e, bool sound = true, int hue = 0)
        {
            var map = e.Map;

            if (map == null)
            {
                return;
            }

            e.ProcessDelta();

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

            OutgoingEffectPackets.CreateTargetParticleEffect(
                ref preEffect,
                e, 0, 10, 5, 0, 0, 5031, 3, 0
                );

            Span <byte> boltEffect = stackalloc byte[OutgoingEffectPackets.BoltEffectLength];

            OutgoingEffectPackets.CreateBoltEffect(ref boltEffect, e, hue);

            Span <byte> soundEffect = sound ? stackalloc byte[OutgoingEffectPackets.SoundPacketLength] : null;

            if (sound)
            {
                OutgoingEffectPackets.CreateSoundEffect(ref soundEffect, 0x29, e);
            }

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

            foreach (var state in eable)
            {
                if (state.Mobile.CanSee(e))
                {
                    if (SendParticlesTo(state))
                    {
                        state.Send(preEffect);
                    }

                    state.Send(boltEffect);

                    if (sound)
                    {
                        state.Send(soundEffect);
                    }
                }
            }

            eable.Free();
        }