Beispiel #1
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            BaseInstrument.PickInstrument(m, OnPickedInstrument);

            return(TimeSpan.FromSeconds(1.0));            // Cannot use another skill for 1 second
        }
Beispiel #2
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.RevealingAction();

            BaseInstrument.PickInstrument(m, new InstrumentPickedCallback(OnPickedInstrument));

            return(TimeSpan.FromSeconds(1.0));
        }
Beispiel #3
0
        public static TimeSpan OnUse(Mobile m)
        {
            m.SendMessage("This skill has been removed for historical accuracy.");
            return(TimeSpan.Zero);

            m.RevealingAction();

            BaseInstrument.PickInstrument(m, new InstrumentPickedCallback(OnPickedInstrument));

            return(TimeSpan.FromSeconds(1.0));              // Cannot use another skill for 1 second
        }
        public static TimeSpan OnUse(Mobile m)
        {
            if (!(m.Weapon is Fists))
            {
                m.SendMessage("You cannot play an instrument while holding a weapon.");
                return(TimeSpan.FromSeconds(1.0));                  // Cannot use another skill for 1 second
            }

            m.RevealingAction();

            BaseInstrument.PickInstrument(m, new InstrumentPickedCallback(OnPickedInstrument));

            return(TimeSpan.FromSeconds(1.0));              // Cannot use another skill for 1 second
        }
Beispiel #5
0
        public static TimeSpan OnUse(Mobile m)
        {
            if (m.BeginAction(typeof(IAction)))
            {
                m.RevealingAction();
                BaseInstrument.PickInstrument(m, OnPickedInstrument);
            }
            else
            {
                m.SendAsciiMessage("You must wait to perform another action.");
            }

            return(TimeSpan.FromSeconds(1.0));              // Cannot use another skill for 1 second
        }
Beispiel #6
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 #7
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 #8
0
        public override void OnUse(NubiaPlayer p)
        {
            if (p.Competences[CompType.Representation].getMaitrise() < 3)
            {
                p.SendMessage("Vous n'êtes pas assez doué en représentation pour ce don");
                return;
            }

            p.ActionRevelation();

            if (p.FindItemOnLayer(Layer.TwoHanded) is BaseInstrument)
            {
                p.Target = new InternalTarget(p, p.FindItemOnLayer(Layer.TwoHanded) as BaseInstrument);
            }
            else
            {
                BaseInstrument.PickInstrument(p, new InstrumentPickedCallback(OnPickedInstrument));
            }
        }
Beispiel #9
0
        public static TimeSpan OnUse(Mobile m)
        {
            PlayerMobile pm = m as PlayerMobile;

            if (bUseRTT && TestCenter.Enabled && pm != null)
            {
                pm.RTT("Please verify that you're at your computer.  Use of this skill will be disabled if too many failures occur.", false, 2, "Peacemaking");
            }

            if (bUseRTT && TestCenter.Enabled && pm != null && pm.RTTFailures >= 3)
            {
                pm.SendMessage("You cannot use this skill because you have failed the AFK check too many times in a row.");
                pm.SendMessage("After some time has elapsed, you will be tested again when you use the skill.");
                return(TimeSpan.FromSeconds(5.0));
            }
            else
            {
                m.RevealingAction();

                BaseInstrument.PickInstrument(m, new InstrumentPickedCallback(OnPickedInstrument));

                return(TimeSpan.FromSeconds(1.0));                // Cannot use another skill for 1 second
            }
        }
Beispiel #10
0
        public static void Play_OnCommand(CommandEventArgs e)
        {
            PlayerMobile pm       = (PlayerMobile)e.Mobile;
            Queue        PlayList = new Queue();
            Object       LastItem = null;

            string[] Notes = { "cl", "csl", "d",  "ds", "e",   "f",  "fs", "g",   "gs", "a",   "as",
                               "b",  "c",   "cs", "dh", "dsh", "eh", "fh", "fsh", "gh", "gsh",
                               "ah", "ash", "bh", "ch" };
            Regex    ValidPause    = new Regex(@"^((1\.0)|(0\.[0-9]))$");
            int      NumOfNotes    = 0;
            int      MaxQueueSize  = 64;
            double   MinMusicSkill = 80.0;

            // Allows dynamic control through the CoreManagementConsole.
            if (e.Mobile.AccessLevel < CoreAI.PlayAccessLevel)
            {
                e.Mobile.SendMessage("Playing music is currently disabled.");
                return;
            }

            if (e.Arguments.Length == 0)
            {
                Usage(pm);
                return;
            }

            // If the player's Musicianship is too low, don't let them play at all.
            if (e.Mobile.Skills[SkillName.Musicianship].Value < MinMusicSkill)
            {
                e.Mobile.SendMessage("You do not have enough skill to play a tune.");
                return;
            }

            // If there are too many notes in the queue, make the player pause and try again.
            if (pm.PlayList != null && pm.PlayList.Count + e.Arguments.Length > MaxQueueSize)
            {
                e.Mobile.SendMessage("Your fingers hurt from so much playing. You must rest a moment before playing another note.");
                return;
            }

            // If there are some leftover notes in the playlist but we're starting a new tune,
            // clear the playlist.
            if (!pm.Playing && pm.PlayList != null)
            {
                pm.PlayList.Clear();
            }

            for (int i = 0; i < e.Length; ++i)
            {
                string item   = e.Arguments[i].ToLower();
                bool   Queued = false;

                for (int j = 0; j < Notes.Length; ++j)
                {
                    if (item == Notes[j])                     // If the argument is a note, add it directly to the queue.
                    {
                        // Detect repeated notes
                        if (PlayList.Count > 0 && LastItem is String && ((String)LastItem).ToLower() == item)
                        {
                            e.Mobile.SendMessage("Warning: Repeated note detected. Some notes may not play. Insert a 0.3 pause between repeated notes.");
                        }
                        PlayList.Enqueue(item);
                        LastItem = item;
                        NumOfNotes++;
                        Queued = true;
                        break;
                    }
                }

                if (Queued)
                {
                    continue;
                }

                if (ValidPause.IsMatch(item))                 // Otherwise, check if it is a valid pause value.
                {
                    double d = 0.0;

                    try
                    {
                        d = System.Convert.ToDouble(item);
                        //						Console.WriteLine(
                        //							"The argument has been converted to a double: {0}", d);
                    }
                    catch (Exception ex)
                    {
                        Scripts.Commands.LogHelper.LogException(ex);
                    }

                    PlayList.Enqueue(d);                     // If so, add it to the queue as a double.
                    LastItem = item;
                    continue;
                }
                else
                {
                    Usage(pm);
                    return;
                }
            }

            if (NumOfNotes == 0)             // If the list is all pauses, do nothing.
            {
                PlayList.Clear();
                return;
            }

            // Append the new playlist to the player's existing playlist (or make a new one).
            if (pm.PlayList == null)
            {
                pm.PlayList = new Queue();
            }

            foreach (Object obj in PlayList)
            {
                pm.PlayList.Enqueue(obj);
            }

            PlayList.Clear();

            // Make sure an instrument is selected.
            BaseInstrument.PickInstrument(pm, new InstrumentPickedCallback(OnPickedInstrument));
        }
Beispiel #11
0
        public static void Play_OnCommand(CommandEventArgs e)
        {
            XmlMusic xm = (XmlMusic)XmlAttach.FindAttachment(e.Mobile, typeof(XmlMusic));

            if (xm == null)
            {
                XmlAttach.AttachTo(e.Mobile, new XmlMusic());
                xm = (XmlMusic)XmlAttach.FindAttachment(e.Mobile, typeof(XmlMusic));
            }

            Queue  PlayList = new Queue();
            Object LastItem = null;

            string[] Notes = { "cl", "csl", "d",  "ds", "e",   "f",  "fs", "g",   "gs", "a",   "as",
                               "b",  "c",   "cs", "dh", "dsh", "eh", "fh", "fsh", "gh", "gsh",
                               "ah", "ash", "bh", "ch" };
            //Regex ValidPause = new Regex(@"^((1\.0)|(0\.[0-9]))$");
            int NumOfNotes = 0;

            double pauseValue = 0.2;

            // Allows dynamic control through the CoreManagementConsole.
            if (e.Mobile.AccessLevel < AccessLevel.Counselor)
            {
                e.Mobile.SendMessage("Playing music is currently disabled.");
                return;
            }

            if (e.Arguments.Length == 0)
            {
                Usage(e.Mobile);
                return;
            }

            // If there are some leftover notes in the playlist but we're starting a new tune,
            // clear the playlist.
            if (!xm.Playing && xm.PlayList != null)
            {
                xm.PlayList.Clear();
            }

            if (e.ArgString != null && e.ArgString == "fast")
            {
                pauseValue /= 2;
            }
            else if (e.ArgString != null && e.ArgString == "slow")
            {
                pauseValue *= 2;
            }
            else if (e.ArgString != null && e.ArgString == "veryfast")
            {
                pauseValue /= 4;
            }
            else if (e.ArgString != null && e.ArgString == "veryslow")
            {
                pauseValue *= 4;
            }

            for (int i = 0; i < e.Length; ++i)
            {
                string item = e.Arguments[i].ToLower();

                if (item.ToLower() == "p")
                {
                    PlayList.Enqueue(pauseValue * 2); //insert a pause for a 'p' played
                }
                else
                {
                    for (int j = 0; j < Notes.Length; ++j)
                    {
                        if (item == Notes[j]) // If the argument is a note, add it directly to the queue.
                        {
                            // Detect repeated notes
                            if (PlayList.Count > 0 && LastItem is String)
                            {
                                PlayList.Enqueue(pauseValue);
                            }
                            PlayList.Enqueue(item);
                            LastItem = item;
                            NumOfNotes++;
                            break;
                        }
                    }
                }

                //if (Queued) continue;

                //if (ValidPause.IsMatch(item)) // Otherwise, check if it is a valid pause value.
                //{
                //    double d = 0.0;

                //    try
                //    {
                //        d = System.Convert.ToDouble(item);
                //        //						Console.WriteLine(
                //        //							"The argument has been converted to a double: {0}", d);
                //    }
                //    catch (Exception ex)
                //    {
                //        Scripts.Commands.LogHelper.LogException(ex);
                //    }

                //    PlayList.Enqueue(d); // If so, add it to the queue as a double.
                //    LastItem = item;
                //    continue;
                //}
                //else
                //{
                //    Usage(e.Mobile);
                //    return;
                //}
            }

            if (NumOfNotes == 0)             // If the list is all pauses, do nothing.
            {
                PlayList.Clear();
                return;
            }

            // Append the new playlist to the player's existing playlist (or make a new one).
            if (xm.PlayList == null)
            {
                xm.PlayList = new Queue();
            }

            foreach (Object obj in PlayList)
            {
                xm.PlayList.Enqueue(obj);
            }

            PlayList.Clear();

            // Make sure an instrument is selected.
            BaseInstrument.PickInstrument(e.Mobile, new InstrumentPickedCallback(OnPickedInstrument));
        }
 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));
 }