Skip to content

[AH] Auction house bot and service as modules - #487

Draft
H0zen wants to merge 3 commits into
mangoszero:masterfrom
H0zen:core/modules
Draft

H0zen wants to merge 3 commits into
mangoszero:masterfrom
H0zen:core/modules

Conversation

@H0zen

@H0zen H0zen commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Moves the in-process auction house bot and the out-of-process AH service out of the core into modules.

Rule: every module has, and must have, its own .conf, whose first key is Enable; it is installed with the module. mangosd.conf knows no module.

Core

  • AuctionHouseModule / AuctionHouseModules (src/game/Object/AuctionHouseModule.h): lifecycle, commands, book queries and request hooks. Modules register from a static object; the core never names one.
  • AuctionHouseHandler, AuctionHouseMgr, Mail, World, WorldConfig, WorldSession, ObjectMgr, Player: every AH service branch, type and setting removed; the module hooks are called instead.
  • The forged "AuctionHouse" bot owner (GUID 0xFFFFFFFE) is removed.
  • Player::CanUseItem checks inline again (no AhUsabilityRef).
  • ChatCommand takes a free-function handler; module command tables are merged into the root table, sorted by name.
  • MailDraft::SendMailToInTransaction takes a plain list of after-commit effects.
  • mangosd: -t runs tests registered with RegisterMangosdTest; -a sets the bot config file through AuctionHouseModules; modules stop after the maps unload.
  • mangosd.conf: no AH service keys; ConfVersion bumped.

Modules

  • src/modules/AuctionHouseBot: the in-process bot. BUILD_AHBOT (default ON), Enable first in ahbot.conf (ConfVersion bumped), .ahbot commands.
  • src/modules/AhService: IPC, worker, custody, intent executor, .ah commands and its self-tests. BUILD_AH_SERVICE (default OFF). All its keys are in ah-service.conf with Enable first; AH.Service.Enabled is now AH.Service.Worker; AH.Service.Config is gone (the worker gets the same file).
  • .ah reload and .ah status take over the service parts of .ahbot reload / .ahbot status.
  • The playerbots' ike3 AhBot (src/modules/Bots/ahbot) is no longer built; src/modules/Bots/AhBotPrices.cpp answers its price queries as before (0, 0, 1.0).

Fixes

  • Cancelling an auction no longer aborts the server: the mails were sent inside the open transaction and opened a nested one (MANGOS_ASSERT in TransHelper::init). They now write into it, and their live effects run after the commit.
  • AuctionHouseBot seller prices: 64-bit math, saturated to uint32 (was a 32-bit wrap and an out-of-range conversion).

Docs

  • CLAUDE.md, extra/doc/AuctionHouseBot.md, src/modules/AhService/README.md.
  • KNOWN_DEFECTS.md in both modules, from a review of the split. The listed defects predate it.

Verified

  • Release builds with PCH=0, AH service and playerbots on: MSVC (Windows), clang 19 (FreeBSD 15), gcc 13 (Ubuntu 24.04). 0 errors, no new warnings.
  • Also built without the AH service.
  • ah-service --selftest passes.
  • The 19 mangosd -t service tests pass on a copy of a character database, with both modules loaded.
  • mangosd starts, runs the world loop and shuts down cleanly with both modules enabled.
  • install places ahbot.conf.dist and ah-service.conf.dist in the config directory.

🤖 Generated with Claude Code


This change is Reviewable

H0zen and others added 2 commits October 3, 2026 02:59
Rule: every module has, and must have, its own .conf, whose first key is
Enable; it is installed with the module. mangosd.conf knows no module.

Core:
- Add AuctionHouseModule / AuctionHouseModules (src/game/Object/AuctionHouseModule.h):
  lifecycle, commands, book queries and request hooks; modules register from a
  static object, the core never names one.
- AuctionHouseHandler, AuctionHouseMgr, Mail, World, WorldConfig, WorldSession,
  ObjectMgr, Player: drop every AH service branch, type and setting; call the
  module hooks instead.
- Remove the forged "AuctionHouse" bot owner (GUID 0xFFFFFFFE).
- Player::CanUseItem checks inline again (no AhUsabilityRef).
- ChatCommand takes a free-function handler; module command tables are merged
  into the root table, sorted by name.
- MailDraft::SendMailToInTransaction takes a plain list of after-commit effects.
- mangosd: -t runs tests registered with RegisterMangosdTest; -a sets the bot
  config file through AuctionHouseModules; modules stop after the maps unload.
- mangosd.conf: no AH service keys; ConfVersion bumped.

Modules:
- src/modules/AuctionHouseBot: the in-process bot, BUILD_AHBOT (default ON),
  Enable as the first key of ahbot.conf (ConfVersion bumped), .ahbot commands.
- src/modules/AhService: IPC, worker, custody, intent executor, .ah commands and
  the self-tests, BUILD_AH_SERVICE (default OFF), all its keys in
  ah-service.conf with Enable first (AH.Service.Enabled is now
  AH.Service.Worker; AH.Service.Config is gone, the worker gets the same file).
- .ah reload and .ah status take over the service parts of .ahbot reload/status.
- The playerbots' ike3 AhBot (src/modules/Bots/ahbot) is no longer built;
  src/modules/Bots/AhBotPrices.cpp answers its price queries as before
  (0, 0, 1.0).

Fixes:
- Cancelling an auction no longer aborts the server: the mails were sent inside
  the open transaction and opened a nested one (MANGOS_ASSERT). They now write
  into it and their live effects run after the commit.
- AuctionHouseBot seller prices: 64-bit math, saturated to uint32 (was a 32-bit
  wrap and an out-of-range conversion).

Docs:
- CLAUDE.md, extra/doc/AuctionHouseBot.md, src/modules/AhService/README.md.
- KNOWN_DEFECTS.md in both modules, from the review of the split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
slproweb no longer serves the 3.6.4 installer (404); 3.6.5 and its SHA512
are taken from slproweb's published hash list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 1497 complexity · 67 duplication

Metric Results
Complexity 1497
Duplication 67

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

cppcheck variableScope (Codacy): s_lastOverflowWarn and s_lastNearFullWarn
are only used inside one branch each; behaviour unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AppVeyorBot

Copy link
Copy Markdown

@MadMaxMangos

Copy link
Copy Markdown
Member

Discussed with h0zen, this is on hold until after the auction worker is fully completed and this will follow behind and be updated for that.

@MadMaxMangos
MadMaxMangos marked this pull request as draft October 3, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants