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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public override bool CheckCast()
        {
            int mana = ScaleMana(RequiredMana);

            if (!base.CheckCast())
            {
                return(false);
            }

            m_Instrument = BaseInstrument.GetInstrument(Caster);

            if (m_Instrument == null)
            {
                BaseInstrument.PickInstrument(Caster, OnPickedInstrument);
                return(false);
            }

            return(true);
        }
Beispiel #4
0
        // 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);
        }
Beispiel #5
0
        private bool CheckInstrumentSlays(Mobile target)
        {
            BaseInstrument instrument = BaseInstrument.GetInstrument(Caster);

            return(instrument != null && instrument.Slays(target));
        }
Beispiel #6
0
            protected override void OnTick()
            {
                if (DateTime.Now < m_PauseTime)
                {
                    //					Console.WriteLine("Waiting pause time");
                    return;
                }

                if (m_Player.PlayList.Count == 0)                 // If the tune is done, stop the timer.
                {
                    m_Player.Playing = false;
                    Stop();
                    return;
                }
                else
                {
                    try
                    {
                        //						Console.WriteLine(DateTime.Now.TimeOfDay);
                        object obj = m_Player.PlayList.Dequeue();

                        // If the first item in the queue is a string, make sure a string
                        // instrument is selected, and play the note.
                        if (obj.GetType() == (typeof(string)))
                        {
                            BaseInstrument instrument = BaseInstrument.GetInstrument(m_Player);

                            // Unfortunately, there are no note files for percussion instruments.
                            if (instrument is Drums || instrument is Tambourine || instrument is TambourineTassel)
                            {
                                m_Player.SendMessage("You cannot play a tune on that instrument.");
                                m_Player.PlayList = null;
                                m_Player.Playing  = false;
                                Stop();
                            }
                            else if (instrument == null)
                            {
                                m_Player.SendMessage("Something has happened to your instrument.");
                                m_Player.PlayList = null;
                                m_Player.Playing  = false;
                                Stop();
                            }
                            else
                            {
                                Music.PlayNote(m_Player, (string)obj, instrument);
                                //								Console.WriteLine("Playing Music");
                            }
                        }
                        else                         // If the first item is a double, treat it as a pause.
                        {
                            double pause = (double)obj;
                            //							Console.WriteLine(pause);
                            m_PauseTime = DateTime.Now + TimeSpan.FromSeconds(pause);
                            //							Console.WriteLine(m_PauseTime);
                            //							Console.WriteLine(DateTime.Now.TimeOfDay);
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        Scripts.Commands.LogHelper.LogException(ex);
                    }
                }
            }