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 = new PlaySound(index, m.Location); p.Acquire(); foreach (NetState state in m.GetClientsInRange(12)) { if (toAll || state.Mobile.CanSee(m)) { state.Send(p); } } p.Release(); }
public override bool OnDragDropInto(Mobile from, Item dropped, Point3D point) { if (dropped is BasePiece piece && piece.Board == this && base.OnDragDropInto(from, dropped, point)) { Packet p = new PlaySound(0x127, GetWorldLocation()); p.Acquire(); if (RootParent == from) { from.Send(p); } else { foreach (var state in GetClientsInRange(2)) { state.Send(p); } } p.Release(); return(true); } return(false); }
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 = new PlaySound(0x127, this.GetWorldLocation()); p.Acquire(); if (this.RootParent == from) { from.Send(p); } else { foreach (NetState state in this.GetClientsInRange(2)) { state.Send(p); } } p.Release(); return(true); } else { return(false); } }
public override bool OnDragDropInto(Mobile from, Item dropped, Point3D point) { BasePiece piece = dropped as BasePiece; if (piece != null && piece.Board == this && base.OnDragDropInto(from, dropped, point)) { Packet p = new PlaySound(0x127, GetWorldLocation()); p.Acquire(); if (RootParent == from) { from.Send(p); } else { IPooledEnumerable eable = this.GetClientsInRange(2); foreach (NetState state in eable) { state.Send(p); } eable.Free(); } p.Release(); return(true); } /* * else * { * // Adam: anything other than a scroll will get dropped into your backpack * // (so your best sword doesn't get dropped on the ground.) * from.AddToBackpack( dropped ); * // For richness, we add the drop sound of the item dropped. * from.PlaySound( dropped.GetDropSound() ); * return true; * } */ return(false); }
/// <summary> /// Plays a sound to all mobiles within 20 tiles of the NPC emitting it /// </summary> /// <param name="m">The NPC producing the sound</param> /// <param name="sound">The sound to play</param> public void PlaySound(ChessMobile m, int sound) { if (m == null) { return; } Packet p = new PlaySound(sound, m.Location); p.Acquire(); foreach (NetState state in m.GetClientsInRange(12)) { if (state.Mobile.CanSee(m)) { state.Send(p); } } p.Release(); }