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); } }
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 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); } }
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); }
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); } }
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>"); } }
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); } }
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); }