Exemple #1
0
        public static void PlayLapHarpMinor_OnCommand(CommandEventArgs e)
        {
            LapHarp inst1 = new LapHarp();
            LapHarp inst2 = new LapHarp();
            LapHarp inst3 = new LapHarp();

            if (PlayChord(e.Mobile, e.Arguments, true, inst1, inst2, inst3))
            {
                inst1.Delete();
                inst2.Delete();
                inst3.Delete();
            }
        }
Exemple #2
0
        public static void MultiPlay_OnCommand(CommandEventArgs e)
        {
            Harp    inst1 = new Harp();
            Lute    inst2 = new Lute();
            LapHarp inst3 = new LapHarp();

            if (PlayChord(e.Mobile, e.Arguments, false, inst1, inst2, inst3))
            {
                inst1.Delete();
                inst2.Delete();
                inst3.Delete();
            }
        }
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            from.CloseGump(typeof(SynthGump));

            InstrumentType inst = InstrumentType.Harp;

            if (info.IsSwitched((int)Buttons.RB2_LapHarp))
            {
                inst = InstrumentType.LapHarp;
            }
            if (info.IsSwitched((int)Buttons.RB3_Lute))
            {
                inst = InstrumentType.Lute;
            }
            if (info.IsSwitched((int)Buttons.RB4_Drums))
            {
                inst = InstrumentType.Drums;
            }

            try { m_Name = info.TextEntries[0].Text.Trim(); }
            catch { m_Name = "Untitled"; }

            if (info.ButtonID > 100)
            {
                m_Page = info.ButtonID - 100;
                from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
            }
            else if (info.ButtonID >= (int)Buttons.Track1 && info.ButtonID <= (int)Buttons.Track8)
            {
                EditTrack(from);
                from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
            }
            else if (info.ButtonID >= (int)Buttons.PlayTrack1 && info.ButtonID <= (int)Buttons.PlayTrack8)
            {
                int track = info.ButtonID - (int)Buttons.PlayTrack1 + 1;
                m_Mixer[track] = !m_Mixer[track];
                from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
            }
            else if (info.ButtonID == (int)Buttons.PlayTracks)
            {
                Container             pack        = m_From.Backpack;
                List <BaseInstrument> instruments = new List <BaseInstrument>();
                List <XmlMusic>       mxm         = new List <XmlMusic>();
                if (pack == null || pack.Deleted || pack.Items.Count == 0)
                {
                    from.SendMessage("Your pack is missing or empty!");
                }
                else
                {
                    foreach (Item i in pack.Items)
                    {
                        if (i is BaseInstrument)
                        {
                            instruments.Add(i as BaseInstrument);
                        }
                    }
                    if (instruments.Count > 0)
                    {
                        XmlMusic findxm = null;
                        for (int x = 0; x < instruments.Count; x++)
                        {
                            if (!m_Mixer[x + 1])
                            {
                                from.SendMessage("Skipping Track {0}", (int)(x + 1));
                                continue;
                            }
                            findxm = (XmlMusic)XmlAttach.FindAttachment(instruments[x], typeof(XmlMusic));
                            if (findxm != null)
                            {
                                try
                                {
                                    mxm.Add(findxm);
                                }
                                catch { }
                            }
                            else
                            {
                                from.SendMessage("XmlMusic was null on the {0}", instruments[x].GetType().Name);
                            }
                        }
                    }
                    if (mxm.Count > 0)
                    {
                        Mix.PlayTracks(from, mxm);
                    }
                    else
                    {
                        from.SendMessage("xmx.Count was 0.");
                    }
                }
            }
            else
            {
                switch (info.ButtonID)
                {
                case (int)Buttons.Quit:
                    break;

                case (int)Buttons.ShowKeys:
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, !m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;

                case (int)Buttons.ShowMusic:
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, !m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;

                case (int)Buttons.ShowChords:
                {
                    m_Chords = !m_Chords;
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;
                }

                case (int)Buttons.ShowMixer:
                {
                    m_Mixer[0] = !m_Mixer[0];
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;
                }

                case (int)Buttons.StartRecording:
                {
                    if (m_Recording)
                    {
                        from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    }
                    else
                    {
                        m_Song = new List <string>();
                        m_Song.Add("norm");
                        from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, true, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    }
                    break;
                }

                case (int)Buttons.StopRecording:
                {
                    if (!m_Recording)
                    {
                        from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    }
                    else
                    {
                        List <string> tempSong = new List <string>(m_Song);
                        string        speed    = tempSong[0];
                        tempSong.RemoveAt(0);
                        string[] newSong = tempSong.ToArray();
                        Play.Play_OnCommand(new CommandEventArgs(from, "Play", speed, newSong));
                        from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, !m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    }
                    break;
                }

                case (int)Buttons.FileOptions: from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, !m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks)); break;

                case (int)Buttons.Play:
                {
                    List <string> tempSong = new List <string>(m_Song);
                    string        speed    = tempSong[0];
                    tempSong.RemoveAt(0);
                    string[] newSong = tempSong.ToArray();
                    Play.Play_OnCommand(new CommandEventArgs(from, "Play", speed, newSong));
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;
                }

                case (int)Buttons.Save:
                {
                    SaveSong(from, m_Name, m_Song);
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;
                }

                case (int)Buttons.Load:
                {
                    m_Song = LoadSong(from, m_Name);
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;
                }

                case (int)Buttons.Fast:
                {
                    if (m_Song.Count == 0)
                    {
                        m_Song.Add("fast");
                    }
                    else if (m_Song[0] == "fast")
                    {
                        m_Song[0] = "veryfast";
                    }
                    else if (m_Song[0] == "norm")
                    {
                        m_Song[0] = "fast";
                    }
                    else if (m_Song[0] == "slow")
                    {
                        m_Song[0] = "norm";
                    }
                    else if (m_Song[0] == "veryslow")
                    {
                        m_Song[0] = "slow";
                    }
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;
                }

                case (int)Buttons.Slow:
                {
                    if (m_Song.Count == 0)
                    {
                        m_Song.Add("slow");
                    }
                    else if (m_Song[0] == "slow")
                    {
                        m_Song[0] = "veryslow";
                    }
                    else if (m_Song[0] == "norm")
                    {
                        m_Song[0] = "slow";
                    }
                    else if (m_Song[0] == "fast")
                    {
                        m_Song[0] = "norm";
                    }
                    else if (m_Song[0] == "veryfast")
                    {
                        m_Song[0] = "fast";
                    }
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;
                }

                default:
                {
                    try
                    {
                        if (m_Song.Count == 0)
                        {
                            m_Song.Add("norm");
                        }
                        if (m_Chords && info.ButtonID < (int)Buttons.n13_c)
                        {
                            switch ((InstrumentType)inst)
                            {
                            case InstrumentType.Harp:
                            {
                                Harp inst1 = new Harp();
                                Harp inst2 = new Harp();
                                Harp inst3 = new Harp();
                                if (Play.PlayChord(from, new string[] { GetNoteString((NoteValue)(info.ButtonID - 1)) }, true, inst1, inst2, inst3))
                                {
                                    inst1.Delete();
                                    inst2.Delete();
                                    inst3.Delete();
                                }
                                break;
                            }

                            case InstrumentType.Lute:
                            {
                                Lute inst1 = new Lute();
                                Lute inst2 = new Lute();
                                Lute inst3 = new Lute();
                                if (Play.PlayChord(from, new string[] { GetNoteString((NoteValue)(info.ButtonID - 1)) }, true, inst1, inst2, inst3))
                                {
                                    inst1.Delete();
                                    inst2.Delete();
                                    inst3.Delete();
                                }
                                break;
                            }

                            case InstrumentType.LapHarp:
                            {
                                LapHarp inst1 = new LapHarp();
                                LapHarp inst2 = new LapHarp();
                                LapHarp inst3 = new LapHarp();
                                if (Play.PlayChord(from, new string[] { GetNoteString((NoteValue)(info.ButtonID - 1)) }, true, inst1, inst2, inst3))
                                {
                                    inst1.Delete();
                                    inst2.Delete();
                                    inst3.Delete();
                                }
                                break;
                            }

                            case InstrumentType.Drums: break;
                            }
                        }
                        else
                        {
                            NoteValue nv = (NoteValue)(info.ButtonID - 1);

                            Music.PlayNote(from, (int)nv, inst);
                            if (m_Recording)
                            {
                                m_Song.Add(GetNoteString(nv));
                                //from.SendMessage("Note added to song: #: {0}, string: {1}", nv, GetNoteString(nv));
                            }
                        }
                    }
                    catch { }
                    from.SendGump(new SynthGump(m_From, m_Page, (int)inst, m_Music, m_Keys, m_Recording, m_FileOptions, m_Chords, m_Mixer, m_Song, m_Name, m_MusicTracks));
                    break;
                }
                }
            }
        }