Esempio n. 1
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

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

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

                break;
            }

            case 2:
            {
                from.SendGump(new PlayerVendorCustomizeGump(m_Vendor, from));

                break;
            }
            }
        }
Esempio n. 2
0
            public override void OnResponse(int hue)
            {
                if (!m_Vendor.CanInteractWith(m_From, true))
                {
                    return;
                }

                Item hair;

                if (m_Beard)
                {
                    hair = m_Vendor.FindItemOnLayer(Layer.FacialHair);
                }
                else
                {
                    hair = m_Vendor.FindItemOnLayer(Layer.Hair);
                }

                if (hair != null)
                {
                    hair.Hue = hue;
                }

                m_From.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));
            }
Esempio n. 3
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

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

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                 // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                m_Vendor.Say(from.Name);

                if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack))
                {
                    m_Vendor.SayTo(from, 503216);                     // You can't buy that.
                }
                else if (!Banker.WithdrawPackAndBank(from, m_Vendor.TypeOfCurrency, m_VI.Price))
                {
                    m_Vendor.SayTo(from, 503205);                     // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                     // You do not have room in your backpack for this.

                    BankBox box = from.FindBank(m_Vendor.Expansion) ?? from.BankBox;

                    box.Credit += (ulong)m_VI.Price;
                    m_Vendor.SayTo(from, "I credited your bank account.  Please come back when you have room for this item.");
                }
                else
                {
                    from.SendLocalizedMessage(503201);                     // You take the item.
                    m_Vendor.HoldCurrency += m_VI.Price;
                    m_Vendor.LastActivity  = DateTime.UtcNow;
                    m_Vendor.NameMod       = null;
                    m_Vendor.NameHue       = -1;
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                 // Cancelled purchase.
            }
        }
Esempio n. 4
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 Currency
                m_Vendor.CollectCurrency(from);
                break;

            case 7:                     // Dismiss Vendor
                m_Vendor.Dismiss(from);
                break;
            }
        }
Esempio n. 5
0
            public override void OnResponse(int hue)
            {
                if (!m_Vendor.CanInteractWith(m_From, true))
                {
                    return;
                }

                if (m_FacialHair)
                {
                    m_Vendor.FacialHairHue = hue;
                }
                else
                {
                    m_Vendor.HairHue = hue;
                }

                m_From.SendGump(new NewPlayerVendorCustomizeGump(m_Vendor));
            }
Esempio n. 6
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

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

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack))
                {
                    m_Vendor.SayTo(from, 503216);                       // You can't buy that.
                    return;
                }

                int totalGold = 0;

                if (from.Backpack != null)
                {
                    totalGold += from.Backpack.GetAmount(typeof(Gold));
                }

                totalGold += Banker.GetBalance(from);

                if (totalGold < m_VI.Price)
                {
                    m_Vendor.SayTo(from, 503205);                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = m_VI.Price;

                    if (from.Backpack != null)
                    {
                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0)
                    {
                        Banker.Withdraw(from, leftPrice);
                    }

                    m_Vendor.HoldGold += m_VI.Price;

                    from.SendLocalizedMessage(503201);                       // You take the item.
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                   // Cancelled purchase.
            }
        }
Esempio n. 7
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            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
            {
                m_Vendor.Dismiss(from);

                break;
            }
            }
        }
Esempio n. 8
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:     // Deposit Gold
            {
                m_Vendor.DepositeGold(from);

                break;
            }

            case 8:     // Dismiss Vendor
            {
                m_Vendor.Dismiss(from);

                break;
            }

            case 9:     // Opt Out of Search
            {
                if (m_Vendor.VendorSearch)
                {
                    m_Vendor.VendorSearch = false;
                }
                else
                {
                    m_Vendor.VendorSearch = true;
                }

                break;
            }
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

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

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, "Voce e o dono deste Shop, pegue o que quiser");                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                m_Vendor.Say(from.Name);

                if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack))
                {
                    m_Vendor.SayTo(from, "Voce nao pode comprar isto");                       // You can't buy that.
                    return;
                }

                int totalGold = 0;

                if (from.Backpack != null)
                {
                    totalGold += from.Backpack.GetAmount(typeof(Gold));
                }

                totalGold += Banker.GetBalance(from);

                if (totalGold < m_VI.Price)
                {
                    m_Vendor.SayTo(from, "Voce nao tem dinheiro!");                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, "Voce nao tem espaco na sua backpack");                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = m_VI.Price;

                    if (from.Backpack != null)
                    {
                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0)
                    {
                        Banker.Withdraw(from, leftPrice);
                    }

                    m_Vendor.HoldGold += m_VI.Price;

                    from.SendMessage("Voce comprou o item");                       // You take the item.
                }
            }
            else
            {
                from.SendMessage("Voce cancelou a compra"); // Cancelled purchase.
            }
        }
Esempio n. 10
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

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

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                if (!m_VI.Valid)
                {
                    m_Vendor.SayTo(from, 503216);                       // You can't buy that.
                    return;
                }

                int totalGold = 0;

                if (from.Backpack != null)
                {
                    totalGold += from.Backpack.GetAmount(typeof(Gold));
                }

                if (from.BankBox != null)
                {
                    totalGold += from.BankBox.GetAmount(typeof(Gold));
                }

                if (totalGold < m_VI.Price)
                {
                    m_Vendor.SayTo(from, 503205);                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = m_VI.Price;

                    if (from.Backpack != null)
                    {
                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0 && from.BankBox != null)
                    {
                        from.BankBox.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (m_Vendor is CityPlayerVendor)
                    {
                        CityPlayerVendor vend = (CityPlayerVendor)m_Vendor;
                        double           rate = Convert.ToDouble(vend.TaxRate) / 100.0;
                        double           tax  = Convert.ToDouble(m_VI.Price) * rate;
                        int taxx = Convert.ToInt32(tax);
                        vend.IncomeTax += taxx;
                        vend.HoldGold  += (m_VI.Price - taxx);
                    }

                    else
                    {
                        m_Vendor.HoldGold += m_VI.Price;
                    }

                    from.SendLocalizedMessage(503201);                       // You take the item.
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                   // Cancelled purchase.
            }
        }
Esempio n. 11
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

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

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                if (!m_VI.Valid)
                {
                    m_Vendor.SayTo(from, 503216);                       // You can't buy that.
                    return;
                }

                int totalGold = 0;

                if (from.Backpack != null)
                {
                    totalGold += from.Backpack.GetAmount(typeof(Gold));
                }

                if (from.BankBox != null)
                {
                    totalGold += from.BankBox.GetAmount(typeof(Gold));
                }

                if (totalGold < m_VI.Price)
                {
                    m_Vendor.SayTo(from, 503205);                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = m_VI.Price;

                    if (from.Backpack != null)
                    {
                        Container cont = from.Backpack;

                        int    silvtotal = 0;
                        Item[] silvers   = cont.FindItemsByType(typeof(Silver), true);
                        foreach (Silver silver in silvers)
                        {
                            silvtotal += silver.Amount;
                            silver.Delete();
                        }

                        Gold money = new Gold();
                        cont.AddItem(money);
                        money.Amount = silvtotal / 10;
                        if (silvtotal - money.Amount > 0)
                        {
                            Silver change = new Silver();
                            cont.AddItem(change);
                            change.Amount = silvtotal - (money.Amount * 10);
                        }

                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0 && from.BankBox != null)
                    {
                        from.BankBox.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    m_Vendor.HoldGold += m_VI.Price;

                    from.SendLocalizedMessage(503201);                       // You take the item.
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                   // Cancelled purchase.
            }
        }
Esempio n. 12
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

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

            if (m_Vendor.IsOwner(from))
            {
                m_Vendor.SayTo(from, 503212);                   // You own this shop, just take what you want.
                return;
            }

            if (info.ButtonID == 1)
            {
                m_Vendor.Say(from.Name);

                if (!m_VI.Valid || !m_VI.Item.IsChildOf(m_Vendor.Backpack))
                {
                    m_Vendor.SayTo(from, 503216);                       // You can't buy that.
                    return;
                }

                int totalGold = 0;
                int price     = m_VI.GetPrice(from, m_Vendor);

                Item[] items = from.Backpack.FindItemsByType(typeof(Gold), true);

                for (int i = 0; i < items.Length; ++i)
                {
                    Item item = items[i];
                    if (item.LootType != LootType.Newbied && item.Movable)
                    {
                        totalGold += items[i].Amount;
                    }
                }

                //if ( from.Backpack != null )
                //	totalGold += from.Backspack.GetAmount( typeof( Gold ) );

                totalGold += Banker.GetBalance(from);

                if (totalGold < price)
                {
                    m_Vendor.SayTo(from, 503205);                       // You cannot afford this item.
                }
                else if (!from.PlaceInBackpack(m_VI.Item))
                {
                    m_Vendor.SayTo(from, 503204);                       // You do not have room in your backpack for this.
                }
                else
                {
                    int leftPrice = price;

                    if (from.Backpack != null)
                    {
                        leftPrice -= from.Backpack.ConsumeUpTo(typeof(Gold), leftPrice);
                    }

                    if (leftPrice > 0)
                    {
                        Banker.Withdraw(from, leftPrice);
                    }

                    m_Vendor.HoldGold += price;
                    from.SendLocalizedMessage(503201);                       // You take the item.
                }
            }
            else
            {
                from.SendLocalizedMessage(503207);                   // Cancelled purchase.
            }
        }