TheGodfather

So this seems trivial, but I just can't find where to edit it so if you buy too much and it makes you overweight instead of dropping at your feet it goes to your bank. Any help is much appreciated!
 
Code:
        private void ProcessValidPurchase(int amount, IBuyItemInfo bii, Mobile buyer, Container cont)
        {
            if (amount > bii.Amount)
            {
                amount = bii.Amount;
            }

            if (amount < 1)
            {
                return;
            }

            bii.Amount -= amount;

            IEntity o = bii.GetEntity();

            if (o is Item)
            {
                Item item = (Item)o;

                if (item.Stackable)
                {
                    item.Amount = amount;

                    if (cont == null || !cont.TryDropItem(buyer, item, false))
                    {
                        item.MoveToWorld(buyer.Location, buyer.Map);
                    }
                }
                else
                {
                    item.Amount = 1;

                    if (cont == null || !cont.TryDropItem(buyer, item, false))
                    {
                        item.MoveToWorld(buyer.Location, buyer.Map);
                    }

                    for (int i = 1; i < amount; i++)
                    {
                        item = bii.GetEntity() as Item;

                        if (item != null)
                        {
                            item.Amount = 1;

                            if (cont == null || !cont.TryDropItem(buyer, item, false))
                            {
                                item.MoveToWorld(buyer.Location, buyer.Map);
                            }
                        }
                    }
                }
            }

I can only assume that it could be there in the BaseVendor.cs script. I will try and search some more.
[doublepost=1475460236][/doublepost]There is another one below this section around line 1456 of BaseVendor.cs Script. It may affect it aswell, but im not entirely sure.
Code:
                        foreach (IShopSellInfo ssi in info)
                        {
                            if (ssi.IsSellable(item))
                            {
                                if (ssi.IsResellable(item))
                                {
                                    Item buyItem;

                                    if (amount >= item.Amount)
                                    {
                                        buyItem = item;
                                    }
                                    else
                                    {
                                        buyItem = LiftItemDupe(item, item.Amount - amount);

                                        if (buyItem == null)
                                        {
                                            buyItem = item;
                                        }
                                    }

                                    if (cont == null || !cont.TryDropItem(buyer, buyItem, false))
                                    {
                                        buyItem.MoveToWorld(buyer.Location, buyer.Map);
                                    }

                                    break;
                                }
                            }
                        }
 
Last edited:
Tried to fix this for ya but it isn't working... this is where I got:

Code:
        private void ProcessValidPurchase(int amount, IBuyItemInfo bii, Mobile buyer, Container cont)
        {
            if (amount > bii.Amount)
            {
                amount = bii.Amount;
            }

            if (amount < 1)
            {
                return;
            }

            bii.Amount -= amount;

            IEntity o = bii.GetEntity();

            if (o is Item)
            {
                Item item = (Item)o;

                if (item.Stackable)
                {
                    item.Amount = amount;

                    if (cont == null || !cont.TryDropItem(buyer, item, false))
                    {
                        //item.MoveToWorld(buyer.Location, buyer.Map);
                        //change container to Bank
                        cont = buyer.BankBox;
                        if(!cont.TryDropItem(buyer, item, false)) {
                            SayTo(buyer, true, "Warning! {0} gold was dropped at your feet. This should not happen!", amount);
                            item.MoveToWorld(buyer.Location, buyer.Map);
                        } else {
                            SayTo(buyer, true, "{0} gold was deposited within your bank because you did not have enough space in your pack.", amount);
                        }
                    }
                }
                else
                {
                    item.Amount = 1;

                    if (cont == null || !cont.TryDropItem(buyer, item, false))
                    {
                        //item.MoveToWorld(buyer.Location, buyer.Map);
                        //change container to Bank
                        cont = buyer.BankBox;
                        if(!cont.TryDropItem(buyer, item, false)) {
                            SayTo(buyer, true, "Warning! {0} gold was dropped at your feet. This should not happen!", amount);
                            item.MoveToWorld(buyer.Location, buyer.Map);
                        } else {
                            SayTo(buyer, true, "{0} gold was deposited within your bank because you did not have enough space in your pack.", amount);
                        }
                    }

                    for (int i = 1; i < amount; i++)
                    {
                        item = bii.GetEntity() as Item;

                        if (item != null)
                        {
                            item.Amount = 1;

                            if (cont == null || !cont.TryDropItem(buyer, item, false))
                            {
                                //item.MoveToWorld(buyer.Location, buyer.Map);
                                //change container to Bank
                        cont = buyer.BankBox;
                        if(!cont.TryDropItem(buyer, item, false)) {
                            SayTo(buyer, true, "Warning! {0} gold was dropped at your feet. This should not happen!", amount);
                            item.MoveToWorld(buyer.Location, buyer.Map);
                        } else {
                            SayTo(buyer, true, "{0} gold was deposited within your bank because you did not have enough space in your pack.", amount);
                        }
                            }
                        }
                    }
                }

This should really be default action for OSI.
 
sorry
replace cont = buyer.BankBox;
with that
Code:
if (cont == null || !cont.TryDropItem(buyer, item, false))
                    {
                        //item.MoveToWorld(buyer.Location, buyer.Map);
                        //change container to Bank
                        buyer.BankBox.DropItem(item);
                        if(!cont.TryDropItem(buyer, item, false)) {
                            SayTo(buyer, true, "Warning! {0} gold was dropped at your feet. This should not happen!", amount);
                            item.MoveToWorld(buyer.Location, buyer.Map);
                        } else {
                            SayTo(buyer, true, "{0} gold was deposited within your bank because you did not have enough space in your pack.", amount);
                        }
                    }


Did the change. Still dropping to ground.
 
wait this is talking about dropping gold to the ground
if im buying something why would they be giving me gold?
i think this is for selling
 
wait this is talking about dropping gold to the ground
if im buying something why would they be giving me gold?
i think this is for selling

The idea is to make it so if you sell something and are overloaded the gold goes to bank.
If you buy something and are overloaded the items go to the bank (bulk regs etc)
 
ok, was dealing with RL stuff and distracted
i think we need to check for buyer weight + item weight
let me test
 
sorry for the delay

these seem to be working

using
WeightOverloading.IsOverloaded(buyer) // buying items
&
WeightOverloading.IsOverloaded(seller) //selling items

just keep in mind that gold added to bank will be added to bank balance unless to turn off "itemless" gold


three methods below that i had to edit


Code:
private void ProcessValidPurchase(int amount, IBuyItemInfo bii, Mobile buyer, Container cont)
        {
            if (amount > bii.Amount)
            {
                amount = bii.Amount;
            }

            if (amount < 1)
            {
                return;
            }

            bii.Amount -= amount;

            IEntity o = bii.GetEntity();

            if (o is Item)
            {
                Item item = (Item)o;

                if (item.Stackable)
                {
                    item.Amount = amount;
                   
                    if( WeightOverloading.IsOverloaded(buyer) )
                    {
                        buyer.BankBox.DropItem( item );
                    }

                    // if (cont == null || !cont.TryDropItem(buyer, item, false))
                    // {
                        // item.MoveToWorld(buyer.Location, buyer.Map);
                    // }
                }
                else
                {
                    item.Amount = 1;

                    if(  WeightOverloading.IsOverloaded(buyer) )
                    {
                        buyer.BankBox.DropItem(item);
                    }
                   
                    // if (cont == null || !cont.TryDropItem(buyer, item, false))
                    // {
                        // item.MoveToWorld(buyer.Location, buyer.Map);
                    // }

                    for (int i = 1; i < amount; i++)
                    {
                        item = bii.GetEntity() as Item;

                        if (item != null)
                        {
                            item.Amount = 1;
                           
                            if(  WeightOverloading.IsOverloaded(buyer) )
                            {
                                buyer.BankBox.DropItem(item);
                            }

                            // if (cont == null || !cont.TryDropItem(buyer, item, false))
                            // {
                                // item.MoveToWorld(buyer.Location, buyer.Map);
                            // }
                        }
                    }
                }
            }
            else if (o is Mobile)
            {
                Mobile m = (Mobile)o;

                m.Direction = (Direction)Utility.Random(8);
                m.MoveToWorld(buyer.Location, buyer.Map);
                m.PlaySound(m.GetIdleSound());

                if (m is BaseCreature)
                {
                    ((BaseCreature)m).SetControlMaster(buyer);
                }

                for (int i = 1; i < amount; ++i)
                {
                    m = bii.GetEntity() as Mobile;

                    if (m != null)
                    {
                        m.Direction = (Direction)Utility.Random(8);
                        m.MoveToWorld(buyer.Location, buyer.Map);

                        if (m is BaseCreature)
                        {
                            ((BaseCreature)m).SetControlMaster(buyer);
                        }
                    }
                }
            }
        }
Code:
        public virtual bool OnBuyItems(Mobile buyer, List<BuyItemResponse> list)
        {
            if (!IsActiveSeller)
            {
                return false;
            }

            if (!buyer.CheckAlive())
            {
                return false;
            }

            if (!CheckVendorAccess(buyer))
            {
                Say(501522); // I shall not treat with scum like thee!
                return false;
            }

            UpdateBuyInfo();

            var buyInfo = GetBuyInfo();
            var info = GetSellInfo();
            int totalCost = 0;
            var validBuy = new List<BuyItemResponse>(list.Count);
            Container cont;
            bool bought = false;
            bool fromBank = false;
            bool fullPurchase = true;
            int controlSlots = buyer.FollowersMax - buyer.Followers;

            foreach (BuyItemResponse buy in list)
            {
                Serial ser = buy.Serial;
                int amount = buy.Amount;

                if (ser.IsItem)
                {
                    Item item = World.FindItem(ser);

                    if (item == null)
                    {
                        continue;
                    }

                    GenericBuyInfo gbi = LookupDisplayObject(item);
                   

                    if (gbi != null)
                    {
                        ProcessSinglePurchase(buy, gbi, validBuy, ref controlSlots, ref fullPurchase, ref totalCost);
                    }
                    else if (item != BuyPack && item.IsChildOf(BuyPack))
                    {
                        if (amount > item.Amount)
                        {
                            amount = item.Amount;
                        }

                        if (amount <= 0)
                        {
                            continue;
                        }

                        foreach (IShopSellInfo ssi in info)
                        {
                            if (ssi.IsSellable(item))
                            {
                                if (ssi.IsResellable(item))
                                {
                                    totalCost += ssi.GetBuyPriceFor(item) * amount;
                                    validBuy.Add(buy);
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (ser.IsMobile)
                {
                    Mobile mob = World.FindMobile(ser);

                    if (mob == null)
                    {
                        continue;
                    }

                    GenericBuyInfo gbi = LookupDisplayObject(mob);

                    if (gbi != null)
                    {
                        ProcessSinglePurchase(buy, gbi, validBuy, ref controlSlots, ref fullPurchase, ref totalCost);
                    }
                }
            } //foreach

            if (fullPurchase && validBuy.Count == 0)
            {
                SayTo(buyer, 500190); // Thou hast bought nothing!
            }
            else if (validBuy.Count == 0)
            {
                SayTo(buyer, 500187); // Your order cannot be fulfilled, please try again.
            }

            if (validBuy.Count == 0)
            {
                return false;
            }

            bought = buyer.AccessLevel >= AccessLevel.GameMaster;

            cont = buyer.Backpack;
           
            if (!bought && cont != null)
            {
                if (cont.ConsumeTotal(typeof(Gold), totalCost))
                {
                    bought = true;
                }
            }

            if (!bought &&
                (totalCost >= 2000 ||
                AccountGold.Enabled)
            )
            {
                if (Banker.Withdraw(buyer, totalCost))
                {
                    bought = true;
                    fromBank = true;
                }
                else
                {
                    cont = buyer.FindBankNoCreate();

                    if (cont != null && cont.ConsumeTotal(typeof(Gold), totalCost))
                    {
                        bought = true;
                        fromBank = true;
                    }
                }
            }

            if (!bought)
            {
                // ? Begging thy pardon, but thy bank account lacks these funds.
                // : Begging thy pardon, but thou casnt afford that.
                SayTo(buyer, totalCost >= 2000 ? 500191 : 500192);

                return false;
            }

            buyer.PlaySound(0x32);
           
            cont = buyer.Backpack ?? buyer.BankBox;

            foreach (BuyItemResponse buy in validBuy)
            {
                Serial ser = buy.Serial;
                int amount = buy.Amount;

                if (amount < 1)
                {
                    continue;
                }

                if (ser.IsItem)
                {
                    Item item = World.FindItem(ser);

                    if (item == null)
                    {
                        continue;
                    }

                    GenericBuyInfo gbi = LookupDisplayObject(item);

                    if (gbi != null)
                    {
                        ProcessValidPurchase(amount, gbi, buyer, cont);
                    }
                    else
                    {
                        if (amount > item.Amount)
                        {
                            amount = item.Amount;
                        }

                        foreach (IShopSellInfo ssi in info)
                        {
                            if (ssi.IsSellable(item))
                            {
                                if (ssi.IsResellable(item))
                                {
                                    Item buyItem;

                                    if (amount >= item.Amount)
                                    {
                                        buyItem = item;
                                    }
                                    else
                                    {
                                        buyItem = LiftItemDupe(item, item.Amount - amount);

                                        if (buyItem == null)
                                        {
                                            buyItem = item;
                                        }

                                        }
                                       
                                        if(  WeightOverloading.IsOverloaded(buyer) )
                                        {
                                            buyer.BankBox.DropItem( buyItem );
                                        }

                                    // if (cont == null || !cont.TryDropItem(buyer, buyItem, false))
                                    // {
                                        // buyItem.MoveToWorld(buyer.Location, buyer.Map);
                                    // }

                                    break;
                                }
                            }
                        }
                    }
                }
                else if (ser.IsMobile)
                {
                    Mobile mob = World.FindMobile(ser);

                    if (mob == null)
                    {
                        continue;
                    }

                    GenericBuyInfo gbi = LookupDisplayObject(mob);

                    if (gbi != null)
                    {
                        ProcessValidPurchase(amount, gbi, buyer, cont);
                    }
                }
            } //foreach

            if (fullPurchase)
            {
                if (buyer.AccessLevel >= AccessLevel.GameMaster)
                {
                    SayTo(buyer, true, "I would not presume to charge thee anything.  Here are the goods you requested.");
                }
                else if (fromBank)
                {
                    SayTo(
                        buyer,
                        true,
                        "The total of thy purchase is {0} gold, which has been withdrawn from your bank account.  My thanks for the patronage.",
                        totalCost);
                }
                else
                {
                    SayTo(buyer, true, "The total of thy purchase is {0} gold.  My thanks for the patronage.", totalCost);
                }
            }
            else
            {
                if (buyer.AccessLevel >= AccessLevel.GameMaster)
                {
                    SayTo(
                        buyer,
                        true,
                        "I would not presume to charge thee anything.  Unfortunately, I could not sell you all the goods you requested.");
                }
                else if (fromBank)
                {
                    SayTo(
                        buyer,
                        true,
                        "The total of thy purchase is {0} gold, which has been withdrawn from your bank account.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.",
                        totalCost);
                }
                else
                {
                    SayTo(
                        buyer,
                        true,
                        "The total of thy purchase is {0} gold.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.",
                        totalCost);
                }
            }

            return true;
        }

Code:
public virtual bool OnSellItems(Mobile seller, List<SellItemResponse> list)
        {
            if (!IsActiveBuyer)
            {
                return false;
            }

            if (!seller.CheckAlive())
            {
                return false;
            }

            if (!CheckVendorAccess(seller))
            {
                Say(501522); // I shall not treat with scum like thee!
                return false;
            }

            seller.PlaySound(0x32);

            var info = GetSellInfo();
            var buyInfo = GetBuyInfo();
            int GiveGold = 0;
            int Sold = 0;
            Container cont;

            foreach (SellItemResponse resp in list)
            {
                if (resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable ||
                    (resp.Item is Container && (resp.Item).Items.Count != 0))
                {
                    continue;
                }

                foreach (IShopSellInfo ssi in info)
                {
                    if (ssi.IsSellable(resp.Item))
                    {
                        Sold++;
                        break;
                    }
                }
            }

            if (Sold > MaxSell)
            {
                SayTo(seller, true, "You may only sell {0} items at a time!", MaxSell);
                return false;
            }
            else if (Sold == 0)
            {
                return true;
            }

            foreach (SellItemResponse resp in list)
            {
                if (resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable ||
                    (resp.Item is Container && (resp.Item).Items.Count != 0))
                {
                    continue;
                }

                foreach (IShopSellInfo ssi in info)
                {
                    if (ssi.IsSellable(resp.Item))
                    {
                        int amount = resp.Amount;

                        if (amount > resp.Item.Amount)
                        {
                            amount = resp.Item.Amount;
                        }

                        if (ssi.IsResellable(resp.Item))
                        {
                            bool found = false;

                            foreach (IBuyItemInfo bii in buyInfo)
                            {
                                if (bii.Restock(resp.Item, amount))
                                {
                                    resp.Item.Consume(amount);
                                    found = true;

                                    break;
                                }
                            }

                            if (!found)
                            {
                                cont = BuyPack;

                                if (amount < resp.Item.Amount)
                                {
                                    Item item = LiftItemDupe(resp.Item, resp.Item.Amount - amount);

                                    if (item != null)
                                    {
                                        item.SetLastMoved();
                                        cont.DropItem(item);
                                    }
                                    else
                                    {
                                        resp.Item.SetLastMoved();
                                        cont.DropItem(resp.Item);
                                    }
                                }
                                else
                                {
                                    resp.Item.SetLastMoved();
                                    cont.DropItem(resp.Item);
                                }
                            }
                        }
                        else
                        {
                            if (amount < resp.Item.Amount)
                            {
                                resp.Item.Amount -= amount;
                            }
                            else
                            {
                                resp.Item.Delete();
                            }
                        }

                        GiveGold += ssi.GetSellPriceFor(resp.Item) * amount;
                        break;
                    }
                }
            }

            if (GiveGold > 0)
            {
                while (GiveGold > 60000)
                {
                    if(  WeightOverloading.IsOverloaded(seller) )
                    {
                        seller.BankBox.DropItem(new Gold(60000));
                    }
                    seller.AddToBackpack(new Gold(60000));
                    GiveGold -= 60000;
                }
               
                //seller.AddToBackpack(new Gold(GiveGold));
               
                if(  WeightOverloading.IsOverloaded(seller) )
                {
                    seller.BankBox.DropItem(new Gold(GiveGold));
                }
                else
                {
                    seller.AddToBackpack(new Gold(GiveGold));
                }

                seller.PlaySound(0x0037); //Gold dropping sound

                if (SupportsBulkOrders(seller))
                {
                    Item bulkOrder = CreateBulkOrder(seller, false);

                    if (bulkOrder is LargeBOD)
                    {
                        seller.SendGump(new LargeBODAcceptGump(seller, (LargeBOD)bulkOrder));
                    }
                    else if (bulkOrder is SmallBOD)
                    {
                        seller.SendGump(new SmallBODAcceptGump(seller, (SmallBOD)bulkOrder));
                    }
                }
            }
            //no cliloc for this?
            //SayTo( seller, true, "Thank you! I bought {0} item{1}. Here is your {2}gp.", Sold, (Sold > 1 ? "s" : ""), GiveGold );

            return true;
        }
 
This is in BaseVendor right? Just not exactly sure what was changed to go make the edits. I can figure it out but if you had line numbers would prolly help others too :) Or even
Find: X
Replace: Y

Find: X
Add: Y

:)

But totally not necessary! Thank you!

I indeed figured it out. Thank you!
[doublepost=1476663264][/doublepost]In Base Vendor . cs

Find:

Code:
private void ProcessValidPurchase(int amount, IBuyItemInfo bii, Mobile buyer, Container cont)

Replace:

Code:
private void ProcessValidPurchase(int amount, IBuyItemInfo bii, Mobile buyer, Container cont)
        {
            if (amount > bii.Amount)
            {
                amount = bii.Amount;
            }
            if (amount < 1)
            {
                return;
            }
            bii.Amount -= amount;
            IEntity o = bii.GetEntity();
            if (o is Item)
            {
                Item item = (Item)o;
                if (item.Stackable)
                {
                    item.Amount = amount;
                  
                    if( WeightOverloading.IsOverloaded(buyer) )
                    {
                        buyer.BankBox.DropItem( item );
                    }
                    // if (cont == null || !cont.TryDropItem(buyer, item, false))
                    // {
                        // item.MoveToWorld(buyer.Location, buyer.Map);
                    // }
                }
                else
                {
                    item.Amount = 1;
                    if(  WeightOverloading.IsOverloaded(buyer) )
                    {
                        buyer.BankBox.DropItem(item);
                    }
                  
                    // if (cont == null || !cont.TryDropItem(buyer, item, false))
                    // {
                        // item.MoveToWorld(buyer.Location, buyer.Map);
                    // }
                    for (int i = 1; i < amount; i++)
                    {
                        item = bii.GetEntity() as Item;
                        if (item != null)
                        {
                            item.Amount = 1;
                          
                            if(  WeightOverloading.IsOverloaded(buyer) )
                            {
                                buyer.BankBox.DropItem(item);
                            }
                            // if (cont == null || !cont.TryDropItem(buyer, item, false))
                            // {
                                // item.MoveToWorld(buyer.Location, buyer.Map);
                            // }
                        }
                    }
                }
            }
            else if (o is Mobile)
            {
                Mobile m = (Mobile)o;
                m.Direction = (Direction)Utility.Random(8);
                m.MoveToWorld(buyer.Location, buyer.Map);
                m.PlaySound(m.GetIdleSound());
                if (m is BaseCreature)
                {
                    ((BaseCreature)m).SetControlMaster(buyer);
                }
                for (int i = 1; i < amount; ++i)
                {
                    m = bii.GetEntity() as Mobile;
                    if (m != null)
                    {
                        m.Direction = (Direction)Utility.Random(8);
                        m.MoveToWorld(buyer.Location, buyer.Map);
                        if (m is BaseCreature)
                        {
                            ((BaseCreature)m).SetControlMaster(buyer);
                        }
                    }
                }
            }
        }

Find:

Code:
   public virtual bool OnBuyItems(Mobile buyer, List<BuyItemResponse> list)

REPLACE:

Code:
        public virtual bool OnBuyItems(Mobile buyer, List<BuyItemResponse> list)
        {
            if (!IsActiveSeller)
            {
                return false;
            }
            if (!buyer.CheckAlive())
            {
                return false;
            }
            if (!CheckVendorAccess(buyer))
            {
                Say(501522); // I shall not treat with scum like thee!
                return false;
            }
            UpdateBuyInfo();
            var buyInfo = GetBuyInfo();
            var info = GetSellInfo();
            int totalCost = 0;
            var validBuy = new List<BuyItemResponse>(list.Count);
            Container cont;
            bool bought = false;
            bool fromBank = false;
            bool fullPurchase = true;
            int controlSlots = buyer.FollowersMax - buyer.Followers;
            foreach (BuyItemResponse buy in list)
            {
                Serial ser = buy.Serial;
                int amount = buy.Amount;
                if (ser.IsItem)
                {
                    Item item = World.FindItem(ser);
                    if (item == null)
                    {
                        continue;
                    }
                    GenericBuyInfo gbi = LookupDisplayObject(item);
                  
                    if (gbi != null)
                    {
                        ProcessSinglePurchase(buy, gbi, validBuy, ref controlSlots, ref fullPurchase, ref totalCost);
                    }
                    else if (item != BuyPack && item.IsChildOf(BuyPack))
                    {
                        if (amount > item.Amount)
                        {
                            amount = item.Amount;
                        }
                        if (amount <= 0)
                        {
                            continue;
                        }
                        foreach (IShopSellInfo ssi in info)
                        {
                            if (ssi.IsSellable(item))
                            {
                                if (ssi.IsResellable(item))
                                {
                                    totalCost += ssi.GetBuyPriceFor(item) * amount;
                                    validBuy.Add(buy);
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (ser.IsMobile)
                {
                    Mobile mob = World.FindMobile(ser);
                    if (mob == null)
                    {
                        continue;
                    }
                    GenericBuyInfo gbi = LookupDisplayObject(mob);
                    if (gbi != null)
                    {
                        ProcessSinglePurchase(buy, gbi, validBuy, ref controlSlots, ref fullPurchase, ref totalCost);
                    }
                }
            } //foreach
            if (fullPurchase && validBuy.Count == 0)
            {
                SayTo(buyer, 500190); // Thou hast bought nothing!
            }
            else if (validBuy.Count == 0)
            {
                SayTo(buyer, 500187); // Your order cannot be fulfilled, please try again.
            }
            if (validBuy.Count == 0)
            {
                return false;
            }
            bought = buyer.AccessLevel >= AccessLevel.GameMaster;
            cont = buyer.Backpack;
          
            if (!bought && cont != null)
            {
                if (cont.ConsumeTotal(typeof(Gold), totalCost))
                {
                    bought = true;
                }
            }
            if (!bought &&
                (totalCost >= 2000 ||
                AccountGold.Enabled)
            )
            {
                if (Banker.Withdraw(buyer, totalCost))
                {
                    bought = true;
                    fromBank = true;
                }
                else
                {
                    cont = buyer.FindBankNoCreate();
                    if (cont != null && cont.ConsumeTotal(typeof(Gold), totalCost))
                    {
                        bought = true;
                        fromBank = true;
                    }
                }
            }
            if (!bought)
            {
                // ? Begging thy pardon, but thy bank account lacks these funds.
                // : Begging thy pardon, but thou casnt afford that.
                SayTo(buyer, totalCost >= 2000 ? 500191 : 500192);
                return false;
            }
            buyer.PlaySound(0x32);
          
            cont = buyer.Backpack ?? buyer.BankBox;
            foreach (BuyItemResponse buy in validBuy)
            {
                Serial ser = buy.Serial;
                int amount = buy.Amount;
                if (amount < 1)
                {
                    continue;
                }
                if (ser.IsItem)
                {
                    Item item = World.FindItem(ser);
                    if (item == null)
                    {
                        continue;
                    }
                    GenericBuyInfo gbi = LookupDisplayObject(item);
                    if (gbi != null)
                    {
                        ProcessValidPurchase(amount, gbi, buyer, cont);
                    }
                    else
                    {
                        if (amount > item.Amount)
                        {
                            amount = item.Amount;
                        }
                        foreach (IShopSellInfo ssi in info)
                        {
                            if (ssi.IsSellable(item))
                            {
                                if (ssi.IsResellable(item))
                                {
                                    Item buyItem;
                                    if (amount >= item.Amount)
                                    {
                                        buyItem = item;
                                    }
                                    else
                                    {
                                        buyItem = LiftItemDupe(item, item.Amount - amount);
                                        if (buyItem == null)
                                        {
                                            buyItem = item;
                                        }
                                        }
                                      
                                        if(  WeightOverloading.IsOverloaded(buyer) )
                                        {
                                            buyer.BankBox.DropItem( buyItem );
                                        }
                                    // if (cont == null || !cont.TryDropItem(buyer, buyItem, false))
                                    // {
                                        // buyItem.MoveToWorld(buyer.Location, buyer.Map);
                                    // }
                                    break;
                                }
                            }
                        }
                    }
                }
                else if (ser.IsMobile)
                {
                    Mobile mob = World.FindMobile(ser);
                    if (mob == null)
                    {
                        continue;
                    }
                    GenericBuyInfo gbi = LookupDisplayObject(mob);
                    if (gbi != null)
                    {
                        ProcessValidPurchase(amount, gbi, buyer, cont);
                    }
                }
            } //foreach
            if (fullPurchase)
            {
                if (buyer.AccessLevel >= AccessLevel.GameMaster)
                {
                    SayTo(buyer, true, "I would not presume to charge thee anything.  Here are the goods you requested.");
                }
                else if (fromBank)
                {
                    SayTo(
                        buyer,
                        true,
                        "The total of thy purchase is {0} gold, which has been withdrawn from your bank account.  My thanks for the patronage.",
                        totalCost);
                }
                else
                {
                    SayTo(buyer, true, "The total of thy purchase is {0} gold.  My thanks for the patronage.", totalCost);
                }
            }
            else
            {
                if (buyer.AccessLevel >= AccessLevel.GameMaster)
                {
                    SayTo(
                        buyer,
                        true,
                        "I would not presume to charge thee anything.  Unfortunately, I could not sell you all the goods you requested.");
                }
                else if (fromBank)
                {
                    SayTo(
                        buyer,
                        true,
                        "The total of thy purchase is {0} gold, which has been withdrawn from your bank account.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.",
                        totalCost);
                }
                else
                {
                    SayTo(
                        buyer,
                        true,
                        "The total of thy purchase is {0} gold.  My thanks for the patronage.  Unfortunately, I could not sell you all the goods you requested.",
                        totalCost);
                }
            }
            return true;
        }

Find:

Code:
publicvirtualbool OnSellItems(Mobile seller, List<SellItemResponse> list)

REPLACE:

Code:
public virtual bool OnSellItems(Mobile seller, List<SellItemResponse> list)
        {
            if (!IsActiveBuyer)
            {
                return false;
            }
            if (!seller.CheckAlive())
            {
                return false;
            }
            if (!CheckVendorAccess(seller))
            {
                Say(501522); // I shall not treat with scum like thee!
                return false;
            }
            seller.PlaySound(0x32);
            var info = GetSellInfo();
            var buyInfo = GetBuyInfo();
            int GiveGold = 0;
            int Sold = 0;
            Container cont;
            foreach (SellItemResponse resp in list)
            {
                if (resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable ||
                    (resp.Item is Container && (resp.Item).Items.Count != 0))
                {
                    continue;
                }
                foreach (IShopSellInfo ssi in info)
                {
                    if (ssi.IsSellable(resp.Item))
                    {
                        Sold++;
                        break;
                    }
                }
            }
            if (Sold > MaxSell)
            {
                SayTo(seller, true, "You may only sell {0} items at a time!", MaxSell);
                return false;
            }
            else if (Sold == 0)
            {
                return true;
            }
            foreach (SellItemResponse resp in list)
            {
                if (resp.Item.RootParent != seller || resp.Amount <= 0 || !resp.Item.IsStandardLoot() || !resp.Item.Movable ||
                    (resp.Item is Container && (resp.Item).Items.Count != 0))
                {
                    continue;
                }
                foreach (IShopSellInfo ssi in info)
                {
                    if (ssi.IsSellable(resp.Item))
                    {
                        int amount = resp.Amount;
                        if (amount > resp.Item.Amount)
                        {
                            amount = resp.Item.Amount;
                        }
                        if (ssi.IsResellable(resp.Item))
                        {
                            bool found = false;
                            foreach (IBuyItemInfo bii in buyInfo)
                            {
                                if (bii.Restock(resp.Item, amount))
                                {
                                    resp.Item.Consume(amount);
                                    found = true;
                                    break;
                                }
                            }
                            if (!found)
                            {
                                cont = BuyPack;
                                if (amount < resp.Item.Amount)
                                {
                                    Item item = LiftItemDupe(resp.Item, resp.Item.Amount - amount);
                                    if (item != null)
                                    {
                                        item.SetLastMoved();
                                        cont.DropItem(item);
                                    }
                                    else
                                    {
                                        resp.Item.SetLastMoved();
                                        cont.DropItem(resp.Item);
                                    }
                                }
                                else
                                {
                                    resp.Item.SetLastMoved();
                                    cont.DropItem(resp.Item);
                                }
                            }
                        }
                        else
                        {
                            if (amount < resp.Item.Amount)
                            {
                                resp.Item.Amount -= amount;
                            }
                            else
                            {
                                resp.Item.Delete();
                            }
                        }
                        GiveGold += ssi.GetSellPriceFor(resp.Item) * amount;
                        break;
                    }
                }
            }
            if (GiveGold > 0)
            {
                while (GiveGold > 60000)
                {
                    if(  WeightOverloading.IsOverloaded(seller) )
                    {
                        seller.BankBox.DropItem(new Gold(60000));
                    }
                    seller.AddToBackpack(new Gold(60000));
                    GiveGold -= 60000;
                }
              
                //seller.AddToBackpack(new Gold(GiveGold));
              
                if(  WeightOverloading.IsOverloaded(seller) )
                {
                    seller.BankBox.DropItem(new Gold(GiveGold));
                }
                else
                {
                    seller.AddToBackpack(new Gold(GiveGold));
                }
                seller.PlaySound(0x0037); //Gold dropping sound
                if (SupportsBulkOrders(seller))
                {
                    Item bulkOrder = CreateBulkOrder(seller, false);
                    if (bulkOrder is LargeBOD)
                    {
                        seller.SendGump(new LargeBODAcceptGump(seller, (LargeBOD)bulkOrder));
                    }
                    else if (bulkOrder is SmallBOD)
                    {
                        seller.SendGump(new SmallBODAcceptGump(seller, (SmallBOD)bulkOrder));
                    }
                }
            }
            //no cliloc for this?
            //SayTo( seller, true, "Thank you! I bought {0} item{1}. Here is your {2}gp.", Sold, (Sold > 1 ? "s" : ""), GiveGold );
            return true;
        }


Just organized what @zerodowned did above. Awesome and it works! Thanks man.
 
Last edited:
The gold actually says "this has been depositted"

The items say nothing.
Ok that's due to the gold in bankbox being added to bank balance

Also just noticed I forgot an else after if for gold given > 60000 in OnSellItem
Will need to fix it
 
Add this line under method : Move To Bank Box
(MobileValue).SendMessage("The item which you bought moved in your bankbox");
[doublepost=1476675888][/doublepost]Also, you can change the sysmsg's color like this

mob.SendMessage( HueCode, "Message" );
if you set 38, sysmsg's fontcolor will be red.

If you want to use value, use code like this

int count = 0;
count++;
mob.SendMessage( String.Format("{0} items removed", count) );

It'll send "1 items removed" as system message.
 
i did it this way since half the code was there for me anyways and no reason to make it harder then it should be i did it like this

Code:
if (cont == null || !cont.TryDropItem(buyer, buyItem, false))
                                     {
                                        // buyItem.MoveToWorld(buyer.Location, buyer.Map);
										buyer.BankBox.DropItem(item);
										buyer.SendMessage(200, "{0} has been sent to your bank, thank you for your purchase",item);
                                     }
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back