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

Overall cleanup and extension of the mod #96

Merged
merged 4 commits into from
Aug 22, 2024

Conversation

kewinrausch
Copy link

Changes Proposed:

  • Code cleanup for readability (added comments for internal documentation)
  • Decoupled the debugging messages to isolate the parts that you desire to debug
  • Tracing mechanism for selling operation which is not console invasive (counters)
  • New configuration: whitelist mechanism, which takes priority over disabled items table (backward compatible). Using a blacklist can be a problem if new items are added to the game, since you have to remember to exclude it, and you've got to go through the pain of checking every single entry. There is always the possibility that an item "slips" in the auction market and you did not want that. Whitelisting allows to to control every single element which can end up being sold. I use the whitelist to sell items that can help users complete their professions until reaching the WOTLK expansion.
  • New configuration: consider only bot auctions. The bot maintains a background noise on the market as auctions from players are not taken into account.
  • New configuration: duplicates count. To avoid overwhelming the market with the same items on unfortunate rolls, there is a maximum amount of auctions with the same item that will be sold.
  • New configuration: divisible stacks. Organize the auctions stacks in a human-like way (not totally random)
  • New configuration: elapsing time class. Allows to configure the auctions of the bots in three set, short, medium and long lived.
  • New console commands: game masters can enabled/disable the bot (seller, buyer) on the fly

Issues Addressed:

SOURCE:

Tests Performed:

  • Build without problems and warnings
  • Tested against the current core version installed in my server f109768. Will test on the latest version when i will upgrade it.
  • Environment: Linux WOWSERVER 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux (yes, I'm crazy enough to test it in WSL and works perfectly)
  • I'm currently using the mod in my setup with a standard configuration, but low population. I have no opportunity or contact to test it under stress with lot of players, but this will be a problem of efficiency rather than broken mechanisms.
  • Tested the gm commands to disable and then re-enable the bot while the game is up (.ahbotoptions seller 0).

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):

  • AuctionHouseBot.TRACE_SELLER = 1
  • AuctionHouseBot.DuplicatesCount = 1
  • AuctionHouseBot.DivisibleStacks = 1
  • AuctionHouseBot.ElapsingTimeClass = 2
  • AuctionHouseBot.SellerWhiteList="2589, 2592, 4306, 4338, 14047"
    2589 - Linen Cloth
    2592 - Wool Cloth
    4306 - Silk Cloth
    4338 - Mageweave Cloth
    14047 - Runecloth
    -AuctionHouseBot.VendorItems = 1 (to sell trade goods)
    -AuctionHouseBot.VendorTradeGoods = 1 (to sell trade goods)

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:

  • req requested amount to be sold in this run
  • sold valid auctions actually put in the auction house
  • aboveMin condition if the configured minimum items test has failed
  • aboveMax condition if the configured maximum items test has failed
  • loopBrk how many times the auction creation logic reached the loop break without picking a valid item
  • noNeed how many times a randomly selected item is not needed
  • tooMany how many times the duplicate stack test decided the item is not necessary
  • binEmpty how many times a picked quality results in no item selected
  • err how many times an error occurred which caused the loop to stop

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).

… of whitelist mechanism compatible with disabled item table (take precedence), new configuration options to regulate amount of elements sold in the market, their size and the elapsed time
@Helias Helias added the enhancement New feature or request label Aug 14, 2024
@Helias Helias closed this Aug 14, 2024
@Helias Helias reopened this Aug 14, 2024
@kewinrausch
Copy link
Author

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
Copy link
Member

Helias commented Aug 20, 2024

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

@kewinrausch
Copy link
Author

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:

  • In a test server, clean the auction house (start from scratch with an empty situation)
  • Configure the bot by setting BOTH AuctionHouseBot.Account and AuctionHouseBot.GUID
  • Enable the seller with AuctionHouseBot.EnableSeller = 1
  • Enable the tracing with AuctionHouseBot.TRACE_SELLER = 1
  • Run once

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 Helias merged commit 5189b72 into azerothcore:master Aug 22, 2024
1 check passed
@Helias
Copy link
Member

Helias commented Aug 22, 2024

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

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

Successfully merging this pull request may close these issues.

2 participants