Provides per-bot combat phase detection (Opener/Sustained/Execute/Finishing)
with spec-specific thresholds and rotation guidance for all 39 specializations.
Each spec has configured execute threshold (20-35%), opener duration (3-8s),
stealth opener flags, execute spell IDs, opener burst CD sequences, and
resource pooling guidance. Integrates with rotation systems via
ShouldPrioritizeSpell() and IsExecuteAbility() queries.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Introduces ShardedMetricsCollector with 256 independent shards for per-bot
performance metrics (AI decision, combat rotation, target selection, etc.).
Each shard has its own std::shared_mutex enabling parallel reader access
(3-5x faster than recursive_mutex for 500+ bots). Also upgrades the existing
Session/BotPerformanceMonitor to use std::shared_mutex for its system-level
tick metrics, replacing OrderedRecursiveMutex. All read-only operations
(reports, queries, degradation checks) now use shared_lock for zero-contention
concurrent access.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Detects when major burst cooldowns are 3-5 seconds from ready and signals
rotation systems to pool resources (energy/rage/mana/etc.) so bots enter
burst windows at 80-95% resource. Supports all 25+ DPS specs with per-spec
burst CD definitions and progressive pooling intensity (light/moderate/aggressive).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Automatically classifies nearby hostile creatures by combat role (healer,
explosive, fixate, enraged, shielding, summoner, berserker) using creature
template data and active spell/aura analysis. Generates role-adjusted
priority scores so tanks pick up loose adds, ranged DPS handle explosives,
and all DPS focus healer adds first. Supports M+ affix awareness
(bolstering, bursting, raging, spiteful) and encounter context scaling.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Bridges InterruptAwareness spell cast detection to damage estimation,
enabling bots to trigger defensive cooldowns BEFORE damage lands rather
than reactively after health drops. Three-phase prediction: active spell
casts via SpellInfo analysis, melee attackers via threat list, and
historical DPS extrapolation. Produces time-bucketed forecasts (1/2/3/5s)
with severity classification and role-aware defensive recommendations.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Two-phase validation system that catches stale/invalid spell IDs at server
startup instead of silently failing during combat:
Phase 1 - ClassSpellDatabase: Validates all spell IDs stored in rotation,
defensive, cooldown, healing tier, fallback chain, and interrupt maps for
all 39 specs across 13 classes.
Phase 2 - Constexpr SpellValidation: Validates ~1925 constexpr spell ID
definitions from SpellValidation_WoW120.h and SpellValidation_WoW120_Part2.h
via per-class registration functions for all 13 classes.
Uses sSpellMgr->GetSpellInfo(spellId, DIFFICULTY_NONE) for validation.
Logs per-spec breakdowns for specs with errors plus aggregate summary.
Called automatically at end of ClassSpellDatabase::Initialize().
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Replace the broken role-based system (SetRoleRequirement never called, all bots
default to ROAMER) with dynamic behavior trees in each BG script. This extends
the Temple of Kotmogu "lighthouse pattern" to all 13 battlegrounds.
Phase 1 - Shared utilities added to base classes:
- BGScriptBase: EngageTarget, FindNearestEnemyPlayer, PatrolAroundPosition
- CTFScriptBase: RefreshFlagState, RunFlagHome, PickupEnemyFlag, HuntEnemyFC,
EscortFriendlyFC, DefendOwnFlagRoom, ReturnDroppedFlag
- DominationScriptBase: RefreshNodeState, CaptureNode, DefendNode,
FindNearestCapturableNode, GetBestAssaultTarget
Phase 2-7 - ExecuteStrategy behavior trees for all 13 BGs:
- CTF: WarsongGulch, TwinPeaks (phase-aware flag priority trees)
- Domination: ArathiBasin (3-cap), BattleForGilneas (2-cap), DeepwindGorge,
SeethingShore (dynamic nodes), EyeOfTheStorm (hybrid CTF/domination)
- Siege: AlteracValley (phase-based), StrandOfTheAncients, IsleOfConquest
- ResourceRace: SilvershardMines (cart escort + lane control)
- Epic: Ashran (road push with event objectives)
Phase 8 - BattlegroundAI.cpp cleanup:
- Reduced from 2,418 to 429 lines (-82%), header from 463 to 164 lines (-65%)
- Removed all legacy behavior methods, strategy structs, role management
- Kept thin dispatch layer, coordinator registration, profiles, metrics
Key patterns applied from ToK lighthouse:
- GUID-hash duty split for deterministic task distribution
- RefreshState throttled to 1s at top of each ExecuteStrategy
- EngageTarget (SetSelection + Attack) at every engagement point
- Phase-ignoring GO search for dynamically spawned BG objects
- Thin delegation: if (script->ExecuteStrategy(player)) return
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Implements comprehensive consumable management system:
- Pre-combat buffing: flasks/phials, food (Well Fed), augment runes
with context-aware usage (only in dungeons/raids/delves)
- Combat emergency: health potions at <=30% HP, healthstones at <=35% HP,
mana potions at <=20% mana for healers/casters
- Combat DPS potions: role-appropriate potions during burst windows
- Content-type detection: Open World, Dungeon, Raid, PvP, Delve
- Role detection: Tank, Healer, Melee DPS, Ranged DPS, Caster DPS
Consumable databases cover TWW, Dragonflight, Shadowlands, BfA, Legion,
WoD, and Classic-era items with priority-based selection (best first).
Buff state detection scans active auras for flask/food/rune patterns.
Per-bot instance owned by GameSystemsManager, updated at REDUCED+ tier
with internal throttling (5s out of combat, 500ms in combat).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Add proc tracking and rotation-integrated consumption for:
- Devastation Evoker: Essence Burst (free Disintegrate/Pyre in ST/AoE/burst)
- Preservation Evoker: Essence Burst (free Emerald Blossom/Verdant Embrace)
- Restoration Shaman: Tidal Waves (2-stack system from Riptide/Chain Heal,
consumed by Healing Surge for +40% crit or Healing Wave for +20% speed)
- Shadow Priest: Surge of Insanity (from Devouring Plague, consumed as
Mind Flay: Insanity or Mind Spike: Insanity based on talent detection)
- Subtlety Rogue: Shadow Techniques (passive auto-attack proc granting
1 combo point + 8 energy with edge detection)
- Guardian Druid: Gore (Mangle reset + 4 extra rage, priority over normal Mangle)
- Restoration Druid: Clearcasting/Omen of Clarity (free instant Regrowth
on most injured group member)
Also adds GORE, CLEARCASTING_RESTO, SURGE_OF_INSANITY, MIND_FLAY_INSANITY,
MIND_SPIKE_INSANITY, and DEATHSPEAKER spell IDs to validation registries.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
The coordinator role system never populated role requirements, causing all
bots to default to ROAMER. This meant no carriers were defended, no enemy
carriers were hunted, and bots wandered aimlessly after picking up orbs.
Replace the role switch with per-tick game state evaluation:
- Priority 1: Orb carriers always move to center (never stop for combat)
- Priority 2: Free orbs get picked up (with bot-splitting via m_orbTargeters)
- Priority 3: GUID-hash duty split - 2/3 escort friendly carriers, 1/3 hunt
enemy carriers, with center-carrier priority weighting
- Priority 4: No carriers - patrol center and fight enemies
Also fix carrier en-route combat that blocked center movement with a
return-true when enemies were within 10yd. Carriers now initiate attack
(so class AI casts abilities) but always continue waypoint movement.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Add in-game commands to toggle and manage bot cheats via BotCheatMask:
- .bot cheat <name> — toggle a cheat on selected/group bots
- .bot cheat list — show available cheats and active cheats
- .bot cheat off — clear all cheats on selected/group bots
- .bot cheat mult <type> <value> — set speed/damage/XP multipliers
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Gate AI subsystems by RPG state to skip unnecessary work in passive states,
reducing CPU per-bot by 30-60% for bots in low-activity states. Three tiers:
FULL (combat/quest/dungeon), REDUCED (travel/city - movement+safety only),
MINIMAL (idle/resting - safety-critical only). Complements existing ST-1
frequency throttling with scope-per-update reduction. Instant combat
escalation ensures bots under attack switch to FULL within one server tick.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
EnchantGemDatabase now loads entirely from DB2 stores (SpellItemEnchantment,
GemProperties, ChrSpecialization) at startup, scoring each enchant/gem against
spec role and primary stat priorities. Removes all hardcoded SQL data and drops
the now-unnecessary playerbot_enchant_recommendations and
playerbot_gem_recommendations tables. Also replaces hardcoded skill IDs in
GuildTaskManager with SharedDefines enums.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
GuildTaskManager, AccountLinkingManager, ChatTemplateManager, and
EnchantGemDatabase were incorrectly using CharacterDatabase for their
queries. All playerbot tables live in the dedicated playerbot database
accessed via sPlayerbotDatabase.
Changes per file:
- Replace #include "DatabaseEnv.h" with "Database/PlayerbotDatabase.h"
- Replace CharacterDatabase.Query() with sPlayerbotDatabase->Query()
- Replace CharacterDatabase.DirectExecute() with sPlayerbotDatabase->Execute()
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Five behavioral gaps fixed in Temple of Kotmogu bot AI:
1. Carrier fights while traveling to center: Carriers now engage enemies
within 15yd en route instead of being passive targets. Chase within
10yd, attack-and-continue for 10-15yd enemies.
2. Proactive escort combat: Escorts now engage the closest enemy within
20yd of the carrier regardless of carrier combat state, instead of
waiting until the carrier is already being attacked.
3. Dropped orb rush: Any bot within 40yd of a free orb rushes to pick
it up, overriding assigned role. Prevents orbs sitting on ground
while bots escort/hunt/defend elsewhere.
4. Contested orb fighting: When PickupOrb finds no GO (orb was taken),
bots engage nearby enemies at the location instead of standing idle.
5. Carrier kiting in center: When HP 30-60% and 2+ enemies within 10yd,
carrier moves away from enemy cluster while staying in center zone,
maintaining attack on closest enemy.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
- Add player->Attack(enemy, true) at all 15 enemy engagement points
across BattlegroundAI.cpp (7 sites) and TempleOfKotmoguScript.cpp
(8 sites). Without Attack(), bots only did SetSelection+ChaseTarget
which is movement-only — combat never started, no PvP occurred.
- Fix ToK CENTER_X/Y from (1732,1287) to (1783.5,1333.4) — the actual
geometric center of the 4 orb positions. Old coords were ~69yd off,
causing carriers to navigate to the wrong location.
- Simplify carrier movement to always push center for 3-6x scoring
bonus instead of requiring 2+ orbs and time conditions.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
- Replace phase-sensitive GetGameObjectListWithEntryInGrid with
GetGameObjectListWithOptionsInGrid (IgnorePhases=true) for ToK orb
pickup. Dynamically spawned BG orbs may not share bot PhaseShift,
causing silent filter in grid search VisitImpl().
- Add ProcessPendingPopulations() retry system in BGBotManager that
retries PopulateBattleground every 5s for up to 2 minutes after BG
start, fixing 8v5 starts caused by warm pool bots still in async login.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Add explicit BATTLEGROUND_TK and BATTLEGROUND_SM cases to GetBGTeamSize()
(return 10) and GetBGMinPlayers() (return 5). Fix QueueStatePoller DBC
fallback which incorrectly divided BattlemasterListEntry::MaxPlayers by 2
(the field is already per-team, as GetMaxPlayersPerTeam() returns it
directly). Use BGBotManager::GetBGTeamSize() as primary fallback instead
of the DBC lookup.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Replace broken event-based orb tracking (ORB_PICKED_UP never fired) with
aura-based RefreshOrbState() that scans all BG players for orb auras every
second. Add m_orbTargeters map to distribute bots 1-per-orb instead of all
targeting the same one. Clear targeting when no GO found at orb location so
bots fall through to escort/hunt instead of looping. Add EscortOrbCarrier
fallback for ORB_CARRIER role when no orbs are available.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Three fixes for BG bot lifecycle issues:
1. End BG when last human leaves: MonitorActiveBattlegrounds() now checks
for human presence in active BGs. After a 30s grace period with no
humans, the BG ends as a draw via EndBattleground(TEAM_OTHER).
2. Release and logout BG bots on BG end: OnBattlegroundEnd() now releases
pool bots via InstanceBotPool::ReleaseBot(), logs out all BG bots via
BotWorldSessionMgr::RemovePlayerBot(), and notifies the orchestrator
via OnInstanceEnded(). Previously only tracking maps were cleared.
3. Fix zone spawner over-spawning with no humans: CalculateTargetBotCount()
now uses _lastRealPlayerCount (humans only) instead of the broken
condition that always applied minimums in static mode or counted bot
sessions as active players.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Update COMPREHENSIVE_AUDIT_REPORT.md and INCOMPLETE_IMPLEMENTATIONS_REPORT.md
to document the February 2026 TODO cleanup results: 50 TODOs resolved across
29 files, 15 MIGRATION markers standardized across 6 files, zero remaining
production TODOs verified by codebase scan.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Resolve 50 TODO comments across 29 production files and standardize 15 MIGRATION
comments across 6 files, achieving zero remaining TODOs in production code.
Implementations:
- DemandCalculator: IsQuestHub() via QuestHubDatabase, GetBotCountInZone() via BotSpawner
- QuestPathfinder: Replace hardcoded RUN_SPEED with player->GetSpeed(MOVE_RUN)
- PlayerbotGroupScript: Add bot detection via PlayerBotHooks::IsPlayerBot()
Comment standardization:
- TODO stubs → DESIGN/LIMITATION/ARCHITECTURE documentation comments
- MIGRATION COMPLETE noise → descriptive architectural comments
- Empty/stale TODOs removed entirely
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Add `override` keyword to all virtual function overrides across 16 BG
script headers to catch signature mismatches at compile time.
Extract virtual calls (GetNodeCount/GetNodeData) from
DominationScriptBase::OnLoad into a new InitializeNodeTracking() method
called by derived classes after base OnLoad completes. This avoids
virtual dispatch at the fragile IBGScript/DominationScriptBase vtable
slot boundary, where MSVC RelWithDebInfo builds with stale .obj files
could route GetNodeCount (returns uint32, RCX=this) through
GetObjectivePath (returns std::vector<Position>, RCX=hidden_return,
RDX=this), causing ACCESS_VIOLATION when RDX=0.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Coordinator Initialize() accesses Battleground data (GetPlayers, GetMapId),
loads BG scripts, and runs map grid operations (FindNearestGameObject 500yd)
which are NOT thread-safe. The previous commit moved Initialize() outside
the lock but still ran it on worker threads, causing ACCESS_VIOLATION in
TempleOfKotmoguScript::OnLoad -> DominationScriptBase::OnLoad vtable crash.
Fix: Worker threads now queue creation requests via _pendingCreations map.
The main thread processes them in Update() -> ProcessPendingCreations()
where Battleground access is safe. Coordinator available within one tick.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
BattlegroundCoordinatorManager held _mutex during expensive coordinator
Initialize() (grid scans, pathfinding, script loading) and Update() calls,
blocking all worker threads from GetCoordinatorForPlayer() lookups. This
caused thread pool timeouts and bots standing idle at spawn.
Fix: copy-and-release pattern - only hold _mutex for map insert/find/erase,
never during coordinator operations. Added _creatingCoordinators guard to
prevent redundant Initialize() calls from multiple worker threads.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Two root causes for idle bots and over-population in battlegrounds:
1. BGScriptRegistry had 0 registered scripts at runtime. The
REGISTER_BG_SCRIPT macro uses static global constructors for
auto-registration, but MSVC's linker dead-strips object files from
static libraries when no external symbol references them. The previous
ForceInclude/volatile-pointer pattern did not prevent this.
Fix: Replace with explicit RegisterScript() calls in
InitializeBGScripts() for all 14 BG map IDs.
2. QueueStatePoller kept re-polling every 5-10 seconds after assigning
warm pool bots. Since bots take time to login and enter the queue
asynchronously, the poller saw "0/10 Alliance, 0/10 Horde" on each
poll and spawned another full batch (14 rounds = ~280 bots for 10v10).
Fix: Unregister the BG queue from the poller immediately after the
warm pool (or JIT) fully satisfies the demand. Also copy the active
queue set before iterating to avoid iterator invalidation.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>