Example #1
0
        protected override void OnTarget(Mobile from, object target)
        {
            if (target is PlayerVendor)
            {
                PlayerVendor vendor = (PlayerVendor)target;
                if (vendor.IsOwner(from))
                {
                    if (vendor.PricingModel == PricingModel.Commission)
                    {
                        from.SendMessage("This vendor is already working on commission.");
                    }
                    else
                    {
                        vendor.PricingModel = PricingModel.Commission;
                        vendor.SayTo(from, String.Format("I shall now work for a minimum wage plus a {0}% comission.", ((int)(vendor.Commission * 100)).ToString()));
                        m_Deed.Delete();
                    }
                }

                else
                {
                    vendor.SayTo(from, "I do not work for thee! Only my master may renegotiate my contract.");
                }
            }
            else
            {
                from.SendMessage("Thou canst only renegotiate the contracts of thy own servants.");
            }
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (target is PlayerVendor)
            {
                PlayerVendor vendor = (PlayerVendor)target;
                if (vendor.IsOwner(from))
                {
                    from.SendMessage("How dost thou wish to title thy servant?");
                    from.Prompt = new RenamePrompt(from, vendor, m_Deed);
                }

                else
                {
                    vendor.SayTo(from, "I do not work for thee! Only my master may change my name.");
                }
            }
            else if (target is PlayerBarkeeper)
            {
                PlayerBarkeeper barkeep = (PlayerBarkeeper)target;
                if (barkeep.IsOwner(from))
                {
                    from.SendMessage("How dost thou wish to title thy servant?");
                    from.Prompt = new RenamePrompt(from, barkeep, m_Deed);
                }
                else
                {
                    barkeep.SayTo(from, "I do not work for thee! Only my master may change my name.");
                }
            }
            else
            {
                from.SendMessage("Thou canst only change the names of thy servants.");
            }
        }
        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.
            }
        }
Example #4
0
 protected override void OnTarget(Mobile from, object target)           // Override the protected OnTarget() for our feature
 {
     if (target is PlayerVendor)
     {
         PlayerVendor vendor = (PlayerVendor)target;
         if (vendor.IsOwner(from))
         {
             vendor.Body = new Body(17);
             vendor.Name = NameList.RandomName("orc");
             m_Deed.Delete();
         }
         else
         {
             from.SendMessage("That vendor does not work for you.");
         }
     }
     else
     {
         from.SendMessage("That is not a player vendor");
     }
 }
Example #5
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.
            }
        }
        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.
            }
        }
        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.
            }
        }
Example #8
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.
            }
        }
Example #9
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.
            }
        }