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:
Kargatum 2021-04-17 16:20:07 +07:00 committed by GitHub
parent b2861be1cd
commit 4af4cbd3d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
246 changed files with 7413 additions and 6807 deletions

View file

@ -0,0 +1,152 @@
from re import compile, MULTILINE
from os import walk, getcwd
notice = ('''/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
''')
if not getcwd().endswith('src'):
print('Run this from the src directory!')
print('(Invoke as \'python ../contrib/enumutils_describe.py\')')
exit(1)
EnumPattern = compile(r'//\s*EnumUtils: DESCRIBE THIS(?:\s*\(in ([^\)]+)\))?\s+enum\s+([0-9A-Za-z]+)[^\n]*\s*{([^}]+)};')
EnumValuesPattern = compile(r'\s+\S.+?(,|$)[^\n]*')
EnumValueNamePattern = compile(r'^\s*([a-zA-Z0-9_]+)', flags=MULTILINE)
EnumValueSkipLinePattern = compile(r'^\s*//')
EnumValueCommentPattern = compile(r'//,?[ \t]*([^\n]+)$')
CommentMatchFormat = compile(r'^(((TITLE +(.+?))|(DESCRIPTION +(.+?))) *){1,2}$')
CommentSkipFormat = compile(r'^SKIP *$')
def strescape(str):
res = ''
for char in str:
if char in ('\\', '"') or not (32 <= ord(char) < 127):
res += ('\\%03o' % ord(char))
else:
res += char
return '"' + res + '"'
def processFile(path, filename):
input = open('%s/%s.h' % (path, filename),'r')
if input is None:
print('Failed to open %s.h' % filename)
return
file = input.read()
enums = []
for enum in EnumPattern.finditer(file):
prefix = enum.group(1) or ''
name = enum.group(2)
values = []
for value in EnumValuesPattern.finditer(enum.group(3)):
valueData = value.group(0)
valueNameMatch = EnumValueNamePattern.search(valueData)
if valueNameMatch is None:
if EnumValueSkipLinePattern.search(valueData) is None:
print('Name of value not found: %s' % repr(valueData))
continue
valueName = valueNameMatch.group(1)
valueCommentMatch = EnumValueCommentPattern.search(valueData)
valueComment = None
if valueCommentMatch:
valueComment = valueCommentMatch.group(1)
valueTitle = None
valueDescription = None
if valueComment is not None:
if CommentSkipFormat.match(valueComment) is not None:
continue
commentMatch = CommentMatchFormat.match(valueComment)
if commentMatch is not None:
valueTitle = commentMatch.group(4)
valueDescription = commentMatch.group(6)
else:
valueDescription = valueComment
if valueTitle is None:
valueTitle = valueName
if valueDescription is None:
valueDescription = ''
values.append((valueName, valueTitle, valueDescription))
enums.append((prefix + name, prefix, values))
print('%s.h: Enum %s parsed with %d values' % (filename, name, len(values)))
if not enums:
return
print('Done parsing %s.h (in %s)\n' % (filename, path))
output = open('%s/enuminfo_%s.cpp' % (path, filename), 'w')
if output is None:
print('Failed to create enuminfo_%s.cpp' % filename)
return
# write output file
output.write(notice)
output.write('#include "%s.h"\n' % filename)
output.write('#include "Define.h"\n')
output.write('#include "SmartEnum.h"\n')
output.write('#include <stdexcept>\n')
output.write('\n')
output.write('namespace acore::Impl::EnumUtilsImpl\n')
output.write('{\n')
for name, prefix, values in enums:
tag = ('data for enum \'%s\' in \'%s.h\' auto-generated' % (name, filename))
output.write('\n')
output.write('/*' + ('*'*(len(tag)+2)) + '*\\\n')
output.write('|* ' + tag + ' *|\n')
output.write('\\*' + ('*'*(len(tag)+2)) + '*/\n')
output.write('template <>\n')
output.write('EnumText EnumUtils<%s>::ToString(%s value)\n' % (name, name))
output.write('{\n')
output.write(' switch (value)\n')
output.write(' {\n')
for label, title, description in values:
output.write(' case %s: return { %s, %s, %s };\n' % (prefix + label, strescape(label), strescape(title), strescape(description)))
output.write(' default: throw std::out_of_range("value");\n')
output.write(' }\n')
output.write('}\n')
output.write('\n')
output.write('template <>\n')
output.write('size_t EnumUtils<%s>::Count() { return %d; }\n' % (name, len(values)))
output.write('\n')
output.write('template <>\n')
output.write('%s EnumUtils<%s>::FromIndex(size_t index)\n' % (name, name))
output.write('{\n')
output.write(' switch (index)\n')
output.write(' {\n')
for (i, (label, title, description)) in enumerate(values):
output.write(' case %d: return %s;\n' % (i, prefix + label))
output.write(' default: throw std::out_of_range("index");\n')
output.write(' }\n')
output.write('}\n')
output.write('\n')
output.write('template <>\n')
output.write('size_t EnumUtils<%s>::ToIndex(%s value)\n' % (name, name))
output.write('{\n')
output.write(' switch (value)\n')
output.write(' {\n')
for (i, (label, title, description)) in enumerate(values):
output.write(' case %s: return %d;\n' % (prefix + label, i))
output.write(' default: throw std::out_of_range("value");\n')
output.write(' }\n')
output.write('}\n')
output.write('}\n')
FilenamePattern = compile(r'^(.+)\.h$')
for root, dirs, files in walk('.'):
for n in files:
nameMatch = FilenamePattern.match(n)
if nameMatch is not None:
processFile(root, nameMatch.group(1))

293
doc/Logging.md Normal file
View file

@ -0,0 +1,293 @@
# Logging system "log4j-like"
## LOGGERS AND APPENDERS
```
Logging system has two components: loggers and appenders. These types of
components enable users to log messages according to message type and level and
control at runtime where they are reported.
```
## 1. **LOGGERS**
```
The first and foremost advantage of this system resided in the ability to
disable certain log statements while allowing others to print unhindered.
This capability assumes that the loggers are categorized according to some
developer-chosen criteria.
```
Loggers are named entitites. Logger names are case-sensitive and they follow
the hierarchical naming rule:
```
A Logger is said to be an ancestor of another logger if its name followed
by a dot is a prefix of the descendant logger name. A logger is salid to be
a parent of a child logger if there are no ancestors between itself and the
descendant logger.
```
For example, the logger named `"entities.player"` is a parent of the logger named
`"entities.player.character"`. Similarly, `"entities"` is a parent of `"entities.player"`
and an ancestor of `"entities.player.character"`.
Loggers may be assigned levels. The set of possible levels are `TRACE`, `DEBUG`,
`INFO`, `WARN`, `ERROR` AND `FATAL`, or be disabled using level `DISABLED`.
By definition the printing method determines the level of a logging request.
For example:
```cpp
LOG_INFO(...) // is a logging request of level INFO.
```
A logging request is said to be enabled if its level is less than or equal to
the level of its logger. Otherwise, the request is said to be disabled. A logger
without an assigned level will inherit one from the hierarchy
Example
```
Logger Name Assigned Level Inherited Level
root Proot Proot
server None Proot
```
As `"server"` is not defined, it uses the root logger and it's log level.
```
FATAL < ERROR < WARN < INFO < DEBUG < TRACE
```
## 2. **APPENDERS**
```
The ability to selectively enable of dissable logging request based on their
loggers is only part of the picture. This system allows logging requests to
print to multiple destinations. An output destination is called an appender.
Current system defines appenders for Console, files and Database, but can be
easily extended to remote socket server, NT event loggers, syslog daemons or
any other system.
```
More than one appender can be attached to one logger. Each enabled logging
request for a given logger will be forwarded to all the appenders in that
logger
**CONFIGURATION**
System will read all config elements with prefix `"Logger."` and `"Appender."`
and configure the logging system. If `"root"` can not be properly configured the core
will remove all loggers and appenders and create a default set:
```
- Logger "root" with log level Error
- Logger "server" with log level Info
- Appender "Console" to log to console
```
Appender config line follows the format:
```
Type,LogLevel,Flags,optional1,optional2
```
```
Its a list of elements separated by comma where each element has its own meaning
Type: Type of the appender
1 - (Console)
2 - (File)
3 - (DB)
LogLevel
0 - (Disabled)
1 - (Fatal)
2 - (Error)
3 - (Warning)
4 - (Info)
5 - (Debug)
6 - (Trace)
Flags: Define some extra modifications to do to logging message
1 - Prefix Timestamp to the text
2 - Prefix Log Level to the text
4 - Prefix Log Filter type to the text
8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS
(Only used with Type = 2)
16 - Make a backup of existing file before overwrite
(Only used with Mode = w)
```
Depending on the type, elements `optional1` and `optional2` will take different
```
Colors (read as optional1 if Type = Console)
Format: "fatal error warn info debug trace"
0 - BLACK
1 - RED
2 - GREEN
3 - BROWN
4 - BLUE
5 - MAGENTA
6 - CYAN
7 - GREY
8 - YELLOW
9 - LRED
10 - LGREEN
11 - LBLUE
12 - LMAGENTA
13 - LCYAN
14 - WHITE
Example: "1 9 3 6 5 8"
File: Name of the file (read as optional1 if Type = File)
Allows to use one "%u" to create dynamic files
Mode: Mode to open the file (read as optional2 if Type = File)
a - (Append)
w - (Overwrite)
```
Example:
```
Appender.Console1=1,5,6
```
Creates new appender to log to console any message with log level `DEBUG`
or less and prefixes log type and level to the message.
```ini
Appender.Console2=1,2,1,"1 9 3 6 5 8"
```
Creates new appender to log to console any message with log level `ERROR`
or less and prefixes timestamp to the message using colored text.
```ini
Appender.File=2,5,7,Auth.log,w
```
Creates new appender to log to file `"Auth.log"` any message with log level
`DEBUG` or less and prefixes timestamp, type and level to message
In the example, having two different loggers to log to console is perfectly
legal but redundant.
Once we have the list of loggers to read, system will try to configure a new
logger from its config line. Logger config line follows the format:
```ini
LogLevel,AppenderList
```
Its a list of elements separated by comma where each element has its own meaning
```
LogLevel
0 - (Disabled)
1 - (Fatal)
2 - (Error)
3 - (Warning)
4 - (Info)
5 - (Debug)
6 - (Trace)
AppenderList: List of appenders linked to logger
(Using spaces as separator).
```
**EXAMPLES**
1. **EXAMPLE 1**
Log errors to console and a file called server.log that only contain
logs for this server run. File should prefix timestamp, type and log level to
the messages. Console should prefix type and log level.
```ini
Appender.Console=1,2,6
Appender.Server=2,2,7,Server.log,w
Logger.root=2,Console Server
```
Lets trace how system will log two different messages:
```cpp
LOG_ERROR("guild", "Guild 1 created");
```
System will try to find logger of type GUILD, as no logger is configured
for GUILD it will use Root logger. As message Log Level is equal or less
than the Log level of logger the message is sent to the Appenders
configured in the Logger. `"Console"` and `"Server"`.
Console will write:
```
"ERROR [GUILD] Guild 1 created"
```
Server will write to file
```
"2012-08-15 ERROR [GUILD] Guild 1 created"
```
```cpp
LOG_INFO("entities.player.character", "Player Name Logged in");
```
System will try to find logger of type `"character"`, as no logger is
configured for `"character"` it will use Root logger. As message Log Level is
not equal or less than the Log level of logger the message its discarted.
2. **EXAMPLE 2**
Same example that above, but now i want to see all messages of level INFO on
file and server file should add timestamp on creation.
```ini
Appender.Console=1,2,6
Appender.Server=2,4,15,Server.log
Logger.root=3,Console Server
```
Lets trace how system will log two different messages:
```cpp
LOG_ERROR("guild", "Guild 1 created");
```
Performs exactly as example 1.
```cpp
LOG_INFO("entities.player.character", "Player Name Logged in");
```
System will try to find logger of type `"character"`, as no logger is
configured for `"character"` it will use Root logger. As message Log Level is
equal or less than the Log level of logger the message is sent to the
Appenders configured in the Logger. `"Console"` and `"Server"`.
Console will discard msg as Log Level is not less or equal to this appender
Server will write to file:
```
"2012-08-15 INFO [CHARACTER ] Player Name Logged in"
```
3. **EXAMPLE 3**
As a dev, i may be interested in logging just a particular part of the core
while i'm trying to fix something. So... i want to debug `"guild"` to maximum
and also some `"character"` events to some point. Also im checking some Waypoints
so i want SQLDEV to be logged to file without prefixes. All other messages
should only be logged to console, `"guild"` to `TRACE` and `"character"` to `INFO`
```ini
Appender.Console=1,6
Appender.SQLDev=2,5,0,SQLDev.log
Logger.guild=6,Console
Logger.entities.player.character=4,Console
Logger.sql.dev=4,SQLDev
```
With this config, any message logger with a Log type different to `"guild"`,
`"character"` or `"sql.dev"` will be ignored, as we didn't define a logger Root and
system created a default Root disabled. Appender Console, log level should be
defined to allow all possible messages of its loggers, in this case `"guild"` uses
`TRACE (6)`, so Appender should allow it. Logger Characters will limit it's own
messages to `INFO (4)`

View file

@ -4,12 +4,17 @@
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*/
#include "Config.h"
#include "MapManager.h"
#include "MMapManager.h"
#include "Log.h"
#include "StringFormat.h"
namespace MMAP
{
static char const* const MAP_FILE_NAME_FORMAT = "%s/mmaps/%03i.mmap";
static char const* const TILE_FILE_NAME_FORMAT = "%s/mmaps/%03i%02i%02i.mmtile";
// ######################## MMapManager ########################
MMapManager::~MMapManager()
{
@ -27,17 +32,14 @@ namespace MMAP
return true;
// load and init dtNavMesh - read parameters from file
uint32 pathLen = sWorld->GetDataPath().length() + strlen("mmaps/%03i.mmap") + 1;
char* fileName = new char[pathLen];
snprintf(fileName, pathLen, (sWorld->GetDataPath() + "mmaps/%03i.mmap").c_str(), mapId);
std::string fileName = acore::StringFormat(MAP_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", ".").c_str(), mapId);
FILE* file = fopen(fileName, "rb");
FILE* file = fopen(fileName.c_str(), "rb");
if (!file)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "MMAP:loadMapData: Error: Could not open mmap file '%s'", fileName);
LOG_DEBUG("maps", "MMAP:loadMapData: Error: Could not open mmap file '%s'", fileName.c_str());
#endif
delete [] fileName;
return false;
}
@ -47,7 +49,6 @@ namespace MMAP
if (count != 1)
{
;//TC_LOG_DEBUG(LOG_FILTER_MAPS, "MMAP:loadMapData: Error: Could not read params from file '%s'", fileName);
delete [] fileName;
return false;
}
@ -56,15 +57,12 @@ namespace MMAP
if (DT_SUCCESS != mesh->init(&params))
{
dtFreeNavMesh(mesh);
sLog->outError("MMAP:loadMapData: Failed to initialize dtNavMesh for mmap %03u from file %s", mapId, fileName);
delete [] fileName;
LOG_ERROR("server", "MMAP:loadMapData: Failed to initialize dtNavMesh for mmap %03u from file %s", mapId, fileName.c_str());
return false;
}
delete [] fileName;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("MMAP:loadMapData: Loaded %03i.mmap", mapId);
LOG_DEBUG("server", "MMAP:loadMapData: Loaded %03i.mmap", mapId);
#endif
// store inside our map list
@ -85,7 +83,7 @@ namespace MMAP
Map* map = sMapMgr->FindBaseMap(mapId);
if (!map)
{
sLog->outMisc("ZOMG! MoveMaps: BaseMap not found!");
LOG_INFO("misc", "ZOMG! MoveMaps: BaseMap not found!");
return this->MMapLock;
}
@ -108,38 +106,31 @@ namespace MMAP
uint32 packedGridPos = packTileID(x, y);
if (mmap->mmapLoadedTiles.find(packedGridPos) != mmap->mmapLoadedTiles.end())
{
sLog->outError("MMAP:loadMap: Asked to load already loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y);
LOG_ERROR("server", "MMAP:loadMap: Asked to load already loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y);
return false;
}
// load this tile :: mmaps/MMMXXYY.mmtile
uint32 pathLen = sWorld->GetDataPath().length() + strlen("mmaps/%03i%02i%02i.mmtile") + 1;
char* fileName = new char[pathLen];
snprintf(fileName, pathLen, (sWorld->GetDataPath() + "mmaps/%03i%02i%02i.mmtile").c_str(), mapId, x, y);
FILE* file = fopen(fileName, "rb");
std::string fileName = acore::StringFormat(TILE_FILE_NAME_FORMAT, sConfigMgr->GetOption<std::string>("DataDir", ".").c_str(), mapId, x, y);
FILE* file = fopen(fileName.c_str(), "rb");
if (!file)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "MMAP:loadMap: Could not open mmtile file '%s'", fileName);
#endif
delete [] fileName;
LOG_DEBUG("maps", "MMAP:loadMap: Could not open mmtile file '%s'", fileName.c_str());
return false;
}
delete [] fileName;
// read header
MmapTileHeader fileHeader;
if (fread(&fileHeader, sizeof(MmapTileHeader), 1, file) != 1 || fileHeader.mmapMagic != MMAP_MAGIC)
{
sLog->outError("MMAP:loadMap: Bad header in mmap %03u%02i%02i.mmtile", mapId, x, y);
LOG_ERROR("server", "MMAP:loadMap: Bad header in mmap %03u%02i%02i.mmtile", mapId, x, y);
fclose(file);
return false;
}
if (fileHeader.mmapVersion != MMAP_VERSION)
{
sLog->outError("MMAP:loadMap: %03u%02i%02i.mmtile was built with generator v%i, expected v%i",
LOG_ERROR("server", "MMAP:loadMap: %03u%02i%02i.mmtile was built with generator v%i, expected v%i",
mapId, x, y, fileHeader.mmapVersion, MMAP_VERSION);
fclose(file);
return false;
@ -151,7 +142,7 @@ namespace MMAP
size_t result = fread(data, fileHeader.size, 1, file);
if (!result)
{
sLog->outError("MMAP:loadMap: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, x, y);
LOG_ERROR("server", "MMAP:loadMap: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, x, y);
fclose(file);
return false;
}
@ -173,13 +164,13 @@ namespace MMAP
++loadedTiles;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
dtMeshHeader* header = (dtMeshHeader*)data;
sLog->outDetail("MMAP:loadMap: Loaded mmtile %03i[%02i,%02i] into %03i[%02i,%02i]", mapId, x, y, mapId, header->x, header->y);
LOG_DEBUG("server", "MMAP:loadMap: Loaded mmtile %03i[%02i,%02i] into %03i[%02i,%02i]", mapId, x, y, mapId, header->x, header->y);
#endif
return true;
}
else
{
sLog->outError("MMAP:loadMap: Could not load %03u%02i%02i.mmtile into navmesh", mapId, x, y);
LOG_ERROR("server", "MMAP:loadMap: Could not load %03u%02i%02i.mmtile into navmesh", mapId, x, y);
dtFree(data);
return false;
}
@ -196,7 +187,7 @@ namespace MMAP
{
// file may not exist, therefore not loaded
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "MMAP:unloadMap: Asked to unload not loaded navmesh map. %03u%02i%02i.mmtile", mapId, x, y);
LOG_DEBUG("maps", "MMAP:unloadMap: Asked to unload not loaded navmesh map. %03u%02i%02i.mmtile", mapId, x, y);
#endif
return false;
}
@ -209,7 +200,7 @@ namespace MMAP
{
// file may not exist, therefore not loaded
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "MMAP:unloadMap: Asked to unload not loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y);
LOG_DEBUG("maps", "MMAP:unloadMap: Asked to unload not loaded navmesh tile. %03u%02i%02i.mmtile", mapId, x, y);
#endif
return false;
}
@ -228,7 +219,7 @@ namespace MMAP
// this is technically a memory leak
// if the grid is later reloaded, dtNavMesh::addTile will return error but no extra memory is used
// we cannot recover from this error - assert out
sLog->outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y);
LOG_ERROR("server", "MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y);
ABORT();
}
else
@ -236,7 +227,7 @@ namespace MMAP
mmap->mmapLoadedTiles.erase(packedGridPos);
--loadedTiles;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId);
LOG_DEBUG("server", "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId);
#endif
return true;
}
@ -252,7 +243,7 @@ namespace MMAP
{
// file may not exist, therefore not loaded
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "MMAP:unloadMap: Asked to unload not loaded navmesh map %03u", mapId);
LOG_DEBUG("maps", "MMAP:unloadMap: Asked to unload not loaded navmesh map %03u", mapId);
#endif
return false;
}
@ -271,12 +262,12 @@ namespace MMAP
}
if (status != DT_SUCCESS)
sLog->outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y);
LOG_ERROR("server", "MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y);
else
{
--loadedTiles;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId);
LOG_DEBUG("server", "MMAP:unloadMap: Unloaded mmtile %03i[%02i,%02i] from %03i", mapId, x, y, mapId);
#endif
}
}
@ -284,7 +275,7 @@ namespace MMAP
delete mmap;
loadedMMaps.erase(mapId);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("MMAP:unloadMap: Unloaded %03i.mmap", mapId);
LOG_DEBUG("server", "MMAP:unloadMap: Unloaded %03i.mmap", mapId);
#endif
return true;
@ -299,7 +290,7 @@ namespace MMAP
{
// file may not exist, therefore not loaded
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "MMAP:unloadMapInstance: Asked to unload not loaded navmesh map %03u", mapId);
LOG_DEBUG("maps", "MMAP:unloadMapInstance: Asked to unload not loaded navmesh map %03u", mapId);
#endif
return false;
}
@ -308,7 +299,7 @@ namespace MMAP
if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "MMAP:unloadMapInstance: Asked to unload not loaded dtNavMeshQuery mapId %03u instanceId %u", mapId, instanceId);
LOG_DEBUG("maps", "MMAP:unloadMapInstance: Asked to unload not loaded dtNavMeshQuery mapId %03u instanceId %u", mapId, instanceId);
#endif
return false;
}
@ -318,7 +309,7 @@ namespace MMAP
dtFreeNavMeshQuery(query);
mmap->navMeshQueries.erase(instanceId);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("MMAP:unloadMapInstance: Unloaded mapId %03u instanceId %u", mapId, instanceId);
LOG_DEBUG("server", "MMAP:unloadMapInstance: Unloaded mapId %03u instanceId %u", mapId, instanceId);
#endif
return true;
@ -351,12 +342,12 @@ namespace MMAP
if (DT_SUCCESS != query->init(mmap->navMesh, 1024))
{
dtFreeNavMeshQuery(query);
sLog->outError("MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
LOG_ERROR("server", "MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
return nullptr;
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
LOG_DEBUG("server", "MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
#endif
mmap->navMeshQueries.insert(std::pair<uint32, dtNavMeshQuery*>(instanceId, query));
}

View file

@ -7,10 +7,10 @@
#ifndef _MMAP_MANAGER_H
#define _MMAP_MANAGER_H
#include "Common.h"
#include "DetourAlloc.h"
#include "DetourNavMesh.h"
#include "DetourExtended.h"
#include "World.h"
#include <unordered_map>
#include <shared_mutex>

View file

@ -270,12 +270,12 @@ namespace VMAP
WorldModel* worldmodel = new WorldModel();
if (!worldmodel->readFile(basepath + filename + ".vmo"))
{
sLog->outError("VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
LOG_ERROR("server", "VMapManager2: could not load '%s%s.vmo'", basepath.c_str(), filename.c_str());
delete worldmodel;
return nullptr;
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str());
LOG_DEBUG("maps", "VMapManager2: loading file '%s%s'", basepath.c_str(), filename.c_str());
#endif
model = iLoadedModelFiles.insert(std::pair<std::string, ManagedModel>(filename, ManagedModel())).first;
model->second.setModel(worldmodel);
@ -291,13 +291,13 @@ namespace VMAP
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
if (model == iLoadedModelFiles.end())
{
sLog->outError("VMapManager2: trying to unload non-loaded file '%s'", filename.c_str());
LOG_ERROR("server", "VMapManager2: trying to unload non-loaded file '%s'", filename.c_str());
return;
}
if (model->second.decRefCount() == 0)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_MAPS, "VMapManager2: unloading file '%s'", filename.c_str());
LOG_DEBUG("maps", "VMapManager2: unloading file '%s'", filename.c_str());
#endif
delete model->second.getModel();
iLoadedModelFiles.erase(model);

View file

@ -5,12 +5,12 @@
*/
#include "MapTree.h"
#include "Common.h"
#include "ModelInstance.h"
#include "VMapManager2.h"
#include "VMapDefinitions.h"
#include "Log.h"
#include "Errors.h"
#include <string>
#include <sstream>
#include <iomanip>
@ -45,7 +45,7 @@ namespace VMAP
void operator()(const Vector3& point, uint32 entry)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) && defined(VMAP_DEBUG)
sLog->outDebug(LOG_FILTER_MAPS, "AreaInfoCallback: trying to intersect '%s'", prims[entry].name.c_str());
LOG_DEBUG("maps", "AreaInfoCallback: trying to intersect '%s'", prims[entry].name.c_str());
#endif
prims[entry].intersectPoint(point, aInfo);
}
@ -61,7 +61,7 @@ namespace VMAP
void operator()(const Vector3& point, uint32 entry)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) && defined(VMAP_DEBUG)
sLog->outDebug(LOG_FILTER_MAPS, "LocationInfoCallback: trying to intersect '%s'", prims[entry].name.c_str());
LOG_DEBUG("maps", "LocationInfoCallback: trying to intersect '%s'", prims[entry].name.c_str());
#endif
if (prims[entry].GetLocationInfo(point, locInfo))
result = true;
@ -338,7 +338,7 @@ namespace VMAP
}
if (!iTreeValues)
{
sLog->outError("StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY);
LOG_ERROR("server", "StaticMapTree::LoadMapTile() : tree has not been initialized [%u, %u]", tileX, tileY);
return false;
}
bool result = true;
@ -364,7 +364,7 @@ namespace VMAP
// acquire model instance
WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name);
if (!model)
sLog->outError("StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY);
LOG_ERROR("server", "StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY);
// update tree
uint32 referencedVal;
@ -376,7 +376,7 @@ namespace VMAP
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) && defined(VMAP_DEBUG)
if (referencedVal > iNTreeValues)
{
sLog->outDebug(LOG_FILTER_MAPS, "StaticMapTree::LoadMapTile() : invalid tree element (%u/%u)", referencedVal, iNTreeValues);
LOG_DEBUG("maps", "StaticMapTree::LoadMapTile() : invalid tree element (%u/%u)", referencedVal, iNTreeValues);
continue;
}
#endif
@ -388,9 +388,9 @@ namespace VMAP
++iLoadedSpawns[referencedVal];
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) && defined(VMAP_DEBUG)
if (iTreeValues[referencedVal].ID != spawn.ID)
sLog->outDebug(LOG_FILTER_MAPS, "StaticMapTree::LoadMapTile() : trying to load wrong spawn in node");
LOG_DEBUG("maps", "StaticMapTree::LoadMapTile() : trying to load wrong spawn in node");
else if (iTreeValues[referencedVal].name != spawn.name)
sLog->outDebug(LOG_FILTER_MAPS, "StaticMapTree::LoadMapTile() : name collision on GUID=%u", spawn.ID);
LOG_DEBUG("maps", "StaticMapTree::LoadMapTile() : name collision on GUID=%u", spawn.ID);
#endif
}
}
@ -414,7 +414,7 @@ namespace VMAP
loadedTileMap::iterator tile = iLoadedTiles.find(tileID);
if (tile == iLoadedTiles.end())
{
sLog->outError("StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY);
LOG_ERROR("server", "StaticMapTree::UnloadMapTile() : trying to unload non-loaded tile - Map:%u X:%u Y:%u", iMapID, tileX, tileY);
return;
}
if (tile->second) // file associated with tile
@ -448,7 +448,7 @@ namespace VMAP
else
{
if (!iLoadedSpawns.count(referencedNode))
sLog->outError("StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
LOG_ERROR("server", "StaticMapTree::UnloadMapTile() : trying to unload non-referenced model '%s' (ID:%u)", spawn.name.c_str(), spawn.ID);
else if (--iLoadedSpawns[referencedNode] == 0)
{
iTreeValues[referencedNode].setUnloaded();

View file

@ -44,14 +44,14 @@ void LoadGameObjectModelList()
FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb");
if (!model_list_file)
{
sLog->outError("Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS);
LOG_ERROR("server", "Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS);
return;
}
char magic[8];
if (fread(magic, 1, 8, model_list_file) != 8 || memcmp(magic, VMAP::VMAP_MAGIC, 8) != 0)
{
sLog->outError("File '%s' has wrong header, expected %s.", VMAP::GAMEOBJECT_MODELS, VMAP::VMAP_MAGIC);
LOG_ERROR("maps", "File '%s' has wrong header, expected %s.", VMAP::GAMEOBJECT_MODELS, VMAP::VMAP_MAGIC);
return;
}
@ -72,13 +72,13 @@ void LoadGameObjectModelList()
|| fread(&v1, sizeof(Vector3), 1, model_list_file) != 1
|| fread(&v2, sizeof(Vector3), 1, model_list_file) != 1)
{
sLog->outError("File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS);
LOG_ERROR("server", "File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS);
break;
}
if (v1.isNaN() || v2.isNaN())
{
sLog->outError("File '%s' Model '%s' has invalid v1%s v2%s values!",
LOG_ERROR("maps", "File '%s' Model '%s' has invalid v1%s v2%s values!",
VMAP::GAMEOBJECT_MODELS, std::string(buff, name_length).c_str(), v1.toString().c_str(), v2.toString().c_str());
continue;
}
@ -87,8 +87,9 @@ void LoadGameObjectModelList()
}
fclose(model_list_file);
sLog->outString(">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
GameObjectModel::~GameObjectModel()
@ -107,7 +108,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn
// ignore models with no bounds
if (mdl_box == G3D::AABox::zero())
{
sLog->outError("GameObject model %s has zero bounds, loading skipped", it->second.name.c_str());
LOG_ERROR("server", "GameObject model %s has zero bounds, loading skipped", it->second.name.c_str());
return false;
}

View file

@ -27,7 +27,7 @@ namespace
{
if (!replace)
{
sLog->outError("> Config: Option '%s' is exist! Option key - '%s'", optionName.c_str(), itr->second.c_str());
LOG_ERROR("server", "> Config: Option '%s' is exist! Option key - '%s'", optionName.c_str(), itr->second.c_str());
return;
}
@ -92,7 +92,7 @@ namespace
}
catch (const std::exception& e)
{
sLog->outError("> Config: %s", e.what());
LOG_ERROR("server", "> Config: %s", e.what());
}
return false;
@ -134,7 +134,7 @@ T ConfigMgr::GetValueDefault(std::string const& name, T const& def, bool showLog
{
if (showLogs)
{
sLog->outError("> Config: Missing name %s in config, add \"%s = %s\"",
LOG_ERROR("server", "> Config: Missing name %s in config, add \"%s = %s\"",
name.c_str(), name.c_str(), acore::ToString(def).c_str());
}
@ -146,7 +146,7 @@ T ConfigMgr::GetValueDefault(std::string const& name, T const& def, bool showLog
{
if (showLogs)
{
sLog->outError("> Config: Bad value defined for name '%s', going to use '%s' instead",
LOG_ERROR("server", "> Config: Bad value defined for name '%s', going to use '%s' instead",
name.c_str(), acore::ToString(def).c_str());
}
@ -164,7 +164,7 @@ std::string ConfigMgr::GetValueDefault<std::string>(std::string const& name, std
{
if (showLogs)
{
sLog->outError("> Config: Missing name %s in config, add \"%s = %s\"",
LOG_ERROR("server", "> Config: Missing name %s in config, add \"%s = %s\"",
name.c_str(), name.c_str(), def.c_str());
}
@ -190,7 +190,7 @@ bool ConfigMgr::GetOption<bool>(std::string const& name, bool const& def, bool s
{
if (showLogs)
{
sLog->outError("> Config: Bad value defined for name '%s', going to use '%s' instead",
LOG_ERROR("server", "> Config: Bad value defined for name '%s', going to use '%s' instead",
name.c_str(), def ? "true" : "false");
}
@ -299,13 +299,13 @@ bool ConfigMgr::LoadModulesConfigs()
return false;
// Print modules configurations
sLog->outString();
sLog->outString("Using modules configuration:");
LOG_INFO("server", " ");
LOG_INFO("server", "Using modules configuration:");
for (auto const& itr : moduleConfigFiles)
sLog->outString("> %s", itr.c_str());
LOG_INFO("server", "> %s", itr.c_str());
sLog->outString("");
LOG_INFO("server", " ");
return true;
}

View file

@ -19,14 +19,14 @@ DatabaseLoader& DatabaseLoader::AddDatabase(DatabaseWorkerPool<T>& pool, std::st
std::string const dbString = sConfigMgr->GetOption<std::string>(name + "DatabaseInfo", "");
if (dbString.empty())
{
sLog->outSQLDriver("Database %s not specified in configuration file!", name.c_str());
LOG_INFO("sql.driver", "Database %s not specified in configuration file!", name.c_str());
return false;
}
uint8 const asyncThreads = sConfigMgr->GetOption<uint8>(name + "Database.WorkerThreads", 1);
if (asyncThreads < 1 || asyncThreads > 32)
{
sLog->outSQLDriver("%s database: invalid number of worker threads specified. Please pick a value between 1 and 32.", name.c_str());
LOG_INFO("sql.driver", "%s database: invalid number of worker threads specified. Please pick a value between 1 and 32.", name.c_str());
return false;
}
@ -46,7 +46,7 @@ DatabaseLoader& DatabaseLoader::AddDatabase(DatabaseWorkerPool<T>& pool, std::st
auto sleepThread = [&]()
{
sLog->outSQLDriver("> Retrying after %u seconds", durationSecs.count());
LOG_INFO("sql.driver", "> Retrying after %u seconds", static_cast<uint32>(durationSecs.count()));
std::this_thread::sleep_for(durationSecs);
};
@ -72,7 +72,7 @@ DatabaseLoader& DatabaseLoader::AddDatabase(DatabaseWorkerPool<T>& pool, std::st
// If the error wasn't handled quit
if (error)
{
sLog->outSQLDriver("DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile for specific errors", name.c_str());
LOG_ERROR("sql.driver", "DatabasePool %s NOT opened. There were errors opening the MySQL connections. Check your SQLDriverLogFile for specific errors", name.c_str());
return false;
}
}
@ -90,7 +90,7 @@ DatabaseLoader& DatabaseLoader::AddDatabase(DatabaseWorkerPool<T>& pool, std::st
{
if (!pool.PrepareStatements())
{
sLog->outSQLDriver("Could not prepare statements of the %s database, see log for details.", name.c_str());
LOG_ERROR("sql.driver", "Could not prepare statements of the %s database, see log for details.", name.c_str());
return false;
}

View file

@ -38,8 +38,8 @@ uint32 DatabaseWorkerPool<T>::Open()
{
WPFatal(_connectionInfo.get(), "Connection info was not set!");
sLog->outSQLDriver("Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
GetDatabaseName(), _async_threads, _synch_threads);
LOG_INFO("sql.driver", "Opening DatabasePool '%s'. Asynchronous connections: %u, synchronous connections: %u.",
GetDatabaseName(), _async_threads, _synch_threads);
uint32 error = OpenConnections(IDX_ASYNC, _async_threads);
@ -52,17 +52,19 @@ uint32 DatabaseWorkerPool<T>::Open()
if (!error)
{
sLog->outSQLDriver("DatabasePool '%s' opened successfully. %u total connections running.",
GetDatabaseName(), (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC]));
LOG_INFO("sql.driver", "DatabasePool '%s' opened successfully. %u total connections running.",
GetDatabaseName(), (_connectionCount[IDX_SYNCH] + _connectionCount[IDX_ASYNC]));
}
LOG_INFO("sql.driver", " ");
return error;
}
template <class T>
void DatabaseWorkerPool<T>::Close()
{
sLog->outSQLDriver("Closing down DatabasePool '%s'.", GetDatabaseName());
LOG_INFO("sql.driver", "Closing down DatabasePool '%s'.", GetDatabaseName());
//! Shuts down delaythreads for this connection pool by underlying deactivate().
//! The next dequeue attempt in the worker thread tasks will result in an error,
@ -78,8 +80,8 @@ void DatabaseWorkerPool<T>::Close()
t->Close(); //! Closes the actualy MySQL connection.
}
sLog->outSQLDriver("Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
GetDatabaseName());
LOG_INFO("sql.driver", "Asynchronous connections on DatabasePool '%s' terminated. Proceeding with synchronous connections.",
GetDatabaseName());
//! Shut down the synchronous connections
//! There's no need for locking the connection, because DatabaseWorkerPool<>::Close
@ -92,7 +94,7 @@ void DatabaseWorkerPool<T>::Close()
delete _queue;
delete _mqueue;
sLog->outSQLDriver("All connections on DatabasePool '%s' closed.", GetDatabaseName());
LOG_INFO("sql.driver", "All connections on DatabasePool '%s' closed.", GetDatabaseName());
}
template <class T>
@ -125,7 +127,7 @@ uint32 DatabaseWorkerPool<T>::OpenConnections(InternalIndex type, uint8 numConne
{
if (mysql_get_server_version(t->GetHandle()) < MIN_MYSQL_SERVER_VERSION)
{
sLog->outSQLDriver("Not support MySQL versions below 5.7");
LOG_ERROR("sql.driver", "Not support MySQL versions below 5.7");
error = 1;
}
}
@ -299,10 +301,10 @@ void DatabaseWorkerPool<T>::CommitTransaction(SQLTransaction transaction)
switch (transaction->GetSize())
{
case 0:
sLog->outSQLDriver("Transaction contains 0 queries. Not executing.");
LOG_INFO("sql.driver", "Transaction contains 0 queries. Not executing.");
return;
case 1:
sLog->outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
LOG_INFO("sql.driver", "Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
break;
default:
break;

View file

@ -32,7 +32,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_TINY))
{
sLog->outSQLDriver("Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetUInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@ -50,7 +50,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_TINY))
{
sLog->outSQLDriver("Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetInt8() on non-tinyint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@ -75,7 +75,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR))
{
sLog->outSQLDriver("Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetUInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@ -93,7 +93,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_SHORT) && !IsType(MYSQL_TYPE_YEAR))
{
sLog->outSQLDriver("Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetInt16() on non-smallint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@ -111,7 +111,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG))
{
sLog->outSQLDriver("Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetUInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@ -129,7 +129,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_INT24) && !IsType(MYSQL_TYPE_LONG))
{
sLog->outSQLDriver("Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetInt32() on non-(medium)int field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@ -147,7 +147,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT))
{
sLog->outSQLDriver("Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetUInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@ -165,7 +165,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_LONGLONG) && !IsType(MYSQL_TYPE_BIT))
{
sLog->outSQLDriver("Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetInt64() on non-bigint field. Using type: %s.", FieldTypeToString(data.type));
return 0;
}
#endif
@ -183,7 +183,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_FLOAT))
{
sLog->outSQLDriver("Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetFloat() on non-float field. Using type: %s.", FieldTypeToString(data.type));
return 0.0f;
}
#endif
@ -201,7 +201,7 @@ public:
#ifdef ACORE_DEBUG
if (!IsType(MYSQL_TYPE_DOUBLE))
{
sLog->outSQLDriver("Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Warning: GetDouble() on non-double field. Using type: %s.", FieldTypeToString(data.type));
return 0.0f;
}
#endif
@ -219,7 +219,7 @@ public:
#ifdef ACORE_DEBUG
if (IsNumeric())
{
sLog->outSQLDriver("Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type));
LOG_INFO("sql.driver", "Error: GetCString() on numeric field. Using type: %s.", FieldTypeToString(data.type));
return nullptr;
}
#endif
@ -331,7 +331,7 @@ protected:
MYSQL_TYPE_SET:
*/
default:
sLog->outSQLDriver("SQL::SizeForType(): invalid field type %u", uint32(field->type));
LOG_INFO("sql.driver", "SQL::SizeForType(): invalid field type %u", uint32(field->type));
return 0;
}
}

View file

@ -93,4 +93,7 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_INS_CHAR_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES (?, ?, ?, ?, ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
// 0: string, 1: string, 2: string // Complete name: "Login_Insert_Failed_Account_Login_due_password_IP_Logging"
PrepareStatement(LOGIN_INS_FALP_IP_LOGGING, "INSERT INTO logs_ip_actions (account_id,character_guid,type,ip,systemnote,unixtime,time) VALUES ((SELECT id FROM account WHERE username = ?), 0, 1, ?, ?, unix_timestamp(NOW()), NOW())", CONNECTION_ASYNC);
// DB logging
PrepareStatement(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC);
}

View file

@ -111,6 +111,8 @@ enum LoginDatabaseStatements
LOGIN_SEL_ACCOUNT_MUTE_INFO,
LOGIN_DEL_ACCOUNT_MUTED,
LOGIN_INS_LOG,
MAX_LOGINDATABASE_STATEMENTS
};

View file

@ -0,0 +1,35 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#include "AppenderDB.h"
#include "DatabaseEnv.h"
#include "LogMessage.h"
#include "PreparedStatement.h"
AppenderDB::AppenderDB(uint8 id, std::string const& name, LogLevel level, AppenderFlags /*flags*/, std::vector<std::string_view> const& /*args*/)
: Appender(id, name, level), realmId(0), enabled(false) { }
AppenderDB::~AppenderDB() { }
void AppenderDB::_write(LogMessage const* message)
{
// Avoid infinite loop, PExecute triggers Logging with "sql.sql" type
if (!enabled || (message->type.find("sql") != std::string::npos))
return;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_LOG);
stmt->setUInt64(0, message->mtime);
stmt->setUInt32(1, realmId);
stmt->setString(2, message->type);
stmt->setUInt8(3, uint8(message->level));
stmt->setString(4, message->text);
LoginDatabase.Execute(stmt);
}
void AppenderDB::setRealmId(uint32 _realmId)
{
enabled = true;
realmId = _realmId;
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef APPENDERDB_H
#define APPENDERDB_H
#include "Appender.h"
class AppenderDB : public Appender
{
public:
static constexpr AppenderType type = APPENDER_DB;
AppenderDB(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector<std::string_view> const& args);
~AppenderDB();
void setRealmId(uint32 realmId) override;
AppenderType getType() const override { return type; }
private:
uint32 realmId;
bool enabled;
void _write(LogMessage const* message) override;
};
#endif

View file

@ -68,7 +68,7 @@ uint32 MySQLConnection::Open()
MYSQL* mysqlInit = mysql_init(nullptr);
if (!mysqlInit)
{
sLog->outError("Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str());
LOG_ERROR("sql.sql", "Could not initialize Mysql connection to database `%s`", m_connectionInfo.database.c_str());
return false;
}
@ -121,18 +121,17 @@ uint32 MySQLConnection::Open()
{
if (!m_reconnecting)
{
sLog->outSQLDriver("MySQL client library: %s", mysql_get_client_info());
sLog->outSQLDriver("MySQL server ver: %s ", mysql_get_server_info(m_Mysql));
LOG_INFO("sql.sql", "MySQL client library: %s", mysql_get_client_info());
LOG_INFO("sql.sql", "MySQL server ver: %s ", mysql_get_server_info(m_Mysql));
if (mysql_get_server_version(m_Mysql) != mysql_get_client_version())
{
sLog->outSQLDriver("[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
LOG_WARN("sql.sql", "[WARNING] MySQL client/server version mismatch; may conflict with behaviour of prepared statements.");
}
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("Connected to MySQL database at %s", m_connectionInfo.host.c_str());
#endif
LOG_INFO("sql.sql", "Connected to MySQL database at %s", m_connectionInfo.host.c_str());
mysql_autocommit(m_Mysql, 1);
// set connection properties to UTF8 to properly handle locales for different
@ -141,7 +140,7 @@ uint32 MySQLConnection::Open()
return 0;
}
sLog->outError("Could not connect to MySQL database at %s: %s", m_connectionInfo.host.c_str(), mysql_error(mysqlInit));
LOG_ERROR("sql.sql", "Could not connect to MySQL database at %s: %s", m_connectionInfo.host.c_str(), mysql_error(mysqlInit));
uint32 errorCode = mysql_errno(mysqlInit);
mysql_close(mysqlInit);
return errorCode;
@ -158,29 +157,23 @@ bool MySQLConnection::Execute(const char* sql)
if (!m_Mysql)
return false;
uint32 _s = getMSTime();
if (mysql_query(m_Mysql, sql))
{
uint32 _s = 0;
if (sLog->GetSQLDriverQueryLogging())
_s = getMSTime();
uint32 lErrno = mysql_errno(m_Mysql);
if (mysql_query(m_Mysql, sql))
{
uint32 lErrno = mysql_errno(m_Mysql);
LOG_ERROR("sql.sql", "SQL: %s", sql);
LOG_ERROR("sql.sql", "ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
sLog->outSQLDriver("SQL: %s", sql);
sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(sql); // Try again
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(sql); // Try again
return false;
}
else if (sLog->GetSQLDriverQueryLogging())
{
sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
}
return false;
}
LOG_DEBUG("sql.sql", "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
return true;
}
@ -201,14 +194,12 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
MYSQL_STMT* msql_STMT = m_mStmt->GetSTMT();
MYSQL_BIND* msql_BIND = m_mStmt->GetBind();
uint32 _s = 0;
if (sLog->GetSQLDriverQueryLogging())
_s = getMSTime();
uint32 _s = getMSTime();
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
{
uint32 lErrno = mysql_errno(m_Mysql);
sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
LOG_ERROR("sql.sql", "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(stmt); // Try again
@ -220,7 +211,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
if (mysql_stmt_execute(msql_STMT))
{
uint32 lErrno = mysql_errno(m_Mysql);
sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
LOG_ERROR("sql.sql", "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return Execute(stmt); // Try again
@ -229,8 +220,7 @@ bool MySQLConnection::Execute(PreparedStatement* stmt)
return false;
}
if (sLog->GetSQLDriverQueryLogging())
sLog->outSQLDriver("[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
LOG_DEBUG("sql.sql", "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
m_mStmt->ClearParameters();
return true;
@ -254,14 +244,12 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES** pResult, uint6
MYSQL_STMT* msql_STMT = m_mStmt->GetSTMT();
MYSQL_BIND* msql_BIND = m_mStmt->GetBind();
uint32 _s = 0;
if (sLog->GetSQLDriverQueryLogging())
_s = getMSTime();
uint32 _s = getMSTime();
if (mysql_stmt_bind_param(msql_STMT, msql_BIND))
{
uint32 lErrno = mysql_errno(m_Mysql);
sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
LOG_ERROR("sql.sql", "SQL(p): %s\n [ERROR]: [%u] %s", m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return _Query(stmt, pResult, pRowCount, pFieldCount); // Try again
@ -273,8 +261,8 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES** pResult, uint6
if (mysql_stmt_execute(msql_STMT))
{
uint32 lErrno = mysql_errno(m_Mysql);
sLog->outSQLDriver("SQL(p): %s\n [ERROR]: [%u] %s",
m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
LOG_ERROR("sql.sql", "SQL(p): %s\n [ERROR]: [%u] %s",
m_mStmt->getQueryString(m_queries[index].first).c_str(), lErrno, mysql_stmt_error(msql_STMT));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return _Query(stmt, pResult, pRowCount, pFieldCount); // Try again
@ -283,8 +271,7 @@ bool MySQLConnection::_Query(PreparedStatement* stmt, MYSQL_RES** pResult, uint6
return false;
}
if (sLog->GetSQLDriverQueryLogging())
sLog->outSQLDriver("[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
LOG_DEBUG("sql.sql", "[%u ms] SQL(p): %s", getMSTimeDiff(_s, getMSTime()), m_mStmt->getQueryString(m_queries[index].first).c_str());
m_mStmt->ClearParameters();
@ -318,32 +305,28 @@ bool MySQLConnection::_Query(const char* sql, MYSQL_RES** pResult, MYSQL_FIELD**
return false;
{
uint32 _s = 0;
if (sLog->GetSQLDriverQueryLogging())
_s = getMSTime();
uint32 _s = getMSTime();
if (mysql_query(m_Mysql, sql))
{
uint32 lErrno = mysql_errno(m_Mysql);
sLog->outSQLDriver("SQL: %s", sql);
sLog->outSQLDriver("ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
LOG_ERROR("sql.sql", "SQL: %s", sql);
LOG_ERROR("sql.sql", "ERROR: [%u] %s", lErrno, mysql_error(m_Mysql));
if (_HandleMySQLErrno(lErrno)) // If it returns true, an error was handled successfully (i.e. reconnection)
return _Query(sql, pResult, pFields, pRowCount, pFieldCount); // We try again
return false;
}
else if (sLog->GetSQLDriverQueryLogging())
{
sLog->outSQLDriver("[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
}
LOG_DEBUG("sql.sql", "[%u ms] SQL: %s", getMSTimeDiff(_s, getMSTime()), sql);
*pResult = mysql_store_result(m_Mysql);
*pRowCount = mysql_affected_rows(m_Mysql);
*pFieldCount = mysql_field_count(m_Mysql);
}
if (!*pResult )
if (!*pResult)
return false;
if (!*pRowCount)
@ -392,7 +375,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
ASSERT(stmt);
if (!Execute(stmt))
{
sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
LOG_INFO("sql.driver", "[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
RollbackTransaction();
return false;
}
@ -404,7 +387,7 @@ bool MySQLConnection::ExecuteTransaction(SQLTransaction& transaction)
ASSERT(sql);
if (!Execute(sql))
{
sLog->outSQLDriver("[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
LOG_INFO("sql.driver", "[Warning] Transaction aborted. %u queries not executed.", (uint32)queries.size());
RollbackTransaction();
return false;
}
@ -427,7 +410,7 @@ MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index)
ASSERT(index < m_stmts.size());
MySQLPreparedStatement* ret = m_stmts[index];
if (!ret)
sLog->outSQLDriver("ERROR: Could not fetch prepared statement %u on database `%s`, connection type: %s.",
LOG_INFO("sql.driver", "ERROR: Could not fetch prepared statement %u on database `%s`, connection type: %s.",
index, m_connectionInfo.database.c_str(), (m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
return ret;
@ -453,16 +436,16 @@ void MySQLConnection::PrepareStatement(uint32 index, const char* sql, Connection
MYSQL_STMT* stmt = mysql_stmt_init(m_Mysql);
if (!stmt)
{
sLog->outSQLDriver("[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql);
sLog->outSQLDriver("[ERROR]: %s", mysql_error(m_Mysql));
LOG_INFO("sql.driver", "[ERROR]: In mysql_stmt_init() id: %u, sql: \"%s\"", index, sql);
LOG_INFO("sql.driver", "[ERROR]: %s", mysql_error(m_Mysql));
m_prepareError = true;
}
else
{
if (mysql_stmt_prepare(stmt, sql, static_cast<unsigned long>(strlen(sql))))
{
sLog->outSQLDriver("[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql);
sLog->outSQLDriver("[ERROR]: %s", mysql_stmt_error(stmt));
LOG_INFO("sql.driver", "[ERROR]: In mysql_stmt_prepare() id: %u, sql: \"%s\"", index, sql);
LOG_INFO("sql.driver", "[ERROR]: %s", mysql_stmt_error(stmt));
mysql_stmt_close(stmt);
m_prepareError = true;
}
@ -506,9 +489,9 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
mysql_close(GetHandle());
if (this->Open()) // Don't remove 'this' pointer unless you want to skip loading all prepared statements....
{
sLog->outSQLDriver("Connection to the MySQL server is active.");
LOG_INFO("sql.driver", "Connection to the MySQL server is active.");
if (oldThreadId != mysql_thread_id(GetHandle()))
sLog->outSQLDriver("Successfully reconnected to %s @%s:%s (%s).",
LOG_INFO("sql.driver", "Successfully reconnected to %s @%s:%s (%s).",
m_connectionInfo.database.c_str(), m_connectionInfo.host.c_str(), m_connectionInfo.port_or_socket.c_str(),
(m_connectionFlags & CONNECTION_ASYNC) ? "asynchronous" : "synchronous");
@ -531,17 +514,17 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
// Outdated table or database structure - terminate core
case ER_BAD_FIELD_ERROR:
case ER_NO_SUCH_TABLE:
sLog->outError("Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders.");
LOG_ERROR("server", "Your database structure is not up to date. Please make sure you've executed all queries in the sql/updates folders.");
std::this_thread::sleep_for(10s);
std::abort();
return false;
case ER_PARSE_ERROR:
sLog->outError("Error while parsing SQL. Core fix required.");
LOG_ERROR("server", "Error while parsing SQL. Core fix required.");
std::this_thread::sleep_for(10s);
std::abort();
return false;
default:
sLog->outError("Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo);
LOG_ERROR("server", "Unhandled MySQL errno %u. Unexpected behaviour possible.", errNo);
return false;
}
}

View file

@ -73,7 +73,7 @@ void PreparedStatement::BindParameters()
}
#ifdef _DEBUG
if (i < m_stmt->m_paramCount)
sLog->outSQLDriver("[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index);
LOG_INFO("sql.driver", "[WARNING]: BindParameters() for statement %u did not bind all allocated parameters", m_index);
#endif
}
@ -246,7 +246,7 @@ void MySQLPreparedStatement::ClearParameters()
static bool ParamenterIndexAssertFail(uint32 stmtIndex, uint8 index, uint32 paramCount)
{
sLog->outError("Attempted to bind parameter %u%s on a PreparedStatement %u (statement has only %u parameters)", uint32(index) + 1, (index == 1 ? "st" : (index == 2 ? "nd" : (index == 3 ? "rd" : "nd"))), stmtIndex, paramCount);
LOG_ERROR("server", "Attempted to bind parameter %u%s on a PreparedStatement %u (statement has only %u parameters)", uint32(index) + 1, (index == 1 ? "st" : (index == 2 ? "nd" : (index == 3 ? "rd" : "nd"))), stmtIndex, paramCount);
return false;
}
@ -256,7 +256,7 @@ bool MySQLPreparedStatement::CheckValidIndex(uint8 index)
ASSERT(index < m_paramCount || ParamenterIndexAssertFail(m_stmt->m_index, index, m_paramCount));
if (m_paramsSet[index])
sLog->outSQLDriver("[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index);
LOG_INFO("sql.driver", "[WARNING] Prepared Statement (id: %u) trying to bind value on already bound index (%u).", m_stmt->m_index, index);
return true;
}

View file

@ -13,7 +13,7 @@ bool SQLQueryHolder::SetQuery(size_t index, const char* sql)
{
if (m_queries.size() <= index)
{
sLog->outError("Query index (%u) out of range (size: %u) for query: %s", uint32(index), (uint32)m_queries.size(), sql);
LOG_ERROR("server", "Query index (%u) out of range (size: %u) for query: %s", uint32(index), (uint32)m_queries.size(), sql);
return false;
}
@ -33,7 +33,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char* format, ...)
{
if (!format)
{
sLog->outError("Query (index: %u) is empty.", uint32(index));
LOG_ERROR("server", "Query (index: %u) is empty.", uint32(index));
return false;
}
@ -45,7 +45,7 @@ bool SQLQueryHolder::SetPQuery(size_t index, const char* format, ...)
if (res == -1)
{
sLog->outError("SQL Query truncated (and not execute) for format: %s", format);
LOG_ERROR("server", "SQL Query truncated (and not execute) for format: %s", format);
return false;
}
@ -56,7 +56,7 @@ bool SQLQueryHolder::SetPreparedQuery(size_t index, PreparedStatement* stmt)
{
if (m_queries.size() <= index)
{
sLog->outError("Query index (%u) out of range (size: %u) for prepared statement", uint32(index), (uint32)m_queries.size());
LOG_ERROR("server", "Query index (%u) out of range (size: %u) for prepared statement", uint32(index), (uint32)m_queries.size());
return false;
}

View file

@ -47,7 +47,7 @@ PreparedResultSet::PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES* result, uint64
//- This is where we store the (entire) resultset
if (mysql_stmt_store_result(m_stmt))
{
sLog->outSQLDriver("%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
LOG_INFO("sql.driver", "%s:mysql_stmt_store_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
delete[] m_rBind;
delete[] m_isNull;
delete[] m_length;
@ -77,7 +77,7 @@ PreparedResultSet::PreparedResultSet(MYSQL_STMT* stmt, MYSQL_RES* result, uint64
//- This is where we bind the bind the buffer to the statement
if (mysql_stmt_bind_result(m_stmt, m_rBind))
{
sLog->outSQLDriver("%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
LOG_INFO("sql.driver", "%s:mysql_stmt_bind_result, cannot bind result from MySQL server. Error: %s", __FUNCTION__, mysql_stmt_error(m_stmt));
delete[] m_rBind;
delete[] m_isNull;
delete[] m_length;

View file

@ -0,0 +1,80 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#include "Appender.h"
#include "LogMessage.h"
#include "StringFormat.h"
#include <sstream>
Appender::Appender(uint8 _id, std::string const& _name, LogLevel _level /* = LOG_LEVEL_DISABLED */, AppenderFlags _flags /* = APPENDER_FLAGS_NONE */):
id(_id), name(_name), level(_level), flags(_flags) { }
Appender::~Appender() { }
uint8 Appender::getId() const
{
return id;
}
std::string const& Appender::getName() const
{
return name;
}
LogLevel Appender::getLogLevel() const
{
return level;
}
AppenderFlags Appender::getFlags() const
{
return flags;
}
void Appender::setLogLevel(LogLevel _level)
{
level = _level;
}
void Appender::write(LogMessage* message)
{
if (!level || level < message->level)
return;
std::ostringstream ss;
if (flags & APPENDER_FLAGS_PREFIX_TIMESTAMP)
ss << message->getTimeStr() << ' ';
if (flags & APPENDER_FLAGS_PREFIX_LOGLEVEL)
ss << acore::StringFormat("%-5s ", Appender::getLogLevelString(message->level));
if (flags & APPENDER_FLAGS_PREFIX_LOGFILTERTYPE)
ss << '[' << message->type << "] ";
message->prefix = ss.str();
_write(message);
}
char const* Appender::getLogLevelString(LogLevel level)
{
switch (level)
{
case LOG_LEVEL_FATAL:
return "FATAL";
case LOG_LEVEL_ERROR:
return "ERROR";
case LOG_LEVEL_WARN:
return "WARN";
case LOG_LEVEL_INFO:
return "INFO";
case LOG_LEVEL_DEBUG:
return "DEBUG";
case LOG_LEVEL_TRACE:
return "TRACE";
default:
return "DISABLED";
}
}

View file

@ -0,0 +1,49 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef APPENDER_H
#define APPENDER_H
#include "Define.h"
#include "LogCommon.h"
#include <stdexcept>
#include <string>
#include <vector>
struct LogMessage;
class Appender
{
public:
Appender(uint8 _id, std::string const& name, LogLevel level = LOG_LEVEL_DISABLED, AppenderFlags flags = APPENDER_FLAGS_NONE);
virtual ~Appender();
uint8 getId() const;
std::string const& getName() const;
virtual AppenderType getType() const = 0;
LogLevel getLogLevel() const;
AppenderFlags getFlags() const;
void setLogLevel(LogLevel);
void write(LogMessage* message);
static char const* getLogLevelString(LogLevel level);
virtual void setRealmId(uint32 /*realmId*/) { }
private:
virtual void _write(LogMessage const* /*message*/) = 0;
uint8 id;
std::string name;
LogLevel level;
AppenderFlags flags;
};
class InvalidAppenderArgsException : public std::length_error
{
public:
explicit InvalidAppenderArgsException(std::string const& message) : std::length_error(message) { }
};
#endif

View file

@ -0,0 +1,191 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#include "AppenderConsole.h"
#include "LogMessage.h"
#include "SmartEnum.h"
#include "StringFormat.h"
#include "StringConvert.h"
#include "Util.h"
#include "Tokenize.h"
#include <sstream>
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
#include <Windows.h>
#endif
AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector<std::string_view> const& args)
: Appender(id, name, level, flags), _colored(false)
{
for (uint8 i = 0; i < NUM_ENABLED_LOG_LEVELS; ++i)
_colors[i] = ColorTypes(NUM_COLOR_TYPES);
if (3 < args.size())
InitColors(name, args[3]);
}
void AppenderConsole::InitColors(std::string const& name, std::string_view str)
{
if (str.empty())
{
_colored = false;
return;
}
std::vector<std::string_view> colorStrs = acore::Tokenize(str, ' ', false);
if (colorStrs.size() != NUM_ENABLED_LOG_LEVELS)
{
throw InvalidAppenderArgsException(acore::StringFormat("Log::CreateAppenderFromConfig: Invalid color data '%s' for console appender %s (expected %u entries, got %zu)",
std::string(str).c_str(), name.c_str(), NUM_ENABLED_LOG_LEVELS, colorStrs.size()));
}
for (uint8 i = 0; i < NUM_ENABLED_LOG_LEVELS; ++i)
{
if (Optional<uint8> color = acore::StringTo<uint8>(colorStrs[i]); color && EnumUtils::IsValid<ColorTypes>(*color))
_colors[i] = static_cast<ColorTypes>(*color);
else
{
throw InvalidAppenderArgsException(acore::StringFormat("Log::CreateAppenderFromConfig: Invalid color '%s' for log level %s on console appender %s",
std::string(colorStrs[i]).c_str(), EnumUtils::ToTitle(static_cast<LogLevel>(i)), name.c_str()));
}
}
_colored = true;
}
void AppenderConsole::SetColor(bool stdout_stream, ColorTypes color)
{
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
static WORD WinColorFG[NUM_COLOR_TYPES] =
{
0, // BLACK
FOREGROUND_RED, // RED
FOREGROUND_GREEN, // GREEN
FOREGROUND_RED | FOREGROUND_GREEN, // BROWN
FOREGROUND_BLUE, // BLUE
FOREGROUND_RED | FOREGROUND_BLUE, // MAGENTA
FOREGROUND_GREEN | FOREGROUND_BLUE, // CYAN
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE, // WHITE
// YELLOW
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY,
// RED_BOLD
FOREGROUND_RED | FOREGROUND_INTENSITY,
// GREEN_BOLD
FOREGROUND_GREEN | FOREGROUND_INTENSITY,
FOREGROUND_BLUE | FOREGROUND_INTENSITY, // BLUE_BOLD
// MAGENTA_BOLD
FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
// CYAN_BOLD
FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY,
// WHITE_BOLD
FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
};
HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
SetConsoleTextAttribute(hConsole, WinColorFG[color]);
#else
enum ANSITextAttr
{
TA_NORMAL = 0,
TA_BOLD = 1,
TA_BLINK = 5,
TA_REVERSE = 7
};
enum ANSIFgTextAttr
{
FG_BLACK = 30,
FG_RED,
FG_GREEN,
FG_BROWN,
FG_BLUE,
FG_MAGENTA,
FG_CYAN,
FG_WHITE,
FG_YELLOW
};
enum ANSIBgTextAttr
{
BG_BLACK = 40,
BG_RED,
BG_GREEN,
BG_BROWN,
BG_BLUE,
BG_MAGENTA,
BG_CYAN,
BG_WHITE
};
static uint8 UnixColorFG[NUM_COLOR_TYPES] =
{
FG_BLACK, // BLACK
FG_RED, // RED
FG_GREEN, // GREEN
FG_BROWN, // BROWN
FG_BLUE, // BLUE
FG_MAGENTA, // MAGENTA
FG_CYAN, // CYAN
FG_WHITE, // WHITE
FG_YELLOW, // YELLOW
FG_RED, // LRED
FG_GREEN, // LGREEN
FG_BLUE, // LBLUE
FG_MAGENTA, // LMAGENTA
FG_CYAN, // LCYAN
FG_WHITE // LWHITE
};
fprintf((stdout_stream? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < NUM_COLOR_TYPES ? ";1" : ""));
#endif
}
void AppenderConsole::ResetColor(bool stdout_stream)
{
#if AC_PLATFORM == AC_PLATFORM_WINDOWS
HANDLE hConsole = GetStdHandle(stdout_stream ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE);
SetConsoleTextAttribute(hConsole, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
#else
fprintf((stdout_stream ? stdout : stderr), "\x1b[0m");
#endif
}
void AppenderConsole::_write(LogMessage const* message)
{
bool stdout_stream = !(message->level == LOG_LEVEL_ERROR || message->level == LOG_LEVEL_FATAL);
if (_colored)
{
uint8 index;
switch (message->level)
{
case LOG_LEVEL_TRACE:
index = 5;
break;
case LOG_LEVEL_DEBUG:
index = 4;
break;
case LOG_LEVEL_INFO:
index = 3;
break;
case LOG_LEVEL_WARN:
index = 2;
break;
case LOG_LEVEL_FATAL:
index = 0;
break;
default:
index = 1;
break;
}
SetColor(stdout_stream, _colors[index]);
utf8printf(stdout_stream ? stdout : stderr, "%s%s\n", message->prefix.c_str(), message->text.c_str());
ResetColor(stdout_stream);
}
else
utf8printf(stdout_stream ? stdout : stderr, "%s%s\n", message->prefix.c_str(), message->text.c_str());
}

View file

@ -0,0 +1,49 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef APPENDERCONSOLE_H
#define APPENDERCONSOLE_H
#include "Appender.h"
// EnumUtils: DESCRIBE THIS
enum ColorTypes
{
BLACK,
RED,
GREEN,
BROWN,
BLUE,
MAGENTA,
CYAN,
GREY,
YELLOW,
LRED,
LGREEN,
LBLUE,
LMAGENTA,
LCYAN,
WHITE,
NUM_COLOR_TYPES // SKIP
};
class AppenderConsole : public Appender
{
public:
static constexpr AppenderType type = APPENDER_CONSOLE;
AppenderConsole(uint8 _id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector<std::string_view> const& args);
void InitColors(std::string const& name, std::string_view init_str);
AppenderType getType() const override { return type; }
private:
void SetColor(bool stdout_stream, ColorTypes color);
void ResetColor(bool stdout_stream);
void _write(LogMessage const* message) override;
bool _colored;
ColorTypes _colors[NUM_ENABLED_LOG_LEVELS];
};
#endif

View file

@ -0,0 +1,119 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#include "AppenderFile.h"
#include "Log.h"
#include "LogMessage.h"
#include "StringConvert.h"
#include "Util.h"
#include <algorithm>
AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector<std::string_view> const& args) :
Appender(id, name, level, flags),
logfile(nullptr),
_logDir(sLog->GetLogsDir()),
_maxFileSize(0),
_fileSize(0)
{
if (args.size() < 4)
throw InvalidAppenderArgsException(acore::StringFormat("Log::CreateAppenderFromConfig: Missing file name for appender %s", name.c_str()));
_fileName.assign(args[3]);
std::string mode = "a";
if (4 < args.size())
mode.assign(args[4]);
if (flags & APPENDER_FLAGS_USE_TIMESTAMP)
{
size_t dot_pos = _fileName.find_last_of('.');
if (dot_pos != std::string::npos)
_fileName.insert(dot_pos, sLog->GetLogsTimestamp());
else
_fileName += sLog->GetLogsTimestamp();
}
if (5 < args.size())
{
if (Optional<uint32> size = acore::StringTo<uint32>(args[5]))
_maxFileSize = *size;
else
throw InvalidAppenderArgsException(acore::StringFormat("Log::CreateAppenderFromConfig: Invalid size '%s' for appender %s", std::string(args[5]).c_str(), name.c_str()));
}
_dynamicName = std::string::npos != _fileName.find("%s");
_backup = (flags & APPENDER_FLAGS_MAKE_FILE_BACKUP) != 0;
if (!_dynamicName)
logfile = OpenFile(_fileName, mode, (mode == "w") && _backup);
}
AppenderFile::~AppenderFile()
{
CloseFile();
}
void AppenderFile::_write(LogMessage const* message)
{
bool exceedMaxSize = _maxFileSize > 0 && (_fileSize.load() + message->Size()) > _maxFileSize;
if (_dynamicName)
{
char namebuf[ACORE_PATH_MAX];
snprintf(namebuf, ACORE_PATH_MAX, _fileName.c_str(), message->param1.c_str());
// always use "a" with dynamic name otherwise it could delete the log we wrote in last _write() call
FILE* file = OpenFile(namebuf, "a", _backup || exceedMaxSize);
if (!file)
return;
fprintf(file, "%s%s\n", message->prefix.c_str(), message->text.c_str());
fflush(file);
_fileSize += uint64(message->Size());
fclose(file);
return;
}
else if (exceedMaxSize)
logfile = OpenFile(_fileName, "w", true);
if (!logfile)
return;
fprintf(logfile, "%s%s\n", message->prefix.c_str(), message->text.c_str());
fflush(logfile);
_fileSize += uint64(message->Size());
}
FILE* AppenderFile::OpenFile(std::string const& filename, std::string const& mode, bool backup)
{
std::string fullName(_logDir + filename);
if (backup)
{
CloseFile();
std::string newName(fullName);
newName.push_back('.');
newName.append(LogMessage::getTimeStr(time(nullptr)));
std::replace(newName.begin(), newName.end(), ':', '-');
rename(fullName.c_str(), newName.c_str()); // no error handling... if we couldn't make a backup, just ignore
}
if (FILE* ret = fopen(fullName.c_str(), mode.c_str()))
{
_fileSize = ftell(ret);
return ret;
}
return nullptr;
}
void AppenderFile::CloseFile()
{
if (logfile)
{
fclose(logfile);
logfile = nullptr;
}
}

View file

@ -0,0 +1,34 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef APPENDERFILE_H
#define APPENDERFILE_H
#include "Appender.h"
#include <atomic>
class AppenderFile : public Appender
{
public:
static constexpr AppenderType type = APPENDER_FILE;
AppenderFile(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector<std::string_view> const& args);
~AppenderFile();
FILE* OpenFile(std::string const& name, std::string const& mode, bool backup);
AppenderType getType() const override { return type; }
private:
void CloseFile();
void _write(LogMessage const* message) override;
FILE* logfile;
std::string _fileName;
std::string _logDir;
bool _dynamicName;
bool _backup;
uint64 _maxFileSize;
std::atomic<uint64> _fileSize;
};
#endif

View file

@ -1,130 +0,0 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
*/
#ifndef AZEROTHCORE_ILOG_H
#define AZEROTHCORE_ILOG_H
class WorldPacket;
enum DebugLogFilters
{
LOG_FILTER_NONE = 0x00000000,
LOG_FILTER_UNITS = 0x00000001, // Anything related to units that doesn't fit in other categories. ie. creature formations
LOG_FILTER_PETS = 0x00000002,
LOG_FILTER_VEHICLES = 0x00000004,
LOG_FILTER_TSCR = 0x00000008, // C++ AI, instance scripts, etc.
LOG_FILTER_DATABASE_AI = 0x00000010, // SmartAI, EventAI, CreatureAI
LOG_FILTER_MAPSCRIPTS = 0x00000020,
LOG_FILTER_NETWORKIO = 0x00000040, // Anything packet/netcode related
LOG_FILTER_SPELLS_AURAS = 0x00000080,
LOG_FILTER_ACHIEVEMENTSYS = 0x00000100,
LOG_FILTER_CONDITIONSYS = 0x00000200,
LOG_FILTER_POOLSYS = 0x00000400,
LOG_FILTER_AUCTIONHOUSE = 0x00000800,
LOG_FILTER_BATTLEGROUND = 0x00001000, // Anything related to arena's and battlegrounds
LOG_FILTER_OUTDOORPVP = 0x00002000,
LOG_FILTER_CHATSYS = 0x00004000,
LOG_FILTER_LFG = 0x00008000,
LOG_FILTER_MAPS = 0x00010000, // Maps, instances, grids, cells, visibility
LOG_FILTER_PLAYER_LOADING = 0x00020000, // Debug output from Player::_Load functions
LOG_FILTER_PLAYER_ITEMS = 0x00040000, // Anything item related
LOG_FILTER_PLAYER_SKILLS = 0x00080000, // Skills related
LOG_FILTER_LOOT = 0x00100000, // Loot related
LOG_FILTER_GUILD = 0x00200000, // Guild related
LOG_FILTER_TRANSPORTS = 0x00400000, // Transport related
LOG_FILTER_WARDEN = 0x00800000, // Warden related
LOG_FILTER_BATTLEFIELD = 0x01000000, // Battlefield related
LOG_FILTER_MODULES = 0x02000000, // Modules debug
LOG_FILTER_CLOSE_SOCKET = 0x04000000, // Whenever KickPlayer() or CloseSocket() are called
};
enum LogTypes
{
LOG_TYPE_STRING = 0,
LOG_TYPE_ERROR = 1,
LOG_TYPE_BASIC = 2,
LOG_TYPE_DETAIL = 3,
LOG_TYPE_DEBUG = 4,
LOG_TYPE_CHAR = 5,
LOG_TYPE_WORLD = 6,
LOG_TYPE_RA = 7,
LOG_TYPE_GM = 8,
LOG_TYPE_CRASH = 9,
LOG_TYPE_CHAT = 10,
LOG_TYPE_PERF = 11,
LOG_TYPE_MULTITH = 12,
MAX_LOG_TYPES
};
enum LogLevel
{
LOGL_NORMAL = 0,
LOGL_BASIC,
LOGL_DETAIL,
LOGL_DEBUG
};
const int LogLevels = int(LOGL_DEBUG) + 1;
enum ColorTypes
{
BLACK,
RED,
GREEN,
BROWN,
BLUE,
MAGENTA,
CYAN,
GREY,
YELLOW,
LRED,
LGREEN,
LBLUE,
LMAGENTA,
LCYAN,
WHITE
};
const int Colors = int(WHITE) + 1;
class ILog
{
public:
virtual ~ILog() {}
virtual void Initialize() = 0;
virtual void ReloadConfig() = 0;
virtual void InitColors(const std::string& init_str) = 0;
virtual void SetColor(bool stdout_stream, ColorTypes color) = 0;
virtual void ResetColor(bool stdout_stream) = 0;
virtual void outDB(LogTypes type, const char* str) = 0;
virtual void outString(const char* str, ...) = 0;
virtual void outString() = 0;
virtual void outStringInLine(const char* str, ...) = 0;
virtual void outError(const char* err, ...) = 0;
virtual void outCrash(const char* err, ...) = 0;
virtual void outBasic(const char* str, ...) = 0;
virtual void outDetail(const char* str, ...) = 0;
virtual void outSQLDev(const char* str, ...) = 0;
virtual void outDebug(DebugLogFilters f, const char* str, ...) = 0;
virtual void outStaticDebug(const char* str, ...) = 0;
virtual void outErrorDb(const char* str, ...) = 0;
virtual void outChar(const char* str, ...) = 0;
virtual void outCommand(uint32 account, const char* str, ...) = 0;
virtual void outChat(const char* str, ...) = 0;
virtual void outRemote(const char* str, ...) = 0;
virtual void outSQLDriver(const char* str, ...) = 0;
virtual void outMisc(const char* str, ...) = 0;
virtual void outCharDump(const char* str, uint32 account_id, uint32 guid, const char* name) = 0;
virtual void SetLogLevel(char* Level) = 0;
virtual void SetLogFileLevel(char* Level) = 0;
virtual void SetSQLDriverQueryLogging(bool newStatus) = 0;
virtual void SetRealmID(uint32 id) = 0;
virtual bool IsOutDebug() const = 0;
virtual bool IsOutCharDump() const = 0;
virtual bool GetLogDB() const = 0;
virtual void SetLogDB(bool enable) = 0;
virtual bool GetSQLDriverQueryLogging() const = 0;
};
#endif //AZEROTHCORE_ILOG_H

File diff suppressed because it is too large Load diff

View file

@ -1,120 +1,256 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef AZEROTHCORE_LOG_H
#define AZEROTHCORE_LOG_H
#ifndef _LOG_H__
#define _LOG_H__
#include "Common.h"
#include "ILog.h"
#include <ace/Task.h>
#include "Define.h"
#include "LogCommon.h"
#include "StringFormat.h"
class Log : public ILog
#include <memory>
#include <unordered_map>
#include <vector>
class Appender;
class Logger;
struct LogMessage;
#define LOGGER_ROOT "root"
typedef Appender*(*AppenderCreatorFn)(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector<std::string_view> const& extraArgs);
template <class AppenderImpl>
Appender* CreateAppender(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector<std::string_view> const& extraArgs)
{
return new AppenderImpl(id, name, level, flags, extraArgs);
}
class Log
{
typedef std::unordered_map<std::string, Logger> LoggerMap;
private:
Log();
~Log();
Log(Log const&) = delete;
Log(Log&&) = delete;
Log& operator=(Log const&) = delete;
Log& operator=(Log&&) = delete;
public:
Log();
~Log();
static Log* instance();
void Initialize();
void LoadFromConfig();
void Close();
bool ShouldLog(std::string const& type, LogLevel level) const;
bool SetLogLevel(std::string const& name, int32 level, bool isLogger = true);
void ReloadConfig();
template<typename Format, typename... Args>
inline void outMessage(std::string const& filter, LogLevel const level, Format&& fmt, Args&&... args)
{
outMessage(filter, level, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
void InitColors(const std::string& init_str);
void SetColor(bool stdout_stream, ColorTypes color);
void ResetColor(bool stdout_stream);
template<typename Format, typename... Args>
void outCommand(uint32 account, Format&& fmt, Args&&... args)
{
if (!ShouldLog("commands.gm", LOG_LEVEL_INFO))
return;
void outDB(LogTypes type, const char* str);
void outString(const char* str, ...) ATTR_PRINTF(2, 3);
void outString();
void outStringInLine(const char* str, ...) ATTR_PRINTF(2, 3);
void outError(const char* err, ...) ATTR_PRINTF(2, 3);
void outCrash(const char* err, ...) ATTR_PRINTF(2, 3);
void outBasic(const char* str, ...) ATTR_PRINTF(2, 3);
void outDetail(const char* str, ...) ATTR_PRINTF(2, 3);
void outSQLDev(const char* str, ...) ATTR_PRINTF(2, 3);
void outDebug(DebugLogFilters f, const char* str, ...) ATTR_PRINTF(3, 4);
void outStaticDebug(const char* str, ...) ATTR_PRINTF(2, 3);
void outErrorDb(const char* str, ...) ATTR_PRINTF(2, 3);
void outChar(const char* str, ...) ATTR_PRINTF(2, 3);
void outCommand(uint32 account, const char* str, ...) ATTR_PRINTF(3, 4);
void outChat(const char* str, ...) ATTR_PRINTF(2, 3);
void outRemote(const char* str, ...) ATTR_PRINTF(2, 3);
void outSQLDriver(const char* str, ...) ATTR_PRINTF(2, 3);
void outMisc(const char* str, ...) ATTR_PRINTF(2, 3); // pussywizard
void outCharDump(const char* str, uint32 account_id, uint32 guid, const char* name);
outCommand(acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...), std::to_string(account));
}
static void outTimestamp(FILE* file);
static std::string GetTimestampStr();
void outCharDump(char const* str, uint32 account_id, uint64 guid, char const* name);
void SetLogLevel(char* Level);
void SetLogFileLevel(char* Level);
void SetSQLDriverQueryLogging(bool newStatus) { m_sqlDriverQueryLogging = newStatus; }
void SetRealmID(uint32 id) { realm = id; }
void SetRealmId(uint32 id);
[[nodiscard]] bool IsOutDebug() const { return m_logLevel > 2 || (m_logFileLevel > 2 && logfile); }
[[nodiscard]] bool IsOutCharDump() const { return m_charLog_Dump; }
template<class AppenderImpl>
void RegisterAppender()
{
RegisterAppender(AppenderImpl::type, &CreateAppender<AppenderImpl>);
}
std::string const& GetLogsDir() const { return m_logsDir; }
std::string const& GetLogsTimestamp() const { return m_logsTimestamp; }
// Deprecated functions
template<typename Format, typename... Args>
inline void outString(Format&& fmt, Args&& ... args)
{
outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
inline void outString()
{
outMessage("server", LOG_LEVEL_INFO, " ");
}
template<typename Format, typename... Args>
inline void outError(Format&& fmt, Args&& ... args)
{
outMessage("server", LOG_LEVEL_ERROR, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
template<typename Format, typename... Args>
void outErrorDb(Format&& fmt, Args&& ... args)
{
if (!ShouldLog("sql.sql", LOG_LEVEL_ERROR))
return;
outMessage("sql.sql", LOG_LEVEL_ERROR, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
template<typename Format, typename... Args>
inline void outBasic(Format&& fmt, Args&& ... args)
{
outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
template<typename Format, typename... Args>
inline void outDetail(Format&& fmt, Args&& ... args)
{
outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
template<typename Format, typename... Args>
void outSQLDev(Format&& fmt, Args&& ... args)
{
if (!ShouldLog("sql.dev", LOG_LEVEL_INFO))
return;
outMessage("sql.dev", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
template<typename Format, typename... Args>
void outSQLDriver(Format&& fmt, Args&& ... args)
{
if (!ShouldLog("sql.driver", LOG_LEVEL_INFO))
return;
outMessage("sql.driver", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
template<typename Format, typename... Args>
inline void outMisc(Format&& fmt, Args&& ... args)
{
outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
template<typename Format, typename... Args>
void outDebug(DebugLogFilters filter, Format&& fmt, Args&& ... args)
{
if (!(_debugLogMask & filter))
return;
if (!ShouldLog("server", LOG_LEVEL_DEBUG))
return;
outMessage("server", LOG_LEVEL_DEBUG, acore::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
}
[[nodiscard]] bool GetLogDB() const { return m_enableLogDB; }
void SetLogDB(bool enable) { m_enableLogDB = enable; }
[[nodiscard]] bool GetSQLDriverQueryLogging() const { return m_sqlDriverQueryLogging; }
private:
FILE* openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode);
FILE* openGmlogPerAccount(uint32 account);
static std::string GetTimestampStr();
void write(std::unique_ptr<LogMessage>&& msg) const;
FILE* raLogfile;
FILE* logfile;
FILE* gmLogfile;
FILE* charLogfile;
FILE* dberLogfile;
FILE* chatLogfile;
FILE* sqlLogFile;
FILE* sqlDevLogFile;
FILE* miscLogFile;
Logger const* GetLoggerByType(std::string const& type) const;
Appender* GetAppenderByName(std::string_view name);
uint8 NextAppenderId();
void CreateAppenderFromConfig(std::string const& name);
void CreateLoggerFromConfig(std::string const& name);
void ReadAppendersFromConfig();
void ReadLoggersFromConfig();
void RegisterAppender(uint8 index, AppenderCreatorFn appenderCreateFn);
void outMessage(std::string const& filter, LogLevel level, std::string&& message);
void outCommand(std::string&& message, std::string&& param1);
std::unordered_map<uint8, AppenderCreatorFn> appenderFactory;
std::unordered_map<uint8, std::unique_ptr<Appender>> appenders;
std::unordered_map<std::string, std::unique_ptr<Logger>> loggers;
uint8 AppenderId;
LogLevel highestLogLevel;
// cache values for after initilization use (like gm log per account case)
std::string m_logsDir;
std::string m_logsTimestamp;
// gm log control
bool m_gmlog_per_account;
std::string m_gmlog_filename_format;
bool m_enableLogDB;
uint32 realm;
// log coloring
bool m_colored;
ColorTypes m_colors[4];
// log levels:
// false: errors only, true: full query logging
bool m_sqlDriverQueryLogging;
// log levels:
// 0 minimum/string, 1 basic/error, 2 detail, 3 full/debug
uint8 m_dbLogLevel;
uint8 m_logLevel;
uint8 m_logFileLevel;
bool m_dbChar;
bool m_dbRA;
bool m_dbGM;
bool m_dbChat;
bool m_charLog_Dump;
bool m_charLog_Dump_Separate;
std::string m_dumpsDir;
DebugLogFilters m_DebugLogMask;
// Deprecated debug filter logs
DebugLogFilters _debugLogMask;
};
std::unique_ptr<ILog>& getLogInstance();
#define sLog Log::instance()
#define sLog getLogInstance()
#define LOG_EXCEPTION_FREE(filterType__, level__, ...) \
{ \
try \
{ \
sLog->outMessage(filterType__, level__, __VA_ARGS__); \
} \
catch (std::exception const& e) \
{ \
sLog->outMessage("server", LOG_LEVEL_ERROR, "Wrong format occurred (%s) at %s:%u.", \
e.what(), __FILE__, __LINE__); \
} \
}
#ifdef PERFORMANCE_PROFILING
#define LOG_MESSAGE_BODY(filterType__, level__, ...) ((void)0)
#elif AC_PLATFORM != AC_PLATFORM_WINDOWS
void check_args(char const*, ...) ATTR_PRINTF(1, 2);
void check_args(std::string const&, ...);
// This will catch format errors on build time
#define LOG_MESSAGE_BODY(filterType__, level__, ...) \
do { \
if (sLog->ShouldLog(filterType__, level__)) \
{ \
if (false) \
check_args(__VA_ARGS__); \
\
LOG_EXCEPTION_FREE(filterType__, level__, __VA_ARGS__); \
} \
} while (0)
#else
#define LOG_MESSAGE_BODY(filterType__, level__, ...) \
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
do { \
if (sLog->ShouldLog(filterType__, level__)) \
LOG_EXCEPTION_FREE(filterType__, level__, __VA_ARGS__); \
} while (0) \
__pragma(warning(pop))
#endif
// Fatal - 1
#define LOG_FATAL(filterType__, ...) \
LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_FATAL, __VA_ARGS__)
// Error - 2
#define LOG_ERROR(filterType__, ...) \
LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_ERROR, __VA_ARGS__)
// Warning - 3
#define LOG_WARN(filterType__, ...) \
LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_WARN, __VA_ARGS__)
// Info - 4
#define LOG_INFO(filterType__, ...) \
LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_INFO, __VA_ARGS__)
// Debug - 5
#define LOG_DEBUG(filterType__, ...) \
LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_DEBUG, __VA_ARGS__)
// Trace - 6
#define LOG_TRACE(filterType__, ...) \
LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_TRACE, __VA_ARGS__)
#define LOG_CHAR_DUMP(message__, accountId__, guid__, name__) \
sLog->outCharDump(message__, accountId__, guid__, name__)
#define LOG_GM(accountId__, ...) \
sLog->outCommand(accountId__, __VA_ARGS__)
#endif // _LOG_H__

View file

@ -0,0 +1,80 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef LogCommon_h__
#define LogCommon_h__
#include "Define.h"
// EnumUtils: DESCRIBE THIS
enum LogLevel : uint8
{
LOG_LEVEL_DISABLED,
LOG_LEVEL_FATAL,
LOG_LEVEL_ERROR,
LOG_LEVEL_WARN,
LOG_LEVEL_INFO,
LOG_LEVEL_DEBUG,
LOG_LEVEL_TRACE,
NUM_ENABLED_LOG_LEVELS = LOG_LEVEL_TRACE, // SKIP
LOG_LEVEL_INVALID = 0xFF // SKIP
};
// EnumUtils: DESCRIBE THIS
enum AppenderType : uint8
{
APPENDER_NONE,
APPENDER_CONSOLE,
APPENDER_FILE,
APPENDER_DB,
APPENDER_INVALID = 0xFF // SKIP
};
enum AppenderFlags : uint8
{
APPENDER_FLAGS_NONE = 0x00,
APPENDER_FLAGS_PREFIX_TIMESTAMP = 0x01,
APPENDER_FLAGS_PREFIX_LOGLEVEL = 0x02,
APPENDER_FLAGS_PREFIX_LOGFILTERTYPE = 0x04,
APPENDER_FLAGS_USE_TIMESTAMP = 0x08,
APPENDER_FLAGS_MAKE_FILE_BACKUP = 0x10
};
// Dprecated debug log filters need delte later
enum DebugLogFilters
{
LOG_FILTER_NONE = 0x00000000,
LOG_FILTER_UNITS = 0x00000001, // Anything related to units that doesn't fit in other categories. ie. creature formations
LOG_FILTER_PETS = 0x00000002,
LOG_FILTER_VEHICLES = 0x00000004,
LOG_FILTER_TSCR = 0x00000008, // C++ AI, instance scripts, etc.
LOG_FILTER_DATABASE_AI = 0x00000010, // SmartAI, EventAI, CreatureAI
LOG_FILTER_MAPSCRIPTS = 0x00000020,
LOG_FILTER_NETWORKIO = 0x00000040, // Anything packet/netcode related
LOG_FILTER_SPELLS_AURAS = 0x00000080,
LOG_FILTER_ACHIEVEMENTSYS = 0x00000100,
LOG_FILTER_CONDITIONSYS = 0x00000200,
LOG_FILTER_POOLSYS = 0x00000400,
LOG_FILTER_AUCTIONHOUSE = 0x00000800,
LOG_FILTER_BATTLEGROUND = 0x00001000, // Anything related to arena's and battlegrounds
LOG_FILTER_OUTDOORPVP = 0x00002000,
LOG_FILTER_CHATSYS = 0x00004000,
LOG_FILTER_LFG = 0x00008000,
LOG_FILTER_MAPS = 0x00010000, // Maps, instances, grids, cells, visibility
LOG_FILTER_PLAYER_LOADING = 0x00020000, // Debug output from Player::_Load functions
LOG_FILTER_PLAYER_ITEMS = 0x00040000, // Anything item related
LOG_FILTER_PLAYER_SKILLS = 0x00080000, // Skills related
LOG_FILTER_LOOT = 0x00100000, // Loot related
LOG_FILTER_GUILD = 0x00200000, // Guild related
LOG_FILTER_TRANSPORTS = 0x00400000, // Transport related
LOG_FILTER_WARDEN = 0x00800000, // Warden related
LOG_FILTER_BATTLEFIELD = 0x01000000, // Battlefield related
LOG_FILTER_MODULES = 0x02000000, // Modules debug
LOG_FILTER_CLOSE_SOCKET = 0x04000000, // Whenever KickPlayer() or CloseSocket() are called
};
#endif // LogCommon_h__

View file

@ -0,0 +1,30 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#include "LogMessage.h"
#include "StringFormat.h"
#include "Util.h"
LogMessage::LogMessage(LogLevel _level, std::string const& _type, std::string&& _text)
: level(_level), type(_type), text(std::forward<std::string>(_text)), mtime(time(nullptr))
{
}
LogMessage::LogMessage(LogLevel _level, std::string const& _type, std::string&& _text, std::string&& _param1)
: level(_level), type(_type), text(std::forward<std::string>(_text)), param1(std::forward<std::string>(_param1)), mtime(time(nullptr))
{
}
std::string LogMessage::getTimeStr(time_t time)
{
tm aTm;
localtime_r(&time, &aTm);
return acore::StringFormat("%04d-%02d-%02d_%02d:%02d:%02d", aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
}
std::string LogMessage::getTimeStr() const
{
return getTimeStr(mtime);
}

View file

@ -0,0 +1,39 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef LogMessage_h__
#define LogMessage_h__
#include "Define.h"
#include "LogCommon.h"
#include <string>
#include <ctime>
struct LogMessage
{
LogMessage(LogLevel _level, std::string const& _type, std::string&& _text);
LogMessage(LogLevel _level, std::string const& _type, std::string&& _text, std::string&& _param1);
LogMessage(LogMessage const& /*other*/) = delete;
LogMessage& operator=(LogMessage const& /*other*/) = delete;
static std::string getTimeStr(time_t time);
std::string getTimeStr() const;
LogLevel const level;
std::string const type;
std::string const text;
std::string prefix;
std::string param1;
time_t mtime;
///@ Returns size of the log message content in bytes
uint32 Size() const
{
return static_cast<uint32>(prefix.size() + text.size());
}
};
#endif // LogMessage_h__

View file

@ -0,0 +1,22 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#include "LogOperation.h"
#include "Logger.h"
#include "LogMessage.h"
LogOperation::LogOperation(Logger const* _logger, std::unique_ptr<LogMessage>&& _msg) : logger(_logger), msg(std::forward<std::unique_ptr<LogMessage>>(_msg))
{
}
LogOperation::~LogOperation()
{
}
int LogOperation::call()
{
logger->write(msg.get());
return 0;
}

View file

@ -0,0 +1,29 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef LOGOPERATION_H
#define LOGOPERATION_H
#include "Define.h"
#include <memory>
class Logger;
struct LogMessage;
class LogOperation
{
public:
LogOperation(Logger const* _logger, std::unique_ptr<LogMessage>&& _msg);
~LogOperation();
int call();
protected:
Logger const* logger;
std::unique_ptr<LogMessage> msg;
};
#endif

View file

@ -0,0 +1,48 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#include "Logger.h"
#include "Appender.h"
#include "LogMessage.h"
Logger::Logger(std::string const& _name, LogLevel _level): name(_name), level(_level) { }
std::string const& Logger::getName() const
{
return name;
}
LogLevel Logger::getLogLevel() const
{
return level;
}
void Logger::addAppender(uint8 id, Appender* appender)
{
appenders[id] = appender;
}
void Logger::delAppender(uint8 id)
{
appenders.erase(id);
}
void Logger::setLogLevel(LogLevel _level)
{
level = _level;
}
void Logger::write(LogMessage* message) const
{
if (!level || level < message->level || message->text.empty())
{
//fprintf(stderr, "Logger::write: Logger %s, Level %u. Msg %s Level %u WRONG LEVEL MASK OR EMPTY MSG\n", getName().c_str(), getLogLevel(), message.text.c_str(), message.level);
return;
}
for (std::pair<uint8 const, Appender*> const& appender : appenders)
if (appender.second)
appender.second->write(message);
}

View file

@ -0,0 +1,36 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef LOGGER_H
#define LOGGER_H
#include "Define.h"
#include "LogCommon.h"
#include <unordered_map>
#include <string>
class Appender;
struct LogMessage;
class Logger
{
public:
Logger(std::string const& name, LogLevel level);
void addAppender(uint8 type, Appender* appender);
void delAppender(uint8 type);
std::string const& getName() const;
LogLevel getLogLevel() const;
void setLogLevel(LogLevel level);
void write(LogMessage* message) const;
private:
std::string name;
LogLevel level;
std::unordered_map<uint8, Appender*> appenders;
};
#endif

View file

@ -0,0 +1,92 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#include "AppenderConsole.h"
#include "Define.h"
#include "SmartEnum.h"
#include <stdexcept>
namespace acore::Impl::EnumUtilsImpl
{
/********************************************************************\
|* data for enum 'ColorTypes' in 'AppenderConsole.h' auto-generated *|
\********************************************************************/
template <>
EnumText EnumUtils<ColorTypes>::ToString(ColorTypes value)
{
switch (value)
{
case BLACK: return { "BLACK", "BLACK", "" };
case RED: return { "RED", "RED", "" };
case GREEN: return { "GREEN", "GREEN", "" };
case BROWN: return { "BROWN", "BROWN", "" };
case BLUE: return { "BLUE", "BLUE", "" };
case MAGENTA: return { "MAGENTA", "MAGENTA", "" };
case CYAN: return { "CYAN", "CYAN", "" };
case GREY: return { "GREY", "GREY", "" };
case YELLOW: return { "YELLOW", "YELLOW", "" };
case LRED: return { "LRED", "LRED", "" };
case LGREEN: return { "LGREEN", "LGREEN", "" };
case LBLUE: return { "LBLUE", "LBLUE", "" };
case LMAGENTA: return { "LMAGENTA", "LMAGENTA", "" };
case LCYAN: return { "LCYAN", "LCYAN", "" };
case WHITE: return { "WHITE", "WHITE", "" };
default: throw std::out_of_range("value");
}
}
template <>
size_t EnumUtils<ColorTypes>::Count() { return 15; }
template <>
ColorTypes EnumUtils<ColorTypes>::FromIndex(size_t index)
{
switch (index)
{
case 0: return BLACK;
case 1: return RED;
case 2: return GREEN;
case 3: return BROWN;
case 4: return BLUE;
case 5: return MAGENTA;
case 6: return CYAN;
case 7: return GREY;
case 8: return YELLOW;
case 9: return LRED;
case 10: return LGREEN;
case 11: return LBLUE;
case 12: return LMAGENTA;
case 13: return LCYAN;
case 14: return WHITE;
default: throw std::out_of_range("index");
}
}
template <>
size_t EnumUtils<ColorTypes>::ToIndex(ColorTypes value)
{
switch (value)
{
case BLACK: return 0;
case RED: return 1;
case GREEN: return 2;
case BROWN: return 3;
case BLUE: return 4;
case MAGENTA: return 5;
case CYAN: return 6;
case GREY: return 7;
case YELLOW: return 8;
case LRED: return 9;
case LGREEN: return 10;
case LBLUE: return 11;
case LMAGENTA: return 12;
case LCYAN: return 13;
case WHITE: return 14;
default: throw std::out_of_range("value");
}
}
}

View file

@ -0,0 +1,113 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#include "LogCommon.h"
#include "Define.h"
#include "SmartEnum.h"
#include <stdexcept>
namespace acore::Impl::EnumUtilsImpl
{
/************************************************************\
|* data for enum 'LogLevel' in 'LogCommon.h' auto-generated *|
\************************************************************/
template <>
EnumText EnumUtils<LogLevel>::ToString(LogLevel value)
{
switch (value)
{
case LOG_LEVEL_DISABLED: return { "LOG_LEVEL_DISABLED", "LOG_LEVEL_DISABLED", "" };
case LOG_LEVEL_FATAL: return { "LOG_LEVEL_FATAL", "LOG_LEVEL_FATAL", "" };
case LOG_LEVEL_ERROR: return { "LOG_LEVEL_ERROR", "LOG_LEVEL_ERROR", "" };
case LOG_LEVEL_WARN: return { "LOG_LEVEL_WARN", "LOG_LEVEL_WARN", "" };
case LOG_LEVEL_INFO: return { "LOG_LEVEL_INFO", "LOG_LEVEL_INFO", "" };
case LOG_LEVEL_DEBUG: return { "LOG_LEVEL_DEBUG", "LOG_LEVEL_DEBUG", "" };
case LOG_LEVEL_TRACE: return { "LOG_LEVEL_TRACE", "LOG_LEVEL_TRACE", "" };
default: throw std::out_of_range("value");
}
}
template <>
size_t EnumUtils<LogLevel>::Count() { return 7; }
template <>
LogLevel EnumUtils<LogLevel>::FromIndex(size_t index)
{
switch (index)
{
case 0: return LOG_LEVEL_DISABLED;
case 1: return LOG_LEVEL_FATAL;
case 2: return LOG_LEVEL_ERROR;
case 3: return LOG_LEVEL_WARN;
case 4: return LOG_LEVEL_INFO;
case 5: return LOG_LEVEL_DEBUG;
case 6: return LOG_LEVEL_TRACE;
default: throw std::out_of_range("index");
}
}
template <>
size_t EnumUtils<LogLevel>::ToIndex(LogLevel value)
{
switch (value)
{
case LOG_LEVEL_DISABLED: return 0;
case LOG_LEVEL_FATAL: return 1;
case LOG_LEVEL_ERROR: return 2;
case LOG_LEVEL_WARN: return 3;
case LOG_LEVEL_INFO: return 4;
case LOG_LEVEL_DEBUG: return 5;
case LOG_LEVEL_TRACE: return 6;
default: throw std::out_of_range("value");
}
}
/****************************************************************\
|* data for enum 'AppenderType' in 'LogCommon.h' auto-generated *|
\****************************************************************/
template <>
EnumText EnumUtils<AppenderType>::ToString(AppenderType value)
{
switch (value)
{
case APPENDER_NONE: return { "APPENDER_NONE", "APPENDER_NONE", "" };
case APPENDER_CONSOLE: return { "APPENDER_CONSOLE", "APPENDER_CONSOLE", "" };
case APPENDER_FILE: return { "APPENDER_FILE", "APPENDER_FILE", "" };
case APPENDER_DB: return { "APPENDER_DB", "APPENDER_DB", "" };
default: throw std::out_of_range("value");
}
}
template <>
size_t EnumUtils<AppenderType>::Count() { return 4; }
template <>
AppenderType EnumUtils<AppenderType>::FromIndex(size_t index)
{
switch (index)
{
case 0: return APPENDER_NONE;
case 1: return APPENDER_CONSOLE;
case 2: return APPENDER_FILE;
case 3: return APPENDER_DB;
default: throw std::out_of_range("index");
}
}
template <>
size_t EnumUtils<AppenderType>::ToIndex(AppenderType value)
{
switch (value)
{
case APPENDER_NONE: return 0;
case APPENDER_CONSOLE: return 1;
case APPENDER_FILE: return 2;
case APPENDER_DB: return 3;
default: throw std::out_of_range("value");
}
}
}

View file

@ -65,5 +65,5 @@ void ByteBuffer::hexlike(bool outString) const
}
o << " ";
sLog->outString("%s", o.str().c_str());
LOG_INFO("server", "%s", o.str().c_str());
}

View file

@ -242,7 +242,7 @@ bool WinServiceRun()
if (!StartServiceCtrlDispatcher(serviceTable))
{
sLog->outError("StartService Failed. Error [%u]", ::GetLastError());
LOG_ERROR("server", "StartService Failed. Error [%u]", ::GetLastError());
return false;
}
return true;

View file

@ -0,0 +1,46 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef IteratorPair_h__
#define IteratorPair_h__
#include "Define.h"
#include <utility>
namespace acore
{
/**
* @class IteratorPair
*
* @brief Utility class to enable range for loop syntax for multimap.equal_range uses
*/
template<class iterator>
class IteratorPair
{
public:
constexpr IteratorPair() : _iterators() { }
constexpr IteratorPair(iterator first, iterator second) : _iterators(first, second) { }
constexpr IteratorPair(std::pair<iterator, iterator> iterators) : _iterators(iterators) { }
constexpr iterator begin() const { return _iterators.first; }
constexpr iterator end() const { return _iterators.second; }
private:
std::pair<iterator, iterator> _iterators;
};
namespace Containers
{
template<class M>
inline auto MapEqualRange(M& map, typename M::key_type const& key) -> IteratorPair<decltype(map.begin())>
{
return { map.equal_range(key) };
}
}
//! namespace Containers
}
//! namespace acore
#endif // IteratorPair_h__

View file

@ -0,0 +1,120 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
*/
#ifndef TRINITY_SMARTENUM_H
#define TRINITY_SMARTENUM_H
#include "IteratorPair.h"
#include <iterator>
struct EnumText
{
EnumText(char const* c, char const* t, char const* d) : Constant(c), Title(t), Description(d) { }
// Enum constant of the value
char const* const Constant;
// Human-readable title of the value
char const* const Title;
// Human-readable description of the value
char const* const Description;
};
namespace acore::Impl::EnumUtilsImpl
{
template <typename Enum>
struct EnumUtils
{
static size_t Count();
static EnumText ToString(Enum value);
static Enum FromIndex(size_t index);
static size_t ToIndex(Enum index);
};
}
class EnumUtils
{
public:
template <typename Enum>
static size_t Count() { return acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::Count(); }
template <typename Enum>
static EnumText ToString(Enum value) { return acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToString(value); }
template <typename Enum>
static Enum FromIndex(size_t index) { return acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::FromIndex(index); }
template <typename Enum>
static uint32 ToIndex(Enum value) { return acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);}
template<typename Enum>
static bool IsValid(Enum value)
{
try
{
acore::Impl::EnumUtilsImpl::EnumUtils<Enum>::ToIndex(value);
return true;
} catch (...)
{
return false;
}
}
template<typename Enum>
static bool IsValid(std::underlying_type_t<Enum> value) { return IsValid(static_cast<Enum>(value)); }
template <typename Enum>
class Iterator
{
public:
using iterator_category = std::random_access_iterator_tag;
using value_type = Enum;
using pointer = Enum*;
using reference = Enum&;
using difference_type = std::ptrdiff_t;
Iterator() : _index(EnumUtils::Count<Enum>()) {}
explicit Iterator(size_t index) : _index(index) { }
bool operator==(const Iterator& other) const { return other._index == _index; }
bool operator!=(const Iterator& other) const { return !operator==(other); }
difference_type operator-(Iterator const& other) const { return _index - other._index; }
bool operator<(const Iterator& other) const { return _index < other._index; }
bool operator<=(const Iterator& other) const { return _index <= other._index; }
bool operator>(const Iterator& other) const { return _index > other._index; }
bool operator>=(const Iterator& other) const { return _index >= other._index; }
value_type operator[](difference_type d) const { return FromIndex<Enum>(_index + d); }
value_type operator*() const { return operator[](0); }
Iterator& operator+=(difference_type d) { _index += d; return *this; }
Iterator& operator++() { return operator+=(1); }
Iterator operator++(int) { Iterator i = *this; operator++(); return i; }
Iterator operator+(difference_type d) const { Iterator i = *this; i += d; return i; }
Iterator& operator-=(difference_type d) { _index -= d; return *this; }
Iterator& operator--() { return operator-=(1); }
Iterator operator--(int) { Iterator i = *this; operator--(); return i; }
Iterator operator-(difference_type d) const { Iterator i = *this; i -= d; return i; }
private:
difference_type _index;
};
template <typename Enum>
static Iterator<Enum> Begin() { return Iterator<Enum>(0); }
template <typename Enum>
static Iterator<Enum> End() { return Iterator<Enum>(); }
template <typename Enum>
static acore::IteratorPair<Iterator<Enum>> Iterate() { return { Begin<Enum>(), End<Enum>() }; }
template <typename Enum>
static char const* ToConstant(Enum value) { return ToString(value).Constant; }
template <typename Enum>
static char const* ToTitle(Enum value) { return ToString(value).Title; }
template <typename Enum>
static char const* ToDescription(Enum value) { return ToString(value).Description; }
};
#endif

View file

@ -13,7 +13,6 @@
#include <vector>
#include <queue>
#include <memory>
#include <optional>
#include <set>
#include <utility>
#include "Util.h"

View file

@ -0,0 +1,25 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
*/
#include "Tokenize.h"
std::vector<std::string_view> acore::Tokenize(std::string_view str, char sep, bool keepEmpty)
{
std::vector<std::string_view> tokens;
size_t start = 0;
for (size_t end = str.find(sep); end != std::string_view::npos; end = str.find(sep, start))
{
if (keepEmpty || (start < end))
tokens.push_back(str.substr(start, end - start));
start = end + 1;
}
if (keepEmpty || (start < str.length()))
tokens.push_back(str.substr(start));
return tokens;
}

View file

@ -0,0 +1,24 @@
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
* Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
*/
#ifndef _ACORE_TOKENIZE_H_
#define _ACORE_TOKENIZE_H_
#include "Common.h"
#include <string_view>
namespace acore
{
std::vector<std::string_view> Tokenize(std::string_view str, char sep, bool keepEmpty);
/* this would return string_view into temporary otherwise */
std::vector<std::string_view> Tokenize(std::string&&, char, bool) = delete;
std::vector<std::string_view> Tokenize(std::string const&&, char, bool) = delete;
/* the delete overload means we need to make this explicit */
inline std::vector<std::string_view> Tokenize(char const* str, char sep, bool keepEmpty) { return Tokenize(std::string_view(str ? str : ""), sep, keepEmpty); }
}
#endif // _ACORE_TOKENIZE_H_

View file

@ -13,6 +13,7 @@
*/
#include "Common.h"
#include "AppenderDB.h"
#include "DatabaseEnv.h"
#include "Config.h"
#include "Log.h"
@ -47,7 +48,7 @@ bool stopEvent = false; // Setting it to tru
/// Print out the usage string for this program on the console.
void usage(const char* prog)
{
sLog->outString("Usage: \n %s [<options>]\n"
LOG_INFO("server.authserver", "Usage: \n %s [<options>]\n"
" -c config_file use config_file as configuration file\n\r",
prog);
}
@ -80,27 +81,29 @@ extern int main(int argc, char** argv)
if (!sConfigMgr->LoadAppConfigs())
return 1;
sLog->outString("%s (authserver)", GitRevision::GetFullVersion());
sLog->outString("<Ctrl-C> to stop.\n");
// Init logging
sLog->RegisterAppender<AppenderDB>();
sLog->Initialize();
sLog->outString(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗");
sLog->outString(" ██╔══██╗╚══███╔╝██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║ ██║");
sLog->outString(" ███████║ ███╔╝ █████╗ ██████╔╝██║ ██║ ██║ ███████║");
sLog->outString(" ██╔══██║ ███╔╝ ██╔══╝ ██╔══██╗██║ ██║ ██║ ██╔══██║");
sLog->outString(" ██║ ██║███████╗███████╗██║ ██║╚██████╔╝ ██║ ██║ ██║");
sLog->outString(" ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝");
sLog->outString(" ██████╗ ██████╗ ██████╗ ███████╗");
sLog->outString(" ██╔════╝██╔═══██╗██╔══██╗██╔═══╝");
sLog->outString(" ██║ ██║ ██║██████╔╝█████╗");
sLog->outString(" ██║ ██║ ██║██╔══██╗██╔══╝");
sLog->outString(" ╚██████╗╚██████╔╝██║ ██║███████╗");
sLog->outString(" ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝\n");
sLog->outString(" AzerothCore 3.3.5a - www.azerothcore.org\n");
sLog->outString("Using configuration file %s.", configFile.c_str());
sLog->outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
LOG_INFO("server.authserver", "%s (authserver)", GitRevision::GetFullVersion());
LOG_INFO("server.authserver", "<Ctrl-C> to stop.");
LOG_INFO("server.authserver", " ");
LOG_INFO("server.authserver", " █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗");
LOG_INFO("server.authserver", " ██╔══██╗╚══███╔╝██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║ ██║");
LOG_INFO("server.authserver", " ███████║ ███╔╝ █████╗ ██████╔╝██║ ██║ ██║ ███████║");
LOG_INFO("server.authserver", " ██╔══██║ ███╔╝ ██╔══╝ ██╔══██╗██║ ██║ ██║ ██╔══██║");
LOG_INFO("server.authserver", " ██║ ██║███████╗███████╗██║ ██║╚██████╔╝ ██║ ██║ ██║");
LOG_INFO("server.authserver", " ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝");
LOG_INFO("server.authserver", " ██████╗ ██████╗ ██████╗ ███████╗");
LOG_INFO("server.authserver", " ██╔════╝██╔═══██╗██╔══██╗██╔═══╝");
LOG_INFO("server.authserver", " ██║ ██║ ██║██████╔╝█████╗");
LOG_INFO("server.authserver", " ██║ ██║ ██║██╔══██╗██╔══╝");
LOG_INFO("server.authserver", " ╚██████╗╚██████╔╝██║ ██║███████╗");
LOG_INFO("server.authserver", " ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝\n");
LOG_INFO("server.authserver", " AzerothCore 3.3.5a - www.azerothcore.org");
LOG_INFO("server.authserver", " ");
LOG_INFO("server.authserver", "Using configuration file %s.", configFile.c_str());
LOG_INFO("server.authserver", "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true);
@ -108,17 +111,17 @@ extern int main(int argc, char** argv)
ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);
#endif
sLog->outBasic("Max allowed open files is %d", ACE::max_handles());
LOG_INFO("server.authserver", "Max allowed open files is %d", ACE::max_handles());
// authserver PID file creation
std::string pidFile = sConfigMgr->GetOption<std::string>("PidFile", "");
if (!pidFile.empty())
{
if (uint32 pid = CreatePIDFile(pidFile))
sLog->outError("Daemon PID: %u\n", pid); // outError for red color in console
LOG_INFO("server.authserver", "Daemon PID: %u\n", pid); // outError for red color in console
else
{
sLog->outError("Cannot create PID file %s (possible error: permission)\n", pidFile.c_str());
LOG_ERROR("server.authserver", "Cannot create PID file %s (possible error: permission)\n", pidFile.c_str());
return 1;
}
}
@ -127,15 +130,11 @@ extern int main(int argc, char** argv)
if (!StartDB())
return 1;
// Initialize the log database
sLog->SetLogDB(false);
sLog->SetRealmID(0); // ensure we've set realm to 0 (authserver realmid)
// Get the list of realms for the server
sRealmList->Initialize(sConfigMgr->GetOption<int32>("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
sLog->outError("No valid realms specified.");
LOG_ERROR("server.authserver", "No valid realms specified.");
return 1;
}
@ -145,7 +144,7 @@ extern int main(int argc, char** argv)
int32 rmport = sConfigMgr->GetOption<int32>("RealmServerPort", 3724);
if (rmport < 0 || rmport > 0xFFFF)
{
sLog->outError("The specified RealmServerPort (%d) is out of the allowed range (1-65535)", rmport);
LOG_ERROR("server.authserver", "The specified RealmServerPort (%d) is out of the allowed range (1-65535)", rmport);
return 1;
}
@ -155,11 +154,11 @@ extern int main(int argc, char** argv)
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
sLog->outError("Auth server can not bind to %s:%d (possible error: port already in use)", bind_ip.c_str(), rmport);
LOG_ERROR("server.authserver", "Auth server can not bind to %s:%d (possible error: port already in use)", bind_ip.c_str(), rmport);
return 1;
}
sLog->outString("Authserver listening to %s:%d", bind_ip.c_str(), rmport);
LOG_INFO("server.authserver", "Authserver listening to %s:%d", bind_ip.c_str(), rmport);
// Initialize the signal handlers
acore::SignalHandler signalHandler;
@ -192,20 +191,20 @@ extern int main(int argc, char** argv)
ULONG_PTR currentAffinity = affinity & appAff;
if (!currentAffinity)
sLog->outError("server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff);
LOG_ERROR("server.authserver", "server.authserver", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the authserver. Accessible processors bitmask (hex): %x", affinity, appAff);
else if (SetProcessAffinityMask(hProcess, currentAffinity))
sLog->outString("server.authserver", "Using processors (bitmask, hex): %x", currentAffinity);
LOG_INFO("server.authserver", "server.authserver", "Using processors (bitmask, hex): %x", currentAffinity);
else
sLog->outError("server.authserver", "Can't set used processors (hex): %x", currentAffinity);
LOG_ERROR("server.authserver", "server.authserver", "Can't set used processors (hex): %x", currentAffinity);
}
}
if (highPriority)
{
if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS))
sLog->outString("server.authserver", "authserver process priority class set to HIGH");
LOG_INFO("server.authserver", "server.authserver", "authserver process priority class set to HIGH");
else
sLog->outError("server.authserver", "Can't set authserver process priority class.");
LOG_ERROR("server.authserver", "server.authserver", "Can't set authserver process priority class.");
}
#else // Linux
@ -220,21 +219,21 @@ extern int main(int argc, char** argv)
CPU_SET(i, &mask);
if (sched_setaffinity(0, sizeof(mask), &mask))
sLog->outError("Can't set used processors (hex): %x, error: %s", affinity, strerror(errno));
LOG_ERROR("server.authserver", "Can't set used processors (hex): %x, error: %s", affinity, strerror(errno));
else
{
CPU_ZERO(&mask);
sched_getaffinity(0, sizeof(mask), &mask);
sLog->outString("Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask));
LOG_INFO("server.authserver", "Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask));
}
}
if (highPriority)
{
if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY))
sLog->outError("Can't set authserver process priority class, error: %s", strerror(errno));
LOG_ERROR("server.authserver", "Can't set authserver process priority class, error: %s", strerror(errno));
else
sLog->outString("authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0));
LOG_INFO("server.authserver", "authserver process priority class set to %i", getpriority(PRIO_PROCESS, 0));
}
#endif
@ -244,13 +243,6 @@ extern int main(int argc, char** argv)
uint32 numLoops = (sConfigMgr->GetOption<int32>("MaxPingTime", 30) * (MINUTE * 1000000 / 100000));
uint32 loopCounter = 0;
// possibly enable db logging; avoid massive startup spam by doing it here.
if (sConfigMgr->GetOption<bool>("EnableLogDB", false))
{
sLog->outString("Enabling database logging...");
sLog->SetLogDB(true);
}
// Wait for termination signal
while (!stopEvent)
{
@ -263,7 +255,7 @@ extern int main(int argc, char** argv)
if ((++loopCounter) == numLoops)
{
loopCounter = 0;
sLog->outDetail("Ping MySQL to keep connection alive");
LOG_INFO("server.authserver", "Ping MySQL to keep connection alive");
LoginDatabase.KeepAlive();
}
}
@ -271,7 +263,7 @@ extern int main(int argc, char** argv)
// Close the Database Pool and library
StopDB();
sLog->outString("Halting process...");
LOG_INFO("server.authserver", "Halting process...");
return 0;
}
@ -290,7 +282,8 @@ bool StartDB()
if (!loader.Load())
return false;
sLog->outString("Started auth database connection pool.");
LOG_INFO("server.authserver", "Started auth database connection pool.");
sLog->SetRealmId(0); // Enables DB appenders when realm is set.
return true;
}

View file

@ -191,13 +191,13 @@ AuthSocket::~AuthSocket() = default;
// Accept the connection
void AuthSocket::OnAccept()
{
sLog->outBasic("'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort());
LOG_INFO("server", "'%s:%d' Accepting connection", socket().getRemoteAddress().c_str(), socket().getRemotePort());
}
void AuthSocket::OnClose()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "AuthSocket::OnClose");
LOG_DEBUG("network", "AuthSocket::OnClose");
#endif
}
@ -221,7 +221,7 @@ void AuthSocket::OnRead()
++challengesInARow;
if (challengesInARow == MAX_AUTH_LOGON_CHALLENGES_IN_A_ROW)
{
sLog->outString("Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str());
LOG_INFO("server", "Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str());
socket().shutdown();
return;
}
@ -231,7 +231,7 @@ void AuthSocket::OnRead()
challengesInARowRealmList++;
if (challengesInARowRealmList == MAX_AUTH_GET_REALM_LIST)
{
sLog->outString("Got %u REALM_LIST in a row from '%s', possible ongoing DoS", challengesInARowRealmList, socket().getRemoteAddress().c_str());
LOG_INFO("server", "Got %u REALM_LIST in a row from '%s', possible ongoing DoS", challengesInARowRealmList, socket().getRemoteAddress().c_str());
socket().shutdown();
return;
}
@ -245,13 +245,13 @@ void AuthSocket::OnRead()
if ((uint8)table[i].cmd == _cmd && (table[i].status == _status))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
LOG_DEBUG("network", "Got data for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
#endif
if (!(*this.*table[i].handler)())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
LOG_DEBUG("network", "Command handler failed for cmd %u recv length %u", (uint32)_cmd, (uint32)socket().recv_len());
#endif
return;
}
@ -263,7 +263,7 @@ void AuthSocket::OnRead()
if (i == AUTH_TOTAL_COMMANDS)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Got unknown packet from '%s'", socket().getRemoteAddress().c_str());
LOG_DEBUG("network", "Got unknown packet from '%s'", socket().getRemoteAddress().c_str());
#endif
socket().shutdown();
return;
@ -279,7 +279,7 @@ std::mutex LastLoginAttemptMutex;
bool AuthSocket::_HandleLogonChallenge()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering _HandleLogonChallenge");
LOG_DEBUG("network", "Entering _HandleLogonChallenge");
#endif
if (socket().recv_len() < sizeof(sAuthLogonChallenge_C))
return false;
@ -321,7 +321,7 @@ bool AuthSocket::_HandleLogonChallenge()
uint16 remaining = ((sAuthLogonChallenge_C*)&buf[0])->size;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] got header, body is %#04x bytes", remaining);
LOG_DEBUG("network", "[AuthChallenge] got header, body is %#04x bytes", remaining);
#endif
if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining))
@ -335,8 +335,8 @@ bool AuthSocket::_HandleLogonChallenge()
// Read the remaining of the packet
socket().recv((char*)&buf[4], remaining);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] got full packet, %#04x bytes", ch->size);
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I);
LOG_DEBUG("network", "[AuthChallenge] got full packet, %#04x bytes", ch->size);
LOG_DEBUG("network", "[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I);
#endif
// BigEndian code, nop in little endian case
@ -376,7 +376,7 @@ bool AuthSocket::_HandleLogonChallenge()
{
pkt << uint8(WOW_FAIL_BANNED);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "'%s:%d' [AuthChallenge] Banned ip tries to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort());
LOG_DEBUG("network", "'%s:%d' [AuthChallenge] Banned ip tries to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort());
#endif
}
else
@ -395,24 +395,24 @@ bool AuthSocket::_HandleLogonChallenge()
bool locked = false;
if (fields[1].GetUInt8() == 1) // if ip is locked
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[2].GetCString());
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Player address is '%s'", ip_address.c_str());
LOG_DEBUG("network", "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[2].GetCString());
LOG_DEBUG("network", "[AuthChallenge] Player address is '%s'", ip_address.c_str());
if (strcmp(fields[3].GetCString(), ip_address.c_str()) != 0)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account IP differs");
LOG_DEBUG("network", "[AuthChallenge] Account IP differs");
pkt << uint8(WOW_FAIL_LOCKED_ENFORCED);
locked = true;
}
else
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account IP matches");
LOG_DEBUG("network", "[AuthChallenge] Account IP matches");
}
else
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str());
LOG_DEBUG("network", "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str());
std::string accountCountry = fields[2].GetString();
if (accountCountry.empty() || accountCountry == "00")
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is not locked to country", _login.c_str());
LOG_DEBUG("network", "[AuthChallenge] Account '%s' is not locked to country", _login.c_str());
else if (!accountCountry.empty())
{
uint32 ip = inet_addr(ip_address.c_str());
@ -423,18 +423,18 @@ bool AuthSocket::_HandleLogonChallenge()
if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt))
{
std::string loginCountry = (*sessionCountryQuery)[0].GetString();
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str());
LOG_DEBUG("network", "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str());
if (loginCountry != accountCountry)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country differs.");
LOG_DEBUG("network", "[AuthChallenge] Account country differs.");
pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK);
locked = true;
}
else
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] Account country matches");
LOG_DEBUG("network", "[AuthChallenge] Account country matches");
}
else
sLog->outDebug(LOG_FILTER_NETWORKIO, "[AuthChallenge] IP2NATION Table empty");
LOG_DEBUG("network", "[AuthChallenge] IP2NATION Table empty");
}
}
@ -452,12 +452,12 @@ bool AuthSocket::_HandleLogonChallenge()
if ((*banresult)[0].GetUInt32() == (*banresult)[1].GetUInt32())
{
pkt << uint8(WOW_FAIL_BANNED);
sLog->outDebug(LOG_FILTER_NETWORKIO, "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
LOG_DEBUG("network", "'%s:%d' [AuthChallenge] Banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
else
{
pkt << uint8(WOW_FAIL_SUSPENDED);
sLog->outDebug(LOG_FILTER_NETWORKIO, "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
LOG_DEBUG("network", "'%s:%d' [AuthChallenge] Temporarily banned account %s tried to login!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str ());
}
}
else
@ -516,9 +516,8 @@ bool AuthSocket::_HandleLogonChallenge()
_localizationName[i] = ch->country[4 - i - 1];
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug( LOG_FILTER_NETWORKIO, "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName) );
LOG_DEBUG("network", "'%s:%d' [AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName) );
#endif
///- All good, await client's proof
_status = STATUS_LOGON_PROOF;
}
@ -536,7 +535,7 @@ bool AuthSocket::_HandleLogonChallenge()
bool AuthSocket::_HandleLogonProof()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering _HandleLogonProof");
LOG_DEBUG("network", "Entering _HandleLogonProof");
#endif
// Read the packet
sAuthLogonProof_C lp;
@ -551,7 +550,7 @@ bool AuthSocket::_HandleLogonProof()
{
// Check if we have the appropriate patch on the disk
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Client with invalid version, patching is not implemented");
LOG_DEBUG("network", "Client with invalid version, patching is not implemented");
#endif
socket().shutdown();
return true;
@ -561,7 +560,7 @@ bool AuthSocket::_HandleLogonProof()
{
_sessionKey = *K;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
LOG_DEBUG("network", "'%s:%d' User '%s' successfully authenticated", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
#endif
// Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account
@ -626,7 +625,7 @@ bool AuthSocket::_HandleLogonProof()
socket().send(data, sizeof(data));
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
LOG_DEBUG("network", "'%s:%d' [AuthChallenge] account %s tried to login with invalid password!", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
#endif
uint32 MaxWrongPassCount = sConfigMgr->GetOption<int32>("WrongPass.MaxCount", 0);
@ -670,7 +669,7 @@ bool AuthSocket::_HandleLogonProof()
LoginDatabase.Execute(stmt);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins);
LOG_DEBUG("network", "'%s:%d' [AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str(), WrongPassBanTime, failed_logins);
#endif
}
else
@ -681,7 +680,7 @@ bool AuthSocket::_HandleLogonProof()
LoginDatabase.Execute(stmt);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times",
LOG_DEBUG("network", "'%s:%d' [AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times",
socket().getRemoteAddress().c_str(), socket().getRemotePort(), socket().getRemoteAddress().c_str(), WrongPassBanTime, _login.c_str(), failed_logins);
#endif
}
@ -697,7 +696,7 @@ bool AuthSocket::_HandleLogonProof()
bool AuthSocket::_HandleReconnectChallenge()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering _HandleReconnectChallenge");
LOG_DEBUG("network", "Entering _HandleReconnectChallenge");
#endif
if (socket().recv_len() < sizeof(sAuthLogonChallenge_C))
return false;
@ -712,7 +711,7 @@ bool AuthSocket::_HandleReconnectChallenge()
uint16 remaining = ((sAuthLogonChallenge_C*)&buf[0])->size;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "[ReconnectChallenge] got header, body is %#04x bytes", remaining);
LOG_DEBUG("network", "[ReconnectChallenge] got header, body is %#04x bytes", remaining);
#endif
if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (socket().recv_len() < remaining))
@ -729,8 +728,8 @@ bool AuthSocket::_HandleReconnectChallenge()
// Read the remaining of the packet
socket().recv((char*)&buf[4], remaining);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "[ReconnectChallenge] got full packet, %#04x bytes", ch->size);
sLog->outDebug(LOG_FILTER_NETWORKIO, "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I);
LOG_DEBUG("network", "[ReconnectChallenge] got full packet, %#04x bytes", ch->size);
LOG_DEBUG("network", "[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I);
#endif
_login = (const char*)ch->I;
@ -742,7 +741,7 @@ bool AuthSocket::_HandleReconnectChallenge()
// Stop if the account is not found
if (!result)
{
sLog->outError("'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
LOG_ERROR("server", "'%s:%d' [ERROR] user %s tried to login and we cannot find his session key in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@ -782,7 +781,7 @@ bool AuthSocket::_HandleReconnectChallenge()
bool AuthSocket::_HandleReconnectProof()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering _HandleReconnectProof");
LOG_DEBUG("network", "Entering _HandleReconnectProof");
#endif
// Read the packet
sAuthReconnectProof_C lp;
@ -820,7 +819,7 @@ bool AuthSocket::_HandleReconnectProof()
}
else
{
sLog->outError("'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
LOG_ERROR("server", "'%s:%d' [ERROR] user %s tried to login, but session is invalid.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@ -852,7 +851,7 @@ ACE_INET_Addr const& AuthSocket::GetAddressForClient(Realm const& realm, ACE_INE
bool AuthSocket::_HandleRealmList()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering _HandleRealmList");
LOG_DEBUG("network", "Entering _HandleRealmList");
#endif
if (socket().recv_len() < 5)
return false;
@ -866,7 +865,7 @@ bool AuthSocket::_HandleRealmList()
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (!result)
{
sLog->outError("'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
LOG_ERROR("server", "'%s:%d' [ERROR] user %s tried to login but we cannot find him in the database.", socket().getRemoteAddress().c_str(), socket().getRemotePort(), _login.c_str());
socket().shutdown();
return false;
}
@ -984,12 +983,12 @@ bool AuthSocket::_HandleRealmList()
bool AuthSocket::_HandleXferResume()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering _HandleXferResume");
LOG_DEBUG("network", "Entering _HandleXferResume");
#endif
// Check packet length and patch existence
if (socket().recv_len() < 9 || !pPatch) // FIXME: pPatch is never used
{
sLog->outError("Error while resuming patch transfer (wrong packet)");
LOG_ERROR("server", "Error while resuming patch transfer (wrong packet)");
return false;
}
@ -1007,7 +1006,7 @@ bool AuthSocket::_HandleXferResume()
bool AuthSocket::_HandleXferCancel()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering _HandleXferCancel");
LOG_DEBUG("network", "Entering _HandleXferCancel");
#endif
// Close and delete the socket
@ -1021,13 +1020,13 @@ bool AuthSocket::_HandleXferCancel()
bool AuthSocket::_HandleXferAccept()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Entering _HandleXferAccept");
LOG_DEBUG("network", "Entering _HandleXferAccept");
#endif
// Check packet length and patch existence
if (!pPatch)
{
sLog->outError("Error while accepting patch transfer (wrong packet)");
LOG_ERROR("server", "Error while accepting patch transfer (wrong packet)");
return false;
}
@ -1109,12 +1108,12 @@ void Patcher::LoadPatchMD5(char* szFileName)
path += szFileName;
FILE* pPatch = fopen(path.c_str(), "rb");
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Loading patch info from %s\n", path.c_str());
LOG_DEBUG("network", "Loading patch info from %s\n", path.c_str());
#endif
if (!pPatch)
{
sLog->outError("Error loading patch %s\n", path.c_str());
LOG_ERROR("server", "Error loading patch %s\n", path.c_str());
return;
}

View file

@ -36,7 +36,7 @@ protected:
virtual int handle_timeout(const ACE_Time_Value& /*current_time*/, const void* /*act = 0*/)
{
sLog->outBasic("Resuming acceptor");
LOG_INFO("server", "Resuming acceptor");
reactor()->cancel_timer(this, 1);
return reactor()->register_handler(this, ACE_Event_Handler::ACCEPT_MASK);
}
@ -46,7 +46,7 @@ protected:
#if defined(ENFILE) && defined(EMFILE)
if (errno == ENFILE || errno == EMFILE)
{
sLog->outError("Out of file descriptors, suspending incoming connections for 10 seconds");
LOG_ERROR("server", "Out of file descriptors, suspending incoming connections for 10 seconds");
reactor()->remove_handler(this, ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL);
reactor()->schedule_timer(this, nullptr, ACE_Time_Value(10));
}

View file

@ -69,116 +69,6 @@ BindIP = "0.0.0.0"
PidFile = ""
#
# LogLevel
# Description: Server console level of logging
# Default: 0 - (Minimum)
# 1 - (Basic)
# 2 - (Detail)
# 3 - (Full/Debug)
LogLevel = 0
#
# LogFile
# Description: Log file for main server log.
# Default: "Auth.log" - (Enabled)
# "" - (Disabled)
LogFile = "Auth.log"
#
# Debug Log Mask
# Description: Bitmask that determines which debug log output (level 3)
# will be logged.
# Possible flags:
#
# 64 - Anything related to network input/output,
# such as packet handlers and netcode logs
#
# Simply add the values together to create a bitmask.
# For more info see enum DebugLogFilters in Log.h
#
# Default: 0 (nothing)
DebugLogMask = 64
#
# SQLDriverLogFile
# Description: Log file for SQL driver events.
# Example: "AuthSQLDriver.log" - (Enabled)
# Default: "" - (Disabled)
SQLDriverLogFile = ""
#
# SQLDriverQueryLogging
# Description: Log SQL queries to the SQLDriverLogFile and console.
# Default: 0 - (Disabled, Query errors only)
# 1 - (Enabled, Full query logging - may have performance impact)
SQLDriverQueryLogging = 0
#
# LogTimestamp
# Description: Append timestamp to the server log file name.
# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
# Default: 0 - (Disabled)
# 1 - (Enabled)
LogTimestamp = 0
#
# LogFileLevel
# Description: Server file level of logging
# Default: 0 - (Minimum)
# 1 - (Basic)
# 2 - (Detail)
# 3 - (Full/Debug)
LogFileLevel = 0
#
# LogColors
# Description: Colors for log messages (Format: "normal basic detail debug").
# Colors: 0 - Black
# 1 - Red
# 2 - Green
# 3 - Brown
# 4 - Blue
# 5 - Magenta
# 6 - Cyan
# 7 - Grey
# 8 - Yellow
# 9 - Lred
# 10 - Lgreen
# 11 - Lblue
# 12 - Lmagenta
# 13 - Lcyan
# 14 - White
# Example: "13 11 9 5" - (Enabled)
# Default: "" - (Disabled)
LogColors = ""
#
# EnableLogDB
# Description: Write log messages to database (LogDatabaseInfo).
# Default: 0 - (Disabled)
# 1 - (Enabled)
EnableLogDB = 0
#
# DBLogLevel
# Description: Log level of databases logging.
# Default: 1 - (Basic)
# 0 - (Minimum)
# 2 - (Detail)
# 3 - (Full/Debug)
DBLogLevel = 1
#
# UseProcessors
# Description: Processors mask for Windows and Linux based multi-processor systems.
@ -278,3 +168,95 @@ LoginDatabase.SynchThreads = 1
#
###################################################################################################
###################################################################################################
#
# LOGGING SYSTEM SETTINGS
#
# Appender config values: Given an appender "name"
# Appender.name
# Description: Defines 'where to log'
# Format: Type,LogLevel,Flags,optional1,optional2,optional3
#
# Type
# 0 - (None)
# 1 - (Console)
# 2 - (File)
# 3 - (DB)
#
# LogLevel
# 0 - (Disabled)
# 1 - (Fatal)
# 2 - (Error)
# 3 - (Warning)
# 4 - (Info)
# 5 - (Debug)
# 6 - (Trace)
#
# Flags:
# 0 - None
# 1 - Prefix Timestamp to the text
# 2 - Prefix Log Level to the text
# 4 - Prefix Log Filter type to the text
# 8 - Append timestamp to the log file name. Format: YYYY-MM-DD_HH-MM-SS (Only used with Type = 2)
# 16 - Make a backup of existing file before overwrite (Only used with Mode = w)
#
# Colors (read as optional1 if Type = Console)
# Format: "fatal error warn info debug trace"
# 0 - BLACK
# 1 - RED
# 2 - GREEN
# 3 - BROWN
# 4 - BLUE
# 5 - MAGENTA
# 6 - CYAN
# 7 - GREY
# 8 - YELLOW
# 9 - LRED
# 10 - LGREEN
# 11 - LBLUE
# 12 - LMAGENTA
# 13 - LCYAN
# 14 - WHITE
# Example: "1 9 3 6 5 8"
#
# File: Name of the file (read as optional1 if Type = File)
# Allows to use one "%s" to create dynamic files
#
# Mode: Mode to open the file (read as optional2 if Type = File)
# a - (Append)
# w - (Overwrite)
#
# MaxFileSize: Maximum file size of the log file before creating a new log file
# (read as optional3 if Type = File)
# Size is measured in bytes expressed in a 64-bit unsigned integer.
# Maximum value is 4294967295 (4 GB). Leave blank for no limit.
# NOTE: Does not work with dynamic filenames.
# Example: 536870912 (512 MB)
#
Appender.Console=1,5,0,"1 9 3 6 5 8"
Appender.Auth=2,5,0,Auth.log,w
# Logger config values: Given a logger "name"
# Logger.name
# Description: Defines 'What to log'
# Format: LogLevel,AppenderList
#
# LogLevel
# 0 - (Disabled)
# 1 - (Fatal)
# 2 - (Error)
# 3 - (Warning)
# 4 - (Info)
# 5 - (Debug)
# 6 - (Trace)
#
# AppenderList: List of appenders linked to logger
# (Using spaces as separator).
#
Logger.root=5,Console Auth
#
###################################################################################################

View file

@ -158,7 +158,7 @@ void CasterAI::UpdateAI(uint32 diff)
ArcherAI::ArcherAI(Creature* c) : CreatureAI(c)
{
if (!me->m_spells[0])
sLog->outError("ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
LOG_ERROR("server", "ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
@ -207,7 +207,7 @@ void ArcherAI::UpdateAI(uint32 /*diff*/)
TurretAI::TurretAI(Creature* c) : CreatureAI(c)
{
if (!me->m_spells[0])
sLog->outError("TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
LOG_ERROR("server", "TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
@ -282,7 +282,7 @@ void VehicleAI::LoadConditions()
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry());
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (!conditions.empty())
sLog->outDebug(LOG_FILTER_CONDITIONSYS, "VehicleAI::LoadConditions: loaded %u conditions", uint32(conditions.size()));
LOG_DEBUG("condition", "VehicleAI::LoadConditions: loaded %u conditions", uint32(conditions.size()));
#endif
}

View file

@ -40,7 +40,7 @@ void GuardAI::EnterEvadeMode()
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "Guard entry: %u enters evade mode.", me->GetEntry());
LOG_DEBUG("entities.unit", "Guard entry: %u enters evade mode.", me->GetEntry());
#endif
me->RemoveAllAuras();

View file

@ -59,7 +59,7 @@ void PetAI::_stopAttack()
if (!me->IsAlive())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow());
LOG_DEBUG("server", "Creature stoped attacking cuz his dead [guid=%u]", me->GetGUIDLow());
#endif
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
@ -157,7 +157,7 @@ void PetAI::UpdateAI(uint32 diff)
if (_needToStop())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Pet AI stopped attacking [guid=%u]", me->GetGUIDLow());
LOG_DEBUG("server", "Pet AI stopped attacking [guid=%u]", me->GetGUIDLow());
#endif
_stopAttack();
return;
@ -681,7 +681,7 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo)
// pussywizard: ZOMG! TEMP!
if (!me->GetCharmInfo())
{
sLog->outMisc("PetAI::CanAttack (A1) - %u, %u", me->GetEntry(), GUID_LOPART(me->GetOwnerGUID()));
LOG_INFO("misc", "PetAI::CanAttack (A1) - %u, %u", me->GetEntry(), GUID_LOPART(me->GetOwnerGUID()));
return false;
}

View file

@ -126,7 +126,7 @@ void UnitAI::DoCastToAllHostilePlayers(uint32 spellid, bool triggered)
void UnitAI::DoCast(uint32 spellId)
{
Unit* target = nullptr;
//sLog->outError("aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target);
//LOG_ERROR("server", "aggre %u %u", spellId, (uint32)AISpellInfo[spellId].target);
switch (AISpellInfo[spellId].target)
{
default:

View file

@ -42,7 +42,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= nullptr*/, float maxRange
Map* map = creature->GetMap();
if (!map->IsDungeon()) //use IsDungeon instead of Instanceable, in case battlegrounds will be instantiated
{
sLog->outError("DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0);
LOG_ERROR("server", "DoZoneInCombat call for map that isn't an instance (creature entry = %d)", creature->GetTypeId() == TYPEID_UNIT ? creature->ToCreature()->GetEntry() : 0);
return;
}
@ -65,7 +65,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= nullptr*/, float maxRange
if (!creature->HasReactState(REACT_PASSIVE) && !creature->GetVictim())
{
sLog->outError("DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
LOG_ERROR("server", "DoZoneInCombat called for creature that has empty threat list (creature entry = %u)", creature->GetEntry());
return;
}
@ -152,7 +152,7 @@ void CreatureAI::EnterEvadeMode()
return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "Creature %u enters evade mode.", me->GetEntry());
LOG_DEBUG("entities.unit", "Creature %u enters evade mode.", me->GetEntry());
#endif
if (!me->GetVehicle()) // otherwise me will be in evade mode forever

View file

@ -84,7 +84,7 @@ namespace FactorySelector
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
// select NullCreatureAI if not another cases
ainame = (ai_factory == nullptr) ? "NullCreatureAI" : ai_factory->key();
sLog->outDebug(LOG_FILTER_TSCR, "Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str());
LOG_DEBUG("scripts.ai", "Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str());
#endif
return (ai_factory == nullptr ? new NullCreatureAI(creature) : ai_factory->Create(creature));
}
@ -131,7 +131,7 @@ namespace FactorySelector
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
std::string ainame = (ai_factory == nullptr || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key();
sLog->outDebug(LOG_FILTER_TSCR, "GameObject %u used AI is %s.", go->GetGUIDLow(), ainame.c_str());
LOG_DEBUG("scripts.ai", "GameObject %u used AI is %s.", go->GetGUIDLow(), ainame.c_str());
#endif
return (ai_factory == nullptr ? new NullGameObjectAI(go) : ai_factory->Create(go));

View file

@ -198,7 +198,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId)
if (!sSoundEntriesStore.LookupEntry(soundId))
{
sLog->outError("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
LOG_ERROR("server", "TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow());
return;
}
@ -330,7 +330,7 @@ void ScriptedAI::DoResetThreat()
{
if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty())
{
sLog->outError("DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
LOG_ERROR("server", "DoResetThreat called for creature that either cannot have threat list or has empty threat list (me entry = %d)", me->GetEntry());
return;
}
@ -359,7 +359,7 @@ void ScriptedAI::DoTeleportPlayer(Unit* unit, float x, float y, float z, float o
if (Player* player = unit->ToPlayer())
player->TeleportTo(unit->GetMapId(), x, y, z, o, TELE_TO_NOT_LEAVE_COMBAT);
else
sLog->outError("TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
LOG_ERROR("server", "TSCR: Creature " UI64FMTD " (Entry: %u) Tried to teleport non-player unit (Type: %u GUID: " UI64FMTD ") to x: %f y:%f z: %f o: %f. Aborted.", me->GetGUID(), me->GetEntry(), unit->GetTypeId(), unit->GetGUID(), x, y, z, o);
}
void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)

View file

@ -199,7 +199,7 @@ void npc_escortAI::EnterEvadeMode()
AddEscortState(STATE_ESCORT_RETURNING);
ReturnToLastPoint();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has left combat and is now returning to last point");
LOG_DEBUG("scripts.ai", "TSCR: EscortAI has left combat and is now returning to last point");
#endif
}
else
@ -327,7 +327,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
if (pointId == POINT_LAST_POINT)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original position before combat");
LOG_DEBUG("scripts.ai", "TSCR: EscortAI has returned to original position before combat");
#endif
me->SetWalk(!m_bIsRunning);
@ -339,7 +339,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
else if (pointId == POINT_HOME)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
LOG_DEBUG("scripts.ai", "TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list.");
#endif
CurrentWP = WaypointList.begin();
@ -428,14 +428,14 @@ void npc_escortAI::SetRun(bool on)
if (!m_bIsRunning)
me->SetWalk(false);
else
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set run mode, but is already running.");
LOG_DEBUG("scripts.ai", "TSCR: EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
me->SetWalk(true);
else
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set walk mode, but is already walking.");
LOG_DEBUG("scripts.ai", "TSCR: EscortAI attempt to set walk mode, but is already walking.");
}
m_bIsRunning = on;
@ -446,13 +446,13 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
{
if (me->GetVictim())
{
sLog->outError("TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
LOG_ERROR("server", "TSCR ERROR: EscortAI (script: %s, creature entry: %u) attempts to Start while in combat", me->GetScriptName().c_str(), me->GetEntry());
return;
}
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
sLog->outError("TSCR: EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
LOG_ERROR("server", "TSCR: EscortAI (script: %s, creature entry: %u) attempts to Start while already escorting", me->GetScriptName().c_str(), me->GetEntry());
return;
}
@ -465,7 +465,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
if (WaypointList.empty())
{
sLog->outErrorDb("TSCR: EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
LOG_ERROR("sql.sql", "TSCR: EscortAI (script: %s, creature entry: %u) starts with 0 waypoints (possible missing entry in script_waypoint. Quest: %u).",
me->GetScriptName().c_str(), me->GetEntry(), quest ? quest->GetQuestId() : 0);
return;
}
@ -482,7 +482,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (m_bCanReturnToStart && m_bCanInstantRespawn)
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.");
LOG_DEBUG("scripts.ai", "TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn.");
#endif
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
@ -490,7 +490,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
me->GetMotionMaster()->MovementExpired();
me->GetMotionMaster()->MoveIdle();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
LOG_DEBUG("scripts.ai", "TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle.");
#endif
}
@ -503,7 +503,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
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);
LOG_DEBUG("scripts.ai", "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
#endif
CurrentWP = WaypointList.begin();

View file

@ -149,7 +149,7 @@ void FollowerAI::EnterEvadeMode()
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI left combat, returning to CombatStartPosition.");
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI left combat, returning to CombatStartPosition.");
#endif
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
@ -177,7 +177,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff)
if (HasFollowState(STATE_FOLLOW_COMPLETE) && !HasFollowState(STATE_FOLLOW_POSTEVENT))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is set completed, despawns.");
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI is set completed, despawns.");
#endif
me->DespawnOrUnsummon();
return;
@ -190,7 +190,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff)
if (HasFollowState(STATE_FOLLOW_RETURNING))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI is returning to leader.");
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI is returning to leader.");
#endif
RemoveFollowState(STATE_FOLLOW_RETURNING);
@ -221,7 +221,7 @@ void FollowerAI::UpdateAI(uint32 uiDiff)
if (bIsMaxRangeExceeded)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI failed because player/group was to far away or not found");
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI failed because player/group was to far away or not found");
#endif
me->DespawnOrUnsummon();
return;
@ -266,14 +266,14 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
if (me->GetVictim())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI attempt to StartFollow while in combat.");
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI attempt to StartFollow while in combat.");
#endif
return;
}
if (HasFollowState(STATE_FOLLOW_INPROGRESS))
{
sLog->outError("TSCR: FollowerAI attempt to StartFollow while already following.");
LOG_ERROR("server", "TSCR: FollowerAI attempt to StartFollow while already following.");
return;
}
@ -290,7 +290,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
me->GetMotionMaster()->Clear();
me->GetMotionMaster()->MoveIdle();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
#endif
}
@ -301,7 +301,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
me->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID);
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI start follow %s (GUID " UI64FMTD ")", player->GetName().c_str(), m_uiLeaderGUID);
#endif
}
@ -322,7 +322,7 @@ Player* FollowerAI::GetLeaderForFollower()
if (member && me->IsWithinDistInMap(member, MAX_PLAYER_DISTANCE) && member->IsAlive())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader changed and returned new leader.");
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI GetLeader changed and returned new leader.");
#endif
m_uiLeaderGUID = member->GetGUID();
return member;
@ -333,7 +333,7 @@ Player* FollowerAI::GetLeaderForFollower()
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: FollowerAI GetLeader can not find suitable leader.");
LOG_DEBUG("scripts.ai", "TSCR: FollowerAI GetLeader can not find suitable leader.");
#endif
return nullptr;
}

View file

@ -99,7 +99,7 @@ WayPoint* SmartAI::GetNextWayPoint()
{
mLastWP = (*itr).second;
if (mLastWP->id != mCurrentWPID)
sLog->outError("SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID);
LOG_ERROR("server", "SmartAI::GetNextWayPoint: Got not expected waypoint id %u, expected %u", mLastWP->id, mCurrentWPID);
return (*itr).second;
}
@ -173,7 +173,7 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
{
if (me->IsInCombat())// no wp movement in combat
{
sLog->outError("SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
LOG_ERROR("server", "SmartAI::StartPath: Creature entry %u wanted to start waypoint movement while in combat, ignoring.", me->GetEntry());
return;
}
@ -232,7 +232,7 @@ void SmartAI::PausePath(uint32 delay, bool forced)
if (HasEscortState(SMART_ESCORT_PAUSED))
{
sLog->outError("SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry());
LOG_ERROR("server", "SmartAI::StartPath: Creature entry %u wanted to pause waypoint movement while already paused, ignoring.", me->GetEntry());
return;
}
@ -1098,7 +1098,7 @@ void SmartGameObjectAI::Reset()
bool SmartGameObjectAI::GossipHello(Player* player, bool reportUse)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartGameObjectAI::GossipHello");
LOG_DEBUG("sql.sql", "SmartGameObjectAI::GossipHello");
#endif
GetScript()->ProcessEventsFor(SMART_EVENT_GOSSIP_HELLO, player, (uint32)reportUse, 0, false, nullptr, go);
return false;
@ -1180,7 +1180,7 @@ public:
return false;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "AreaTrigger %u is using SmartTrigger script", trigger->entry);
LOG_DEBUG("sql.sql", "AreaTrigger %u is using SmartTrigger script", trigger->entry);
#endif
SmartScript script;
script.OnInitialize(nullptr, trigger);

View file

@ -146,7 +146,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (Unit* tempInvoker = GetLastInvoker())
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName().c_str(), tempInvoker->GetGUIDLow());
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName().c_str(), tempInvoker->GetGUIDLow());
#endif
bool isControlled = e.action.MoveToPos.controlled > 0;
@ -192,7 +192,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!sCreatureTextMgr->TextExist(talker->GetEntry(), uint8(e.action.talk.textGroupID)))
{
sLog->outErrorDb("SmartScript::ProcessAction: SMART_ACTION_TALK: EntryOrGuid %d SourceType %u EventType %u TargetType %u using non-existent Text id %u for talker %u, ignored.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetTargetType(), e.action.talk.textGroupID, talker->GetEntry());
LOG_ERROR("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_TALK: EntryOrGuid %d SourceType %u EventType %u TargetType %u using non-existent Text id %u for talker %u, ignored.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetTargetType(), e.action.talk.textGroupID, talker->GetEntry());
break;
}
@ -202,7 +202,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
mUseTextTimer = true;
sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), talkTarget);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textId: %u", talker->GetName().c_str(), talker->GetGUIDLow(), mLastTextID);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textId: %u", talker->GetName().c_str(), talker->GetGUIDLow(), mLastTextID);
#endif
break;
}
@ -221,7 +221,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker : 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_NEUTRAL, false, (*itr)->ToPlayer());
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u",
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID));
#endif
}
@ -241,7 +241,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToUnit()->HandleEmoteCommand(e.action.emote.emote);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s (GuidLow: %u), emote: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s (GuidLow: %u), emote: %u",
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.emote.emote);
#endif
}
@ -262,7 +262,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.onlySelf > 0);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.onlySelf);
#endif
}
@ -307,7 +307,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 sound = temp[urand(0, count - 1)];
(*itr)->SendPlaySound(sound, e.action.randomSound.onlySelf > 0);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), sound, e.action.randomSound.onlySelf);
#endif
}
@ -357,7 +357,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->SendPlayMusic(e.action.music.sound, e.action.music.onlySelf > 0);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_MUSIC: target: %s (GuidLow: %u), sound: %u, onlySelf: %u, type: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MUSIC: target: %s (GuidLow: %u), sound: %u, onlySelf: %u, type: %u",
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.music.sound, e.action.music.onlySelf, e.action.music.type);
#endif
}
@ -432,7 +432,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 sound = temp[urand(0, count - 1)];
(*itr)->SendPlayMusic(sound, e.action.randomMusic.onlySelf > 0);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_MUSIC: target: %s (GuidLow: %u), sound: %u, onlyself: %u, type: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_MUSIC: target: %s (GuidLow: %u), sound: %u, onlyself: %u, type: %u",
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), sound, e.action.randomMusic.onlySelf, e.action.randomMusic.type);
#endif
}
@ -454,7 +454,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToCreature()->setFaction(e.action.faction.factionID);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u",
(*itr)->GetEntry(), (*itr)->GetGUIDLow(), e.action.faction.factionID);
#endif
}
@ -466,7 +466,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToCreature()->setFaction(ci->faction);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_FACTION: Creature entry %u, GuidLow %u set faction to %u",
(*itr)->GetEntry(), (*itr)->GetGUIDLow(), ci->faction);
#endif
}
@ -500,7 +500,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 displayId = ObjectMgr::ChooseDisplayId(ci);
(*itr)->ToCreature()->SetDisplayId(displayId);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u",
(*itr)->GetEntry(), (*itr)->GetGUIDLow(), displayId);
#endif
}
@ -510,7 +510,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToCreature()->SetDisplayId(e.action.morphOrMount.model);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u set displayid to %u",
(*itr)->GetEntry(), (*itr)->GetGUIDLow(), e.action.morphOrMount.model);
#endif
}
@ -519,7 +519,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToCreature()->DeMorph();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u demorphs.",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_MORPH_TO_ENTRY_OR_MODEL: Creature entry %u, GuidLow %u demorphs.",
(*itr)->GetEntry(), (*itr)->GetGUIDLow());
#endif
}
@ -540,7 +540,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToPlayer()->FailQuest(e.action.quest.quest);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_FAIL_QUEST: Player guidLow %u fails quest %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_FAIL_QUEST: Player guidLow %u fails quest %u",
(*itr)->GetGUIDLow(), e.action.quest.quest);
#endif
}
@ -569,11 +569,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
PlayerMenu menu(session);
menu.SendQuestGiverQuestDetails(q, me->GetGUID(), true);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(
LOG_FILTER_DATABASE_AI,
"SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player guidLow %u - offering quest %u",
(*itr)->GetGUIDLow(),
e.action.questOffer.questID);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player guidLow %u - offering quest %u",
(*itr)->GetGUIDLow(), e.action.questOffer.questID);
#endif
}
}
@ -581,11 +578,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, nullptr);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(
LOG_FILTER_DATABASE_AI,
"SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player guidLow %u - quest %u added",
(*itr)->GetGUIDLow(),
e.action.questOffer.questID);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_OFFER_QUEST: Player guidLow %u - quest %u added",
(*itr)->GetGUIDLow(), e.action.questOffer.questID);
#endif
}
}
@ -649,7 +643,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 emote = temp[urand(0, count - 1)];
(*itr)->ToUnit()->HandleEmoteCommand(emote);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_EMOTE: Creature guidLow %u handle random emote %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_EMOTE: Creature guidLow %u handle random emote %u",
(*itr)->GetGUIDLow(), emote);
#endif
}
@ -670,7 +664,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
me->getThreatManager().modifyThreatPercent(target, e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature guidLow %u modify threat for unit %u, value %i",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_ALL_PCT: Creature guidLow %u modify threat for unit %u, value %i",
me->GetGUIDLow(), target->GetGUIDLow(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
#endif
}
@ -692,7 +686,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
me->getThreatManager().modifyThreatPercent((*itr)->ToUnit(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature guidLow %u modify threat for unit %u, value %i",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_THREAT_SINGLE_PCT: Creature guidLow %u modify threat for unit %u, value %i",
me->GetGUIDLow(), (*itr)->GetGUIDLow(), e.action.threatPCT.threatINC ? (int32)e.action.threatPCT.threatINC : -(int32)e.action.threatPCT.threatDEC);
#endif
}
@ -721,7 +715,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
player->GroupEventHappens(e.action.quest.quest, me);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS: Player guidLow %u credited quest %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS: Player guidLow %u credited quest %u",
(*itr)->GetGUIDLow(), e.action.quest.quest);
#endif
}
@ -833,7 +827,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToUnit()->AddAura(e.action.cast.spell, (*itr)->ToUnit());
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ADD_AURA: Adding aura %u to unit %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_ADD_AURA: Adding aura %u to unit %u",
e.action.cast.spell, (*itr)->GetGUIDLow());
#endif
}
@ -857,7 +851,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
(*itr)->ToGameObject()->SetLootState(GO_READY);
(*itr)->ToGameObject()->UseDoorOrButton(0, !!e.action.activateObject.alternative, unit);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ACTIVATE_GOBJECT. Gameobject %u (entry: %u) activated",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_ACTIVATE_GOBJECT. Gameobject %u (entry: %u) activated",
(*itr)->GetGUIDLow(), (*itr)->GetEntry());
#endif
}
@ -878,7 +872,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToGameObject()->ResetDoorOrButton();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_RESET_GOBJECT. Gameobject %u (entry: %u) reset",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_RESET_GOBJECT. Gameobject %u (entry: %u) reset",
(*itr)->GetGUIDLow(), (*itr)->GetEntry());
#endif
}
@ -899,7 +893,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
(*itr)->ToUnit()->SetUInt32Value(UNIT_NPC_EMOTESTATE, e.action.emote.emote);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %u set emotestate to %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_EMOTE_STATE. Unit %u set emotestate to %u",
(*itr)->GetGUIDLow(), e.action.emote.emote);
#endif
}
@ -921,14 +915,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!e.action.unitFlag.type)
{
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
//TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS",
//(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS",
(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
}
else
{
(*itr)->ToUnit()->SetFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
//TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS_2",
//(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_UNIT_FLAG. Unit %u added flag %u to UNIT_FIELD_FLAGS_2",
(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
}
}
}
@ -949,14 +943,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!e.action.unitFlag.type)
{
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS, e.action.unitFlag.flag);
//TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS",
//(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS",
(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
}
else
{
(*itr)->ToUnit()->RemoveFlag(UNIT_FIELD_FLAGS_2, e.action.unitFlag.flag);
//TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS_2",
//(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_REMOVE_UNIT_FLAG. Unit %u removed flag %u to UNIT_FIELD_FLAGS_2",
(*itr)->GetGUIDLow(), e.action.unitFlag.flag);
}
}
}
@ -971,7 +965,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
CAST_AI(SmartAI, me->AI())->SetAutoAttack(e.action.autoAttack.attack);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_AUTO_ATTACK: Creature: %u bool on = %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_AUTO_ATTACK: Creature: %u bool on = %u",
me->GetGUIDLow(), e.action.autoAttack.attack);
#endif
break;
@ -991,7 +985,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
else
CAST_AI(SmartAI, me->AI())->SetCombatMove(move);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %u bool on = %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %u bool on = %u",
me->GetGUIDLow(), e.action.combatMove.move);
#endif
break;
@ -1003,7 +997,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
SetPhase(e.action.setEventPhase.phase);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SET_EVENT_PHASE: Creature %u set event phase %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SET_EVENT_PHASE: Creature %u set event phase %u",
GetBaseObject()->GetGUIDLow(), e.action.setEventPhase.phase);
#endif
break;
@ -1016,7 +1010,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
IncPhase(e.action.incEventPhase.inc);
DecPhase(e.action.incEventPhase.dec);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_INC_EVENT_PHASE: Creature %u inc event phase by %u, "
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_INC_EVENT_PHASE: Creature %u inc event phase by %u, "
"decrease by %u", GetBaseObject()->GetGUIDLow(), e.action.incEventPhase.inc, e.action.incEventPhase.dec);
#endif
break;
@ -1051,7 +1045,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
sCreatureTextMgr->SendChatPacket(me, builder, CHAT_MSG_MONSTER_EMOTE);
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow());
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_FLEE_FOR_ASSIST: Creature %u DoFleeToGetAssistance", me->GetGUIDLow());
#endif
break;
}
@ -1079,7 +1073,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (Player* player = (*itr)->ToUnit()->GetCharmerOrOwnerPlayerOrPlayerItself())
player->GroupEventHappens(e.action.quest.quest, GetBaseObject());
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_GROUPEVENTHAPPENS: Player %u, group credit for quest %u",
(*itr)->GetGUIDLow(), e.action.quest.quest);
#endif
}
@ -1113,7 +1107,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
(*itr)->ToUnit()->RemoveAllAuras();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit %u, spell %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_REMOVEAURASFROMSPELL: Unit %u, spell %u",
(*itr)->GetGUIDLow(), e.action.removeAura.spell);
#endif
}
@ -1140,7 +1134,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
float angle = e.action.follow.angle > 6 ? (e.action.follow.angle * M_PI / 180.0f) : e.action.follow.angle;
CAST_AI(SmartAI, me->AI())->SetFollow((*itr)->ToUnit(), float(int32(e.action.follow.dist)) + 0.1f, angle, e.action.follow.credit, e.action.follow.entry, e.action.follow.creditType, e.action.follow.aliveState);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_FOLLOW: Creature %u following target %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_FOLLOW: Creature %u following target %u",
me->GetGUIDLow(), (*itr)->GetGUIDLow());
#endif
break;
@ -1179,7 +1173,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 phase = temp[urand(0, count - 1)];
SetPhase(phase);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE: Creature %u sets event phase to %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE: Creature %u sets event phase to %u",
GetBaseObject()->GetGUIDLow(), phase);
#endif
break;
@ -1192,7 +1186,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 phase = urand(e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax);
SetPhase(phase);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE_RANGE: Creature %u sets event phase to %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_RANDOM_PHASE_RANGE: Creature %u sets event phase to %u",
GetBaseObject()->GetGUIDLow(), phase);
#endif
break;
@ -1203,7 +1197,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
unit->ToPlayer()->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, unit);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: (trigger == true) Player %u, Killcredit: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: (trigger == true) Player %u, Killcredit: %u",
unit->GetGUIDLow(), e.action.killedMonster.creature);
#endif
}
@ -1215,8 +1209,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (Player* player = me->GetLootRecipient())
{
player->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, player);
//TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u",
// player->GetGUIDLow(), e.action.killedMonster.creature);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u",
player->GetGUIDLow(), e.action.killedMonster.creature);
}
}
else // Specific target type
@ -1236,7 +1230,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
player->RewardPlayerAndGroupAtEvent(e.action.killedMonster.creature, player);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_CALL_KILLEDMONSTER: Player %u, Killcredit: %u",
(*itr)->GetGUIDLow(), e.action.killedMonster.creature);
#endif
}
@ -1257,13 +1251,13 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
InstanceScript* instance = obj->GetInstanceScript();
if (!instance)
{
sLog->outErrorDb("SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
LOG_ERROR("sql.sql", "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
break;
}
instance->SetData(e.action.setInstanceData.field, e.action.setInstanceData.data);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA: Field: %u, data: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA: Field: %u, data: %u",
e.action.setInstanceData.field, e.action.setInstanceData.data);
#endif
break;
@ -1280,7 +1274,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
InstanceScript* instance = obj->GetInstanceScript();
if (!instance)
{
sLog->outErrorDb("SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
LOG_ERROR("sql.sql", "SmartScript: Event %u attempt to set instance data without instance script. EntryOrGuid %d", e.GetEventType(), e.entryOrGuid);
break;
}
@ -1290,7 +1284,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
instance->SetData64(e.action.setInstanceData64.field, targets->front()->GetGUID());
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: %lu",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_SET_INST_DATA64: Field: %u, data: %lu",
e.action.setInstanceData64.field, targets->front()->GetGUID());
#endif
delete targets;
@ -1315,7 +1309,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
Unit::Kill(me, me);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature %u", me->GetGUIDLow());
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_DIE: Creature %u", me->GetGUIDLow());
#endif
}
break;
@ -1374,7 +1368,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
me->SetSheath(SheathState(e.action.setSheath.sheath));
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_SET_SHEATH: Creature %u, State: %u",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_SET_SHEATH: Creature %u, State: %u",
me->GetGUIDLow(), e.action.setSheath.sheath);
#endif
}
@ -1774,14 +1768,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI()))
ai->GetScript()->StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset);
else
sLog->outError("SmartScript: Action target for SMART_ACTION_SET_COUNTER is not using SmartAI, skipping");
LOG_ERROR("server", "SmartScript: Action target for SMART_ACTION_SET_COUNTER is not using SmartAI, skipping");
}
else if (IsGameObject(*itr))
{
if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI()))
ai->GetScript()->StoreCounter(e.action.setCounter.counterId, e.action.setCounter.value, e.action.setCounter.reset);
else
sLog->outError("SmartScript: Action target for SMART_ACTION_SET_COUNTER is not using SmartGameObjectAI, skipping");
LOG_ERROR("server", "SmartScript: Action target for SMART_ACTION_SET_COUNTER is not using SmartGameObjectAI, skipping");
}
}
@ -2048,7 +2042,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(npc->GetEntry(), equipId);
if (!einfo)
{
sLog->outError("SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry());
LOG_ERROR("server", "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u", equipId, npc->GetEntry());
break;
}
npc->SetCurrentEquipmentId(equipId);
@ -2177,7 +2171,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (e.GetTargetType() == SMART_TARGET_NONE)
{
sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
LOG_ERROR("sql.sql", "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@ -2275,8 +2269,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
(*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED));
}
//else
// TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
else
LOG_DEBUG("sql.sql", "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura",
e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
}
}
@ -2310,7 +2305,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 id = temp[urand(0, count - 1)];
if (e.GetTargetType() == SMART_TARGET_NONE)
{
sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
LOG_ERROR("sql.sql", "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@ -2340,7 +2335,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 id = urand(e.action.randTimedActionList.entry1, e.action.randTimedActionList.entry2);
if (e.GetTargetType() == SMART_TARGET_NONE)
{
sLog->outErrorDb("SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
LOG_ERROR("sql.sql", "SmartScript: Entry %d SourceType %u Event %u Action %u is using TARGET_NONE(0) for Script9 target. Please correct target_type in database.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
break;
}
@ -2573,14 +2568,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI()))
ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list
else
sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping");
LOG_ERROR("sql.sql", "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping");
}
else if (IsGameObject(*itr))
{
if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI()))
ai->GetScript()->StoreTargetList(new ObjectList(*storedTargets), e.action.sendTargetToTarget.id); // store a copy of target list
else
sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping");
LOG_ERROR("sql.sql", "SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping");
}
}
@ -2593,7 +2588,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SEND_GOSSIP_MENU: gossipMenuId %d, gossipNpcTextId %d",
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction:: SMART_ACTION_SEND_GOSSIP_MENU: gossipMenuId %d, gossipNpcTextId %d",
e.action.sendGossipMenu.gossipMenuId, e.action.sendGossipMenu.gossipNpcTextId);
#endif
ObjectList* targets = GetTargets(e, unit);
@ -2791,7 +2786,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 eventId = e.action.gameEventStop.id;
if (!sGameEventMgr->IsActiveEvent(eventId))
{
sLog->outError("SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_STOP, inactive event (id: %u)", eventId);
LOG_ERROR("server", "SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_STOP, inactive event (id: %u)", eventId);
break;
}
sGameEventMgr->StopEvent(eventId, true);
@ -2802,7 +2797,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
uint32 eventId = e.action.gameEventStart.id;
if (sGameEventMgr->IsActiveEvent(eventId))
{
sLog->outError("SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_START, already activated event (id: %u)", eventId);
LOG_ERROR("server", "SmartScript::ProcessAction: At case SMART_ACTION_GAME_EVENT_START, already activated event (id: %u)", eventId);
break;
}
sGameEventMgr->StartEvent(eventId, true);
@ -3287,7 +3282,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
break;
}
default:
sLog->outErrorDb("SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry %d SourceType %u, Event %u, Unhandled Action type %u", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;
}
@ -3297,7 +3292,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (linked.GetActionType() && linked.GetEventType() == SMART_EVENT_LINK)
ProcessEvent(linked, unit, var0, var1, bvar, spell, gob);
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);
LOG_ERROR("sql.sql", "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);
}
}
@ -3322,7 +3317,7 @@ void SmartScript::InstallTemplate(SmartScriptHolder const& e)
return;
if (mTemplate)
{
sLog->outErrorDb("SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType());
LOG_ERROR("sql.sql", "SmartScript::InstallTemplate: Entry %d SourceType %u AI Template can not be set more then once, skipped.", e.entryOrGuid, e.GetScriptType());
return;
}
mTemplate = (SMARTAI_TEMPLATE)e.action.installTtemplate.id;
@ -3630,7 +3625,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
Creature* target = nullptr;
if (!scriptTrigger && !baseObject)
{
sLog->outError("SMART_TARGET_CREATURE_GUID can not be used without invoker");
LOG_ERROR("server", "SMART_TARGET_CREATURE_GUID can not be used without invoker");
break;
}
@ -3653,7 +3648,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
GameObject* target = nullptr;
if (!scriptTrigger && !GetBaseObject())
{
sLog->outError("SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker");
LOG_ERROR("server", "SMART_TARGET_GAMEOBJECT_GUID can not be used without invoker");
break;
}
@ -4296,7 +4291,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
case SMART_EVENT_GOSSIP_SELECT:
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript: Gossip Select: menu %u action %u", var0, var1); //little help for scripters
LOG_DEBUG("sql.sql", "SmartScript: Gossip Select: menu %u action %u", var0, var1); //little help for scripters
#endif
if (e.event.gossip.sender != var0 || e.event.gossip.action != var1)
return;
@ -4478,7 +4473,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
break;
}
default:
sLog->outErrorDb("SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType());
LOG_ERROR("sql.sql", "SmartScript::ProcessEvent: Unhandled Event type %u", e.GetEventType());
break;
}
}
@ -4679,10 +4674,10 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger c
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (obj)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript: EventMap for Entry %u is empty but is using SmartScript.", obj->GetEntry());
LOG_DEBUG("sql.sql", "SmartScript: EventMap for Entry %u is empty but is using SmartScript.", obj->GetEntry());
if (at)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript: EventMap for AreaTrigger %u is empty but is using SmartScript.", at->entry);
LOG_DEBUG("sql.sql", "SmartScript: EventMap for AreaTrigger %u is empty but is using SmartScript.", at->entry);
#endif
return;
}
@ -4742,18 +4737,18 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTrigger const* at)
mScriptType = SMART_SCRIPT_TYPE_CREATURE;
me = obj->ToCreature();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is Creature %u", me->GetEntry());
LOG_DEBUG("sql.sql", "SmartScript::OnInitialize: source is Creature %u", me->GetEntry());
#endif
break;
case TYPEID_GAMEOBJECT:
mScriptType = SMART_SCRIPT_TYPE_GAMEOBJECT;
go = obj->ToGameObject();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is GameObject %u", go->GetEntry());
LOG_DEBUG("sql.sql", "SmartScript::OnInitialize: source is GameObject %u", go->GetEntry());
#endif
break;
default:
sLog->outError("SmartScript::OnInitialize: Unhandled TypeID !WARNING!");
LOG_ERROR("server", "SmartScript::OnInitialize: Unhandled TypeID !WARNING!");
return;
}
}
@ -4762,12 +4757,12 @@ void SmartScript::OnInitialize(WorldObject* obj, AreaTrigger const* at)
mScriptType = SMART_SCRIPT_TYPE_AREATRIGGER;
trigger = at;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::OnInitialize: source is AreaTrigger %u", trigger->entry);
LOG_DEBUG("sql.sql", "SmartScript::OnInitialize: source is AreaTrigger %u", trigger->entry);
#endif
}
else
{
sLog->outError("SmartScript::OnInitialize: !WARNING! Initialized objects are nullptr.");
LOG_ERROR("server", "SmartScript::OnInitialize: !WARNING! Initialized objects are nullptr.");
return;
}
@ -4914,7 +4909,7 @@ void SmartScript::SetScript9(SmartScriptHolder& e, uint32 entry)
// any SmartScriptHolder contained like the "e" parameter passed to this function
if (isProcessingTimedActionList)
{
sLog->outError("Entry %d SourceType %u Event %u Action %u is trying to overwrite timed action list from a timed action, this is not allowed!.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
LOG_ERROR("server", "Entry %d SourceType %u Event %u Action %u is trying to overwrite timed action list from a timed action, this is not allowed!.", e.entryOrGuid, e.GetScriptType(), e.GetEventType(), e.GetActionType());
return;
}

View file

@ -105,7 +105,7 @@ public:
smart = false;
if (!smart)
sLog->outErrorDb("SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0));
LOG_ERROR("sql.sql", "SmartScript: Action target Creature(entry: %u) is not using SmartAI, action skipped to prevent crash.", c ? c->GetEntry() : (me ? me->GetEntry() : 0));
return smart;
}
@ -119,7 +119,7 @@ public:
if (!go || go->GetAIName() != "SmartGameObjectAI")
smart = false;
if (!smart)
sLog->outErrorDb("SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0));
LOG_ERROR("sql.sql", "SmartScript: Action target GameObject(entry: %u) is not using SmartGameObjectAI, action skipped to prevent crash.", g ? g->GetEntry() : (go ? go->GetEntry() : 0));
return smart;
}

View file

@ -44,8 +44,8 @@ void SmartWaypointMgr::LoadFromDB()
if (!result)
{
sLog->outString(">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
LOG_INFO("server", " ");
return;
}
@ -72,7 +72,7 @@ void SmartWaypointMgr::LoadFromDB()
}
if (last_id != id)
sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
LOG_ERROR("sql.sql", "SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
last_id++;
(*waypoint_map[entry])[id] = new WayPoint(id, x, y, z);
@ -81,8 +81,8 @@ void SmartWaypointMgr::LoadFromDB()
total++;
} while (result->NextRow());
sLog->outString(">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
SmartWaypointMgr::~SmartWaypointMgr()
@ -114,8 +114,8 @@ void SmartAIMgr::LoadSmartAIFromDB()
if (!result)
{
sLog->outString(">> Loaded 0 SmartAI scripts. DB table `smart_scripts` is empty.");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 SmartAI scripts. DB table `smart_scripts` is empty.");
LOG_INFO("server", " ");
return;
}
@ -131,7 +131,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
SmartScriptType source_type = (SmartScriptType)fields[1].GetUInt8();
if (source_type >= SMART_SCRIPT_TYPE_MAX)
{
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type));
LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: invalid source_type (%u), skipped loading.", uint32(source_type));
continue;
}
if (temp.entryOrGuid >= 0)
@ -142,7 +142,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid))
{
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
}
break;
@ -151,7 +151,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid))
{
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
}
break;
@ -160,7 +160,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetAreaTrigger((uint32)temp.entryOrGuid))
{
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: AreaTrigger entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid));
continue;
}
break;
@ -168,7 +168,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
case SMART_SCRIPT_TYPE_TIMED_ACTIONLIST:
break;//nothing to check, really
default:
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type);
LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: not yet implemented source_type %u", (uint32)source_type);
continue;
}
}
@ -176,7 +176,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
{
if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid))))
{
sLog->outErrorDb("SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));
LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid)));
continue;
}
}
@ -269,8 +269,8 @@ void SmartAIMgr::LoadSmartAIFromDB()
mEventMap[source_type][temp.entryOrGuid].push_back(temp);
} while (result->NextRow());
sLog->outString(">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
@ -284,7 +284,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.unitDistance.creature && !sObjectMgr->GetCreatureTemplate(e.target.unitDistance.creature))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.unitDistance.creature);
return false;
}
break;
@ -294,7 +294,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.goDistance.entry && !sObjectMgr->GetGameObjectTemplate(e.target.goDistance.entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.target.goDistance.entry);
return false;
}
break;
@ -316,7 +316,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
{
if (e.target.playerDistance.dist == 0)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has maxDist 0 as target_param1, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
break;
@ -346,7 +346,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_ROLE_SELECTION:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
return true;
@ -356,20 +356,20 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if ((e.event.type >= SMART_EVENT_TC_END && e.event.type <= SMART_EVENT_AC_START) || e.event.type >= SMART_EVENT_AC_END)
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetEventType());
return false;
}
// in SMART_SCRIPT_TYPE_TIMED_ACTIONLIST all event types are overriden by core
if (e.GetScriptType() != SMART_SCRIPT_TYPE_TIMED_ACTIONLIST && !(SmartAIEventMask[e.event.type][1] & SmartAITypeMask[e.GetScriptType()][1]))
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d, event type %u can not be used for Script type %u", e.entryOrGuid, e.GetEventType(), e.GetScriptType());
return false;
}
if (e.action.type <= 0
|| (e.action.type >= SMART_ACTION_TC_END && e.action.type <= SMART_ACTION_AC_START)
|| e.action.type >= SMART_ACTION_AC_END)
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has an invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has an invalid action type (%u), skipped.", e.entryOrGuid, e.event_id, e.GetActionType());
return false;
}
switch (e.action.type)
@ -378,7 +378,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_PLAY_ANIMKIT:
case SMART_ACTION_SCENE_PLAY:
case SMART_ACTION_SCENE_CANCEL:
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has an action type that is not supported on 3.3.5a (%u), skipped.",
LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has an action type that is not supported on 3.3.5a (%u), skipped.",
e.entryOrGuid, e.event_id, e.GetActionType());
return false;
case SMART_ACTION_SET_CORPSE_DELAY:
@ -390,7 +390,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SPAWN_SPAWNGROUP:
case SMART_ACTION_DESPAWN_SPAWNGROUP:
case SMART_ACTION_RESPAWN_BY_SPAWNID:
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has an action type that is not yet supported on AzerothCore (%u), skipped.",
LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has an action type that is not yet supported on AzerothCore (%u), skipped.",
e.entryOrGuid, e.event_id, e.GetActionType());
return false;
default:
@ -398,24 +398,24 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
if (e.target.type < 0 || (e.target.type >= SMART_TARGET_TC_END && e.target.type < SMART_TARGET_AC_START) || e.target.type >= SMART_TARGET_AC_END)
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has an invalid target type (%u), skipped.",
LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has an invalid target type (%u), skipped.",
e.entryOrGuid, e.event_id, e.GetTargetType());
return false;
}
if (e.target.type == SMART_TARGET_LOOT_RECIPIENTS)
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has a target type that is not yet supported on AzerothCore (%u), skipped.",
LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has a target type that is not yet supported on AzerothCore (%u), skipped.",
e.entryOrGuid, e.event_id, e.GetTargetType());
return false;
}
if (e.event.event_phase_mask > SMART_EVENT_PHASE_ALL)
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid phase mask (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_phase_mask);
return false;
}
if (e.event.event_flags > SMART_EVENT_FLAGS_ALL)
{
sLog->outErrorDb("SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
LOG_ERROR("sql.sql", "SmartAIMgr: EntryOrGuid %d using event(%u) has invalid event flags (%u), skipped.", e.entryOrGuid, e.event_id, e.event.event_flags);
return false;
}
if (e.GetScriptType() == SMART_SCRIPT_TYPE_TIMED_ACTIONLIST)
@ -456,12 +456,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
if (!spellInfo)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
if (e.event.spellHit.school && (e.event.spellHit.school & spellInfo->SchoolMask) != spellInfo->SchoolMask)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses Spell entry %u with invalid school mask, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
}
@ -479,12 +479,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_RESPAWN:
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_MAP && !sMapStore.LookupEntry(e.event.respawn.map))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.map);
return false;
}
if (e.event.respawn.type == SMART_SCRIPT_RESPAWN_CONDITION_AREA && !sAreaTableStore.LookupEntry(e.event.respawn.area))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Area entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.respawn.area);
return false;
}
break;
@ -521,7 +521,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_VICTIM_CASTING:
if (e.event.targetCasting.spellId > 0 && !sSpellMgr->GetSpellInfo(e.event.targetCasting.spellId))
{
sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
LOG_ERROR("server", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
return false;
}
@ -575,7 +575,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.movementInform.type > NULL_MOTION_TYPE)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Motion type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.movementInform.type);
return false;
}
break;
@ -599,7 +599,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.link && e.link == e.event_id)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u, Event %u, Link Event is linking self (infinite loop), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id);
return false;
}
break;
@ -620,7 +620,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.event.doAction.eventId > EVENT_CHARGE)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid event id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.doAction.eventId);
return false;
}
break;
@ -631,7 +631,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.event.friendlyHealthPct.maxHpPct > 100 || e.event.friendlyHealthPct.minHpPct > 100)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has pct value above 100, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
@ -646,57 +646,57 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_TARGET_PLAYER_DISTANCE:
break;
default:
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid target_type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid target_type %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.GetTargetType());
return false;
}
break;
case SMART_EVENT_DISTANCE_CREATURE:
if (e.event.distance.guid == 0 && e.event.distance.entry == 0)
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE did not provide creature guid or entry, skipped.");
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE did not provide creature guid or entry, skipped.");
return false;
}
if (e.event.distance.guid != 0 && e.event.distance.entry != 0)
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE provided both an entry and guid, skipped.");
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE provided both an entry and guid, skipped.");
return false;
}
if (e.event.distance.guid != 0 && !sObjectMgr->GetCreatureData(e.event.distance.guid))
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE using invalid creature guid %u, skipped.", e.event.distance.guid);
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE using invalid creature guid %u, skipped.", e.event.distance.guid);
return false;
}
if (e.event.distance.entry != 0 && !sObjectMgr->GetCreatureTemplate(e.event.distance.entry))
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE using invalid creature entry %u, skipped.", e.event.distance.entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_CREATURE using invalid creature entry %u, skipped.", e.event.distance.entry);
return false;
}
break;
case SMART_EVENT_DISTANCE_GAMEOBJECT:
if (e.event.distance.guid == 0 && e.event.distance.entry == 0)
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT did not provide gameobject guid or entry, skipped.");
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT did not provide gameobject guid or entry, skipped.");
return false;
}
if (e.event.distance.guid != 0 && e.event.distance.entry != 0)
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT provided both an entry and guid, skipped.");
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT provided both an entry and guid, skipped.");
return false;
}
if (e.event.distance.guid != 0 && !sObjectMgr->GetGOData(e.event.distance.guid))
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT using invalid gameobject guid %u, skipped.", e.event.distance.guid);
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT using invalid gameobject guid %u, skipped.", e.event.distance.guid);
return false;
}
if (e.event.distance.entry != 0 && !sObjectMgr->GetGameObjectTemplate(e.event.distance.entry))
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT using invalid gameobject entry %u, skipped.", e.event.distance.entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_DISTANCE_GAMEOBJECT using invalid gameobject entry %u, skipped.", e.event.distance.entry);
return false;
}
break;
@ -706,13 +706,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.event.counter.id == 0)
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_COUNTER_SET using invalid counter id %u, skipped.", e.event.counter.id);
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_COUNTER_SET using invalid counter id %u, skipped.", e.event.counter.id);
return false;
}
if (e.event.counter.value == 0)
{
sLog->outErrorDb("SmartAIMgr: Event SMART_EVENT_COUNTER_SET using invalid value %u, skipped.", e.event.counter.value);
LOG_ERROR("sql.sql", "SmartAIMgr: Event SMART_EVENT_COUNTER_SET using invalid value %u, skipped.", e.event.counter.value);
return false;
}
break;
@ -753,7 +753,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_ON_SPELLCLICK:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
}
@ -763,7 +763,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_FACTION:
if (e.action.faction.factionID && !sFactionTemplateStore.LookupEntry(e.action.faction.factionID))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Faction %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.faction.factionID);
return false;
}
break;
@ -773,7 +773,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.morphOrMount.creature > 0 && !sObjectMgr->GetCreatureTemplate(e.action.morphOrMount.creature))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.creature);
return false;
}
@ -781,12 +781,12 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.morphOrMount.creature)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has ModelID set with also set CreatureId, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
else if (!sCreatureDisplayInfoStore.LookupEntry(e.action.morphOrMount.model))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Model id %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.morphOrMount.model);
return false;
}
}
@ -840,7 +840,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!sTaxiPathStore.LookupEntry(e.action.taxi.id))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Taxi path ID %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.taxi.id);
return false;
}
break;
@ -884,32 +884,32 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!qid->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u SpecialFlags for Quest entry %u does not include FLAGS_EXPLORATION_OR_EVENT(2), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
return false;
}
}
else
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.quest.quest);
return false;
}
break;
case SMART_ACTION_SET_EVENT_PHASE:
if (e.action.setEventPhase.phase >= SMART_EVENT_PHASE_MAX)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX - 1);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set phase %u. Phase mask cannot be used past phase %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setEventPhase.phase, SMART_EVENT_PHASE_MAX - 1);
return false;
}
break;
case SMART_ACTION_INC_EVENT_PHASE:
if (!e.action.incEventPhase.inc && !e.action.incEventPhase.dec)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u is incrementing phase by 0, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
else if (e.action.incEventPhase.inc > SMART_EVENT_PHASE_MAX || e.action.incEventPhase.dec > SMART_EVENT_PHASE_MAX)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to increment phase by too large value, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
break;
@ -926,7 +926,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
e.action.randomPhase.phase5 >= SMART_EVENT_PHASE_MAX ||
e.action.randomPhase.phase6 >= SMART_EVENT_PHASE_MAX)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
if (e.action.randomPhase.phase1 == 0 &&
@ -936,7 +936,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
e.action.randomPhase.phase5 == 0 &&
e.action.randomPhase.phase6 == 0)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
}
@ -946,7 +946,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
if (e.action.randomPhaseRange.phaseMin >= SMART_EVENT_PHASE_MAX ||
e.action.randomPhaseRange.phaseMax >= SMART_EVENT_PHASE_MAX)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
if (!IsMinMaxValid(e, e.action.randomPhaseRange.phaseMin, e.action.randomPhaseRange.phaseMax))
@ -958,7 +958,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
return false;
if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type);
return false;
}
break;
@ -973,7 +973,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SET_SHEATH:
if (e.action.setSheath.sheath && e.action.setSheath.sheath >= MAX_SHEATH_STATE)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect Sheath state %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.setSheath.sheath);
return false;
}
break;
@ -981,7 +981,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.action.react.state > REACT_AGGRESSIVE)
{
sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.react.state);
return false;
}
break;
@ -1001,14 +1001,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_TELEPORT:
if (!sMapStore.LookupEntry(e.action.teleport.mapID))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Map entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.teleport.mapID);
return false;
}
break;
case SMART_ACTION_INSTALL_AI_TEMPLATE:
if (e.action.installTtemplate.id >= SMARTAI_TEMPLATE_END)
{
sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses non-existent AI template id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.installTtemplate.id);
return false;
}
break;
@ -1020,14 +1020,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!sSmartWaypointMgr->GetPath(e.action.wpStart.pathID))
{
sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses non-existent WaypointPath id %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.pathID);
return false;
}
if (e.action.wpStart.quest && !IsQuestValid(e, e.action.wpStart.quest))
return false;
if (e.action.wpStart.reactState > REACT_AGGRESSIVE)
{
sLog->outErrorDb("SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
LOG_ERROR("sql.sql", "SmartAIMgr: Creature %d Event %u Action %u uses invalid React State %u, skipped.", e.entryOrGuid, e.event_id, e.GetActionType(), e.action.wpStart.reactState);
return false;
}
break;
@ -1052,7 +1052,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_REMOVE_POWER:
if (e.action.power.powerType > MAX_POWERS)
{
sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
LOG_ERROR("server", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
return false;
}
break;
@ -1063,14 +1063,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
if (eventId < 1 || eventId >= events.size())
{
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
LOG_ERROR("server", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
return false;
}
GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
LOG_ERROR("server", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStop.id);
return false;
}
break;
@ -1082,14 +1082,14 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
if (eventId < 1 || eventId >= events.size())
{
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
LOG_ERROR("server", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
return false;
}
GameEventData const& eventData = events[eventId];
if (!eventData.isValid())
{
sLog->outError("SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
LOG_ERROR("server", "SmartAIMgr: Entry %u SourceType %u Event %u Action %u uses non-existent event, eventId %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.gameEventStart.id);
return false;
}
break;
@ -1105,7 +1105,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(e.entryOrGuid, equipId);
if (!einfo)
{
sLog->outError("SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u, skipped.", equipId, e.entryOrGuid);
LOG_ERROR("server", "SmartScript: SMART_ACTION_EQUIP uses non-existent equipment info id %u for creature %u, skipped.", equipId, e.entryOrGuid);
return false;
}
}
@ -1116,7 +1116,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (!acore::IsValidMapCoord(e.target.x, e.target.y))
{
sLog->outError("SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
LOG_ERROR("server", "SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
return false;
}
break;
@ -1125,7 +1125,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
{
if (e.GetScriptType() == SMART_SCRIPT_TYPE_GAMEOBJECT)
{
sLog->outErrorDb("SmartScript: action_type %u is not allowed with source_type %u. Entry %u, skipped.", e.GetActionType(), e.GetScriptType(), e.entryOrGuid);
LOG_ERROR("sql.sql", "SmartScript: action_type %u is not allowed with source_type %u. Entry %u, skipped.", e.GetActionType(), e.GetScriptType(), e.entryOrGuid);
return false;
}
break;
@ -1227,7 +1227,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_CU_ENCOUNTER_START:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
return false;
}
@ -1245,7 +1245,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
CreatureData const* data = sObjectMgr->GetCreatureData(entry);
if (!data)
{
sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("server", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Creature guid %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
else
@ -1255,7 +1255,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
error = true;
if (error)
{
sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id);
LOG_ERROR("server", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id);
return false;
}
return true;

View file

@ -1807,7 +1807,7 @@ public:
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (entry > 0) //first search is for guid (negative), do not drop error if not found
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
LOG_DEBUG("sql.sql", "SmartAIMgr::GetScript: Could not load Script for Entry %d ScriptType %u.", entry, uint32(type));
#endif
return temp;
}
@ -1824,7 +1824,7 @@ private:
{
if (target < SMART_TARGET_NONE || target >= SMART_TARGET_END)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses invalid Target type %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), target);
return false;
}
return true;
@ -1834,7 +1834,7 @@ private:
{
if (max < min)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses min/max params wrong (%u/%u), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), min, max);
return false;
}
return true;
@ -1844,7 +1844,7 @@ private:
{
if (pct < -100 || pct > 100)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u has invalid Percent set (%d), skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), pct);
return false;
}
return true;
@ -1854,7 +1854,7 @@ private:
{
if (!data)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be nullptr, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u Parameter can not be nullptr, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
return true;
@ -1864,7 +1864,7 @@ private:
{
if (!sObjectMgr->GetCreatureTemplate(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Creature entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@ -1874,7 +1874,7 @@ private:
{
if (!sObjectMgr->GetQuestTemplate(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Quest entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@ -1884,7 +1884,7 @@ private:
{
if (!sObjectMgr->GetGameObjectTemplate(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent GameObject entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@ -1894,7 +1894,7 @@ private:
{
if (!sSpellMgr->GetSpellInfo(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@ -1904,7 +1904,7 @@ private:
{
if (!sObjectMgr->GetItemTemplate(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Item entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@ -1914,7 +1914,7 @@ private:
{
if (!sEmotesTextStore.LookupEntry(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Text Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@ -1924,7 +1924,7 @@ private:
{
if (!sEmotesStore.LookupEntry(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Emote entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@ -1934,7 +1934,7 @@ private:
{
if (!sObjectMgr->GetAreaTrigger(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent AreaTrigger entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;
@ -1944,7 +1944,7 @@ private:
{
if (!sSoundEntriesStore.LookupEntry(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Sound entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
}
return true;

View file

@ -58,7 +58,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
{
if (dataType >= MAX_ACHIEVEMENT_CRITERIA_DATA_TYPE)
{
sLog->outErrorDb("Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType);
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` for criteria (Entry: %u) has wrong data type (%u), ignored.", criteria->ID, dataType);
return false;
}
@ -93,7 +93,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
default:
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
{
sLog->outErrorDb("Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType);
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` has data for non-supported criteria type (Entry: %u Type: %u), ignored.", criteria->ID, criteria->requiredType);
return false;
}
break;
@ -108,7 +108,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE:
if (!creature.id || !sObjectMgr->GetCreatureTemplate(creature.id))
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_CREATURE (%u) has non-existing creature id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, creature.id);
return false;
}
@ -116,13 +116,13 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE:
if (classRace.class_id && ((1 << (classRace.class_id - 1)) & CLASSMASK_ALL_PLAYABLE) == 0)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.class_id);
return false;
}
if (classRace.race_id && ((1 << (classRace.race_id - 1)) & RACEMASK_ALL_PLAYABLE) == 0)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.race_id);
return false;
}
@ -130,7 +130,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_LESS_HEALTH:
if (health.percent < 1 || health.percent > 100)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_PLAYER_LESS_HEALTH (%u) has wrong percent value in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, health.percent);
return false;
}
@ -138,7 +138,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD:
if (player_dead.own_team_flag > 1)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_DEAD (%u) has wrong boolean value1 (%u).",
criteria->ID, criteria->requiredType, dataType, player_dead.own_team_flag);
return false;
}
@ -149,19 +149,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(aura.spell_id);
if (!spellEntry)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA ? "ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA" : "ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id);
return false;
}
if (aura.effect_idx >= 3)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell effect index in value2 (%u), ignored.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA ? "ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA" : "ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.effect_idx);
return false;
}
if (!spellEntry->Effects[aura.effect_idx].ApplyAuraName)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA ? "ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA" : "ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id, aura.effect_idx);
return false;
}
@ -170,7 +170,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA:
if (!sAreaTableStore.LookupEntry(area.id))
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AREA (%u) has wrong area id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, area.id);
return false;
}
@ -178,7 +178,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE:
if (value.compType >= COMP_TYPE_MAX)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE (%u) has wrong ComparisionType in value2 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_VALUE (%u) has wrong ComparisionType in value2 (%u), ignored.",
value.compType, criteria->requiredType, dataType, value.value);
return false;
}
@ -186,7 +186,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL:
if (level.minlevel > STRONG_MAX_LEVEL)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_LEVEL (%u) has wrong minlevel in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, level.minlevel);
return false;
}
@ -194,7 +194,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER:
if (gender.gender > GENDER_NONE)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_GENDER (%u) has wrong gender in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, gender.gender);
return false;
}
@ -202,7 +202,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT:
if (!ScriptId)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT (%u) does not have ScriptName set, ignored.",
criteria->ID, criteria->requiredType, dataType);
return false;
}
@ -210,7 +210,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY:
if (difficulty.difficulty >= MAX_DIFFICULTY)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_DIFFICULTY (%u) has wrong difficulty in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, difficulty.difficulty);
return false;
}
@ -218,7 +218,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
if (map_players.maxcount <= 0)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT (%u) has wrong max players count in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, map_players.maxcount);
return false;
}
@ -226,7 +226,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM:
if (team.team != ALLIANCE && team.team != HORDE)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM (%u) has unknown team in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, team.team);
return false;
}
@ -234,7 +234,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK:
if (drunk.state >= MAX_DRUNKEN)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK (%u) has unknown drunken state in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, drunk.state);
return false;
}
@ -242,7 +242,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY:
if (!sHolidaysStore.LookupEntry(holiday.id))
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY (%u) has unknown holiday in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, holiday.id);
return false;
}
@ -252,7 +252,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM:
if (equipped_item.item_quality >= MAX_ITEM_QUALITY)
{
sLog->outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_REQUIRE_S_EQUIPED_ITEM (%u) has unknown quality state in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, equipped_item.item_quality);
return false;
}
@ -260,7 +260,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID:
if (!sMapStore.LookupEntry(map_id.mapId))
{
sLog->outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_ID (%u) has unknown map id in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, map_id.mapId);
return false;
}
@ -268,19 +268,19 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE:
if (!classRace.class_id && !classRace.race_id)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) must not have 0 in either value field, ignored.",
criteria->ID, criteria->requiredType, dataType);
return false;
}
if (classRace.class_id && ((1 << (classRace.class_id - 1)) & CLASSMASK_ALL_PLAYABLE) == 0)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing class in value1 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.class_id);
return false;
}
if (classRace.race_id && ((1 << (classRace.race_id - 1)) & RACEMASK_ALL_PLAYABLE) == 0)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) for data type ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE (%u) has non-existing race in value2 (%u), ignored.",
criteria->ID, criteria->requiredType, dataType, classRace.race_id);
return false;
}
@ -289,14 +289,14 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
{
if (!sCharTitlesStore.LookupEntry(known_title.title_id))
{
sLog->outErrorDb("Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_S_KNOWN_TITLE (%u) have unknown title_id in value1 (%u), ignore.",
LOG_ERROR("sql.sql", "Table `achievement_criteria_requirement` (Entry: %u Type: %u) for requirement ACHIEVEMENT_CRITERIA_DATA_TYPE_S_KNOWN_TITLE (%u) have unknown title_id in value1 (%u), ignore.",
criteria->ID, criteria->requiredType, dataType, known_title.title_id);
return false;
}
return true;
}
default:
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType);
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: %u Type: %u) has data for non-supported data type (%u), ignored.", criteria->ID, criteria->requiredType, dataType);
return false;
}
}
@ -402,14 +402,14 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
Map* map = source->GetMap();
if (!map->IsDungeon())
{
sLog->outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_TYPE_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u",
LOG_ERROR("sql.sql", "Achievement system call ACHIEVEMENT_CRITERIA_DATA_TYPE_INSTANCE_SCRIPT (%u) for achievement criteria %u for non-dungeon/non-raid map %u",
ACHIEVEMENT_CRITERIA_DATA_TYPE_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
InstanceScript* instance = map->ToInstanceMap()->GetInstanceScript();
if (!instance)
{
sLog->outErrorDb("Achievement system call ACHIEVEMENT_CRITERIA_DATA_TYPE_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script",
LOG_ERROR("sql.sql", "Achievement system call ACHIEVEMENT_CRITERIA_DATA_TYPE_INSTANCE_SCRIPT (%u) for achievement criteria %u for map %u but map does not have a instance script",
ACHIEVEMENT_CRITERIA_DATA_TYPE_INSTANCE_SCRIPT, criteria_id, map->GetId());
return false;
}
@ -498,7 +498,7 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaCondition condi
if (m_player->IsGameMaster())
return;
sLog->outDebug(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", condition, value, evenIfCriteriaComplete);
LOG_DEBUG("achievement", "AchievementMgr::ResetAchievementCriteria(%u, %u, %u)", condition, value, evenIfCriteriaComplete);
AchievementCriteriaEntryList const* achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByCondition(condition, value);
if (!achievementCriteriaList)
@ -630,7 +630,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
if (!criteria)
{
// we will remove not existed criteria for all characters
sLog->outError("Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id);
LOG_ERROR("server", "Non-existing achievement criteria %u data removed from table `character_achievement_progress`.", id);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEV_PROGRESS_CRITERIA);
@ -662,7 +662,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) && defined(ACORE_DEBUG)
sLog->outDebug(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::SendAchievementEarned(%u)", achievement->ID);
LOG_DEBUG("achievement", "AchievementMgr::SendAchievementEarned(%u)", achievement->ID);
#endif
if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildId()))
@ -764,11 +764,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (type >= ACHIEVEMENT_CRITERIA_TYPE_TOTAL)
{
sLog->outDebug(LOG_FILTER_ACHIEVEMENTSYS, "UpdateAchievementCriteria: Wrong criteria type %u", type);
LOG_DEBUG("achievement", "UpdateAchievementCriteria: Wrong criteria type %u", type);
return;
}
sLog->outDebug(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::UpdateAchievementCriteria(%u, %u, %u)", type, miscValue1, miscValue2);
LOG_DEBUG("achievement", "AchievementMgr::UpdateAchievementCriteria(%u, %u, %u)", type, miscValue1, miscValue2);
#endif
AchievementCriteriaEntryList const* achievementCriteriaList = nullptr;
@ -2011,7 +2011,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_ACHIEVEMENTSYS, "AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow());
LOG_DEBUG("achievement", "AchievementMgr::SetCriteriaProgress(%u, %u) for (GUID:%u)", entry->ID, changeValue, m_player->GetGUIDLow());
#endif
CriteriaProgress* progress = GetCriteriaProgress(entry);
@ -2160,7 +2160,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
// disable for gamemasters with GM-mode enabled
if (m_player->IsGameMaster())
{
sLog->outString("Not available in GM mode.");
LOG_INFO("server", "Not available in GM mode.");
ChatHandler(m_player->GetSession()).PSendSysMessage("Not available in GM mode");
return;
}
@ -2169,7 +2169,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("AchievementMgr::CompletedAchievement(%u)", achievement->ID);
LOG_DEBUG("server", "AchievementMgr::CompletedAchievement(%u)", achievement->ID);
#endif
SendAchievementEarned(achievement);
@ -2434,8 +2434,8 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
if (sAchievementCriteriaStore.GetNumRows() == 0)
{
sLog->outErrorDb(">> Loaded 0 achievement criteria.");
sLog->outString();
LOG_ERROR("sql.sql", ">> Loaded 0 achievement criteria.");
LOG_INFO("server", " ");
return;
}
@ -2573,8 +2573,8 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
++loaded;
}
sLog->outString(">> Loaded %u achievement criteria in %u ms", loaded, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u achievement criteria in %u ms", loaded, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void AchievementGlobalMgr::LoadAchievementReferenceList()
@ -2583,8 +2583,8 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
if (sAchievementStore.GetNumRows() == 0)
{
sLog->outString(">> Loaded 0 achievement references.");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 achievement references.");
LOG_INFO("server", " ");
return;
}
@ -2600,8 +2600,8 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
++count;
}
sLog->outString(">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void AchievementGlobalMgr::LoadAchievementCriteriaData()
@ -2614,8 +2614,8 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (!result)
{
sLog->outString(">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
LOG_INFO("server", " ");
return;
}
@ -2630,7 +2630,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (!criteria)
{
sLog->outErrorDb("Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id);
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` has data for non-existing criteria (Entry: %u), ignore.", criteria_id);
continue;
}
@ -2640,7 +2640,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (scriptName.length()) // not empty
{
if (dataType != ACHIEVEMENT_CRITERIA_DATA_TYPE_SCRIPT)
sLog->outError("Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType);
LOG_ERROR("server", "Table `achievement_criteria_data` has ScriptName set for non-scripted data type (Entry: %u, type %u), useless data.", criteria_id, dataType);
else
scriptId = sObjectMgr->GetScriptId(scriptName.c_str());
}
@ -2732,11 +2732,11 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
}
if (!GetCriteriaDataSet(criteria) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, nullptr))
sLog->outErrorDb("Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
}
sLog->outString(">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void AchievementGlobalMgr::LoadCompletedAchievements()
@ -2755,8 +2755,8 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
if (!result)
{
sLog->outString(">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
LOG_INFO("server", " ");
return;
}
@ -2769,7 +2769,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
if (!achievement)
{
// Remove non existent achievements from all characters
sLog->outError("Non-existing achievement %u data removed from table `character_achievement`.", achievementId);
LOG_ERROR("server", "Non-existing achievement %u data removed from table `character_achievement`.", achievementId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_ACHIEVMENT);
@ -2783,8 +2783,8 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
m_allCompletedAchievements[achievementId] = std::chrono::system_clock::time_point::max();
} while (result->NextRow());
sLog->outString(">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void AchievementGlobalMgr::LoadRewards()
@ -2798,8 +2798,8 @@ void AchievementGlobalMgr::LoadRewards()
if (!result)
{
sLog->outErrorDb(">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
sLog->outString();
LOG_ERROR("sql.sql", ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
LOG_INFO("server", " ");
return;
}
@ -2812,7 +2812,7 @@ void AchievementGlobalMgr::LoadRewards()
AchievementEntry const* achievement = sAchievementStore.LookupEntry(entry);
if (!achievement)
{
sLog->outErrorDb("Table `achievement_reward` has wrong achievement (Entry: %u). Ignoring.", entry);
LOG_ERROR("sql.sql", "Table `achievement_reward` has wrong achievement (Entry: %u). Ignoring.", entry);
continue;
}
@ -2828,19 +2828,19 @@ void AchievementGlobalMgr::LoadRewards()
// Must reward a title or send a mail else, skip it.
if (!reward.titleId[0] && !reward.titleId[1] && !reward.sender)
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) does not have any title or item reward data. Ignoring.", entry);
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) does not have any title or item reward data. Ignoring.", entry);
continue;
}
if (achievement->requiredFaction == ACHIEVEMENT_FACTION_ANY && (!reward.titleId[0] ^ !reward.titleId[1]))
sLog->outDebug(LOG_FILTER_NONE, "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) set for only one team.", entry, reward.titleId[0], reward.titleId[1]);
LOG_DEBUG("achievement", "Table `achievement_reward` (Entry: %u) has title (A: %u H: %u) set for only one team.", entry, reward.titleId[0], reward.titleId[1]);
if (reward.titleId[0])
{
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[0]);
if (!titleEntry)
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`. Setting it to 0.", entry, reward.titleId[0]);
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_A`. Setting it to 0.", entry, reward.titleId[0]);
reward.titleId[0] = 0;
}
}
@ -2850,7 +2850,7 @@ void AchievementGlobalMgr::LoadRewards()
CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(reward.titleId[1]);
if (!titleEntry)
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`. Setting it to 0.", entry, reward.titleId[1]);
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid title id (%u) in `title_H`. Setting it to 0.", entry, reward.titleId[1]);
reward.titleId[1] = 0;
}
}
@ -2860,34 +2860,34 @@ void AchievementGlobalMgr::LoadRewards()
{
if (!sObjectMgr->GetCreatureTemplate(reward.sender))
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid creature_template entry %u as Sender. Will not send the mail reward.", entry, reward.sender);
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid creature_template entry %u as Sender. Will not send the mail reward.", entry, reward.sender);
reward.sender = 0;
}
}
else
{
if (reward.itemId)
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has itemId reward set but does not have Sender data set. Item will not be sent.", entry);
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has itemId reward set but does not have Sender data set. Item will not be sent.", entry);
if (!reward.subject.empty())
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has mail Subject but does not have Sender data set.", entry); // Maybe add "Mail will not be sent." ?
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has mail Subject but does not have Sender data set.", entry); // Maybe add "Mail will not be sent." ?
if (!reward.text.empty())
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has mail text (Body) set but does not have Sender data set.", entry); // Maybe add "Mail will not be sent." ?
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has mail text (Body) set but does not have Sender data set.", entry); // Maybe add "Mail will not be sent." ?
if (reward.mailTemplate)
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has mailTemplate set does not have Sender data set.", entry); // Maybe add "Mail will not be sent." ?
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has mailTemplate set does not have Sender data set.", entry); // Maybe add "Mail will not be sent." ?
}
if (reward.mailTemplate)
{
if (!sMailTemplateStore.LookupEntry(reward.mailTemplate))
{
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid mailTemplate (%u) (check the DBC).", entry, reward.mailTemplate);
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid mailTemplate (%u) (check the DBC).", entry, reward.mailTemplate);
reward.mailTemplate = 0;
}
else if (!reward.subject.empty() || !reward.text.empty())
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has mailTemplate (%u) and mail Subject/Body. To use the column mailTemplate, Subject and Body must be empty.", entry, reward.mailTemplate);
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has mailTemplate (%u) and mail Subject/Body. To use the column mailTemplate, Subject and Body must be empty.", entry, reward.mailTemplate);
}
if (reward.itemId)
@ -2895,7 +2895,7 @@ void AchievementGlobalMgr::LoadRewards()
if (!sObjectMgr->GetItemTemplate(reward.itemId))
{
// Not sure it's an error, it's probably an outDebug instead, because we can simply send a mail with no reward, right?
sLog->outErrorDb("Table `achievement_reward` (Entry: %u) has invalid item_template id %u. Reward mail will not contain any item.", entry, reward.itemId);
LOG_ERROR("sql.sql", "Table `achievement_reward` (Entry: %u) has invalid item_template id %u. Reward mail will not contain any item.", entry, reward.itemId);
reward.itemId = 0;
}
}
@ -2904,8 +2904,8 @@ void AchievementGlobalMgr::LoadRewards()
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void AchievementGlobalMgr::LoadRewardLocales()
@ -2919,8 +2919,8 @@ void AchievementGlobalMgr::LoadRewardLocales()
if (!result)
{
sLog->outString(">> Loaded 0 achievement reward locale strings. DB table `achievement_reward_locale` is empty");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 achievement reward locale strings. DB table `achievement_reward_locale` is empty");
LOG_INFO("server", " ");
return;
}
@ -2935,7 +2935,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
if (m_achievementRewards.find(ID) == m_achievementRewards.end())
{
sLog->outErrorDb("Table `achievement_reward_locale` (Entry: %u) has locale strings for non-existing achievement reward.", ID);
LOG_ERROR("sql.sql", "Table `achievement_reward_locale` (Entry: %u) has locale strings for non-existing achievement reward.", ID);
continue;
}
@ -2948,6 +2948,6 @@ void AchievementGlobalMgr::LoadRewardLocales()
ObjectMgr::AddLocaleString(Text, locale, data.Text);
} while (result->NextRow());
sLog->outString(">> Loaded %lu Achievement Reward Locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %lu Achievement Reward Locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}

View file

@ -33,8 +33,8 @@ namespace AddonMgr
QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons");
if (!result)
{
sLog->outString(">> Loaded 0 known addons. DB table `addons` is empty!");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 known addons. DB table `addons` is empty!");
LOG_INFO("server", " ");
return;
}
@ -52,8 +52,8 @@ namespace AddonMgr
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
oldMSTime = getMSTime();
result = CharacterDatabase.Query("SELECT id, name, version, UNIX_TIMESTAMP(timestamp) FROM banned_addons");
@ -81,8 +81,8 @@ namespace AddonMgr
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u banned addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u banned addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
}

View file

@ -72,10 +72,10 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
uint32 deposit = uint32(((multiplier * MSV * count / 3) * timeHr * 3) * sWorld->getRate(RATE_AUCTION_DEPOSIT));
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "MSV: %u", MSV);
sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "Items: %u", count);
sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "Multiplier: %f", multiplier);
sLog->outDebug(LOG_FILTER_AUCTIONHOUSE, "Deposit: %u", deposit);
LOG_DEBUG("auctionHouse", "MSV: %u", MSV);
LOG_DEBUG("auctionHouse", "Items: %u", count);
LOG_DEBUG("auctionHouse", "Multiplier: %f", multiplier);
LOG_DEBUG("auctionHouse", "Deposit: %u", deposit);
#endif
if (deposit < AH_MINIMUM_DEPOSIT * sWorld->getRate(RATE_AUCTION_DEPOSIT))
@ -283,8 +283,8 @@ void AuctionHouseMgr::LoadAuctionItems()
if (!result)
{
sLog->outString(">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
LOG_INFO("server", " ");
return;
}
@ -300,7 +300,7 @@ void AuctionHouseMgr::LoadAuctionItems()
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template);
if (!proto)
{
sLog->outError("AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template);
LOG_ERROR("server", "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template);
continue;
}
@ -315,8 +315,8 @@ void AuctionHouseMgr::LoadAuctionItems()
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void AuctionHouseMgr::LoadAuctions()
@ -328,8 +328,8 @@ void AuctionHouseMgr::LoadAuctions()
if (!result)
{
sLog->outString(">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
LOG_INFO("server", " ");
return;
}
@ -354,8 +354,8 @@ void AuctionHouseMgr::LoadAuctions()
CharacterDatabase.CommitTransaction(trans);
sLog->outString(">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void AuctionHouseMgr::AddAItem(Item* it)
@ -696,7 +696,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
Item* item = sAuctionMgr->GetAItem(item_guidlow);
if (!item)
{
sLog->outError("AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow);
LOG_ERROR("server", "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow);
return false;
}
data << uint32(Id);
@ -779,14 +779,14 @@ bool AuctionEntry::LoadFromDB(Field* fields)
CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer);
if (!auctioneerData)
{
sLog->outError("Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
LOG_ERROR("server", "Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
return false;
}
CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
if (!auctioneerInfo)
{
sLog->outError("Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
LOG_ERROR("server", "Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
return false;
}
@ -794,7 +794,7 @@ bool AuctionEntry::LoadFromDB(Field* fields)
auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(factionTemplateId);
if (!auctionHouseEntry)
{
sLog->outError("Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
LOG_ERROR("server", "Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
return false;
}
@ -802,7 +802,7 @@ bool AuctionEntry::LoadFromDB(Field* fields)
// and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems)
if (!sAuctionMgr->GetAItem(item_guidlow))
{
sLog->outError("Auction %u has not a existing item : %u", Id, item_guidlow);
LOG_ERROR("server", "Auction %u has not a existing item : %u", Id, item_guidlow);
return false;
}
return true;
@ -830,14 +830,14 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer);
if (!auctioneerData)
{
sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
LOG_ERROR("server", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer);
return false;
}
CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
if (!auctioneerInfo)
{
sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
LOG_ERROR("server", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id);
return false;
}
@ -846,7 +846,7 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
if (!auctionHouseEntry)
{
sLog->outError("AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
LOG_ERROR("server", "AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId);
return false;
}

View file

@ -292,7 +292,7 @@ void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o)
if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL))
StalkerGuid = creature->GetGUID();
else
sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry);
LOG_ERROR("server", "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry);
}
void Battlefield::KickAfkPlayers()
@ -543,7 +543,7 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player)
if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
{
sLog->outMisc("Battlefield::AddOrSetPlayerToCorrectBfGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
LOG_INFO("misc", "Battlefield::AddOrSetPlayerToCorrectBfGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
return false;
}
@ -583,10 +583,10 @@ BfGraveyard* Battlefield::GetGraveyardById(uint32 id) const
if (m_GraveyardList[id])
return m_GraveyardList[id];
else
sLog->outError("Battlefield::GetGraveyardById Id:%u not existed", id);
LOG_ERROR("server", "Battlefield::GetGraveyardById Id:%u not existed", id);
}
else
sLog->outError("Battlefield::GetGraveyardById Id:%u cant be found", id);
LOG_ERROR("server", "Battlefield::GetGraveyardById Id:%u cant be found", id);
return nullptr;
}
@ -680,7 +680,7 @@ void BfGraveyard::SetSpirit(Creature* spirit, TeamId team)
{
if (!spirit)
{
sLog->outError("BfGraveyard::SetSpirit: Invalid Spirit.");
LOG_ERROR("server", "BfGraveyard::SetSpirit: Invalid Spirit.");
return;
}
@ -787,14 +787,14 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
Map* map = sMapMgr->CreateBaseMap(m_MapId);
if (!map)
{
sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry);
LOG_ERROR("server", "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry);
return 0;
}
Creature* creature = new Creature(true);
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
{
sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
LOG_ERROR("server", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
delete creature;
return nullptr;
}
@ -805,7 +805,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
{
sLog->outErrorDb("Battlefield::SpawnCreature: entry %u does not exist.", entry);
LOG_ERROR("sql.sql", "Battlefield::SpawnCreature: entry %u does not exist.", entry);
return nullptr;
}
// force using DB speeds -- do we really need this?
@ -830,8 +830,8 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
GameObject* go = sObjectMgr->IsGameObjectStaticTransport(entry) ? new StaticTransport() : new GameObject();
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(), 100, GO_STATE_READY))
{
sLog->outErrorDb("Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
sLog->outError("Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
LOG_ERROR("sql.sql", "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
LOG_ERROR("server", "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
delete go;
return nullptr;
}
@ -909,7 +909,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
ASSERT(capturePoint);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", capturePoint->GetEntry());
LOG_DEBUG("bg.battlefield", "Creating capture point %u", capturePoint->GetEntry());
#endif
m_capturePoint = capturePoint->GetGUID();
@ -918,7 +918,7 @@ bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
GameObjectTemplate const* goinfo = capturePoint->GetGOInfo();
if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
{
sLog->outError("OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry());
LOG_ERROR("server", "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry());
return false;
}
@ -1064,7 +1064,7 @@ bool BfCapturePoint::Update(uint32 diff)
if (m_OldState != m_State)
{
//sLog->outError("%u->%u", m_OldState, m_State);
//LOG_ERROR("server", "%u->%u", m_OldState, m_State);
if (oldTeam != m_team)
ChangeTeam(oldTeam);
return true;

View file

@ -89,7 +89,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
uint8 Accepted;
recvData >> BattleId >> Accepted;
//sLog->outError("HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
//LOG_ERROR("server", "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
@ -107,7 +107,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket& recvData)
uint8 Accepted;
recvData >> BattleId >> Accepted;
//sLog->outError("HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
//LOG_ERROR("server", "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;
@ -129,7 +129,7 @@ void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
uint32 BattleId;
recvData >> BattleId;
//sLog->outError("HandleBfExitRequest: BattleID:%u ", BattleId);
//LOG_ERROR("server", "HandleBfExitRequest: BattleID:%u ", BattleId);
Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
if (!Bf)
return;

View file

@ -12,12 +12,12 @@
BattlefieldMgr::BattlefieldMgr()
{
m_UpdateTimer = 0;
//sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Instantiating BattlefieldMgr");
//LOG_DEBUG("bg.battlefield", "Instantiating BattlefieldMgr");
}
BattlefieldMgr::~BattlefieldMgr()
{
//sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Deleting BattlefieldMgr");
//LOG_DEBUG("bg.battlefield", "Deleting BattlefieldMgr");
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
delete *itr;
}
@ -34,17 +34,17 @@ void BattlefieldMgr::InitBattlefield()
// respawn, init variables
if (!pBf->SetupBattlefield())
{
sLog->outString();
sLog->outString("Battlefield : Wintergrasp init failed.");
sLog->outString();
LOG_INFO("server", " ");
LOG_INFO("server", "Battlefield : Wintergrasp init failed.");
LOG_INFO("server", " ");
delete pBf;
}
else
{
m_BattlefieldSet.push_back(pBf);
sLog->outString();
sLog->outString("Battlefield : Wintergrasp successfully initiated.");
sLog->outString();
LOG_INFO("server", " ");
LOG_INFO("server", "Battlefield : Wintergrasp successfully initiated.");
LOG_INFO("server", " ");
}
/* For Cataclysm: Tol Barad
@ -53,7 +53,7 @@ void BattlefieldMgr::InitBattlefield()
if(!pBf->SetupBattlefield())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed.");
LOG_DEBUG("bg.battlefield", "Battlefield : Tol Barad init failed.");
#endif
delete pBf;
}
@ -61,7 +61,7 @@ void BattlefieldMgr::InitBattlefield()
{
m_BattlefieldSet.push_back(pBf);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated.");
LOG_DEBUG("bg.battlefield", "Battlefield : Tol Barad successfully initiated.");
#endif
} */
}
@ -82,7 +82,7 @@ void BattlefieldMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
itr->second->HandlePlayerEnterZone(player, zoneid);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
LOG_DEBUG("bg.battlefield", "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
#endif
}
@ -97,7 +97,7 @@ void BattlefieldMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
return;
itr->second->HandlePlayerLeaveZone(player, zoneid);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
LOG_DEBUG("bg.battlefield", "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
#endif
}

View file

@ -220,7 +220,7 @@ void BattlefieldWG::OnBattleStart()
m_titansRelic = go->GetGUID();
}
else
sLog->outError("WG: Failed to spawn titan relic.");
LOG_ERROR("server", "WG: Failed to spawn titan relic.");
// Update tower visibility and update faction
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
@ -509,7 +509,7 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const
case AREA_THE_CHILLED_QUAGMIRE:
return BATTLEFIELD_WG_GY_HORDE;
default:
sLog->outError("BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId);
LOG_ERROR("server", "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId);
break;
}

View file

@ -1197,7 +1197,7 @@ struct BfWGGameObjectBuilding
if (GameObject* go = m_WG->GetRelic())
go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
else
sLog->outError("BattlefieldWG: Relic not found.");
LOG_ERROR("server", "BattlefieldWG: Relic not found.");
break;
case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
case BATTLEFIELD_WG_OBJECTTYPE_WALL:

View file

@ -107,7 +107,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Check if player is already in a similar arena team
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromStorage(GUID_LOPART(playerGuid), GetSlot()) != 0)
{
sLog->outError("Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
LOG_ERROR("server", "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
return false;
}
@ -242,7 +242,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
// Delete member if character information is missing
if (fields[6].GetString().empty())
{
sLog->outErrorDb("ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
LOG_ERROR("sql.sql", "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
this->DelMember(newMember.Guid, true);
continue;
}
@ -260,7 +260,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
{
// Arena team is empty or captain is not in team, delete from db
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
LOG_DEBUG("bg.battleground", "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
#endif
return false;
}
@ -303,7 +303,7 @@ void ArenaTeam::SetCaptain(uint64 guid)
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
/*if (oldCaptain)
{
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
LOG_DEBUG("bg.battleground", "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
oldCaptain->GetName().c_str(), oldCaptain->GetGUIDLow(), newCaptain->GetName().c_str(),
newCaptain->GetGUIDLow(), GetId(), GetType());
}*/
@ -460,7 +460,7 @@ void ArenaTeam::Roster(WorldSession* session)
session->SendPacket(&data);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_ROSTER");
LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_ROSTER");
#endif
}
@ -477,7 +477,7 @@ void ArenaTeam::Query(WorldSession* session)
data << uint32(BorderColor); // border color
session->SendPacket(&data);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE");
LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE");
#endif
}
@ -579,7 +579,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun
data << str1 << str2 << str3;
break;
default:
sLog->outError("Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
LOG_ERROR("server", "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
return;
}
@ -589,7 +589,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun
BroadcastPacket(&data);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_EVENT");
LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_EVENT");
#endif
}
@ -631,7 +631,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
return slot;
}
sLog->outError("FATAL: Unknown arena team type %u for some arena team", type);
LOG_ERROR("server", "FATAL: Unknown arena team type %u for some arena team", type);
return 0xFF;
}

View file

@ -120,7 +120,7 @@ uint32 ArenaTeamMgr::GenerateArenaTeamId()
{
if (NextArenaTeamId >= MAX_ARENA_TEAM_ID)
{
sLog->outError("Arena team ids overflow!! Can't continue, shutting down server. ");
LOG_ERROR("server", "Arena team ids overflow!! Can't continue, shutting down server. ");
World::StopNow(ERROR_EXIT_CODE);
}
@ -149,8 +149,8 @@ void ArenaTeamMgr::LoadArenaTeams()
if (!result)
{
sLog->outString(">> Loaded 0 arena teams. DB table `arena_team` is empty!");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 arena teams. DB table `arena_team` is empty!");
LOG_INFO("server", " ");
return;
}
@ -179,8 +179,8 @@ void ArenaTeamMgr::LoadArenaTeams()
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void ArenaTeamMgr::DistributeArenaPoints()

View file

@ -309,7 +309,7 @@ inline void Battleground::_CheckSafePositions(uint32 diff)
if (pos.GetExactDistSq(x, y, z) > maxDist)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", itr->second->GetName().c_str(), GetMapId());
LOG_DEBUG("bg.battleground", "BATTLEGROUND: Sending %s back to start location (map: %u) (possible exploit)", itr->second->GetName().c_str(), GetMapId());
#endif
itr->second->TeleportTo(GetMapId(), x, y, z, o);
}
@ -442,7 +442,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
if (!FindBgMap())
{
sLog->outError("Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID);
LOG_ERROR("server", "Battleground::_ProcessJoin: map (map id: %u, instance id: %u) is not created!", m_MapId, m_InstanceID);
EndNow();
return;
}
@ -1169,7 +1169,7 @@ void Battleground::Init()
if (m_BgInvitedPlayers[TEAM_ALLIANCE] > 0 || m_BgInvitedPlayers[TEAM_HORDE] > 0)
{
sLog->outError("Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", m_BgInvitedPlayers[TEAM_ALLIANCE], m_BgInvitedPlayers[TEAM_HORDE], m_MapId, m_InstanceID);
LOG_ERROR("server", "Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", m_BgInvitedPlayers[TEAM_ALLIANCE], m_BgInvitedPlayers[TEAM_HORDE], m_MapId, m_InstanceID);
ABORT();
}
@ -1269,7 +1269,7 @@ void Battleground::AddPlayer(Player* player)
// Log
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDetail("BATTLEGROUND: Player %s joined the battle.", player->GetName().c_str());
LOG_DEBUG("server", "BATTLEGROUND: Player %s joined the battle.", player->GetName().c_str());
#endif
}
@ -1278,7 +1278,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId)
{
if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
{
sLog->outMisc("Battleground::AddOrSetPlayerToCorrectBgGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
LOG_INFO("misc", "Battleground::AddOrSetPlayerToCorrectBgGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
return;
}
@ -1447,7 +1447,7 @@ void Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value,
}
break;
default:
sLog->outError("Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::UpdatePlayerScore: unknown score type (%u) for BG (map: %u, instance id: %u)!",
type, m_MapId, m_InstanceID);
break;
}
@ -1514,9 +1514,9 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, GetBgMap(),
PHASEMASK_NORMAL, x, y, z, o, G3D::Quat(rotation0, rotation1, rotation2, rotation3), 100, goState))
{
sLog->outErrorDb("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
LOG_ERROR("sql.sql", "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
sLog->outError("Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete go;
return false;
@ -1567,7 +1567,7 @@ void Battleground::DoorClose(uint32 type)
}
}
else
sLog->outError("Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::DoorClose: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
}
@ -1579,7 +1579,7 @@ void Battleground::DoorOpen(uint32 type)
obj->SetGoState(GO_STATE_ACTIVE);
}
else
sLog->outError("Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::DoorOpen: door gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
}
@ -1587,7 +1587,7 @@ GameObject* Battleground::GetBGObject(uint32 type)
{
GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]);
if (!obj)
sLog->outError("Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
return obj;
}
@ -1596,7 +1596,7 @@ Creature* Battleground::GetBGCreature(uint32 type)
{
Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]);
if (!creature)
sLog->outError("Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
return creature;
}
@ -1641,7 +1641,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
Creature* creature = new Creature();
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, x, y, z, o))
{
sLog->outError("Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete creature;
return nullptr;
@ -1652,7 +1652,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
{
sLog->outError("Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!",
entry, m_MapId, m_InstanceID);
delete creature;
return nullptr;
@ -1691,7 +1691,7 @@ bool Battleground::DelCreature(uint32 type)
return true;
}
sLog->outError("Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::DelCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID);
BgCreatures[type] = 0;
return false;
@ -1709,7 +1709,7 @@ bool Battleground::DelObject(uint32 type)
BgObjects[type] = 0;
return true;
}
sLog->outError("Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::DelObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!",
type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID);
BgObjects[type] = 0;
return false;
@ -1733,7 +1733,7 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float
//creature->CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true);
return true;
}
sLog->outError("Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!",
LOG_ERROR("server", "Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!",
type, entry, m_MapId, m_InstanceID);
EndNow();
return false;
@ -1921,7 +1921,7 @@ int32 Battleground::GetObjectType(uint64 guid)
for (uint32 i = 0; i < BgObjects.size(); ++i)
if (BgObjects[i] == guid)
return i;
sLog->outError("Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
LOG_ERROR("server", "Battleground::GetObjectType: player used gameobject (GUID: %u) which is not in internal data for BG (map: %u, instance id: %u), cheating?",
GUID_LOPART(guid), m_MapId, m_InstanceID);
return -1;
}
@ -1977,7 +1977,7 @@ uint32 Battleground::GetTeamScore(TeamId teamId) const
if (teamId == TEAM_ALLIANCE || teamId == TEAM_HORDE)
return m_TeamScores[teamId];
sLog->outError("GetTeamScore with wrong Team %u for BG %u", teamId, GetBgTypeID());
LOG_ERROR("server", "GetTeamScore with wrong Team %u for BG %u", teamId, GetBgTypeID());
return 0;
}

View file

@ -248,7 +248,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
itr2 = itr++;
if (!bg->IsPlayerInBattleground(itr2->first))
{
sLog->outError("Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetBgTypeID());
LOG_ERROR("server", "Player " UI64FMTD " has scoreboard entry for battleground %u but is not in battleground!", itr->first, bg->GetBgTypeID());
continue;
}
@ -363,7 +363,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
// should never happen
if (++scoreCount >= bg->GetMaxPlayersPerTeam() * 2 && itr != bg->GetPlayerScoresEnd())
{
sLog->outMisc("Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bgTypeId, bg->GetPlayerScoresSize(), bg->GetMaxPlayersPerTeam() * 2);
LOG_INFO("misc", "Battleground %u scoreboard has more entries (%u) than allowed players in this bg (%u)", bgTypeId, bg->GetPlayerScoresSize(), bg->GetMaxPlayersPerTeam() * 2);
break;
}
}
@ -519,7 +519,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
if (!result)
{
sLog->outError(">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
LOG_ERROR("server", ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
return;
}
@ -538,7 +538,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
BattlemasterListEntry const* bl = sBattlemasterListStore.LookupEntry(bgTypeId);
if (!bl)
{
sLog->outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeId);
LOG_ERROR("server", "Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeId);
continue;
}
@ -559,14 +559,14 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam)
{
sLog->outError("Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)",
LOG_ERROR("server", "Table `battleground_template` for id %u has bad values for MinPlayersPerTeam (%u) and MaxPlayersPerTeam(%u)",
data.bgTypeId, data.MinPlayersPerTeam, data.MaxPlayersPerTeam);
continue;
}
if (data.LevelMin == 0 || data.LevelMax == 0 || data.LevelMin > data.LevelMax)
{
sLog->outError("Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)",
LOG_ERROR("server", "Table `battleground_template` for id %u has bad values for LevelMin (%u) and LevelMax(%u)",
data.bgTypeId, data.LevelMin, data.LevelMax);
continue;
}
@ -594,7 +594,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
else
{
sLog->outError("Table `battleground_template` for id %u have non-existed `game_graveyard` table id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
LOG_ERROR("server", "Table `battleground_template` for id %u have non-existed `game_graveyard` table id %u in field `AllianceStartLoc`. BG not created.", data.bgTypeId, startId);
continue;
}
@ -608,7 +608,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
else
{
sLog->outError("Table `battleground_template` for id %u have non-existed `game_graveyard` table id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
LOG_ERROR("server", "Table `battleground_template` for id %u have non-existed `game_graveyard` table id %u in field `HordeStartLoc`. BG not created.", data.bgTypeId, startId);
continue;
}
}
@ -624,8 +624,8 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void BattlegroundMgr::InitAutomaticArenaPointDistribution()
@ -635,15 +635,15 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
time_t wstime = time_t(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
time_t curtime = time(nullptr);
sLog->outString("AzerothCore Battleground: Initializing Automatic Arena Point Distribution");
LOG_INFO("server", "AzerothCore Battleground: Initializing Automatic Arena Point Distribution");
if (wstime < curtime)
{
m_NextAutoDistributionTime = curtime; // reset will be called in the next update
sLog->outString("AzerothCore Battleground: Next arena point distribution time in the past, reseting it now.");
LOG_INFO("server", "AzerothCore Battleground: Next arena point distribution time in the past, reseting it now.");
}
else
m_NextAutoDistributionTime = wstime;
sLog->outString("AzerothCore Battleground: Automatic Arena Point Distribution initialized.");
LOG_INFO("server", "AzerothCore Battleground: Automatic Arena Point Distribution initialized.");
}
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
@ -848,8 +848,8 @@ void BattlegroundMgr::LoadBattleMastersEntry()
if (!result)
{
sLog->outString(">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
LOG_INFO("server", " ");
return;
}
@ -865,18 +865,18 @@ void BattlegroundMgr::LoadBattleMastersEntry()
if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry))
{
if ((cInfo->npcflag & UNIT_NPC_FLAG_BATTLEMASTER) == 0)
sLog->outErrorDb("Creature (Entry: %u) listed in `battlemaster_entry` is not a battlemaster.", entry);
LOG_ERROR("sql.sql", "Creature (Entry: %u) listed in `battlemaster_entry` is not a battlemaster.", entry);
}
else
{
sLog->outErrorDb("Creature (Entry: %u) listed in `battlemaster_entry` does not exist.", entry);
LOG_ERROR("sql.sql", "Creature (Entry: %u) listed in `battlemaster_entry` does not exist.", entry);
continue;
}
uint32 bgTypeId = fields[1].GetUInt32();
if (!sBattlemasterListStore.LookupEntry(bgTypeId))
{
sLog->outErrorDb("Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId);
LOG_ERROR("sql.sql", "Table `battlemaster_entry` contain entry %u for not existed battleground type %u, ignored.", entry, bgTypeId);
continue;
}
@ -885,8 +885,8 @@ void BattlegroundMgr::LoadBattleMastersEntry()
CheckBattleMasters();
sLog->outString(">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void BattlegroundMgr::CheckBattleMasters()
@ -896,7 +896,7 @@ void BattlegroundMgr::CheckBattleMasters()
{
if ((itr->second.npcflag & UNIT_NPC_FLAG_BATTLEMASTER) && mBattleMastersMap.find(itr->second.Entry) == mBattleMastersMap.end())
{
sLog->outErrorDb("CreatureTemplate (Entry: %u) has UNIT_NPC_FLAG_BATTLEMASTER but no data in `battlemaster_entry` table. Removing flag!", itr->second.Entry);
LOG_ERROR("sql.sql", "CreatureTemplate (Entry: %u) has UNIT_NPC_FLAG_BATTLEMASTER but no data in `battlemaster_entry` table. Removing flag!", itr->second.Entry);
const_cast<CreatureTemplate*>(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_BATTLEMASTER;
}
}

View file

@ -381,14 +381,14 @@ bool BattlegroundAB::SetupBattleground()
for (uint32 i = BG_AB_OBJECT_BANNER_NEUTRAL; i < BG_AB_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!");
LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = BG_AB_SPIRIT_ALIANCE; i <= BG_AB_SPIRIT_HORDE; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundAB: Failed to spawn spirit guides Battleground not created!");
LOG_ERROR("sql.sql", "BatteGroundAB: Failed to spawn spirit guides Battleground not created!");
return false;
}

View file

@ -60,7 +60,7 @@ void BattlegroundAV::HandleKillPlayer(Player* player, Player* killer)
void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av HandleKillUnit %i", unit->GetEntry());
LOG_DEBUG("bg.battleground", "bg_av HandleKillUnit %i", unit->GetEntry());
#endif
if (GetStatus() != STATUS_IN_PROGRESS)
return;
@ -96,7 +96,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
{
if (!m_CaptainAlive[0])
{
sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
LOG_ERROR("server", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
}
m_CaptainAlive[0] = false;
@ -115,7 +115,7 @@ void BattlegroundAV::HandleKillUnit(Creature* unit, Player* killer)
{
if (!m_CaptainAlive[1])
{
sLog->outError("Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
LOG_ERROR("server", "Killed a Captain twice, please report this bug, if you haven't done \".respawn\"");
return;
}
m_CaptainAlive[1] = false;
@ -143,7 +143,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
TeamId teamId = player->GetTeamId();
//TODO add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed", questid);
#endif
switch (questid)
{
@ -155,7 +155,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
if (m_Team_QuestStatus[teamId][0] == 500 || m_Team_QuestStatus[teamId][0] == 1000 || m_Team_QuestStatus[teamId][0] == 1500) //25, 50, 75 turn ins
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed starting with unit upgrading..", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed starting with unit upgrading..", questid);
#endif
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
if (m_Nodes[i].OwnerId == player->GetTeamId() && m_Nodes[i].State == POINT_CONTROLED)
@ -172,7 +172,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
RewardReputationToTeam(teamId, 1, teamId);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (m_Team_QuestStatus[teamId][1] == 30)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
#endif
break;
case AV_QUEST_A_COMMANDER2:
@ -181,7 +181,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
RewardReputationToTeam(teamId, 1, teamId);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (m_Team_QuestStatus[teamId][2] == 60)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
#endif
break;
case AV_QUEST_A_COMMANDER3:
@ -190,7 +190,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
RewardReputationToTeam(teamId, 1, teamId);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (m_Team_QuestStatus[teamId][3] == 120)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
#endif
break;
case AV_QUEST_A_BOSS1:
@ -202,7 +202,7 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
m_Team_QuestStatus[teamId][4]++;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (m_Team_QuestStatus[teamId][4] >= 200)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
#endif
break;
case AV_QUEST_A_NEAR_MINE:
@ -211,10 +211,10 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
if (m_Team_QuestStatus[teamId][5] == 28)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[teamId][6] == 7)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
#endif
}
break;
@ -224,10 +224,10 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
if (m_Team_QuestStatus[teamId][6] == 7)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[teamId][5] == 20)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
#endif
}
break;
@ -237,10 +237,10 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
if (m_Team_QuestStatus[teamId][7] == 25)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[teamId][8] == 25)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
#endif
}
break;
@ -250,16 +250,16 @@ void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
if (m_Team_QuestStatus[teamId][8] == 25)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[teamId][7] == 25)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
#endif
}
break;
default:
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV Quest %i completed but is not interesting at all", questid);
LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed but is not interesting at all", questid);
#endif
return; //was no interesting quest at all
break;
@ -449,7 +449,7 @@ void BattlegroundAV::StartingEventCloseDoors()
void BattlegroundAV::StartingEventOpenDoors()
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning mine stuff");
LOG_DEBUG("bg.battleground", "BG_AV: start spawning mine stuff");
#endif
for (uint16 i = BG_AV_OBJECT_MINE_SUPPLY_N_MIN; i <= BG_AV_OBJECT_MINE_SUPPLY_N_MAX; i++)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
@ -600,7 +600,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
{
uint32 object = GetObjectThroughNode(node);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av: player destroyed point node %i object %i", node, object);
LOG_DEBUG("bg.battleground", "bg_av: player destroyed point node %i object %i", node, object);
#endif
//despawn banner
@ -616,7 +616,7 @@ void BattlegroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
if (BgCreatures[AV_CPLACE_A_MARSHAL_SOUTH + tmp])
DelCreature(AV_CPLACE_A_MARSHAL_SOUTH + tmp);
else
sLog->outError("BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
LOG_ERROR("server", "BG_AV: playerdestroyedpoint: marshal %i doesn't exist", AV_CPLACE_A_MARSHAL_SOUTH + tmp);
//spawn destroyed aura
for (uint8 i = 0; i <= 9; i++)
SpawnBGObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + i + (tmp * 10), RESPAWN_IMMEDIATELY);
@ -675,7 +675,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
if (!initial)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av depopulating mine %i (0=north, 1=south)", mine);
LOG_DEBUG("bg.battleground", "bg_av depopulating mine %i (0=north, 1=south)", mine);
#endif
if (mine == AV_SOUTH_MINE)
for (uint16 i = AV_CPLACE_MINE_S_S_MIN; i <= AV_CPLACE_MINE_S_S_MAX; i++)
@ -688,7 +688,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
SendMineWorldStates(mine);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av populating mine %i (0=north, 1=south)", mine);
LOG_DEBUG("bg.battleground", "bg_av populating mine %i (0=north, 1=south)", mine);
#endif
uint16 miner;
//also neutral team exists.. after a big time, the neutral team tries to conquer the mine
@ -712,7 +712,7 @@ void BattlegroundAV::ChangeMineOwner(uint8 mine, TeamId teamId, bool initial)
miner = AV_NPC_S_MINE_N_1;
//vermin
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "spawning vermin");
LOG_DEBUG("bg.battleground", "spawning vermin");
#endif
if (teamId == TEAM_ALLIANCE)
cinfo = AV_NPC_S_MINE_A_3;
@ -781,7 +781,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
if (BgCreatures[node])
DelCreature(node);
if (!AddSpiritGuide(node, BG_AV_CreaturePos[node][0], BG_AV_CreaturePos[node][1], BG_AV_CreaturePos[node][2], BG_AV_CreaturePos[node][3], ownerId))
sLog->outError("AV: couldn't spawn spiritguide at node %i", node);
LOG_ERROR("server", "AV: couldn't spawn spiritguide at node %i", node);
}
for (uint8 i = 0; i < 4; i++)
AddAVCreature(creatureid, c_place + i);
@ -831,7 +831,7 @@ void BattlegroundAV::DePopulateNode(BG_AV_Nodes node)
BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_AV getnodethroughobject %i", object);
LOG_DEBUG("bg.battleground", "bg_AV getnodethroughobject %i", object);
#endif
if (object <= BG_AV_OBJECT_FLAG_A_STONEHEART_BUNKER)
return BG_AV_Nodes(object);
@ -847,7 +847,7 @@ BG_AV_Nodes BattlegroundAV::GetNodeThroughObject(uint32 object)
return BG_AV_Nodes(object - 29);
if (object == BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE)
return BG_AV_NODES_SNOWFALL_GRAVE;
sLog->outError("BattlegroundAV: ERROR! GetPlace got a wrong object :(");
LOG_ERROR("server", "BattlegroundAV: ERROR! GetPlace got a wrong object :(");
ABORT();
return BG_AV_Nodes(0);
}
@ -856,7 +856,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
{
//this function is the counterpart to GetNodeThroughObject()
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_AV GetObjectThroughNode %i", node);
LOG_DEBUG("bg.battleground", "bg_AV GetObjectThroughNode %i", node);
#endif
if (m_Nodes[node].OwnerId == TEAM_ALLIANCE)
{
@ -888,7 +888,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node)
}
else if (m_Nodes[node].OwnerId == TEAM_NEUTRAL)
return BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE;
sLog->outError("BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
LOG_ERROR("server", "BattlegroundAV: Error! GetPlaceNode couldn't resolve node %i", node);
ABORT();
return 0;
}
@ -940,11 +940,11 @@ void BattlegroundAV::EventPlayerDefendsPoint(Player* player, uint32 object)
return;
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "player defends point object: %i node: %i", object, node);
LOG_DEBUG("bg.battleground", "player defends point object: %i node: %i", object, node);
#endif
if (m_Nodes[node].PrevOwnerId != teamId)
{
sLog->outError("BG_AV: player defends point which doesn't belong to his team %i", node);
LOG_ERROR("server", "BG_AV: player defends point which doesn't belong to his team %i", node);
return;
}
@ -1004,7 +1004,7 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
TeamId prevOwnerId = m_Nodes[node].OwnerId;
TeamId teamId = player->GetTeamId();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "bg_av: player assaults point object %i node %i", object, node);
LOG_DEBUG("bg.battleground", "bg_av: player assaults point object %i node %i", object, node);
#endif
if (prevOwnerId == teamId || teamId == m_Nodes[node].TotalOwnerId)
return; //surely a gm used this object
@ -1157,7 +1157,7 @@ uint8 BattlegroundAV::GetWorldStateType(uint8 state, TeamId teamId) //this is us
if (state == POINT_ASSAULTED)
return 3;
}
sLog->outError("BG_AV: should update a strange worldstate state:%i team:%i", state, teamId);
LOG_ERROR("server", "BG_AV: should update a strange worldstate state:%i team:%i", state, teamId);
return 5; //this will crash the game, but i want to know if something is wrong here
}
@ -1234,7 +1234,7 @@ bool BattlegroundAV::SetupBattleground()
|| !AddObject(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_A, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_AURA_H_FIRSTAID_STATION + i * 3, BG_AV_OBJECTID_AURA_H, BG_AV_ObjectPos[i][0], BG_AV_ObjectPos[i][1], BG_AV_ObjectPos[i][2], BG_AV_ObjectPos[i][3], 0, 0, sin(BG_AV_ObjectPos[i][3] / 2), cos(BG_AV_ObjectPos[i][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!2");
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!2");
return false;
}
}
@ -1249,7 +1249,7 @@ bool BattlegroundAV::SetupBattleground()
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_A, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PH, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!3");
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!3");
return false;
}
}
@ -1262,7 +1262,7 @@ bool BattlegroundAV::SetupBattleground()
|| !AddObject(BG_AV_OBJECT_TFLAG_A_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_PA, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_TFLAG_H_DUNBALDAR_SOUTH + (2 * (i - BG_AV_NODES_DUNBALDAR_SOUTH)), BG_AV_OBJECTID_TOWER_BANNER_H, BG_AV_ObjectPos[i + 8][0], BG_AV_ObjectPos[i + 8][1], BG_AV_ObjectPos[i + 8][2], BG_AV_ObjectPos[i + 8][3], 0, 0, sin(BG_AV_ObjectPos[i + 8][3] / 2), cos(BG_AV_ObjectPos[i + 8][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!4");
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!4");
return false;
}
}
@ -1270,7 +1270,7 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_DUNBALDAR_SOUTH + ((i - BG_AV_NODES_DUNBALDAR_SOUTH) * 10) + j][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!5.%i", i);
return false;
}
}
@ -1284,7 +1284,7 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE + (i * 10) + j, BG_AV_OBJECTID_SMOKE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!6.%i", i);
return false;
}
}
@ -1292,7 +1292,7 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_BURN_BUILDING_ALLIANCE + (i * 10) + j, BG_AV_OBJECTID_FIRE, BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][0], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][1], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][2], BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_BURN_BUILDING_A + (i * 10) + j][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!7.%i", i);
return false;
}
}
@ -1302,7 +1302,7 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_N_MIN + i, BG_AV_OBJECTID_MINE_N, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_N_MIN + i][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.5.%i", i);
return false;
}
}
@ -1310,14 +1310,14 @@ bool BattlegroundAV::SetupBattleground()
{
if (!AddObject(BG_AV_OBJECT_MINE_SUPPLY_S_MIN + i, BG_AV_OBJECTID_MINE_S, BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][0], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][1], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][2], BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_MINE_SUPPLY_S_MIN + i][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some mine supplies Battleground not created!7.6.%i", i);
return false;
}
}
if (!AddObject(BG_AV_OBJECT_FLAG_N_SNOWFALL_GRAVE, BG_AV_OBJECTID_BANNER_SNOWFALL_N, BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][0], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][1], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][2], BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3], 0, 0, sin(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3] / 2), cos(BG_AV_ObjectPos[BG_AV_NODES_SNOWFALL_GRAVE][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
}
for (uint8 i = 0; i < 4; i++)
@ -1327,7 +1327,7 @@ bool BattlegroundAV::SetupBattleground()
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_H + i, BG_AV_OBJECTID_SNOWFALL_CANDY_H, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY)
|| !AddObject(BG_AV_OBJECT_SNOW_EYECANDY_PH + i, BG_AV_OBJECTID_SNOWFALL_CANDY_PH, BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][0], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][1], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][2], BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_SNOW_1 + i][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!9.%i", i);
return false;
}
}
@ -1343,18 +1343,18 @@ bool BattlegroundAV::SetupBattleground()
// Quest banners
if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
}
if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3] / 2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3] / 2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
LOG_ERROR("server", "BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
}
uint16 i;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Alterac Valley: entering state STATUS_WAIT_JOIN ...");
LOG_DEBUG("bg.battleground", "Alterac Valley: entering state STATUS_WAIT_JOIN ...");
#endif
// Initial Nodes
for (i = 0; i < BG_AV_OBJECT_MAX; i++)
@ -1403,7 +1403,7 @@ bool BattlegroundAV::SetupBattleground()
//creatures
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes");
LOG_DEBUG("bg.battleground", "BG_AV start poputlating nodes");
#endif
for (i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
{
@ -1412,19 +1412,19 @@ bool BattlegroundAV::SetupBattleground()
}
//all creatures which don't get despawned through the script are static
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning static creatures");
LOG_DEBUG("bg.battleground", "BG_AV: start spawning static creatures");
#endif
for (i = 0; i < AV_STATICCPLACE_MAX; i++)
AddAVCreature(0, i + AV_CPLACE_MAX);
//mainspiritguides:
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning spiritguides creatures");
LOG_DEBUG("bg.battleground", "BG_AV: start spawning spiritguides creatures");
#endif
AddSpiritGuide(7, BG_AV_CreaturePos[7][0], BG_AV_CreaturePos[7][1], BG_AV_CreaturePos[7][2], BG_AV_CreaturePos[7][3], TEAM_ALLIANCE);
AddSpiritGuide(8, BG_AV_CreaturePos[8][0], BG_AV_CreaturePos[8][1], BG_AV_CreaturePos[8][2], BG_AV_CreaturePos[8][3], TEAM_HORDE);
//spawn the marshals (those who get deleted, if a tower gets destroyed)
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV: start spawning marshal creatures");
LOG_DEBUG("bg.battleground", "BG_AV: start spawning marshal creatures");
#endif
for (i = AV_NPC_A_MARSHAL_SOUTH; i <= AV_NPC_H_MARSHAL_WTOWER; i++)
AddAVCreature(i, AV_CPLACE_A_MARSHAL_SOUTH + (i - AV_NPC_A_MARSHAL_SOUTH));
@ -1436,7 +1436,7 @@ bool BattlegroundAV::SetupBattleground()
// horde gates
|| !AddObject(BG_AV_OBJECT_DOOR_H, BG_AV_OBJECTID_GATE_H, BG_AV_DoorPositons[1][0], BG_AV_DoorPositons[1][1], BG_AV_DoorPositons[1][2], BG_AV_DoorPositons[1][3], 0, 0, sin(BG_AV_DoorPositons[1][3] / 2), cos(BG_AV_DoorPositons[1][3] / 2), RESPAWN_IMMEDIATELY))
{
sLog->outErrorDb("BatteGroundAV: Failed to spawn some object Battleground not created!1");
LOG_ERROR("sql.sql", "BatteGroundAV: Failed to spawn some object Battleground not created!1");
return false;
}
@ -1478,7 +1478,7 @@ char const* BattlegroundAV::GetNodeName(BG_AV_Nodes node)
case BG_AV_NODES_FROSTWOLF_HUT:
return GetAcoreString(LANG_BG_AV_NODE_GRAVE_FROST_HUT);
default:
sLog->outError("tried to get name for node %u", node);
LOG_ERROR("server", "tried to get name for node %u", node);
break;
}
@ -1489,22 +1489,22 @@ void BattlegroundAV::AssaultNode(BG_AV_Nodes node, TeamId teamId)
{
if (m_Nodes[node].TotalOwnerId == teamId)
{
sLog->outCrash("Assaulting team is TotalOwner of node");
LOG_FATAL("server", "Assaulting team is TotalOwner of node");
ABORT();
}
if (m_Nodes[node].OwnerId == teamId)
{
sLog->outCrash("Assaulting team is owner of node");
LOG_FATAL("server", "Assaulting team is owner of node");
ABORT();
}
if (m_Nodes[node].State == POINT_DESTROYED)
{
sLog->outCrash("Destroyed node is being assaulted");
LOG_FATAL("server", "Destroyed node is being assaulted");
ABORT();
}
if (m_Nodes[node].State == POINT_ASSAULTED && m_Nodes[node].TotalOwnerId != TEAM_NEUTRAL) //only assault an assaulted node if no totalowner exists
{
sLog->outCrash("Assault on an not assaulted node with total owner");
LOG_FATAL("server", "Assault on an not assaulted node with total owner");
ABORT();
}
//the timer gets another time, if the previous owner was 0 == Neutral

View file

@ -72,7 +72,7 @@ void BattlegroundBE::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
sLog->outError("Killer player not found");
LOG_ERROR("server", "Killer player not found");
return;
}
@ -152,7 +152,7 @@ bool BattlegroundBE::SetupBattleground()
|| !AddObject(BG_BE_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 6189.47f, 235.54f, 5.52f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|| !AddObject(BG_BE_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 6287.19f, 288.25f, 5.33f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
{
sLog->outErrorDb("BatteGroundBE: Failed to spawn some object!");
LOG_ERROR("sql.sql", "BatteGroundBE: Failed to spawn some object!");
return false;
}

View file

@ -160,7 +160,7 @@ void BattlegroundDS::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
sLog->outError("BattlegroundDS: Killer player not found");
LOG_ERROR("server", "BattlegroundDS: Killer player not found");
return;
}
@ -246,7 +246,7 @@ bool BattlegroundDS::SetupBattleground()
|| !AddObject(BG_DS_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 1229.44f, 759.35f, 17.89f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|| !AddObject(BG_DS_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 1352.90f, 822.77f, 17.96f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
{
sLog->outErrorDb("BatteGroundDS: Failed to spawn some object!");
LOG_ERROR("sql.sql", "BatteGroundDS: Failed to spawn some object!");
return false;
}

View file

@ -320,14 +320,14 @@ bool BattlegroundEY::SetupBattleground()
for (uint32 i = BG_EY_OBJECT_DOOR_A; i < BG_EY_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!");
LOG_ERROR("sql.sql", "BatteGroundEY: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = BG_EY_SPIRIT_MAIN_ALLIANCE; i <= BG_EY_SPIRIT_MAIN_HORDE; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guides Battleground not created!");
LOG_ERROR("sql.sql", "BatteGroundEY: Failed to spawn spirit guides Battleground not created!");
return false;
}

View file

@ -397,7 +397,7 @@ bool BattlegroundIC::SetupBattleground()
{
if (!AddObject(BG_IC_ObjSpawnlocs[i].type, BG_IC_ObjSpawnlocs[i].entry, BG_IC_ObjSpawnlocs[i].x, BG_IC_ObjSpawnlocs[i].y, BG_IC_ObjSpawnlocs[i].z, BG_IC_ObjSpawnlocs[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY))
{
sLog->outError("Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry);
LOG_ERROR("server", "Isle of Conquest: There was an error spawning gameobject %u", BG_IC_ObjSpawnlocs[i].entry);
return false;
}
@ -410,7 +410,7 @@ bool BattlegroundIC::SetupBattleground()
{
if (!AddObject(BG_IC_Teleporters[i].type, BG_IC_Teleporters[i].entry, BG_IC_Teleporters[i].x, BG_IC_Teleporters[i].y, BG_IC_Teleporters[i].z, BG_IC_Teleporters[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY))
{
sLog->outError("Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
LOG_ERROR("server", "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
return false;
}
}
@ -419,7 +419,7 @@ bool BattlegroundIC::SetupBattleground()
{
if (!AddObject(BG_IC_TeleporterEffects[i].type, BG_IC_TeleporterEffects[i].entry, BG_IC_TeleporterEffects[i].x, BG_IC_TeleporterEffects[i].y, BG_IC_TeleporterEffects[i].z, BG_IC_TeleporterEffects[i].o, 0, 0, 0, 0, RESPAWN_ONE_DAY))
{
sLog->outError("Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
LOG_ERROR("server", "Isle of Conquest | Starting Event Open Doors: There was an error spawning gameobject %u", BG_IC_Teleporters[i].entry);
return false;
}
}
@ -428,7 +428,7 @@ bool BattlegroundIC::SetupBattleground()
{
if (!AddCreature(BG_IC_NpcSpawnlocs[i].entry, BG_IC_NpcSpawnlocs[i].type, BG_IC_NpcSpawnlocs[i].x, BG_IC_NpcSpawnlocs[i].y, BG_IC_NpcSpawnlocs[i].z, BG_IC_NpcSpawnlocs[i].o, RESPAWN_ONE_DAY))
{
sLog->outError("Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry);
LOG_ERROR("server", "Isle of Conquest: There was an error spawning creature %u", BG_IC_NpcSpawnlocs[i].entry);
return false;
}
}
@ -438,7 +438,7 @@ bool BattlegroundIC::SetupBattleground()
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1 + 5, BG_IC_SpiritGuidePos[7][0], BG_IC_SpiritGuidePos[7][1], BG_IC_SpiritGuidePos[7][2], BG_IC_SpiritGuidePos[7][3], TEAM_ALLIANCE)
|| !AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1 + 6, BG_IC_SpiritGuidePos[8][0], BG_IC_SpiritGuidePos[8][1], BG_IC_SpiritGuidePos[8][2], BG_IC_SpiritGuidePos[8][3], TEAM_HORDE))
{
sLog->outError("Isle of Conquest: Failed to spawn initial spirit guide!");
LOG_ERROR("server", "Isle of Conquest: Failed to spawn initial spirit guide!");
return false;
}
@ -447,7 +447,7 @@ bool BattlegroundIC::SetupBattleground()
if (!gunshipAlliance || !gunshipHorde)
{
sLog->outError("Isle of Conquest: There was an error creating gunships!");
LOG_ERROR("server", "Isle of Conquest: There was an error creating gunships!");
return false;
}
@ -676,7 +676,7 @@ uint32 BattlegroundIC::GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool r
return nodePoint->last_entry;
// we should never be here...
sLog->outError("Isle Of Conquest: Unexpected return in GetNextBanner function");
LOG_ERROR("server", "Isle Of Conquest: Unexpected return in GetNextBanner function");
return 0;
}
@ -728,7 +728,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
BG_IC_SpiritGuidePos[nodePoint->nodeType][0], BG_IC_SpiritGuidePos[nodePoint->nodeType][1],
BG_IC_SpiritGuidePos[nodePoint->nodeType][2], BG_IC_SpiritGuidePos[nodePoint->nodeType][3],
nodePoint->faction))
sLog->outError("Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
LOG_ERROR("server", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
}
switch (nodePoint->gameobject_type)
@ -751,20 +751,20 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1 + u;
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY))
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
LOG_ERROR("server", "Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
}
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS; ++u)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_EFFECT_1 + u;
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
LOG_ERROR("server", "Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
}
for (uint8 u = 0; u < MAX_TRIGGER_SPAWNS_PER_FACTION; ++u)
{
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
LOG_ERROR("server", "Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
}
for (uint8 u = 0; u < MAX_CAPTAIN_SPAWNS_PER_FACTION; ++u)
@ -777,7 +777,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_2)
if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
LOG_ERROR("server", "Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
}
(nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->EnableMovement(true);

View file

@ -69,7 +69,7 @@ void BattlegroundNA::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
sLog->outError("BattlegroundNA: Killer player not found");
LOG_ERROR("server", "BattlegroundNA: Killer player not found");
return;
}
@ -130,7 +130,7 @@ bool BattlegroundNA::SetupBattleground()
|| !AddObject(BG_NA_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 4090.46f, 2875.43f, 12.16f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|| !AddObject(BG_NA_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 4022.82f, 2966.61f, 12.17f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
{
sLog->outErrorDb("BatteGroundNA: Failed to spawn some object!");
LOG_ERROR("sql.sql", "BatteGroundNA: Failed to spawn some object!");
return false;
}

View file

@ -69,7 +69,7 @@ void BattlegroundRL::HandleKillPlayer(Player* player, Player* killer)
if (!killer)
{
sLog->outError("Killer player not found");
LOG_ERROR("server", "Killer player not found");
return;
}
@ -154,7 +154,7 @@ bool BattlegroundRL::SetupBattleground()
|| !AddObject(BG_RL_OBJECT_READY_MARKER_1, ARENA_READY_MARKER_ENTRY, 1298.61f, 1598.59f, 31.62f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
|| !AddObject(BG_RL_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 1273.71f, 1734.05f, 31.61f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300))
{
sLog->outErrorDb("BatteGroundRL: Failed to spawn some object!");
LOG_ERROR("sql.sql", "BatteGroundRL: Failed to spawn some object!");
return false;
}

View file

@ -279,7 +279,7 @@ bool BattlegroundRV::SetupBattleground()
|| !AddObject(BG_RV_OBJECT_READY_MARKER_2, ARENA_READY_MARKER_ENTRY, 757.02f, -267.30f, 2.80f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 300)
)
{
sLog->outErrorDb("BatteGroundRV: Failed to spawn some object!");
LOG_ERROR("sql.sql", "BatteGroundRV: Failed to spawn some object!");
return false;
}

View file

@ -169,7 +169,7 @@ bool BattlegroundSA::ResetObjs()
if (!sg)
{
sLog->outError("SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
LOG_ERROR("server", "SOTA: Can't find GY entry %u", BG_SA_GYEntries[i]);
return false;
}
@ -182,7 +182,7 @@ bool BattlegroundSA::ResetObjs()
{
GraveyardStatus[i] = GetOtherTeamId(Attackers);
if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], GetOtherTeamId(Attackers)))
sLog->outError("SOTA: couldn't spawn GY: %u", i);
LOG_ERROR("server", "SOTA: couldn't spawn GY: %u", i);
}
}
@ -911,7 +911,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source)
GraveyardStruct const* sg = sGraveyard->GetGraveyard(BG_SA_GYEntries[i]);
if (!sg)
{
sLog->outError("BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]);
LOG_ERROR("server", "BattlegroundSA::CaptureGraveyard: non-existant GY entry: %u", BG_SA_GYEntries[i]);
return;
}

View file

@ -414,14 +414,14 @@ bool BattlegroundWS::SetupBattleground()
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i < BG_WS_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!");
LOG_ERROR("sql.sql", "BatteGroundWS: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = WS_SPIRIT_MAIN_ALLIANCE; i < BG_CREATURES_MAX_WS; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundWS: Failed to spawn spirit guides Battleground not created!");
LOG_ERROR("sql.sql", "BatteGroundWS: Failed to spawn spirit guides Battleground not created!");
return false;
}

View file

@ -76,7 +76,7 @@ void CalendarMgr::LoadFromDB()
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u calendar events", count);
LOG_INFO("server", ">> Loaded %u calendar events", count);
count = 0;
// 0 1 2 3 4 5 6 7
@ -102,8 +102,8 @@ void CalendarMgr::LoadFromDB()
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u calendar invites", count);
sLog->outString();
LOG_INFO("server", ">> Loaded %u calendar invites", count);
LOG_INFO("server", " ");
for (uint64 i = 1; i < _maxEventId; ++i)
if (!GetEvent(i))
@ -315,7 +315,7 @@ CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId) const
return *itr2;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
LOG_DEBUG("entities.unit", "CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
#endif
return nullptr;
}

View file

@ -98,7 +98,7 @@ void Channel::UpdateChannelInDB() const
CharacterDatabase.Execute(stmt);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", _name.c_str());
LOG_DEBUG("chat.system", "Channel(%s) updated in database", _name.c_str());
#endif
}
}
@ -509,7 +509,7 @@ void Channel::UnBan(Player const* player, std::string const& badname)
}
if (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN)
sLog->outCommand(player->GetSession()->GetAccountId(), "Command: /unban %s %s (Moderator %s [guid: %u, account: %u] unbanned %s [guid: %u])", GetName().c_str(), badname.c_str(), player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), badname.c_str(), GUID_LOPART(victim));
LOG_GM(player->GetSession()->GetAccountId(), "Command: /unban %s %s (Moderator %s [guid: %u, account: %u] unbanned %s [guid: %u])", GetName().c_str(), badname.c_str(), player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), badname.c_str(), GUID_LOPART(victim));
bannedStore.erase(GUID_LOPART(victim));
RemoveChannelBanFromDB(GUID_LOPART(victim));
@ -696,7 +696,7 @@ void Channel::List(Player const* player)
}
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_LIST %s Channel: %s", player->GetSession()->GetPlayerInfo().c_str(), GetName().c_str());
LOG_DEBUG("chat.system", "SMSG_CHANNEL_LIST %s Channel: %s", player->GetSession()->GetPlayerInfo().c_str(), GetName().c_str());
#endif
WorldPacket data(SMSG_CHANNEL_LIST, 1 + (GetName().size() + 1) + 1 + 4 + playersStore.size() * (8 + 1));
data << uint8(1); // channel type?

View file

@ -42,7 +42,7 @@ void ChannelMgr::LoadChannels()
QueryResult result = CharacterDatabase.PQuery("SELECT channelId, name, team, announce, ownership, password FROM channels WHERE team = %u ORDER BY channelId ASC", _teamId);
if (!result)
{
sLog->outString(">> Loaded 0 channels for %s", _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde");
LOG_INFO("server", ">> Loaded 0 channels for %s", _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde");
return;
}
@ -78,8 +78,8 @@ void ChannelMgr::LoadChannels()
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u channels for %s in %ums", count, _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde", GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u channels for %s in %ums", count, _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde", GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
Channel* ChannelMgr::GetJoinChannel(std::string const& name, uint32 channelId)
@ -135,8 +135,8 @@ void ChannelMgr::LoadChannelRights()
QueryResult result = CharacterDatabase.Query("SELECT name, flags, speakdelay, joinmessage, delaymessage, moderators FROM channels_rights");
if (!result)
{
sLog->outString(">> Loaded 0 Channel Rights!");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 Channel Rights!");
LOG_INFO("server", " ");
return;
}
@ -162,8 +162,8 @@ void ChannelMgr::LoadChannelRights()
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %d Channel Rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %d Channel Rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
const ChannelRights& ChannelMgr::GetChannelRightsFor(const std::string& name)

View file

@ -316,14 +316,20 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
zoneName = zone->area_name[locale];
}
sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (%ul) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%ul)]",
fullcmd.c_str(), player->GetName().c_str(), GUID_LOPART(player->GetGUID()),
m_session->GetAccountId(), player->GetPositionX(), player->GetPositionY(),
player->GetPositionZ(), player->GetMapId(),
player->GetMap()->GetMapName(),
areaId, areaName.c_str(), zoneName.c_str(),
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
GUID_LOPART(guid));
LOG_GM(m_session->GetAccountId(), "Command: %s [Player: %s (%u) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected: %s (%ul)]",
fullcmd.c_str(),
player->GetName().c_str(),
GUID_LOPART(player->GetGUID()),
m_session->GetAccountId(),
player->GetPositionX(),
player->GetPositionY(),
player->GetPositionZ(),
player->GetMapId(),
player->GetMap()->GetMapName(),
areaId, areaName.c_str(),
zoneName.c_str(),
(player->GetSelectedUnit()) ? player->GetSelectedUnit()->GetName().c_str() : "",
GUID_LOPART(guid));
}
}
// some commands have custom error messages. Don't send the default one in these cases.
@ -372,12 +378,12 @@ bool ChatHandler::SetDataForCommandInTable(std::vector<ChatCommand>& table, char
// expected subcommand by full name DB content
else if (*text)
{
sLog->outError("Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str());
LOG_ERROR("server", "Table `command` have unexpected subcommand '%s' in command '%s', skip.", text, fullcommand.c_str());
return false;
}
//if (table[i].SecurityLevel != security)
// sLog->outDetail("Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security);
// LOG_DEBUG("server", "Table `command` overwrite for command '%s' default security (%u) by %u", fullcommand.c_str(), table[i].SecurityLevel, security);
table[i].SecurityLevel = security;
table[i].Help = help;
@ -388,9 +394,9 @@ bool ChatHandler::SetDataForCommandInTable(std::vector<ChatCommand>& table, char
if (!cmd.empty())
{
if (&table == &getCommandTable())
sLog->outError("Table `command` have non-existing command '%s', skip.", cmd.c_str());
LOG_ERROR("server", "Table `command` have non-existing command '%s', skip.", cmd.c_str());
else
sLog->outError("Table `command` have non-existing subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str());
LOG_ERROR("server", "Table `command` have non-existing subcommand '%s' in command '%s', skip.", cmd.c_str(), fullcommand.c_str());
}
return false;

View file

@ -66,7 +66,7 @@ inline bool CheckDelimiter(std::istringstream& iss, char delimiter, const char*
if (c != delimiter)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): invalid %s link structure ('%c' expected, '%c' found)", iss.str().c_str(), context, delimiter, c);
#endif
return false;
}
@ -102,7 +102,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, itemEntry))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str());
#endif
return false;
}
@ -111,7 +111,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
if (!_item)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry);
#endif
return false;
}
@ -119,7 +119,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
if (_color != ItemQualityColors[_item->Quality])
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->Quality], _color);
#endif
return false;
}
@ -135,7 +135,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
if (!ReadInt32(iss, id))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item property (%u)", iss.str().c_str(), index);
#endif
return false;
}
@ -148,7 +148,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
if (!_property)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid item property id %u in |item command", iss.str().c_str(), id);
#endif
return false;
}
@ -159,7 +159,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
if (!_suffix)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid item suffix id %u in |item command", iss.str().c_str(), -id);
#endif
return false;
}
@ -205,7 +205,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context)
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (!res)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item (id: %u) name wasn't found in any localization", context, _item->ItemId);
#endif
return res;
}
@ -219,7 +219,7 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, questId))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest entry", iss.str().c_str());
#endif
return false;
}
@ -228,7 +228,7 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
if (!_quest)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): quest template %u not found", iss.str().c_str(), questId);
#endif
return false;
}
@ -239,7 +239,7 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
if (!ReadInt32(iss, _questLevel))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading quest level", iss.str().c_str());
#endif
return false;
}
@ -247,7 +247,7 @@ bool QuestChatLink::Initialize(std::istringstream& iss)
if (_questLevel >= STRONG_MAX_LEVEL)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): quest level %d is too big", iss.str().c_str(), _questLevel);
#endif
return false;
}
@ -270,7 +270,7 @@ bool QuestChatLink::ValidateName(char* buffer, const char* context)
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (!res)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): linked quest (id: %u) title wasn't found in any localization", context, _quest->GetQuestId());
#endif
return res;
}
@ -286,7 +286,7 @@ bool SpellChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, spellId))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading spell entry", iss.str().c_str());
#endif
return false;
}
@ -295,7 +295,7 @@ bool SpellChatLink::Initialize(std::istringstream& iss)
if (!_spell)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId);
#endif
return false;
}
@ -313,7 +313,7 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
if (bounds.first == bounds.second)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id);
#endif
return false;
}
@ -321,7 +321,7 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
if (!skillInfo)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id);
#endif
return false;
}
@ -329,7 +329,7 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
if (!skillLine)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId);
#endif
return false;
}
@ -358,7 +358,7 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (!res)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id);
#endif
return res;
}
@ -374,7 +374,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, achievementId))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
#endif
return false;
}
@ -383,7 +383,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
if (!_achievement)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid achivement id %u in |achievement command", iss.str().c_str(), achievementId);
#endif
return false;
}
@ -394,7 +394,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
if (!ReadHex(iss, _guid, 0))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading char's guid", iss.str().c_str());
#endif
return false;
}
@ -408,7 +408,7 @@ bool AchievementChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, _data[index]))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement property (%u)", iss.str().c_str(), index);
#endif
return false;
}
@ -430,7 +430,7 @@ bool AchievementChatLink::ValidateName(char* buffer, const char* context)
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (!res)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID);
#endif
return res;
}
@ -446,7 +446,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, spellId))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement entry", iss.str().c_str());
#endif
return false;
}
@ -455,7 +455,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
if (!_spell)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId);
#endif
return false;
}
@ -466,7 +466,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
if (!ReadInt32(iss, _minSkillLevel))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading minimum talent level", iss.str().c_str());
#endif
return false;
}
@ -477,7 +477,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
if (!ReadInt32(iss, _maxSkillLevel))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading maximum talent level", iss.str().c_str());
#endif
return false;
}
@ -488,7 +488,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
if (!ReadHex(iss, _guid, 0))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading achievement's owner guid", iss.str().c_str());
#endif
return false;
}
@ -507,7 +507,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, _talentId))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent entry", iss.str().c_str());
#endif
return false;
}
@ -516,7 +516,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
if (!talentInfo)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId);
#endif
return false;
}
@ -525,7 +525,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
if (!_spell)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]);
#endif
return false;
}
@ -536,7 +536,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
if (!ReadInt32(iss, _rankId))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading talent rank", iss.str().c_str());
#endif
return false;
}
@ -554,7 +554,7 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, spellId))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading enchantment spell entry", iss.str().c_str());
#endif
return false;
}
@ -563,7 +563,7 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss)
if (!_spell)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId);
#endif
return false;
}
@ -580,7 +580,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, _slotId))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading slot id", iss.str().c_str());
#endif
return false;
}
@ -592,7 +592,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
if (!ReadUInt32(iss, glyphId))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading glyph entry", iss.str().c_str());
#endif
return false;
}
@ -601,7 +601,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
if (!_glyph)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid glyph id %u in |glyph command", iss.str().c_str(), glyphId);
#endif
return false;
}
@ -610,7 +610,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
if (!_spell)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId);
#endif
return false;
}
@ -650,7 +650,7 @@ bool LinkExtractor::IsValidMessage()
else if (_iss.get() != PIPE_CHAR)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence aborted unexpectedly", _iss.str().c_str());
#endif
return false;
}
@ -659,7 +659,7 @@ bool LinkExtractor::IsValidMessage()
if (_iss.peek() == '\0')
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): pipe followed by '\\0'", _iss.str().c_str());
#endif
return false;
}
@ -684,7 +684,7 @@ bool LinkExtractor::IsValidMessage()
else
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): invalid sequence, expected '%c' but got '%c'", _iss.str().c_str(), *validSequenceIterator, commandChar);
#endif
return false;
}
@ -693,7 +693,7 @@ bool LinkExtractor::IsValidMessage()
{
// no escaped pipes in sequences
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got escaped pipe in sequence", _iss.str().c_str());
#endif
return false;
}
@ -704,7 +704,7 @@ bool LinkExtractor::IsValidMessage()
if (!ReadHex(_iss, color, 8))
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): invalid hexadecimal number while reading color", _iss.str().c_str());
#endif
return false;
}
@ -715,7 +715,7 @@ bool LinkExtractor::IsValidMessage()
if (_iss.eof())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
#endif
return false;
}
@ -739,7 +739,7 @@ bool LinkExtractor::IsValidMessage()
else
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): user sent unsupported link type '%s'", _iss.str().c_str(), buffer);
#endif
return false;
}
@ -756,7 +756,7 @@ bool LinkExtractor::IsValidMessage()
if (_iss.get() != '[')
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): link caption doesn't start with '['", _iss.str().c_str());
#endif
return false;
}
@ -764,7 +764,7 @@ bool LinkExtractor::IsValidMessage()
if (_iss.eof())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly", _iss.str().c_str());
#endif
return false;
}
@ -784,7 +784,7 @@ bool LinkExtractor::IsValidMessage()
break;
default:
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar);
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid command |%c", _iss.str().c_str(), commandChar);
#endif
return false;
}
@ -794,7 +794,7 @@ bool LinkExtractor::IsValidMessage()
if (validSequence != validSequenceIterator)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str());
LOG_DEBUG("chat.system", "ChatHandler::isValidChatMessage('%s'): EOF in active sequence", _iss.str().c_str());
#endif
return false;
}

File diff suppressed because it is too large Load diff

View file

@ -49,8 +49,8 @@ namespace DisableMgr
if (!result)
{
sLog->outString(">> Loaded 0 disables. DB table `disables` is empty!");
sLog->outString();
LOG_INFO("server", ">> Loaded 0 disables. DB table `disables` is empty!");
LOG_INFO("server", " ");
return;
}
@ -61,7 +61,7 @@ namespace DisableMgr
DisableType type = DisableType(fields[0].GetUInt32());
if (type >= MAX_DISABLE_TYPES)
{
sLog->outErrorDb("Invalid type %u specified in `disables` table, skipped.", type);
LOG_ERROR("sql.sql", "Invalid type %u specified in `disables` table, skipped.", type);
continue;
}
@ -78,22 +78,22 @@ namespace DisableMgr
case DISABLE_TYPE_GO_LOS:
if (!sObjectMgr->GetGameObjectTemplate(entry))
{
sLog->outErrorDb("Gameobject entry %u from `disables` doesn't exist in dbc, skipped.", entry);
LOG_ERROR("sql.sql", "Gameobject entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (flags)
sLog->outErrorDb("Disable flags specified for gameobject %u, useless data.", entry);
LOG_ERROR("sql.sql", "Disable flags specified for gameobject %u, useless data.", entry);
break;
case DISABLE_TYPE_SPELL:
if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
{
sLog->outErrorDb("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
LOG_ERROR("sql.sql", "Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (!flags || flags > MAX_SPELL_DISABLE_TYPE)
{
sLog->outErrorDb("Disable flags for spell %u are invalid, skipped.", entry);
LOG_ERROR("sql.sql", "Disable flags for spell %u are invalid, skipped.", entry);
continue;
}
@ -128,7 +128,7 @@ namespace DisableMgr
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
if (!mapEntry)
{
sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
LOG_ERROR("sql.sql", "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
bool isFlagInvalid = false;
@ -149,12 +149,12 @@ namespace DisableMgr
break;
case MAP_BATTLEGROUND:
case MAP_ARENA:
sLog->outErrorDb("Battleground map %u specified to be disabled in map case, skipped.", entry);
LOG_ERROR("sql.sql", "Battleground map %u specified to be disabled in map case, skipped.", entry);
continue;
}
if (isFlagInvalid)
{
sLog->outErrorDb("Disable flags for map %u are invalid, skipped.", entry);
LOG_ERROR("sql.sql", "Disable flags for map %u are invalid, skipped.", entry);
continue;
}
break;
@ -162,64 +162,64 @@ namespace DisableMgr
case DISABLE_TYPE_BATTLEGROUND:
if (!sBattlemasterListStore.LookupEntry(entry))
{
sLog->outErrorDb("Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
LOG_ERROR("sql.sql", "Battleground entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (flags)
sLog->outErrorDb("Disable flags specified for battleground %u, useless data.", entry);
LOG_ERROR("sql.sql", "Disable flags specified for battleground %u, useless data.", entry);
break;
case DISABLE_TYPE_OUTDOORPVP:
if (entry > MAX_OUTDOORPVP_TYPES)
{
sLog->outErrorDb("OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
LOG_ERROR("sql.sql", "OutdoorPvPTypes value %u from `disables` is invalid, skipped.", entry);
continue;
}
if (flags)
sLog->outErrorDb("Disable flags specified for outdoor PvP %u, useless data.", entry);
LOG_ERROR("sql.sql", "Disable flags specified for outdoor PvP %u, useless data.", entry);
break;
case DISABLE_TYPE_ACHIEVEMENT_CRITERIA:
if (!sAchievementCriteriaStore.LookupEntry(entry))
{
sLog->outErrorDb("Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry);
LOG_ERROR("sql.sql", "Achievement Criteria entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
if (flags)
sLog->outErrorDb("Disable flags specified for Achievement Criteria %u, useless data.", entry);
LOG_ERROR("sql.sql", "Disable flags specified for Achievement Criteria %u, useless data.", entry);
break;
case DISABLE_TYPE_VMAP:
{
MapEntry const* mapEntry = sMapStore.LookupEntry(entry);
if (!mapEntry)
{
sLog->outErrorDb("Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
LOG_ERROR("sql.sql", "Map entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
}
switch (mapEntry->map_type)
{
case MAP_COMMON:
if (flags & VMAP_DISABLE_AREAFLAG)
sLog->outString("Areaflag disabled for world map %u.", entry);
LOG_INFO("server", "Areaflag disabled for world map %u.", entry);
if (flags & VMAP_DISABLE_LIQUIDSTATUS)
sLog->outString("Liquid status disabled for world map %u.", entry);
LOG_INFO("server", "Liquid status disabled for world map %u.", entry);
break;
case MAP_INSTANCE:
case MAP_RAID:
if (flags & VMAP_DISABLE_HEIGHT)
sLog->outString("Height disabled for instance map %u.", entry);
LOG_INFO("server", "Height disabled for instance map %u.", entry);
if (flags & VMAP_DISABLE_LOS)
sLog->outString("LoS disabled for instance map %u.", entry);
LOG_INFO("server", "LoS disabled for instance map %u.", entry);
break;
case MAP_BATTLEGROUND:
if (flags & VMAP_DISABLE_HEIGHT)
sLog->outString("Height disabled for battleground map %u.", entry);
LOG_INFO("server", "Height disabled for battleground map %u.", entry);
if (flags & VMAP_DISABLE_LOS)
sLog->outString("LoS disabled for battleground map %u.", entry);
LOG_INFO("server", "LoS disabled for battleground map %u.", entry);
break;
case MAP_ARENA:
if (flags & VMAP_DISABLE_HEIGHT)
sLog->outString("Height disabled for arena map %u.", entry);
LOG_INFO("server", "Height disabled for arena map %u.", entry);
if (flags & VMAP_DISABLE_LOS)
sLog->outString("LoS disabled for arena map %u.", entry);
LOG_INFO("server", "LoS disabled for arena map %u.", entry);
break;
default:
break;
@ -234,8 +234,8 @@ namespace DisableMgr
++total_count;
} while (result->NextRow());
sLog->outString(">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void CheckQuestDisables()
@ -245,8 +245,8 @@ namespace DisableMgr
uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size();
if (!count)
{
sLog->outString(">> Checked 0 quest disables.");
sLog->outString();
LOG_INFO("server", ">> Checked 0 quest disables.");
LOG_INFO("server", " ");
return;
}
@ -256,17 +256,17 @@ namespace DisableMgr
const uint32 entry = itr->first;
if (!sObjectMgr->GetQuestTemplate(entry))
{
sLog->outErrorDb("Quest entry %u from `disables` doesn't exist, skipped.", entry);
LOG_ERROR("sql.sql", "Quest entry %u from `disables` doesn't exist, skipped.", entry);
m_DisableMap[DISABLE_TYPE_QUEST].erase(itr++);
continue;
}
if (itr->second.flags)
sLog->outErrorDb("Disable flags specified for quest %u, useless data.", entry);
LOG_ERROR("sql.sql", "Disable flags specified for quest %u, useless data.", entry);
++itr;
}
sLog->outString(">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags)

View file

@ -183,7 +183,7 @@ uint32 DBCFileCount = 0;
static bool LoadDBC_assert_print(uint32 fsize, uint32 rsize, const std::string& filename)
{
sLog->outError("Size of '%s' set by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
LOG_ERROR("server", "Size of '%s' set by format string (%u) not equal size of C++ structure (%u).", filename.c_str(), fsize, rsize);
// ASSERT must fail after function call
return false;
@ -425,7 +425,7 @@ void LoadDBCStores(const std::string& dataPath)
if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x]))
{
if (spellDiff->SpellID[x] > 0) //don't show error if spell is <= 0, not all modes have spells and there are unknown negative values
sLog->outErrorDb("spelldifficulty_dbc: spell %i at field id: %u at spellid %i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
LOG_ERROR("sql.sql", "spelldifficulty_dbc: spell %i at field id: %u at spellid %i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x);
newEntry.SpellID[x] = 0; // spell was <= 0 or invalid, set to 0
}
@ -565,7 +565,7 @@ void LoadDBCStores(const std::string& dataPath)
// error checks
if (bad_dbc_files.size() >= DBCFileCount)
{
sLog->outError("Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str());
LOG_ERROR("server", "Incorrect DataDir value in worldserver.conf or ALL required *.dbc files (%d) not found by path: %sdbc", DBCFileCount, dataPath.c_str());
exit(1);
}
else if (!bad_dbc_files.empty())
@ -574,7 +574,7 @@ void LoadDBCStores(const std::string& dataPath)
for (StoreProblemList::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
str += *i + "\n";
sLog->outError("Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str());
LOG_ERROR("server", "Some required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFileCount, str.c_str());
exit(1);
}
@ -586,14 +586,14 @@ void LoadDBCStores(const std::string& dataPath)
!sMapStore.LookupEntry(724) || // last map added in 3.3.5a
!sSpellStore.LookupEntry(80864) ) // last client known item added in 3.3.5a
{
sLog->outError("You have _outdated_ DBC data. Please extract correct versions from current using client.");
LOG_ERROR("server", "You have _outdated_ DBC data. Please extract correct versions from current using client.");
exit(1);
}
LoadM2Cameras(dataPath);
sLog->outString(">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
// Convert the geomoetry from a spline value, to an actual WoW XYZ
@ -775,7 +775,7 @@ bool readCamera(M2Camera const* cam, uint32 buffSize, M2Header const* header, Ci
void LoadM2Cameras(const std::string& dataPath)
{
sFlyByCameraStore.clear();
sLog->outString(">> Loading Cinematic Camera files");
LOG_INFO("server", ">> Loading Cinematic Camera files");
uint32 oldMSTime = getMSTime();
for (uint32 i = 0; i < sCinematicCameraStore.GetNumRows(); ++i)
@ -813,7 +813,7 @@ void LoadM2Cameras(const std::string& dataPath)
// Reject if not at least the size of the header
if (static_cast<uint32>(fileSize) < sizeof(M2Header))
{
sLog->outError("Camera file %s is damaged. File is smaller than header size", filename.c_str());
LOG_ERROR("server", "Camera file %s is damaged. File is smaller than header size", filename.c_str());
m2file.close();
continue;
}
@ -827,7 +827,7 @@ void LoadM2Cameras(const std::string& dataPath)
// Check file has correct magic (MD20)
if (strcmp(fileCheck, "MD20"))
{
sLog->outError("Camera file %s is damaged. File identifier not found", filename.c_str());
LOG_ERROR("server", "Camera file %s is damaged. File identifier not found", filename.c_str());
m2file.close();
continue;
}
@ -847,7 +847,7 @@ void LoadM2Cameras(const std::string& dataPath)
if (header->ofsCameras + sizeof(M2Camera) > static_cast<uint32>(fileSize))
{
sLog->outError("Camera file %s is damaged. Camera references position beyond file end", filename.c_str());
LOG_ERROR("server", "Camera file %s is damaged. Camera references position beyond file end", filename.c_str());
continue;
}
@ -855,11 +855,11 @@ void LoadM2Cameras(const std::string& dataPath)
M2Camera const* cam = reinterpret_cast<M2Camera const*>(buffer.data() + header->ofsCameras);
if (!readCamera(cam, fileSize, header, dbcentry))
{
sLog->outError("Camera file %s is damaged. Camera references position beyond file end", filename.c_str());
LOG_ERROR("server", "Camera file %s is damaged. Camera references position beyond file end", filename.c_str());
}
}
}
sLog->outString(">> Loaded %u cinematic waypoint sets in %u ms", (uint32)sFlyByCameraStore.size(), GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", ">> Loaded %u cinematic waypoint sets in %u ms", (uint32)sFlyByCameraStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
SimpleFactionsList const* GetFactionTeamList(uint32 faction)

View file

@ -106,7 +106,7 @@ namespace lfg
if (!result)
{
sLog->outError(">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
LOG_ERROR("server", ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
return;
}
@ -123,25 +123,25 @@ namespace lfg
if (!GetLFGDungeonEntry(dungeonId))
{
sLog->outError("Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
LOG_ERROR("server", "Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
continue;
}
if (!maxLevel || maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
sLog->outError("Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId);
LOG_ERROR("server", "Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId);
maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
}
if (!firstQuestId || !sObjectMgr->GetQuestTemplate(firstQuestId))
{
sLog->outError("First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId);
LOG_ERROR("server", "First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId);
continue;
}
if (otherQuestId && !sObjectMgr->GetQuestTemplate(otherQuestId))
{
sLog->outError("Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId);
LOG_ERROR("server", "Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId);
otherQuestId = 0;
}
@ -149,8 +149,8 @@ namespace lfg
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id)
@ -192,8 +192,8 @@ namespace lfg
if (!result)
{
sLog->outError(">> Loaded 0 lfg entrance positions. DB table `lfg_dungeon_template` is empty!");
sLog->outString();
LOG_ERROR("server", ">> Loaded 0 lfg entrance positions. DB table `lfg_dungeon_template` is empty!");
LOG_INFO("server", " ");
return;
}
@ -206,7 +206,7 @@ namespace lfg
LFGDungeonContainer::iterator dungeonItr = LfgDungeonStore.find(dungeonId);
if (dungeonItr == LfgDungeonStore.end())
{
sLog->outError("table `lfg_dungeon_template` contains coordinates for wrong dungeon %u", dungeonId);
LOG_ERROR("server", "table `lfg_dungeon_template` contains coordinates for wrong dungeon %u", dungeonId);
continue;
}
@ -219,8 +219,8 @@ namespace lfg
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u lfg entrance positions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u lfg entrance positions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
// Fill all other teleport coords from areatriggers
for (LFGDungeonContainer::iterator itr = LfgDungeonStore.begin(); itr != LfgDungeonStore.end(); ++itr)
@ -233,7 +233,7 @@ namespace lfg
AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(dungeon.map);
if (!at)
{
sLog->outError("LFGMgr::LoadLFGDungeons: Failed to load dungeon %s, cant find areatrigger for map %u", dungeon.name.c_str(), dungeon.map);
LOG_ERROR("server", "LFGMgr::LoadLFGDungeons: Failed to load dungeon %s, cant find areatrigger for map %u", dungeon.name.c_str(), dungeon.map);
continue;
}
@ -580,7 +580,7 @@ namespace lfg
isRaid = true;
break;
default:
sLog->outError("Wrong dungeon type %u for dungeon %u", type, *it);
LOG_ERROR("server", "Wrong dungeon type %u for dungeon %u", type, *it);
joinData.result = LFG_JOIN_DUNGEON_INVALID;
break;
}
@ -666,7 +666,7 @@ namespace lfg
if (joinData.result != LFG_JOIN_OK)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Join: [" UI64FMTD "] joining with %u members. result: %u", guid, grp ? grp->GetMembersCount() : 1, joinData.result);
LOG_DEBUG("lfg", "LFGMgr::Join: [" UI64FMTD "] joining with %u members. result: %u", guid, grp ? grp->GetMembersCount() : 1, joinData.result);
#endif
if (!dungeons.empty()) // Only should show lockmap when have no dungeons available
joinData.lockmap.clear();
@ -759,7 +759,7 @@ namespace lfg
o << "LFGMgr::Join: [" << guid << "] joined (" << (grp ? "group" : "player") << ") Members: " << debugNames.c_str()
<< ". Dungeons (" << uint32(dungeons.size()) << "): " << ConcatenateDungeons(dungeons);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug((LOG_FILTER_LFG, "%s", o.str().c_str());
LOG_DEBUG("lfg", "%s", o.str().c_str());
#endif
}*/
}
@ -772,7 +772,7 @@ namespace lfg
*/
void LFGMgr::LeaveLfg(uint64 guid)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Leave: [" UI64FMTD "]", guid);
LOG_DEBUG("lfg", "LFGMgr::Leave: [" UI64FMTD "]", guid);
uint64 gguid = IS_GROUP_GUID(guid) ? guid : GetGroup(guid);
LfgState state = GetState(guid);
switch (state)
@ -1659,7 +1659,7 @@ namespace lfg
player.accept = LfgAnswer(accept);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::UpdateProposal: Player [" UI64FMTD "] of proposal %u selected: %u", guid, proposalId, accept);
LOG_DEBUG("lfg", "LFGMgr::UpdateProposal: Player [" UI64FMTD "] of proposal %u selected: %u", guid, proposalId, accept);
#endif
if (!accept)
{
@ -1752,7 +1752,7 @@ namespace lfg
proposal.state = LFG_PROPOSAL_FAILED;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: Proposal %u, state FAILED, UpdateType %u", itProposal->first, type);
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: Proposal %u, state FAILED, UpdateType %u", itProposal->first, type);
#endif
// Mark all people that didn't answered as no accept
if (type == LFG_UPDATETYPE_PROPOSAL_FAILED)
@ -1798,14 +1798,14 @@ namespace lfg
{
updateData.updateType = type;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: [" UI64FMTD "] didn't accept. Removing from queue and compatible cache", guid);
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: [" UI64FMTD "] didn't accept. Removing from queue and compatible cache", guid);
#endif
}
else
{
updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: [" UI64FMTD "] in same group that someone that didn't accept. Removing from queue and compatible cache", guid);
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: [" UI64FMTD "] in same group that someone that didn't accept. Removing from queue and compatible cache", guid);
#endif
}
@ -1821,7 +1821,7 @@ namespace lfg
else
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: Readding [" UI64FMTD "] to queue.", guid);
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: Readding [" UI64FMTD "] to queue.", guid);
#endif
SetState(guid, LFG_STATE_QUEUED);
if (gguid != guid)
@ -2031,7 +2031,7 @@ namespace lfg
if (error != LFG_TELEPORTERROR_OK)
player->GetSession()->SendLfgTeleportError(uint8(error));
//sLog->outDebug(LOG_FILTER_LFG, "TeleportPlayer: Player %s is being teleported in to map %u "
//LOG_DEBUG("lfg", "TeleportPlayer: Player %s is being teleported in to map %u "
// "(x: %f, y: %f, z: %f) Result: %u", player->GetName().c_str(), dungeon->map,
// dungeon->x, dungeon->y, dungeon->z, error);
}
@ -2047,13 +2047,13 @@ namespace lfg
uint32 gDungeonId = GetDungeon(gguid);
if (gDungeonId != dungeonId)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] Finished dungeon %u but group queued for %u. Ignoring", gguid, dungeonId, gDungeonId);
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [" UI64FMTD "] Finished dungeon %u but group queued for %u. Ignoring", gguid, dungeonId, gDungeonId);
return;
}
if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) // Shouldn't happen. Do not reward multiple times
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] Already rewarded group. Ignoring", gguid);
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [" UI64FMTD "] Already rewarded group. Ignoring", gguid);
return;
}
@ -2066,7 +2066,7 @@ namespace lfg
uint64 guid = (*it);
if (GetState(guid) == LFG_STATE_FINISHED_DUNGEON)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] Already rewarded player. Ignoring", guid);
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [" UI64FMTD "] Already rewarded player. Ignoring", guid);
continue;
}
@ -2082,14 +2082,14 @@ namespace lfg
if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal))
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] dungeon %u is not random or seasonal", guid, rDungeonId);
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [" UI64FMTD "] dungeon %u is not random or seasonal", guid, rDungeonId);
continue;
}
Player* player = ObjectAccessor::FindPlayer(guid);
if (!player || player->FindMap() != currMap) // pussywizard: currMap - multithreading crash if on other map (map id check is not enough, binding system is not reliable)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] not found in world", guid);
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [" UI64FMTD "] not found in world", guid);
continue;
}
@ -2098,7 +2098,7 @@ namespace lfg
if (player->GetMapId() != mapId)
{
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] is in map %u and should be in %u to get reward", guid, player->GetMapId(), mapId);
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [" UI64FMTD "] is in map %u and should be in %u to get reward", guid, player->GetMapId(), mapId);
continue;
}
@ -2136,7 +2136,7 @@ namespace lfg
}
// Give rewards
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::FinishDungeon: [" UI64FMTD "] done dungeon %u, %s previously done.", player->GetGUID(), GetDungeon(gguid), done ? " " : " not");
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [" UI64FMTD "] done dungeon %u, %s previously done.", player->GetGUID(), GetDungeon(gguid), done ? " " : " not");
LfgPlayerRewardData data = LfgPlayerRewardData(dungeon->Entry(), GetDungeon(gguid, false), done, quest);
player->GetSession()->SendLfgPlayerReward(data);
}
@ -2205,7 +2205,7 @@ namespace lfg
state = PlayersStore[guid].GetState();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetState: [" UI64FMTD "] = %u", guid, state);
LOG_DEBUG("lfg", "LFGMgr::GetState: [" UI64FMTD "] = %u", guid, state);
#endif
return state;
}
@ -2219,7 +2219,7 @@ namespace lfg
state = PlayersStore[guid].GetOldState();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetOldState: [" UI64FMTD "] = %u", guid, state);
LOG_DEBUG("lfg", "LFGMgr::GetOldState: [" UI64FMTD "] = %u", guid, state);
#endif
return state;
}
@ -2228,7 +2228,7 @@ namespace lfg
{
uint32 dungeon = GroupsStore[guid].GetDungeon(asId);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u = %u", guid, asId, dungeon);
LOG_DEBUG("lfg", "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u = %u", guid, asId, dungeon);
#endif
return dungeon;
}
@ -2242,7 +2242,7 @@ namespace lfg
mapId = dungeon->map;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetDungeonMapId: [" UI64FMTD "] = %u (DungeonId = %u)", guid, mapId, dungeonId);
LOG_DEBUG("lfg", "LFGMgr::GetDungeonMapId: [" UI64FMTD "] = %u (DungeonId = %u)", guid, mapId, dungeonId);
#endif
return mapId;
}
@ -2251,7 +2251,7 @@ namespace lfg
{
uint8 roles = PlayersStore[guid].GetRoles();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetRoles: [" UI64FMTD "] = %u", guid, roles);
LOG_DEBUG("lfg", "LFGMgr::GetRoles: [" UI64FMTD "] = %u", guid, roles);
#endif
return roles;
}
@ -2259,7 +2259,7 @@ namespace lfg
const std::string& LFGMgr::GetComment(uint64 guid)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, PlayersStore[guid].GetComment().c_str());
LOG_DEBUG("lfg", "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, PlayersStore[guid].GetComment().c_str());
#endif
return PlayersStore[guid].GetComment();
}
@ -2267,7 +2267,7 @@ namespace lfg
LfgDungeonSet const& LFGMgr::GetSelectedDungeons(uint64 guid)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
LOG_DEBUG("lfg", "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
#endif
return PlayersStore[guid].GetSelectedDungeons();
}
@ -2275,7 +2275,7 @@ namespace lfg
LfgLockMap const& LFGMgr::GetLockedDungeons(uint64 guid)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid);
LOG_DEBUG("lfg", "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid);
#endif
return PlayersStore[guid].GetLockedDungeons();
}
@ -2284,7 +2284,7 @@ namespace lfg
{
uint8 kicks = GroupsStore[guid].GetKicksLeft();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetKicksLeft: [" UI64FMTD "] = %u", guid, kicks);
LOG_DEBUG("lfg", "LFGMgr::GetKicksLeft: [" UI64FMTD "] = %u", guid, kicks);
#endif
return kicks;
}
@ -2298,7 +2298,7 @@ namespace lfg
{
std::string const& ps = GetStateString(data.GetState());
std::string const& os = GetStateString(data.GetOldState());
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RestoreState: Group: [" UI64FMTD "] (%s) State: %s, oldState: %s",
LOG_TRACE("lfg", "LFGMgr::RestoreState: Group: [" UI64FMTD "] (%s) State: %s, oldState: %s",
guid, debugMsg, ps.c_str(), os.c_str());
}*/
@ -2311,7 +2311,7 @@ namespace lfg
{
std::string const& ps = GetStateString(data.GetState());
std::string const& os = GetStateString(data.GetOldState());
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RestoreState: Player: [" UI64FMTD "] (%s) State: %s, oldState: %s",
LOG_TRACE("lfg", "LFGMgr::RestoreState: Player: [" UI64FMTD "] (%s) State: %s, oldState: %s",
guid, debugMsg, ps.c_str(), os.c_str());
}*/
data.RestoreState();
@ -2326,7 +2326,7 @@ namespace lfg
std::string ns = GetStateString(state);
std::string ps = GetStateString(data.GetState());
std::string os = GetStateString(data.GetOldState());
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetState: Group: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s", guid, ns.c_str(), ps.c_str(), os.c_str());
LOG_DEBUG("lfg", "LFGMgr::SetState: Group: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s", guid, ns.c_str(), ps.c_str(), os.c_str());
data.SetState(state);
}
else
@ -2335,7 +2335,7 @@ namespace lfg
std::string ns = GetStateString(state);
std::string ps = GetStateString(data.GetState());
std::string os = GetStateString(data.GetOldState());
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetState: Player: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s", guid, ns.c_str(), ps.c_str(), os.c_str());
LOG_DEBUG("lfg", "LFGMgr::SetState: Player: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s", guid, ns.c_str(), ps.c_str(), os.c_str());
data.SetState(state);
}
}
@ -2348,7 +2348,7 @@ namespace lfg
void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon);
LOG_DEBUG("lfg", "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon);
#endif
GroupsStore[guid].SetDungeon(dungeon);
}
@ -2356,7 +2356,7 @@ namespace lfg
void LFGMgr::SetRoles(uint64 guid, uint8 roles)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles);
LOG_DEBUG("lfg", "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles);
#endif
PlayersStore[guid].SetRoles(roles);
}
@ -2364,7 +2364,7 @@ namespace lfg
void LFGMgr::SetComment(uint64 guid, std::string const& comment)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str());
LOG_DEBUG("lfg", "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str());
#endif
PlayersStore[guid].SetComment(comment);
}
@ -2385,7 +2385,7 @@ namespace lfg
void LFGMgr::SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
LOG_DEBUG("lfg", "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
#endif
PlayersStore[guid].SetSelectedDungeons(dungeons);
}
@ -2393,7 +2393,7 @@ namespace lfg
void LFGMgr::SetLockedDungeons(uint64 guid, LfgLockMap const& lock)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
LOG_DEBUG("lfg", "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
#endif
PlayersStore[guid].SetLockedDungeons(lock);
}
@ -2401,7 +2401,7 @@ namespace lfg
void LFGMgr::DecreaseKicksLeft(uint64 guid)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid);
LOG_DEBUG("lfg", "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid);
#endif
GroupsStore[guid].DecreaseKicksLeft();
}
@ -2409,7 +2409,7 @@ namespace lfg
void LFGMgr::RemoveGroupData(uint64 guid)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid);
LOG_DEBUG("lfg", "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid);
#endif
LfgGroupDataContainer::iterator it = GroupsStore.find(guid);
if (it == GroupsStore.end())

View file

@ -31,20 +31,20 @@ namespace lfg
void LFGQueue::AddToQueue(uint64 guid, bool failedProposal)
{
//sLog->outString("ADD AddToQueue: %u, failed proposal: %u", GUID_LOPART(guid), failedProposal ? 1 : 0);
//LOG_INFO("server", "ADD AddToQueue: %u, failed proposal: %u", GUID_LOPART(guid), failedProposal ? 1 : 0);
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
if (itQueue == QueueDataStore.end())
{
sLog->outError("LFGQueue::AddToQueue: Queue data not found for [" UI64FMTD "]", guid);
LOG_ERROR("server", "LFGQueue::AddToQueue: Queue data not found for [" UI64FMTD "]", guid);
return;
}
//sLog->outString("AddToQueue success: %u", GUID_LOPART(guid));
//LOG_INFO("server", "AddToQueue success: %u", GUID_LOPART(guid));
AddToNewQueue(guid, failedProposal);
}
void LFGQueue::RemoveFromQueue(uint64 guid, bool partial)
{
//sLog->outString("REMOVE RemoveFromQueue: %u, partial: %u", GUID_LOPART(guid), partial ? 1 : 0);
//LOG_INFO("server", "REMOVE RemoveFromQueue: %u, partial: %u", GUID_LOPART(guid), partial ? 1 : 0);
RemoveFromNewQueue(guid);
RemoveFromCompatibles(guid);
@ -55,13 +55,13 @@ namespace lfg
{
if (itr->second.bestCompatible.hasGuid(guid))
{
//sLog->outString("CLEAR bestCompatible: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
//LOG_INFO("server", "CLEAR bestCompatible: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
itr->second.bestCompatible.clear();
}
}
else
{
//sLog->outString("CLEAR bestCompatible SELF: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
//LOG_INFO("server", "CLEAR bestCompatible SELF: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
//itr->second.bestCompatible.clear(); // don't clear here, because UpdateQueueTimers will try to find with every diff update
itDelete = itr;
}
@ -70,10 +70,10 @@ namespace lfg
// xinef: partial
if (!partial && itDelete != QueueDataStore.end())
{
//sLog->outString("ERASE QueueDataStore for: %u", GUID_LOPART(guid));
//sLog->outString("ERASE QueueDataStore for: %u, itDelete: %u,%u,%u", GUID_LOPART(guid), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
//LOG_INFO("server", "ERASE QueueDataStore for: %u", GUID_LOPART(guid));
//LOG_INFO("server", "ERASE QueueDataStore for: %u, itDelete: %u,%u,%u", GUID_LOPART(guid), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
QueueDataStore.erase(itDelete);
//sLog->outString("ERASE QueueDataStore for: %u SUCCESS", GUID_LOPART(guid));
//LOG_INFO("server", "ERASE QueueDataStore for: %u SUCCESS", GUID_LOPART(guid));
}
}
@ -81,34 +81,34 @@ namespace lfg
{
if (front)
{
//sLog->outString("ADD AddToNewQueue at FRONT: %u", GUID_LOPART(guid));
//LOG_INFO("server", "ADD AddToNewQueue at FRONT: %u", GUID_LOPART(guid));
restoredAfterProposal.push_back(guid);
newToQueueStore.push_front(guid);
}
else
{
//sLog->outString("ADD AddToNewQueue at the END: %u", GUID_LOPART(guid));
//LOG_INFO("server", "ADD AddToNewQueue at the END: %u", GUID_LOPART(guid));
newToQueueStore.push_back(guid);
}
}
void LFGQueue::RemoveFromNewQueue(uint64 guid)
{
//sLog->outString("REMOVE RemoveFromNewQueue: %u", GUID_LOPART(guid));
//LOG_INFO("server", "REMOVE RemoveFromNewQueue: %u", GUID_LOPART(guid));
newToQueueStore.remove(guid);
restoredAfterProposal.remove(guid);
}
void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
{
//sLog->outString("JOINED AddQueueData: %u", GUID_LOPART(guid));
//LOG_INFO("server", "JOINED AddQueueData: %u", GUID_LOPART(guid));
QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
AddToQueue(guid);
}
void LFGQueue::RemoveQueueData(uint64 guid)
{
//sLog->outString("LEFT RemoveQueueData: %u", GUID_LOPART(guid));
//LOG_INFO("server", "LEFT RemoveQueueData: %u", GUID_LOPART(guid));
LfgQueueDataContainer::iterator it = QueueDataStore.find(guid);
if (it != QueueDataStore.end())
QueueDataStore.erase(it);
@ -144,11 +144,11 @@ namespace lfg
void LFGQueue::RemoveFromCompatibles(uint64 guid)
{
//sLog->outString("COMPATIBLES REMOVE for: %u", GUID_LOPART(guid));
//LOG_INFO("server", "COMPATIBLES REMOVE for: %u", GUID_LOPART(guid));
for (LfgCompatibleContainer::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it)
if (it->hasGuid(guid))
{
//sLog->outString("Removed Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
//LOG_INFO("server", "Removed Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
it->clear(); // set to 0, this will be removed while iterating in FindNewGroups
}
for (LfgCompatibleContainer::iterator itr = CompatibleTempList.begin(); itr != CompatibleTempList.end(); )
@ -156,7 +156,7 @@ namespace lfg
LfgCompatibleContainer::iterator it = itr++;
if (it->hasGuid(guid))
{
//sLog->outString("Erased Temp Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
//LOG_INFO("server", "Erased Temp Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
CompatibleTempList.erase(it);
}
}
@ -164,20 +164,20 @@ namespace lfg
void LFGQueue::AddToCompatibles(Lfg5Guids const& key)
{
//sLog->outString("COMPATIBLES ADD: %s", key.toString().c_str());
//LOG_INFO("server", "COMPATIBLES ADD: %s", key.toString().c_str());
CompatibleTempList.push_back(key);
}
uint8 LFGQueue::FindGroups()
{
//sLog->outString("FIND GROUPS!");
//LOG_INFO("server", "FIND GROUPS!");
uint8 newGroupsProcessed = 0;
if (!newToQueueStore.empty())
{
++newGroupsProcessed;
uint64 newGuid = newToQueueStore.front();
bool pushCompatiblesToFront = (std::find(restoredAfterProposal.begin(), restoredAfterProposal.end(), newGuid) != restoredAfterProposal.end());
//sLog->outString("newToQueueStore guid: %u, front: %u", GUID_LOPART(newGuid), pushCompatiblesToFront ? 1 : 0);
//LOG_INFO("server", "newToQueueStore guid: %u, front: %u", GUID_LOPART(newGuid), pushCompatiblesToFront ? 1 : 0);
RemoveFromNewQueue(newGuid);
FindNewGroups(newGuid);
@ -197,7 +197,7 @@ namespace lfg
uint64 foundMask = 0;
uint32 foundCount = 0;
//sLog->outString("FIND NEW GROUPS for: %u", GUID_LOPART(newGuid));
//LOG_INFO("server", "FIND NEW GROUPS for: %u", GUID_LOPART(newGuid));
// we have to take into account that FindNewGroups is called every X minutes if number of compatibles is low!
// build set of already present compatibles for this guid
@ -225,7 +225,7 @@ namespace lfg
Lfg5GuidsList::iterator itr = it++;
if (itr->empty())
{
//sLog->outString("ERASE from CompatibleList");
//LOG_INFO("server", "ERASE from CompatibleList");
CompatibleList.erase(itr);
continue;
}
@ -241,7 +241,7 @@ namespace lfg
LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles)
{
//sLog->outString("CHECK CheckCompatibility: %s, new guid: %u", checkWith.toString().c_str(), GUID_LOPART(newGuid));
//LOG_INFO("server", "CHECK CheckCompatibility: %s, new guid: %u", checkWith.toString().c_str(), GUID_LOPART(newGuid));
Lfg5Guids check(checkWith, false); // here newGuid is at front
Lfg5Guids strGuids(checkWith, false); // here guids are sorted
check.force_insert_front(newGuid);
@ -266,7 +266,7 @@ namespace lfg
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
if (itQueue == QueueDataStore.end())
{
sLog->outError("LFGQueue::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", guid);
LOG_ERROR("server", "LFGQueue::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", guid);
RemoveFromQueue(guid);
return LFG_COMPATIBILITY_PENDING;
}
@ -320,7 +320,7 @@ namespace lfg
if (itRoles->first == itPlayer->first)
{
// pussywizard: LFG ZOMG! this means that this player was in two different LfgQueueData (in QueueDataStore), and at least one of them is a group guid, because we do checks so there aren't 2 same guids in current CHECK
//sLog->outError("LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
//LOG_ERROR("server", "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
break;
}
else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
@ -456,13 +456,13 @@ namespace lfg
else
m_QueueStatusTimer += diff;
//sLog->outString("UPDATE UpdateQueueTimers");
//LOG_INFO("server", "UPDATE UpdateQueueTimers");
for (Lfg5GuidsList::iterator it = CompatibleList.begin(); it != CompatibleList.end(); )
{
Lfg5GuidsList::iterator itr = it++;
if (itr->empty())
{
//sLog->outString("UpdateQueueTimers ERASE compatible");
//LOG_INFO("server", "UpdateQueueTimers ERASE compatible");
CompatibleList.erase(itr);
}
}
@ -492,7 +492,7 @@ namespace lfg
return;
}
//sLog->outTrace(LOG_FILTER_LFG, "Updating queue timers...");
// LOG_TRACE("lfg", "Updating queue timers...");
for (LfgQueueDataContainer::iterator itQueue = QueueDataStore.begin(); itQueue != QueueDataStore.end(); ++itQueue)
{
LfgQueueData& queueinfo = itQueue->second;
@ -530,7 +530,7 @@ namespace lfg
if (queueinfo.bestCompatible.empty())
{
//sLog->outString("found empty bestCompatible");
//LOG_INFO("server", "found empty bestCompatible");
FindBestCompatibleInQueue(itQueue);
}
@ -562,7 +562,7 @@ namespace lfg
void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key)
{
//sLog->outString("UpdateBestCompatibleInQueue: %s", key.toString().c_str());
//LOG_INFO("server", "UpdateBestCompatibleInQueue: %s", key.toString().c_str());
LfgQueueData& queueData = itrQueue->second;
uint8 storedSize = queueData.bestCompatible.size();

View file

@ -67,7 +67,7 @@ namespace lfg
uint64 gguid2 = group->GetGUID();
if (gguid != gguid2)
{
//sLog->outError("%s on group %u but LFG has group %u saved... Fixing.",
//LOG_ERROR("server", "%s on group %u but LFG has group %u saved... Fixing.",
// player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid));
sLFGMgr->SetupGroupMember(guid, group->GetGUID());
}
@ -103,7 +103,7 @@ namespace lfg
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, 0.0f);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGPlayerScript::OnMapChanged, Player %s (%u) is in LFG dungeon map but does not have a valid group! Teleporting to homebind.", player->GetName().c_str(), player->GetGUIDLow());
LOG_DEBUG("lfg", "LFGPlayerScript::OnMapChanged, Player %s (%u) is in LFG dungeon map but does not have a valid group! Teleporting to homebind.", player->GetName().c_str(), player->GetGUIDLow());
#endif
return;
}
@ -141,7 +141,7 @@ namespace lfg
if (leader == guid)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader);
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader);
#endif
sLFGMgr->SetLeader(gguid, guid);
}
@ -150,7 +150,7 @@ namespace lfg
LfgState gstate = sLFGMgr->GetState(gguid);
LfgState state = sLFGMgr->GetState(guid);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state);
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state);
#endif
if (state == LFG_STATE_QUEUED)
@ -185,7 +185,7 @@ namespace lfg
uint64 gguid = group->GetGUID();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
#endif
bool isLFG = group->isLFGGroup();
@ -246,7 +246,7 @@ namespace lfg
uint64 gguid = group->GetGUID();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
LOG_DEBUG("lfg", "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
#endif
// pussywizard: after all necessary actions handle raid browser
@ -264,7 +264,7 @@ namespace lfg
uint64 gguid = group->GetGUID();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
#endif
sLFGMgr->SetLeader(gguid, newLeaderGuid);
@ -284,7 +284,7 @@ namespace lfg
uint64 gguid = group->GetGUID();
uint64 leader = group->GetLeaderGUID();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
#endif
// No gguid == new group being formed
// No leader == after group creation first invite is new leader

View file

@ -65,7 +65,7 @@ bool Corpse::Create(uint32 guidlow, Player* owner)
if (!IsPositionValid())
{
sLog->outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
LOG_ERROR("server", "Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
guidlow, owner->GetName().c_str(), owner->GetPositionX(), owner->GetPositionY());
return false;
}
@ -168,7 +168,7 @@ bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
if (!IsPositionValid())
{
sLog->outError("Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
LOG_ERROR("server", "Corpse (guid: %u, owner: %u) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
GetGUIDLow(), GUID_LOPART(GetOwnerGUID()), posX, posY, posZ);
return false;
}

View file

@ -202,7 +202,7 @@ Creature::~Creature()
i_AI = nullptr;
//if (m_uint32Values)
// sLog->outError("Deconstruct Creature Entry = %u", GetEntry());
// LOG_ERROR("server", "Deconstruct Creature Entry = %u", GetEntry());
}
void Creature::AddToWorld()
@ -314,7 +314,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!normalInfo)
{
sLog->outErrorDb("Creature::InitEntry creature entry %u does not exist.", Entry);
LOG_ERROR("sql.sql", "Creature::InitEntry creature entry %u does not exist.", Entry);
return false;
}
@ -353,7 +353,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
// Cancel load if no model defined
if (!(cinfo->GetFirstValidModelId()))
{
sLog->outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
LOG_ERROR("sql.sql", "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
return false;
}
@ -361,7 +361,7 @@ bool Creature::InitEntry(uint32 Entry, const CreatureData* data)
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
if (!minfo) // Cancel load if no model defined
{
sLog->outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
LOG_ERROR("sql.sql", "Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry);
return false;
}
@ -517,11 +517,11 @@ void Creature::Update(uint32 diff)
{
case JUST_RESPAWNED:
// Must not be called, see Creature::setDeathState JUST_RESPAWNED -> ALIVE promoting.
sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry());
LOG_ERROR("server", "Creature (GUID: %u Entry: %u) in wrong state: JUST_RESPAWNED (4)", GetGUIDLow(), GetEntry());
break;
case JUST_DIED:
// Must not be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting.
sLog->outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry());
LOG_ERROR("server", "Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)", GetGUIDLow(), GetEntry());
break;
case DEAD:
{
@ -571,7 +571,7 @@ void Creature::Update(uint32 diff)
{
RemoveCorpse(false);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
LOG_DEBUG("server", "Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
#endif
}
break;
@ -659,10 +659,10 @@ void Creature::Update(uint32 diff)
if (sWorld->getBoolConfig(CONFIG_REGEN_HP_CANNOT_REACH_TARGET_IN_RAID) || !GetMap()->IsRaid())
{
RegenerateHealth();
sLog->outDebug(LOG_FILTER_UNITS, "RegenerateHealth() enabled because Creature cannot reach the target. Detail: %s", GetDebugInfo().c_str());
LOG_DEBUG("entities.unit", "RegenerateHealth() enabled because Creature cannot reach the target. Detail: %s", GetDebugInfo().c_str());
}
else
sLog->outDebug(LOG_FILTER_UNITS, "RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: %s", GetDebugInfo().c_str());
LOG_DEBUG("entities.unit", "RegenerateHealth() disabled even if the Creature cannot reach the target. Detail: %s", GetDebugInfo().c_str());
}
}
@ -873,7 +873,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai)
if (m_AI_locked)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_TSCR, "AIM_Initialize: failed to init, locked.");
LOG_DEBUG("scripts.ai", "AIM_Initialize: failed to init, locked.");
#endif
return false;
}
@ -918,7 +918,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!cinfo)
{
sLog->outErrorDb("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
LOG_ERROR("sql.sql", "Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
return false;
}
@ -932,7 +932,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
if (!IsPositionValid())
{
sLog->outError("Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang);
LOG_ERROR("server", "Creature::Create(): given coordinates for creature (guidlow %d, entry %d) are not valid (X: %f, Y: %f, Z: %f, O: %f)", guidlow, Entry, x, y, z, ang);
return false;
}
@ -1149,7 +1149,7 @@ void Creature::SaveToDB()
CreatureData const* data = sObjectMgr->GetCreatureData(m_DBTableGuid);
if (!data)
{
sLog->outError("Creature::SaveToDB failed, cannot get creature data!");
LOG_ERROR("server", "Creature::SaveToDB failed, cannot get creature data!");
return;
}
@ -1387,7 +1387,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, const
CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry);
if (!normalInfo)
{
sLog->outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
LOG_ERROR("sql.sql", "Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry);
return false;
}
@ -1437,7 +1437,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap, bool gri
if (!data)
{
sLog->outErrorDb("Creature (GUID: %u) not found in table `creature`, can't load. ", guid);
LOG_ERROR("sql.sql", "Creature (GUID: %u) not found in table `creature`, can't load. ", guid);
return false;
}
@ -1571,7 +1571,7 @@ void Creature::DeleteFromDB()
{
if (!m_DBTableGuid)
{
sLog->outError("Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry());
LOG_ERROR("server", "Trying to delete not saved creature! LowGUID: %u, Entry: %u", GetGUIDLow(), GetEntry());
return;
}
@ -1762,7 +1762,7 @@ void Creature::Respawn(bool force)
GetMap()->RemoveCreatureRespawnTime(m_DBTableGuid);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outStaticDebug("Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry());
LOG_DEBUG("server", "Respawning creature %s (GuidLow: %u, Full GUID: " UI64FMTD " Entry: %u)", GetName().c_str(), GetGUIDLow(), GetGUID(), GetEntry());
#endif
m_respawnTime = 0;
ResetPickPocketLootTime();
@ -1927,7 +1927,7 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
LOG_ERROR("server", "WORLD: unknown spell id %i", m_spells[i]);
continue;
}
@ -1975,7 +1975,7 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
LOG_ERROR("server", "WORLD: unknown spell id %i", m_spells[i]);
continue;
}
@ -2074,7 +2074,7 @@ void Creature::SendAIReaction(AiReaction reactionType)
((WorldObject*)this)->SendMessageToSet(&data, true);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType);
LOG_DEBUG("network", "WORLD: Sent SMSG_AI_REACTION, type %u.", reactionType);
#endif
}
@ -2404,7 +2404,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
if (!AdditionalSpellInfo)
{
sLog->outErrorDb("Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
LOG_ERROR("sql.sql", "Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
continue;
}
@ -2412,14 +2412,14 @@ bool Creature::LoadCreaturesAddon(bool reload)
if (HasAura(*itr))
{
if (!reload)
sLog->outErrorDb("Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
LOG_ERROR("sql.sql", "Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
continue;
}
AddAura(*itr, this);
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "Spell: %u added to creature (GUID: %u Entry: %u)", *itr, GetGUIDLow(), GetEntry());
LOG_DEBUG("entities.unit", "Spell: %u added to creature (GUID: %u Entry: %u)", *itr, GetGUIDLow(), GetEntry());
#endif
}
}
@ -2439,7 +2439,7 @@ void Creature::SetInCombatWithZone()
{
if (!CanHaveThreatList())
{
sLog->outError("Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
LOG_ERROR("server", "Creature entry %u call SetInCombatWithZone but creature cannot have threat list.", GetEntry());
return;
}
@ -2447,7 +2447,7 @@ void Creature::SetInCombatWithZone()
if (!map->IsDungeon())
{
sLog->outError("Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId());
LOG_ERROR("server", "Creature entry %u call SetInCombatWithZone for map (id: %u) that isn't an instance.", GetEntry(), map->GetId());
return;
}
@ -3157,7 +3157,7 @@ void Creature::SetCannotReachTarget(bool cannotReach)
m_cannotReachTimer = 0;
if (cannotReach)
sLog->outDebug(LOG_FILTER_UNITS, "Creature::SetCannotReachTarget() called with true. Details: %s", GetDebugInfo().c_str());
LOG_DEBUG("entities.unit", "Creature::SetCannotReachTarget() called with true. Details: %s", GetDebugInfo().c_str());
}
time_t Creature::GetLastDamagedTime() const

View file

@ -14,6 +14,7 @@
#include "LootMgr.h"
#include "Unit.h"
#include "UpdateMask.h"
#include "World.h"
#include <list>
class SpellInfo;

View file

@ -34,7 +34,7 @@ void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member)
if (itr != map->CreatureGroupHolder.end())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId());
LOG_DEBUG("entities.unit", "Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId());
#endif
itr->second->AddMember(member);
}
@ -42,7 +42,7 @@ void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member)
else
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "Group not found: %u. Creating new group.", groupId);
LOG_DEBUG("entities.unit", "Group not found: %u. Creating new group.", groupId);
#endif
CreatureGroup* group = new CreatureGroup(groupId);
map->CreatureGroupHolder[groupId] = group;
@ -53,7 +53,7 @@ void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member)
void FormationMgr::RemoveCreatureFromGroup(CreatureGroup* group, Creature* member)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow());
LOG_DEBUG("entities.unit", "Deleting member pointer to GUID: %u from group %u", group->GetId(), member->GetDBTableGUIDLow());
#endif
group->RemoveMember(member);
@ -64,7 +64,7 @@ void FormationMgr::RemoveCreatureFromGroup(CreatureGroup* group, Creature* membe
return;
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "Deleting group with InstanceID %u", member->GetInstanceId());
LOG_DEBUG("entities.unit", "Deleting group with InstanceID %u", member->GetInstanceId());
#endif
map->CreatureGroupHolder.erase(group->GetId());
delete group;
@ -84,8 +84,8 @@ void FormationMgr::LoadCreatureFormations()
if (!result)
{
sLog->outErrorDb(">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
sLog->outString();
LOG_ERROR("sql.sql", ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
LOG_INFO("server", " ");
return;
}
@ -120,14 +120,14 @@ void FormationMgr::LoadCreatureFormations()
{
if (!sObjectMgr->GetCreatureData(group_member->leaderGUID))
{
sLog->outErrorDb("creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
LOG_ERROR("sql.sql", "creature_formations table leader guid %u incorrect (not exist)", group_member->leaderGUID);
delete group_member;
continue;
}
if (!sObjectMgr->GetCreatureData(memberGUID))
{
sLog->outErrorDb("creature_formations table member guid %u incorrect (not exist)", memberGUID);
LOG_ERROR("sql.sql", "creature_formations table member guid %u incorrect (not exist)", memberGUID);
delete group_member;
continue;
}
@ -137,21 +137,21 @@ void FormationMgr::LoadCreatureFormations()
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
LOG_INFO("server", ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
LOG_INFO("server", " ");
}
void CreatureGroup::AddMember(Creature* member)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow());
LOG_DEBUG("entities.unit", "CreatureGroup::AddMember: Adding unit GUID: %u.", member->GetGUIDLow());
#endif
//Check if it is a leader
if (member->GetDBTableGUIDLow() == m_groupID)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow());
LOG_DEBUG("entities.unit", "Unit GUID: %u is formation leader. Adding group.", member->GetGUIDLow());
#endif
m_leader = member;
}
@ -182,7 +182,7 @@ void CreatureGroup::MemberAttackStart(Creature* member, Unit* target)
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
if (m_leader) // avoid crash if leader was killed and reset.
sLog->outDebug(LOG_FILTER_UNITS, "GROUP ATTACK: group instance id %u calls member instid %u", m_leader->GetInstanceId(), member->GetInstanceId());
LOG_DEBUG("entities.unit", "GROUP ATTACK: group instance id %u calls member instid %u", m_leader->GetInstanceId(), member->GetInstanceId());
#endif
//Skip one check
@ -214,7 +214,7 @@ void CreatureGroup::FormationReset(bool dismiss)
else
itr->first->GetMotionMaster()->MoveIdle();
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_UNITS, "Set %s movement for member GUID: %u", dismiss ? "default" : "idle", itr->first->GetGUIDLow());
LOG_DEBUG("entities.unit", "Set %s movement for member GUID: %u", dismiss ? "default" : "idle", itr->first->GetGUIDLow());
#endif
}
}

Some files were not shown because too many files have changed in this diff Show more