Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Bot Does Not Restock AH Back to MaxItems Until a Server Restart or Config Reload #126

Open
LannyE opened this issue Dec 11, 2024 · 6 comments

Comments

@LannyE
Copy link

LannyE commented Dec 11, 2024

Current Behaviour

With the current commit it appears that the Bot will not restock items as auctions expire and gradually over time the auction house will be at 0 total items without a server restart or config reload. Once you restart/reload the server the bot restocks the auction house back to between the minitems and maxitems database settings.

I decided to make this its own issue as this was discussed and confirmed in another issue #122 that wasn't exactly about this issue.

As show in the linked issue this is the errors I received when the bot was trying to restock items.
image

My auction house maxitems is rather large sitting at 13000 items but I have tested it at 1000 and had the same results. I have noticed this issue for about three months. It used to work fine.

Expected Behaviour

When auctions expire at the next check or "tick" the bot should add more auctions to get the auction house total auctions back up to between the minitems and maxitems database settings.

Steps to reproduce the problem

  1. Set your minitems and maxitems in the database
  2. Start Azerothcore server
  3. Watch as auction house auctions are listed, and total auctions reach the maxitems setting.
  4. Do not restart server and wait for auctions to expire. Over time the auction house total auctions will continue to decrease without a restock.

Extra Notes

I tested an old commit 139bea2 on one of my test instances and the auction house does restock and keeps the total number of auctions between the minitems and maxitems database settings as expected. I chose that commit because I started noticing this issue way back in September.

AC rev. hash/commit

AzerothCore rev. df03a80ee75b+ 2024-12-06 22:49:01 -0700 (master branch) (Win64, RelWithDebInfo, Static)

Operating system

Windows

Custom changes or Modules

mod-ah-bot
mod-gain-honor-guard
mod-individual-xp
mod-pvp-titles
mod-solo-lfg
mod-transmog
mod-weekend-xp

@StraysFromPath
Copy link

Same issue here.

@BakaMatt
Copy link

BakaMatt commented Dec 13, 2024

I have this issue with different symptoms. No bin error, but every time a bot auction is purchased by a player or a bot auction expires, the following is logged: "AHBot: Item {} doesn't exist, perhaps bought already?".

It appears the script can't access the item properties of removed auctions, so the running auction counters never get decreased after the initial population. Once the bot reaches maximum auction size count, it doesn't restock as the counter never lowers.

It's not a problem on a fresh server start as the counts are loaded direct from db on initialization.

@BieJay93
Copy link

BieJay93 commented Dec 14, 2024

I had the same issue, i fixed it by adjusting the percentages of item colors in the mod_auctionhousebot table.
I've also noticed, that this problem only occurs if "maxItems" is too high.
Currently these values are working for me:
min/maxItems: 30k
percentages tradegoods: 0,3,1,1,0,0,0
precentages itesm: 0,18,53,16,8,0,0

It's been a while since I've dealt with this..But i think this happens, if the max amount of allowed items of a color is larger than the available items * DuplicatesCount . For example if we have 10 different blue items the bot can choose from and the duplicatesCount is 5 (in total 50 stacks). And the maximum amount of blue item stacks in the ah is 100, the bot tries to populate more blue items until it reaches 100, but he can't because there are no more items and the duplicateCount is reached.
So there is still a bug, because it doesn't start to restock, after it's expired/sold. Couldn't find the problem in the code, so i adjusted the percentages.

Possible that you need other values, because i'm also running the changes from #113

@StraysFromPath
Copy link

I had the same issue, i fixed it by adjusting the percentages of item colors in the mod_auctionhousebot table. I've also noticed, that this problem only occurs if "maxItems" is too high. Currently these values are working for me: min/maxItems: 30k percentages tradegoods: 0,3,1,1,0,0,0 precentages itesm: 0,18,53,16,8,0,0

It's been a while since I've dealt with this..But i think this happens, if the max amount of allowed items of a color is larger than the available items * DuplicatesCount . For example if we have 10 different blue items the bot can choose from and the duplicatesCount is 5 (in total 50 stacks). And the maximum amount of blue item stacks in the ah is 100, the bot tries to populate more blue items until it reaches 100, but he can't because there are no more items and the duplicateCount is reached. So there is still a bug, because it doesn't start to restock, after it's expired/sold. Couldn't find the problem in the code, so i adjusted the percentages.

Possible that you need other values, because i'm also running the changes from #113

Is there a way to disable/revert the "duplicates count" bug then? I have duplicate checking disabled and the module is still bricked.

@LannyE
Copy link
Author

LannyE commented Dec 18, 2024

I think I found the problem. Comment out line 190 from the
mod-ah-bot/src/AuctionHouseBotAuctionHouseScript.cpp

    {
        if (config->DebugOut)
        {
            LOG_ERROR("module", "AHBot: Item {} doesn't exist, perhaps bought already?", auction->item_guid.ToString());
        }

       // return;  <- Commented out or you can remove it.
    }

Basically, what happens is after an item is bought then creation of this pItem is attempted and for whatever reason doesn't happen and you get this log error. Then the if statement exits out of the function and doesn't allow this decrement code to happen:

config->DecItemCounts(prototype->Class, prototype->Quality);

Since that code doesn't happen the total number of auctions for that quality of item doesn't decrease so you keep the same amount of auctions for that quality of item even though auctions have ended for it. On the other side of this, the overall total amount of auctions does decrease in the code and since all the different quality of auctions stay at the same amount it can't find one to add any auctions to. Thus, it never adds any new auctions.

Been running this for 3 days now on my test server and it is working fine.

@kadeshar
Copy link

kadeshar commented Dec 28, 2024

@LannyE tried your soultion but for me didnt work. My overall auctions still decreasing in time.
obraz
obraz
obraz
obraz

UPDATE with config reload:
obraz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants