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

            if (map != null)
            {
                Packet playSound = null;

                foreach (NetState state in map.GetClientsInRange(p))
                {
                    state.Mobile.ProcessDelta();

                    if (playSound == null)
                    {
                        playSound = Packet.Acquire(GenericPackets.PlaySound(soundId, p));
                    }

                    state.Send(playSound);
                }

                Packet.Release(playSound);
            }
        }
Esempio n. 2
0
        public override bool OnDragDropInto(Mobile from, Item dropped, Point3D point, byte gridloc)
        {
            BasePiece piece = dropped as BasePiece;

            if (piece != null && piece.Board == this && base.OnDragDropInto(from, dropped, point, gridloc))
            {
                Packet p = GenericPackets.PlaySound(0x127, GetWorldLocation());

                p.Acquire();

                if (RootParent == from)
                {
                    from.Send(p);
                }
                else
                {
                    foreach (GameClient state in this.GetClientsInRange(2))
                    {
                        state.Send(p);
                    }
                }

                if (p != null)
                {
                    p.Release();
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        private static void PlaySound(Mobile m, int index, bool toAll)
        {
            Map map = m.Map;

            if (map == null)
            {
                return;
            }

            CommandLogging.WriteLine(m, "{0} {1} playing sound {2} (toAll={3})", m.AccessLevel, CommandLogging.Format(m), index, toAll);

            Packet p = GenericPackets.PlaySound(index, m.Location);

            p.Acquire();

            foreach (GameClient state in m.GetClientsInRange(12))
            {
                if (toAll || state.Mobile.CanSee(m))
                {
                    state.Send(p);
                }
            }

            p.Release();
        }
        public GenericPackets GenericPackets;                                                                          //collection of all Generic Packets and functions

        public PacketCollection()
        {
            EMPPackets          = new EMPPackets();                                                                 //generate the packet classes
            SNPPackets          = new SNPPackets();
            ControlPackets      = new ControlPackets();
            ChainStretchPackets = new ChainStretchPackets();
            GenericPackets      = new GenericPackets();
        }
Esempio n. 5
0
        public static void SendBoltEffect(IEntity e, bool sound = true, int hue = 0)
        {
            IMap 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;

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

                        state.Send(preEffect);
                    }

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

                    state.Send(boltEffect);

                    if (sound)
                    {
                        if (playSound == null)
                        {
                            playSound = Packet.Acquire(GenericPackets.PlaySound(0x29, e));
                        }

                        state.Send(playSound);
                    }
                }
            }

            Packet.Release(preEffect);
            Packet.Release(boltEffect);
            Packet.Release(playSound);
        }
Esempio n. 6
0
 private void DeltaEnemies()
 {
     foreach (Mobile m in m_Owner.GetMobilesInRange(18))
     {
         if (m.GetType() == m_TargetType)
         {
             m_Owner.Send(GenericPackets.MobileMoving(m, Notoriety.Compute(m_Owner, m)));
         }
     }
 }
Esempio n. 7
0
 public virtual void BeginConfirmation(Mobile from)
 {
     if (IsInTown(from.Location, from.Map) && !IsInTown(m_Target, m_TargetMap) || (from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning))
     {
         from.Send(GenericPackets.PlaySound(0x20E, from.Location));
         from.CloseGump(typeof(MoongateConfirmGump));
         from.SendGump(new MoongateConfirmGump(from, this));
     }
     else
     {
         EndConfirmation(from);
     }
 }
Esempio n. 8
0
        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile from = e.Mobile;

            if (e.Length == 1)
            {
                int    index = e.GetInt32(0);
                Mobile mob   = (Mobile)obj;

                CommandLogging.WriteLine(from, "{0} {1} playing sound {2} for {3}", from.AccessLevel, CommandLogging.Format(from), index, CommandLogging.Format(mob));
                mob.Send(GenericPackets.PlaySound(index, mob.Location));
            }
            else
            {
                from.SendMessage("Format: PrivSound <index>");
            }
        }
Esempio n. 9
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is SpellScroll && dropped.Amount == 1 && !(dropped is Spells.Mysticism.SpellStone))
            {
                SpellScroll scroll = (SpellScroll)dropped;

                SpellbookType type = GetTypeForSpell(scroll.SpellID);

                if (type != this.SpellbookType)
                {
                    return(false);
                }
                else if (HasSpell(scroll.SpellID))
                {
                    from.SendLocalizedMessage(500179);                       // That spell is already present in that spellbook.
                    return(false);
                }
                else
                {
                    int val = scroll.SpellID - BookOffset;

                    if (val >= 0 && val < BookCount)
                    {
                        m_Content |= (ulong)1 << val;
                        ++m_Count;

                        InvalidateProperties();

                        scroll.Delete();

                        from.Send(GenericPackets.PlaySound(0x249, GetWorldLocation()));
                        return(true);
                    }

                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is DarkKnightRune)
            {
                from.SendLocalizedMessage(1078842);                   // That rune can't be added to a Runebook
            }
            else if (dropped is RecallRune)
            {
                if (!CheckAccess(from))
                {
                    from.SendLocalizedMessage(502413);                       // That cannot be done while the book is locked down.
                }
                else if (IsOpen(from))
                {
                    from.SendLocalizedMessage(1005571);                       // You cannot place objects in the book while viewing the contents.
                }
                else if (m_Entries.Count < 16)
                {
                    RecallRune rune = (RecallRune)dropped;

                    if (rune.Marked && rune.TargetMap != null)
                    {
                        m_Entries.Add(new RunebookEntry(rune.Target, rune.TargetMap, rune.Description, rune.House, rune.Hue));

                        dropped.Delete();

                        from.Send(GenericPackets.PlaySound(0x42, GetWorldLocation()));

                        string desc = rune.Description;

                        if (desc == null || (desc = desc.Trim()).Length == 0)
                        {
                            desc = "(indescript)";
                        }

                        from.SendAsciiMessage(desc);

                        return(true);
                    }
                    else
                    {
                        from.SendLocalizedMessage(502409);                           // This rune does not have a marked location.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502401);                       // This runebook is full.
                }
            }
            else if (dropped is RecallScroll)
            {
                if (m_CurCharges < m_MaxCharges)
                {
                    from.Send(GenericPackets.PlaySound(0x249, GetWorldLocation()));

                    int amount = dropped.Amount;

                    if (amount > (m_MaxCharges - m_CurCharges))
                    {
                        dropped.Consume(m_MaxCharges - m_CurCharges);
                        m_CurCharges = m_MaxCharges;
                    }
                    else
                    {
                        m_CurCharges += amount;
                        dropped.Delete();

                        return(true);
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502410);                       // This book already has the maximum amount of charges.
                }
            }

            return(false);
        }