Example #1
0
 public PigmentsTileButtonInfo(PigmentType p)
     : base(0xEFF, PigmentsOfTokuno.GetInfo(p)[0], PigmentsOfTokuno.GetInfo(p)[1])
 {
     this.m_Pigment = p;
 }
Example #2
0
        public override void HandleButtonResponse(NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo)
        {
            PlayerMobile pm = sender.Mobile as PlayerMobile;

            if (pm == null || !pm.InRange(this.m_Collector.Location, 7) || !(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward))
                return;

            bool pigments = (buttonInfo is PigmentsTileButtonInfo);

            Item item = null;

            if (pigments)
            {
                PigmentsTileButtonInfo p = buttonInfo as PigmentsTileButtonInfo;

                item = new PigmentsOfTokuno(p.Pigment);
            }
            else
            {
                TypeTileButtonInfo t = buttonInfo as TypeTileButtonInfo;

                if (t.Type == typeof(PigmentsOfTokuno))	//Special case of course.
                {
                    pm.CloseGump(typeof(ToTTurnInGump));	//Sanity
                    pm.CloseGump(typeof(ToTRedeemGump));

                    pm.SendGump(new ToTRedeemGump(this.m_Collector, true));

                    return;
                }

                try
                {
                    item = (Item)Activator.CreateInstance(t.Type);
                }
                catch
                {
                }
            }

            if (item == null)
                return; //Sanity

            if (pm.AddToBackpack(item))
            {
                pm.ToTItemsTurnedIn -= TreasuresOfTokuno.ItemsPerReward;
                this.m_Collector.SayTo(pm, 1070984, (item.Name == null || item.Name.Length <= 0) ? String.Format("#{0}", item.LabelNumber) : item.Name); // You have earned the gratitude of the Empire. I have placed the ~1_OBJTYPE~ in your backpack.
            }
            else
            {
                item.Delete();
                this.m_Collector.SayTo(pm, 500722); // You don't have enough room in your backpack!
                this.m_Collector.SayTo(pm, 1070982); // When you wish to choose your reward, you have but to approach me again.
            }
        }