Server.Items.CommodityDeed.SetCommodity C# (CSharp) Method

SetCommodity() public method

public SetCommodity ( Item item ) : bool
item Item
return bool
		public bool SetCommodity( Item item )
		{
			InvalidateProperties();

			if ( m_Commodity == null && item is ICommodity && ((ICommodity)item).IsDeedable )
			{
				m_Commodity = item;
				m_Commodity.Internalize();
				InvalidateProperties();

				return true;
			}
			else
			{
				return false;
			}
		}

Usage Example

Ejemplo n.º 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Deed.Deleted)
                {
                    return;
                }

                int number;

                if (m_Deed.Commodity != null)
                {
                    number = 1047028;                     // The commodity deed has already been filled.
                }
                else if (targeted is Item)
                {
                    Item targetedItem = (Item)targeted;
                    if (targetedItem.Association > 0)
                    {
                        from.SendLocalizedMessage(1047027);  // That is not a commodity the bankers will fill a commodity deed with.
                        return;
                    }
                    BankBox          box = from.FindBankNoCreate();
                    CommodityDeedBox cox = CommodityDeedBox.Find(m_Deed);

                    // Veteran Rewards mods
                    if (box != null && m_Deed.IsChildOf(box) && ((Item)targeted).IsChildOf(box) ||
                        cox != null && cox.IsSecure && ((Item)targeted).IsChildOf(cox))
                    {
                        if (m_Deed.SetCommodity((Item)targeted))
                        {
                            m_Deed.Hue = 0x47;
                            number     = 1047030;                         // The commodity deed has been filled.
                        }
                        else
                        {
                            number = 1047027;                             // That is not a commodity the bankers will fill a commodity deed with.
                        }
                    }
                    else
                    {
                        if (m_Deed.EraML)
                        {
                            number = 1080526;                             // That must be in your bank box or commodity deed box to use it.
                        }
                        else
                        {
                            number = 1047026;                             // That must be in your bank box to use it.
                        }
                    }
                }
                else
                {
                    number = 1047027;                     // That is not a commodity the bankers will fill a commodity deed with.
                }

                from.SendLocalizedMessage(number);
            }
All Usage Examples Of Server.Items.CommodityDeed::SetCommodity