示例#1
0
        public override void AddNameProperty(ObjectPropertyList list)
        {
            DawnsMusicInfo info = DawnsMusicBox.GetInfo(m_Music);

            if (info != null)
            {
                if (info.Rarity == DawnsMusicRarity.Common)
                {
                    list.Add(1075204); // Gear for Dawn's Music Box (Common)
                }
                else if (info.Rarity == DawnsMusicRarity.Uncommon)
                {
                    list.Add(1075205); // Gear for Dawn's Music Box (Uncommon)
                }
                else if (info.Rarity == DawnsMusicRarity.Rare)
                {
                    list.Add(1075206); // Gear for Dawn's Music Box (Rare)
                }
                list.Add(info.Name);
            }
            else
            {
                base.AddNameProperty(list);
            }
        }
示例#2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Gear == null || m_Gear.Deleted)
                {
                    return;
                }

                DawnsMusicBox box = targeted as DawnsMusicBox;

                if (box != null)
                {
                    if (!box.Tracks.Contains(m_Gear.Music))
                    {
                        box.Tracks.Add(m_Gear.Music);
                        box.InvalidateProperties();

                        m_Gear.Delete();

                        from.SendLocalizedMessage(1071961); // This song has been added to the musicbox.
                    }
                    else
                    {
                        from.SendLocalizedMessage(1071962); // This song track is already in the musicbox.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1071964); // Gears can only be put into a musicbox.
                }
            }
示例#3
0
		public DawnsMusicBoxGump(DawnsMusicBox box)
			: base(60, 36)
		{
			m_Box = box;

			AddPage(0);

			AddBackground(0, 0, 273, 324, 0x13BE);
			AddImageTiled(10, 10, 253, 20, 0xA40);
			AddImageTiled(10, 40, 253, 244, 0xA40);
			AddImageTiled(10, 294, 253, 20, 0xA40);
			AddAlphaRegion(10, 10, 253, 304);
			AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
			AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
			AddHtmlLocalized(14, 12, 273, 20, 1075130, 0x7FFF, false, false); // Choose a track to play

			int page = 1;
			int i, y = 49;

			AddPage(page);

			for (i = 0; i < m_Box.Tracks.Count; i++, y += 24)
			{
				DawnsMusicInfo info = DawnsMusicBox.GetInfo(m_Box.Tracks[i]);

				if (i > 0 && i % 10 == 0)
				{
					AddButton(228, 294, 0xFA5, 0xFA6, 0, GumpButtonType.Page, page + 1);

					AddPage(page + 1);
					y = 49;

					AddButton(193, 294, 0xFAE, 0xFAF, 0, GumpButtonType.Page, page);

					page++;
				}

				if (info == null)
				{
					continue;
				}

				AddButton(19, y, 0x845, 0x846, 100 + i, GumpButtonType.Reply, 0);
				AddHtmlLocalized(44, y - 2, 213, 20, info.Name, 0x7FFF, false, false);
			}

			if (i % 10 == 0)
			{
				AddButton(228, 294, 0xFA5, 0xFA6, 0, GumpButtonType.Page, page + 1);

				AddPage(page + 1);
				y = 49;

				AddButton(193, 294, 0xFAE, 0xFAF, 0, GumpButtonType.Page, page);
			}

			AddButton(19, y, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
			AddHtmlLocalized(44, y - 2, 213, 20, 1075207, 0x7FFF, false, false); // Stop Song
		}
示例#4
0
        public override void OnAfterDuped(Item newItem)
        {
            DawnsMusicBox box = newItem as DawnsMusicBox;

            if (box == null)
            {
                return;
            }

            box.m_Tracks = new List <MusicName>();
            box.m_Tracks.AddRange(m_Tracks);
        }
示例#5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadEncodedInt();

            switch (version)
            {
            case 1:
            {
                this.m_Music = (MusicName)reader.ReadInt();
                break;
            }
            }

            if (version == 0) // Music wasn't serialized in version 0, pick a new track of random rarity
            {
                DawnsMusicRarity rarity;
                double           rand = Utility.RandomDouble();

                if (rand < 0.025)
                {
                    rarity = DawnsMusicRarity.Rare;
                }
                else if (rand < 0.225)
                {
                    rarity = DawnsMusicRarity.Uncommon;
                }
                else
                {
                    rarity = DawnsMusicRarity.Common;
                }

                this.m_Music = DawnsMusicBox.RandomTrack(rarity);
            }
        }
示例#6
0
 public DawnsMusicGear()
     : this(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Common))
 {
 }