public bool CheckInstrument() { BaseInstrument inst = BaseInstrument.GetInstrument(this.m_Mobile); if (inst != null) { return(true); } if (this.m_Mobile.Debug) { this.m_Mobile.Say(1162, "I need an instrument, fixing my problem."); } if (this.m_Mobile.Backpack == null) { return(false); } inst = (BaseInstrument)this.m_Mobile.Backpack.FindItemByType(typeof(BaseInstrument)); if (inst == null) { inst = new Harp(); inst.SuccessSound = 0x58B; inst.FailureSound = 0x58C; // Got Better Music? // inst.DiscordSound = inst.PeaceSound = 0x58B; // inst.ProvocationSound = 0x58A; } BaseInstrument.SetInstrument(this.m_Mobile, inst); return(true); }
public static void OnPickedInstrument(Mobile from, BaseInstrument instrument) { XmlMusic xm = (XmlMusic)XmlAttach.FindAttachment(from, typeof(XmlMusic)); if (xm == null) { XmlAttach.AttachTo(from, new XmlMusic()); xm = (XmlMusic)XmlAttach.FindAttachment(from, typeof(XmlMusic)); } if (!instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); //This must be in your backpack } else if (instrument is Tambourine || instrument is TambourineTassel) { from.SendMessage("You cannot play a tune on that instrument."); BaseInstrument.SetInstrument(from, null); } else if (!xm.Playing) // If this is a new tune, create a new timer and start it. { from.Emote("*plays a tune*"); // Player emotes to indicate they are playing xm.Playing = true; MobilePlayTimer pt = new MobilePlayTimer(from, instrument); pt.Start(); } }
public static BaseInstrument LoadTrack(Mobile from, string song, Queue playlist) { BaseInstrument.SetInstrument(from, null); BaseInstrument.PickInstrument(from, new InstrumentPickedCallback(OnPickedInstrument)); from.SendMessage("Target an instrument to load in to this Track."); BaseInstrument instrument = BaseInstrument.GetInstrument(from); try { XmlMusic xm = (XmlMusic)XmlAttach.FindAttachment(instrument, typeof(XmlMusic)); xm.PlayList = playlist; xm.Song = song; } catch { return(null); } return(instrument); }
// Warning: Untested public static bool CheckBarding(BaseCreature from) { BaseInstrument inst = BaseInstrument.GetInstrument(from); if (inst == null) { if (from.Backpack == null) { return(false); } inst = (BaseInstrument)from.Backpack.FindItemByType(typeof(BaseInstrument)); if (inst == null) { inst = new Harp(); inst.SuccessSound = 0x58B; // inst.DiscordSound = inst.PeaceSound = 0x58B; // inst.ProvocationSound = 0x58A; inst.FailureSound = 0x58C; } } BaseInstrument.SetInstrument(from, inst); if (from.Skills[SkillName.Discordance].Base == 0) { from.Skills[SkillName.Discordance].Base = 100.0; } if (from.Skills[SkillName.Peacemaking].Base == 0) { from.Skills[SkillName.Peacemaking].Base = 100.0; } if (from.Skills[SkillName.Provocation].Base == 0) { from.Skills[SkillName.Provocation].Base = 100.0; } return(true); }
public static void OnPickedInstrument(Mobile from, BaseInstrument instrument) { PlayerMobile pm = (PlayerMobile)from; if (!instrument.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); //This must be in your backpack } else if (instrument is Drums || instrument is Tambourine || instrument is TambourineTassel) { from.SendMessage("You cannot play a tune on that instrument."); BaseInstrument.SetInstrument(from, null); } else if (!pm.Playing) // If this is a new tune, create a new timer and start it. { from.Emote("*plays a tune*"); // Player emotes to indicate they are playing pm.Playing = true; PlayTimer pt = new PlayTimer(pm); pt.Start(); } }
private void LoadTrack(Mobile from) { BaseInstrument.SetInstrument(from, null); from.SendMessage("Target an instrument to load in to this Track."); BaseInstrument.PickInstrument(from, new InstrumentPickedCallback(OnPickedInstrument)); }