mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 00:06:11 +00:00
feat(Core/Logging): rework logging (#4692)
* feat(Core/Logging): rework logging * correct level for sql.sql * del unused config options * Correct build * correct after merge * whitespace 20:29:37 1. 'Player.cpp'. Replace (1) 20:29:37 2. 'ObjectMgr.cpp'. Replace (3) * 1 * correct logging * correct affter merge * 1 * 2 * LOG_LEVEL_WARN * #include "AppenderDB.h" * 3 * 4 * 5 * 1. 'WorldSocket.cpp'. Replace (1) * 6 * 1
This commit is contained in:
@@ -91,7 +91,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
|
||||
{
|
||||
Player* player = nullptr;
|
||||
if (!source && !target)
|
||||
sLog->outError("%s source and target objects are nullptr.", scriptInfo->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s source and target objects are nullptr.", scriptInfo->GetDebugInfo().c_str());
|
||||
else
|
||||
{
|
||||
// Check target first, then source.
|
||||
@@ -101,7 +101,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe
|
||||
player = source->ToPlayer();
|
||||
|
||||
if (!player)
|
||||
sLog->outError("%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(),
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
|
||||
@@ -113,7 +113,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
|
||||
{
|
||||
Creature* creature = nullptr;
|
||||
if (!source && !target)
|
||||
sLog->outError("%s source and target objects are nullptr.", scriptInfo->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s source and target objects are nullptr.", scriptInfo->GetDebugInfo().c_str());
|
||||
else
|
||||
{
|
||||
if (bReverse)
|
||||
@@ -134,7 +134,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
|
||||
}
|
||||
|
||||
if (!creature)
|
||||
sLog->outError("%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(),
|
||||
source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
|
||||
target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
|
||||
@@ -146,15 +146,15 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
|
||||
{
|
||||
Unit* unit = nullptr;
|
||||
if (!obj)
|
||||
sLog->outError("%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
LOG_ERROR("server", "%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
else if (!obj->isType(TYPEMASK_UNIT))
|
||||
sLog->outError("%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
else
|
||||
{
|
||||
unit = obj->ToUnit();
|
||||
if (!unit)
|
||||
sLog->outError("%s %s object could not be casted to unit.",
|
||||
LOG_ERROR("server", "%s %s object could not be casted to unit.",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
}
|
||||
return unit;
|
||||
@@ -164,12 +164,12 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf
|
||||
{
|
||||
Player* player = nullptr;
|
||||
if (!obj)
|
||||
sLog->outError("%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
LOG_ERROR("server", "%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
else
|
||||
{
|
||||
player = obj->ToPlayer();
|
||||
if (!player)
|
||||
sLog->outError("%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).",
|
||||
LOG_ERROR("server", "%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
}
|
||||
return player;
|
||||
@@ -179,12 +179,12 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip
|
||||
{
|
||||
Creature* creature = nullptr;
|
||||
if (!obj)
|
||||
sLog->outError("%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
LOG_ERROR("server", "%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
else
|
||||
{
|
||||
creature = obj->ToCreature();
|
||||
if (!creature)
|
||||
sLog->outError("%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(),
|
||||
LOG_ERROR("server", "%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(),
|
||||
isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
}
|
||||
return creature;
|
||||
@@ -194,13 +194,13 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const
|
||||
{
|
||||
WorldObject* pWorldObject = nullptr;
|
||||
if (!obj)
|
||||
sLog->outError("%s %s object is nullptr.",
|
||||
LOG_ERROR("server", "%s %s object is nullptr.",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
|
||||
else
|
||||
{
|
||||
pWorldObject = dynamic_cast<WorldObject*>(obj);
|
||||
if (!pWorldObject)
|
||||
sLog->outError("%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).",
|
||||
LOG_ERROR("server", "%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).",
|
||||
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
|
||||
}
|
||||
return pWorldObject;
|
||||
@@ -219,29 +219,29 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script
|
||||
case SCRIPT_COMMAND_CLOSE_DOOR:
|
||||
break;
|
||||
default:
|
||||
sLog->outError("%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str());
|
||||
return;
|
||||
}
|
||||
if (!guid)
|
||||
sLog->outError("%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str());
|
||||
else if (!source)
|
||||
sLog->outError("%s source object is nullptr.", scriptInfo->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s source object is nullptr.", scriptInfo->GetDebugInfo().c_str());
|
||||
else if (!source->isType(TYPEMASK_UNIT))
|
||||
sLog->outError("%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(),
|
||||
LOG_ERROR("server", "%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(),
|
||||
source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
|
||||
else
|
||||
{
|
||||
WorldObject* wSource = dynamic_cast <WorldObject*> (source);
|
||||
if (!wSource)
|
||||
sLog->outError("%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
|
||||
else
|
||||
{
|
||||
GameObject* pDoor = _FindGameObject(wSource, guid);
|
||||
if (!pDoor)
|
||||
sLog->outError("%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid);
|
||||
LOG_ERROR("server", "%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid);
|
||||
else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR)
|
||||
sLog->outError("%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).",
|
||||
LOG_ERROR("server", "%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).",
|
||||
scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUIDLow());
|
||||
else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY))
|
||||
{
|
||||
@@ -320,7 +320,7 @@ void Map::ScriptsProcess()
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outError("%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
|
||||
LOG_ERROR("server", "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
|
||||
step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID));
|
||||
break;
|
||||
}
|
||||
@@ -355,7 +355,7 @@ void Map::ScriptsProcess()
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sLog->outError("%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
|
||||
LOG_ERROR("server", "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).",
|
||||
step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID));
|
||||
break;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ void Map::ScriptsProcess()
|
||||
case SCRIPT_COMMAND_TALK:
|
||||
if (step.script->Talk.ChatType > CHAT_TYPE_WHISPER && step.script->Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER)
|
||||
{
|
||||
sLog->outError("%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType);
|
||||
LOG_ERROR("server", "%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType);
|
||||
break;
|
||||
}
|
||||
if (step.script->Talk.Flags & SF_TALK_USE_PLAYER)
|
||||
@@ -394,7 +394,7 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
uint64 targetGUID = target ? target->GetGUID() : 0;
|
||||
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
|
||||
sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
player->Whisper(text, LANG_UNIVERSAL, targetGUID);
|
||||
break;
|
||||
@@ -426,13 +426,13 @@ void Map::ScriptsProcess()
|
||||
break;
|
||||
case CHAT_TYPE_WHISPER:
|
||||
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
|
||||
sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
cSource->MonsterWhisper(step.script->Talk.TextID, target->ToPlayer());
|
||||
break;
|
||||
case CHAT_MSG_RAID_BOSS_WHISPER:
|
||||
if (!targetGUID || !IS_PLAYER_GUID(targetGUID))
|
||||
sLog->outError("%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
cSource->MonsterWhisper(step.script->Talk.TextID, target->ToPlayer(), true);
|
||||
break;
|
||||
@@ -460,7 +460,7 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
// Validate field number.
|
||||
if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount())
|
||||
sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID,
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
else
|
||||
@@ -489,7 +489,7 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
// Validate field number.
|
||||
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
|
||||
sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
else
|
||||
@@ -503,7 +503,7 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
// Validate field number.
|
||||
if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount())
|
||||
sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.",
|
||||
step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID,
|
||||
cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
else
|
||||
@@ -530,12 +530,12 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
if (!source)
|
||||
{
|
||||
sLog->outError("%s source object is nullptr.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s source object is nullptr.", step.script->GetDebugInfo().c_str());
|
||||
break;
|
||||
}
|
||||
if (!target)
|
||||
{
|
||||
sLog->outError("%s target object is nullptr.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s target object is nullptr.", step.script->GetDebugInfo().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -546,7 +546,7 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outError("%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow());
|
||||
break;
|
||||
}
|
||||
@@ -559,7 +559,7 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER)
|
||||
{
|
||||
sLog->outError("%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
|
||||
break;
|
||||
}
|
||||
@@ -567,7 +567,7 @@ void Map::ScriptsProcess()
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog->outError("%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(),
|
||||
target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
|
||||
break;
|
||||
@@ -598,7 +598,7 @@ void Map::ScriptsProcess()
|
||||
case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT:
|
||||
if (!step.script->RespawnGameobject.GOGuid)
|
||||
{
|
||||
sLog->outError("%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ void Map::ScriptsProcess()
|
||||
GameObject* pGO = _FindGameObject(pSummoner, step.script->RespawnGameobject.GOGuid);
|
||||
if (!pGO)
|
||||
{
|
||||
sLog->outError("%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid);
|
||||
LOG_ERROR("server", "%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -617,7 +617,7 @@ void Map::ScriptsProcess()
|
||||
pGO->GetGoType() == GAMEOBJECT_TYPE_BUTTON ||
|
||||
pGO->GetGoType() == GAMEOBJECT_TYPE_TRAP)
|
||||
{
|
||||
sLog->outError("%s can not be used with gameobject of type %u (guid: %u).",
|
||||
LOG_ERROR("server", "%s can not be used with gameobject of type %u (guid: %u).",
|
||||
step.script->GetDebugInfo().c_str(), uint32(pGO->GetGoType()), step.script->RespawnGameobject.GOGuid);
|
||||
break;
|
||||
}
|
||||
@@ -640,7 +640,7 @@ void Map::ScriptsProcess()
|
||||
if (WorldObject* pSummoner = _GetScriptWorldObject(source, true, step.script))
|
||||
{
|
||||
if (!step.script->TempSummonCreature.CreatureEntry)
|
||||
sLog->outError("%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str());
|
||||
else
|
||||
{
|
||||
uint32 entry = step.script->TempSummonCreature.CreatureEntry;
|
||||
@@ -656,7 +656,7 @@ void Map::ScriptsProcess()
|
||||
break;
|
||||
|
||||
if (!pSummoner->SummonCreature(entry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->TempSummonCreature.DespawnDelay))
|
||||
sLog->outError("%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry);
|
||||
LOG_ERROR("server", "%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -674,13 +674,13 @@ void Map::ScriptsProcess()
|
||||
// Target must be GameObject.
|
||||
if (!target)
|
||||
{
|
||||
sLog->outError("%s target object is nullptr.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s target object is nullptr.", step.script->GetDebugInfo().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
if (target->GetTypeId() != TYPEID_GAMEOBJECT)
|
||||
{
|
||||
sLog->outError("%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
LOG_ERROR("server", "%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.",
|
||||
step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
|
||||
break;
|
||||
}
|
||||
@@ -704,7 +704,7 @@ void Map::ScriptsProcess()
|
||||
// TODO: Allow gameobjects to be targets and casters
|
||||
if (!source && !target)
|
||||
{
|
||||
sLog->outError("%s source and target objects are nullptr.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s source and target objects are nullptr.", step.script->GetDebugInfo().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -737,13 +737,13 @@ void Map::ScriptsProcess()
|
||||
|
||||
if (!uSource || !uSource->isType(TYPEMASK_UNIT))
|
||||
{
|
||||
sLog->outError("%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
|
||||
LOG_ERROR("server", "%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!uTarget || !uTarget->isType(TYPEMASK_UNIT))
|
||||
{
|
||||
sLog->outError("%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
|
||||
LOG_ERROR("server", "%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ void Map::ScriptsProcess()
|
||||
if (Unit* unit = _GetScriptUnit(source, true, step.script))
|
||||
{
|
||||
if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID))
|
||||
sLog->outError("%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID);
|
||||
LOG_ERROR("server", "%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID);
|
||||
else
|
||||
unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable);
|
||||
}
|
||||
@@ -813,12 +813,12 @@ void Map::ScriptsProcess()
|
||||
{
|
||||
if (!step.script->CallScript.CreatureEntry)
|
||||
{
|
||||
sLog->outError("%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str());
|
||||
break;
|
||||
}
|
||||
if (!step.script->CallScript.ScriptID)
|
||||
{
|
||||
sLog->outError("%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@ void Map::ScriptsProcess()
|
||||
|
||||
if (!cTarget)
|
||||
{
|
||||
sLog->outError("%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry);
|
||||
LOG_ERROR("server", "%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -852,7 +852,7 @@ void Map::ScriptsProcess()
|
||||
//if no scriptmap present...
|
||||
if (!datamap)
|
||||
{
|
||||
sLog->outError("%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType);
|
||||
LOG_ERROR("server", "%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ void Map::ScriptsProcess()
|
||||
if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script))
|
||||
{
|
||||
if (cSource->isDead())
|
||||
sLog->outError("%s creature is already dead (Entry: %u, GUID: %u)",
|
||||
LOG_ERROR("server", "%s creature is already dead (Entry: %u, GUID: %u)",
|
||||
step.script->GetDebugInfo().c_str(), cSource->GetEntry(), cSource->GetGUIDLow());
|
||||
else
|
||||
{
|
||||
@@ -942,7 +942,7 @@ void Map::ScriptsProcess()
|
||||
break;
|
||||
|
||||
default:
|
||||
sLog->outError("Unknown script command %s.", step.script->GetDebugInfo().c_str());
|
||||
LOG_ERROR("server", "Unknown script command %s.", step.script->GetDebugInfo().c_str());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ ScriptMgr* ScriptMgr::instance()
|
||||
void ScriptMgr::Initialize()
|
||||
{
|
||||
AddScripts();
|
||||
sLog->outString("Loading C++ scripts");
|
||||
LOG_INFO("server", "Loading C++ scripts");
|
||||
}
|
||||
|
||||
void ScriptMgr::Unload()
|
||||
@@ -168,8 +168,8 @@ void ScriptMgr::LoadDatabase()
|
||||
|
||||
CheckIfScriptsInDatabaseExist();
|
||||
|
||||
sLog->outString(">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
|
||||
sLog->outString();
|
||||
LOG_INFO("server", ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", " ");
|
||||
}
|
||||
|
||||
struct TSpellSummary
|
||||
@@ -216,7 +216,7 @@ void ScriptMgr::CheckIfScriptsInDatabaseExist()
|
||||
!ScriptRegistry<CommandSC>::GetScriptById(sid) &&
|
||||
!ScriptRegistry<ArenaScript>::GetScriptById(sid) &&
|
||||
!ScriptRegistry<GroupScript>::GetScriptById(sid))
|
||||
sLog->outErrorDb("Script named '%s' is assigned in the database, but has no code!", (*itr).c_str());
|
||||
LOG_ERROR("sql.sql", "Script named '%s' is assigned in the database, but has no code!", (*itr).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@ public:
|
||||
_mapEntry = sMapStore.LookupEntry(_mapId);
|
||||
|
||||
if (!_mapEntry)
|
||||
sLog->outError("Invalid MapScript for %u; no such map ID.", _mapId);
|
||||
LOG_ERROR("server", "Invalid MapScript for %u; no such map ID.", _mapId);
|
||||
}
|
||||
|
||||
// Gets the MapEntry structure associated with this script. Can return nullptr.
|
||||
@@ -353,7 +353,7 @@ public:
|
||||
checkMap();
|
||||
|
||||
if (GetEntry() && !GetEntry()->IsWorldMap())
|
||||
sLog->outError("WorldMapScript for map %u is invalid.", GetEntry()->MapID);
|
||||
LOG_ERROR("server", "WorldMapScript for map %u is invalid.", GetEntry()->MapID);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -370,7 +370,7 @@ public:
|
||||
checkMap();
|
||||
|
||||
if (GetEntry() && !GetEntry()->IsDungeon())
|
||||
sLog->outError("InstanceMapScript for map %u is invalid.", GetEntry()->MapID);
|
||||
LOG_ERROR("server", "InstanceMapScript for map %u is invalid.", GetEntry()->MapID);
|
||||
}
|
||||
|
||||
// Gets an InstanceScript object for this instance.
|
||||
@@ -390,7 +390,7 @@ public:
|
||||
checkMap();
|
||||
|
||||
if (GetEntry() && !GetEntry()->IsBattleground())
|
||||
sLog->outError("BattlegroundMapScript for map %u is invalid.", GetEntry()->MapID);
|
||||
LOG_ERROR("server", "BattlegroundMapScript for map %u is invalid.", GetEntry()->MapID);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1990,7 +1990,7 @@ public:
|
||||
else
|
||||
{
|
||||
// If the script is already assigned -> delete it!
|
||||
sLog->outError("Script named '%s' is already assigned (two or more scripts have the same name), so the script can't work, aborting...",
|
||||
LOG_ERROR("server", "Script named '%s' is already assigned (two or more scripts have the same name), so the script can't work, aborting...",
|
||||
script->GetName().c_str());
|
||||
|
||||
ABORT(); // Error that should be fixed ASAP.
|
||||
@@ -2000,7 +2000,7 @@ public:
|
||||
{
|
||||
// The script uses a script name from database, but isn't assigned to anything.
|
||||
if (script->GetName().find("Smart") == std::string::npos)
|
||||
sLog->outErrorDb("Script named '%s' is not assigned in the database.",
|
||||
LOG_ERROR("sql.sql", "Script named '%s' is not assigned in the database.",
|
||||
script->GetName().c_str());
|
||||
}
|
||||
}
|
||||
@@ -2034,7 +2034,7 @@ private:
|
||||
{
|
||||
if (it->second == script)
|
||||
{
|
||||
sLog->outError("Script '%s' has same memory pointer as '%s'.",
|
||||
LOG_ERROR("server", "Script '%s' has same memory pointer as '%s'.",
|
||||
script->GetName().c_str(), it->second->GetName().c_str());
|
||||
|
||||
return false;
|
||||
|
||||
@@ -31,15 +31,15 @@ void SystemMgr::LoadScriptWaypoints()
|
||||
if (result)
|
||||
uiCreatureCount = result->GetRowCount();
|
||||
|
||||
sLog->outString("TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
|
||||
LOG_INFO("server", "TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
|
||||
|
||||
// 0 1 2 3 4 5
|
||||
result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
sLog->outString(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
|
||||
sLog->outString();
|
||||
LOG_INFO("server", ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
|
||||
LOG_INFO("server", " ");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -62,16 +62,16 @@ void SystemMgr::LoadScriptWaypoints()
|
||||
|
||||
if (!pCInfo)
|
||||
{
|
||||
sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry);
|
||||
LOG_ERROR("sql.sql", "TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!pCInfo->ScriptID)
|
||||
sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry);
|
||||
LOG_ERROR("sql.sql", "TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry);
|
||||
|
||||
m_mPointMoveMap[uiEntry].push_back(temp);
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server", ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user