示例#1
0
        protected override void OnTick()
        {
            if (DateTime.Now >= m_Expire)
            {
                if (m_vendor == null || !CheckVendorExist(m_vendor))
                {
                    Stop();
                }

                else
                {
                    Container pack = m_vendor.Backpack;
                    if (pack != null && pack.Items.Count > 0)
                    {
                        BankBox     box  = m_owner.BankBox;
                        List <Item> list = new List <Item>();
                        list = pack.Items;
                        int number = pack.Items.Count;
                        for (int i = 0; i < number; i++)
                        {
                            /*if ( (Item)list[i] is Container )
                             * {
                             *
                             * }*/

                            if (box.TryDropItem(m_owner, (Item)list[i], false))
                            {
                                continue;
                            }
                            else
                            {
                                //list.Remove( list[i] );
                                continue;
                            }
                        }
                        m_vendor.Dismiss(m_owner);
                        Stop();
                    }
                    else
                    {
                        m_vendor.Dismiss(m_owner);
                        Stop();
                    }
                }
            }
        }
示例#2
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            if (info.ButtonID == 1 || info.ButtonID == 2)               // See goods or Customize
            {
                m_Vendor.CheckTeleport(from);
            }

            if (!m_Vendor.CanInteractWith(from, true))
            {
                return;
            }

            switch (info.ButtonID)
            {
            case 1:                     // See goods
            {
                m_Vendor.OpenBackpack(from);

                break;
            }

            case 2:                     // Customize
            {
                from.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));

                break;
            }

            case 3:                     // Rename Shop
            {
                m_Vendor.RenameShop(from);

                break;
            }

            case 4:                     // Rename Vendor
            {
                m_Vendor.Rename(from);

                break;
            }

            case 5:                     // Open Paperdoll
            {
                m_Vendor.DisplayPaperdollTo(from);

                break;
            }

            case 6:                     // Collect Gold
            {
                m_Vendor.CollectGold(from);

                break;
            }

            case 7:                     // Dismiss Vendor
            {
                if (m_Vendor is CityPlayerVendor)
                {
                    CityPlayerVendor vend = (CityPlayerVendor)m_Vendor;
                    vend.Dismiss(from);
                }
                else
                {
                    m_Vendor.Dismiss(from);
                }

                break;
            }
            }
        }