SetVendorItem() private method

private SetVendorItem ( Item item, int price, string description ) : VendorItem
item Item
price int
description string
return VendorItem
Ejemplo n.º 1
0
            private void SetInfo(Mobile from, int price, string description)
            {
                Item item = m_VI.Item;

                bool setPrice = false;

                if (price < 0) // Not for sale
                {
                    price = -1;

                    if (item is Container)
                    {
                        if (item is LockableContainer && ((LockableContainer)item).Locked)
                        {
                            m_Vendor.SayTo(from, 1043298); // Locked items may not be made not-for-sale.
                        }
                        else if (item.Items.Count > 0)
                        {
                            m_Vendor.SayTo(from,
                                           1043299); // To be not for sale, all items in a container must be for sale.
                        }
                        else
                        {
                            setPrice = true;
                        }
                    }
                    else if (item is BaseBook)
                    {
                        setPrice = true;
                    }
                    else
                    {
                        m_Vendor.SayTo(from,
                                       1043301); // Only the following may be made not-for-sale: books, containers, keyrings, and items in for-sale containers.
                    }
                }
                else
                {
                    if (price > 100000000)
                    {
                        price = 100000000;
                        from.SendMessage(
                            "You cannot price items above 100,000,000 gold.  The price has been adjusted.");
                    }

                    setPrice = true;
                }

                if (setPrice)
                {
                    m_Vendor.SetVendorItem(item, price, description);
                }
                else
                {
                    m_VI.Description = description;
                }
            }