move logs to debug
This commit is contained in:
@@ -415,7 +415,7 @@ namespace Playerbot
|
||||
botPtr == 0xDDDDDDDD || botPtr == 0xFEEEFEEE ||
|
||||
botPtr == 0xCDCDCDCD || botPtr == 0xCCCCCCCC)
|
||||
{
|
||||
TC_LOG_ERROR("module.playerbot.ai", "CRITICAL: BotAI::UpdateAI called with invalid _bot pointer 0x{:X} - aborting to prevent crash!", botPtr);
|
||||
TC_LOG_DEBUG("module.playerbot.ai", "CRITICAL: BotAI::UpdateAI called with invalid _bot pointer 0x{:X} - aborting to prevent crash!", botPtr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -805,7 +805,7 @@ namespace Playerbot
|
||||
catch (...)
|
||||
{
|
||||
// Catch any exceptions during member access (e.g., destroyed objects)
|
||||
TC_LOG_ERROR("playerbot", "Exception while accessing group member for bot {}", _bot->GetName());
|
||||
TC_LOG_DEBUG("playerbot", "Exception while accessing group member for bot {}", _bot->GetName());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -1115,7 +1115,7 @@ namespace Playerbot
|
||||
uint32 now = GameTime::GetGameTimeMS();
|
||||
if (now - lastCombatStateLog > 2000)
|
||||
{
|
||||
TC_LOG_ERROR("module.playerbot", "?? UpdateCombatState: Bot {} - wasInCombat={}, isInCombat={}, AIState={}, HasVictim={}", _bot ? _bot->GetName() : "null",
|
||||
TC_LOG_DEBUG("module.playerbot", "?? UpdateCombatState: Bot {} - wasInCombat={}, isInCombat={}, AIState={}, HasVictim={}", _bot ? _bot->GetName() : "null",
|
||||
wasInCombat, isInCombat,
|
||||
static_cast<uint32>(_aiState),
|
||||
(_bot && _bot->GetVictim()) ? "YES" : "NO");
|
||||
@@ -1126,7 +1126,7 @@ namespace Playerbot
|
||||
if (!wasInCombat && isInCombat)
|
||||
{
|
||||
// Entering combat
|
||||
TC_LOG_ERROR("module.playerbot", "?? ENTERING COMBAT: Bot {}", _bot->GetName());
|
||||
TC_LOG_DEBUG("module.playerbot", "?? ENTERING COMBAT: Bot {}", _bot->GetName());
|
||||
SetAIState(BotAIState::COMBAT);
|
||||
|
||||
// Find initial target
|
||||
@@ -1134,7 +1134,7 @@ namespace Playerbot
|
||||
::Unit* target = _objectCache.GetTarget();
|
||||
if (target)
|
||||
{
|
||||
TC_LOG_ERROR("module.playerbot", "?? Target from cache: {}", target->GetName());
|
||||
TC_LOG_DEBUG("module.playerbot", "?? Target from cache: {}", target->GetName());
|
||||
}
|
||||
|
||||
// CRITICAL FIX: Try GetVictim() as fallback if cache has no target
|
||||
@@ -1144,7 +1144,7 @@ namespace Playerbot
|
||||
target = _bot->GetVictim();
|
||||
if (target)
|
||||
{
|
||||
TC_LOG_ERROR("module.playerbot", "?? Target from GetVictim(): {}", target->GetName());
|
||||
TC_LOG_DEBUG("module.playerbot", "?? Target from GetVictim(): {}", target->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1178,31 +1178,31 @@ namespace Playerbot
|
||||
if (attacker && attacker->IsAlive() && _bot->IsValidAttackTarget(attacker))
|
||||
{
|
||||
target = attacker;
|
||||
TC_LOG_ERROR("module.playerbot", "?? Target from getAttackers(): {}", target->GetName());
|
||||
TC_LOG_DEBUG("module.playerbot", "?? Target from getAttackers(): {}", target->GetName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
TC_LOG_ERROR("module.playerbot", "?? Exception while iterating attackers for bot {}", _bot->GetName());
|
||||
TC_LOG_DEBUG("module.playerbot", "?? Exception while iterating attackers for bot {}", _bot->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
TC_LOG_ERROR("module.playerbot", "? Calling OnCombatStart() with target {}", target->GetName());
|
||||
TC_LOG_DEBUG("module.playerbot", "? Calling OnCombatStart() with target {}", target->GetName());
|
||||
OnCombatStart(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("module.playerbot", "? COMBAT START FAILED: No valid target found!");
|
||||
TC_LOG_DEBUG("module.playerbot", "? COMBAT START FAILED: No valid target found!");
|
||||
}
|
||||
}
|
||||
else if (wasInCombat && !isInCombat)
|
||||
{
|
||||
// Leaving combat
|
||||
TC_LOG_ERROR("module.playerbot", "??? LEAVING COMBAT: Bot {}", _bot->GetName()); OnCombatEnd();
|
||||
TC_LOG_DEBUG("module.playerbot", "??? LEAVING COMBAT: Bot {}", _bot->GetName()); OnCombatEnd();
|
||||
|
||||
// Determine new state
|
||||
if (_bot->GetGroup() && GetStrategy("follow"))
|
||||
@@ -1457,7 +1457,7 @@ namespace Playerbot
|
||||
::MovementGeneratorType currentType = mm->GetCurrentMovementGeneratorType(MOTION_SLOT_ACTIVE);
|
||||
if (currentType != FOLLOW_MOTION_TYPE && currentType != IDLE_MOTION_TYPE)
|
||||
{
|
||||
TC_LOG_ERROR("playerbot", "?? OnCombatEnd: Clearing {} motion type for bot {} to allow follow",
|
||||
TC_LOG_DEBUG("playerbot", "?? OnCombatEnd: Clearing {} motion type for bot {} to allow follow",
|
||||
static_cast<uint32>(currentType), _bot->GetName());
|
||||
mm->Clear();
|
||||
}
|
||||
@@ -1503,12 +1503,12 @@ namespace Playerbot
|
||||
// Initiate death recovery process
|
||||
if (auto* deathRecoveryManager = GetDeathRecoveryManager())
|
||||
{
|
||||
TC_LOG_ERROR("playerbots.ai", "Bot {} died - calling DeathRecoveryManager::OnDeath()", _bot->GetName());
|
||||
TC_LOG_DEBUG("playerbots.ai", "Bot {} died - calling DeathRecoveryManager::OnDeath()", _bot->GetName());
|
||||
deathRecoveryManager->OnDeath();
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("playerbots.ai", "Bot {} died but GetDeathRecoveryManager() returned nullptr! _gameSystems={}",
|
||||
TC_LOG_DEBUG("playerbots.ai", "Bot {} died but GetDeathRecoveryManager() returned nullptr! _gameSystems={}",
|
||||
_bot->GetName(), _gameSystems ? "valid" : "null");
|
||||
}
|
||||
|
||||
@@ -1629,7 +1629,7 @@ namespace Playerbot
|
||||
|
||||
// Check if follow strategy existsif (_strategies.find("follow") == _strategies.end())
|
||||
{
|
||||
TC_LOG_ERROR("playerbot", "CRITICAL: Follow strategy not found for bot {} - creating emergency fallback", _bot->GetName());
|
||||
TC_LOG_DEBUG("playerbot", "CRITICAL: Follow strategy not found for bot {} - creating emergency fallback", _bot->GetName());
|
||||
|
||||
// Create it immediately while we hold the lock
|
||||
auto followBehavior = std::make_unique<LeaderFollowBehavior>();
|
||||
@@ -1639,7 +1639,7 @@ namespace Playerbot
|
||||
// Check if group combat strategy exists
|
||||
if (_strategies.find("group_combat") == _strategies.end())
|
||||
{
|
||||
TC_LOG_ERROR("playerbot", "CRITICAL: GroupCombat strategy not found for bot {} - creating emergency fallback", _bot->GetName());
|
||||
TC_LOG_DEBUG("playerbot", "CRITICAL: GroupCombat strategy not found for bot {} - creating emergency fallback", _bot->GetName());
|
||||
|
||||
// Create it immediately while we hold the lock
|
||||
auto groupCombat = std::make_unique<GroupCombatStrategy>();
|
||||
@@ -1654,7 +1654,7 @@ namespace Playerbot
|
||||
{
|
||||
bool wasActive = it->second->IsActive(this);
|
||||
|
||||
TC_LOG_ERROR("playerbot", "?? OnGroupJoined: Bot {} follow strategy - alreadyInList={}, wasActive={}", _bot->GetName(), alreadyInList, wasActive);
|
||||
TC_LOG_DEBUG("playerbot", "?? OnGroupJoined: Bot {} follow strategy - alreadyInList={}, wasActive={}", _bot->GetName(), alreadyInList, wasActive);
|
||||
|
||||
if (!alreadyInList)
|
||||
_activeStrategies.push_back("follow");
|
||||
@@ -1665,7 +1665,7 @@ namespace Playerbot
|
||||
// This handles server restart where bot loads with group but follow not initialized
|
||||
strategiesToActivate.push_back(it->second.get());
|
||||
|
||||
TC_LOG_ERROR("playerbot", "? OnGroupJoined: Bot {} queued follow strategy for OnActivate callback", _bot->GetName());
|
||||
TC_LOG_DEBUG("playerbot", "? OnGroupJoined: Bot {} queued follow strategy for OnActivate callback", _bot->GetName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1695,7 +1695,7 @@ namespace Playerbot
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("playerbot", "? Strategy activation FAILED for bot {} - follow={}, combat={}", _bot->GetName(), followActive, combatActive);
|
||||
TC_LOG_DEBUG("playerbot", "? Strategy activation FAILED for bot {} - follow={}, combat={}", _bot->GetName(), followActive, combatActive);
|
||||
}
|
||||
} // RELEASE LOCK - all operations completed
|
||||
|
||||
@@ -1958,7 +1958,7 @@ namespace Playerbot
|
||||
// This handles both: new activations and re-activation of strategies that were improperly added
|
||||
needsOnActivate = !alreadyInList || !wasActive;
|
||||
|
||||
TC_LOG_ERROR("module.playerbot.ai", "?? ACTIVATED STRATEGY: '{}' for bot {}, alreadyInList={}, wasActive={}, needsOnActivate={}", name, _bot->GetName(), alreadyInList, wasActive, needsOnActivate);
|
||||
TC_LOG_DEBUG("module.playerbot.ai", "?? ACTIVATED STRATEGY: '{}' for bot {}, alreadyInList={}, wasActive={}, needsOnActivate={}", name, _bot->GetName(), alreadyInList, wasActive, needsOnActivate);
|
||||
|
||||
// Get strategy pointer for callback
|
||||
strategy = it->second.get();
|
||||
@@ -1967,7 +1967,7 @@ namespace Playerbot
|
||||
// Call OnActivate hook WITHOUT holding lock if needed
|
||||
if (strategy && needsOnActivate)
|
||||
{
|
||||
TC_LOG_ERROR("module.playerbot.ai", "?? Calling OnActivate() for strategy '{}' on bot {}", name, _bot->GetName());
|
||||
TC_LOG_DEBUG("module.playerbot.ai", "?? Calling OnActivate() for strategy '{}' on bot {}", name, _bot->GetName());
|
||||
strategy->OnActivate(this);
|
||||
TC_LOG_DEBUG("playerbot", "Activated strategy '{}' for bot {}", name, _bot->GetName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user