Commit Graph
981 Commits
Author SHA1 Message Date
luis 57d072cee8 lua crash 2026-03-26 21:22:51 -03:00
luis da47dd1e47 initial crash fix for eluna 2026-03-26 21:21:07 -03:00
luis 169fb022fa add quest task for wq 2026-03-26 20:55:54 -03:00
luis 6770ccec62 remove unused 2026-03-26 20:40:13 -03:00
luis d8f89644dd delve system part 1 2026-03-26 20:38:54 -03:00
luis 4c3e7d6a74 Add NeedsFood diagnostic, downgrade ObjectiveTracker ERROR to DEBUG 2026-03-26 19:55:29 -03:00
luis 50b4365362 typo 2026-03-26 13:30:52 -03:00
agatho b00b00a753 Blacklist quest givers that return 0 quests to prevent infinite loop
Bots repeatedly interacted with the same NPC (Image of Archmage Xylem)
every tick, getting 0 accepted quests each time but never trying other
NPCs. The spatial grid scan always picked the closest quest giver.

Now tracks NPCs that returned 0 quests in _failedQuestGiverGuids and
skips them in future scans. When all nearby NPCs are blacklisted, the
search falls through to the quest hub / teleport path. The blacklist
clears on teleport (new zone has new NPCs).

Signed-off-by: luis <[email protected]>
2026-03-26 13:30:17 -03:00
luis af47a7f487 Fix log spam, stuck walk detection, and mana snapshot for dual-power classes
- Remove STRAT-SELECT diagnostic (60k lines per session)
- Downgrade CalculateObjectivePriorities from ERROR to TRACE (60k lines)
- Throttle "walking to quest giver" log to once per 5 seconds
- Detect stuck walks (distance not decreasing for 30s) and clear pending
- Fix mana snapshot using GetMaxPower(POWER_MANA) instead of GetPowerType
  so Warlocks (soul shards + mana) and Paladins (holy power + mana) get
  correct mana percentage instead of 100% default
2026-03-26 08:43:39 -03:00
agatho 9755fd11c0 Fix MINIMAL budget tier permanently blocking strategy execution
RPG states IDLE/RESTING/INACTIVE mapped to MINIMAL budget tier which
skipped UpdateStrategies entirely via goto throttled_update_complete.
After death+respawn at spirit healer, the RPG routine classified the
bot as IDLE -> MINIMAL -> strategies never ran -> bot idle forever.

Strategies are what drive bots OUT of idle state (find quest givers,
accept quests, start grinding). They must always run regardless of
budget tier.

Signed-off-by: luis <[email protected]>
2026-03-26 08:35:49 -03:00
agatho 3098d3b6d0 Run quest strategy every frame while walking to quest giver
Signed-off-by: luis <[email protected]>
2026-03-26 08:34:46 -03:00
agatho a65ae5b177 Fix RestStrategy using stale health/mana — GetBotAI always returned null
BotAI doesn't extend PlayerAI/UnitAI, so dynamic_cast<BotAI*>(GetAI())
always returned nullptr. The cached health/mana values were never read,
falling back to stale bot->GetHealthPct() on the worker thread.

RestStrategy already receives BotAI* ai as a parameter — use
ai->GetCachedHealthPct() and ai->GetCachedManaPct() directly instead
of trying to look up BotAI from the Player.

Signed-off-by: luis <[email protected]>
2026-03-26 08:34:00 -03:00
agatho 58335d9b20 Initialize cached state in BotAI constructor to prevent 0,0,0 position on first tick
Signed-off-by: luis <[email protected]>
2026-03-26 08:33:18 -03:00
luis e5b00529c1 lua fixes 2026-03-26 08:32:26 -03:00
luis aae5614085 init implement methods 2026-03-25 20:56:46 -03:00
agatho 6619d78fbc Move bot state snapshot from worker thread to main thread
The state cache (health, mana, position, map, combat) was being
populated at the start of UpdateAI on the worker thread, reading the
same stale data it was trying to avoid. Health showed 53% for hours
while actually 100% because GetHealthPct() returns the value from the
last Player::Update() call on the main thread.

Now BotSession::SnapshotBotState() runs on the main thread from
BotWorldSessionMgr::ProcessAllDeferredPackets(), after Player::Update()
has already run. Worker threads read these cached values which are
guaranteed current.

Uses movespline->ComputePosition() for accurate interpolated position
instead of FinalDestination() which only gives the endpoint.

Signed-off-by: luis <[email protected]>
2026-03-25 19:28:57 -03:00
agatho cbdab1cc13 Cache health/mana/map/combat state for worker thread safety
All bot stats read via GetHealthPct(), GetPowerPct(), GetMapId(),
IsInCombat() are only updated on the main thread during Player::Update.
Worker threads reading them directly get stale data — health showing
53% when actually 100%, causing rest strategy to idle bots for hours.

BotAI now caches health, mana, map ID, and combat state at the start
of each UpdateAI tick. RestStrategy uses these cached values instead
of reading from the bot directly.

Signed-off-by: luis <[email protected]>
2026-03-25 19:27:46 -03:00
luis bfce87a158 Scripts/Commands: Set worldstate when using .debug worldstate instead of just sending packet 2026-03-25 13:42:37 -03:00
luis 183ac260e3 Core/Transmog: Implemented TransmogHoliday.db2 transmog conditions 2026-03-25 13:41:50 -03:00
luis 0d9be8a492 db fixes 2026-03-25 13:34:48 -03:00
luis 41f361a630 Fix crash 2026-03-24 19:30:23 -03:00
luis 6d3375f01d ready 2026-03-24 03:04:30 -03:00
luis fb7c43cd57 ++ 2026-03-24 03:00:32 -03:00
agatho 819706874b Accept quests immediately when already at quest giver
When SearchForQuestGivers found a quest giver at 0yd distance, it
deferred to the pending system which required another UpdateBehavior
tick. With the 150ms throttle and only ~6 calls per session, the
follow-up never happened.

Now resolves the creature and calls ProcessQuestGiver immediately
when the bot is already within interaction distance, instead of
deferring to the next tick.

Signed-off-by: luis <[email protected]>
2026-03-24 02:36:52 -03:00
agatho 8042cd9da8 Fix AbandonQuest not removing quests — add RemoveActiveQuest before every AbandonQuest call
Signed-off-by: luis <[email protected]>
2026-03-24 02:36:24 -03:00
agatho cca29fdfa0 Fix remaining bot idle issues and clean up diagnostic logging
- Abandon quests with no ender in DB immediately on first attempt
  instead of waiting for 3 failures (fixes quest 55660 blocking)
- Loot strategy only activates on game objects within INTERACTION_DISTANCE
  preventing distant spatial grid objects from blocking quest strategy
- Rest threshold lowered to 15-25% for no-consumable resting
  (was 30-50%, causing bots at 50% health to idle without food)
- Downgrade 275 TC_LOG_ERROR calls to TC_LOG_DEBUG in QuestStrategy
- Downgrade STRAT-SELECT diagnostic to TRACE
- Downgrade target scanner evaluation log to TRACE
- Downgrade auto-accept check diagnostic to DEBUG

Signed-off-by: luis <[email protected]>
2026-03-24 02:35:27 -03:00
agatho 1e9be20087 Add worker-thread-safe position cache from movespline to BotAI
bot->GetPositionX/Y/Z() is only updated on the main thread during
Player::Update(). Worker threads reading it mid-spline get stale data.

BotAI now caches the current position at the start of each UpdateAI():
- If a movespline is active: uses FinalDestination() as effective position
- If idle: uses last known server position

GetCurrentPosition() provides this cached value for any worker thread
code that needs accurate bot location. Quest strategy's pending quest
giver distance check now uses this instead of bot->GetPositionX/Y/Z().

Also re-added navmesh reachability check to spatial grid quest giver
scan to skip unreachable NPCs (towers, cliffs) before selection.

Signed-off-by: luis <[email protected]>
2026-03-24 02:34:40 -03:00
agatho c127948a26 Fix quest giver distance using spline destination instead of stale position
bot->GetPositionX/Y() returns the server-side position which lags behind
the client during active spline movement. The bot visually stands at the
NPC but GetExactDist2d reports 77yd because the position hasn't been
updated by the main thread yet.

Now uses movespline->FinalDestination() as the bot's effective position
when a spline is active. This matches where the client renders the bot.

Also re-added navmesh reachability check to the spatial grid scan to
skip unreachable NPCs (towers, cliffs) before selection.

Signed-off-by: luis <[email protected]>
2026-03-23 09:24:19 -03:00
agatho a5c8d85089 Rewrite SearchForQuestGivers to use spatial grid instead of live grid
SafeGridOperations::GetCreatureListSafe accessed the live grid which
returned stale creatures from the old map after teleports (worker thread
data race on m_currMap). The bot searched for quest givers on the wrong
continent.

Now uses DoubleBufferedSpatialGrid which provides lock-free atomic
snapshots updated by the main thread. Worker threads always read current
map data. The scan uses creature snapshot fields (hasQuestGiver, entry,
position, isDead) and quest relation DB lookups (thread-safe static data)
to find quest givers without touching any live creature pointers.

Quest acceptance still uses live creature pointers but only in the
pending quest giver arrival phase, when the bot is physically at the NPC
and the data is guaranteed current.

Signed-off-by: luis <[email protected]>
2026-03-23 09:21:44 -03:00
agatho 6746649e95 Revert quest log cleanup — bots earned their quests legitimately
Signed-off-by: luis <[email protected]>
2026-03-23 09:21:04 -03:00
agatho 7fb99f6fa8 Clear pre-loaded quest log on first quest strategy run
Signed-off-by: luis <[email protected]>
2026-03-23 09:20:31 -03:00
agatho 6566e59412 Add teleport cooldown and auto-accept diagnostics
Worker thread reads stale map/grid data after TeleportTo, causing quest
giver searches to return creatures from the old map. Added 5-second
cooldown after each teleport to let the main thread process the map
change before the quest strategy runs again.

Also added diagnostic logging to ProcessQuestGiver auto-accept phase
to trace why quests aren't being accepted (alreadyHas, blacklisted,
canTake, canAdd checks).

Added navmesh reachability check to quest giver selection and position
diagnostic for pending quest giver distance debugging.

Signed-off-by: luis <[email protected]>
2026-03-23 09:19:27 -03:00
agatho 572f6826af Validate quest giver navmesh reachability before selection
Bots walked to quest givers on unreachable terrain (towers, cliffs)
because SearchForQuestGivers selected by straight-line distance without
checking if the navmesh could path there. The bot stopped at the
closest navmesh point, 77+ yards from the NPC.

Now uses PathGenerator to verify navmesh reachability before selecting
a quest giver. Unreachable NPCs are skipped in favor of reachable ones.

Also allows interaction when the NPC is found via grid scan (within
50yd) even if the stored position distance is larger, handling cases
where navmesh pathing ends at a different point than the stored coords.

Signed-off-by: luis <[email protected]>
2026-03-23 09:17:23 -03:00
agatho 88e61e37bb Replace CastSpell hearthstone with TeleportTo for bot homebind travel
CastSpell(8690) failed silently for bots without a hearthstone item in
inventory (gear application failed at creation). Bots stood idle in
wrong zones because the hearthstone cast did nothing.

Use Player::TeleportTo(m_homebind) directly — no item required, no
cooldown, no cast time. This is already used elsewhere in the module
(AdvancedBehaviorManager, PlayerbotCommands, TravelRouteManager).

Signed-off-by: luis <[email protected]>
2026-03-23 09:16:49 -03:00
agatho a15abe4cc0 Refine stale route timeout to only fire when stuck walking to first dock
The 2-minute timeout incorrectly killed routes where the bot was
waiting for a ship, riding a transport, or on later legs. Now only
fires when stuck in WALKING_TO_TRANSPORT state on leg 0 — the specific
case caused by worker thread GetMapId() staleness after teleport.

Signed-off-by: luis <[email protected]>
2026-03-23 09:16:16 -03:00
agatho 8fdbe66c57 Add timeout-based stale route detection for worker thread map staleness
bot->GetMapId() returns stale data on worker threads after a teleport
because m_mapId is updated on the main thread only. The existing map
comparison check fails — the worker still sees the old map ID.

Added a 2-minute timeout: if the travel route has been active for over
2 minutes without completing the first leg, it's considered stale and
cleared. This handles the case where the bot hearthstoned to a
different map but the worker thread can't detect the map change.

Signed-off-by: luis <[email protected]>
2026-03-23 09:15:40 -03:00
agatho 017e21d98f Fix quest giver arrival check using 3D distance instead of 2D
Bots stopped 30+ yards from quest givers because 3D distance included
Z-height difference (stairs, ramps, platforms). The bot was visually
at the NPC but the 3D dist of 31yd > INTERACTION_DISTANCE of 5yd.

Switched all pending quest giver distance checks to 2D, matching how
WoW's gossip interaction works. Also widened grid scan to 50yd for
finding NPCs when ObjectAccessor fails.

Signed-off-by: luis <[email protected]>
2026-03-23 09:13:27 -03:00
agatho 04c06abf21 Fix false falling state blocking all bot movement
IsOnGround() returned false when GroundValidator::GetGroundHeight
returned INVALID_HEIGHT (map data not loaded), causing the state
machine to set MOVEMENTFLAG_FALLING. This permanently blocked
MovePoint from generating splines — bots stood idle despite movement
commands being issued every tick.

Changed INVALID_HEIGHT to assume on-ground (safe default). A bot at
a spawn point is never falling.

Also added INFO diagnostic to HandleOnTransport for travel visibility.

Signed-off-by: luis <[email protected]>
2026-03-23 09:12:39 -03:00
luis 2e2cdd1a08 Db fixes 2026-03-22 21:05:07 -03:00
luis 7564d3e5fa typo 2026-03-22 20:46:27 -03:00
luis 22fa9aaba3 Core/Players: Fixed custom playercreateinfo_item using 0 in race/class columns (should apply to all races/classes) 2026-03-22 20:05:02 -03:00
luis d9bdbf86b9 ++ 2026-03-22 20:03:13 -03:00
luis 84ae6f7bbc Core/GameObjects: Implement "EnableDoodadSets" for phaseableMO gameobject type 2026-03-22 19:32:20 -03:00
luis ee2721db00 Core/GameObjects: Initialize gameobject type before creating its model 2026-03-22 19:31:06 -03:00
luis a30688baab tmog sql 2026-03-22 19:29:02 -03:00
luis a2983a2961 typo 2026-03-22 19:07:16 -03:00
luis 0665cda727 typo 2026-03-22 19:05:38 -03:00
luis c9dab6ac93 new tmog still not ready wait for sqls 2026-03-22 18:57:22 -03:00
luis aed90f22e5 tmog part 1 2026-03-22 18:11:58 -03:00
luis 9ec349ebaf ++typo 2026-03-21 05:16:42 -03:00