aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI
diff options
context:
space:
mode:
authorMachiavelli <machiavelli.trinity@gmail.com>2011-02-20 20:16:34 +0100
committerMachiavelli <machiavelli.trinity@gmail.com>2011-02-20 20:16:34 +0100
commite07e20ffcaf6911d4dd47e0895fbdc52c5a52f05 (patch)
treefcc0c8865a387c67b925df174e22f49820a985a0 /src/server/game/AI
parent45db1591a4959ca9d58fc40ea2294936bcf4bd10 (diff)
Core/Log: Implement log masks for debug log level, to allow selective debug output. Update your worldserver.conf.
Diffstat (limited to 'src/server/game/AI')
-rwxr-xr-xsrc/server/game/AI/CoreAI/CombatAI.cpp4
-rwxr-xr-xsrc/server/game/AI/CreatureAI.cpp2
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAI.cpp4
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp28
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp18
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp4
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp14
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h2
8 files changed, 36 insertions, 40 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index 1aedf41cd47..d1c30a76932 100755
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -340,9 +340,7 @@ void VehicleAI::LoadConditions()
{
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry());
if (!conditions.empty())
- {
- sLog->outDebug("VehicleAI::LoadConditions: loaded %u conditions", uint32(conditions.size()));
- }
+ sLog->outDebug(LOG_FILTER_CONDITIONSYS, "VehicleAI::LoadConditions: loaded %u conditions", uint32(conditions.size()));
}
void VehicleAI::CheckConditions(const uint32 diff)
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index afa928e52e8..be4cbc4f56b 100755
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -140,7 +140,7 @@ void CreatureAI::EnterEvadeMode()
if (!_EnterEvadeMode())
return;
- sLog->outDebug("Creature %u enters evade mode.", me->GetEntry());
+ sLog->outDebug(LOG_FILTER_UNITS, "Creature %u enters evade mode.", me->GetEntry());
if (!me->GetVehicle()) // otherwise me will be in evade mode forever
{
diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp
index ba7ed560589..8a7f20e8687 100755
--- a/src/server/game/AI/EventAI/CreatureEventAI.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp
@@ -1256,7 +1256,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
return;
}
- sLog->outDebug("CreatureEventAI: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote);
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "CreatureEventAI: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote);
if ((*i).second.SoundId)
{
@@ -1356,7 +1356,7 @@ void CreatureEventAI::ReceiveEmote(Player* pPlayer, uint32 text_emote)
if (cond.Meets(pPlayer))
{
- sLog->outDebug("CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing");
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "CreatureEventAI: ReceiveEmote CreatureEventAI: Condition ok, processing");
ProcessEvent(*itr, pPlayer);
}
}
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index fb97feb8ab4..780b07b6352 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -178,7 +178,7 @@ void npc_escortAI::EnterEvadeMode()
{
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
- sLog->outDebug("TSCR: EscortAI has left combat and is now returning to last point");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has left combat and is now returning to last point");
}
else
{
@@ -225,7 +225,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
{
if (DespawnAtEnd)
{
- sLog->outDebug("TSCR: EscortAI reached end of waypoints");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI reached end of waypoints");
if (m_bCanReturnToStart)
{
@@ -236,7 +236,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
m_uiWPWaitTimer = 0;
- sLog->outDebug("TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ);
return;
}
@@ -252,7 +252,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
}
else
{
- sLog->outDebug("TSCR: EscortAI reached end of waypoints with Despawn off");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI reached end of waypoints with Despawn off");
return;
}
@@ -261,7 +261,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
if (!HasEscortState(STATE_ESCORT_PAUSED))
{
me->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
- sLog->outDebug("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z);
WaypointStart(CurrentWP->id);
@@ -279,7 +279,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
{
if (DespawnAtFar && !IsPlayerOrGroupInRange())
{
- sLog->outDebug("TSCR: EscortAI failed because player/group was to far away or not found");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI failed because player/group was to far away or not found");
if (m_bCanInstantRespawn)
{
@@ -317,7 +317,7 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
//Combat start position reached, continue waypoint movement
if (uiPointId == POINT_LAST_POINT)
{
- sLog->outDebug("TSCR: EscortAI has returned to original position before combat");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original position before combat");
if (m_bIsRunning && me->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
@@ -331,7 +331,7 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
}
else if (uiPointId == POINT_HOME)
{
- sLog->outDebug("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
CurrentWP = WaypointList.begin();
m_uiWPWaitTimer = 1;
@@ -345,7 +345,7 @@ void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId)
return;
}
- sLog->outDebug("TSCR: EscortAI Waypoint %u reached", CurrentWP->id);
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI Waypoint %u reached", CurrentWP->id);
//Call WP function
WaypointReached(CurrentWP->id);
@@ -416,14 +416,14 @@ void npc_escortAI::SetRun(bool bRun)
if (!m_bIsRunning)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
else
- sLog->outDebug("TSCR: EscortAI attempt to set run mode, but is already running.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
else
- sLog->outDebug("TSCR: EscortAI attempt to set walk mode, but is already walking.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set walk mode, but is already walking.");
}
m_bIsRunning = bRun;
}
@@ -468,19 +468,19 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID,
m_bCanReturnToStart = bCanLoopPath;
if (m_bCanReturnToStart && m_bCanInstantRespawn)
- sLog->outDebug("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
{
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MoveIdle();
- sLog->outDebug("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
}
//disable npcflags
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
- sLog->outDebug("TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
CurrentWP = WaypointList.begin();
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 06fb3bc667a..8b2eef48d56 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -165,7 +165,7 @@ void FollowerAI::EnterEvadeMode()
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
- sLog->outDebug("TSCR: FollowerAI left combat, returning to CombatStartPosition.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI left combat, returning to CombatStartPosition.");
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE)
{
@@ -191,7 +191,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
- sLog->outDebug("TSCR: FollowerAI is set completed, despawns.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is set completed, despawns.");
me->DespawnOrUnsummon();
return;
}
@@ -202,7 +202,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
{
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
- sLog->outDebug("TSCR: FollowerAI is returning to leader.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is returning to leader.");
RemoveFollowState(STATE_FOLLOW_RETURNING);
me->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
@@ -231,7 +231,7 @@ void FollowerAI::UpdateAI(const uint32 uiDiff)
if (bIsMaxRangeExceeded)
{
- sLog->outDebug("TSCR: FollowerAI failed because player/group was to far away or not found");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI failed because player/group was to far away or not found");
me->DespawnOrUnsummon();
return;
}
@@ -274,7 +274,7 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
{
if (me->getVictim())
{
- sLog->outDebug("TSCR: FollowerAI attempt to StartFollow while in combat.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI attempt to StartFollow while in combat.");
return;
}
@@ -296,7 +296,7 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
{
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
- sLog->outDebug("TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
}
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
@@ -305,7 +305,7 @@ void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const
me->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
- sLog->outDebug("TSCR: FollowerAI start follow %s (GUID " UI64FMTD ")", pLeader->GetName(), m_uiLeaderGUID);
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI start follow %s (GUID " UI64FMTD ")", pLeader->GetName(), m_uiLeaderGUID);
}
Player* FollowerAI::GetLeaderForFollower()
@@ -324,7 +324,7 @@ Player* FollowerAI::GetLeaderForFollower()
if (pMember && pMember->isAlive() && me->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE))
{
- sLog->outDebug("TSCR: FollowerAI GetLeader changed and returned new leader.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader changed and returned new leader.");
m_uiLeaderGUID = pMember->GetGUID();
return pMember;
break;
@@ -334,7 +334,7 @@ Player* FollowerAI::GetLeaderForFollower()
}
}
- sLog->outDebug("TSCR: FollowerAI GetLeader can not find suitable leader.");
+ sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader can not find suitable leader.");
return NULL;
}
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index dbd58b06a5f..422096b3798 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -845,7 +845,7 @@ void SmartGameObjectAI::Reset()
// Called when a player opens a gossip dialog with the gameobject.
bool SmartGameObjectAI::GossipHello(Player* player)
{
- sLog->outDebug("SmartGameObjectAI::GossipHello");
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartGameObjectAI::GossipHello");
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_HELLO, player, 0 ,0 , false, NULL, go);
return false;
}
@@ -909,7 +909,7 @@ class SmartTrigger : public AreaTriggerScript
bool OnTrigger(Player* player, AreaTriggerEntry const* trigger)
{
- sLog->outDebug("AreaTrigger %u is using SmartTrigger script", trigger->id);
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "AreaTrigger %u is using SmartTrigger script", trigger->id);
SmartScript script;
script.OnInitialize(NULL, trigger);
script.ProcessEventsFor(SMART_EVENT_AREATRIGGER_ONTRIGGER, player, trigger->id);
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index e8610ff94b5..f9371979a77 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -115,11 +115,9 @@ void SmartScript::ProcessAction(SmartScriptHolder &e, Unit* unit, uint32 var0, u
{
SmartScriptHolder linked = FindLinkedEvent(e.link);
if (linked.GetActionType() && linked.GetEventType() == SMART_EVENT_LINK)
- {
ProcessEvent(linked, unit, var0, var1, bvar, spell, gob);
- }else{
+ else
sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Link Event %u not found or invalid, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.link);
- }
}
switch (e.GetActionType())
@@ -2150,9 +2148,9 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEn
if (e.empty())
{
if (obj)
- sLog->outDebug("SmartScript: EventMap for Entry %u is empty but is using SmartScript.", obj->GetEntry());
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript: EventMap for Entry %u is empty but is using SmartScript.", obj->GetEntry());
if (at)
- sLog->outDebug("SmartScript: EventMap for AreaTrigger %u is empty but is using SmartScript.", at->id);
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript: EventMap for AreaTrigger %u is empty but is using SmartScript.", at->id);
return;
}
for (SmartAIEventList::iterator i = e.begin(); i != e.end(); ++i)
@@ -2214,12 +2212,12 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at)
case TYPEID_UNIT:
mScriptType = SMART_SCRIPT_TYPE_CREATURE;
me = obj->ToCreature();
- sLog->outDebug("SmartScript::OnInitialize: source is Creature %u", me->GetEntry());
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is Creature %u", me->GetEntry());
break;
case TYPEID_GAMEOBJECT:
mScriptType = SMART_SCRIPT_TYPE_GAMEOBJECT;
go = obj->ToGameObject();
- sLog->outDebug("SmartScript::OnInitialize: source is GameObject %u", go->GetEntry());
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is GameObject %u", go->GetEntry());
break;
default:
sLog->outError("SmartScript::OnInitialize: Unhandled TypeID !WARNING!");
@@ -2229,7 +2227,7 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTriggerEntry const* at)
{
mScriptType = SMART_SCRIPT_TYPE_AREATRIGGER;
trigger = at;
- sLog->outDebug("SmartScript::OnInitialize: source is AreaTrigger %u", trigger->id);
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is AreaTrigger %u", trigger->id);
}
else
{
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 0dcb166070f..51f31e401ad 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -1203,7 +1203,7 @@ class SmartAIMgr
else
{
if(entry > 0)//first search is for guid (negative), do not drop error if not found
- sLog->outDebug("SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
+ sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
return temp;
}
}