BotActionProcessor::GetBot() used ObjectAccessor::GetPlayer(nullptr, guid)
which compares player->GetMap() == nullptr — always false for bots on BG
maps. This caused 100% action failure rate (39/39 failed). All deferred
actions (orb pickup, flag capture, node interaction) were silently dropped.
Fix: Use ObjectAccessor::FindPlayer(guid) which does a global lookup
without map comparison.
Also adds TrimExcessBotsLocked() to detect and remove excess bots when
teams are overpopulated, called from both PopulateBattlegroundLocked()
and ProcessPendingPopulations().
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Replace TerrainMgr::GetZoneId() calls with direct reads from the
gameobject table's zoneId/areaId columns. This avoids loading 62+ map
terrain trees (with recursive child maps, grid file I/O, and VMap/MMap
load/unload cycles) during startup.
destinationZoneId is unused by any consumer — the travel route planner
already uses exact destinationPosition coordinates for distance-based
routing, which is strictly more precise than zone-level comparison.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Implements the previously unhandled CMSG_SET_CURRENCY_FLAGS opcode, which
allows players to toggle per-currency display preferences (e.g. "Show on
Backpack"). Wire format decoded from IDA disassembly of WoW 12.x client:
{ uint32 CurrencyID; uint8 Flags; }
Changes:
- Add SetCurrencyFlags ClientPacket class (MiscPackets.h/cpp)
- Add Player::SetCurrencyFlags() with ClientFlags mask validation
- Add WorldSession::HandleSetCurrencyFlags() with DB2 currency validation
- Wire opcode as STATUS_LOGGEDIN, PROCESS_THREADUNSAFE
The flags (CurrencyDbFlags::InBackpack, UnusedInUI) are persisted via the
existing _SaveCurrency() path — no schema changes needed.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
GetZoneIdForPosition() calls sTerrainMgr.GetZoneId() per portal, which
uses weak_ptr caching. During startup no Map objects hold terrain refs,
so each call loads the entire terrain tree from disk (including all child
instance maps) then immediately unloads it. For continent maps with dozens
of children, this repeats hundreds of times causing extreme startup delay.
Hold shared_ptr<TerrainInfo> in a temporary cache during initialization so
each map's terrain is loaded exactly once.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Two critical bugs fixed:
1. BotActionManager::ProcessActions() was never called in production.
The BotActionManagerSubsystem had updateOrder=0 (never updated) and
no Update() method. All deferred actions (INTERACT_OBJECT, ENTER_VEHICLE,
etc.) queued by worker threads accumulated forever without execution.
This broke ToK orb pickup, CTF flag return, node captures, vehicle
boarding, and all other deferred GO interactions added in Phase 1A.
Fix: Added Update() override with updateOrder=250.
2. Dead bots in BGs ran to their corpse instead of resurrecting.
HandleResurrecting with AUTO_RESURRECT passively waited 30s for
IsAlive(), but BG spirit guides require gossip interaction that bots
never perform. After timeout, retry via GHOST_DECIDING could choose
CORPSE_RUN if BG ended during the wait (InBattleground() false).
Fix: Force-resurrect bots in BGs after 30s wave timer instead of
falling through to corpse run retry path.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
- Fix silent orb pickup failure: deferred Use() via BotActionMgr caused bots
to move away before main thread processed the spell cast. Added
m_pendingOrbPickup hold-position state so bots stay at orb for up to 2s
until the main thread processes the deferred GO interaction.
- Fix uneven orb split (1 vs 8+ bots): replaced race-prone m_orbTargeters
map with GUID-based deterministic slot assignment (GUID % ORB_COUNT with
round-robin fallback) for even distribution without shared mutable state.
- Fix missing combat engagement: bots now check for nearby enemies via
coordinator during orb approach movement and initiate Attack().
- Fix claim-aware hasFreeOrb: ExecuteStrategy Priority 2 now skips orbs
with active m_orbClaimedUntil and m_orbSearchFailed cooldowns, so bots
correctly fall through to escort/hunt instead of re-entering PickupOrb.
- Fix carrier waypoint oscillation: replaced forward-only waypoint scan
with center-distance comparison so carriers don't oscillate between
midway waypoint and center.
- Fix missing OnBattlegroundEnd hook: PlayerbotBGScript now detects
STATUS_WAIT_LEAVE transition and calls BGBotManager::OnBattlegroundEnd()
to prevent resource leaks and dangling pointers.
- Fix Map::SendObjectUpdates crash: RemovePlayerBot now clears Account
and Item BaseEntity objects from _updateObjects, not just Player.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Bug 1: BG under-population (7v4) - Skip bots on wrong map in in-transit
counting. Bots that failed teleport sit on their home map but were
counted as "in-transit", making teams appear full prematurely.
Bug 2 (CRITICAL): Spatial cache faction bug - BGSpatialQueryCache used a
single _faction from the first bot for ALL enemy/ally queries. Half the
bots saw their own team as enemies and enemies as allies. Added
callerFaction parameter to all 8 spatial query methods and excludeGuid
to GetNearestEnemy to prevent self-targeting. Updated all 15 call sites
across BGScriptBase, CTFScriptBase, and TempleOfKotmoguScript.
Bug 3: Dual orb pickup race - Two bots at orb location could both call
Use() in the same tick before RefreshOrbState() detected the aura. Added
m_orbClaimedUntil timestamp map with 3-second claim window.
Bug 4: Carrier circling - Fully caused by Bug 2. Carrier's
GetNearestEnemy() returned itself, causing self-attack which disrupted
movement. Resolved by callerFaction + excludeGuid parameters.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
When a human queued for a BG, warm pool bots failed to populate the
queue due to 5 cascading failures:
1. Human player was only registered in _humanPlayers after botsQueued>0,
but warm pool bots are async so botsQueued=0 — human never tracked,
breaking GetQueuedHumanForBG() for all warm pool bots
2. Dead bots from previous sessions silently failed IsBotAvailable()
with no logging — 10/19 warm pool bots rejected
3. IsBotAvailable() had no diagnostic logging for any rejection path
4. QueueStatePoller immediately unregistered after warm pool claimed
success, with no verification that bots actually queued
Fixes:
- Move human registration before bot loop (always register)
- Resurrect dead bots in BotPostLoginConfigurator before BG queue
- Add TC_LOG_DEBUG to every IsBotAvailable rejection path
- Replace immediate unregister with 30s verification re-poll that
re-registers the queue if actual counts are insufficient
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
BotPacketSimulator previously polled every 100ms scanning all 9 speed types
plus teleport/knockback/magnitude flags for every bot. Now BotSession::SendPacket()
intercepts outgoing SMSGs and sets atomic flags via OnPacketSent(), and Update()
processes only the flagged ACKs with O(1) cost when idle.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
- TankSwapCoordinator: Automated tank swap detection with taunt rotation and debuff tracking
- CooldownSyncCoordinator: Raid-wide defensive/offensive CD synchronization with priority queuing
- StructuredCombatLog: Ring-buffer combat event logging with DPS/HPS metrics and encounter tracking
- ReagentManager: Reagent/consumable inventory management with auto-purchase and crafting support
- TransmogManager: Per-bot transmog outfit management with appearance collection and themed outfits
- ArchaeologyManager: Full archaeology profession state machine (survey/triangulate/collect/solve)
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Prevents duplicate raid-wide buff casting when multiple bots of the same
class are in a group. Uses claim-based system: bot claims buff responsibility,
others skip. Tracks 7 WoW 12.0 categories (Intellect, Stamina, Versatility,
Attack Power, Physical/Magic damage, Movement Speed).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Tracks packet counts, bytes sent/received, and filter savings per bot
session. Provides per-opcode breakdown, top-N bots by bandwidth, and
formatted reports. Uses sharded atomic counters for lock-free recording.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Tracks water state (DRY/WADING/SWIMMING/UNDERWATER/SURFACING/DROWNING),
monitors breath timer, and triggers proactive surfacing at 30% breath.
Detects water breathing auras and aquatic form availability for druids.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Enables operators to set verbose log levels (DEBUG/TRACE) for individual
bots without flooding logs from hundreds of other bots. Supports category
filters, timed auto-expiry, and convenience macros (BOT_LOG_DEBUG, etc.).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Tracks active proc auras and escalates rotation priority when procs are
about to expire unused. Covers all major class procs (Hot Streak, Brain
Freeze, Rime, Art of War, Maelstrom Weapon, etc.) with configurable
urgency thresholds and stack-aware consumption logic.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Bots now auto-respond to warlock summons and meeting stone requests with
human-like delays (1.5-4s randomized). Evaluates combat state, CC, BG/arena,
and group membership before accepting. Tracks summon history and statistics.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Implements RacialAbilityManager with complete database of racial abilities
for all 25+ playable races including TWW Earthen. Evaluates racials by
priority: CC-break > defensive > offensive (burst-aligned) > resource >
AoE CC. Includes spell availability validation, cooldown tracking, burst
window detection, and CC-state awareness.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Adds a .bot config reload chat command that reloads playerbots.conf,
synchronizes runtime ConfigManager, refreshes BotSpawner config, and
reloads trade configuration. Reports per-subsystem success/failure with
step counts. Also available from server console.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Implements CombatMetricsTracker providing WoW-style damage/healing meters:
rolling-window DPS/HPS/DTPS, per-spell breakdowns with crit rates and
efficiency, encounter tracking with auto-detect, formatted reports for
chat commands, and session history. Uses fixed-size circular buffer for
zero-allocation combat event recording.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Implements StringInterningPool with shared_mutex for read-heavy concurrent access,
FNV-1a hashing, transparent heterogeneous lookup via string_view, and per-category
profiling. Pre-interns common class/spec/resource names at startup. Eliminates
duplicate string allocations across all bot instances (~6.4MB savings at 500 bots).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Implements ProactiveLoSFixer component that intercepts spell cast
attempts, checks LOS, and repositions the bot to a valid position
before casting. Completes all missing LineOfSightManager method
implementations and upgrades MovementIntegration to use smart
position-finding instead of naive movement toward target.
Key additions:
- ProactiveLoSFixer: pre-cast LOS check with queued cast + reposition
- Healer group LOS maintenance: proactive repositioning to see group
- 30+ missing LineOfSightManager method implementations completed
- LoSUtils::DoLinesIntersect segment intersection implementation
- MovementIntegration::CheckLineOfSight upgraded to use FindBestLoSPosition
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
Per-bot component that scans EQUIPMENT_SLOT_TRINKET1/TRINKET2 for
items with ITEM_SPELLTRIGGER_ON_USE effects and activates them at
optimal times during combat:
- Offensive trinkets: aligned with burst/opener windows, then on-CD
- Defensive trinkets: reactive when health drops below 35%
- PvP trinkets: reactive CC-break on stun/fear/charm/confuse
- Utility trinkets: used on cooldown for maximum uptime
Features:
- SpellInfo-based effect classification (aura types determine category)
- Equipment change detection via lightweight checksum comparison
- Cooldown tracking via SpellHistory::HasCooldown()
- CastSpellExtraArgs(item) for proper item-sourced spell casting
- 500ms update throttle to minimize per-bot overhead
- Debug summary for diagnostics
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: luis <[email protected]>
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]>