azerothcore / mod-ah-bot

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

Overall cleanup and extension of the mod #96

Closed kewinrausch closed 1 month ago

kewinrausch commented 2 months ago

Changes Proposed:

Issues Addressed:

SOURCE:

Tests Performed:

How to Test the Changes:

Install the mod, then configure the file to enable the features. This can be done by setting (whitelist configured with tailoring profession items):

Clean up the auction house from existing auctions to start in a pristine environment, then start the server (i used a SQL command a startup to clear all those options of the bots that have not been bidded delete from auctionhouse where itemowner = <bot_id> and lastbid = 0, but probably you will have to be a little more careful).

With the tracing set on on you will be able to read from the console log what is happening like the following: AHSeller: New stack ah=7, id=14047, stack=20, bid=9460, buyout=13520 AHSeller: New stack ah=7, id=2772, stack=10, bid=3060, buyout=3060 AHSeller: New stack ah=7, id=11144, stack=1, bid=1418, buyout=1730 AHSeller: New stack ah=7, id=2673, stack=10, bid=160, buyout=170 AHSeller: New stack ah=7, id=3355, stack=5, bid=340, buyout=480 AHSeller: New stack ah=7, id=2770, stack=5, bid=30, buyout=40 AHSeller: auctionhouse 7, req=200, sold=6, aboveMin=false, aboveMax=false, loopBrk=1, noNeed=1034, tooMany=193, binEmpty=0, err=0

Every line describe a new auction sold in the actionhouse (7 is neutral faction here). There is the stack size which shall be a multiple of 3, 4 or 5, and not totally random (stack=).

The last line will report the overall operations performed during the run. Can be read as:

In the example provided you can see that the system will perform 200 attempts, 1 reached the loop break and terminated, 6 has been sold and 193 where not necessary (193+6+1 = 200, so all the attempts where made).

Feel free to reach me out with a Call on the Discord channel if you wish to have further info, but warn me first since I'm not usually socially active (I open Discord only when i need it).

kewinrausch commented 2 months ago

Hey there, I pushed some more modifications that allows the bot to run multiple instances of characters of the provided account. If the character GUID is provided then only one bot will be run (should be backward compatible). I've performed some additional testing and some more will be done in the following days.

Helias commented 1 month ago

(should be backward compatible) are you sure it is?

kewinrausch commented 1 month ago

For that part alone (if specified, only one bot will be active), I'm pretty sure right now. You can test this yourself by following these steps:

At this point you will be able to see the following log (I cut some part since it was too long):

AHBot [8]: New stack ah=6, id=3821, stack=12, bid=2988, buyout=3744
AHBot [8]: New stack ah=6, id=2770, stack=4, bid=32, buyout=44
AHBot [8]: New stack ah=6, id=2453, stack=16, bid=480, buyout=624
AHBot [8]: New stack ah=6, id=3820, stack=4, bid=532, buyout=704
AHBot [8]: New stack ah=6, id=2771, stack=4, bid=140, buyout=164
AHBot [8]: New stack ah=6, id=11144, stack=1, bid=1691, buyout=1780
AHBot [8]: New stack ah=6, id=12208, stack=12, bid=3900, buyout=4392
AHBot [8]: New stack ah=6, id=3731, stack=4, bid=340, buyout=412
AHBot [8]: New stack ah=6, id=3173, stack=12, bid=276, buyout=408
AHBot [8]: New stack ah=6, id=765, stack=16, bid=304, buyout=336
AHBot [8]: New stack ah=6, id=1015, stack=12, bid=576, buyout=624
AHBot [8]: New stack ah=6, id=785, stack=16, bid=400, buyout=560
AHBot [8]: New stack ah=6, id=3712, stack=16, bid=2112, buyout=2224
AHBot [8]: New stack ah=6, id=2674, stack=8, bid=192, buyout=200
AHBot [8]: New stack ah=6, id=16206, stack=1, bid=1992, buyout=2490
AHBot [8]: New stack ah=6, id=2589, stack=8, bid=112, buyout=160
AHBot [8]: New stack ah=6, id=10620, stack=8, bid=3488, buyout=3840
AHBot [8]: New stack ah=6, id=11128, stack=1, bid=940, buyout=1175
AHBot [8]: New stack ah=6, id=6338, stack=1, bid=232, buyout=253
AHBot [8]: New stack ah=6, id=2447, stack=8, bid=136, buyout=168
AHBot [8]: New stack ah=6, id=2672, stack=12, bid=72, buyout=96
AHBot [8]: New stack ah=6, id=12184, stack=12, bid=1680, buyout=2316
AHBot [8]: New stack ah=6, id=2673, stack=12, bid=168, buyout=204
AHBot [8]: New stack ah=6, id=2592, stack=4, bid=180, buyout=248
AHBot [8]: New stack ah=6, id=3858, stack=4, bid=1552, buyout=2128
AHBot [8]: New stack ah=6, id=8836, stack=4, bid=584, buyout=680
AHBot [8]: New stack ah=6, id=14047, stack=16, bid=12400, buyout=12928
AHBot [8]: auctionhouse 6, req=200, sold=44, aboveMin=false, aboveMax=false, loopBrk=3, noNeed=1195, tooMany=153, binEmpty=0, err=0

This is the trace of the bot bound to the character GUID 8 in my server. Since only one is active, you only see AHBot [8] from the character 8 performing selling auctions. You can verify too by logging in and checking the AH in game.

Then you shutdown the server, and set the AuctionHouseBot.GUID = 0 but leave AuctionHouseBot.Account with a valid number. This will instruct the mod to use ALL the characters of that account.

By restarting the server now you can also follow the trace of the second seller, like the following trace:

HBot [8]: auctionhouse 2, req=200, sold=0, aboveMin=false, aboveMax=false, loopBrk=1, noNeed=1179, tooMany=199, binEmpty=0, err=0
Starting up Auction House Listing thread...
AC> AHBot [8]: auctionhouse 6, req=200, sold=0, aboveMin=false, aboveMax=false, loopBrk=0, noNeed=1177, tooMany=200, binEmpty=0, err=0
AHBot [8]: auctionhouse 7, req=200, sold=0, aboveMin=false, aboveMax=false, loopBrk=1, noNeed=1257, tooMany=199, binEmpty=0, err=0
AHBot [10]: New stack ah=2, id=20424, stack=16, bid=4960, buyout=6800
AHBot [10]: New stack ah=2, id=785, stack=16, bid=528, buyout=576
AHBot [10]: New stack ah=2, id=2589, stack=12, bid=216, buyout=288
AHBot [10]: New stack ah=2, id=3173, stack=4, bid=96, buyout=128
AHBot [10]: New stack ah=2, id=2776, stack=3, bid=16254, buyout=18060
AHBot [10]: New stack ah=2, id=7911, stack=3, bid=14412, buyout=18015
AHBot [10]: New stack ah=2, id=5503, stack=4, bid=136, buyout=152
AHBot [10]: New stack ah=2, id=2772, stack=16, bid=3712, buyout=4176
AHBot [10]: New stack ah=2, id=2775, stack=3, bid=1890, buyout=2337
(.... more traces here ...)
AHBot [10]: New stack ah=2, id=3357, stack=16, bid=1792, buyout=2560
AHBot [10]: New stack ah=2, id=4306, stack=16, bid=4496, buyout=6000
AHBot [10]: New stack ah=2, id=3356, stack=4, bid=148, buyout=188
AHBot [10]: New stack ah=2, id=2450, stack=12, bid=468, buyout=516
AHBot [10]: New stack ah=2, id=2672, stack=8, bid=40, buyout=56
AHBot [10]: New stack ah=2, id=8838, stack=8, bid=992, buyout=1128
AHBot [10]: New stack ah=2, id=3731, stack=12, bid=936, buyout=984
AHBot [10]: auctionhouse 2, req=200, sold=45, aboveMin=false, aboveMax=false, loopBrk=3, noNeed=1214, tooMany=152, binEmpty=0, err=0

This informs you that the second bot (number 10) is currently operating and selling stuff. If you login an check the AH you will be able to see two sellers.

After some time they will reach an equilibrium by reaching the assigned max or by not having any more item to be sold (I'm using a whitelist of 50 items right now). This results in the following trace:

AHBot [8]: auctionhouse 2, req=200, sold=0, aboveMin=false, aboveMax=false, loopBrk=2, noNeed=1069, tooMany=198, binEmpty=0, err=0
AHBot [8]: auctionhouse 6, req=200, sold=0, aboveMin=false, aboveMax=false, loopBrk=1, noNeed=1212, tooMany=199, binEmpty=0, err=0
AHBot [8]: auctionhouse 7, req=200, sold=0, aboveMin=false, aboveMax=false, loopBrk=0, noNeed=1156, tooMany=200, binEmpty=0, err=0
AHBot [10]: auctionhouse 2, req=200, sold=0, aboveMin=false, aboveMax=false, loopBrk=2, noNeed=1188, tooMany=198, binEmpty=0, err=0
AHBot [10]: auctionhouse 6, req=200, sold=0, aboveMin=false, aboveMax=false, loopBrk=0, noNeed=1067, tooMany=200, binEmpty=0, err=0
AHBot [10]: auctionhouse 7, req=200, sold=0, aboveMin=false, aboveMax=false, loopBrk=1, noNeed=1203, tooMany=199, binEmpty=0, err=0

The bots are not concurrent or multi-thread, they are just operated one after the other. Right now the final effect is something like: image

Currently my only problem is that I'm testing it in a server which is used by me and few of my friends, so I can't say that I've tested out every single combination of the configuration or all the cases.

Helias commented 1 month ago

ok, thanks for the confirmation, I merged the PR!