Exemple #1
0
			public override void HandleButtonResponse(NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo)
			{
				//AccessLevel check?

				var decobuttoninfo = (DecoImageTileButtonInfo)buttonInfo;
				BoundingBoxPicker.Begin(sender.Mobile, AddDeco_Callback, decobuttoninfo.DecoParameters);
			}
		public override void HandleButtonResponse( NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo )
		{
			PlayerMobile pm = sender.Mobile as PlayerMobile;

			Item item = ((ItemTileButtonInfo)buttonInfo).Item;

			if( !( pm != null && item.IsChildOf( pm.Backpack ) && pm.InRange( m_Collector.Location, 7 )) )
				return;

			item.Delete();

			if( ++pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward )
			{
				m_Collector.SayTo( pm, 1070980 ); // Congratulations! You have turned in enough minor treasures to earn a greater reward.

				pm.CloseGump( typeof( ToTTurnInGump ) );	//Sanity

				if( !pm.HasGump( typeof( ToTRedeemGump ) ) )
					pm.SendGump( new ToTRedeemGump( m_Collector, false ) );
			}
			else
			{
				m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.

				ArrayList buttons = FindRedeemableItems( pm );

				pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity

				if( buttons.Count > 0 )
					pm.SendGump( new ToTTurnInGump( m_Collector, buttons ) );
			}
		}
		public override void HandleButtonResponse( NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo )
		{
			PlayerMobile pm = sender.Mobile as PlayerMobile;

			if( pm == null || !pm.InRange( 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( 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;
				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();
				m_Collector.SayTo( pm, 500722 ); // You don't have enough room in your backpack!
				m_Collector.SayTo( pm, 1070982 ); // When you wish to choose your reward, you have but to approach me again.
			}
		}
Exemple #4
0
        public BaseItemTileButtonsGump(TextDefinition header, ItemTileButtonInfo[] buttons)
            : base(100, 100) //Coords are 0, o on OSI, intentional difference
        {
            m_Buttons = buttons;
            AddPage(0);

            int x = XItems * 180;
            int y = YItems * 64;

            AddBackground(0, 0, x + 20, y + 84, 3600);
            AddImageTiled(10, 10, x, 20, 0xA40);
            //           AddImageTiled(10, 40, x, y + 4, 0xA40);
            AddImageTiled(10, y + 54, x, 20, 0xA40);
            //AddAlphaRegion(10, 10, x, y + 64);

            AddButton(0, 0, 0xFB1, 0xFB2, 999, GumpButtonType.Reply, 0);             //zp  all Cancel Button
            AddButton(10, y + 54, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);         //Cancel Button
            AddHtmlLocalized(45, y + 56, x - 50, 20, 1060051, 0x7FFF, false, false); // CANCEL
            TextDefinition.AddHtmlText(this, 40, 12, x, 20, header, false, false, 0x7FFF, 0xFFFFFF);

            AddPage(1);

            int itemsPerPage = XItems * YItems;

            for (int i = 0; i < buttons.Length; i++)
            {
                int position = i % itemsPerPage;

                int innerX = (position % XItems) * 180 + 14;
                int innerY = (position / XItems) * 64 + 44;

                int pageNum = i / itemsPerPage + 1;

                if (position == 0 && i != 0)
                {
                    AddButton(x - 100, y + 54, 0xFA5, 0xFA7, 0, GumpButtonType.Page, pageNum);
                    AddHtmlLocalized(x - 60, y + 56, 60, 20, 1043353, 0x7FFF, false, false); // Next

                    AddPage(pageNum);

                    AddButton(x - 200, y + 54, 0xFAE, 0xFB0, 0, GumpButtonType.Page, pageNum - 1);
                    AddHtmlLocalized(x - 160, y + 56, 60, 20, 1011393, 0x7FFF, false, false); // Back
                }

                ImageTileButtonInfo b = buttons[i];

                AddImageTiledButton(innerX, innerY, 0x918, 0x919, 100 + i, GumpButtonType.Reply, 0, b.ItemID, b.Hue,
                                    15, 10, b.LocalizedTooltip);
                AddItemProperty(buttons[i].Item.Serial);
                TextDefinition.AddHtmlText(this, innerX + 84, innerY, 100, 60, b.Label, false, false, 0x7FFF, 0xFFFFFF);
            }
        }
        public BaseImageTileButtonsGump(TextDefinition header, ImageTileButtonInfo[] buttons)
            : base(10, 10)//Coords are 0, o on OSI, intentional difference
        {
            this.m_Buttons = buttons;
            this.AddPage(0);

            int x = this.XItems * 250;
            int y = this.YItems * 64;

            this.AddBackground(0, 0, x + 20, y + 84, 0x13BE);
            this.AddImageTiled(10, 10, x, 20, 0xA40);
            this.AddImageTiled(10, 40, x, y + 4, 0xA40);
            this.AddImageTiled(10, y + 54, x, 20, 0xA40);
            this.AddAlphaRegion(10, 10, x, y + 64);

            this.AddButton(10, y + 54, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0); //Cancel Button
            this.AddHtmlLocalized(45, y + 56, x - 50, 20, 1060051, 0x7FFF, false, false); // CANCEL
            TextDefinition.AddHtmlText(this, 14, 12, x, 20, header, false, false, 0x7FFF, 0xFFFFFF);

            this.AddPage(1);

            int itemsPerPage = this.XItems * this.YItems;

            for (int i = 0; i < buttons.Length; i++)
            {
                int position = i % itemsPerPage;

                int innerX = (position % this.XItems) * 250 + 14;
                int innerY = (position / this.XItems) * 64 + 44;

                int pageNum = i / itemsPerPage + 1;

                if (position == 0 && i != 0)
                {
                    this.AddButton(x - 100, y + 54, 0xFA5, 0xFA7, 0, GumpButtonType.Page, pageNum);
                    this.AddHtmlLocalized(x - 60, y + 56, 60, 20, 1043353, 0x7FFF, false, false); // Next

                    this.AddPage(pageNum);

                    this.AddButton(x - 200, y + 54, 0xFAE, 0xFB0, 0, GumpButtonType.Page, pageNum - 1);
                    this.AddHtmlLocalized(x - 160, y + 56, 60, 20, 1011393, 0x7FFF, false, false); // Back
                }

                ImageTileButtonInfo b = buttons[i];

                this.AddImageTiledButton(innerX, innerY, 0x918, 0x919, 100 + i, GumpButtonType.Reply, 0, b.ItemID, b.Hue, 15, 10, b.LocalizedTooltip);
                TextDefinition.AddHtmlText(this, innerX + 84, innerY, 250, 60, b.Label, false, false, 0x7FFF, 0xFFFFFF);
            }
        }
		public override void HandleButtonResponse( NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo )
		{
			PlayerMobile pm = sender.Mobile as PlayerMobile;

			if( pm == null || !pm.InRange( 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( 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;
				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();
				m_Collector.SayTo( pm, 500722 ); // You don't have enough room in your backpack!
				m_Collector.SayTo( pm, 1070982 ); // When you wish to choose your reward, you have but to approach me again.
			}
		}
		public override void HandleButtonResponse( NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo )
		{
			PlayerMobile pm = sender.Mobile as PlayerMobile;

			Item item = ((ItemTileButtonInfo)buttonInfo).Item;

			if( !( pm != null && item.IsChildOf( pm.Backpack ) && pm.InRange( m_Collector.Location, 7 )) )
				return;

			item.Delete();

			if( ++pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward )
			{
				m_Collector.SayTo( pm, 1070980 ); // Congratulations! You have turned in enough minor treasures to earn a greater reward.

				pm.CloseGump( typeof( ToTTurnInGump ) );	//Sanity

				if( !pm.HasGump( typeof( ToTRedeemGump ) ) )
					pm.SendGump( new ToTRedeemGump( m_Collector, false ) );
			}
			else
			{
				m_Collector.SayTo( pm, 1070981, String.Format( "{0}\t{1}", pm.ToTItemsTurnedIn, TreasuresOfTokuno.ItemsPerReward ) ); // You have turned in ~1_COUNT~ minor artifacts. Turn in ~2_NUM~ to receive a reward.

				ArrayList buttons = FindRedeemableItems( pm );

				pm.CloseGump( typeof( ToTTurnInGump ) ); //Sanity

				if( buttons.Count > 0 )
					pm.SendGump( new ToTTurnInGump( m_Collector, buttons ) );
			}
		}
 public virtual void HandleButtonResponse(NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo)
 {
 }
 public virtual void HandleButtonResponse(NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo)
 {
 }