Esempio n. 1
0
        public static void PlaySound(Point3D p, Map map, int soundID)
        {
            if (soundID <= -1)
            {
                return;
            }

            if (map != null)
            {
                Span <byte> buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength];
                buffer.InitializePacket();

                var eable = map.GetClientsInRange(new Point3D(p));

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

                    if (buffer[0] == 0)
                    {
                        OutgoingEffectPackets.CreateSoundEffect(buffer, soundID, p);
                    }

                    state.Send(buffer);
                }

                eable.Free();
            }
        }
Esempio n. 2
0
        public override bool OnDragDropInto(Mobile from, Item dropped, Point3D point)
        {
            if (dropped is BasePiece piece && piece.Board == this && base.OnDragDropInto(from, dropped, point))
            {
                if (RootParent == from)
                {
                    from.SendSound(0x127, GetWorldLocation());
                }
                else
                {
                    Span <byte> buffer = stackalloc byte[OutgoingEffectPackets.SoundPacketLength];
                    buffer.InitializePacket();

                    foreach (var state in GetClientsInRange(2))
                    {
                        if (buffer[0] == 0)
                        {
                            OutgoingEffectPackets.CreateSoundEffect(buffer, 0x127, GetWorldLocation());
                        }

                        state.Send(buffer);
                    }
                }

                return(true);
            }

            return(false);
        }
Esempio n. 3
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();
        }