Skip to content

feat(Core/Playerbots): add auction house botting#2

Open
scarecr0w12 wants to merge 13 commits into
feature/playerbot-farming-rpg-splitfrom
feature/playerbot-ah-split
Open

feat(Core/Playerbots): add auction house botting#2
scarecr0w12 wants to merge 13 commits into
feature/playerbot-farming-rpg-splitfrom
feature/playerbot-ah-split

Conversation

@scarecr0w12

Copy link
Copy Markdown
Collaborator

Summary

This PR adds auction house botting on top of the farming RPG base branch.

It includes:

  • AH buy/sell actions
  • AH routing from RPG flow
  • pricing and policy helpers
  • AH config toggles
  • AH policy SQL
  • farming-to-AH handoff once bots have enough auctionable inventory

Depends On

Base branch: feature/playerbot-farming-rpg-split

Scope

  • AH item usage classification
  • AH sell and buy flow
  • AH routing and gating in RPG behavior
  • pricing, policy, and helper utilities
  • AH SQL update and config toggles

Testing

Not run during branch split. Recommend build plus targeted in-game validation of:

  • item classification
  • vendor vs AH routing
  • farming to AH handoff
  • auction posting behavior

Notes

This PR is intentionally stacked on the farming RPG branch so the dependency is explicit and reviewable.

@augmentcode

augmentcode Bot commented Mar 26, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds opt-in auction house botting for playerbots and wires it into existing RPG/travel behavior.

Changes:

  • Introduces config toggles for enabling AH botting plus pricing/undercut/stack sizing and excluded item IDs.
  • Adds a DB policy table (playerbots_auction_item_policy) and a loader to drive per-item sell rules.
  • Updates item usage classification to mark eligible items as ITEM_USAGE_AH (with reagent/material exceptions).
  • Implements AH sell flow via SellAction and world-thread AuctionSellOperation, including market-snapshot pricing.
  • Implements AH buy flow via BuyAction and world-thread AuctionBuyOperation.
  • Extends RPG/travel target selection to visit auctioneers when bots have auctionable inventory.

Technical Notes: Uses PlayerbotWorldThreadProcessor to run packet-facing buy/sell operations on the world thread and adds helper utilities for preferred AH item detection.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 3 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

}
case RPG_FARMING:
{
<<<<<<< HEAD

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unresolved merge-conflict markers (<<<<<<<, =======, >>>>>>>) are committed here, which will break compilation. This should be resolved so only the intended RPG_FARMING auction-visit logic remains.

Severity: high

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

{
auto& data = std::get<NewRpgInfo::GoGrind>(info.data);
WorldPosition& originalPos = data.pos;
assert(data.pos != WorldPosition());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In RPG_GO_GRIND (and similarly RPG_GO_CAMP), data/originalPos are referenced after their declarations were removed, so this code won’t compile and the status transition logic can’t run. Consider restoring the correct std::get<...>(info.data) and originalPos bindings for each case.

Severity: high

Other Locations
  • src/Ai/World/Rpg/Action/NewRpgAction.cpp:89
  • src/Ai/World/Rpg/Action/NewRpgAction.cpp:97

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

return snapshot;

uint64 totalUnitBuyout = 0;
for (auto itr = auctionHouse->GetAuctionsBegin(); itr != auctionHouse->GetAuctionsEnd(); ++itr)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This iterates AuctionHouseObject directly; if playerbot AI runs in map threads while auctions are mutated in the world thread, this can race and invalidate iterators/pointers. Consider ensuring auction scanning/snapshotting happens on the world thread or under the same synchronization used for auction mutations.

Severity: medium

Other Locations
  • src/Ai/Base/Actions/BuyAction.cpp:275
  • src/Ai/Base/Actions/SellAction.cpp:95

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

scarecr0w12 added a commit that referenced this pull request Jun 12, 2026
… idempotency

## Critical Fixes Applied

### 1. Fix GetCurrentRealmId() source of truth (Issue #1)
- Changed from sConfigMgr config read to global realm.Id.Realm
- Fixes default mismatch (0 vs 1) that caused realm ID collisions
- Added Realm.h include for proper type consistency
- Added validation: refuse ownership operations if realm ID is 0
- Added error logging to alert misconfigured systems

### 2. Make base SQL idempotent (Issue #2)
- Removed destructive DROP TABLE IF EXISTS from base schema
- Changed to CREATE TABLE IF NOT EXISTS
- Prevents data loss if schema hash changes trigger re-apply
- Applied to: data/sql/auth/base/playerbots_account_ownership.sql

### 3. Add guard clauses for invalid realm IDs
- GetOwnedRandomBotAccounts(): Refuse to fetch if realmId == 0
- CreateRandomBots(): Refuse to create/delete if realmId == 0
- Includes error logging for each guard

### 4. Remove legacy redundant sql/ folder
- Commit 76b7815 migrated everything to data/sql/ per AzerothCore standards
- sql/ was accidentally populated in this PR (duplicates only)
- Removed sql/auth/* files to maintain single source of truth

## Validation
- Code follows AzerothCore realm ID patterns (realm.Id.Realm)
- SQL schema now safe for multi-realm, multi-apply scenarios
- No longer possible to silently reintroduce cross-realm destruction

Fixes review comments from Celandriel (automated code review)
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

Successfully merging this pull request may close these issues.

1 participant