Items not replenishing in shop

I followed the RPG Shops and Abilities tutorial, and my shop items don’t replenish when I level up as in the tutorial. I figured it has something to with the following function, because availabilities[config.item] += config.initialStock; is adding the availabilities to the initial stock, and the level to unlock feature on the shop works, just the replenish feature is bugged… Thank you in advance.

private Dictionary<InventoryItem, int> GetAvailabilities()
{
Dictionary<InventoryItem, int> availabilities = new Dictionary<InventoryItem, int>();

        foreach(var config in GetAvailableConfigs())
        {
            if (isBuyingMode)
            {
                if (!availabilities.ContainsKey(config.item))
                {
                    int sold = 0;
                    stockSold.TryGetValue(config.item, out sold);
                    availabilities[config.item] = -sold;
                }
                availabilities[config.item] += config.initialStock;
            }
            else
            {
                availabilities[config.item] = CountItemsInInventory(config.item);
            }
        }
        return availabilities;
    }

I asked for assistance in Discord and this bug is solved.

Sorry, I was out of town for the weekend. I’m glad you go this sorted.

Privacy & Terms