azerothcore / mod-ah-bot

AHBot for AzerothCore
http://azerothcore.org/
70 stars 82 forks source link

Bug: No enchanting materials exists on AH #73

Open ChrisFredriksson opened 1 year ago

ChrisFredriksson commented 1 year ago

Current Behaviour

Can't find any enchanting material on AH; Strange Dust, Dream Dust, Greater Magic Essence and so on.. No materials found on AH.

None of these are listed in the DB table "mod_auctionhousebot_disabled_items".

Expected Behaviour

All enchanting materials except the ones specified in DB table "mod_auctionhousebot_disabled_items".

Steps to reproduce the problem

Launch server with AHBot module

Extra Notes

I have set minitems to 140 000 and maxitems to 150 000.

AC rev. hash/commit

AzerothCore rev. 1209d61565cb+ 2023-08-11 22:20:06 +0000 (master branch)

Operating system

Debian 12 x64

Custom changes or Modules

AutoBalance IndividualProgression SoloLFG NPCBots

dedmen commented 11 months ago

Example 11137 has a BuyPrice of 4000, and a SellPrice of 0.

As the bot by default uses SellPrice, it seeing a price of zero might make it not work.

https://github.com/georgzoeller/mod-ah-bot/blob/master/src/AuctionHouseBot.cpp#L868

Here we exit if the SellPrice is zero. Problem is, you cannot fix it by switching to BuyPrice. Well it would fix enchant mats, but that will break other things that cannot be purchased from vendor, and don't have a buy price.

There needs to be a fallback where it will use the BuyPrice if the SellPrice is zero.

ChrisFredriksson commented 11 months ago

Aha! I didn't even think of checking the source...! lol..

Well, either one could reprogram it, after all it is C so, I should be able to do it quite easily.. or, more "easy" approach could be to add sell prices to the mats.. sure then you can sell them to a vendor I guess, but I don't really care about that.. Of course, not pure blizzlike behavior, but could get around to having those mats on AH at least, for now..

What's your thought on that?

dedmen commented 11 months ago

I would like to have a fallback, if sellPrice doesn't exist, then use buyprice. I plan to work on a extra price database, so one can import prices from real servers gathered with Auctioneer addon. So instead of this vendor price calculation, have actual real world prices, which would also solve that problem.

lanarchy commented 11 months ago

Agreed, a fallback would be awesome! Or an override field we can add items to such as copper ores, and whatnot.

Akaitatsu commented 11 months ago

When I was researching #74 I noticed that some of these items have buy and sell prices set to 0. So, even falling back won't work. If you set prices, I am interested to see what you set them to.

lanarchy commented 11 months ago

Would there be any real downside to changing anything with a price of 0 to a price of 1? That way they should at least populate the auction house and then we can go from there to dial the price in. I will see if I can go through some of the common trade good items and try to price them appropriately and let people know when I have time.

dedmen commented 11 months ago

I am interested to see what you set them to.

I run this fork https://github.com/DedmenWoW/mod-ah-bot/blob/master/src/ItemIndex.cpp#L35

With data I exported from my Auctioneer addon data from a bigger server. mod_auctionhousebot_priceOverride.txt

Akaitatsu commented 11 months ago

Your code looks much better than what I have been wading through in the main repo. I have only looked through it briefly though, and I don't see the script for your override table. One other suggestion that we've mentioned in here is to fall back to the buy/sell price if the preferred base price is 0. Here is what I implemented yesterday for my tiny (max 3 players) server.

            // Buy Count is used later when the buy price is for multiple items (arrows, bullets, etc.)
            uint32 buyCount = 1;
            // Favor SellMethod (Use Buy Price), but fall back if price is 0
            if (SellMethod)
            {
                if (prototype->BuyPrice > 0)
                {
                    buyoutPrice = prototype->BuyPrice;
                    buyCount = prototype->BuyCount;
                }
                else
                    buyoutPrice = prototype->SellPrice * 4;
            }
            else
            {
                if (prototype->SellPrice > 0)
                    buyoutPrice = prototype->SellPrice;
                else
                {
                    // Adjust base price rounding up
                    buyoutPrice = (prototype->BuyPrice + 4 - 1) / 4;
                    buyCount = prototype->BuyCount;
                }
            }

I am still researching the data to come up with a query that will pull items that aren't showing up for an unknown reason. I think there are some loot tables missing items but I am not sure.

Edit: I just learned about DBC data and how some of it is in the DBC files and that only overrides are in the DBC tables. Since AH Bot depends on references to item templates being in the database, anything that isn't overridden in the DBC tables is going to be skipped. We might also need an "include" table so we can specify items we want in the AH but the bot can't find in the database. Examples: