public MonsterContractGump( Mobile from, MonsterContract parentMC ) : base( 0, 0 )
		{
			from.CloseGump( typeof( MonsterContractGump ) );
			
			this.Closable=true;
			this.Disposable=true;
			this.Dragable=true;
			this.Resizable=false;

			this.AddPage(0);
			this.AddBackground(0, 0, 300, 170, 5170);
			this.AddLabel(40, 40, 0, @"A Contract for: " + parentMC.AmountToKill + " " + parentMC.Monster);
			this.AddLabel(40, 60, 0, @"Amount Killed: " + parentMC.AmountKilled);
			this.AddLabel(40, 80, 0, @"Reward: " + parentMC.Reward);
			if ( parentMC.AmountKilled != parentMC.AmountToKill )
			{
				this.AddButton(90, 110, 2061, 2062, 1, GumpButtonType.Reply, 0);
				this.AddLabel(104, 108, 0, @"Claim Corpse");
			}
			else
			{
				this.AddButton(90, 110, 2061, 2062, 2, GumpButtonType.Reply, 0);
				this.AddLabel(104, 108, 0, @"Claim Reward");
			}

			MCparent = parentMC;
		}
		public override void OnResponse( NetState state, RelayInfo info )
		{
			if ( info.ButtonID > 0 )
			{
				if( info.ButtonID >= 200 )// Add Corpse
				{
					m.SendMessage("Choose the corpse to add.");
					m.Target = new MonsterCorpseBookTarget( b,info.ButtonID % 100 );
				}
				else if ( info.ButtonID >= 100 ) // One removes the deed book.
				{
					MonsterContractEntry MCE = b.Entries[ info.ButtonID % 100 ] as MonsterContractEntry;
					MonsterContract MC = new MonsterContract( MCE.Monster, MCE.AmountKilled, MCE.AmountToKill, MCE.Reward );
					m.AddToBackpack( MC );
					b.Entries.RemoveAt( info.ButtonID % 100 );
				}
				
				m.SendGump( new MonsterContractBookGump( (PlayerMobile) m, b ) );//#01
			}
		}
Example #3
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            if (dropped is MonsterContract)
            {
                MonsterContract MC = dropped as MonsterContract;
                if (!IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062385);                       // You must have the book in your backpack to add deeds to it.
                    return(false);
                }
                else if (m_Entries.Count < 20)
                {
                    m_Entries.Add(new MonsterContractEntry(MC.Monster, MC.AmountKilled, MC.AmountToKill, MC.Reward));

                    m_Entries.Sort();                    //#01

                    InvalidateProperties();

                    from.SendLocalizedMessage(1062386);                       // Deed added to book.

                    if (from is PlayerMobile)
                    {
                        from.SendGump(new MonsterContractBookGump((PlayerMobile)from, this));
                    }

                    dropped.Delete();
                    return(true);
                }
                else
                {
                    from.SendLocalizedMessage(1062387);                       // The book is full of deeds.
                    return(false);
                }
            }

            from.SendMessage("This is not a valid contract.");
            return(false);
        }
			public MonsterCorpseTarget( MonsterContract parentMC ) : base( -1, true, TargetFlags.None )
			{
				MCparent = parentMC;
			}