GenericBuy.cs missing m_MaxAmount =

ParanoiaPhD

Well-Known Member
May 2, 2019
100
11
31
California
www.iceyou.org
Shard Name
Central USA
I can change the maximum amount that can be bought at a time in GenericBuy.cs but not in GenericSell.cs

For example I was able to change m_MaxAmount = 999 to 5000 so now I'm able to purchase 5000 of each reagent at a time but when it comes to selling it's stuck at 999 the default value for both selling and buying.

In GenericBuy.cs there is this code. The bottom two line allow you to change the maximum amount you can buy per transaction. This is absent in GenericSell.cs

C#:
            if (m_Amount <= 999)
{
                m_MaxAmount *= 2;
                if (m_MaxAmount >= 999)
m_MaxAmount = 999;
            }
Could we get the equivalent added to genericsell.cs ? or is there a way to do this that I'm just not seeing. I've spent that last two days prodding the issue with no success. I'm not a good coder. I'm more of a pleb code manipulator.
Post automatically merged:

Dang it I meant "GenericSell.cs missing m_MaxAmount ="
 
Last edited:

ParanoiaPhD

Well-Known Member
May 2, 2019
100
11
31
California
www.iceyou.org
Shard Name
Central USA
so earlier i came to the conclusion that since genericbuy and genericsell are written differently its impossible to change the default 999. I gave up because genericbuy has this code.

GenericBuy.cs Has the right coding to change the 999 to whatever you want.
C#:
using System;
using System.Collections.Generic;
using Server.Items;
using System.Linq;

namespace Server.Mobiles
{
    public class GenericBuyInfo : IBuyItemInfo
    {
        public static Dictionary<Type, int> BuyPrices = new Dictionary<Type, int>();
        private Type m_Type;
        private string m_Name;
        private int m_Price;
        private int m_MaxAmount, m_Amount;
        private int m_ItemID;
        private int m_Hue;
        private object[] m_Args;
        private IEntity m_DisplayEntity;
        private int m_PriceScalar;
        private bool m_Stackable;
        private int m_TotalBought;
        private int m_TotalSold;

        public GenericBuyInfo(Type type, int price, int amount, int itemID, int hue, bool stacks = false)

And genericsell.cs does not
C#:
using System;
using System.Collections.Generic;
using Server.Items;
using System.Linq;

namespace Server.Mobiles
{
    public class GenericSellInfo : IShopSellInfo
    {
        private readonly Dictionary<Type, int> m_Table = new Dictionary<Type, int>();
        private Type[] m_Types;
        public GenericSellInfo()
its that thing at the bottom of both headers

C#:
public GenericBuyInfo(Type type, int price, int amount, int itemID, int hue, bool stacks = false)
C#:
public GenericSellInfo()
so there is no way to incorporate an "int amount"

without rewriting all the SBVendors
 

zerodowned

Moderator
ServUO Developer
Jun 28, 2014
1,771
219
i think its written that way because the default gump only supports a 3 digit number.
 

zerodowned

Moderator
ServUO Developer
Jun 28, 2014
1,771
219
i think what you want to look at is this: https://github.com/ServUO/ServUO/blob/5ece3305802cc4211f4c92fea5534f923a73300f/Scripts/Mobiles/NPCs/BaseVendor.cs#L2368

I believe if you change those numbers for "amount" it will change the number of items the vendor will stock/sell to players

C#:
switch (doubled)
                                        {
                                            case 0:
                                                break;
                                            case 1:
                                                amount = 40;
                                                break;
                                            case 2:
                                                amount = 80;
                                                break;
                                            case 3:
                                                amount = 160;
                                                break;
                                            case 4:
                                                amount = 320;
                                                break;
                                            case 5:
                                                amount = 640;
                                                break;
                                            case 6:
                                                amount = 999;
                                                break;
}
 

ParanoiaPhD

Well-Known Member
May 2, 2019
100
11
31
California
www.iceyou.org
Shard Name
Central USA
already tried that. I tried everything there is to try lol. the code just doesn't let me change max buy its always 999.

the only option is to add code. code it in. I don't know how so I worked around this by adding GoldBricks to cleanuprewardsvendor and made them worth 60k from a tinker. It's actually better this way since I mainly wanted people to be able to sell bulk resources they farmed. It simplifies things even MORE than if they could sell more than 999 because you cant hold shift and sell an entire stack that's client side I think BUT you can drop entire stacks into a cleanup barrel. Faster, easier, and cooler.