fix(buyer): stop skip-starvation, add cap headroom, escalate own bids to buyout - #30
Merged
Merged
Conversation
… to buyout Three stacked causes kept player auctions from ever being bought: - Candidates were scanned lowest-auction-ID-first and every skipped auction consumed the BidsPerInterval budget while re-entering the query each cycle, so a handful of permanently-overpriced auctions starved everything newer. Candidates are now shuffled and only successful operations (bid or buyout) consume the budget. - Overrides with minPrice == avgPrice collapse the buy cap (avg + (avg - min)) to exactly avg while the seller lists at avg +-10%, making ordinary undercuts unbuyable. The cap now gets at least 15% headroom above avg whenever an override exists. - Auctions the bot already led were excluded via buyguid, so a single bid froze them until expiry. They stay in the candidate set; the bot never outbids itself but escalates to a buyout when it fits the cap. Closes #28
There was a problem hiding this comment.
Pull request overview
This PR fixes buyer-side auction evaluation starvation and improves purchase behavior so player listings that are within cap are actually considered and bought promptly, addressing issue #28.
Changes:
- Randomizes candidate auction evaluation order and ensures each candidate is evaluated at most once per run.
- Makes skipped auctions not consume the per-interval bid/buyout budget (only successful bid/buyout operations increment the budget counter).
- Keeps auctions the bot already leads in the candidate set and escalates to buyout (when within cap) instead of re-bidding or abandoning.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Skips no longer consume the bid budget, so a skip-heavy cycle could scan every candidate. Cap evaluations at 100x BidsPerInterval; the shuffled order keeps the sample fair across cycles.
In account-only mode the config GUID list is empty, so JoinGUIDs rendered an invalid NOT IN () clause and broke the buyer query. Use the resolved bot character set and bail out when it is empty.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
src/AuctionHouseBot.cpp:649
- Log message has an extra space before the comma (
"Bought ,"), which makes log searching/aggregation less consistent.
LOG_INFO("module", "AHBot [{}]: Bought , itemid={}, ah={}, item={}, start={}, current={}, buyout={}", _id, prototype->ItemId, AuctionHouseId(auction->GetHouseId()), auction->item_template, auction->startbid, currentPrice, auction->buyout);
src/AuctionHouseBot.cpp:273
Buy()silently returns whengBotsIdis empty, which can make misconfiguration or init-order problems hard to diagnose at runtime. Consider logging (ideally once) before returning so operators can see why the buyer loop is doing nothing.
if (gBotsId.empty())
{
return;
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Player auctions were never bought or only cycles later (#28). Verified live: the 5 lowest-ID player auctions were permanently above the bot's buy cap, and because skips consumed the 5-bids-per-15-min budget and the candidate set was scanned lowest-ID-first, buyable auctions further down the queue (e.g. Runed Copper Bracers at 21090 vs cap 21709) were never even evaluated. Two auctions the bot had bid on were frozen until expiry by the buyguid exclusion.
Changes (all in
Buy())BidsPerIntervalbudget, only successful bids/buyouts do. Each candidate is evaluated at most once per run.avg + (avg - min)to exactly avg while the seller lists at avg +-10%.Notes
BidsPerIntervalset pops; that's tens of rows on a bot-populated AH.Verification
AuctionHouseBot.cpp.ocompiles clean on testcore (GCC 12, -Werror).opsDoneincrements exactly once per DB-writing operation, no self-outbid path, includes already present.Closes #28