diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..ea659ebfe1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,53 @@ +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "ac-dev-server", + + // Update the 'dockerComposeFile' list if you have more compose files or use different names. + // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. + "dockerComposeFile": [ + "../docker-compose.yml", + "../docker-compose.override.yml", // needed until this issue will be solved: https://github.com/microsoft/vscode-remote-release/issues/1080 + "docker-compose.yml" + ], + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "ac-dev-server", + + // The optional 'workspaceFolder' property is the path VS Code should open by default when + // connected. This is typically a file mount in .devcontainer/docker-compose.yml + "workspaceFolder": "/azerothcore", + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": null + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "notskm.clang-tidy", + "xaver.clang-format", + "bbenoist.doxygen", + "ms-vscode.cpptools", + "austin.code-gnu-global", + "twxs.cmake", + "mhutchie.git-graph", + "github.vscode-pull-request-github", + "eamodio.gitlens", + "cschlosser.doxdocgen" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Uncomment the next line if you want start specific services in your Docker Compose config. + "runServices": ["ac-dev-server", "ac-database"], + + // Uncomment the next line if you want to keep your containers running after VS Code shuts down. + // "shutdownAction": "none", + + // Uncomment the next line to run commands after the container is created - for example installing curl. + // "postCreateCommand": "apt-get update && apt-get install -y curl", + + // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "acore" +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000..a1daace7c5 --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3.9' +services: + # Update this to the name of the service you want to work with in your docker-compose.yml file + ac-dev-server: + # If you want add a non-root user to your Dockerfile, you can use the "remoteUser" + # property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks, + # debugging) to execute as the user. Uncomment the next line if you want the entire + # container to run as this user instead. Note that, on Linux, you may need to + # ensure the UID and GID of the container user you create matches your local user. + # See https://aka.ms/vscode-remote/containers/non-root for details. + # + # user: vscode + + # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer + # folder. Note that the path of the Dockerfile and context is relative to the *primary* + # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" + # array). The sample below assumes your primary file is in the root of your project. + # + # build: + # context: . + # dockerfile: .devcontainer/Dockerfile + + #volumes: + # Update this to wherever you want VS Code to mount the folder of your project + #- .:/workspace:cached + + # Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details. + # - /var/run/docker.sock:/var/run/docker.sock + + # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. + # cap_add: + # - SYS_PTRACE + # security_opt: + # - seccomp:unconfined + tty: true diff --git a/.dockerignore b/.dockerignore index 18644dcc28..5baa9d3d99 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,10 +1,12 @@ -build*/ -var/* -data/contrib/* -data/doc/* -conf/* -!conf/dist -docker/worldserver/data/* -docker/build/cache +/cmake-build-debug/* +/build*/ +/var/* +/env/dist/* +/env/user/* +/env/docker/data/* +/env/docker/logs/* +/env/docker/etc/* +!/env/docker/etc/authserver.conf.dockerdist +!/env/docker/etc/worldserver.conf.dockerdist +/.env* .idea -cmake-build-debug/* diff --git a/.env.dist b/.env.dist deleted file mode 100644 index f3dc4b6225..0000000000 --- a/.env.dist +++ /dev/null @@ -1,12 +0,0 @@ -WORLDSERVER_DATA=./docker/worldserver/data -WORLDSERVER_ETC=./docker/worldserver/etc -WORLDSERVER_LOGS=./docker/worldserver/logs - -AUTHSERVER_ETC=./docker/authserver/etc -AUTHSERVER_LOGS=./docker/authserver/logs - -WORLD_EXTERNAL_PORT=8085 -AUTH_EXTERNAL_PORT=3724 -DB_EXTERNAL_PORT=3306 -DB_ROOT_PASSWORD=password -SOAP_EXTERNAL_PORT=7878 diff --git a/.github/README.md b/.github/README.md index a1bd406e97..939a2010a6 100644 --- a/.github/README.md +++ b/.github/README.md @@ -2,6 +2,8 @@ [![CodeFactor](https://www.codefactor.io/repository/github/azerothcore/azerothcore-wotlk/badge)](https://www.codefactor.io/repository/github/azerothcore/azerothcore-wotlk) [![core-build](https://github.com/azerothcore/azerothcore-wotlk/workflows/core-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/azerothcore-wotlk/actions?query=workflow%3Acore-build+branch%3Amaster+event%3Apush) +[![windows-build](https://github.com/azerothcore/azerothcore-wotlk/workflows/windows-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/azerothcore-wotlk/actions?query=workflow%3Awindows-build+branch%3Amaster+event%3Apush) +[![macos-build](https://github.com/azerothcore/azerothcore-wotlk/workflows/macos-build/badge.svg?branch=master&event=push)](https://github.com/azerothcore/azerothcore-wotlk/actions?query=workflow%3Amacos-build+branch%3Amaster+event%3Apush) [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=40032087)](https://www.bountysource.com/teams/azerothcore/bounties "Put money on issues or get paid for fixing them") [![StackOverflow](http://img.shields.io/badge/stackoverflow-azerothcore-blue.svg)](https://stackoverflow.com/questions/tagged/azerothcore?sort=newest "Ask / browse questions here") [![Discord](https://img.shields.io/discord/217589275766685707.svg)](https://discord.gg/gkt4y2x "Our community hub on Discord") diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index 1be5d9168d..9a67d4dff5 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -82,119 +82,40 @@ jobs: - name: Run unit tests run: source ./apps/ci/ci-run-unit-tests.sh - mac-build: + docker-build-n-deploy: strategy: - fail-fast: false - matrix: - os: - - macos-10.15 - # - macos-11.0 - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} - needs: [build] - if: github.repository == 'azerothcore/azerothcore-wotlk' && success() - steps: - - uses: actions/checkout@v2 - - name: Cache - uses: actions/cache@v1.1.2 - with: - path: ~/.ccache - key: ccache:${{ matrix.os }}:${{ github.ref }}:${{ github.sha }} - restore-keys: | - ccache:${{ matrix.os }}:${{ github.ref }} - ccache:${{ matrix.os }} - - name: Install latest bash - run: brew install bash - - name: Configure OS - run: source ./acore.sh install-deps - - name: Build - run: source ./apps/ci/mac/ci-compile.sh - - name: Run unit tests - run: source ./apps/ci/ci-run-unit-tests.sh - - windows-build: - strategy: - fail-fast: false - runs-on: windows-2019 - name: windows-2019-MSVC16 + fail-fast: true + runs-on: ubuntu-20.04 if: github.repository == 'azerothcore/azerothcore-wotlk' + env: + DOCKER_EXTENDS_BIND: abstract-no-bind + DOCKER_BUILD_WORLD_TARGET: worldserver + DOCKER_BUILD_AUTH_TARGET: authserver steps: - - uses: actions/checkout@v2 - - name: Configure OS - run: choco install --no-progress openssl - - name: Build + - name: Extract branch name shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + - uses: actions/checkout@v2 + - name: Configure run: | - mkdir -p build && cd build - cmake .. -DTOOLS=ON - cmake --build . --config Release --parallel 4 - - name: Copy dll files - shell: bash + docker --version + docker-compose --version + - name: Build + #env: + # DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }} run: | - cp "/c/mysql-5.7.21-winx64/lib/libmysql.dll" "build/bin/Release/" - cp "/c/Program Files/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll" "build/bin/Release/" - cp "/c/Program Files/OpenSSL-Win64/bin/libssl-1_1-x64.dll" "build/bin/Release/" - - uses: actions/upload-artifact@v2 + docker-compose --profile all build + - name: Login to Docker Hub + if: ${{ steps.extract_branch.outputs.branch == 'master' }} + uses: docker/login-action@v1 with: - name: windows-2019-MSVC16-release - path: build/bin/Release + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Deploy + #env: + # DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }} + if: ${{ steps.extract_branch.outputs.branch == 'master' }} + run: | + docker-compose --profile all push - docker-build: - strategy: - fail-fast: true - runs-on: ubuntu-20.04 - if: github.repository == 'azerothcore/azerothcore-wotlk' - steps: - - uses: actions/checkout@v2 - - name: Configure - run: | - docker --version - docker-compose --version - - name: Build - run: | - ./bin/acore-docker-build-no-scripts - - docker-worldserver: - strategy: - fail-fast: true - runs-on: ubuntu-20.04 - if: github.repository == 'azerothcore/azerothcore-wotlk' - steps: - - uses: actions/checkout@v2 - - name: Configure - run: | - docker --version - docker-compose --version - - name: Build - run: | - docker build -t azerothcore/worldserver -f docker/worldserver/Dockerfile docker/worldserver - - docker-authserver: - strategy: - fail-fast: true - runs-on: ubuntu-20.04 - if: github.repository == 'azerothcore/azerothcore-wotlk' - steps: - - uses: actions/checkout@v2 - - name: Configure - run: | - docker --version - docker-compose --version - - name: Build - run: | - docker build -t azerothcore/authserver -f docker/authserver/Dockerfile docker/authserver - - docker-database: - strategy: - fail-fast: true - runs-on: ubuntu-20.04 - if: github.repository == 'azerothcore/azerothcore-wotlk' - steps: - - uses: actions/checkout@v2 - - name: Configure - run: | - docker --version - docker-compose --version - - name: Build - run: | - docker build -t azerothcore/database -f docker/database/Dockerfile . diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos_build.yml new file mode 100644 index 0000000000..9bfbbf97f3 --- /dev/null +++ b/.github/workflows/macos_build.yml @@ -0,0 +1,37 @@ +name: macos-build +on: + push: + branches: + - '**' # matches every branch + - '!coverity_scan' # excludes coverity_scan + pull_request: + +jobs: + macos-build: + strategy: + fail-fast: false + matrix: + os: + - macos-10.15 + # - macos-11.0 + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} + if: github.repository == 'azerothcore/azerothcore-wotlk' + steps: + - uses: actions/checkout@v2 + - name: Cache + uses: actions/cache@v2 + with: + path: ~/Library/Caches/ccache + key: ccache:${{ matrix.os }}:${{ github.ref }}:${{ github.sha }} + restore-keys: | + ccache:${{ matrix.os }}:${{ github.ref }} + ccache:${{ matrix.os }} + - name: Install latest bash + run: brew install bash + - name: Configure OS + run: source ./acore.sh install-deps + - name: Build + run: source ./apps/ci/mac/ci-compile.sh + - name: Run unit tests + run: source ./apps/ci/ci-run-unit-tests.sh diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml new file mode 100644 index 0000000000..fccaf6fc7c --- /dev/null +++ b/.github/workflows/windows_build.yml @@ -0,0 +1,35 @@ +name: windows-build +on: + push: + branches: + - '**' # matches every branch + - '!coverity_scan' # excludes coverity_scan + pull_request: + +jobs: + windows-build: + strategy: + fail-fast: false + runs-on: windows-2019 + name: windows-2019-MSVC16 + if: github.repository == 'azerothcore/azerothcore-wotlk' + steps: + - uses: actions/checkout@v2 + - name: Configure OS + run: choco install --no-progress openssl + - name: Build + shell: bash + run: | + mkdir -p build && cd build + cmake .. -DTOOLS=ON + cmake --build . --config Release --parallel 4 + - name: Copy dll files + shell: bash + run: | + cp "/c/mysql-5.7.21-winx64/lib/libmysql.dll" "build/bin/Release/" + cp "/c/Program Files/OpenSSL-Win64/bin/libcrypto-1_1-x64.dll" "build/bin/Release/" + cp "/c/Program Files/OpenSSL-Win64/bin/libssl-1_1-x64.dll" "build/bin/Release/" + - uses: actions/upload-artifact@v2 + with: + name: windows-2019-MSVC16-release + path: build/bin/Release diff --git a/.gitignore b/.gitignore index d9a08b14a5..ca628ad590 100644 --- a/.gitignore +++ b/.gitignore @@ -2,29 +2,25 @@ # AzerothCore # -conf/* -!conf/dist -apps/drassil/* -env/dist/* -env/user/* -modules/* -!modules/*.md -!modules/*.sh -build*/ -var/* -docker/build/cache -docker/authserver/bin -docker/worldserver/bin -docker/authserver/etc/authserver.conf -docker/authserver/etc/authserver.conf.dist -docker/worldserver/etc/worldserver.conf -docker/worldserver/etc/worldserver.conf.dist -docker/authserver/logs/ -docker/worldserver/logs/ -docker/worldserver/data/ -!docker/build -.env -apps/joiner +/conf/* +!/conf/dist +/modules/* +!/modules/*.md +!/modules/*.sh +/build*/ +/var/* +/env/dist/* +/env/user/* +/env/docker/data/* +/env/docker/logs/* +/env/docker/etc/* +!/env/docker/etc/authserver.conf.dockerdist +!/env/docker/etc/worldserver.conf.dockerdist +/.env* +/apps/joiner +/deps/deno + +/docker-compose.override.yml !.gitkeep @@ -59,7 +55,6 @@ nbproject/ .sync.ffs_db *.kate-swp .browse.VC* -.vscode .idea cmake-build-debug/* cmake-build-debug-coverage/* @@ -85,9 +80,9 @@ local.properties # ================== # # CUSTOM -# +# # put below your custom ignore rules -# for example , if you want to include a +# for example , if you want to include a # module directly in repositoryyou can do: # # !modules/yourmodule diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..8fbdb5467d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "deps/git-subrepo"] + path = deps/git-subrepo + url = https://github.com/ingydotnet/git-subrepo.git diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..f78da7e8aa --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,15 @@ +{ + "recommendations": [ + "ms-vscode-remote.remote-containers", + "notskm.clang-tidy", + "xaver.clang-format", + "bbenoist.doxygen", + "ms-vscode.cpptools", + "austin.code-gnu-global", + "twxs.cmake", + "mhutchie.git-graph", + "github.vscode-pull-request-github", + "eamodio.gitlens", + "cschlosser.doxdocgen" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..bb4fa23a78 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,68 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Linux/Docker debug", + "type": "cppdbg", + "request": "launch", + "program": "/azerothcore/env/dist/bin/worldserver", + "cwd": "/azerothcore", + "args": [], + "environment": [], + "externalConsole": false, + "sourceFileMap": { + "/azerothcore": "${workspaceFolder}" + }, + "linux": { + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": false + } + ] + } + }, + { + "name": "(docker run) Pipe Launch", + "type": "cppdbg", + "request": "launch", + "program": "/azerothcore/env/dist/bin/worldserver", + "cwd": "/azerothcore", + "args": [], + "environment": [], + "externalConsole": true, + "pipeTransport": { + "debuggerPath": "/usr/bin/gdb", + "pipeProgram": "docker-compose", + "pipeArgs": [ + "exec", "-T", "ac-worldserver", "sh", "-c" + ], + "pipeCwd": "${workspaceFolder}" + }, + "sourceFileMap": { + "/azerothcore": "${workspaceFolder}" + }, + "linux": { + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": false + } + ] + }, + "osx": { + "MIMode": "lldb" + }, + "windows": { + "MIMode": "gdb", + "miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe" + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..1cf6801393 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,69 @@ +{ + "files.associations": { + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "cinttypes": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "cfenv": "cpp", + "typeinfo": "cpp", + "codecvt": "cpp" + }, + "deno.enable": true, + "deno.path" : "deps/deno/bin/deno" +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000..eeba203d70 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,19 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "./acore.sh compiler build", + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + } + ] + } diff --git a/CMakeLists.txt b/CMakeLists.txt index f9bdd461e5..2dbcfddd5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,9 +39,10 @@ list(APPEND CMAKE_MODULE_PATH include(CheckCXXSourceRuns) include(CheckIncludeFiles) +include(ConfigureScripts) # some utils for cmake -include(deps/drassil/cmake-utils/utils.cmake) +include(deps/acore/cmake-utils/utils.cmake) include(src/cmake/ac_macros.cmake) diff --git a/acore.sh b/acore.sh index ba247e009c..59db491484 100755 --- a/acore.sh +++ b/acore.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash -set -e +[ -z "$WITH_ERRORS" ] && set -e CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + source "$CUR_PATH/apps/installer/main.sh" diff --git a/apps/EnumUtils/enumutils_describe.py b/apps/EnumUtils/enumutils_describe.py new file mode 100644 index 0000000000..e25d88962c --- /dev/null +++ b/apps/EnumUtils/enumutils_describe.py @@ -0,0 +1,152 @@ +from re import compile, MULTILINE +from os import walk, getcwd + +notice = ('''/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2021+ WarheadCore + * Copyright (C) 2008-2021 TrinityCore + */ + +''') + +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 \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)) diff --git a/apps/bash_shared/common.sh b/apps/bash_shared/common.sh index ed0859319c..c8d8880cf8 100644 --- a/apps/bash_shared/common.sh +++ b/apps/bash_shared/common.sh @@ -1,12 +1,15 @@ -function registerHooks() { hwc_event_register_hooks "$@"; } -function runHooks() { hwc_event_run_hooks "$@"; } +function registerHooks() { acore_event_registerHooks "$@"; } +function runHooks() { acore_event_runHooks "$@"; } source "$AC_PATH_CONF/dist/config.sh" # include dist to avoid missing conf variables -if [ -f "$AC_PATH_CONF/config.sh" ]; then - source "$AC_PATH_CONF/config.sh" # should overwrite previous +# first check if it's defined in env, otherwise use the default +USER_CONF_PATH=${USER_CONF_PATH:-"$AC_PATH_CONF/config.sh"} + +if [ -f "$USER_CONF_PATH" ]; then + source "$USER_CONF_PATH" # should overwrite previous else - echo "NOTICE: file <$AC_PATH_CONF/config.sh> has not been found, you should create and configure it." + echo "NOTICE: file <$USER_CONF_PATH> has not been found, you should create and configure it." fi # @@ -15,7 +18,7 @@ fi for entry in "$AC_PATH_MODULES/"*/include.sh do - if [ -e "$entry" ]; then + if [ -e "$entry" ]; then source "$entry" fi done diff --git a/apps/bash_shared/defines.sh b/apps/bash_shared/defines.sh index ed70cac1d5..ed5f3733c9 100644 --- a/apps/bash_shared/defines.sh +++ b/apps/bash_shared/defines.sh @@ -14,6 +14,11 @@ else AC_PATH_ROOT=$(readlink -f "$AC_PATH_APPS/../") fi +case $AC_PATH_ROOT in + /*) AC_PATH_ROOT=$AC_PATH_ROOT;; + *) AC_PATH_ROOT=$PWD/$AC_PATH_ROOT;; +esac + AC_PATH_CONF="$AC_PATH_ROOT/conf" AC_PATH_MODULES="$AC_PATH_ROOT/modules" diff --git a/apps/bash_shared/deno.sh b/apps/bash_shared/deno.sh new file mode 100644 index 0000000000..68086acf51 --- /dev/null +++ b/apps/bash_shared/deno.sh @@ -0,0 +1,23 @@ +DENO_MIN_VERSION="1.9.1" + +function denoInstall() { + + { # try + echo "Deno version check:" && denoCmd upgrade --version $DENO_MIN_VERSION + } || + { # catch + echo "Installing Deno..." + # just one line of command that works on all OSes + # (temporary cd into AC_PATH_DEPS) + curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL="$AC_PATH_DEPS/deno" sh + } +} + +function denoCmd() { + [[ "$OSTYPE" = "msys" ]] && DENOEXEC="./deps/deno/bin/deno.exe" || DENOEXEC="./deps/deno/bin/deno" + (cd "$AC_PATH_ROOT" ; $DENOEXEC "$@") +} + +function denoRunFile() { + denoCmd run --allow-all --unstable "$@" +} diff --git a/apps/bash_shared/includes.sh b/apps/bash_shared/includes.sh index 1817683ad9..22a4d91b7e 100644 --- a/apps/bash_shared/includes.sh +++ b/apps/bash_shared/includes.sh @@ -1,7 +1,7 @@ [[ ${GUARDYVAR:-} -eq 1 ]] && return || readonly GUARDYVAR=1 # include it once # force default language for applications -LC_ALL=C +LC_ALL=C AC_PATH_APPS="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" @@ -9,9 +9,13 @@ AC_PATH_SHARED="$AC_PATH_APPS/bash_shared" source "$AC_PATH_SHARED/defines.sh" -source "$AC_PATH_DEPS/hw-core/bash-lib-event/src/hooks.sh" +source "$AC_PATH_DEPS/acore/bash-lib/src/event/hooks.sh" source "$AC_PATH_SHARED/common.sh" +source "$AC_PATH_SHARED/deno.sh" + +denoInstall + [[ "$OSTYPE" = "msys" ]] && AC_BINPATH_FULL="$BINPATH" || AC_BINPATH_FULL="$BINPATH/bin" diff --git a/apps/db_assembler/includes/functions.sh b/apps/db_assembler/includes/functions.sh index 8e7ff5a5e1..86973e1042 100644 --- a/apps/db_assembler/includes/functions.sh +++ b/apps/db_assembler/includes/functions.sh @@ -2,6 +2,21 @@ PROMPT_USER="" PROMPT_PASS="" +function dbasm_waitMysqlConn() { + DBHOST="$1" + DBPORT="$2" + COUNT=0 + while ! mysqladmin ping -h"$DBHOST" --port="$DBPORT" --silent; do + ((COUNT++)) + if [ $COUNT -gt $DBASM_WAIT_RETRIES ]; then + echo "DBASM Timeout: Cannot ping mysql!" 1>&2 + exit 64 + fi + echo "Cannot ping mysql, retry in $DBASM_WAIT_TIMEOUT seconds (remaining: $COUNT/$DBASM_WAIT_RETRIES)..." + sleep $DBASM_WAIT_TIMEOUT + done +} + # use in a subshell function dbasm_resetExitCode() { exit 0 @@ -11,7 +26,7 @@ function dbasm_mysqlExec() { confs=$1 command=$2 options=$3 - + # MYSQL_PORT needs to be reseted as the next eval might not overwite the current value causing the commands to use wrong port MYSQL_PORT=3306 eval $confs @@ -21,6 +36,7 @@ function dbasm_mysqlExec() { MYSQL_PASS=$PROMPT_PASS fi + dbasm_waitMysqlConn $MYSQL_HOST $MYSQL_PORT export MYSQL_PWD=$MYSQL_PASS @@ -57,7 +73,7 @@ function dbasm_mysqlExec() { eval $_confs echo "Grant permissions for ${MYSQL_USER}'@'${MYSQL_HOST} to ${_dbname}" - "$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -P "$MYSQL_PORT" -e "GRANT ALL PRIVILEGES ON ${_dbname}.* TO '${MYSQL_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION;" + "$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -P "$MYSQL_PORT" -e "GRANT ALL PRIVILEGES ON ${_dbname}.* TO '${MYSQL_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION; FLUSH PRIVILEGES;" done else exit @@ -109,9 +125,13 @@ function dbasm_createDB() { echo "$dbname database exists" else echo "Creating DB ${dbname} ..." - dbasm_mysqlExec "$confs" "CREATE DATABASE \`${dbname}\`" "" + dbasm_mysqlExec "$confs" "CREATE DATABASE \`${dbname}\`;" "" + echo "Creating User ${CONF_USER}@${MYSQL_HOST} identified by ${CONF_PASS}..." dbasm_mysqlExec "$confs" "CREATE USER IF NOT EXISTS '${CONF_USER}'@'${MYSQL_HOST}' IDENTIFIED BY '${CONF_PASS}';" - dbasm_mysqlExec "$confs" "GRANT ALL PRIVILEGES ON \`${dbname}\`.* TO '${CONF_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION;" + echo "Granting user privileges on: ${dbname} ..." + dbasm_mysqlExec "$confs" "GRANT ALL PRIVILEGES ON \`${dbname}\`.* TO '${CONF_USER}'@'${MYSQL_HOST}'" + echo "Flush privileges" + dbasm_mysqlExec "$confs" "FLUSH PRIVILEGES;" fi } @@ -247,7 +267,7 @@ function dbasm_db_backup() { name="DB_"$uc"_NAME" dbname=${!name} - + # MYSQL_PORT needs to be reseted as the next eval might not overwite the current value causing the commands to use wrong port MYSQL_PORT=3306 eval $confs; @@ -299,7 +319,7 @@ function dbasm_db_import() { fi echo "importing $1 - $2 ..." - + # MYSQL_PORT needs to be reseted as the next eval might not overwite the current value causing the commands to use wrong port MYSQL_PORT=3306 eval $confs; @@ -309,6 +329,8 @@ function dbasm_db_import() { MYSQL_PASS=$PROMPT_PASS fi + dbasm_waitMysqlConn $MYSQL_HOST $MYSQL_PORT + export MYSQL_PWD=$MYSQL_PASS diff --git a/apps/db_exporter/db_export.sh b/apps/db_exporter/db_export.sh index c9e6db8f2e..e5ce4a5c67 100644 --- a/apps/db_exporter/db_export.sh +++ b/apps/db_exporter/db_export.sh @@ -2,7 +2,7 @@ ROOTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )" -source $ROOTPATH"/apps/bash_shared/includes.sh" +source "$ROOTPATH/apps/bash_shared/includes.sh" if [ -f "./config.sh" ]; then source "./config.sh" # should overwrite previous @@ -24,7 +24,7 @@ function export() { var_base_path="DB_"$database"_PATHS" base_path=${!var_base_path%/} - + base_conf="TPATH="$base_path";\ CLEANFOLDER=1; \ CHMODE=0; \ @@ -33,15 +33,15 @@ function export() { FULL=0; \ DUMPOPTS='--skip-comments --skip-set-charset --routines --extended-insert --order-by-primary --single-transaction --quick'; \ " - + var_base_conf="DB_"$database"_CONF" base_conf=$base_conf${!var_base_conf} - + var_base_name="DB_"$database"_NAME" base_name=${!var_base_name} - bash $AC_PATH_DEPS"/drassil/mysql-tools/mysql-tools" dump "" $base_name "" "$base_conf" + bash "$AC_PATH_DEPS/acore/mysql-tools/mysql-tools" "dump" "" "$base_name" "" "$base_conf" } for db in ${DATABASES[@]} diff --git a/apps/docker/Dockerfile b/apps/docker/Dockerfile new file mode 100644 index 0000000000..6c95ffa211 --- /dev/null +++ b/apps/docker/Dockerfile @@ -0,0 +1,128 @@ +#================================================================ +# +# DEV: Stage used for the development environment +# and the locally built services +# +#================================================================= + +FROM ubuntu:20.04 as dev +ARG USER_ID=1000 +ARG GROUP_ID=1000 + +LABEL description="AC Worldserver Debug Container for use with Visual Studio" + +# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones + +ENV DOCKER=1 + +# set timezone environment variable +ENV TZ=Etc/UTC + +# set noninteractive mode so tzdata doesn't ask to set timezone on install +ENV DEBIAN_FRONTEND=noninteractive + +# install essentials +RUN apt-get update && apt-get install -y gdb gdbserver git dos2unix lsb-core sudo curl unzip + +# copy everything so we can work directly within the container +# using tools such as vscode dev-container +COPY . /azerothcore + +# install the required dependencies to run the worldserver +RUN /azerothcore/acore.sh install-deps + +# change timezone in container +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata + +# Create a non-root user +RUN addgroup --gid $GROUP_ID acore && \ + adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID acore && \ + passwd -d acore && \ + echo 'acore ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers + +RUN mkdir -p /azerothcore + +# Correct permissions for non-root operations +RUN chown -R acore:acore \ + /run \ + /home/acore \ + /opt/ \ + /azerothcore + +USER acore + +WORKDIR /azerothcore + +#================================================================ +# +# BUILD STAGE: to prepare binaries for the production services +# +#================================================================= +FROM dev as build + +RUN bash acore.sh compiler build + +#================================================================ +# +# SERVICE BASE: prepare the OS for the production-ready services +# +#================================================================= + +FROM ubuntu:20.04 as servicebase + +# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones + +# set timezone environment variable +ENV TZ=Etc/UTC + +# set noninteractive mode so tzdata doesn't ask to set timezone on install +ENV DEBIAN_FRONTEND=noninteractive + +COPY --from=build /azerothcore/env /azerothcore/env + +# copy the sources from the host machine +COPY apps /azerothcore/apps +COPY bin /azerothcore/bin +COPY conf /azerothcore/conf +COPY data /azerothcore/data +COPY deps /azerothcore/deps +COPY acore.json /azerothcore/acore.json +COPY acore.sh /azerothcore/acore.sh + +# install the required dependencies to run the authserver +RUN apt-get update && apt-get install -y gdb gdbserver net-tools tzdata libmysqlclient-dev libace-dev mysql-client curl unzip; + +# change timezone in container +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata + +WORKDIR /azerothcore/ + +RUN cp -n "/azerothcore/env/docker/etc/worldserver.conf.dockerdist" "/azerothcore/env/dist/etc/worldserver.conf" +RUN cp -n "/azerothcore/env/docker/etc/authserver.conf.dockerdist" "/azerothcore/env/dist/etc/authserver.conf" + +#================================================================ +# +# AUTH SERVICE: create a ready-to-use authserver image +# +#================================================================= + +FROM servicebase as authserver + +CMD ./acore.sh run-authserver + +#================================================================ +# +# WORLD SERVICE: create a ready-to-use worldserver image +# +#================================================================= + +FROM servicebase as worldserver + +ENV DATAPATH=/azerothcore/env/dist/data + +RUN /azerothcore/acore.sh client-data + +CMD ./acore.sh run-worldserver + + + diff --git a/apps/docker/README.md b/apps/docker/README.md new file mode 100644 index 0000000000..80cd4fa100 --- /dev/null +++ b/apps/docker/README.md @@ -0,0 +1,27 @@ +# Run AzerothCore with Docker + +*This readme it's a summary of the AzerothCore docker features.* + +Docker. is a software that performs operating-system-level virtualization, allowing to wrap and launch applications inside containers. + +Thanks to Docker, you can quickly setup and run AzerothCore in any operating system. + +The **only** requirement is having [Docker](https://docs.docker.com/install/) installed into your system. Forget about installing mysql, visual studio, cmake, etc... + +### Installation instructions + +Check the [Install with Docker](https://www.azerothcore.org/wiki/Install-with-Docker) guide. + +### Memory usage + +The total amount of RAM when running all AzerothCore docker containers is **less than 2 GB**. + +![AzerothCore containers memory](https://user-images.githubusercontent.com/75517/51078287-10e65b80-16b3-11e9-807f-f59a5844dae5.png) + + +### Docker containers vs Virtual machines + +Using Docker will have the same benefits as using virtual machines, but with much less overhead: + +![Docker containers vs Virtual machines](https://user-images.githubusercontent.com/75517/51078179-d4fec680-16b1-11e9-8ce6-87b5053f55dd.png) + diff --git a/apps/docker/config-docker.sh b/apps/docker/config-docker.sh new file mode 100644 index 0000000000..8c3ac42067 --- /dev/null +++ b/apps/docker/config-docker.sh @@ -0,0 +1,6 @@ +CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# allow the user to override configs +if [ -f "$AC_PATH_CONF/config.sh" ]; then + source "$AC_PATH_CONF/config.sh" # should overwrite previous +fi diff --git a/apps/docker/docker-cmd.ts b/apps/docker/docker-cmd.ts new file mode 100644 index 0000000000..f666ca0944 --- /dev/null +++ b/apps/docker/docker-cmd.ts @@ -0,0 +1,174 @@ +import { Command } from "https://cdn.depjs.com/cmd/mod.ts"; +import * as ink from "https://deno.land/x/ink/mod.ts"; +import { + Input, + Select, +} from "https://deno.land/x/cliffy@v0.18.2/prompt/mod.ts"; + +const program = new Command(); + +program.name("acore.sh docker") + .description("Shell scripts for docker") + .version("1.0.0"); + +shellCommandFactory( + "start:app", + "Startup the authserver and worldserver apps", + "docker-compose --profile app up", +); + +shellCommandFactory( + "start:app:d", + "Startup the authserver and worldserver apps in detached mode", + "docker-compose --profile app up -d", +); + +shellCommandFactory( + "start:dev", + "Startup the dev server", + "docker-compose --profile dev up", +); + +shellCommandFactory( + "build", + "Build the authserver and worldserver", + `docker-compose run --rm ac-dev-server bash bin/acore-docker-build`, +); + +shellCommandFactory( + "build:clean", + "Clean build data", + `docker-compose run --rm ac-dev-server bash rm -rf var/build`, +); + +shellCommandFactory( + "client-data", + "Download client data inside the ac-data volume", + "docker-compose run --rm ac-dev-server bash acore.sh client-data", +); + +shellCommandFactory( + "db-import", + "Create and upgrade the database with latest updates", + "docker-compose run --rm ac-dev-server bash acore.sh db-assembler import-all", +); + +shellCommandFactory( + "dashboard [args...]", + "Execute acore dashboard within a running ac-dev-server", + "docker-compose exec ac-dev-server bash acore.sh", +); + +program.command("attach [service]") + .description("attach to a service") + .action(async (service: string | undefined) => { + const { run } = Deno; + + let command = `docker-compose ps`; + + if (service) { + command = `${command} ${service}`; + } + + console.log(ink.colorize(`>>>>> Running: ${command}`)); + + let cmd = command.split(" "); + const res = Deno.run({ + cmd, + cwd: process.cwd(), + stdout: "piped", + stderr: "piped", + }); + + const output = await res.output(); // "piped" must be set + + let services = new TextDecoder().decode(output).split("\n"); + + services.pop(); + services = services.slice(2); + + res.close(); // Don't forget to close it + + let selService: string; + if (services.length > 1) { + selService = await Select.prompt({ + message: `Select a service`, + options: services, + }); + } else { + selService = services[0]; + } + + command = `docker attach ${selService.split(" ")[0]}`; + + console.log(ink.colorize(`>>>>> Running: ${command}`)); + + console.log( + ink.colorize( + "NOTE: you can detach from a container and leave it running using the CTRL-p CTRL-q key sequence.", + ), + ); + + cmd = command.split(" "); + + const shellCmd = run({ + cmd, + cwd: process.cwd(), + }); + + await shellCmd.status(); + + shellCmd.close(); + }); + +program.command("quit").description("Close docker command").action(()=> { + process.exit(0) +}) + +// Handle it however you like +// e.g. display usage +while (true) { + if (Deno.args.length === 0) { + program.outputHelp(); + const command = await Input.prompt({ + message: "Enter the command:", + }); + await program.parseAsync(command.split(" ")); + } else { + await program.parseAsync(Deno.args); + process.exit(0) + } +} + + + +function shellCommandFactory( + name: string, + description: string, + command: string, +): Command { + return program.command(name) + .description( + `${description}. Command: \n"${ink.colorize(`${command}`)}"\n`, + ) + .action(async (args: any[] | undefined) => { + const { run } = Deno; + + console.log(ink.colorize(`>>>>> Running: ${command}`)); + + const cmd = command.split(" "); + + if (Array.isArray(args)) { + cmd.push(...args); + } + + const shellCmd = run({ + cmd, + cwd: process.cwd(), + }); + + await shellCmd.status(); + + shellCmd.close(); + }); +} diff --git a/apps/installer/includes/functions.sh b/apps/installer/includes/functions.sh index ff00f91e2c..1204362e7a 100644 --- a/apps/installer/includes/functions.sh +++ b/apps/installer/includes/functions.sh @@ -2,7 +2,7 @@ function inst_configureOS() { echo "Platform: $OSTYPE" case "$OSTYPE" in solaris*) echo "Solaris is not supported yet" ;; - darwin*) source "$AC_PATH_INSTALLER/includes/os_configs/osx.sh" ;; + darwin*) source "$AC_PATH_INSTALLER/includes/os_configs/osx.sh" ;; linux*) # If $OSDISTRO is set, use this value (from config.sh) if [ ! -z "$OSDISTRO" ]; then @@ -68,7 +68,6 @@ function inst_cleanCompile() { function inst_allInOne() { inst_configureOS - inst_updateRepo inst_compile dbasm_import true true true } @@ -153,7 +152,7 @@ function inst_module_install { if [[ "$b" != "none" ]]; then Joiner:add_repo "https://github.com/azerothcore/$res" "$res" "$b" && echo "Done, please re-run compiling and db assembly. Read instruction on module repository for more information" else - echo "Cannot install $res module: it doesn't exists or no version compatible with AC v$ACORE_VERSION are available" + echo "Cannot install $res module: it doesn't exists or no version compatible with AC v$ACORE_VERSION are available" fi echo ""; @@ -219,9 +218,31 @@ function inst_simple_restarter { } function inst_download_client_data { - local path="$AC_BINPATH_FULL" + # change the following version when needed + local VERSION=v10 + + echo "#######################" + echo "Client data downloader" + echo "#######################" + + # first check if it's defined in env, otherwise use the default + local path="${DATAPATH:-$AC_BINPATH_FULL}" + + dataVersionFile="$path/data-version" + + [ -f "$dataVersionFile" ] && source "$dataVersionFile" + + # create the path if doesn't exists + mkdir -p "$path" + + if [ "$VERSION" == "$INSTALLED_VERSION" ]; then + echo "Data $VERSION already installed. If you want to force the download remove the following file: $dataVersionFile" + return + fi echo "Downloading client data in: $path/data.zip ..." - curl -L https://github.com/wowgaming/client-data/releases/download/v10/data.zip > "$path/data.zip" \ - && unzip -o "$path/data.zip" -d "$path/" && rm "$path/data.zip" + curl -L https://github.com/wowgaming/client-data/releases/download/$VERSION/data.zip > "$path/data.zip" \ + && echo "unzip downloaded file..." && unzip -q -o "$path/data.zip" -d "$path/" \ + && echo "Remove downloaded file" && rm "$path/data.zip" \ + && echo "INSTALLED_VERSION=$VERSION" > "$dataVersionFile" } diff --git a/apps/installer/includes/includes.sh b/apps/installer/includes/includes.sh index 5afd4a159b..5b99c45cc5 100644 --- a/apps/installer/includes/includes.sh +++ b/apps/installer/includes/includes.sh @@ -6,24 +6,9 @@ source "$CURRENT_PATH/../../bash_shared/includes.sh" AC_PATH_INSTALLER="$AC_PATH_APPS/installer" - -J_VER_REQ="v0.8.3" -J_PATH="$AC_PATH_APPS/joiner" +J_PATH="$AC_PATH_DEPS/acore/joiner" J_PATH_MODULES="$AC_PATH_MODULES" -#install/update and include joiner -if [ ! -d "$J_PATH/.git" ]; then - git clone https://github.com/azerothcore/joiner "$J_PATH" -b master - git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" reset --hard "$J_VER_REQ" -else - # legacy code, with new rev of joiner the update process is internally handled - _cur_branch=$(git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" rev-parse --abbrev-ref HEAD) - _cur_ver=$(git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" name-rev --tags --name-only $_cur_branch) - if [ "$_cur_ver" != "$J_VER_REQ" ]; then - git --git-dir="$J_PATH/.git" --work-tree="$J_PATH/" rev-parse && git --git-dir="$J_PATH/.git" --work-tree="$J_PATH/" fetch --tags origin master --quiet - git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" reset --hard "$J_VER_REQ" - fi -fi source "$J_PATH/joiner.sh" if [ -f "$AC_PATH_INSTALLER/config.sh" ]; then diff --git a/apps/installer/includes/os_configs/ubuntu.sh b/apps/installer/includes/os_configs/ubuntu.sh index 6edaad51d6..63ef36d513 100644 --- a/apps/installer/includes/os_configs/ubuntu.sh +++ b/apps/installer/includes/os_configs/ubuntu.sh @@ -7,13 +7,16 @@ UBUNTU_VERSION=$(lsb_release -sr); sudo apt-get update -y -if [[ $CONTINUOUS_INTEGRATION ]]; then - sudo apt-get -y install build-essential libtool make cmake cmake-data clang openssl libgoogle-perftools-dev \ - libssl-dev libmysqlclient-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev libace-dev mysql-client \ - libncurses5-dev ccache +# shared deps +sudo apt-get -y install make cmake clang curl unzip libmysqlclient-dev libace-dev + +if [[ $CONTINUOUS_INTEGRATION || $DOCKER ]]; then + sudo apt-get -y install build-essential libtool cmake-data openssl libgoogle-perftools-dev \ + libssl-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev mysql-client \ + libncurses5-dev ccache curl unzip else - sudo apt-get install -y git cmake make gcc g++ clang libmysqlclient-dev \ + sudo apt-get install -y git gcc g++ \ libssl-dev libbz2-dev libreadline-dev libncurses-dev \ - mysql-server libace-6.* libace-dev curl unzip + mysql-server libace-6.* fi - + diff --git a/apps/installer/main.sh b/apps/installer/main.sh index 71df484244..b985b225b4 100644 --- a/apps/installer/main.sh +++ b/apps/installer/main.sh @@ -19,7 +19,8 @@ options=( "client-data: (gd): download client data from github repository (beta)" # 11 "run-worldserver (rw): execute a simple restarter for worldserver" # 12 "run-authserver (ra): execute a simple restarter for authserver" # 13 - "quit: Exit from this menu" # 14 + "docker (dr): Run docker tools" # 14 + "quit: Exit from this menu" # 15 ) function _switch() { @@ -66,7 +67,11 @@ function _switch() { ""|"ra"|"run-authserver"|"13") inst_simple_restarter authserver ;; - ""|"quit"|"14") + ""|"dr"|"docker"|"14") + DOCKER=1 denoRunFile "$AC_PATH_APPS/docker/docker-cmd.ts" "${@:2}" + exit + ;; + ""|"quit"|"15") echo "Goodbye!" exit ;; diff --git a/apps/startup-scripts/conf.sh.dist b/apps/startup-scripts/conf.sh.dist index 774a7c01ce..3a2c395782 100644 --- a/apps/startup-scripts/conf.sh.dist +++ b/apps/startup-scripts/conf.sh.dist @@ -2,7 +2,7 @@ export GDB_ENABLED=0 # [optional] gdb file -# default: gdb.txt +# default: gdb.conf export GDB="" # directory where binary are stored diff --git a/apps/startup-scripts/examples/restarter-auth.sh b/apps/startup-scripts/examples/restarter-auth.sh index 575981cf2a..61ea8b9cfa 100644 --- a/apps/startup-scripts/examples/restarter-auth.sh +++ b/apps/startup-scripts/examples/restarter-auth.sh @@ -2,12 +2,12 @@ PATH_RUNENGINE="./" -source $PATH_RUNENGINE/run-engine +source "$PATH_RUNENGINE/run-engine" # you must create your conf -# copying conf.sh.dist +# copying conf.sh.dist # and renaming as below -source ./conf-auth.sh +source "./conf-auth.sh" restarter diff --git a/apps/startup-scripts/examples/restarter-world.sh b/apps/startup-scripts/examples/restarter-world.sh index 5307eb4a76..9b34e114e0 100644 --- a/apps/startup-scripts/examples/restarter-world.sh +++ b/apps/startup-scripts/examples/restarter-world.sh @@ -2,12 +2,12 @@ PATH_RUNENGINE="./" -source $PATH_RUNENGINE/run-engine +source "$PATH_RUNENGINE/run-engine" # you must create your conf -# copying conf.sh.dist +# copying conf.sh.dist # and renaming as below -source ./conf-world.sh +source "./conf-world.sh" restarter diff --git a/apps/startup-scripts/examples/starter-auth.sh b/apps/startup-scripts/examples/starter-auth.sh index 0aedb9bca7..734cfb5a22 100644 --- a/apps/startup-scripts/examples/starter-auth.sh +++ b/apps/startup-scripts/examples/starter-auth.sh @@ -2,13 +2,12 @@ PATH_RUNENGINE="./" -source $PATH_RUNENGINE/run-engine +source "$PATH_RUNENGINE/run-engine" # you must create your conf # copying conf.sh.dist # and renaming as below -source ./conf-auth.sh +source "./conf-auth.sh" starter - diff --git a/apps/startup-scripts/examples/starter-world.sh b/apps/startup-scripts/examples/starter-world.sh index 4b866dee1d..697a2c85ac 100644 --- a/apps/startup-scripts/examples/starter-world.sh +++ b/apps/startup-scripts/examples/starter-world.sh @@ -2,12 +2,12 @@ PATH_RUNENGINE="./" -source $PATH_RUNENGINE/run-engine +source "$PATH_RUNENGINE/run-engine" # you must create your conf -# copying conf.sh.dist +# copying conf.sh.dist # and renaming as below -source ./conf-world.sh +source "./conf-world.sh" starter diff --git a/apps/startup-scripts/gdb.conf b/apps/startup-scripts/gdb.conf new file mode 100644 index 0000000000..bcedc28ffc --- /dev/null +++ b/apps/startup-scripts/gdb.conf @@ -0,0 +1,4 @@ +set logging on +set debug timestamp +run +bt diff --git a/apps/startup-scripts/simple-restarter b/apps/startup-scripts/simple-restarter index dc04ce0743..6415c0a449 100755 --- a/apps/startup-scripts/simple-restarter +++ b/apps/startup-scripts/simple-restarter @@ -2,56 +2,69 @@ #PARAMETER 1: directory #PARAMETER 2: binary file +#PARAMETER 3: gdb on/off -_bin_path=$1 -_bin_file=$2 +bin_path="${1:-$AC_RESTARTER_BINPATH}" +bin_file="${2:-$AC_RESTARTER_BINFILE}" +with_gdb="${3:-$AC_RESTARTER_WITHGDB}" + +CURRENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd ) _instant_crash_count=0 _restart_count=0 if [ "$#" -ne 2 ]; then echo "Usage: $0 path filename" - echo "Example: $0 $HOME/azeroth-server/bin worldserver" + echo "Example: $0 $HOME/azerothcore/bin worldserver" exit 1 fi while true do - if [ ! -f "$_bin_path/$_bin_file" ]; then - echo "$_bin_path/$_bin_file doesn't exists!" + if [ ! -f "$bin_path/$bin_file" ]; then + echo "$bin_path/$bin_file doesn't exists!" exit 1 fi STARTING_TIME=$(date +%s) - cd "$_bin_path" && "./$_bin_file" # &>/dev/null; + cd "$bin_path"; + + if [ "$with_gdb" = true ]; then + echo "Running with GDB enabled" + gdb -x "$CURRENT_PATH/gdb.conf" --batch "./$bin_file" + else + echo "Running without GDB" + "./$bin_file" + fi + _exit_code=$? echo "exit code: $_exit_code" # stop restarter on SIGKILL (disabled for now) # 128 + 9 (SIGKILL) #if [ $_exit_code -eq 137 ]; then - # echo "$_bin_file has been killed" + # echo "$bin_file has been killed" # exit 0 #fi - echo "$_bin_file terminated, restarting..." + echo "$bin_file terminated, restarting..." ENDING_TIME=$(date +%s) DIFFERENCE=$(( $ENDING_TIME - $STARTING_TIME )) ((_restart_count++)) - echo "$_bin_file Terminated after $DIFFERENCE seconds, termination count: : $_restart_count" + echo "$bin_file Terminated after $DIFFERENCE seconds, termination count: : $_restart_count" if [ $DIFFERENCE -lt 10 ]; then - # increment instant crash if runtime is lower than 10 seconds + # increment instant crash if runtime is lower than 10 seconds ((_instant_crash_count++)) else _instant_crash_count=0 # reset count fi if [ $_instant_crash_count -gt 5 ]; then - echo "$_bin_file Restarter exited. Infinite crash loop prevented. Please check your system" + echo "$bin_file Restarter exited. Infinite crash loop prevented. Please check your system" exit 1 fi done diff --git a/apps/whitespace_remover/whitespace_remover.sh b/apps/whitespace_remover/whitespace_remover.sh new file mode 100644 index 0000000000..788d561e94 --- /dev/null +++ b/apps/whitespace_remover/whitespace_remover.sh @@ -0,0 +1,3 @@ +# Change '*.cpp' and '*.h' to the extension you want to remove whitespaces in. +find -name '*.cpp' -print0 | xargs -r0 sed -e 's/[[:blank:]]\+$//' -i +find -name '*.h' -print0 | xargs -r0 sed -e 's/[[:blank:]]\+$//' -i diff --git a/bin/acore-db-asm b/bin/acore-db-asm deleted file mode 100755 index 962a70b233..0000000000 --- a/bin/acore-db-asm +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -source "$CUR_PATH/../apps/db_assembler/db_assembler.sh" diff --git a/bin/acore-docker-build b/bin/acore-docker-build index 5ec93feafb..1e3d050d76 100755 --- a/bin/acore-docker-build +++ b/bin/acore-docker-build @@ -1,9 +1,15 @@ #!/usr/bin/env bash -docker build -t acbuild -f docker/build/Dockerfile . +bash acore.sh compiler build && bash acore.sh db-assembler import-all + +CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +ENV_PATH=$(readlink -f "$CUR_PATH/../env") + +echo "Generating confs..." +cp -n "$ENV_PATH/docker/etc/worldserver.conf.dockerdist" "$ENV_PATH/dist/etc/worldserver.conf" +cp -n "$ENV_PATH/docker/etc/authserver.conf.dockerdist" "$ENV_PATH/dist/etc/authserver.conf" + +echo "Fixing EOL..." +dos2unix "$ENV_PATH/dist/etc/"* -docker run \ - -v /"$(pwd)"/docker/build/cache:/azerothcore/build \ - -v /"$(pwd)"/docker/worldserver/bin:/binworldserver \ - -v /"$(pwd)"/docker/authserver/bin:/binauthserver \ - acbuild diff --git a/bin/acore-docker-build-no-scripts b/bin/acore-docker-build-no-scripts deleted file mode 100755 index a0c80a5e33..0000000000 --- a/bin/acore-docker-build-no-scripts +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -docker build --build-arg ENABLE_SCRIPTS=0 -t acbuild -f docker/build/Dockerfile . - -docker run \ - -v /"$(pwd)"/docker/build/cache:/azerothcore/build \ - -v /"$(pwd)"/docker/worldserver/bin:/binworldserver \ - -v /"$(pwd)"/docker/authserver/bin:/binauthserver \ - acbuild diff --git a/bin/acore-docker-generate-etc b/bin/acore-docker-generate-etc deleted file mode 100755 index c6062088a0..0000000000 --- a/bin/acore-docker-generate-etc +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -cp src/server/worldserver/worldserver.conf.dist docker/worldserver/etc/worldserver.conf.dist -cp src/server/authserver/authserver.conf.dist docker/authserver/etc/authserver.conf.dist - -cp docker/worldserver/etc/worldserver.conf.dockerdist docker/worldserver/etc/worldserver.conf -cp docker/authserver/etc/authserver.conf.dockerdist docker/authserver/etc/authserver.conf - -if [ $OSTYPE = msys ]; then - dos2unix docker/worldserver/etc/* docker/authserver/etc/* -fi diff --git a/bin/acore-docker-remove-build-cache b/bin/acore-docker-remove-build-cache deleted file mode 100755 index d455f2a976..0000000000 --- a/bin/acore-docker-remove-build-cache +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -if [ "$(id -u)" != "0" ] && [ "$OSTYPE" != "msys" ] ; then - echo "Please run the script with sudo" -else - rm -rf ./docker/build/cache/CMakeFiles - rm -rf ./docker/build/cache/deps - rm -rf ./docker/build/cache/src - rm ./docker/build/cache/*.cmake - rm ./docker/build/cache/*.txt - rm ./docker/build/cache/*.h - rm ./docker/build/cache/*.cpp - rm ./docker/build/cache/Makefile -fi diff --git a/bin/acore-subrepo-update b/bin/acore-subrepo-update new file mode 100755 index 0000000000..bc05e4a042 --- /dev/null +++ b/bin/acore-subrepo-update @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +####################### +# +# README +# +# This script is used to automatically update +# submodules and subrepos included in this project +# Subrepo are updated in bidirectional way (pull + push) +# because they are intended to be developed by this organization +# +# NOTE: only maintainers and CI should run this script and +# keep it updated +# +####################### + +set -e +ROOT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../" +# update all submodules +git submodule update --init --recursive +git submodule foreach git pull origin master +# include libraries for git subrepo +source "$ROOT_PATH/deps/git-subrepo/.rc" +source "$ROOT_PATH/deps/acore/bash-lib/src/git-utils/subrepo.sh" + +echo "> Pulling and update all subrepos" + +subrepoUpdate https://github.com/azerothcore/bash-lib master deps/acore/bash-lib + +subrepoUpdate https://github.com/azerothcore/cmake-utils master deps/acore/cmake-utils + +subrepoUpdate https://github.com/azerothcore/mysql-tools master deps/acore/mysql-tools + +subrepoUpdate https://github.com/azerothcore/joiner master deps/acore/joiner diff --git a/conf/dist/config.cmake b/conf/dist/config.cmake index 3b2000b638..d11b5a1db0 100644 --- a/conf/dist/config.cmake +++ b/conf/dist/config.cmake @@ -12,6 +12,19 @@ option(WITHOUT_GIT "Disable the GIT testing routines" option(ENABLE_EXTRAS "Set to 0 to disable extra features optimizing performances" 1) option(ENABLE_VMAP_CHECKS "Enable Checks relative to DisableMgr system on vmap" 1) option(ENABLE_EXTRA_LOGS "Enable extra log functions that can be CPU intensive" 0) +option(WITH_DYNAMIC_LINKING "Enable dynamic library linking." 0) + +IsDynamicLinkingRequired(WITH_DYNAMIC_LINKING_FORCED) + +if(WITH_DYNAMIC_LINKING AND WITH_DYNAMIC_LINKING_FORCED) + set(WITH_DYNAMIC_LINKING_FORCED OFF) +endif() + +if(WITH_DYNAMIC_LINKING OR WITH_DYNAMIC_LINKING_FORCED) + set(BUILD_SHARED_LIBS ON) +else() + set(BUILD_SHARED_LIBS OFF) +endif() # Source tree in IDE set(WITH_SOURCE_TREE "hierarchical" CACHE STRING "Build the source tree for IDE's.") diff --git a/conf/dist/config.sh b/conf/dist/config.sh index 8feef71197..c9ef22abc7 100644 --- a/conf/dist/config.sh +++ b/conf/dist/config.sh @@ -5,7 +5,9 @@ SRCPATH="$AC_PATH_ROOT" # absolute path where build files must be stored BUILDPATH="$AC_PATH_ROOT/var/build/obj" -# absolute path where binary files must be stored +# absolute path where azerothcore will be installed +# NOTE: on linux the binaries are stored in a subfolder (/bin) +# of the $BINPATH BINPATH="$AC_PATH_ROOT/env/dist" # bash fills it by default with your os type. No need to change it. @@ -15,12 +17,17 @@ BINPATH="$AC_PATH_ROOT/env/dist" # When using linux, our installer automatically get information about your distro # using lsb_release. If your distro is not supported but it's based on ubuntu or debian, # please change it to one of these values. -#OSDISTRO="ubuntu" +# OSDISTRO="ubuntu" # absolute path where config. files must be stored # default: the system will use binpath by default # CONFDIR="$AC_PATH_ROOT/env/dist/etc/" +# absolute path where maps and client data will be downloaded +# by the AC dashboard +# default: the system will use binpath by default +# DATAPATH="$BINPATH/bin" + ############################################## # # COMPILER_CONFIGURATIONS @@ -43,10 +50,16 @@ MTHREADS=0 CWARNINGS=ON # enable/disable some debug informations ( it's not a debug compilation ) CDEBUG=OFF -# specify compilation type -CTYPE=Release +# specify compilation type: +# * Release: high optimization level, no debug info, code or asserts. +# * Debug: No optimization, asserts enabled, [custom debug (output) code enabled], +# debug info included in executable (so you can step through the code with a +# debugger and have address to source-file:line-number translation). +# * RelWithDebInfo: optimized, *with* debug info, but no debug (output) code or asserts. +# * MinSizeRel: same as Release but optimizing for size rather than speed. +CTYPE=${CTYPE:-Release} # compile scripts -CSCRIPTS=ON +CSCRIPTS=${CSCRIPTS:-ON} # compile unit tests CBUILD_TESTING=OFF # compile server @@ -76,17 +89,21 @@ CCUSTOMOPTIONS="" ############################################## # -# Basically you don't have to edit it -# but if you have another database you can add it here -# and create relative confiugurations below +# Comma separated list of databases +# +# You can add another element here if you need +# to support multiple databases # -DATABASES=( - "AUTH" - "CHARACTERS" - "WORLD" -) -OUTPUT_FOLDER="$AC_PATH_ROOT/env/dist/sql/" +DBLIST=${DBLIST:-"AUTH,CHARACTERS,WORLD"} +# convert from comma separated list to an array. +# This is needed to support environment variables +readarray -td, DATABASES <<<"$DBLIST"; + +OUTPUT_FOLDER=${OUTPUT_FOLDER:-"$AC_PATH_ROOT/env/dist/sql/"} + +DBASM_WAIT_TIMEOUT=${DBASM_WAIT_TIMEOUT:-1} +DBASM_WAIT_RETRIES=${DBASM_WAIT_RETRIES:-3} ####### BACKUP # Set to true if you want to backup your azerothcore databases before importing the SQL with the db_assembler @@ -163,23 +180,23 @@ DB_MYSQL_EXEC="mysql" DB_MYSQL_DUMP_EXEC="mysqldump" -DB_AUTH_CONF="MYSQL_USER='acore'; \ +DB_AUTH_CONF=${DB_AUTH_CONF:-"MYSQL_USER='acore'; \ MYSQL_PASS='acore'; \ MYSQL_HOST='localhost';\ MYSQL_PORT='3306';\ - " + "} -DB_CHARACTERS_CONF="MYSQL_USER='acore'; \ +DB_CHARACTERS_CONF=${DB_CHARACTERS_CONF:-"MYSQL_USER='acore'; \ MYSQL_PASS='acore'; \ MYSQL_HOST='localhost';\ MYSQL_PORT='3306';\ - " + "} -DB_WORLD_CONF="MYSQL_USER='acore'; \ +DB_WORLD_CONF=${DB_WORLD_CONF:-"MYSQL_USER='acore'; \ MYSQL_PASS='acore'; \ MYSQL_HOST='localhost';\ MYSQL_PORT='3306';\ - " + "} DB_AUTH_NAME="acore_auth" diff --git a/conf/dist/docker-compose.override.yml b/conf/dist/docker-compose.override.yml new file mode 100644 index 0000000000..1e71bd8c64 --- /dev/null +++ b/conf/dist/docker-compose.override.yml @@ -0,0 +1,4 @@ +version: '3.8' +# services: +# ac-worldserver-2: + diff --git a/conf/dist/env.ac b/conf/dist/env.ac new file mode 100644 index 0000000000..0639e2349f --- /dev/null +++ b/conf/dist/env.ac @@ -0,0 +1,31 @@ +# +# GENERAL +# + +USER_CONF_PATH=/azerothcore/apps/docker/config-docker.sh +DATAPATH=/azerothcore/env/dist/data + +# +# COMPILER +# +CTYPE=RelWithDebInfo +CSCRIPTS=ON + +# +# DATABASE +# + +OUTPUT_FOLDER=/azerothcore/var/build/sql/ + +DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='password'; MYSQL_HOST='ac-database'; MYSQL_PORT='3306';" + +DB_CHARACTERS_CONF="MYSQL_USER='root'; MYSQL_PASS='password'; MYSQL_HOST='ac-database'; MYSQL_PORT='3306';" + +DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='password'; MYSQL_HOST='ac-database'; MYSQL_PORT='3306';" + +# +# SIMPLE RESTARTER +# +AC_RESTARTER_BINPATH= +AC_RESTARTER_BINFILE= +AC_RESTARTER_WITHGDB= diff --git a/conf/dist/env.docker b/conf/dist/env.docker new file mode 100644 index 0000000000..28e91af917 --- /dev/null +++ b/conf/dist/env.docker @@ -0,0 +1,23 @@ +# +# Create a .env file in the root folder and use the following +# variables to configure your docker-compose +# + +DOCKER_AC_ENV_FILE= + +DOCKER_DATA=./env/docker/data +DOCKER_ETC=./env/docker/etc +DOCKER_LOGS=./env/docker/logs +DOCKER_CONF=./conf + +DOCKER_WORLD_EXTERNAL_PORT=8085 +DOCKER_AUTH_EXTERNAL_PORT=3724 +DOCKER_DB_EXTERNAL_PORT=3306 +DOCKER_DB_ROOT_PASSWORD=password +DOCKER_SOAP_EXTERNAL_PORT=7878 + +# To maximize the performance on MAC you can change the DOCKER_EXTENDS_BIND variable +# to "abstract-no-bind", however it won't bind the host directory inside the container. +# It means that you need to work directly within the container using a tool +# like the VScode dev-container of the remote-extension suite +DOCKER_EXTENDS_BIND=abstract-bind diff --git a/data/sql/updates/db_world/2021_04_16_00.sql b/data/sql/updates/db_world/2021_04_16_00.sql new file mode 100644 index 0000000000..41a3e028fd --- /dev/null +++ b/data/sql/updates/db_world/2021_04_16_00.sql @@ -0,0 +1,143 @@ +-- DB update 2021_04_14_02 -> 2021_04_16_00 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_14_02'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_14_02 2021_04_16_00 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1605009324701425500'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1605009324701425500'); + +SET @NPC_JONATHAN := 28136; +SET @NPC_LAMOOF := 28142; +SET @NPC_JOSEPHINE := 28148; + +UPDATE `creature_template` SET `gossip_menu_id`=9660 WHERE `entry`=@NPC_JONATHAN; +UPDATE `creature_template` SET `gossip_menu_id`=9659 WHERE `entry`=@NPC_LAMOOF; +UPDATE `creature_template` SET `gossip_menu_id`=9658 WHERE `entry`=@NPC_JOSEPHINE; +UPDATE `creature_template` SET `faction`=2070, `npcflag`=1, `unit_flags`=32768, `AIName`='SmartAI' WHERE `entry` IN (@NPC_JONATHAN,@NPC_LAMOOF,@NPC_JOSEPHINE); +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` IN (@NPC_JONATHAN,@NPC_LAMOOF,@NPC_JOSEPHINE); +DELETE FROM `smart_scripts` WHERE `source_type`=9 AND `entryorguid` IN (@NPC_JONATHAN*100,@NPC_LAMOOF*100,@NPC_JOSEPHINE*100); +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@NPC_JONATHAN,0,0,1,54,0,100,0,0,0,0,0,11,50665,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - Just summoned - Spellcast Bleeding Out'), +(@NPC_JONATHAN,0,1,2,61,0,100,0,0,0,0,0,64,1,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Crusader Jonathan - Just summoned - Store targetlist'), +(@NPC_JONATHAN,0,2,3,61,0,100,0,0,0,0,0,29,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Crusader Jonathan - Just summoned - Follow envoker'), +(@NPC_JONATHAN,0,3,4,61,0,100,0,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - Just summoned - Set phase 1'), +(@NPC_JONATHAN,0,4,0,61,0,100,0,0,0,0,0,91,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - Just summoned - Reset unit_field_bytes1'), +(@NPC_JONATHAN,0,5,0,23,1,100,1,50665,0,0,0,80,@NPC_JONATHAN*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - Aura Bleeding Out missing (phase 1) - Call timed actionlist'), +(@NPC_JONATHAN,0,6,7,40,0,100,1,5,0,0,0,90,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On WP 5 reached - Set unit_field_bytes1'), +(@NPC_JONATHAN,0,7,0,61,0,100,0,0,0,0,0,41,20000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On WP 5 reached - Despawn after 20 seconds'), +(@NPC_JONATHAN,0,8,9,8,1,100,0,50669,0,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On spellhit Quest Credit - Set phase 2'), +(@NPC_JONATHAN,0,9,10,61,0,100,0,0,0,0,0,11,50671,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On spellhit Quest Credit - Cast Kill Credit Jonathan 01'), +(@NPC_JONATHAN,0,10,11,61,0,100,0,0,0,0,0,11,50709,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On spellhit Quest Credit - Cast Strip Aura Jonathan 01'), +(@NPC_JONATHAN,0,11,12,61,0,100,0,0,0,0,0,86,50680,0,12,1,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On spellhit Quest Credit - Crosscast Kill Credit Jonathan'), +(@NPC_JONATHAN,0,12,13,61,0,100,0,0,0,0,0,86,50710,0,12,1,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On spellhit Quest Credit - Crosscast Strip Aura Jonanthan'), +(@NPC_JONATHAN,0,13,14,61,0,100,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Crusader Jonathan - On spellhit Quest Credit - Stop follow'), +(@NPC_JONATHAN,0,14,15,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On spellhit Quest Credit - Say text'), +(@NPC_JONATHAN,0,15,16,61,0,100,0,0,0,0,0,53,0,@NPC_JONATHAN,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On spellhit Quest Credit - Start WP movement'), +(@NPC_JONATHAN,0,16,0,61,0,100,0,0,0,0,0,83,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan - On spellhit Quest Credit - Remove npcflag'), +(@NPC_JONATHAN*100,9,0,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan script - Say text'), +(@NPC_JONATHAN*100,9,1,0,0,0,100,0,0,0,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan script - Set phase 2'), +(@NPC_JONATHAN*100,9,2,0,0,0,100,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Crusader Jonathan script - Stop follow'), +(@NPC_JONATHAN*100,9,3,0,0,0,100,0,2000,2000,0,0,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Jonathan script - Die'), + +(@NPC_LAMOOF,0,0,1,54,0,100,0,0,0,0,0,11,50681,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - Just summoned - Spellcast Bleeding Out'), +(@NPC_LAMOOF,0,1,2,61,0,100,0,0,0,0,0,64,1,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Crusader Lamoof - Just summoned - Store targetlist'), +(@NPC_LAMOOF,0,2,3,61,0,100,0,0,0,0,0,29,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Crusader Lamoof - Just summoned - Follow envoker'), +(@NPC_LAMOOF,0,3,4,61,0,100,0,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - Just summoned - Set phase 1'), +(@NPC_LAMOOF,0,4,0,61,0,100,0,0,0,0,0,91,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - Just summoned - Reset unit_field_bytes1'), +(@NPC_LAMOOF,0,5,0,23,1,100,1,50681,0,0,0,80,@NPC_LAMOOF*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - Aura Bleeding Out missing (phase 1) - Call timed actionlist'), +(@NPC_LAMOOF,0,6,7,40,0,100,1,5,0,0,0,90,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On WP 5 reached - Set unit_field_bytes1'), +(@NPC_LAMOOF,0,7,0,61,0,100,0,0,0,0,0,41,20000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On WP 5 reached - Despawn after 20 seconds'), +(@NPC_LAMOOF,0,8,9,8,1,100,0,50669,0,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On spellhit Quest Credit - Set phase 2'), +(@NPC_LAMOOF,0,9,10,61,0,100,0,0,0,0,0,11,50683,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On spellhit Quest Credit - Cast Kill Credit Lamoof 01'), +(@NPC_LAMOOF,0,10,11,61,0,100,0,0,0,0,0,11,50723,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On spellhit Quest Credit - Cast Strip Aura Lamoof 01'), +(@NPC_LAMOOF,0,11,12,61,0,100,0,0,0,0,0,86,50684,0,12,1,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On spellhit Quest Credit - Crosscast Kill Credit Lamoof'), +(@NPC_LAMOOF,0,12,13,61,0,100,0,0,0,0,0,86,50722,0,12,1,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On spellhit Quest Credit - Crosscast Strip Aura Lamoof'), +(@NPC_LAMOOF,0,13,14,61,0,100,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Crusader Lamoof - On spellhit Quest Credit - Stop follow'), +(@NPC_LAMOOF,0,14,15,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On spellhit Quest Credit - Say text'), +(@NPC_LAMOOF,0,15,16,61,0,100,0,0,0,0,0,53,0,@NPC_LAMOOF,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On spellhit Quest Credit - Start WP movement'), +(@NPC_LAMOOF,0,16,0,61,0,100,0,0,0,0,0,83,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof - On spellhit Quest Credit - Remove npcflag'), +(@NPC_LAMOOF*100,9,0,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof script - Say text'), +(@NPC_LAMOOF*100,9,1,0,0,0,100,0,0,0,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof script - Set phase 2'), +(@NPC_LAMOOF*100,9,2,0,0,0,100,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Crusader Lamoof script - Stop follow'), +(@NPC_LAMOOF*100,9,3,0,0,0,100,0,2000,2000,0,0,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Lamoof script - Die'), + +(@NPC_JOSEPHINE,0,0,1,54,0,100,0,0,0,0,0,11,50695,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - Just summoned - Spellcast Bleeding Out'), +(@NPC_JOSEPHINE,0,1,2,61,0,100,0,0,0,0,0,64,1,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Crusader Josephine - Just summoned - Store targetlist'), +(@NPC_JOSEPHINE,0,2,3,61,0,100,0,0,0,0,0,29,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Crusader Josephine - Just summoned - Follow envoker'), +(@NPC_JOSEPHINE,0,3,4,61,0,100,0,0,0,0,0,22,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - Just summoned - Set phase 1'), +(@NPC_JOSEPHINE,0,4,0,61,0,100,0,0,0,0,0,91,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - Just summoned - Reset unit_field_bytes1'), +(@NPC_JOSEPHINE,0,5,0,23,1,100,1,50695,0,0,0,80,@NPC_JOSEPHINE*100,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - Aura Bleeding Out missing (phase 1) - Call timed actionlist'), +(@NPC_JOSEPHINE,0,6,7,40,0,100,1,4,0,0,0,90,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On WP 4 reached - Set unit_field_bytes1'), +(@NPC_JOSEPHINE,0,7,0,61,0,100,0,0,0,0,0,41,20000,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On WP 4 reached - Despawn after 20 seconds'), +(@NPC_JOSEPHINE,0,8,9,8,1,100,0,50669,0,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On spellhit Quest Credit - Set phase 2'), +(@NPC_JOSEPHINE,0,9,10,61,0,100,0,0,0,0,0,11,50698,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On spellhit Quest Credit - Cast Kill Credit Jospehine 01'), +(@NPC_JOSEPHINE,0,10,11,61,0,100,0,0,0,0,0,11,50711,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On spellhit Quest Credit - Cast Strip Aura Josephine 01'), +(@NPC_JOSEPHINE,0,11,12,61,0,100,0,0,0,0,0,86,50699,0,12,1,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On spellhit Quest Credit - Crosscast Kill Credit Josephine'), +(@NPC_JOSEPHINE,0,12,13,61,0,100,0,0,0,0,0,86,50712,0,12,1,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On spellhit Quest Credit - Crosscast Strip Aura Josephine'), +(@NPC_JOSEPHINE,0,13,14,61,0,100,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Crusader Josephine - On spellhit Quest Credit - Stop follow'), +(@NPC_JOSEPHINE,0,14,15,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On spellhit Quest Credit - Say text'), +(@NPC_JOSEPHINE,0,15,16,61,0,100,0,0,0,0,0,53,0,@NPC_JOSEPHINE,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On spellhit Quest Credit - Start WP movement'), +(@NPC_JOSEPHINE,0,16,0,61,0,100,0,0,0,0,0,83,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine - On spellhit Quest Credit - Remove npcflag'), +(@NPC_JOSEPHINE*100,9,0,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine script - Say text'), +(@NPC_JOSEPHINE*100,9,1,0,0,0,100,0,0,0,0,0,22,2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine script - Set phase 2'), +(@NPC_JOSEPHINE*100,9,2,0,0,0,100,0,0,0,0,0,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Crusader Josephine script - Stop follow'), +(@NPC_JOSEPHINE*100,9,3,0,0,0,100,0,2000,2000,0,0,37,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Crusader Josephine script - Die'); + +DELETE FROM `waypoints` WHERE `entry` IN (@NPC_JONATHAN,@NPC_LAMOOF,@NPC_JOSEPHINE); +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`) VALUES +(@NPC_JONATHAN,1,5257.454,-3500.14,291.6933), +(@NPC_JONATHAN,2,5253.089,-3516.885,291.6786), +(@NPC_JONATHAN,3,5255.452,-3523.673,291.6932), +(@NPC_JONATHAN,4,5262.733,-3527.41,291.6934), +(@NPC_JONATHAN,5,5261.445,-3528.885,291.6929), + +(@NPC_LAMOOF,1,5257.454,-3500.14,291.6933), +(@NPC_LAMOOF,2,5253.089,-3516.885,291.6786), +(@NPC_LAMOOF,3,5255.452,-3523.673,291.6932), +(@NPC_LAMOOF,4,5260.741,-3525.38,291.69343), +(@NPC_LAMOOF,5,5259.029,-3527.101,291.4913), + +(@NPC_JOSEPHINE,1,5257.454,-3500.14,291.6933), +(@NPC_JOSEPHINE,2,5253.089,-3516.885,291.6786), +(@NPC_JOSEPHINE,3,5257.784,-3521.994,291.6931), +(@NPC_JOSEPHINE,4,5256.293,-3523.494,291.6933); + +DELETE FROM `creature_text` WHERE `creatureid` IN (@NPC_JONATHAN,@NPC_LAMOOF,@NPC_JOSEPHINE) AND `groupid`=1; +INSERT INTO `creature_text` (`creatureid`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@NPC_JONATHAN,1,0,'... This is the end of me.',12,0,100,1,0,0,''), +(@NPC_LAMOOF,1,0,'... This is the end of me.',12,0,100,1,0,0,''), +(@NPC_JOSEPHINE,1,0,'Ohhh, I... cannot go on....',12,0,100,1,0,0,''); + +DELETE FROM `gossip_menu` WHERE `menuid` IN (9658,9659,9660); +INSERT INTO `gossip_menu` (`menuid`,`textid`) VALUES +(9658,13081), +(9659,13083), +(9660,13082); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (50709,50710,50711,50712,50722,50723); +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(50709,-50665,1,'Strip Aura Jonathan 01 remove aura Bleeding Out'), +(50710,-50666,1,'Strip Aura Jonathan remove aura Jonathan Dying from player'), +(50711,-50695,1,'Strip Aura Josephine 01 remove aura Bleeding Out'), +(50712,-50693,1,'Strip Aura Josephine remove aura Josephine Dying from player'), +(50722,-50679,1,'Strip Aura Lamoof remove aura Lamoof Dying from player'), +(50723,-50681,1,'Strip Aura Lamoof 01 remove aura Bleeding Out'); + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_17_00.sql b/data/sql/updates/db_world/2021_04_17_00.sql new file mode 100644 index 0000000000..6b1a78ea0f --- /dev/null +++ b/data/sql/updates/db_world/2021_04_17_00.sql @@ -0,0 +1,30 @@ +-- DB update 2021_04_16_00 -> 2021_04_17_00 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_16_00'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_16_00 2021_04_17_00 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618137493700140600'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618137493700140600'); + +-- Mulgore copper veins +UPDATE `gameobject` SET `position_x` = -3050.334229, `position_y` = 316.995148, `position_z` = 151.141052 WHERE `guid` = 4696; +UPDATE `gameobject` SET `position_x` = -3002.635986, `position_y` = 280.656830, `position_z` = 110.877350 WHERE `guid` = 20650; + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_18_00.sql b/data/sql/updates/db_world/2021_04_18_00.sql new file mode 100644 index 0000000000..0b5bdef9e0 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_18_00.sql @@ -0,0 +1,31 @@ +-- DB update 2021_04_17_00 -> 2021_04_18_00 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_17_00'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_17_00 2021_04_18_00 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1617964644615239534'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1617964644615239534'); + +SET @ENTRY := 11598; +DELETE FROM `creature_onkill_reputation` WHERE (`creature_id` = @ENTRY); +INSERT INTO `creature_onkill_reputation` (`creature_id`, `RewOnKillRepFaction1`, `RewOnKillRepFaction2`, `MaxStanding1`, `IsTeamAward1`, `RewOnKillRepValue1`, `MaxStanding2`, `IsTeamAward2`, `RewOnKillRepValue2`, `TeamDependent`) VALUES +(@ENTRY, 529, 0, 6, 0, 0, 0, 0, 0, 0); + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_18_01.sql b/data/sql/updates/db_world/2021_04_18_01.sql new file mode 100644 index 0000000000..e53fdf4e5c --- /dev/null +++ b/data/sql/updates/db_world/2021_04_18_01.sql @@ -0,0 +1,45 @@ +-- DB update 2021_04_18_00 -> 2021_04_18_01 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_18_00'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_18_00 2021_04_18_01 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618698984447935300'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618698984447935300'); + +-- Ground & water +UPDATE `creature_template` SET `InhabitType`=3 WHERE entry IN ( +3632, -- Deviate Creeper +3633, -- Deviate Slayer +3634, -- Deviate Stalker +3636, -- Deviate Ravager +3638); -- Devouring Ectoplasm + +-- Ground & air +UPDATE `creature_template` SET `InhabitType`=5 WHERE entry IN ( +3630, -- Deviate Coiler +3631, -- Deviate Stinglash +20797); -- Deviate Coiler Hatchling + +-- Improve SAI for Deviate Stinglash +-- https://wowgaming.altervista.org/aowow/?npc=3631#abilities +UPDATE `smart_scripts` SET `event_param1`=5000, `event_param2`=7000, `event_param3`=12000, `event_param4`=18000, `comment`='Deviate Stinglash - In Combat - Cast Lash' WHERE `entryorguid`=3631 AND `source_type`=0 AND `id`=0 AND `link`=0; + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_18_02.sql b/data/sql/updates/db_world/2021_04_18_02.sql new file mode 100644 index 0000000000..ca02363bbc --- /dev/null +++ b/data/sql/updates/db_world/2021_04_18_02.sql @@ -0,0 +1,168 @@ +-- DB update 2021_04_18_01 -> 2021_04_18_02 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_18_01'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_18_01 2021_04_18_02 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1614130170345582600'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1614130170345582600'); + +DELETE FROM `creature` WHERE `id` IN (2603, 2604, 2605, 2606, 14231, 14233, 14235, 14236, 14237, 14429); +DELETE FROM `creature_addon` WHERE `guid` IN (301300, 301292, 300777); +DELETE FROM `waypoint_data` WHERE `id` IN (3013000, 3012920, 3007770); +DELETE FROM `pool_creature` WHERE `pool_entry` IN (2605, 2606, 42939, 43157); +DELETE FROM `pool_template` WHERE `entry` IN (2605, 2606, 42939, 43157); +INSERT INTO `pool_template` (`entry`, `max_limit`, `description`) VALUES +(2605, 1, 'zalas witherbark'), +(2606, 1, 'nimar the slayer'), +(42939, 1, 'Drogoth the Roamer'), +(43157, 1, 'Ripscale'); + +-- arathi highlands +-- Kovork, +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES (300753, 2603, 0, -1192.92, -2079.91, 44.328, 1.92247, 27000, 0, 0); +-- molok the crusher +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES (300754, 2604, 0, -2044.39, -2803.18, 72.7163, 5.29147, 54000, 5, 1); +-- zalas witherbark +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES +(300757, 2605, 0, -2044.94, -3359.01, 60.6886, 0.443181, 252000, 5, 1), +(301300, 2605, 0, -2056.85, -3271.49, 49.4426, 3.13338, 252000, 0, 2), +(301301, 2605, 0, -2021.36, -3309.32, 54.3502, 5.92935, 252000, 0, 0), +(301302, 2605, 0, -2075.02, -3289.68, 67.3143, 3.72238, 252000, 5, 1); +INSERT INTO `pool_creature` (`guid`, `pool_entry`, `chance`, `description`) VALUES +(301300, 2605, 0, 'Zalas Witherbark (Youfie)'), +(301301, 2605, 0, 'Zalas Witherbark (Youfie)'), +(301302, 2605, 0, 'Zalas Witherbark (Youfie)'), +(300757, 2605, 0, 'Zalas Witherbark (Youfie)'); +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `isLarge`, `auras`) VALUES (301300, 3013000, 0, 0, 1, 0, 0, ''); +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`) VALUES +(3013000, 1, -2056.85, -3271.49, 49.4426, 3.13338, 0), +(3013000, 2, -2061.19, -3271.54, 50.2861, 3.15301, 500000), +(3013000, 3, -2083.62, -3276.01, 51.4356, 3.35722, 0), +(3013000, 4, -2098.75, -3286.29, 51.7022, 4.22115, 10000), +(3013000, 5, -2106.52, -3322.71, 56.8964, 1.3191, 0), +(3013000, 6, -2115.63, -3344.91, 58.7511, 4.33895, 10000), +(3013000, 7, -2109.39, -3369.78, 61.0127, 5.03795, 0), +(3013000, 8, -2091.81, -3381.89, 59.4361, 5.79586, 5000), +(3013000, 9, -2095.79, -3366.71, 59.3, 2.34403, 0), +(3013000, 10, -2093.88, -3364.27, 59.1176, 0.808577, 500000), +(3013000, 11, -2099.47, -3360.35, 59.2716, 2.55215, 0), +(3013000, 12, -2102.05, -3333.13, 58.104, 1.66465, 10000), +(3013000, 13, -2095.42, -3295.27, 52.4655, 1.09524, 0), +(3013000, 14, -2078.4, -3272.51, 51.7336, 0.965648, 0), +(3013000, 15, -2055.61, -3271.22, 49.3672, 3.19225, 0); +-- add two missing spells to Zalas and correct his timers based on vmangos +SET @ENTRY := 2605; +DELETE FROM smart_scripts WHERE entryOrGuid = 2605 AND source_type = 0; +UPDATE creature_template SET AIName="SmartAI" WHERE entry= @ENTRY; +INSERT INTO smart_scripts (entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o, comment) VALUES +(@ENTRY, 0, 0, 0, 0, 0, 80, 0, 5000, 5000, 15000, 25000, 11, 512, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Every 15 - 25 seconds (5 - 5s initially) - Self: Cast spell Chains of Ice (512) on Victim"), +(@ENTRY, 0, 1, 0, 0, 0, 80, 0, 3000, 3000, 15000, 15000, 11, 851, 1, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, "Every 15 seconds (3s initially) - Self: Cast spell Polymorph: Sheep (851) on Random hostile (not top) (flags: interrupt previous)"), +(@ENTRY, 0, 2, 0, 60, 0, 100, 0, 1000, 3000, 5000, 15000, 11, 4974, 32, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, "Every 5 - 15 seconds (1 - 3s initially) - Self: Cast spell Wither Touch (4974) on Random hostile (flags: aura not present)"), +(@ENTRY, 0, 3, 0, 60, 0, 100, 0, 5000, 8000, 8000, 15000, 11, 9081, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, "Every 8 - 15 seconds (5 - 8s initially) - Self: Cast spell Shadow Bolt Volley (9081) on Random hostile"); + + +-- nimar the slayer +-- TODO : he has a script or emote where he eats meat +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES +(300755, 2606, 0, -1902.16, -3193.09, 56.5808, 5.63212, 27000, 0, 0), +(301290, 2606, 0, -1810.14, -3417.2, 45.4232, 0.985671, 27000, 0, 0), +(301291, 2606, 0, -1701.21, -3509.16, 60.2556, 6.26748, 27000, 5, 1), +(301292, 2606, 0, -1672.56, -3246.93, 25.7297, 4.51998, 27000, 0, 2); +INSERT INTO `pool_creature` (`guid`, `pool_entry`, `chance`, `description`) VALUES +(300755, 2606, 0, 'Nimar the Slayer (Youfie)'), +(301290, 2606, 0, 'Nimar the Slayer (Youfie)'), +(301291, 2606, 0, 'Nimar the Slayer (Youfie)'), +(301292, 2606, 0, 'Nimar the Slayer (Youfie)'); +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `isLarge`, `auras`) VALUES (301292, 3012920, 0, 0, 1, 0, 0, ''); +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`) VALUES +(3012920, 1, -1672.56, -3246.93, 25.7297, 4.51998, 0), +(3012920, 2, -1673.33, -3252.4, 25.7306, 4.57495, 120000), +(3012920, 3, -1679.78, -3257.49, 25.5371, 3.8406, 0), +(3012920, 4, -1678.29, -3264.48, 24.3447, 5.92976, 0), +(3012920, 5, -1650.41, -3263.6, 26.8072, 6.20386, 0), +(3012920, 6, -1642.67, -3252.82, 31.5431, 1.3933, 0), +(3012920, 7, -1645.48, -3241.07, 33.4071, 2.38133, 0), +(3012920, 8, -1654.84, -3232.66, 33.5165, 2.42452, 0), +(3012920, 9, -1670.32, -3228.45, 34.6906, 2.91933, 0), +(3012920, 10, -1693.22, -3231.79, 29.2882, 6.01379, 0), +(3012920, 11, -1693.78, -3246.29, 26.4924, 4.78071, 0), +(3012920, 12, -1672.47, -3263.53, 25.0571, 5.57397, 15000), +(3012920, 13, -1668.16, -3255.58, 25.73, 2.7269, 0), +(3012920, 14, -1673.27, -3253.71, 25.7309, 1.5056, 0); +-- add cleave and berserker stance +SET @ENTRY := 2606; +DELETE FROM smart_scripts WHERE entryOrGuid = 2606 AND source_type = 0; +UPDATE creature_template SET AIName="SmartAI" WHERE entry= @ENTRY; +INSERT INTO smart_scripts (entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o, comment) VALUES +(@ENTRY, 0, 0, 0, 60, 0, 100, 0, 1000, 1000, 240000, 240000, 11, 2458, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "Every 240 seconds (1s initially) - Self: Cast spell Berserker Stance (2458) on Self"), +(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 7800, 10000, 11100, 24200, 11, 17207, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Every 11.1 - 24.2 seconds (7.8 - 10s initially) - Self: Cast spell Whirlwind (17207) on Victim"), +(@ENTRY, 0, 2, 0, 0, 0, 100, 0, 7000, 13000, 7000, 23000, 11, 15496, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Every 7 - 23 seconds (7 - 13s initially) - Self: Cast spell Cleave (15496) on Victim"), +(@ENTRY, 0, 3, 0, 12, 0, 100, 1, 0, 30, 0, 0, 11, 7160, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "When victim health between 0 - 30 (check every 0 - 0) - Self: Cast spell Execute (7160) on Victim (flags: interrupt previous)"), +(@ENTRY, 0, 4, 0, 2, 0, 100, 1, 0, 15, 0, 0, 25, 1, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, "When health between 0 and 15 (check every 0 - 0 ms) - Self: Flee for assist"); + +-- dustwallow marsh +-- drogoth the roamer +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES +(300769, 14231, 1, -2608.36, -3011.72, 29.4168, 0.0195422, 27000, 10, 1), +(300770, 14231, 1, -2799.72, -3129.45, 28.7032, 4.41743, 27000, 5, 1); +INSERT INTO `pool_creature` (`guid`, `pool_entry`, `chance`, `description`) VALUES (300769, 42939, 0, 'Dustwallow Marsh: Drogoth the Roamer'); +INSERT INTO `pool_creature` (`guid`, `pool_entry`, `chance`, `description`) VALUES (300770, 42939, 0, 'Dustwallow Marsh: Drogoth the Roamer'); +-- ripscale +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES +(300775, 14233, 1, -3969.57, -3182.07, 28.8974, 3.08685, 38000, 10, 1), +(300776, 14233, 1, -4040.93, -3557.63, 28.5225, 5.65789, 38000, 10, 1); +DELETE FROM `pool_creature` WHERE `guid` IN (300775,300776); +INSERT INTO `pool_creature` (`guid`, `pool_entry`, `chance`, `description`) VALUES +(300775, 43157, 0, 'Dustwallow Marsh: Ripscale'), +(300776, 43157, 0, 'Dustwallow Marsh: Ripscale'); +-- The rot +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES (300773, 14235, 1, -4042.09, -3753.6, 43.2492, 6.26622, 108000, 5, 1); +-- lord angler +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES (300771, 14236, 1, -4250.64, -3849.09, -6.71606, 5.12114, 108000, 5, 1); +-- oozeworm +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES (300772, 14237, 1, -4207.99, -2911.04, 44.9497, 2.051, 180000, 5, 1); + +-- teldrassil +-- grimmaw +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `MovementType`) VALUES (300777, 14429, 1, 9132.61, 1651.7, 1322.14, 4.25837, 9000, 0, 2); +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `isLarge`, `auras`) VALUES (300777, 3007770, 0, 0, 1, 0, 0, ''); +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`) VALUES +(3007770, 1, 9132.81, 1664.76, 1320.77, 4.74146, 0), +(3007770, 2, 9141.27, 1690.01, 1320.05, 1.23858, 0), +(3007770, 3, 9141.58, 1727.6, 1319.16, 1.73339, 0), +(3007770, 4, 9137.61, 1753.82, 1319.01, 1.808, 0), +(3007770, 5, 9116, 1771.33, 1321.66, 2.04362, 0), +(3007770, 6, 9109.14, 1808.41, 1325.54, 1.66663, 0), +(3007770, 7, 9111.24, 1823.84, 1328.53, 4.67864, 0), +(3007770, 8, 9108.77, 1809.06, 1325.75, 4.86517, 0), +(3007770, 9, 9115.99, 1771.94, 1321.74, 5.14595, 0), +(3007770, 10, 9136.82, 1754.07, 1318.87, 4.75914, 0), +(3007770, 11, 9141.64, 1726.7, 1319.16, 4.60991, 0), +(3007770, 12, 9141.35, 1689.69, 1320.03, 4.60991, 0), +(3007770, 13, 9131.44, 1665.16, 1320.95, 4.71202, 0), +(3007770, 14, 9132.59, 1646.61, 1322.61, 4.6806, 0); +-- add missing spell vicious bite +SET @ENTRY := 14429; +DELETE FROM smart_scripts WHERE entryOrGuid = 14429 AND source_type = 0; +UPDATE creature_template SET AIName="SmartAI" WHERE entry= @ENTRY; +INSERT INTO smart_scripts (entryorguid, source_type, id, link, event_type, event_phase_mask, event_chance, event_flags, event_param1, event_param2, event_param3, event_param4, action_type, action_param1, action_param2, action_param3, action_param4, action_param5, action_param6, target_type, target_param1, target_param2, target_param3, target_x, target_y, target_z, target_o, comment) VALUES +(@ENTRY, 0, 0, 0, 0, 0, 100, 0, 4000, 4000, 6000, 8000, 11, 19319, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Every 6 - 8 seconds (4 - 4s initially) - Self: Cast spell Vicious Bite (19319) on Victim"); + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_18_03.sql b/data/sql/updates/db_world/2021_04_18_03.sql new file mode 100644 index 0000000000..51303228f3 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_18_03.sql @@ -0,0 +1,42 @@ +-- DB update 2021_04_18_02 -> 2021_04_18_03 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_18_02'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_18_02 2021_04_18_03 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618147391543148390'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618147391543148390'); + +DELETE FROM `creature` WHERE (`id` = 6909) AND (`guid` IN (2499)); +INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `ScriptName`, `VerifiedBuild`) VALUES +(2499, 6909, 1, 0, 0, 1, 1, 0, 0, 11077.9, 1902.37, 1342.63, 2.18262, 516, 0, 0, 247, 0, 2, 0, 0, 0, '', 0); + +DELETE FROM `creature_addon` WHERE (`guid` IN (2499)); +INSERT INTO `creature_addon` (`guid`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `isLarge`, `auras`) VALUES +(2499, 24990, 0, 0, 4097, 0, 0, NULL); + +DELETE FROM `waypoint_data` WHERE `id` = 24990; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_type`,`action`,`action_chance`,`wpguid`) VALUES +(24990, 1, 11052.318359, 1921.549927, 1332.641724, 2.536241, 0, 0, 0, 100, 0), +(24990, 2, 11021.328125, 1909.217896, 1327.031128, 3.541551, 12000, 0, 0, 100, 0), +(24990, 3, 11027.135742, 1911.013672, 1327.976685, 1.816816, 5000, 0, 0, 100, 0), +(24990, 4, 11052.318359, 1921.549927, 1332.641724, 2.536241, 0, 0, 0, 100, 0), +(24990, 5, 11077.9, 1902.37, 1342.63, 2.18262, 3000, 0, 0, 100, 0); + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_00.sql b/data/sql/updates/db_world/2021_04_19_00.sql new file mode 100644 index 0000000000..38ce07fc4d --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_00.sql @@ -0,0 +1,31 @@ +-- DB update 2021_04_18_03 -> 2021_04_19_00 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_18_03'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_18_03 2021_04_19_00 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618166495075484153'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618166495075484153'); + +UPDATE `creature_equip_template` SET `itemID3`=5870 WHERE `CreatureID` IN (701); +UPDATE `smart_scripts` SET `action_param2`=`action_param2`|2 WHERE `source_type`=0 AND `entryorguid`=7856 AND `id`=0; +UPDATE `creature_equip_template` SET `itemID3`=5856 WHERE `CreatureID` IN (1162); + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_01.sql b/data/sql/updates/db_world/2021_04_19_01.sql new file mode 100644 index 0000000000..601dc661bc --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_01.sql @@ -0,0 +1,37 @@ +-- DB update 2021_04_19_00 -> 2021_04_19_01 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_00'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_00 2021_04_19_01 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618169172923159272'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618169172923159272'); + +DELETE FROM `gameobject` WHERE (`id` = 2040) AND (`guid` IN (32880)); -- mithril vein duplicate +DELETE FROM `gameobject` WHERE (`id` = 3726) AND (`guid` IN (13596)); -- earthroot duplicate +DELETE FROM `gameobject` WHERE (`id` = 175404) AND (`guid` IN (17506, 17507)); -- rich thorium veins duplicate + +-- fix spawn small thorium vein +DELETE FROM `gameobject` WHERE (`id` = 324) AND (`guid` IN (317)); +INSERT INTO `gameobject` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `ScriptName`, `VerifiedBuild`) VALUES +(317, 324, 1, 0, 0, 1, 1, -7213.251465, -2300.464355, -262.501099, 3.603, 0, 0, -0.973506, 0.228663, 2700, 100, 1, '', 0); + +DELETE FROM `gameobject` WHERE (`id` = 324) AND (`guid` IN (374)); -- small thorium vein cluster (removed 1 on 3) + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_02.sql b/data/sql/updates/db_world/2021_04_19_02.sql new file mode 100644 index 0000000000..3c946d2f23 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_02.sql @@ -0,0 +1,30 @@ +-- DB update 2021_04_19_01 -> 2021_04_19_02 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_01'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_01 2021_04_19_02 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618169871194421039'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618169871194421039'); + +DELETE FROM `creature` WHERE (`id` = 9164) AND (`guid` IN (24506)); +INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `ScriptName`, `VerifiedBuild`) VALUES +(24506, 9164, 1, 0, 0, 1, 1, 8512, 0, -7306.250977, -375.499695, -268.558746, 0.703892, 300, 5, 0, 3293, 0, 1, 0, 0, 0, '', 0); + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_03.sql b/data/sql/updates/db_world/2021_04_19_03.sql new file mode 100644 index 0000000000..421b055e5d --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_03.sql @@ -0,0 +1,31 @@ +-- DB update 2021_04_19_02 -> 2021_04_19_03 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_02'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_02 2021_04_19_03 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618170334855143471'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618170334855143471'); + +DELETE FROM `creature` WHERE (`id` = 6491) AND (`guid` IN (950)); +INSERT INTO `creature` (`guid`, `id`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `modelid`, `equipment_id`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `wander_distance`, `currentwaypoint`, `curhealth`, `curmana`, `MovementType`, `npcflag`, `unit_flags`, `dynamicflags`, `ScriptName`, `VerifiedBuild`) VALUES +(950, 6491, 0, 0, 0, 1, 1, 0, 0, 2053.1, -5019.08, 75.2506, 0.0315629, 300, 0, 0, 4121, 0, 0, 0, 0, 0, '', 0); + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_04.sql b/data/sql/updates/db_world/2021_04_19_04.sql new file mode 100644 index 0000000000..af4e451ad0 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_04.sql @@ -0,0 +1,35 @@ +-- DB update 2021_04_19_03 -> 2021_04_19_04 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_03'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_03 2021_04_19_04 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618177960313931100'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618177960313931100'); + +-- Links a gossip text to NPC Terenthis in Auberdine, Darkshore +-- https://github.com/azerothcore/azerothcore-wotlk/issues/5227 +-- https://www.youtube.com/watch?v=ZwFgc6P3ERc +DELETE FROM `gossip_menu` WHERE (`MenuID` = 6456) AND (`TextID` IN (3334)); +INSERT INTO `gossip_menu` (`MenuID`, `TextID`) VALUES (6456, 3334); +UPDATE `creature_template` SET `gossip_menu_id` = 6456 WHERE `entry` = 3693; -- Add created gossip menu to NPC +UPDATE `npc_text` SET `BroadcastTextID0` = '0' WHERE `ID` = 3334; -- This was set to a text with typos, not sure why +UPDATE `creature_template` SET `npcflag` = `npcflag` | 1 WHERE `entry` = 3693; -- Make sure the NPC has the gossip flag + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_05.sql b/data/sql/updates/db_world/2021_04_19_05.sql new file mode 100644 index 0000000000..39c5202402 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_05.sql @@ -0,0 +1,30 @@ +-- DB update 2021_04_19_04 -> 2021_04_19_05 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_04'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_04 2021_04_19_05 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618180915871216782'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618180915871216782'); + +DELETE FROM `creature_loot_template` WHERE `Reference` = 24048; +INSERT INTO `creature_loot_template` VALUES (2345, 24048, 24048, 4, 0, 1, 1, 1, 1, 'Dun Garok Rifleman - (ReferenceTable)'); + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_06.sql b/data/sql/updates/db_world/2021_04_19_06.sql new file mode 100644 index 0000000000..64422dee3f --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_06.sql @@ -0,0 +1,39 @@ +-- DB update 2021_04_19_05 -> 2021_04_19_06 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_05'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_05 2021_04_19_06 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618250435092390200'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618250435092390200'); + +DELETE FROM `spell_dbc` WHERE (`ID` IN (16256, 16257, 16277, 16278, 16279, 16280, 16281, 16282, 16283, 16284)); +INSERT INTO `spell_dbc` VALUES +(16256, 0, 0, 0, 208, 0, 0, 67108864, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 0, 0, 0, 1, 21, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16257, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 1','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16257s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190,'','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), +(16257, 0, 0, 0, 0, 0, 0, 524288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 3, 0, 0, 1, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2759, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 1','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16257s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Attack speed increased by $16257s1%.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 11, 0, 512, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), +(16277, 0, 0, 0, 0, 0, 0, 524288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 3, 0, 0, 1, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2759, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 2','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16277s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Attack speed increased by $16277s1%.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 11, 0, 512, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), +(16278, 0, 0, 0, 0, 0, 0, 524288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 3, 0, 0, 1, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2759, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 3','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16278s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Attack speed increased by $16278s1%.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 11, 0, 512, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), +(16279, 0, 0, 0, 0, 0, 0, 524288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 3, 0, 0, 1, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2759, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 4','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16279s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Attack speed increased by $16279s1%.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 11, 0, 512, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), +(16280, 0, 0, 0, 0, 0, 0, 524288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 3, 0, 0, 1, 8, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2759, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 5','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16280s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Attack speed increased by $16280s1%.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 11, 0, 512, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), +(16281, 0, 0, 0, 208, 0, 0, 67108864, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 0, 0, 0, 1, 21, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16277, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 2','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16277s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190,'','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), +(16282, 0, 0, 0, 208, 0, 0, 67108864, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 0, 0, 0, 1, 21, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16278, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 3','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16278s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190,'','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), +(16283, 0, 0, 0, 208, 0, 0, 67108864, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 0, 0, 0, 1, 21, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16279, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 4','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16279s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190,'','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0), +(16284, 0, 0, 0, 208, 0, 0, 67108864, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 20, 100, 0, 0, 0, 1, 21, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, 0, 50, 'Flurry','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Rank 5','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 'Increases your attack speed by $16280s1% for your next 3 swings after dealing a critical strike.','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190,'','','','','','','','','', 0, 0, 0, 0, 0, 0, 0, 16712190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0); + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_07.sql b/data/sql/updates/db_world/2021_04_19_07.sql new file mode 100644 index 0000000000..467e596533 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_07.sql @@ -0,0 +1,44 @@ +-- DB update 2021_04_19_06 -> 2021_04_19_07 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_06'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_06 2021_04_19_07 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618383191741891235'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618383191741891235'); + +UPDATE `quest_template_addon` SET `AllowableClasses` = 1090 WHERE (`ID` = 8989); +UPDATE `quest_template_addon` SET `AllowableClasses` = 9 WHERE (`ID` = 8990); +UPDATE `quest_template_addon` SET `AllowableClasses` = 144 WHERE (`ID` = 8991); +UPDATE `quest_template_addon` SET `AllowableClasses` = 260 WHERE (`ID` = 8992); +UPDATE `quest_template_addon` SET `AllowableClasses` = 9 WHERE (`ID` = 8985); +UPDATE `quest_template_addon` SET `AllowableClasses` = 1090 WHERE (`ID` = 8986); +UPDATE `quest_template_addon` SET `AllowableClasses` = 144 WHERE (`ID` = 8987); +UPDATE `quest_template_addon` SET `AllowableClasses` = 260 WHERE (`ID` = 8988); +UPDATE `quest_template_addon` SET `AllowableClasses` = 129 WHERE (`ID` = 8966); +UPDATE `quest_template_addon` SET `AllowableClasses` = 1280 WHERE (`ID` = 8967); +UPDATE `quest_template_addon` SET `AllowableClasses` = 12 WHERE (`ID` = 8968); +UPDATE `quest_template_addon` SET `AllowableClasses` = 82 WHERE (`ID` = 8969); +UPDATE `quest_template_addon` SET `AllowableClasses` = 129 WHERE (`ID` = 8962); +UPDATE `quest_template_addon` SET `AllowableClasses` = 1280 WHERE (`ID` = 8963); +UPDATE `quest_template_addon` SET `AllowableClasses` = 12 WHERE (`ID` = 8964); +UPDATE `quest_template_addon` SET `AllowableClasses` = 82 WHERE (`ID` = 8965); + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_08.sql b/data/sql/updates/db_world/2021_04_19_08.sql new file mode 100644 index 0000000000..3d53a74b36 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_08.sql @@ -0,0 +1,29 @@ +-- DB update 2021_04_19_07 -> 2021_04_19_08 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_07'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_07 2021_04_19_08 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618695684001514600'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618695684001514600'); + +UPDATE `gameobject` SET `position_x`=2660.25, `position_y`=1490.65, `position_z`=234.041, `zoneId`=406, `areaId`=467 WHERE `guid`=3716; + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_09.sql b/data/sql/updates/db_world/2021_04_19_09.sql new file mode 100644 index 0000000000..e79462bdc8 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_09.sql @@ -0,0 +1,29 @@ +-- DB update 2021_04_19_08 -> 2021_04_19_09 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_08'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_08 2021_04_19_09 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618694589843475600'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618694589843475600'); + +UPDATE `gameobject` SET `position_x`=1360.45, `position_y`=1536.73, `position_z`=149.534 WHERE `guid`=4186; + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_10.sql b/data/sql/updates/db_world/2021_04_19_10.sql new file mode 100644 index 0000000000..13e53128a6 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_10.sql @@ -0,0 +1,334 @@ +-- DB update 2021_04_19_09 -> 2021_04_19_10 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_09'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_09 2021_04_19_10 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1616252834972147900'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1616252834972147900'); +/* + * Zone: Shadowmoon Valley + * Update by Knindza | +*/ + +/* SMARTSCRIPT */ +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19788; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19788); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19788, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 38232, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Coilskar Muckwatcher - On Aggro - Cast \'38232\' (No Repeat)'), +(19788, 0, 1, 0, 0, 0, 100, 0, 5000, 10000, 15000, 20000, 11, 38029, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Coilskar Muckwatcher - In Combat - Cast \'38029\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19784; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19784); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19784, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 15000, 20000, 11, 38030, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Coilskar Cobra - In Combat - Cast \'38030\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19767; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19767); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19767, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 10000, 15000, 11, 32011, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Coilskar Sorceress - In Combat - Cast \'32011\''), +(19767, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 38026, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Coilskar Sorceress - Between 20-80% Health - Cast \'38026\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19765; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19765); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19765, 0, 0, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 38027, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Coilskar Myrmidon - Between 20-80% Health - Cast \'38027\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 20795; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 20795); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(20795, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 10000, 15000, 11, 32011, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Keeper of the Cistern - In Combat - Cast \'32011\''), +(20795, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 11831, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Keeper of the Cistern - Between 20-80% Health - Cast \'11831\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21205; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21205); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21205, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 15000, 20000, 11, 38363, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Ravenous Flayer Matriarch - In Combat - Cast \'38363\''), +(21205, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 36464, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Ravenous Flayer Matriarch - Between 20-80% Health - Cast \'36464\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21196; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21196); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21196, 0, 0, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 37933, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Ravenous Flayer - Between 20-80% Health - Cast \'37933\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21663; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21663); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21663, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 12550, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Oronu the Elder - On Aggro - Cast \'12550\' (No Repeat)'), +(21663, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 34079, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Oronu the Elder - Between 20-80% Health - Cast \'34079\' (No Repeat)'), +(21663, 0, 2, 0, 2, 0, 100, 1, 10, 30, 0, 0, 11, 11986, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Oronu the Elder - Between 10-30% Health - Cast \'11986\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21803; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21803); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21803, 0, 0, 0, 2, 0, 100, 1, 5, 30, 0, 0, 11, 8599, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Ashtongue Handler - Between 5-30% Health - Cast \'8599\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21802; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21802); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21802, 0, 0, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 38045, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Elekk Demolisher - Between 20-80% Health - Cast \'38045\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21453; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21453); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21453, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 12550, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Ashtongue Shaman - On Aggro - Cast \'12550\' (No Repeat)'), +(21453, 0, 1, 0, 0, 0, 100, 0, 5000, 10000, 20000, 25000, 11, 32062, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Ashtongue Shaman - In Combat - Cast \'32062\''), +(21453, 0, 2, 0, 2, 0, 100, 1, 5, 30, 0, 0, 11, 37067, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Ashtongue Shaman - Between 5-30% Health - Cast \'37067\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21808; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21808); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21808, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 15000, 20000, 11, 11977, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Overseer - In Combat - Cast \'11977\''), +(21808, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 32736, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Overseer - Between 20-80% Health - Cast \'32736\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21455; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21455); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21455, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 15000, 20000, 11, 6016, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Ashtongue Worker - In Combat - Cast \'6016\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 22037; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 22037); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(22037, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 10000, 15000, 11, 13444, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Smith Gorlunk - In Combat - Cast \'13444\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 22859; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 22859); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(22859, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 13338, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Shadowhoof Summoner - On Aggro - Cast \'13338\' (No Repeat)'), +(22859, 0, 1, 0, 0, 0, 100, 0, 2500, 4000, 8500, 10000, 11, 38386, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Shadowhoof Summoner - In Combat - Cast \'38386\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21166; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21166); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21166, 0, 0, 0, 0, 0, 100, 0, 2500, 4000, 8500, 10000, 11, 17287, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Dreadlord - In Combat - Cast \'17287\''), +(21166, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 12098, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Dreadlord - Between 20-80% Health - Cast \'12098\' (No Repeat)'), +(21166, 0, 2, 0, 2, 0, 100, 1, 5, 30, 0, 0, 11, 13704, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Dreadlord - Between 5-30% Health - Cast \'13704\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21908; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21908); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21908, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 15000, 20000, 11, 31553, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Spellbound Terrorguard - In Combat - Cast \'31553\''), +(21908, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 37488, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Spellbound Terrorguard - Between 20-80% Health - Cast \'37488\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21178; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21178); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21178, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 38010, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Varedis - On Aggro - Cast \'38010\' (No Repeat)'), +(21178, 0, 1, 0, 0, 0, 100, 0, 5000, 15000, 25000, 35000, 11, 39262, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 'Varedis - In Combat - Cast \'39262\''), +(21178, 0, 2, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 37683, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Varedis - Between 20-80% Health - Cast \'37683\' (No Repeat)'), +(21178, 0, 3, 0, 0, 0, 100, 0, 25000, 35000, 55000, 75000, 11, 38608, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Varedis - In Combat - Cast \'38608\''), +(21178, 0, 4, 0, 2, 0, 100, 1, 45, 50, 0, 0, 11, 36298, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Varedis - Between 45-50% Health - Cast \'36298\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21171; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21171); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21171, 0, 0, 0, 0, 0, 100, 0, 5000, 15000, 25000, 35000, 11, 39262, 32, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 'Alandien - In Combat - Cast \'39262\''), +(21171, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 37683, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Alandien - Between 20-80% Health - Cast \'37683\' (No Repeat)'), +(21171, 0, 2, 0, 2, 0, 100, 1, 45, 50, 0, 0, 11, 36298, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Alandien - Between 45-50% Health - Cast \'36298\' (No Repeat)'), +(21171, 0, 3, 0, 0, 0, 100, 0, 25000, 35000, 55000, 75000, 11, 39082, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Alandien - In Combat - Cast \'39082\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21164; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21164); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21164, 0, 0, 0, 0, 0, 100, 0, 5000, 15000, 25000, 35000, 11, 39262, 32, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 'Netharel - In Combat - Cast \'39262\''), +(21164, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 37683, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Netharel - Between 20-80% Health - Cast \'37683\' (No Repeat)'), +(21164, 0, 2, 0, 0, 0, 100, 0, 10000, 20000, 30000, 40000, 11, 39135, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Netharel - In Combat - Cast \'39135\''), +(21164, 0, 3, 0, 2, 0, 100, 1, 45, 50, 0, 0, 11, 36298, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Netharel - Between 45-50% Health - Cast \'36298\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21168; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21168); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21168, 0, 0, 0, 0, 0, 100, 0, 5000, 15000, 25000, 35000, 11, 39262, 32, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 'Theras - In Combat - Cast \'39262\''), +(21168, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 37683, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Theras - Between 20-80% Health - Cast \'37683\' (No Repeat)'), +(21168, 0, 2, 0, 0, 0, 100, 0, 10000, 20000, 30000, 40000, 11, 35871, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Theras - In Combat - Cast \'35871\''), +(21168, 0, 3, 0, 2, 0, 100, 1, 45, 50, 0, 0, 11, 36298, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Theras - Between 45-50% Health - Cast \'36298\' (No Repeat)'), +(21168, 0, 4, 0, 0, 0, 100, 0, 25000, 35000, 55000, 75000, 11, 31534, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Theras - In Combat - Cast \'31534\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21505; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21505); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21505, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 10000, 15000, 11, 13901, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Sunfury Summoner - In Combat - Cast \'13901\''), +(21505, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 14514, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Sunfury Summoner - Between 20-80% Health - Cast \'14514\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21179; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21179); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21179, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 32720, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Demon Hunter Supplicant - On Aggro - Cast \'32720\' (No Repeat)'), +(21179, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 37683, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Demon Hunter Supplicant - Between 20-80% Health - Cast \'37683\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21180; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21180); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21180, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 36051, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Demon Hunter Initiate - On Aggro - Cast \'36051\' (No Repeat)'), +(21180, 0, 1, 0, 0, 0, 100, 0, 5000, 10000, 15000, 20000, 11, 35871, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Demon Hunter Initiate - In Combat - Cast \'35871\''), +(21180, 0, 2, 0, 2, 0, 100, 1, 10, 30, 0, 0, 11, 27565, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Demon Hunter Initiate - Between 10-30% Health - Cast \'27565\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21742; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21742); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21742, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 38008, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Sunfury Eradicator - On Aggro - Cast \'38008\' (No Repeat)'), +(21742, 0, 1, 0, 2, 0, 100, 1, 10, 30, 0, 0, 11, 17137, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Sunfury Eradicator - Between 10-30% Health - Cast \'17137\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21827; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21827); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21827, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 38051, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Zandras - On Aggro - Cast \'38051\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19744; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19744); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19744, 0, 0, 0, 0, 0, 100, 0, 5000, 10000, 15000, 20000, 11, 32736, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Dreadwarden - In Combat - Cast \'32736\''), +(19744, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 11443, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Dreadwarden - Between 20-80% Health - Cast \'11443\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19801; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19801); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19801, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 10000, 12500, 11, 36227, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Agonizer - In Combat - Cast \'36227\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21520; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21520); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21520, 0, 0, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 38051, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Jailor - Between 20-80% Health - Cast \'38051\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21478; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21478); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21478, 0, 0, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 33912, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Rocknail Ripper - Between 20-80% Health - Cast \'33912\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21901; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21901); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21901, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 20000, 25000, 11, 36659, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Netherskate - In Combat - Cast \'36659\''), +(21901, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 17008, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Netherskate - Between 20-80% Health - Cast \'17008\' (No Repeat)'), +(21901, 0, 2, 0, 2, 0, 100, 1, 10, 30, 0, 0, 11, 35334, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Netherskate - Between 10-30% Health - Cast \'35334\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 23269; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 23269); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(23269, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 32732, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Barash the Den Mother - On Aggro - Cast \'32732\' (No Repeat)'), +(23269, 0, 1, 0, 0, 0, 100, 0, 2500, 5000, 20000, 25000, 11, 13443, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Barash the Den Mother - In Combat - Cast \'13443\''), +(23269, 0, 2, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 33810, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Barash the Den Mother - Between 20-80% Health - Cast \'33810\' (No Repeat)'), +(23269, 0, 3, 0, 2, 0, 100, 1, 10, 30, 0, 0, 11, 40636, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Barash the Den Mother - Between 10-30% Health - Cast \'40636\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 23267; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 23267); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(23267, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 32732, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Arvoar the Rapacious - On Aggro - Cast \'32732\' (No Repeat)'), +(23267, 0, 1, 0, 0, 0, 100, 0, 2500, 5000, 20000, 25000, 11, 13443, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Arvoar the Rapacious - In Combat - Cast \'13443\''), +(23267, 0, 2, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 33810, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Arvoar the Rapacious - Between 20-80% Health - Cast \'33810\' (No Repeat)'), +(23267, 0, 3, 0, 2, 0, 100, 1, 10, 30, 0, 0, 11, 40636, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Arvoar the Rapacious - Between 10-30% Health - Cast \'40636\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 23264; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 23264); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(23264, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 20000, 25000, 11, 13443, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Overmine Flayer - In Combat - Cast \'13443\''), +(23264, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 33810, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Overmine Flayer - Between 20-80% Health - Cast \'33810\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 22274; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 22274); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(22274, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 38859, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Dragonmaw Skybreaker - On Aggro - Cast \'38859\' (No Repeat)'), +(22274, 0, 1, 0, 0, 0, 100, 0, 5000, 10000, 15000, 20000, 11, 38861, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Dragonmaw Skybreaker - In Combat - Cast \'38861\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21711; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21711); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21711, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 10000, 12500, 11, 9532, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Haalum - In Combat - Cast \'9532\''), +(21711, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 12058, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Haalum - Between 20-80% Health - Cast \'12058\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 22093; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 22093); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(22093, 0, 0, 0, 0, 0, 100, 0, 5000, 10000, 15000, 20000, 11, 32736, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Watcher - In Combat - Cast \'32736\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 22011; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 22011); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(22011, 0, 0, 0, 0, 0, 100, 0, 5000, 10000, 15000, 20000, 11, 12612, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Corok the Mighty - In Combat - Cast \'12612\''), +(22011, 0, 1, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 15550, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Corok the Mighty - Between 20-80% Health - Cast \'15550\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21979; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21979); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21979, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 10000, 12500, 11, 38094, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Val\'zareq the Conqueror - In Combat - Cast \'38094\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19824; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19824); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19824, 0, 0, 0, 0, 0, 100, 0, 5000, 10000, 15000, 20000, 11, 12612, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Son of Corok - In Combat - Cast \'12612\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21639; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21639); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21639, 0, 0, 1, 4, 0, 100, 1, 0, 0, 0, 0, 11, 22120, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Slayer - On Aggro - Cast \'22120\' (No Repeat)'), +(21639, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 59, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Illidari Slayer - On Aggro - Set Run Off (No Repeat)'), +(21639, 0, 2, 0, 0, 0, 100, 0, 2500, 5000, 10000, 15000, 11, 15496, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Slayer - In Combat - Cast \'15496\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21450; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21450); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21450, 0, 0, 0, 2, 0, 100, 1, 20, 80, 0, 0, 11, 38254, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Skethyl Owl - Between 20-80% Health - Cast \'38254\' (No Repeat)'), +(21450, 0, 1, 0, 2, 0, 100, 1, 10, 30, 0, 0, 11, 38021, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Skethyl Owl - Between 10-30% Health - Cast \'38021\' (No Repeat)'); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19757; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19757); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19757, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 15000, 20000, 11, 11969, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Infernal Soul - In Combat - Cast \'11969\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21337; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21337); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21337, 0, 0, 0, 1, 0, 100, 1, 1000, 1500, 0, 0, 11, 5916, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Illidari Shadowstalker - Out of Combat - Cast \'5916\' (No Repeat)'), +(21337, 0, 1, 0, 0, 0, 100, 0, 2500, 5000, 10000, 12500, 11, 7159, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Shadowstalker - In Combat - Cast \'7159\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21928; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21928); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21928, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 38166, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Lothros - On Aggro - Cast \'38166\' (No Repeat)'), +(21928, 0, 1, 0, 0, 0, 100, 0, 5000, 10000, 20000, 25000, 11, 38167, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Lothros - In Combat - Cast \'38167\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19800; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19800); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19800, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 10000, 15000, 11, 15968, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Painlasher - In Combat - Cast \'15968\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19799; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19799); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19799, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 38166, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Illidari Dreadbringer - On Aggro - Cast \'38166\' (No Repeat)'), +(19799, 0, 1, 0, 0, 0, 100, 0, 5000, 10000, 20000, 25000, 11, 38167, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Dreadbringer - In Combat - Cast \'38167\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21656; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21656); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21656, 0, 0, 0, 0, 0, 100, 0, 2500, 5000, 15000, 20000, 11, 38048, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Satyr - In Combat - Cast \'38048\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 19802; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 19802); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(19802, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 22120, 32, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Shocktrooper - On Aggro - Cast \'22120\' (No Repeat)'), +(19802, 0, 1, 0, 0, 0, 100, 0, 2500, 5000, 10000, 15000, 11, 15496, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Illidari Shocktrooper - In Combat - Cast \'15496\''); + +UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 21408; +DELETE FROM `smart_scripts` WHERE (source_type = 0 AND entryorguid = 21408); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21408, 0, 0, 0, 4, 0, 100, 1, 0, 0, 0, 0, 11, 37941, 32, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Felfire Diemetradon - On Aggro - Cast \'37941\' (No Repeat)'), +(21408, 0, 1, 0, 0, 0, 100, 0, 2500, 5000, 10000, 12500, 11, 36247, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 'Felfire Diemetradon - In Combat - Cast \'36247\''); + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_19_11.sql b/data/sql/updates/db_world/2021_04_19_11.sql new file mode 100644 index 0000000000..d9616ade77 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_19_11.sql @@ -0,0 +1,30 @@ +-- DB update 2021_04_19_10 -> 2021_04_19_11 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_10'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_10 2021_04_19_11 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618438031594589517'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618438031594589517'); + +DELETE FROM `game_event_creature` WHERE `guid`=137686 AND `eventEntry`=5; +INSERT INTO `game_event_creature` (`eventEntry`, `guid`) VALUES +(5, 137686); + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_21_00.sql b/data/sql/updates/db_world/2021_04_21_00.sql new file mode 100644 index 0000000000..872e3f05e9 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_21_00.sql @@ -0,0 +1,29 @@ +-- DB update 2021_04_19_11 -> 2021_04_21_00 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_19_11'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_19_11 2021_04_21_00 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1618848739269957700'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1618848739269957700'); + +UPDATE `gameobject` SET `position_x`=-2076.86, `position_y`=-3631.41, `position_z`=60.910 WHERE `guid`=3538; + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_22_00.sql b/data/sql/updates/db_world/2021_04_22_00.sql new file mode 100644 index 0000000000..9e7da0c6e2 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_22_00.sql @@ -0,0 +1,35 @@ +-- DB update 2021_04_21_00 -> 2021_04_22_00 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_21_00'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_21_00 2021_04_22_00 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1619032787077995400'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1619032787077995400'); + +-- Despawn minions on death +DELETE FROM `smart_scripts` WHERE `entryorguid`=12203 AND `source_type`=0 AND `id`=3; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(12203, 0, 3, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 41, 500, 0, 0, 0, 0, 0, 11, 11783, 100, 0, 0, 0, 0, 0, 0, 'Landslide - On death - Despawn minions'); + +-- Use correct spell for Knock Away +UPDATE `smart_scripts` SET `action_param1`=10101 WHERE `entryorguid`=12203 AND `source_type`=0 AND `id`=1 AND `link`=0; + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_22_01.sql b/data/sql/updates/db_world/2021_04_22_01.sql new file mode 100644 index 0000000000..c987ba18f9 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_22_01.sql @@ -0,0 +1,29 @@ +-- DB update 2021_04_22_00 -> 2021_04_22_01 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_22_00'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_22_00 2021_04_22_01 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1619115153766529700'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1619115153766529700'); + +UPDATE `npc_text` SET `text0_0`='Welcome to Camp Mojache, brave $c. How may I assist you this day?' WHERE `ID`=2368; + + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_24_00.sql b/data/sql/updates/db_world/2021_04_24_00.sql new file mode 100644 index 0000000000..f13d93d15e --- /dev/null +++ b/data/sql/updates/db_world/2021_04_24_00.sql @@ -0,0 +1,115 @@ +-- DB update 2021_04_22_01 -> 2021_04_24_00 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_22_01'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_22_01 2021_04_24_00 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1615627556897035768'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1615627556897035768'); + +UPDATE `creature_template` SET `BaseAttackTime`=2500 WHERE `entry`=485; -- Blackrock Outrunner, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=2800 WHERE `entry`=584; -- Kazon, was 1425 +UPDATE `creature_template` SET `BaseAttackTime`=1500 WHERE `entry`=947; -- Rohh the Silent, was 1425 +UPDATE `creature_template` SET `BaseAttackTime`=2200 WHERE `entry`=2271; -- Dalaran Shield Guard, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=1300 WHERE `entry`=2275; -- Enraged Stanley, was 1770 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=2475; -- Sloth, was 1700 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=2479; -- Sludge, was 1700 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=2502; -- "Shaky" Phillipe, was 2400 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=2713; -- Kinelory, was 2500 +UPDATE `creature_template` SET `BaseAttackTime`=1000 WHERE `entry`=2850; -- Broken Tooth, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=4049; -- Seereth Stonebreak, was 1750 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=4400; -- Mudrock Snapjaw, was 1600 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=5399; -- Veyzhak the Cannibal, was 1250 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=5400; -- Zekkis, was 1250 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=5781; -- Silithid Creeper Egg, was 1800 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=5809; -- Watch Commander Zalaphil, was 1575 +UPDATE `creature_template` SET `BaseAttackTime`=2700 WHERE `entry`=5827; -- Brontus, was 1425 +UPDATE `creature_template` SET `BaseAttackTime`=1300 WHERE `entry`=5828; -- Humar the Pridelord, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=1500 WHERE `entry`=5865; -- Dishu, was 1525 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=6239; -- Cyclonian, was 1300 +UPDATE `creature_template` SET `BaseAttackTime`=1625 WHERE `entry`=6913; -- Lost One Rift Traveler, was 1760 +UPDATE `creature_template` SET `BaseAttackTime`=4000 WHERE `entry`=7226; -- Sand Storm, was 1570 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=7846; -- Teremus the Devourer, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=2800 WHERE `entry`=7895; -- Ambassador Bloodrage, was 1350 +UPDATE `creature_template` SET `BaseAttackTime`=2600 WHERE `entry`=8215; -- Grimungous, was 1233 +UPDATE `creature_template` SET `BaseAttackTime`=1300 WHERE `entry`=8300; -- Ravage, was 1216 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=8585; -- Frost Spectre, was 1600 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=8932; -- Borer Beetle, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=1800 WHERE `entry`=9027; -- Gorosh the Dervish, was 1183 +UPDATE `creature_template` SET `BaseAttackTime`=2400 WHERE `entry`=9032; -- Hedrum the Creeper, was 1208 +UPDATE `creature_template` SET `BaseAttackTime`=1300 WHERE `entry`=9236; -- Shadow Hunter Vosh'gajin, was 800 +UPDATE `creature_template` SET `BaseAttackTime`=1300 WHERE `entry`=9264; -- Firebrand Pyromancer, was 1158 +UPDATE `creature_template` SET `BaseAttackTime`=2400 WHERE `entry`=9456; -- Warlord Krom'zar, was 1770 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=9462; -- Chieftain Bloodmaw, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=9568; -- Overlord Wyrmthalak, was 800 +UPDATE `creature_template` SET `BaseAttackTime`=2600 WHERE `entry`=9605; -- Blackrock Raider, was 1420 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=10184; -- Onyxia, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=1100 WHERE `entry`=10220; -- Halycon, was 1175 +UPDATE `creature_template` SET `BaseAttackTime`=1400 WHERE `entry`=10261; -- Burning Felhound, was 1470 +UPDATE `creature_template` SET `BaseAttackTime`=2300 WHERE `entry`=10263; -- Burning Felguard, was 1175 +UPDATE `creature_template` SET `BaseAttackTime`=1500 WHERE `entry`=10374; -- Spire Spider, was 1175 +UPDATE `creature_template` SET `BaseAttackTime`=1500 WHERE `entry`=10375; -- Spire Spiderling, was 1480 +UPDATE `creature_template` SET `BaseAttackTime`=1500 WHERE `entry`=10376; -- Crystal Fang, was 1150 +UPDATE `creature_template` SET `BaseAttackTime`=3000 WHERE `entry`=10506; -- Kirtonos the Herald, was 1600 +UPDATE `creature_template` SET `BaseAttackTime`=3200 WHERE `entry`=10584; -- Urok Doomhowl, was 1166 +UPDATE `creature_template` SET `BaseAttackTime`=1500 WHERE `entry`=10596; -- Mother Smolderweb, was 1100 +UPDATE `creature_template` SET `BaseAttackTime`=2200 WHERE `entry`=11347; -- Zealot Lor'Khan, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=1600 WHERE `entry`=11467; -- Tsu'zee, was 1166 +UPDATE `creature_template` SET `BaseAttackTime`=3000 WHERE `entry`=11627; -- Tamed Kodo, was 1660 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=11677; -- Taskmaster Snivvle, was 1175 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=11949; -- Captain Balinda Stonehearth, was 2400 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=11981; -- Flamegor, was 1300 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=12121; -- Drakan, was 1846 +UPDATE `creature_template` SET `BaseAttackTime`=2400 WHERE `entry`=12467; -- Death Talon Captain, was 1091 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=12756; -- Lady Onyxia, was 850 +UPDATE `creature_template` SET `BaseAttackTime`=2660 WHERE `entry`=12860; -- Duriel Moonfire, was 1710 +UPDATE `creature_template` SET `BaseAttackTime`=2800 WHERE `entry`=12865; -- Ambassador Malcin, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=13020; -- Vaelastrasz the Corrupt, was 1600 +UPDATE `creature_template` SET `BaseAttackTime`=2500 WHERE `entry`=13147; -- Lieutenant Lewis, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=13456; -- Noxxion's Spawn, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=14020; -- Chromaggus, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=1000 WHERE `entry`=14370; -- Cadaverous Worm, was 1400 +UPDATE `creature_template` SET `BaseAttackTime`=2800 WHERE `entry`=14372; -- Winterfall Ambusher, was 1450 +UPDATE `creature_template` SET `BaseAttackTime`=10000 WHERE `entry`=14396; -- Eye of Immol'thar, was 1410 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=14484; -- Injured Peasant, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=900 WHERE `entry`=14490; -- Rippa, was 1283 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=14601; -- Ebonroc, was 1100 +UPDATE `creature_template` SET `BaseAttackTime`=2700 WHERE `entry`=14603; -- Zapped Shore Strider, was 1530 +UPDATE `creature_template` SET `BaseAttackTime`=2600 WHERE `entry`=14604; -- Zapped Land Walker, was 1510 +UPDATE `creature_template` SET `BaseAttackTime`=2500 WHERE `entry`=14638; -- Zapped Wave Strider, was 1520 +UPDATE `creature_template` SET `BaseAttackTime`=2700 WHERE `entry`=14639; -- Zapped Deep Strider, was 1520 +UPDATE `creature_template` SET `BaseAttackTime`=2700 WHERE `entry`=14640; -- Zapped Cliff Giant, was 1510 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=14890; -- Taerar, was 1000 +UPDATE `creature_template` SET `BaseAttackTime`=1000 WHERE `entry`=14965; -- Frenzied Bloodseeker Bat, was 1440 +UPDATE `creature_template` SET `BaseAttackTime`=1400 WHERE `entry`=15041; -- Spawn of Mar'li, was 1440 +UPDATE `creature_template` SET `BaseAttackTime`=2500 WHERE `entry`=15085; -- Wushoolay, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=1600 WHERE `entry`=15101; -- Zulian Prowler, was 1440 +UPDATE `creature_template` SET `BaseAttackTime`=3000 WHERE `entry`=15195; -- Wickerman Guardian, was 1175 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=15334; -- Giant Eye Tentacle, was 1000 +UPDATE `creature_template` SET `BaseAttackTime`=2700 WHERE `entry`=15517; -- Ouro, was 1750 +UPDATE `creature_template` SET `BaseAttackTime`=1500 WHERE `entry`=15721; -- Mechanical Greench, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=1000 WHERE `entry`=15725; -- Claw Tentacle, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=1000 WHERE `entry`=15726; -- Eye Tentacle, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=2500 WHERE `entry`=15728; -- Giant Claw Tentacle, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=2400 WHERE `entry`=15742; -- Colossus of Ashi, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=2000 WHERE `entry`=15802; -- Flesh Tentacle, was 1500 +UPDATE `creature_template` SET `BaseAttackTime`=1800 WHERE `entry`=15952; -- Maexxna, was 2000 +UPDATE `creature_template` SET `BaseAttackTime`=750 WHERE `entry`=16028; -- Patchwerk, was 1200 + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/data/sql/updates/db_world/2021_04_24_01.sql b/data/sql/updates/db_world/2021_04_24_01.sql new file mode 100644 index 0000000000..dfbee69f70 --- /dev/null +++ b/data/sql/updates/db_world/2021_04_24_01.sql @@ -0,0 +1,34 @@ +-- DB update 2021_04_24_00 -> 2021_04_24_01 +DROP PROCEDURE IF EXISTS `updateDb`; +DELIMITER // +CREATE PROCEDURE updateDb () +proc:BEGIN DECLARE OK VARCHAR(100) DEFAULT 'FALSE'; +SELECT COUNT(*) INTO @COLEXISTS +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'version_db_world' AND COLUMN_NAME = '2021_04_24_00'; +IF @COLEXISTS = 0 THEN LEAVE proc; END IF; +START TRANSACTION; +ALTER TABLE version_db_world CHANGE COLUMN 2021_04_24_00 2021_04_24_01 bit; +SELECT sql_rev INTO OK FROM version_db_world WHERE sql_rev = '1616619114792330400'; IF OK <> 'FALSE' THEN LEAVE proc; END IF; +-- +-- START UPDATING QUERIES +-- + +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1616619114792330400'); + +DELETE FROM `spell_dbc` WHERE `ID`=39183; +INSERT INTO `spell_dbc` (`ID`, `Category`, `DispelType`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesExB`, `AttributesExC`, `AttributesExD`, `AttributesExE`, `AttributesExF`, `AttributesExG`, `ShapeshiftMask`, `unk_320_2`, `ShapeshiftExclude`, `unk_320_3`, `Targets`, `TargetCreatureType`, `RequiresSpellFocus`, `FacingCasterFlags`, `CasterAuraState`, `TargetAuraState`, `ExcludeCasterAuraState`, `ExcludeTargetAuraState`, `CasterAuraSpell`, `TargetAuraSpell`, `ExcludeCasterAuraSpell`, `ExcludeTargetAuraSpell`, `CastingTimeIndex`, `RecoveryTime`, `CategoryRecoveryTime`, `InterruptFlags`, `AuraInterruptFlags`, `ChannelInterruptFlags`, `ProcTypeMask`, `ProcChance`, `ProcCharges`, `MaxLevel`, `BaseLevel`, `SpellLevel`, `DurationIndex`, `PowerType`, `ManaCost`, `ManaCostPerLevel`, `ManaPerSecond`, `ManaPerSecondPerLevel`, `RangeIndex`, `Speed`, `ModalNextSpell`, `CumulativeAura`, `Totem_1`, `Totem_2`, `Reagent_1`, `Reagent_2`, `Reagent_3`, `Reagent_4`, `Reagent_5`, `Reagent_6`, `Reagent_7`, `Reagent_8`, `ReagentCount_1`, `ReagentCount_2`, `ReagentCount_3`, `ReagentCount_4`, `ReagentCount_5`, `ReagentCount_6`, `ReagentCount_7`, `ReagentCount_8`, `EquippedItemClass`, `EquippedItemSubclass`, `EquippedItemInvTypes`, `Effect_1`, `Effect_2`, `Effect_3`, `EffectDieSides_1`, `EffectDieSides_2`, `EffectDieSides_3`, `EffectRealPointsPerLevel_1`, `EffectRealPointsPerLevel_2`, `EffectRealPointsPerLevel_3`, `EffectBasePoints_1`, `EffectBasePoints_2`, `EffectBasePoints_3`, `EffectMechanic_1`, `EffectMechanic_2`, `EffectMechanic_3`, `ImplicitTargetA_1`, `ImplicitTargetA_2`, `ImplicitTargetA_3`, `ImplicitTargetB_1`, `ImplicitTargetB_2`, `ImplicitTargetB_3`, `EffectRadiusIndex_1`, `EffectRadiusIndex_2`, `EffectRadiusIndex_3`, `EffectAura_1`, `EffectAura_2`, `EffectAura_3`, `EffectAuraPeriod_1`, `EffectAuraPeriod_2`, `EffectAuraPeriod_3`, `EffectMultipleValue_1`, `EffectMultipleValue_2`, `EffectMultipleValue_3`, `EffectChainTargets_1`, `EffectChainTargets_2`, `EffectChainTargets_3`, `EffectItemType_1`, `EffectItemType_2`, `EffectItemType_3`, `EffectMiscValue_1`, `EffectMiscValue_2`, `EffectMiscValue_3`, `EffectMiscValueB_1`, `EffectMiscValueB_2`, `EffectMiscValueB_3`, `EffectTriggerSpell_1`, `EffectTriggerSpell_2`, `EffectTriggerSpell_3`, `EffectPointsPerCombo_1`, `EffectPointsPerCombo_2`, `EffectPointsPerCombo_3`, `EffectSpellClassMaskA_1`, `EffectSpellClassMaskA_2`, `EffectSpellClassMaskA_3`, `EffectSpellClassMaskB_1`, `EffectSpellClassMaskB_2`, `EffectSpellClassMaskB_3`, `EffectSpellClassMaskC_1`, `EffectSpellClassMaskC_2`, `EffectSpellClassMaskC_3`, `SpellVisualID_1`, `SpellVisualID_2`, `SpellIconID`, `ActiveIconID`, `SpellPriority`, `Name_Lang_enUS`, `Name_Lang_enGB`, `Name_Lang_koKR`, `Name_Lang_frFR`, `Name_Lang_deDE`, `Name_Lang_enCN`, `Name_Lang_zhCN`, `Name_Lang_enTW`, `Name_Lang_zhTW`, `Name_Lang_esES`, `Name_Lang_esMX`, `Name_Lang_ruRU`, `Name_Lang_ptPT`, `Name_Lang_ptBR`, `Name_Lang_itIT`, `Name_Lang_Unk`, `Name_Lang_Mask`, `NameSubtext_Lang_enUS`, `NameSubtext_Lang_enGB`, `NameSubtext_Lang_koKR`, `NameSubtext_Lang_frFR`, `NameSubtext_Lang_deDE`, `NameSubtext_Lang_enCN`, `NameSubtext_Lang_zhCN`, `NameSubtext_Lang_enTW`, `NameSubtext_Lang_zhTW`, `NameSubtext_Lang_esES`, `NameSubtext_Lang_esMX`, `NameSubtext_Lang_ruRU`, `NameSubtext_Lang_ptPT`, `NameSubtext_Lang_ptBR`, `NameSubtext_Lang_itIT`, `NameSubtext_Lang_Unk`, `NameSubtext_Lang_Mask`, `Description_Lang_enUS`, `Description_Lang_enGB`, `Description_Lang_koKR`, `Description_Lang_frFR`, `Description_Lang_deDE`, `Description_Lang_enCN`, `Description_Lang_zhCN`, `Description_Lang_enTW`, `Description_Lang_zhTW`, `Description_Lang_esES`, `Description_Lang_esMX`, `Description_Lang_ruRU`, `Description_Lang_ptPT`, `Description_Lang_ptBR`, `Description_Lang_itIT`, `Description_Lang_Unk`, `Description_Lang_Mask`, `AuraDescription_Lang_enUS`, `AuraDescription_Lang_enGB`, `AuraDescription_Lang_koKR`, `AuraDescription_Lang_frFR`, `AuraDescription_Lang_deDE`, `AuraDescription_Lang_enCN`, `AuraDescription_Lang_zhCN`, `AuraDescription_Lang_enTW`, `AuraDescription_Lang_zhTW`, `AuraDescription_Lang_esES`, `AuraDescription_Lang_esMX`, `AuraDescription_Lang_ruRU`, `AuraDescription_Lang_ptPT`, `AuraDescription_Lang_ptBR`, `AuraDescription_Lang_itIT`, `AuraDescription_Lang_Unk`, `AuraDescription_Lang_Mask`, `ManaCostPct`, `StartRecoveryCategory`, `StartRecoveryTime`, `MaxTargetLevel`, `SpellClassSet`, `SpellClassMask_1`, `SpellClassMask_2`, `SpellClassMask_3`, `MaxTargets`, `DefenseType`, `PreventionType`, `StanceBarOrder`, `EffectChainAmplitude_1`, `EffectChainAmplitude_2`, `EffectChainAmplitude_3`, `MinFactionID`, `MinReputation`, `RequiredAuraVision`, `RequiredTotemCategoryID_1`, `RequiredTotemCategoryID_2`, `RequiredAreasID`, `SchoolMask`, `RuneCostID`, `SpellMissileID`, `PowerDisplayID`, `Field227`, `Field228`, `Field229`, `SpellDescriptionVariableID`, `SpellDifficultyID`) VALUES +(39183, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 76, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 185298, 22444, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8959, 0, 1, 0, 0, 'Create Anchorite Relic', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 16712190, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 16712188, 'Place the Anchorite Relic at Gor\'gaz Outpost.', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 16712190, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 16712190, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 88, 1, 0, 0, 0, 0, 0, 0, 0, 0); + +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 22454) AND (`source_type` = 0) AND (`id` IN (0)); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(22454, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Fel Spirit - On Just Summoned - Say Line 0'); + +-- +-- END UPDATING QUERIES +-- +COMMIT; +END // +DELIMITER ; +CALL updateDb(); +DROP PROCEDURE IF EXISTS `updateDb`; diff --git a/deps/acore/bash-lib/.gitrepo b/deps/acore/bash-lib/.gitrepo new file mode 100644 index 0000000000..d62898c2b5 --- /dev/null +++ b/deps/acore/bash-lib/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = https://github.com/azerothcore/bash-lib + branch = master + commit = 86fcff1dd6167078f863d45b3cd233e802bebe89 + parent = 0ebf9eb7365e4c73f423e2acd9fb1f21b84c6ef6 + method = merge + cmdver = 0.4.3 diff --git a/deps/hw-core/bash-lib-git/bin/git-subtree-list b/deps/acore/bash-lib/bin/git-subtree-list similarity index 84% rename from deps/hw-core/bash-lib-git/bin/git-subtree-list rename to deps/acore/bash-lib/bin/git-subtree-list index d3af413e9c..7111d4d646 100644 --- a/deps/hw-core/bash-lib-git/bin/git-subtree-list +++ b/deps/acore/bash-lib/bin/git-subtree-list @@ -4,4 +4,4 @@ CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $CUR_DIR"/../src/subtree.sh" -hwc_git_subtree_list +subtreeFlow diff --git a/deps/acore/bash-lib/docs/README.md b/deps/acore/bash-lib/docs/README.md new file mode 100644 index 0000000000..b35c31e86f --- /dev/null +++ b/deps/acore/bash-lib/docs/README.md @@ -0,0 +1,23 @@ +# BASH-LIB + +## description + +bash-lib is a collection of generic purpose functions and defines that can be used +and shared by other bash scripts. + +## Documentation + +### src/event + +Libraries for event-driven functions + +#### hooks.sh + +Library that implements a simple Observer Pattern + +### src/git-utils + +#### subrepo.sh + + +#### subtree.sh diff --git a/deps/acore/bash-lib/docs/_config.yml b/deps/acore/bash-lib/docs/_config.yml new file mode 100644 index 0000000000..17bd07cb1d --- /dev/null +++ b/deps/acore/bash-lib/docs/_config.yml @@ -0,0 +1,152 @@ +# based on git-wiki-theme 2.6.1 +remote_theme: Drassil/git-wiki-theme@master +# (string) Title of your wiki +title: "bash-lib" +baseurl: /bash-lib/ +# (string) if you've installed your wiki in subfolder, you must change this configuration +# with your folder name, otherwise leave it empty +# baseurl: "/git-wiki-skeleton" +# (string) Description of your wiki +description: +# (boolean) Enable/disable wiki page list in sidebar +show_wiki_pages: true +# (integer) Maximum number of wiki page to shown in sidebar +show_wiki_pages_limit: 10 +# (boolean) Enable/disable blog feature +blog_feature: true +# (boolean) Enable/disable wiki posts list in sidebar (needs blog_feature enabled) +show_wiki_posts: true +# (integer) Maximum number of wiki posts to shown in sidebar +show_wiki_posts_limit: 10 +# from jekyll (read jekyll doc) +paginate: 5 +paginate_path: "/blog/page:num" +permalink: /blog/posts/:year/:month/:day/:title:output_ext +# (boolean) Enable/disable download buttons in sidebar +show_downloads: true +# (string) Specify branch rendered by gitpages allowing wiki tool buttons to work +git_branch: "master" +# (string) Url of logo image, it can be full, absolute or relative. +logo_url: https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Gnu-bash-logo.svg/1200px-Gnu-bash-logo.svg.png +# (string) The UA-XXXXX-Y code from google analytic to enable GA on your wiki +google_analytics: +# (string) folder where wiki pages are stored, it's needed for tool buttons +wiki_folder: +# (boolean) if you're using github wiki as submodule then this config +# must be enabled to allow tool buttons to work properly +use_github_wiki: false +# (boolean) Enable "Edit with Prose.io" button in tools, it's a 3rd party +# service to edit github markdown pages easily +use_prose_io: true +# Select search_engine component from: +# - js: it uses a built in javascript component that uses generated js object +# - js_rss: it uses a built in javascript component that uses generated sitemap_full.xml to search inside your wiki with lunr library (slow and experimental) +# - github : it uses internal github repository search +# - google : it uses cse search bar, you need to configure google_cse_token +# +search_engine : "js" +# Setting google custom search engine for google. Default: empty +# cse search bar (https://cse.google.it/cse/) +google_cse_token: + + +# (string) path of site root. Normally it's must be empty because _config.yml resides in the root of your repository. +# If you have _config.yml and your site in a subfolder, then change this config accordly +site_root: docs/ + +# +# Jekyll configurations +# + +# You can customize it changing default layout for all pages +# More info: https://jekyllrb.com/docs/configuration/ +# +# git-wiki includes some internal themes that you can choose +# check _layouts folder +# +markdown: kramdown +highlighter: rouge +kramdown: + input: GFM + syntax_highlighter: rouge + +defaults: + - + scope: + path: "wiki" + values: + permalink: /:basename + - + scope: + path: "" # an empty string here means all files in the project + values: + layout: "git-wiki-default" + - + scope: + path: "" + type: "pages" + values: + layout: "git-wiki-default" + - + scope: + path: "" + type: "posts" + values: + layout: "git-wiki-post" + - + scope: + path: blog + values: + layout: "git-wiki-blog" +sass: + style: compressed +plugins: + - jekyll-avatar + - jekyll-coffeescript + - jekyll-default-layout + - jekyll-feed + - jekyll-gist + - jekyll-paginate + - jekyll-mentions + - jekyll-optional-front-matter + - jekyll-readme-index + - jekyll-redirect-from + - jekyll-remote-theme + - jekyll-relative-links + - jekyll-seo-tag + - jekyll-sitemap + - jekyll-titles-from-headings + - jemoji + - jekyll-gitlab-metadata + +# +# INCLUDING HOOKS +# They are optional, change them only if you need +# Check wiki documentation to learn how they work +# + +inc_before_toc : +inc_after_toc : +inc_before_content : +inc_after_content : +inc_before_footer : +inc_after_footer : +inc_before_head : +inc_after_head : +inc_before_meta : +inc_after_meta : +inc_before_scripts : +inc_after_scripts : +inc_before_styles : +inc_after_styles : +inc_before_header : +inc_after_header : +inc_before_tail : +inc_after_tail : +inc_before_tools : +inc_after_tools : + +inc_before_page_list : +inc_after_page_list : +inc_before_post_list : +inc_after_post_list : diff --git a/deps/hw-core/bash-lib-event/src/hooks.sh b/deps/acore/bash-lib/src/event/hooks.sh similarity index 78% rename from deps/hw-core/bash-lib-event/src/hooks.sh rename to deps/acore/bash-lib/src/event/hooks.sh index b791a600fb..77cd6456e2 100644 --- a/deps/hw-core/bash-lib-event/src/hooks.sh +++ b/deps/acore/bash-lib/src/event/hooks.sh @@ -1,5 +1,5 @@ # par 1: hook_name -function hwc_event_run_hooks() { +function acore_event_runHooks() { hook_name="HOOKS_MAP_$1" read -r -a SRCS <<< ${!hook_name} echo "Running hooks: $hook_name" @@ -9,7 +9,7 @@ function hwc_event_run_hooks() { done } -function hwc_event_register_hooks() { +function acore_event_registerHooks() { hook_name="HOOKS_MAP_$1" hooks=${@:2} declare -g "$hook_name+=$hooks " diff --git a/deps/acore/bash-lib/src/git-utils/subrepo.sh b/deps/acore/bash-lib/src/git-utils/subrepo.sh new file mode 100644 index 0000000000..e0d36d9a82 --- /dev/null +++ b/deps/acore/bash-lib/src/git-utils/subrepo.sh @@ -0,0 +1,36 @@ + +#!/usr/bin/env bash + + + +CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" + +echo "> Init and updating submodules..." + +function subrepoUpdate() { + repo=$1 + branch=$2 + folder=$3 + + toClone=$(git ls-remote --heads "$repo" "$branch" | wc -l) + + if [[ -d "$folder" ]]; then + if [[ ! -f "$folder/.gitrepo" ]]; then + git subrepo init "$folder" -r "$repo" -b "$branch" + fi + + if [[ $toClone -eq 0 ]]; then + git subrepo push "$folder" + fi + else + # try-catch + set +e + git subrepo clone "$repo" "$folder" -b "$branch" + set -e + fi + + git subrepo clean "$folder" + git subrepo pull "$folder" + git subrepo push "$folder" -s + git subrepo clean "$folder" +} diff --git a/deps/acore/bash-lib/src/git-utils/subtree.sh b/deps/acore/bash-lib/src/git-utils/subtree.sh new file mode 100644 index 0000000000..1b32c97286 --- /dev/null +++ b/deps/acore/bash-lib/src/git-utils/subtree.sh @@ -0,0 +1,12 @@ +function subtreeFlow { + local name=$1 + local path=$2 + local repo=$3 + local branch=$4 + local prefix="$path/$name" + + echo "> Adding subtree if not exists" + git subtree add --prefix "$prefix" "$repo" "$branch" + echo "> Pulling latest changes from remote subtree" + git subtree pull --prefix "$prefix" "$repo" "$branch" +} diff --git a/deps/drassil/cmake-utils/.gitignore b/deps/acore/cmake-utils/.gitignore similarity index 100% rename from deps/drassil/cmake-utils/.gitignore rename to deps/acore/cmake-utils/.gitignore diff --git a/deps/acore/cmake-utils/.gitrepo b/deps/acore/cmake-utils/.gitrepo new file mode 100644 index 0000000000..67403e7fa5 --- /dev/null +++ b/deps/acore/cmake-utils/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = https://github.com/azerothcore/cmake-utils + branch = master + commit = 1589c53ac61b7909c6950f1d85833441cbd58790 + method = merge + cmdver = 0.4.3 + parent = ebcbd4e904f835beef8db05c88f2e971c48c2820 diff --git a/docker/authserver/bin/.gitkeep b/deps/acore/cmake-utils/README.md similarity index 100% rename from docker/authserver/bin/.gitkeep rename to deps/acore/cmake-utils/README.md diff --git a/deps/drassil/cmake-utils/utils.cmake b/deps/acore/cmake-utils/utils.cmake similarity index 100% rename from deps/drassil/cmake-utils/utils.cmake rename to deps/acore/cmake-utils/utils.cmake diff --git a/deps/acore/joiner/.gitrepo b/deps/acore/joiner/.gitrepo new file mode 100644 index 0000000000..4fd20b2c13 --- /dev/null +++ b/deps/acore/joiner/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = https://github.com/azerothcore/joiner + branch = master + commit = 9b74caa2ca609738a944bcf25c025a2a67de78ed + parent = 5f910409ec1e5f27f49fe26b0662b19b37bdabb3 + method = merge + cmdver = 0.4.3 diff --git a/deps/acore/joiner/LICENSE b/deps/acore/joiner/LICENSE new file mode 100644 index 0000000000..1ce875873d --- /dev/null +++ b/deps/acore/joiner/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. \ No newline at end of file diff --git a/deps/acore/joiner/README.md b/deps/acore/joiner/README.md new file mode 100644 index 0000000000..0fc3d26b4e --- /dev/null +++ b/deps/acore/joiner/README.md @@ -0,0 +1,211 @@ +# Joiner v0.8.4 + +Universal crossplatform and agnostic dependency manager written in bash for any kind of module. + +it is compatible with: + +- Linux (natively) +- MacOS (natively) +- Windows (via mingw, wsl or other installable bash console) + +This script is able to install and update modules and its dependencies via git clone, submodule or files directly. +To install dependencies you must configure your repository to support Joiner. Read instructions below. + +## Projects that are using Joiner + +- https://github.com/azerothcore/azerothcore-wotlk + +- https://github.com/hw-core + +## features + +- install modules via git clone/submodule or files/zipped folders +- update modules downloaded via git +- remove modules and its dependencies +- define and install dependencies or suggested modules +- since it uses bash, you can run any kind of task/script during install/uninstall (compilation, configuration etc.) + +## requirements + +- bash +- git +- unzip +- curl + +## Installation + +This command will download the script then you can directly run it or include in your script to run commands programmatically + +``` +git clone https://github.com/drassil/joiner.git drassil/joiner +``` + +if you want to include in your scripts you can use this code that will also automatically download the joiner if you don't have it yet and will keep it updated at each run (internally handled by joiner script): + +``` +J_PATH_MODULES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/modules" +[ ! -d $J_PATH_MODULES/drassil/joiner ] && git clone https://github.com/drassil/joiner $J_PATH_MODULES/drassil/joiner -b master +source "$J_PATH_MODULES/drassil/joiner/joiner.sh" +``` + +## Usage + +You can run joiner executing it in a bash shell. It will prompt an interactive menu where you can run commands or just run them directly via command line (see below) + +Alternatively you can use it programmatically running internal functions in your scripts (see below). It's also needed to create a module compatible with Joiner dependency manager. + +## Sample + +This command will install js-lib-class modules and its dependencies + + joiner add-repo https://github.com/HW-Core/js-lib-class + +To install also development dependencies (test and documentation modules) you've to run: + + joiner add-repo --dev https://github.com/HW-Core/js-lib-class + +## Options + +-d|--dev: install development dependencies (see Joiner:with_dev) + +-e|--extras: install extras dependencies (see Joiner:with_extras) + +-z|--unzip: if adding a compressed file, this option will unzip it + +## Command line + +- **add-repo (a)**: download and install a module from git repository. + + Syntax: joiner.sh add-repo [-d] [-e] url name branch [basedir] + + If you set name/branch as empty string ("") the system will use default values + +- **upd-repo (u)**: update a module. + Syntax: joiner.sh upd-repo [-d] [-e] url name branch [basedir] + + If you set name/branch as empty string ("") the system will use default values + +- **add-git-submodule (s)**: download and install module from git repository as git submodule. + + Syntax: joiner.sh add-git-submodule [-d] [-e] url name branch [basedir] + + If you set name/branch as empty string ("") the system will use default values + + +- **add-file (f)**: download and install a file or zipped folder. + + Syntax: joiner.sh add-file [-d] [-e] [-z] source [destination] + +- **remove (r)**: uninstall and remove a module. + + Syntax: joiner.sh remove name [basedir] + +- **self-update (j)**: Update joiner version to the latest stable (master branch) + + Syntax: joiner.sh self-update + + + +## Programmatically usage + +### commands methods +Download and install a module from git repository. + + Joiner:add_repo [-d] [-e] url name branch [basedir] + +Update a module. + + Joiner:upd_repo [-d] [-e] url name branch [basedir] + +Download and install module from git repository as git submodule. + + Joiner:add_git_submodule [-d] [-e] url name branch [basedir] + +Download and install a file or zipped folder. + + Joiner:add_file [-d] [-e] [-z] source [destination] + +Uninstall and remove a module. + + Joiner:remove name [basedir] + +### conditional methods + +Check if Joiner has been run with --dev|-d option + + Joiner:with_dev + + return: true|false + +Check if Joiner has been run with --extras|-e option + + Joiner:with_extras + + return: true|false + +Update joiner version to the latest stable (master branch) + + Joiner:self_update + + +## How to create a Joiner module + +Creating a Joiner compatible module is extremely simple. +You just have to create following files in the root directory of your project: + +### install.sh + +``` +#!/usr/bin/env bash + +J_PATH_MODULES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/modules" +[ ! -d $J_PATH_MODULES/drassil/joiner ] && git clone https://github.com/drassil/joiner $J_PATH_MODULES/drassil/joiner -b master +source "$J_PATH_MODULES/drassil/joiner/joiner.sh" + +## You can do any kind of pre-install task here + +# ADD DEPENDENCIES + +Joiner:add_repo "dependency-repo-url" + +if Joiner:with_dev ; then + Joiner:add_repo "dev-dependency-repo-url" +fi + +## You can do any kind of post-install task here +``` + + +### uninstall.sh + + +``` +#!/usr/bin/env bash + +J_PATH_MODULES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/modules" +[ ! -d $J_PATH_MODULES/drassil/joiner ] && git clone https://github.com/drassil/joiner $J_PATH_MODULES/drassil/joiner -b master +source "$J_PATH_MODULES/drassil/joiner/joiner.sh" + +# +# REMOVE DEPENDENCIES +# + +Joiner:remove "dependency-folder-name" + +``` + +If other dependencies are Joiner modules then joiner will install dependencies recursively, otherwise will just download them. + + +## Contribute + +Please use github platform to report an issue or ask anything you like: + +https://github.com/Drassil/joiner + + + + + + + diff --git a/deps/acore/joiner/_config.yml b/deps/acore/joiner/_config.yml new file mode 100644 index 0000000000..b4fb3bcb93 --- /dev/null +++ b/deps/acore/joiner/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-architect diff --git a/deps/acore/joiner/joiner.sh b/deps/acore/joiner/joiner.sh new file mode 100755 index 0000000000..be95b673a1 --- /dev/null +++ b/deps/acore/joiner/joiner.sh @@ -0,0 +1,441 @@ +#!/usr/bin/env bash + +# +# bash >= 4.x required +# + +# +# DEFINES +# + +# boolean bash convention ( inverse ) +declare -A J_OPT; + +TRUE=0 +FALSE=1 + +J_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +unamestr=`uname` +if [ -z "$J_PATH_MODULES" ]; then + if [[ "$unamestr" == 'Darwin' ]]; then + J_PATH_MODULES=$(greadlink -f "$J_PATH/../../") + else + J_PATH_MODULES=$(readlink -f "$J_PATH/../../") + fi +fi + +for i in "$@" +do +case $i in + --parent=*) #internally used + J_OPT[parent]="${i#*=}" + shift + ;; + --child=*) #internally used + J_OPT[child]="${i#*=}" + shift + ;; + *) + # unknown option + ;; +esac +done + +J_PARAMS="$@" + +function Joiner:is_submodule() +{ + path=$1 + (cd "$path" && cd "$(git rev-parse --show-toplevel 2>&1)/.." + git rev-parse --is-inside-work-tree 2>&1) | grep -q true +} + + +function Joiner:_help() { + hasReq=$1 + firstParam=$2 + msg=$3 + + if [ $hasReq = false ]; then + echo "Argument missing: $msg" + exit 1 + fi + + if [[ "$firstParam" = "--help" || "$firstParam" = "-h" ]]; then + echo "Help: $msg" + exit 1 + fi +} + +function Joiner:_searchFirstValiPath() { + path="$1" + until $(cd -- "$path") + do + case "$path" in(*[!/]/*) + path="${path%/*}" + ;; + (*) + ! break + esac + done 2>/dev/null + echo "$path" +} + +# +# JOINER FUNCTIONS +# + +function Joiner:add_repo() ( + set -e + url="$1" + name=${2:-""} + branch=${3:-"master"} + basedir="${4:-""}" + + [[ -z $url ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh add-repo [-d] [-e] url name branch [basedir]" + + # retrieving info from url if not set + if [[ -z $name ]]; then + basename=$(basename $url) + name=${basename%%.*} + + if [[ -z "$basedir" ]]; then + dir=$(dirname "$url") + basedir=$(basename "$dir") + fi + + name="${name,,}" #to lowercase + basedir="${basedir,,}" #to lowercase + fi + + path="$J_PATH_MODULES/$basedir/$name" + changed="yes" + + if [ -e "$path/.git/" ]; then + # if exists , update + git --git-dir="$path/.git/" rev-parse && git --git-dir="$path/.git/" pull origin $branch | grep 'Already up-to-date.' && changed="no" || true + else + # otherwise clone + git clone $url -c advice.detachedHead=0 -b $branch "$path" + fi + + if [ "$?" -ne "0" ]; then + return $FALSE + fi + + # parent/child to avoid redundancy + [[ -f $path/install.sh && "$changed" = "yes" + && "${J_OPT[parent]}" != "$path" && "${J_OPT[child]}" != "$path" ]] && bash "$path/install.sh" --child="${J_OPT[parent]}" --parent="$path" $J_PARAMS + + return $TRUE +) + +function Joiner:add_git_submodule() ( + set -e + url=$1 + name=${2:-""} + branch=${3:-"master"} + basedir=${4:-""} + + [[ -z $url ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh add-git-submodule [-d] [-e] url name branch [basedir]" + + # retrieving info from url if not set + if [[ -z $name ]]; then + basename=$(basename $url) + name=${basename%%.*} + + if [[ -z $basedir ]]; then + dir=$(dirname $url) + basedir=$(basename $dir) + fi + + name="${name,,}" #to lowercase + basedir="${basedir,,}" #to lowercase + fi + + path="$J_PATH_MODULES/$basedir/$name" + valid_path=`Joiner:_searchFirstValiPath "$path"` + rel_path=${path#$valid_path} + rel_path=${rel_path#/} + + if [ -e $path/ ]; then + # if exists , update + (cd "$path" && git pull origin $branch) + (cd "$valid_path" && git submodule update -f --init $rel_path) + else + # otherwise add + (cd "$valid_path" && git submodule add -f -b $branch $url $rel_path) + (cd "$valid_path" && git submodule update -f --init $rel_path) + fi + + if [ "$?" -ne "0" ]; then + return $FALSE + fi + + # parent/child to avoid redundancy + [[ -f $path/install.sh && "$changed" = "yes" + && "${J_OPT[parent]}" != "$path" && "${J_OPT[child]}" != "$path" ]] && bash "$path/install.sh" --child="${J_OPT[parent]}" --parent="$path" $J_PARAMS + + return $TRUE +) + +function Joiner:add_file() ( + set -e + declare -A _OPT; + for i in "$@" + do + case $i in + --unzip|-z) + _OPT[unzip]=true + shift + ;; + *) + # unknown option + ;; + esac + done + + source=$1 + destination="$J_PATH_MODULES/$2" + + [[ -z $source ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh add-file [-d] [-e] [-z] source [destination]" + + if [[ "$destination" =~ '/'$ ]]; then + mkdir -p "$destination" + else + mkdir -p "$(dirname $destination)" + fi + + [ ! -e $J_PATH_MODULES/$2 ] && curl -o "$destination" "$source" + + if [ "${_OPT[unzip]}" = true ]; then + dir=$(dirname $destination) + unzip -d $dir $destination + rm $destination + + filename=$(basename -- "$destination") + newpath="$dir${filename%%.*}" + + # parent/child to avoid redundancy + [[ -f $newpath/install.sh && "$changed" = "yes" + && "${J_OPT[parent]}" != "$newpath" && "${J_OPT[child]}" != "$newpath" ]] && bash "$newpath/install.sh" --child="${J_OPT[parent]}" --parent="$newpath" $J_PARAMS + fi + + if [ "$?" -ne "0" ]; then + return $FALSE + fi + + return $TRUE +) + +function Joiner:upd_repo() ( + set -e + url=$1 + name=${2:-""} + branch=${3:-"master"} + basedir=${4:-""} + + [[ -z $url ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh upd-repo [-d] [-e] url name branch [basedir]" + + # retrieving info from url if not set + if [[ -z $name ]]; then + basename=$(basename $url) + name=${basename%%.*} + + if [[ -z $basedir ]]; then + dir=$(dirname $url) + basedir=$(basename $dir) + fi + + name="${name,,}" #to lowercase + basedir="${basedir,,}" #to lowercase + fi + + path="$J_PATH_MODULES/$basedir/$name" + + if [[ -z $url ]]; then + url=`git --git-dir="$path/.git" remote get-url origin` + fi + + if [[ `Joiner:is_submodule "$path"` = true ]]; then + Joiner:add_git_submodule $@ + else + Joiner:add_repo $@ + fi + + if [ "$?" -ne "0" ]; then + return $FALSE + fi + + return $TRUE +) + +function Joiner:remove() ( + set -e + name=$1 + basedir=$2 + + [[ -z $name ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh remove name [basedir]" + + path="$J_PATH_MODULES/$basedir/$name" + + if [ -d "$path" ]; then + rm -r --interactive=never "$path" + [[ -f $path/uninstall.sh ]] && bash "$path/uninstall.sh" $J_PARAMS + elif [ -f "$path" ]; then + rm --interactive=never "$path" + else + return $FALSE + fi + + return $TRUE +) + +function Joiner:with_dev() ( + set -e + if [ "${J_OPT[dev]}" = true ]; then + return $TRUE; + else + return $FALSE; + fi +) + +function Joiner:with_extras() ( + set -e + if [ "${J_OPT[extra]}" = true ]; then + return $TRUE; + else + return $FALSE; + fi +) + +# +# Parsing parameters +# +function Joiner:self_update() { + if [ -e "$J_PATH/.git/" ]; then + # self update + if [ ! -z "$J_VER_REQ" ]; then + # if J_VER_REQ is defined then update only if tag is different + _cur_branch=`git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" rev-parse --abbrev-ref HEAD` + _cur_ver=`git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" name-rev --tags --name-only $_cur_branch` + if [ "$_cur_ver" != "$J_VER_REQ" ]; then + git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" rev-parse && git --git-dir="$J_PATH/.git/" fetch --tags origin "$_cur_branch" --quiet + git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" checkout "tags/$J_VER_REQ" -b "$_cur_branch" + fi + else + # else always try to keep at latest available version (worst performances) + + git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" rev-parse && git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" fetch origin "$_cur_branch" --quiet + fi + fi +} + +function Joiner:_checkOptions() { + for i in "$@" + do + case $i in + -e=*|--extras=*) + echo "Extras enabled" + J_OPT[extra]="${i#*=}" + shift + ;; + --dev|-d) + echo "Development enabled" + J_OPT[dev]=true + shift + ;; + *) + # unknown option + ;; + esac + done +} + +function Joiner:menu() { + PS3='[Please enter your choice]: ' + options=( + "add-repo (a): download and install a module from git repository." # 1 + "upd-repo (u): update a module." # 2 + "add-git-submodule (s): download and install module from git repository as git submodule." # 3 + "add-file (f): download and install a file or zipped folder." # 4 + "remove (r): uninstall and remove a module." # 5 + "self-update (j): Update joiner version to the latest stable (master branch)" + "quit: Exit from this menu" + ) + + function _switch() { + _reply="$1" + shift + + Joiner:_checkOptions + + _opt="$@" + + case $_reply in + ""|"a"|"add-repo"|"1") + Joiner:add_repo $_opt + ;; + ""|"u"|"upd-repo"|"2") + Joiner:upd_repo $_opt + ;; + ""|"s"|"add-git-submodule"|"3") + Joiner:add_git_submodule $_opt + ;; + ""|"f"|"add-file"|"4") + Joiner:add_file $_opt + ;; + ""|"r"|"remove"|"5") + Joiner:remove $_opt + ;; + ""|"j"|"self-update"|"6") + Joiner:self_update + ;; + ""|"quit"|"7") + echo "Goodbye!" + exit + ;; + ""|"--help") + echo "Available commands:" + printf '%s\n' "${options[@]}" + echo "Arguments:" + echo "-d, --dev: install also dev dependencies" + echo "-e, --extras: install extra dependencies (suggested by module)" + echo "-z, --unzip: extract a zipped file downloaded by add-file command" + ;; + *) echo "invalid option, use --help option for the commands list";; + esac + } + + while true + do + # run option directly if specified in argument + [ ! -z $1 ] && _switch $@ + [ ! -z $1 ] && exit 0 + + echo "" + echo "==== JOINER MENU ====" + select opt in "${options[@]}" + do + echo "" + _switch $REPLY + break + done + done +} + +# Call menu only when run from command line. +# if you wish to run joiner menu when sourced +# you must call the relative function +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + Joiner:menu $@ +else + Joiner:_checkOptions $@ +fi + diff --git a/deps/drassil/mysql-tools/.gitignore b/deps/acore/mysql-tools/.gitignore similarity index 91% rename from deps/drassil/mysql-tools/.gitignore rename to deps/acore/mysql-tools/.gitignore index fa1ea4671a..c6659cf0c1 100644 --- a/deps/drassil/mysql-tools/.gitignore +++ b/deps/acore/mysql-tools/.gitignore @@ -1,13 +1,13 @@ -/mysql_config -mysql_tools_(for usr-local-bin) - -# -# Editors / debuggers / other output files -# -*~ -*.bak -*.orig -*.patch -callgrind.out.* - -.upt.json +/mysql_config +mysql_tools_(for usr-local-bin) + +# +# Editors / debuggers / other output files +# +*~ +*.bak +*.orig +*.patch +callgrind.out.* + +.upt.json diff --git a/deps/acore/mysql-tools/.gitrepo b/deps/acore/mysql-tools/.gitrepo new file mode 100644 index 0000000000..f4d05ff4cc --- /dev/null +++ b/deps/acore/mysql-tools/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = https://github.com/azerothcore/mysql-tools + branch = master + commit = 6e9f39989cf4769c8972fb575aecf2b0291f3e6e + parent = 2668a0e170fbfd776380bf2d5edc4d0c39e0630d + method = merge + cmdver = 0.4.3 diff --git a/deps/drassil/mysql-tools/README b/deps/acore/mysql-tools/README similarity index 100% rename from deps/drassil/mysql-tools/README rename to deps/acore/mysql-tools/README diff --git a/deps/drassil/mysql-tools/bin/dump-parser b/deps/acore/mysql-tools/bin/dump-parser similarity index 100% rename from deps/drassil/mysql-tools/bin/dump-parser rename to deps/acore/mysql-tools/bin/dump-parser diff --git a/deps/drassil/mysql-tools/bin/dump-parser-mac b/deps/acore/mysql-tools/bin/dump-parser-mac similarity index 100% rename from deps/drassil/mysql-tools/bin/dump-parser-mac rename to deps/acore/mysql-tools/bin/dump-parser-mac diff --git a/deps/drassil/mysql-tools/bin/mysql.exe b/deps/acore/mysql-tools/bin/mysql.exe similarity index 100% rename from deps/drassil/mysql-tools/bin/mysql.exe rename to deps/acore/mysql-tools/bin/mysql.exe diff --git a/deps/drassil/mysql-tools/bin/mysqldump.exe b/deps/acore/mysql-tools/bin/mysqldump.exe similarity index 100% rename from deps/drassil/mysql-tools/bin/mysqldump.exe rename to deps/acore/mysql-tools/bin/mysqldump.exe diff --git a/deps/drassil/mysql-tools/bin/mysqlimport.exe b/deps/acore/mysql-tools/bin/mysqlimport.exe similarity index 100% rename from deps/drassil/mysql-tools/bin/mysqlimport.exe rename to deps/acore/mysql-tools/bin/mysqlimport.exe diff --git a/deps/drassil/mysql-tools/build-dump-parser.sh b/deps/acore/mysql-tools/build-dump-parser.sh similarity index 100% rename from deps/drassil/mysql-tools/build-dump-parser.sh rename to deps/acore/mysql-tools/build-dump-parser.sh diff --git a/deps/drassil/mysql-tools/dump-parser.c b/deps/acore/mysql-tools/dump-parser.c similarity index 100% rename from deps/drassil/mysql-tools/dump-parser.c rename to deps/acore/mysql-tools/dump-parser.c diff --git a/deps/drassil/mysql-tools/mysql-config.dist b/deps/acore/mysql-tools/mysql-config.dist similarity index 96% rename from deps/drassil/mysql-tools/mysql-config.dist rename to deps/acore/mysql-tools/mysql-config.dist index ca71fc41ea..2075c54c11 100644 --- a/deps/drassil/mysql-tools/mysql-config.dist +++ b/deps/acore/mysql-tools/mysql-config.dist @@ -1,62 +1,62 @@ -#!/bin/bash -# -# * Copyright (C) 2007 - 2015 Hyperweb2 All rights reserved. -# * GNU General Public License version 3; see www.hyperweb2.com/terms/ -# -# This file contains login/password information for accessing the MySQL database -# and is used by all the mysql_* scripts. -# - -# -# MYSQL -# - -# change these lines with your mysql config -MYSQL_DB=test -MYSQL_USER=usr -MYSQL_PASS=pwd -MYSQL_HOST=localhost -#MYSQL_SOCK=/var/lib/mysql/mysql.sock - -# -# File Options -# - -# path of directory where extract separated tables ( without end slash ) -TPATH=./tables - -# (boolean) clean directory before dump, in this way non-existant db tables will be deleted -CLEANFOLDER=1 - -# path of file to extract database full dump -FPATH=./full/full.sql - -# (boolean) switch to enable(1)/disable(0) the dump/import of full db file -# ( you can do it manually using command parameters ) -FULL=0 - -# (boolean) set 1 to enable --tab option for mysqldump and import data from it -# it's very fast import/export process but doesn't utilize the insert query -# NOTE: full db continue to be dumped with normal sql format -# NOTE2: if you have problem with permissions ( mysql errorcode:13) mostly in linux -# you should enable CHMODE config and disable/edit -# some protections such as AppArmor in Ubuntu or SELinux in Fedora.. - -TEXTDUMPS=1 - -# (boolean) allow to change "TPATH" folder permissions to enable mysql server writing - -CHMODE=0 - - -# -# TOOLS OPTIONS -# - -#number of threads you want to use in TEXT import mode ( you can safely set it to your number of processor increasing process speed ) -THREADS=1 - -IMPORTOPTS_TEXT="--use-threads=$THREADS --local --compress --delete --lock-tables" - -DUMPOPTS="--skip-comments --skip-set-charset --extended-insert --order-by-primary --single-transaction --quick" - +#!/bin/bash +# +# * Copyright (C) 2007 - 2015 Hyperweb2 All rights reserved. +# * GNU General Public License version 3; see www.hyperweb2.com/terms/ +# +# This file contains login/password information for accessing the MySQL database +# and is used by all the mysql_* scripts. +# + +# +# MYSQL +# + +# change these lines with your mysql config +MYSQL_DB=test +MYSQL_USER=usr +MYSQL_PASS=pwd +MYSQL_HOST=localhost +#MYSQL_SOCK=/var/lib/mysql/mysql.sock + +# +# File Options +# + +# path of directory where extract separated tables ( without end slash ) +TPATH=./tables + +# (boolean) clean directory before dump, in this way non-existant db tables will be deleted +CLEANFOLDER=1 + +# path of file to extract database full dump +FPATH=./full/full.sql + +# (boolean) switch to enable(1)/disable(0) the dump/import of full db file +# ( you can do it manually using command parameters ) +FULL=0 + +# (boolean) set 1 to enable --tab option for mysqldump and import data from it +# it's very fast import/export process but doesn't utilize the insert query +# NOTE: full db continue to be dumped with normal sql format +# NOTE2: if you have problem with permissions ( mysql errorcode:13) mostly in linux +# you should enable CHMODE config and disable/edit +# some protections such as AppArmor in Ubuntu or SELinux in Fedora.. + +TEXTDUMPS=1 + +# (boolean) allow to change "TPATH" folder permissions to enable mysql server writing + +CHMODE=0 + + +# +# TOOLS OPTIONS +# + +#number of threads you want to use in TEXT import mode ( you can safely set it to your number of processor increasing process speed ) +THREADS=1 + +IMPORTOPTS_TEXT="--use-threads=$THREADS --local --compress --delete --lock-tables" + +DUMPOPTS="--skip-comments --skip-set-charset --extended-insert --order-by-primary --single-transaction --quick" + diff --git a/deps/drassil/mysql-tools/mysql-dump b/deps/acore/mysql-tools/mysql-dump similarity index 100% rename from deps/drassil/mysql-tools/mysql-dump rename to deps/acore/mysql-tools/mysql-dump diff --git a/deps/drassil/mysql-tools/mysql-import b/deps/acore/mysql-tools/mysql-import similarity index 100% rename from deps/drassil/mysql-tools/mysql-import rename to deps/acore/mysql-tools/mysql-import diff --git a/deps/drassil/mysql-tools/mysql-tools b/deps/acore/mysql-tools/mysql-tools similarity index 100% rename from deps/drassil/mysql-tools/mysql-tools rename to deps/acore/mysql-tools/mysql-tools diff --git a/deps/drassil/mysql-tools/shared-def b/deps/acore/mysql-tools/shared-def similarity index 100% rename from deps/drassil/mysql-tools/shared-def rename to deps/acore/mysql-tools/shared-def diff --git a/deps/acore/mysql-tools/upt.json b/deps/acore/mysql-tools/upt.json new file mode 100644 index 0000000000..2956a94a2c --- /dev/null +++ b/deps/acore/mysql-tools/upt.json @@ -0,0 +1,11 @@ +{ + "name": "udw/mysql-tools", + "dependencies": { + }, + "devDependencies": { + }, + "_comment_keep": "ensure we keep the right git repository configurations", + "keep": [ + ".git/config" + ] +} diff --git a/deps/deno/bin/.gitignore b/deps/deno/bin/.gitignore new file mode 100644 index 0000000000..6f4f877a95 --- /dev/null +++ b/deps/deno/bin/.gitignore @@ -0,0 +1 @@ +deno* diff --git a/deps/deno/bin/README.md b/deps/deno/bin/README.md new file mode 100644 index 0000000000..563b3e2b8f --- /dev/null +++ b/deps/deno/bin/README.md @@ -0,0 +1,3 @@ +# DENO + +This folder is empty and needed to host the deno binaries automatically downloaded by the ./acore.sh dahsboard \ No newline at end of file diff --git a/deps/git-subrepo b/deps/git-subrepo new file mode 160000 index 0000000000..2f6859642a --- /dev/null +++ b/deps/git-subrepo @@ -0,0 +1 @@ +Subproject commit 2f6859642ae9104a9699021218bf607598f5a0ea diff --git a/deps/hw-core/bash-lib-git/src/subtree.sh b/deps/hw-core/bash-lib-git/src/subtree.sh deleted file mode 100644 index 08820e6405..0000000000 --- a/deps/hw-core/bash-lib-git/src/subtree.sh +++ /dev/null @@ -1,3 +0,0 @@ -function hwc_git_subtree_list() { - git log | grep git-subtree-dir | tr -d ' ' | cut -d ":" -f2 | sort | uniq -} diff --git a/doc/Logging.md b/doc/Logging.md new file mode 100644 index 0000000000..9059fd5756 --- /dev/null +++ b/doc/Logging.md @@ -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)` diff --git a/docker-compose.yml b/docker-compose.yml index a13d49ceb2..16ade324fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,79 +1,147 @@ -version: '3.2' +version: '3.9' + +# extension field: https://docs.docker.com/compose/compose-file/compose-file-v3/#extension-fields +x-networks: &networks + networks: + - ac-network + +x-ac-shared-conf: &ac-shared-conf + <<: *networks + working_dir: /azerothcore + depends_on: + ac-database: + condition: service_healthy services: +#============================ +# +# Abstract services to extend +# +#============================ + + abstract-bind: + image: local/azerothcore/abstract-bind + volumes: + - .:/azerothcore/ + # env dir shared between services + # we cannot use /env/dist to avoid permission issues + - ac-env:/azerothcore/env + # expose some dist folder outside allowing the host to use them + - ${DOCKER_CONF:-./conf}:/azerothcore/conf + - ${DOCKER_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc + # [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544 + - ${DOCKER_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated + - ${DOCKER_DATA:-./env/docker/data}:/azerothcore/env/dist/data:delegated + profiles: [abstract-service] # do not run this + + abstract-no-bind: + image: local/azerothcore/abstract-no-bind + volumes: + - ac-proj:/azerothcore/ + profiles: [abstract-service] # do not run this + +#======================= +# +# Applications +# +#======================= + ac-database: - image: azerothcore/database + <<: *networks + image: mysql:8.0 restart: unless-stopped - build: - context: . - dockerfile: ./docker/database/Dockerfile - networks: - - ac-network + cap_add: + - SYS_NICE # CAP_SYS_NICE ports: - - ${DB_EXTERNAL_PORT:-3306}:3306 + - ${DOCKER_DB_EXTERNAL_PORT:-3306}:3306 environment: - - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD:-password} + - MYSQL_ROOT_PASSWORD=${DOCKER_DB_ROOT_PASSWORD:-password} volumes: - type: volume source: ac-database target: /var/lib/mysql + healthcheck: + test: "/usr/bin/mysql --user=root --password=$$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\"" + interval: 2s + timeout: 20s + retries: 10 + ac-worldserver: + <<: *ac-shared-conf + extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} stdin_open: true tty: true - image: azerothcore/worldserver + command: ./acore.sh run-worldserver + image: acore/worldserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally restart: unless-stopped + env_file: + ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} privileged: true build: - context: ./docker/worldserver - dockerfile: Dockerfile - networks: - - ac-network + context: . + target: ${DOCKER_BUILD_WORLD_TARGET:-dev} + dockerfile: ./apps/docker/Dockerfile ports: - - ${WORLD_EXTERNAL_PORT:-8085}:8085 - - ${SOAP_EXTERNAL_PORT:-7878}:7878 - volumes: - - type: bind - source: ./docker/worldserver/bin - target: /azeroth-server/bin - - type: bind - source: ${WORLDSERVER_ETC:-./docker/worldserver/etc} - target: /azeroth-server/etc - - type: bind - source: ${WORLDSERVER_LOGS:-./docker/worldserver/logs} - target: /azeroth-server/logs - - type: bind - source: ${WORLDSERVER_DATA:-./docker/worldserver/data} - target: /azeroth-server/data - depends_on: - - ac-database + - ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085 + - ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878 + profiles: [all, app, worldserver] ac-authserver: - image: azerothcore/authserver + <<: *ac-shared-conf + extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} + tty: true + command: ./acore.sh run-authserver + image: acore/authserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally restart: unless-stopped + env_file: + ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} build: - context: ./docker/authserver - dockerfile: Dockerfile - networks: - - ac-network + context: . + target: ${DOCKER_BUILD_AUTH_TARGET:-dev} + dockerfile: ./apps/docker/Dockerfile ports: - - ${AUTH_EXTERNAL_PORT:-3724}:3724 + - ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724 + profiles: [all, app, authserver] + +#====================== +# +# Dev services +# +#====================== + + ac-dev-server: + <<: *ac-shared-conf + tty: true + image: acore/dev-server:${DOCKER_IMAGE_TAG:-master} + security_opt: + - seccomp:unconfined + build: + context: . + target: dev + dockerfile: ./apps/docker/Dockerfile + args: + USER_ID: ${DOCKER_USER_ID:-1000} + GROUP_ID: ${DOCKER_GROUP_ID:-1000} + extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} + env_file: + ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} + environment: + DBLIST: AUTH,CHARACTERS,WORLD + ports: + - ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724 + - ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085 + - ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878 volumes: - - type: bind - source: ./docker/authserver/bin - target: /azeroth-server/bin - - type: bind - source: ${AUTHSERVER_ETC:-./docker/authserver/etc} - target: /azeroth-server/etc - - type: bind - source: ${AUTHSERVER_LOGS:-./docker/authserver/logs} - target: /azeroth-server/logs - depends_on: - - ac-database + - ac-build:/azerothcore/var/build + profiles: [all, dev] volumes: ac-database: + ac-env: + ac-build: + ac-proj: networks: ac-network: diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index fd9f9ff7b5..0000000000 --- a/docker/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Run AzerothCore with Docker - -*This readme it's a summary of the AzerothCore docker features.* - -Docker. is a software that performs operating-system-level virtualization, allowing to wrap and launch applications inside containers. - -Thanks to Docker, you can quickly setup and run AzerothCore in any operating system. - -The **only** requirement is having [Docker](https://docs.docker.com/install/) installed into your system. Forget about installing mysql, visual studio, cmake, etc... - -### Installation instructions - -To install and AzerothCore using Docker, you have two options - -#### Option A. Using Docker Compose (very easy - recommended) - -- Check the [Install with Docker](https://www.azerothcore.org/wiki/Install-with-Docker) guide. - -#### Option B. Build and start each container manually (longer - not recommended) - -You have to follow these steps (**respecting the order**): - -1) Create a Docker Network: `docker network create ac-network`. All your docker containers will use it to communicate to each other. - -2) Launch one instance of the [AzerothCore Dockerized Database](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/database) - -3) Build AzerothCore using [AzerothCore Dockerized Build](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build) - -4) Launch one instance of the [AzerothCore Dockerized Authserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/authserver) - -5) Launch one instance of the [AzerothCore Dockerized Worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver) - - -### Memory usage - -The total amount of RAM when running all AzerothCore docker containers is **less than 2 GB**. - -![AzerothCore containers memory](https://user-images.githubusercontent.com/75517/51078287-10e65b80-16b3-11e9-807f-f59a5844dae5.png) - - -### Docker containers vs Virtual machines - -Usind Docker will have the same benefits as using virtual machines, but with much less overhead: - -![Docker containers vs Virtual machines](https://user-images.githubusercontent.com/75517/51078179-d4fec680-16b1-11e9-8ce6-87b5053f55dd.png) - diff --git a/docker/authserver/Dockerfile b/docker/authserver/Dockerfile deleted file mode 100644 index d7e6bc2e9a..0000000000 --- a/docker/authserver/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu:20.04 - -# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones - -# set timezone environment variable -ENV TZ=Etc/UTC - -# set noninteractive mode so tzdata doesn't ask to set timezone on install -ENV DEBIAN_FRONTEND=noninteractive - -# install the required dependencies to run the authserver -RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev net-tools tzdata; - -# change timezone in container -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata - -HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=3 CMD netstat -lnpt | grep :3724 || exit 1 - -# run the authserver located in the directory "docker/authserver/bin" of the host machine -CMD ["/azeroth-server/bin/authserver"] diff --git a/docker/authserver/README.md b/docker/authserver/README.md deleted file mode 100644 index d4d3a7f180..0000000000 --- a/docker/authserver/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AzerothCore Dockerized Authserver - -This provides a way to manually build and launch a container with the AzerothCore authserver running inside it. - -If you just want to install the whole AzerothCore quickly using Docker Compose, we recommend [this guide](http://www.azerothcore.org/wiki/install-with-Docker). - -## Requirements - -- You need to have [Docker](https://docs.docker.com/install/) installed in your system. You can install it on any operating system. - -- You need to first build the [AzerothCore Build Image](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build). - -- If you haven't created a docker network yet, create it by simply using `docker network create ac-network`. - -- You have to copy the file `docker/authserver/etc/authserver.conf.dockerdist` and rename the copied file to `docker/authserver/etc/authserver.conf`. Then open it and change the values where needed (you may need to change the DB port). - -## Building the container image - -To build the container image you have to be in the **main** folder of your local AzerothCore sources directory. - -``` -docker build -t azerothcore/authserver -f docker/authserver/Dockerfile docker/authserver -``` - -*For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).* - -## Run the container - -``` -docker run --name ac-authserver \ - --mount type=bind,source="$(pwd)"/docker/authserver/bin/,target=/azeroth-server/bin \ - --mount type=bind,source="$(pwd)"/docker/authserver/etc/,target=/azeroth-server/etc \ - --mount type=bind,source="$(pwd)"/docker/authserver/logs/,target=/azeroth-server/logs \ - -p 127.0.0.1:3724:3724 \ - --network ac-network \ - -it azerothcore/authserver -``` - -*For more information about the `docker run` command, check the [docker run doc](https://docs.docker.com/engine/reference/run/).* diff --git a/docker/authserver/logs/.gitkeep b/docker/authserver/logs/.gitkeep deleted file mode 100644 index 8b13789179..0000000000 --- a/docker/authserver/logs/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile deleted file mode 100644 index db37eab909..0000000000 --- a/docker/build/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM ubuntu:20.04 - -# install the required dependencies to compile AzerothCore -ARG DEBIAN_FRONTEND=noninteractive -RUN apt update && apt install -y git cmake make gcc g++ clang libmysqlclient-dev libssl-dev libbz2-dev libreadline-dev libncurses-dev libace-6.4.5 libace-dev - -# copy the sources from the host machine to the Docker container -ADD .git /azerothcore/.git -ADD deps /azerothcore/deps -ADD conf/dist /azerothcore/conf/dist -ADD src /azerothcore/src -ADD modules /azerothcore/modules -ADD CMakeLists.txt /azerothcore/CMakeLists.txt - -ARG ENABLE_SCRIPTS=1 -ENV ENABLE_SCRIPTS=$ENABLE_SCRIPTS - -ENTRYPOINT cd azerothcore/build && \ - # run cmake - cmake ../ -DCMAKE_INSTALL_PREFIX=/azeroth-server -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DTOOLS=0 -DSCRIPTS=$ENABLE_SCRIPTS -DWITH_WARNINGS=1 -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" && \ - # calculate the optimal number of threads - MTHREADS=`grep -c ^processor /proc/cpuinfo`; MTHREADS=$(($MTHREADS + 2)) && \ - # run compilation - make -j $MTHREADS && \ - make install -j $MTHREADS && \ - # copy the binary files "authserver" and "worldserver" files back to the host - # - the directories "/binworldserver" and "/binauthserver" are meant to be bound to the host directories - # - see docker/build/README.md to view the bindings - cp -f /azeroth-server/bin/worldserver /binworldserver && \ - cp -f /azeroth-server/bin/authserver /binauthserver diff --git a/docker/build/README.md b/docker/build/README.md deleted file mode 100644 index a47db99e9f..0000000000 --- a/docker/build/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# AzerothCore Dockerized Build - -The AzerothCore Build Dockerfile will create a container that will run the AC build. - -When this container runs, it will compile AC and generate: - -- the build cache in the `docker/build/cache` directory -- the `worldserver` executable file in `docker/worldserver/bin` -- the `authserver` executable file in `docker/authserver/bin` - -The executable files will be used by the [authserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/authserver) and the [worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver) docker containers. - -Note: every time you update your AzerothCore sources, you **must** run again the build container and restart your `worldserver` and `authserver` containers. - -## Usage - -To build the container image you have to be in the **main** folder of your local AzerothCore sources directory and run: - -``` -docker build -t acbuild -f docker/build/Dockerfile . -``` - -Then you can launch the container to rebuild AC using: - -``` -docker run \ - -v /$(pwd)/docker/build/cache:/azerothcore/build \ - -v /$(pwd)/docker/worldserver/bin:/binworldserver \ - -v /$(pwd)/docker/authserver/bin:/binauthserver \ - acbuild -``` - -### Clearing the cache - -To clear the build cache, delete all files contained under the `docker/build/cache` directory. diff --git a/docker/database/Dockerfile b/docker/database/Dockerfile deleted file mode 100644 index 5fd73237d7..0000000000 --- a/docker/database/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM alpine:3.9 as builder - -# install bash -RUN apk add --no-cache bash - -# copy the sources from the host machine -COPY apps /azerothcore/apps -COPY bin /azerothcore/bin -COPY conf /azerothcore/conf -COPY data /azerothcore/data -COPY deps /azerothcore/deps -COPY acore.json /azerothcore/acore.json - -# run the AzerothCore database assembler -RUN ./azerothcore/bin/acore-db-asm 1 - -FROM mysql:5.7 - -# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones - -# set timezone environment variable -ENV TZ=Etc/UTC - -ENV LANG C.UTF-8 - -# copy files from the previous build stage - see: https://docs.docker.com/develop/develop-images/multistage-build/ -COPY --from=builder /azerothcore/env/dist/sql /sql - -# adding the "generate-databases.sh" to the directory "/docker-entrypoint-initdb.d" -# because all scripts included in that directory will automatically be executed when the docker container starts -COPY docker/database/generate-databases.sh /docker-entrypoint-initdb.d - -HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=3 CMD mysqladmin -uroot -p$MYSQL_ROOT_PASSWORD ping -h localhost diff --git a/docker/database/README.md b/docker/database/README.md deleted file mode 100644 index 77a7670614..0000000000 --- a/docker/database/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# AzerothCore Dockerized Database - -This provides a way to quickly launch one or more instances of a fully-ready AzerothCore database. It is particularly useful for testing/development purposes. - -For example, with this you can quickly create a new, clean instance of the AzerothCore DB. Or create **multiple** instances each one available on a different **port** (that can be handy to test & compare things). - -Instances (containers) can be easily set up and then destroyed, so you can always switch to a clean state after your experiments. Every instance will have the three `acore_auth`, `acore_characters` and `acore_world` mysql databases. - -**NOTE**: you do **not** need to install any mysql-server manually in your system and if you already have it, the docker instances will **not** interfere with it. - - -If you just want to install the whole AzerothCore quickly using Docker Compose, we recommend following [this guide instead](http://www.azerothcore.org/wiki/install-with-Docker). - - -# Setup & usage instructions - -### Requirements - -The only requirement is [Docker](https://docs.docker.com/install/). You can install it on any operating system. - - -## Building the container image - -To build the container image you have to be in the **main folder** of your local AzerothCore sources directory. - -If you don't have the AzerothCore sources, clone it using: - -`git clone https://github.com/azerothcore/azerothcore-wotlk.git` - -and cd into it `cd azerothcore-wotlk`. - -You can build the image using: - -``` -docker build -t azerothcore/database -f docker/database/Dockerfile . -``` - -**Note:** the version of your DB will be the one of your sources when you built the image. If you want to update it, just update your sources (`git pull`) and build the image again. - -*For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).* - - -## How to launch a container - -Run the following command to launch a container: - -``` -docker run --name ac-database \ - -p 127.0.0.1:3306:3306 \ - -e MYSQL_ROOT_PASSWORD=password \ - --network ac-network \ - azerothcore/database -``` - -Where: - -`--name` is followed by a container name like `ac-database`. Put whatever name you like, each container should have an unique name. - -`-p` (port) is followed by `IP_ADDRESS:EXTERNAL_PORT:INTERNAL_PORT`. - -- INTERNAL_PORT **must** always be 3306. -- EXTERNAL_PORT is the port that you will use to access the mysql-server from outside docker - -`--network` takes the name of the internal docker network. Containers must be on the same network to communicate to each other. - -**NOTE**: You may want to use an external port different than 3306 in case you have already mysql-server installed in your system (or some other service that is using that port). So you can use for example port 9000 with `-p 127.0.0.1:9000:3306` - -`docker run --name ac-database -p 9000:3306 -e MYSQL_ROOT_PASSWORD=password azerothcore/database` - -`-e MYSQL_ROOT_PASSWORD=password` lets you change the default password for the `root` user. - -`azerothcore/database` will be the name of your docker image. - -When the container is ready, you will see a message similar to: - -> Version: '5.7.24' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) - -You can optionally pass option `-d` to detach the container run from your terminal. - -You can optionally pass option `-it` to run the container as an interactive process (so you can kill it with ctrl+c). - -*For more information about the `docker run` command, check the [docker run doc](https://docs.docker.com/engine/reference/run/).* - -## Launching more instances - -You can easily run more instances. You just have to specify a different **name** and **port** for each. - -Example: I want to launch three instances of the AzerothCore databases, each one listening respectively on port 9001, 9002 and 9003. I can do it with the following commands: - -`docker run --name ac-database-1 -p 127.0.0.1:9001:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database` -`docker run --name ac-database-2 -p 127.0.0.1:9002:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database` -`docker run --name ac-database-3 -p 127.0.0.1:9003:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database` - -You can use the `docker ps` command to check your running containers. - -*For more information about the `docker ps` command, check the [docker ps doc](https://docs.docker.com/engine/reference/commandline/ps/).* - -## Stopping / removing - -You can stop a container using `docker stop name-of-the container`, for example `docker stop ac-database-1`. - -You can then remove the container using `docker rm name-of-the container`, for example `docker rm ac-database-1`. diff --git a/docker/database/generate-databases.sh b/docker/database/generate-databases.sh deleted file mode 100755 index 5912af5464..0000000000 --- a/docker/database/generate-databases.sh +++ /dev/null @@ -1,40 +0,0 @@ -# TODO: remove this line after we squash our DB updates -mysql -u root -p$MYSQL_ROOT_PASSWORD -e "SET GLOBAL max_allowed_packet=128*1024*1024;" - -echo "Creating DBs..." -mysql -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE acore_auth" -mysql -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE acore_characters" -mysql -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE acore_world" - - -echo "Importing auth base..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_auth < /sql/auth_base.sql - -echo "Importing characters base..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_characters < /sql/characters_base.sql - -echo "Importing world base..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_world < /sql/world_base.sql - - -echo "Importing auth updates..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_auth < /sql/auth_updates.sql - -echo "Importing characters updates..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_characters < /sql/characters_updates.sql - -echo "Importing world updates..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_world < /sql/world_updates.sql - - -echo "Importing auth custom (if any)..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_auth < /sql/auth_custom.sql - -echo "Importing characters custom (if any)..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_characters < /sql/characters_custom.sql - -echo "Importing world custom (if any)..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_world < /sql/world_custom.sql - - -echo "Done!" diff --git a/docker/worldserver/Dockerfile b/docker/worldserver/Dockerfile deleted file mode 100644 index e208e48994..0000000000 --- a/docker/worldserver/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu:20.04 - -# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones - -# set timezone environment variable -ENV TZ=Etc/UTC - -# set noninteractive mode so tzdata doesn't ask to set timezone on install -ENV DEBIAN_FRONTEND=noninteractive - -# install the required dependencies to run the authserver -RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev libreadline-dev net-tools tzdata; - -# change timezone in container -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata - -HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=3 CMD netstat -lnpt | grep :8085 || exit 1 - -# run the worldserver located in the directory "docker/worldserver/bin" of the host machine -CMD ["/azeroth-server/bin/worldserver"] diff --git a/docker/worldserver/README.md b/docker/worldserver/README.md deleted file mode 100644 index 3e8f577c52..0000000000 --- a/docker/worldserver/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# AzerothCore Dockerized Worldserver - -This provides a way to build and launch a container with the AzerothCore authserver running inside it. - -If you just want to install the whole AzerothCore quickly using Docker Compose, we recommend following [this guide instead](http://www.azerothcore.org/wiki/install-with-Docker). - -## Requirements - -- You need to have [Docker](https://docs.docker.com/install/) installed in your system. You can install it on any operating system. - -- You need to first build AzerothCore using the [AzerothCore Dockerized Build](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build). - -- If you haven't created a docker network yet, create it by simply using `docker network create ac-network`. - -- You have to copy the file `docker/worldserver/worldserver.conf.dockerdist` and rename the copied file to `docker/worldserver/worldserver.conf`. Then open it and change the values where needed (you may need to change the DB port). - -- You need to have the **data files** somewhere in your system. If you don't have them yet, check the step ["Download the data files" from the installation guide](http://www.azerothcore.org/wiki/Installation#5-download-the-data-files). - -## Building the container image - -To build the container image you have to be in the **main** folder of your local AzerothCore sources directory. - -```docker build -t azerothcore/worldserver -f docker/worldserver/Dockerfile docker/worldserver``` - -*For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).* - -## Run the container - -Replace `/path/to/your/data` with the path of where your data folder is. - -``` -docker run --name ac-worldserver \ - --mount type=bind,source=/path/to/your/data,target=/azeroth-server/data \ - --mount type=bind,source="$(pwd)"/docker/worldserver/bin/,target=/azeroth-server/bin \ - --mount type=bind,source="$(pwd)"/docker/worldserver/etc/,target=/azeroth-server/etc \ - --mount type=bind,source="$(pwd)"/docker/worldserver/logs/,target=/azeroth-server/logs \ - -p 127.0.0.1:8085:8085 \ - --network ac-network \ - -it azerothcore/worldserver -``` - -*For more information about the `docker run` command, check the [docker run doc](https://docs.docker.com/engine/reference/run/).* diff --git a/docker/worldserver/data/.gitkeep b/docker/worldserver/data/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/docker/worldserver/etc/.gitkeep b/docker/worldserver/etc/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/docker/worldserver/logs/.gitkeep b/docker/worldserver/logs/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/docker/authserver/etc/.gitkeep b/env/docker/data/.gitkeep similarity index 100% rename from docker/authserver/etc/.gitkeep rename to env/docker/data/.gitkeep diff --git a/docker/build/cache/.gitkeep b/env/docker/etc/.gitkeep similarity index 100% rename from docker/build/cache/.gitkeep rename to env/docker/etc/.gitkeep diff --git a/docker/authserver/etc/authserver.conf.dockerdist b/env/docker/etc/authserver.conf.dockerdist similarity index 95% rename from docker/authserver/etc/authserver.conf.dockerdist rename to env/docker/etc/authserver.conf.dockerdist index fdfa1cc695..48a00fca22 100644 --- a/docker/authserver/etc/authserver.conf.dockerdist +++ b/env/docker/etc/authserver.conf.dockerdist @@ -5,7 +5,7 @@ # Do not change this # Files in LogsDir will reflect on your host directory: docker/authserver/logs -LogsDir = "/azeroth-server/logs" +LogsDir = "/azerothcore/env/dist/logs" # Change this configuration accordingly with your docker setup # The format is "hostname;port;username;password;database": diff --git a/docker/worldserver/etc/worldserver.conf.dockerdist b/env/docker/etc/worldserver.conf.dockerdist similarity index 92% rename from docker/worldserver/etc/worldserver.conf.dockerdist rename to env/docker/etc/worldserver.conf.dockerdist index 854cbb3c3e..d59ffa2e1b 100644 --- a/docker/worldserver/etc/worldserver.conf.dockerdist +++ b/env/docker/etc/worldserver.conf.dockerdist @@ -5,8 +5,8 @@ # Do NOT change those Dir configs # Files in LogsDir will reflect on your host directory: docker/worldserver/logs -LogsDir = "/azeroth-server/logs" -DataDir = "/azeroth-server/data" +LogsDir = "/azerothcore/env/dist/logs" +DataDir = "/azerothcore/env/dist/data" # Change this configuration accordingly with your docker setup # The format is "hostname;port;username;password;database": diff --git a/docker/worldserver/bin/.gitkeep b/env/docker/logs/.gitkeep similarity index 100% rename from docker/worldserver/bin/.gitkeep rename to env/docker/logs/.gitkeep diff --git a/modules/create_module.sh b/modules/create_module.sh index 3f2f638105..51e9de479a 100644 --- a/modules/create_module.sh +++ b/modules/create_module.sh @@ -31,7 +31,7 @@ then git init && git add -A && git commit -m "Initial commit - $MODULE_NAME" echo "--- Configure git for nice commit messages" - source $GIT_COMMIT_MSG_SETUP || bash $GIT_COMMIT_MSG_SETUP + source "$GIT_COMMIT_MSG_SETUP" || bash "$GIT_COMMIT_MSG_SETUP" echo "--- Ready to code" fi diff --git a/src/cmake/compiler/clang/settings.cmake b/src/cmake/compiler/clang/settings.cmake index 32234085cf..fecfb2edc4 100644 --- a/src/cmake/compiler/clang/settings.cmake +++ b/src/cmake/compiler/clang/settings.cmake @@ -8,6 +8,14 @@ target_compile_definitions(acore-compile-option-interface INTERFACE -D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}") +set(CLANG_EXPECTED_VERSION 6.0.0) + +if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_EXPECTED_VERSION) + message(FATAL_ERROR "Clang: AzerothCore requires version ${CLANG_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}") +else() + message(STATUS "Clang: Minimum version required is ${CLANG_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!") +endif() + # This tests for a bug in clang-7 that causes linkage to fail for 64-bit from_chars (in some configurations) # If the clang requirement is bumped to >= clang-8, you can remove this check, as well as # the associated ifdef block in src/common/Utilities/StringConvert.h @@ -59,6 +67,20 @@ target_compile_options(acore-compile-option-interface -Wno-narrowing -Wno-deprecated-register) -target_compile_definitions(acore-compile-option-interface - INTERFACE - -DDEBUG=1) +if(BUILD_SHARED_LIBS) + # -fPIC is needed to allow static linking in shared libs. + # -fvisibility=hidden sets the default visibility to hidden to prevent exporting of all symbols. + target_compile_options(acore-compile-option-interface + INTERFACE + -fPIC) + + target_compile_options(acore-hidden-symbols-interface + INTERFACE + -fvisibility=hidden) + + # --no-undefined to throw errors when there are undefined symbols + # (caused through missing WARHEAD_*_API macros). + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --no-undefined") + + message(STATUS "Clang: Disallow undefined symbols") +endif() diff --git a/src/cmake/compiler/gcc/settings.cmake b/src/cmake/compiler/gcc/settings.cmake index 4e6b126e59..7519278053 100644 --- a/src/cmake/compiler/gcc/settings.cmake +++ b/src/cmake/compiler/gcc/settings.cmake @@ -8,10 +8,12 @@ target_compile_definitions(acore-compile-option-interface INTERFACE -D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}") -set(GCC_EXPECTED_VERSION 4.8.2) +set(GCC_EXPECTED_VERSION 7.0.0) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_EXPECTED_VERSION) message(FATAL_ERROR "GCC: This project requires version ${GCC_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}") +else() + message(STATUS "GCC: Minimum version required is ${GCC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!") endif() if(PLATFORM EQUAL 32) @@ -47,3 +49,21 @@ if( WITH_COREDEBUG ) -g3) message(STATUS "GCC: Debug-flags set (-g3)") endif() + +if(BUILD_SHARED_LIBS) + target_compile_options(acore-compile-option-interface + INTERFACE + -fPIC + -Wno-attributes) + + target_compile_options(acore-hidden-symbols-interface + INTERFACE + -fvisibility=hidden) + + # Should break the build when there are WARHEAD_*_API macros missing + # but it complains about missing references in precompiled headers. + # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--no-undefined") + # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-undefined") + + message(STATUS "GCC: Enabled shared linking") +endif() diff --git a/src/cmake/compiler/msvc/settings.cmake b/src/cmake/compiler/msvc/settings.cmake index 0ca173c0e0..aa4b389052 100644 --- a/src/cmake/compiler/msvc/settings.cmake +++ b/src/cmake/compiler/msvc/settings.cmake @@ -6,9 +6,14 @@ # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -# set up output paths ofr static libraries etc (commented out - shown here as an example only) -#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(MSVC_EXPECTED_VERSION 19.24) +set(MSVC_EXPECTED_VERSION_STRING "Microsoft Visual Studio 2019 16.4") + +if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_EXPECTED_VERSION) + message(FATAL_ERROR "MSVC: AzerothCore requires version ${MSVC_EXPECTED_VERSION} (${MSVC_EXPECTED_VERSION_STRING}) to build but found ${CMAKE_CXX_COMPILER_VERSION}") +else() + message(STATUS "MSVC: Minimum version required is ${MSVC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!") +endif() # CMake sets warning flags by default, however we manage it manually # for different core and dependency targets @@ -106,6 +111,14 @@ if(NOT WITH_WARNINGS) endif() endif() +# Ignore specific warnings +# C4351: new behavior: elements of array 'x' will be default initialized +# C4091: 'typedef ': ignored on left of '' when no variable is declared +target_compile_options(acore-compile-option-interface + INTERFACE + /wd4351 + /wd4091) + # Specify the maximum PreCompiled Header memory allocation limit # Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid discrepancies) # (And yes, this is a verified , unresolved bug with MSVC... *sigh*) @@ -119,3 +132,26 @@ target_compile_options(acore-warning-interface INTERFACE /we4263 /we4264) + +if(BUILD_SHARED_LIBS) + # C4251: needs to have dll-interface to be used by clients of class '...' + # C4275: non dll-interface class ...' used as base for dll-interface class '...' + target_compile_options(acore-compile-option-interface + INTERFACE + /wd4251 + /wd4275) + + message(STATUS "MSVC: Enabled shared linking") +endif() + +# Disable incremental linking in debug builds. +# To prevent linking getting stuck (which might be fixed in a later VS version). +macro(DisableIncrementalLinking variable) +string(REGEX REPLACE "/INCREMENTAL *" "" ${variable} "${${variable}}") +set(${variable} "${${variable}} /INCREMENTAL:NO") +endmacro() + +DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_DEBUG) +DisableIncrementalLinking(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO) +DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_DEBUG) +DisableIncrementalLinking(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO) diff --git a/src/cmake/macros/ConfigureScripts.cmake b/src/cmake/macros/ConfigureScripts.cmake new file mode 100644 index 0000000000..cefaa88377 --- /dev/null +++ b/src/cmake/macros/ConfigureScripts.cmake @@ -0,0 +1,108 @@ +# +# Copyright (C) 2008-2019 TrinityCore +# Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# Returns the base path to the script directory in the source directory +function(WarnAboutSpacesInBuildPath) + # Only check win32 since unix doesn't allow spaces in paths + if(WIN32) + string(FIND "${CMAKE_BINARY_DIR}" " " SPACE_INDEX_POS) + + if(SPACE_INDEX_POS GREATER -1) + message("") + message(WARNING " *** WARNING!\n" + " *** Your selected build directory contains spaces!\n" + " *** Please note that this will cause issues!") + endif() + endif() +endfunction() + +# Returns the base path to the script directory in the source directory +function(GetScriptsBasePath variable) + set(${variable} "${CMAKE_SOURCE_DIR}/src/server/scripts" PARENT_SCOPE) +endfunction() + +# Stores the absolut path of the given module in the variable +function(GetPathToScriptModule module variable) + GetScriptsBasePath(SCRIPTS_BASE_PATH) + set(${variable} "${SCRIPTS_BASE_PATH}/${module}" PARENT_SCOPE) +endfunction() + +# Stores the project name of the given module in the variable +function(GetProjectNameOfScriptModule module variable) + string(TOLOWER "scripts_${SCRIPT_MODULE}" GENERATED_NAME) + set(${variable} "${GENERATED_NAME}" PARENT_SCOPE) +endfunction() + +# Creates a list of all script modules +# and stores it in the given variable. +function(GetScriptModuleList variable) + GetScriptsBasePath(BASE_PATH) + file(GLOB LOCALE_SCRIPT_MODULE_LIST RELATIVE + ${BASE_PATH} + ${BASE_PATH}/*) + + set(${variable}) + foreach(SCRIPT_MODULE ${LOCALE_SCRIPT_MODULE_LIST}) + GetPathToScriptModule(${SCRIPT_MODULE} SCRIPT_MODULE_PATH) + if(IS_DIRECTORY ${SCRIPT_MODULE_PATH}) + list(APPEND ${variable} ${SCRIPT_MODULE}) + endif() + endforeach() + set(${variable} ${${variable}} PARENT_SCOPE) +endfunction() + +# Converts the given script module name into it's +# variable name which holds the linkage type. +function(ScriptModuleNameToVariable module variable) + string(TOUPPER ${module} ${variable}) + set(${variable} "SCRIPTS_${${variable}}") + set(${variable} ${${variable}} PARENT_SCOPE) +endfunction() + +# Stores in the given variable whether dynamic linking is required +function(IsDynamicLinkingRequired variable) + if(SCRIPTS MATCHES "dynamic") + set(IS_DEFAULT_VALUE_DYNAMIC ON) + endif() + + GetScriptModuleList(SCRIPT_MODULE_LIST) + set(IS_REQUIRED OFF) + foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST}) + ScriptModuleNameToVariable(${SCRIPT_MODULE} SCRIPT_MODULE_VARIABLE) + if((${SCRIPT_MODULE_VARIABLE} STREQUAL "dynamic") OR + (${SCRIPT_MODULE_VARIABLE} STREQUAL "default" AND IS_DEFAULT_VALUE_DYNAMIC)) + set(IS_REQUIRED ON) + break() + endif() + endforeach() + set(${variable} ${IS_REQUIRED} PARENT_SCOPE) +endfunction() + +# Stores the native variable name +function(GetNativeSharedLibraryName module variable) + if(WIN32) + set(${variable} "${module}.dll" PARENT_SCOPE) + elseif(APPLE) + set(${variable} "lib${module}.dylib" PARENT_SCOPE) + else() + set(${variable} "lib${module}.so" PARENT_SCOPE) + endif() +endfunction() + +# Stores the native install path in the variable +function(GetInstallOffset variable) + if(WIN32) + set(${variable} "${CMAKE_INSTALL_PREFIX}/scripts" PARENT_SCOPE) + else() + set(${variable} "${CMAKE_INSTALL_PREFIX}/bin/scripts" PARENT_SCOPE) + endif() +endfunction() diff --git a/src/cmake/showoptions.cmake b/src/cmake/showoptions.cmake index 5822cd82cd..3ee69ae695 100644 --- a/src/cmake/showoptions.cmake +++ b/src/cmake/showoptions.cmake @@ -134,7 +134,7 @@ else() message("* Enable extra logging functions : No (default)") endif() -if(WIN32 AND NOT CMAKE_VERSION VERSION_LESS 2.8.12) +if(WIN32) if(NOT WITH_SOURCE_TREE STREQUAL "no") message("* Show source tree : Yes - \"${WITH_SOURCE_TREE}\"") else() @@ -144,4 +144,18 @@ else() message("* Show source tree : No (For UNIX default)") endif() +if(BUILD_SHARED_LIBS) + message("") + message(" *** WITH_DYNAMIC_LINKING - INFO!") + message(" *** Will link against shared libraries!") + message(" *** Please note that this is an experimental feature!") + if(WITH_DYNAMIC_LINKING_FORCED) + message("") + message(" *** Dynamic linking was enforced through a dynamic script module!") + endif() + add_definitions(-DACORE_API_USE_DYNAMIC_LINKING) + + WarnAboutSpacesInBuildPath() +endif() + message("") diff --git a/src/common/Banner.cpp b/src/common/Banner.cpp new file mode 100644 index 0000000000..5904b154e9 --- /dev/null +++ b/src/common/Banner.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU GPL v3 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. + */ + +#include "Banner.h" +#include "GitRevision.h" +#include "StringFormat.h" + +void acore::Banner::Show(char const* applicationName, void(*log)(char const* text), void(*logExtraInfo)()) +{ + log(acore::StringFormat("%s (%s)", GitRevision::GetFullVersion(), applicationName).c_str()); + log(" to stop.\n"); + log(" █████╗ ███████╗███████╗██████╗ ██████╗ ████████╗██╗ ██╗"); + log(" ██╔══██╗╚══███╔╝██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝██║ ██║"); + log(" ███████║ ███╔╝ █████╗ ██████╔╝██║ ██║ ██║ ███████║"); + log(" ██╔══██║ ███╔╝ ██╔══╝ ██╔══██╗██║ ██║ ██║ ██╔══██║"); + log(" ██║ ██║███████╗███████╗██║ ██║╚██████╔╝ ██║ ██║ ██║"); + log(" ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝"); + log(" ██████╗ ██████╗ ██████╗ ███████╗"); + log(" ██╔════╝██╔═══██╗██╔══██╗██╔═══╝"); + log(" ██║ ██║ ██║██████╔╝█████╗"); + log(" ██║ ██║ ██║██╔══██╗██╔══╝"); + log(" ╚██████╗╚██████╔╝██║ ██║███████╗"); + log(" ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝\n"); + log(" AzerothCore 3.3.5a - www.azerothcore.org\n"); + + if (logExtraInfo) + { + logExtraInfo(); + } +} diff --git a/src/common/Banner.h b/src/common/Banner.h new file mode 100644 index 0000000000..44160e0d0c --- /dev/null +++ b/src/common/Banner.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU GPL v3 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version. + */ + +#ifndef AZEROTHCORE_BANNER_H +#define AZEROTHCORE_BANNER_H + +#include "Define.h" + +namespace acore +{ + namespace Banner + { + void Show(char const* applicationName, void(*log)(char const* text), void(*logExtraInfo)()); + } +} + +#endif // AZEROTHCORE_BANNER_H diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index ae8c21fbab..d06edcaf3b 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -54,7 +54,6 @@ target_link_libraries(common PUBLIC acore-core-interface ace - mysql g3dlib Detour sfmt diff --git a/src/common/Collision/Management/MMapManager.cpp b/src/common/Collision/Management/MMapManager.cpp index 2e676fd704..1ccb133229 100644 --- a/src/common/Collision/Management/MMapManager.cpp +++ b/src/common/Collision/Management/MMapManager.cpp @@ -4,12 +4,17 @@ * Copyright (C) 2005-2009 MaNGOS */ +#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("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(¶ms)) { 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 @@ -80,20 +78,21 @@ namespace MMAP return uint32(x << 16 | y); } - ACE_RW_Thread_Mutex& MMapManager::GetMMapLock(uint32 mapId) + std::shared_mutex& MMapManager::GetMMapLock(uint32 mapId) { 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; } + return map->GetMMapLock(); } bool MMapManager::loadMap(uint32 mapId, int32 x, int32 y) { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock); + std::unique_lock guard(MMapManagerLock); // make sure the mmap is loaded and ready to load tiles if (!loadMapData(mapId)) @@ -107,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("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; @@ -150,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; } @@ -161,7 +153,7 @@ namespace MMAP dtStatus stat; { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId)); + std::unique_lock guard(GetMMapLock(mapId)); stat = mmap->navMesh->addTile(data, fileHeader.size, DT_TILE_FREE_DATA, 0, &tileRef); } @@ -172,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; } @@ -188,14 +180,14 @@ namespace MMAP bool MMapManager::unloadMap(uint32 mapId, int32 x, int32 y) { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock); + std::unique_lock guard(MMapManagerLock); // check if we have this map loaded if (loadedMMaps.find(mapId) == loadedMMaps.end()) { // 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; } @@ -208,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; } @@ -217,7 +209,7 @@ namespace MMAP dtStatus status; { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId)); + std::unique_lock guard(GetMMapLock(mapId)); status = mmap->navMesh->removeTile(tileRef, nullptr, nullptr); } @@ -227,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 @@ -235,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; } @@ -245,13 +237,13 @@ namespace MMAP bool MMapManager::unloadMap(uint32 mapId) { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock); + std::unique_lock guard(MMapManagerLock); if (loadedMMaps.find(mapId) == loadedMMaps.end()) { // 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; } @@ -265,17 +257,17 @@ namespace MMAP dtStatus status; { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId)); + std::unique_lock guard(GetMMapLock(mapId)); status = mmap->navMesh->removeTile(i->second, nullptr, nullptr); } 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 } } @@ -283,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; @@ -291,14 +283,14 @@ namespace MMAP bool MMapManager::unloadMapInstance(uint32 mapId, uint32 instanceId) { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock); + std::unique_lock guard(MMapManagerLock); // check if we have this map loaded if (loadedMMaps.find(mapId) == loadedMMaps.end()) { // 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; } @@ -307,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; } @@ -317,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; @@ -325,9 +317,6 @@ namespace MMAP dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId) { - // pussywizard: moved to calling function - //ACORE_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock); - if (loadedMMaps.find(mapId) == loadedMMaps.end()) return nullptr; @@ -336,9 +325,6 @@ namespace MMAP dtNavMeshQuery const* MMapManager::GetNavMeshQuery(uint32 mapId, uint32 instanceId) { - // pussywizard: moved to calling function - //ACORE_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock); - if (loadedMMaps.find(mapId) == loadedMMaps.end()) return nullptr; @@ -346,7 +332,7 @@ namespace MMAP if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end()) { // pussywizard: different instances of the same map shouldn't access this simultaneously - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId)); + std::unique_lock guard(GetMMapLock(mapId)); // check again after acquiring mutex if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end()) { @@ -356,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(instanceId, query)); } diff --git a/src/common/Collision/Management/MMapManager.h b/src/common/Collision/Management/MMapManager.h index ecb02a3924..d71e35b18e 100644 --- a/src/common/Collision/Management/MMapManager.h +++ b/src/common/Collision/Management/MMapManager.h @@ -7,11 +7,12 @@ #ifndef _MMAP_MANAGER_H #define _MMAP_MANAGER_H +#include "Common.h" #include "DetourAlloc.h" #include "DetourNavMesh.h" #include "DetourExtended.h" -#include "World.h" #include +#include // memory management inline void* dtCustomAlloc(size_t size, dtAllocHint /*hint*/) @@ -72,9 +73,9 @@ namespace MMAP uint32 getLoadedTilesCount() const { return loadedTiles; } uint32 getLoadedMapsCount() const { return loadedMMaps.size(); } - ACE_RW_Thread_Mutex& GetMMapLock(uint32 mapId); - ACE_RW_Thread_Mutex& GetMMapGeneralLock() { return MMapLock; } // pussywizard: in case a per-map mutex can't be found, should never happen - ACE_RW_Thread_Mutex& GetManagerLock() { return MMapManagerLock; } + std::shared_mutex& GetMMapLock(uint32 mapId); + std::shared_mutex& GetMMapGeneralLock() { return MMapLock; } // pussywizard: in case a per-map mutex can't be found, should never happen + std::shared_mutex& GetManagerLock() { return MMapManagerLock; } private: bool loadMapData(uint32 mapId); uint32 packTileID(int32 x, int32 y); @@ -82,9 +83,9 @@ namespace MMAP MMapDataSet loadedMMaps; uint32 loadedTiles; - ACE_RW_Thread_Mutex MMapManagerLock; - ACE_RW_Thread_Mutex MMapLock; // pussywizard: in case a per-map mutex can't be found, should never happen + std::shared_mutex MMapManagerLock; + std::shared_mutex MMapLock; // pussywizard: in case a per-map mutex can't be found, should never happen }; } -#endif \ No newline at end of file +#endif diff --git a/src/common/Collision/Management/VMapManager2.cpp b/src/common/Collision/Management/VMapManager2.cpp index d91d2d2755..7284762861 100644 --- a/src/common/Collision/Management/VMapManager2.cpp +++ b/src/common/Collision/Management/VMapManager2.cpp @@ -262,7 +262,7 @@ namespace VMAP WorldModel* VMapManager2::acquireModelInstance(const std::string& basepath, const std::string& filename) { //! Critical section, thread safe access to iLoadedModelFiles - ACORE_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock); + std::lock_guard guard(LoadedModelFilesLock); ModelFileMap::iterator model = iLoadedModelFiles.find(filename); if (model == iLoadedModelFiles.end()) @@ -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(filename, ManagedModel())).first; model->second.setModel(worldmodel); @@ -287,17 +287,17 @@ namespace VMAP void VMapManager2::releaseModelInstance(const std::string& filename) { //! Critical section, thread safe access to iLoadedModelFiles - ACORE_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock); + std::lock_guard guard(LoadedModelFilesLock); 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); diff --git a/src/common/Collision/Management/VMapManager2.h b/src/common/Collision/Management/VMapManager2.h index 4235963b28..71fcbeaa33 100644 --- a/src/common/Collision/Management/VMapManager2.h +++ b/src/common/Collision/Management/VMapManager2.h @@ -20,7 +20,7 @@ #include "IVMapManager.h" #include "Define.h" -#include +#include #include //=========================================================== @@ -72,7 +72,7 @@ namespace VMAP ModelFileMap iLoadedModelFiles; InstanceTreeMap iInstanceMapTrees; // Mutex for iLoadedModelFiles - ACE_Thread_Mutex LoadedModelFilesLock; + std::mutex LoadedModelFilesLock; bool _loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY); /* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */ diff --git a/src/common/Collision/Maps/MapTree.cpp b/src/common/Collision/Maps/MapTree.cpp index f710ed5082..520ad8cc33 100644 --- a/src/common/Collision/Maps/MapTree.cpp +++ b/src/common/Collision/Maps/MapTree.cpp @@ -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 #include #include @@ -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(); diff --git a/src/common/Collision/Models/GameObjectModel.cpp b/src/common/Collision/Models/GameObjectModel.cpp index 84abe10738..9a0e294a01 100644 --- a/src/common/Collision/Models/GameObjectModel.cpp +++ b/src/common/Collision/Models/GameObjectModel.cpp @@ -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; } diff --git a/src/common/Common.h b/src/common/Common.h index 3b92c383bd..7d0b3233ee 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -78,9 +78,6 @@ #include "Threading/LockedQueue.h" #include "Threading/Threading.h" - -#include -#include #include #if AC_PLATFORM == AC_PLATFORM_WINDOWS @@ -124,8 +121,6 @@ inline float finiteAlways(float f) { return isfinite(f) ? f : 0.0f; } inline bool myisfinite(float f) { return isfinite(f) && !isnan(f); } -#define atol(a) strtoul( a, nullptr, 10) - #define STRINGIZE(a) #a #define MAX_NETCLIENT_PACKET_SIZE (32767 - 1) // Client hardcap: int16 with trailing zero space otherwise crash on memory free @@ -187,22 +182,6 @@ typedef std::vector StringVector; #define MAX_QUERY_LEN 32*1024 -#define ACORE_GUARD(MUTEX, LOCK) \ - ACE_Guard< MUTEX > ACORE_GUARD_OBJECT (LOCK); \ - if (ACORE_GUARD_OBJECT.locked() == 0) ASSERT(false); - -//! For proper implementation of multiple-read, single-write pattern, use -//! ACE_RW_Mutex as underlying @MUTEX -# define ACORE_WRITE_GUARD(MUTEX, LOCK) \ - ACE_Write_Guard< MUTEX > ACORE_GUARD_OBJECT (LOCK); \ - if (ACORE_GUARD_OBJECT.locked() == 0) ASSERT(false); - -//! For proper implementation of multiple-read, single-write pattern, use -//! ACE_RW_Mutex as underlying @MUTEX -# define ACORE_READ_GUARD(MUTEX, LOCK) \ - ACE_Read_Guard< MUTEX > ACORE_GUARD_OBJECT (LOCK); \ - if (ACORE_GUARD_OBJECT.locked() == 0) ASSERT(false); - namespace acore { template diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp index 205ea26c06..c191f1be9c 100644 --- a/src/common/Configuration/Config.cpp +++ b/src/common/Configuration/Config.cpp @@ -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 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(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; } diff --git a/src/common/Debugging/Errors.cpp b/src/common/Debugging/Errors.cpp index a862430bed..be076c1409 100644 --- a/src/common/Debugging/Errors.cpp +++ b/src/common/Debugging/Errors.cpp @@ -56,7 +56,6 @@ namespace namespace acore { - void Assert(char const* file, int line, char const* function, std::string const& debugInfo, char const* message) { std::string formattedMessage = acore::StringFormat("\n%s:%i in %s ASSERTION FAILED:\n %s\n", file, line, function, message) + debugInfo + '\n'; @@ -116,6 +115,20 @@ namespace acore Crash(formattedMessage.c_str()); } + void Abort(char const* file, int line, char const* function, char const* message, ...) + { + va_list args; + va_start(args, message); + + std::string formattedMessage = StringFormat("\n%s:%i in %s ABORTED:\n", file, line, function) + FormatAssertionMessage(message, args) + '\n'; + va_end(args); + + fprintf(stderr, "%s", formattedMessage.c_str()); + fflush(stderr); + + Crash(formattedMessage.c_str()); + } + void AbortHandler(int sigval) { // nothing useful to log here, no way to pass args diff --git a/src/common/Debugging/Errors.h b/src/common/Debugging/Errors.h index 1a01c51ae0..6e40202f4e 100644 --- a/src/common/Debugging/Errors.h +++ b/src/common/Debugging/Errors.h @@ -21,6 +21,8 @@ namespace acore DECLSPEC_NORETURN void Abort(char const* file, int line, char const* function) ATTR_NORETURN; + DECLSPEC_NORETURN void Abort(char const* file, int line, char const* function, char const* message, ...) ATTR_NORETURN; + void Warning(char const* file, int line, char const* function, char const* message); DECLSPEC_NORETURN void AbortHandler(int sigval) ATTR_NORETURN; @@ -47,6 +49,7 @@ std::string GetDebugInfo(); #define WPError(cond, msg) ASSERT_BEGIN do { if (!(cond)) acore::Error(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END #define WPWarning(cond, msg) ASSERT_BEGIN do { if (!(cond)) acore::Warning(__FILE__, __LINE__, __FUNCTION__, (msg)); } while(0) ASSERT_END #define WPAbort() ASSERT_BEGIN do { acore::Abort(__FILE__, __LINE__, __FUNCTION__); } while(0) ASSERT_END +#define WPAbort_MSG(msg, ...) ASSERT_BEGIN do { acore::Abort(__FILE__, __LINE__, __FUNCTION__, (msg), ##__VA_ARGS__); } while(0) ASSERT_END #ifdef PERFORMANCE_PROFILING #define ASSERT(cond, ...) ((void)0) @@ -57,6 +60,7 @@ std::string GetDebugInfo(); #endif #define ABORT WPAbort +#define ABORT_MSG WPAbort_MSG template inline T* ASSERT_NOTNULL_IMPL(T* pointer, char const* expr) diff --git a/src/common/Define.h b/src/common/Define.h index 36fb88f2af..159f7822db 100644 --- a/src/common/Define.h +++ b/src/common/Define.h @@ -64,6 +64,45 @@ # define ATTR_DEPRECATED #endif //AC_COMPILER == AC_COMPILER_GNU +#ifdef ACORE_API_USE_DYNAMIC_LINKING +# if AC_COMPILER == AC_COMPILER_MICROSOFT +# define AC_API_EXPORT __declspec(dllexport) +# define AC_API_IMPORT __declspec(dllimport) +# elif AC_COMPILER == AC_COMPILER_GNU +# define AC_API_EXPORT __attribute__((visibility("default"))) +# define AC_API_IMPORT +# else +# error compiler not supported! +# endif +#else +# define AC_API_EXPORT +# define AC_API_IMPORT +#endif + +#ifdef ACORE_API_EXPORT_COMMON +# define AC_COMMON_API AC_API_EXPORT +#else +# define AC_COMMON_API AC_API_IMPORT +#endif + +#ifdef ACORE_API_EXPORT_DATABASE +# define AC_DATABASE_API AC_API_EXPORT +#else +# define AC_DATABASE_API AC_API_IMPORT +#endif + +#ifdef ACORE_API_EXPORT_SHARED +# define AC_SHARED_API AC_API_EXPORT +#else +# define AC_SHARED_API AC_API_IMPORT +#endif + +#ifdef ACORE_API_EXPORT_GAME +# define AC_GAME_API AC_API_EXPORT +#else +# define AC_GAME_API AC_API_IMPORT +#endif + #define UI64FMTD "%" PRIu64 #define UI64LIT(N) UINT64_C(N) diff --git a/src/common/Logging/Appender.cpp b/src/common/Logging/Appender.cpp new file mode 100644 index 0000000000..660283f853 --- /dev/null +++ b/src/common/Logging/Appender.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#include "Appender.h" +#include "LogMessage.h" +#include "StringFormat.h" +#include + +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"; + } +} diff --git a/src/common/Logging/Appender.h b/src/common/Logging/Appender.h new file mode 100644 index 0000000000..a3d5c11f21 --- /dev/null +++ b/src/common/Logging/Appender.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#ifndef APPENDER_H +#define APPENDER_H + +#include "Define.h" +#include "LogCommon.h" +#include +#include +#include + +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 diff --git a/src/common/Logging/AppenderConsole.cpp b/src/common/Logging/AppenderConsole.cpp new file mode 100644 index 0000000000..ab5f778f51 --- /dev/null +++ b/src/common/Logging/AppenderConsole.cpp @@ -0,0 +1,191 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#include "AppenderConsole.h" +#include "LogMessage.h" +#include "SmartEnum.h" +#include "StringFormat.h" +#include "StringConvert.h" +#include "Util.h" +#include "Tokenize.h" +#include + +#if AC_PLATFORM == AC_PLATFORM_WINDOWS +#include +#endif + +AppenderConsole::AppenderConsole(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector 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 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 color = acore::StringTo(colorStrs[i]); color && EnumUtils::IsValid(*color)) + _colors[i] = static_cast(*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(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()); +} diff --git a/src/common/Logging/AppenderConsole.h b/src/common/Logging/AppenderConsole.h new file mode 100644 index 0000000000..8198e2c35c --- /dev/null +++ b/src/common/Logging/AppenderConsole.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#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 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 diff --git a/src/common/Logging/AppenderFile.cpp b/src/common/Logging/AppenderFile.cpp new file mode 100644 index 0000000000..5f7bdb6349 --- /dev/null +++ b/src/common/Logging/AppenderFile.cpp @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#include "AppenderFile.h" +#include "Log.h" +#include "LogMessage.h" +#include "StringConvert.h" +#include "Util.h" +#include + +AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector 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 size = acore::StringTo(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; + } +} diff --git a/src/common/Logging/AppenderFile.h b/src/common/Logging/AppenderFile.h new file mode 100644 index 0000000000..b91b6000a8 --- /dev/null +++ b/src/common/Logging/AppenderFile.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#ifndef APPENDERFILE_H +#define APPENDERFILE_H + +#include "Appender.h" +#include + +class AppenderFile : public Appender +{ +public: + static constexpr AppenderType type = APPENDER_FILE; + + AppenderFile(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector 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 _fileSize; +}; + +#endif diff --git a/src/common/Logging/ILog.h b/src/common/Logging/ILog.h deleted file mode 100644 index 62ee0289b1..0000000000 --- a/src/common/Logging/ILog.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2016+ AzerothCore , 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 diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index 73cdfa7168..00d6418c3b 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -1,1021 +1,363 @@ /* - * Copyright (C) 2016+ AzerothCore , 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 - * Copyright (C) 2005-2009 MaNGOS + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore */ -#include "Common.h" #include "Log.h" -#include "WorldPacket.h" -#include "Configuration/Config.h" +#include "AppenderConsole.h" +#include "AppenderFile.h" +#include "Common.h" +#include "Config.h" +#include "Errors.h" +#include "Logger.h" +#include "LogMessage.h" +#include "LogOperation.h" +#include "StringConvert.h" #include "Util.h" +#include "Tokenize.h" +#include +#include -#include "Implementation/LoginDatabase.h" // For logging - -extern LoginDatabaseWorkerPool LoginDatabase; - -#include -#include - -Log::Log() : - raLogfile(nullptr), logfile(nullptr), gmLogfile(nullptr), charLogfile(nullptr), - dberLogfile(nullptr), chatLogfile(nullptr), sqlLogFile(nullptr), sqlDevLogFile(nullptr), miscLogFile(nullptr), - m_gmlog_per_account(false), m_enableLogDB(false), m_colored(false) +Log::Log() : AppenderId(0), highestLogLevel(LOG_LEVEL_FATAL) { - Initialize(); + m_logsTimestamp = "_" + GetTimestampStr(); + RegisterAppender(); + RegisterAppender(); } Log::~Log() { - if (logfile != nullptr) - fclose(logfile); - logfile = nullptr; - - if (gmLogfile != nullptr) - fclose(gmLogfile); - gmLogfile = nullptr; - - if (charLogfile != nullptr) - fclose(charLogfile); - charLogfile = nullptr; - - if (dberLogfile != nullptr) - fclose(dberLogfile); - dberLogfile = nullptr; - - if (raLogfile != nullptr) - fclose(raLogfile); - raLogfile = nullptr; - - if (chatLogfile != nullptr) - fclose(chatLogfile); - chatLogfile = nullptr; - - if (sqlLogFile != nullptr) - fclose(sqlLogFile); - sqlLogFile = nullptr; - - if (sqlDevLogFile != nullptr) - fclose(sqlDevLogFile); - sqlDevLogFile = nullptr; - - if (miscLogFile != nullptr) - fclose(miscLogFile); - miscLogFile = nullptr; + Close(); } -std::unique_ptr& getLogInstance() +uint8 Log::NextAppenderId() { - static std::unique_ptr instance = std::make_unique(); - return instance; + return AppenderId++; } -void Log::SetLogLevel(char* Level) +Appender* Log::GetAppenderByName(std::string_view name) { - int32 NewLevel = atoi((char*)Level); - if (NewLevel < 0) - NewLevel = 0; - m_logLevel = NewLevel; + auto it = appenders.begin(); + while (it != appenders.end() && it->second && it->second->getName() != name) + ++it; - outString("LogLevel is %u", m_logLevel); + return it == appenders.end() ? nullptr : it->second.get(); } -void Log::SetLogFileLevel(char* Level) +void Log::CreateAppenderFromConfig(std::string const& appenderName) { - int32 NewLevel = atoi((char*)Level); - if (NewLevel < 0) - NewLevel = 0; - m_logFileLevel = NewLevel; + if (appenderName.empty()) + return; - outString("LogFileLevel is %u", m_logFileLevel); -} + // Format = type, level, flags, optional1, optional2 + // if type = File. optional1 = file and option2 = mode + // if type = Console. optional1 = Color + std::string options = sConfigMgr->GetStringDefault(appenderName, ""); -void Log::Initialize() -{ - /// Check whether we'll log GM commands/RA events/character outputs/chat stuffs - m_dbChar = sConfigMgr->GetOption("LogDB.Char", false, false); - m_dbRA = sConfigMgr->GetOption("LogDB.RA", false, false); - m_dbGM = sConfigMgr->GetOption("LogDB.GM", false, false); - m_dbChat = sConfigMgr->GetOption("LogDB.Chat", false, false); + std::vector tokens = acore::Tokenize(options, ',', true); - /// Realm must be 0 by default - SetRealmID(0); + size_t const size = tokens.size(); + std::string name = appenderName.substr(9); - /// Common log files data - m_logsDir = sConfigMgr->GetOption("LogsDir", "", false); - if (!m_logsDir.empty()) - if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) - m_logsDir.push_back('/'); - - m_logsTimestamp = "_" + GetTimestampStr(); - - /// Open specific log files - logfile = openLogFile("LogFile", "LogTimestamp", "w"); - InitColors(sConfigMgr->GetOption("LogColors", "", false)); - - m_gmlog_per_account = sConfigMgr->GetOption("GmLogPerAccount", false, false); - if (!m_gmlog_per_account) - gmLogfile = openLogFile("GmLogFile", "GmLogTimestamp", "a"); - else + if (size < 2) { - // GM log settings for per account case - m_gmlog_filename_format = sConfigMgr->GetOption("GmLogFile", "", false); - if (!m_gmlog_filename_format.empty()) - { - bool m_gmlog_timestamp = sConfigMgr->GetOption("GmLogTimestamp", false, false); - - size_t dot_pos = m_gmlog_filename_format.find_last_of('.'); - if (dot_pos != m_gmlog_filename_format.npos) - { - if (m_gmlog_timestamp) - m_gmlog_filename_format.insert(dot_pos, m_logsTimestamp); - - m_gmlog_filename_format.insert(dot_pos, "_#%u"); - } - else - { - m_gmlog_filename_format += "_#%u"; - - if (m_gmlog_timestamp) - m_gmlog_filename_format += m_logsTimestamp; - } - - m_gmlog_filename_format = m_logsDir + m_gmlog_filename_format; - } - } - - charLogfile = openLogFile("CharLogFile", "CharLogTimestamp", "a"); - dberLogfile = openLogFile("DBErrorLogFile", nullptr, "a"); - raLogfile = openLogFile("RaLogFile", nullptr, "a"); - chatLogfile = openLogFile("ChatLogFile", "ChatLogTimestamp", "a"); - sqlLogFile = openLogFile("SQLDriverLogFile", nullptr, "a"); - sqlDevLogFile = openLogFile("SQLDeveloperLogFile", nullptr, "a"); - miscLogFile = fopen((m_logsDir + "Misc.log").c_str(), "a"); - - // Main log file settings - m_logLevel = sConfigMgr->GetOption("LogLevel", LOGL_NORMAL, false); - m_logFileLevel = sConfigMgr->GetOption("LogFileLevel", LOGL_NORMAL, false); - m_dbLogLevel = sConfigMgr->GetOption("DBLogLevel", LOGL_NORMAL, false); - m_sqlDriverQueryLogging = sConfigMgr->GetOption("SQLDriverQueryLogging", false, false); - - m_DebugLogMask = DebugLogFilters(sConfigMgr->GetOption("DebugLogMask", LOG_FILTER_NONE, false)); - - // Char log settings - m_charLog_Dump = sConfigMgr->GetOption("CharLogDump", false, false); - m_charLog_Dump_Separate = sConfigMgr->GetOption("CharLogDump.Separate", false, false); - if (m_charLog_Dump_Separate) - { - m_dumpsDir = sConfigMgr->GetOption("CharLogDump.SeparateDir", "", false); - if (!m_dumpsDir.empty()) - if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\')) - m_dumpsDir.push_back('/'); - } -} - -void Log::ReloadConfig() -{ - m_logLevel = sConfigMgr->GetOption("LogLevel", LOGL_NORMAL); - m_logFileLevel = sConfigMgr->GetOption("LogFileLevel", LOGL_NORMAL); - m_dbLogLevel = sConfigMgr->GetOption("DBLogLevel", LOGL_NORMAL); - - m_DebugLogMask = DebugLogFilters(sConfigMgr->GetOption("DebugLogMask", LOG_FILTER_NONE)); -} - -FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode) -{ - std::string logfn = sConfigMgr->GetOption(configFileName, "", false); - if (logfn.empty()) - return nullptr; - - if (configTimeStampFlag && sConfigMgr->GetOption(configTimeStampFlag, false, false)) - { - size_t dot_pos = logfn.find_last_of("."); - if (dot_pos != logfn.npos) - logfn.insert(dot_pos, m_logsTimestamp); - else - logfn += m_logsTimestamp; - } - - return fopen((m_logsDir + logfn).c_str(), mode); -} - -FILE* Log::openGmlogPerAccount(uint32 account) -{ - if (m_gmlog_filename_format.empty()) - return nullptr; - - char namebuf[ACORE_PATH_MAX]; - snprintf(namebuf, ACORE_PATH_MAX, m_gmlog_filename_format.c_str(), account); - return fopen(namebuf, "a"); -} - -void Log::outTimestamp(FILE* file) -{ - time_t t = time(nullptr); - tm* aTm = localtime(&t); - // YYYY year - // MM month (2 digits 01-12) - // DD day (2 digits 01-31) - // HH hour (2 digits 00-23) - // MM minutes (2 digits 00-59) - // SS seconds (2 digits 00-59) - fprintf(file, "%-4d-%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); -} - -void Log::InitColors(const std::string& str) -{ - if (str.empty()) - { - m_colored = false; + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong configuration for appender %s. Config line: %s\n", name.c_str(), options.c_str()); return; } - int color[4]; + AppenderFlags flags = APPENDER_FLAGS_NONE; + AppenderType type = AppenderType(acore::StringTo(tokens[0]).value_or(APPENDER_INVALID)); + LogLevel level = LogLevel(acore::StringTo(tokens[1]).value_or(LOG_LEVEL_INVALID)); - std::istringstream ss(str); - - for (uint8 i = 0; i < LogLevels; ++i) + auto factoryFunction = appenderFactory.find(type); + if (factoryFunction == appenderFactory.end()) { - ss >> color[i]; - - if (!ss) - return; - - if (color[i] < 0 || color[i] >= Colors) - return; + fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown type '%s' for appender %s\n", std::string(tokens[0]).c_str(), name.c_str()); + return; } - for (uint8 i = 0; i < LogLevels; ++i) - m_colors[i] = ColorTypes(color[i]); + if (level > NUM_ENABLED_LOG_LEVELS) + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Wrong Log Level '%s' for appender %s\n", std::string(tokens[1]).c_str(), name.c_str()); + return; + } - m_colored = true; + if (size > 2) + { + if (Optional flagsVal = acore::StringTo(tokens[2])) + flags = AppenderFlags(*flagsVal); + else + { + fprintf(stderr, "Log::CreateAppenderFromConfig: Unknown flags '%s' for appender %s\n", std::string(tokens[2]).c_str(), name.c_str()); + return; + } + } + + try + { + Appender* appender = factoryFunction->second(NextAppenderId(), name, level, flags, tokens); + appenders[appender->getId()].reset(appender); + } + catch (InvalidAppenderArgsException const& iaae) + { + fprintf(stderr, "%s\n", iaae.what()); + } } -void Log::SetColor(bool stdout_stream, ColorTypes color) +void Log::CreateLoggerFromConfig(std::string const& appenderName) { -#if AC_PLATFORM == AC_PLATFORM_WINDOWS - static WORD WinColorFG[Colors] = - { - 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 - }; + if (appenderName.empty()) + return; - 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 - }; + LogLevel level = LOG_LEVEL_DISABLED; - enum ANSIFgTextAttr - { - FG_BLACK = 30, FG_RED, FG_GREEN, FG_BROWN, FG_BLUE, - FG_MAGENTA, FG_CYAN, FG_WHITE, FG_YELLOW - }; + std::string options = sConfigMgr->GetStringDefault(appenderName, ""); + std::string name = appenderName.substr(7); - enum ANSIBgTextAttr + if (options.empty()) { - BG_BLACK = 40, BG_RED, BG_GREEN, BG_BROWN, BG_BLUE, - BG_MAGENTA, BG_CYAN, BG_WHITE - }; + fprintf(stderr, "Log::CreateLoggerFromConfig: Missing config option Logger.%s\n", name.c_str()); + return; + } - static uint8 UnixColorFG[Colors] = + std::vector tokens = acore::Tokenize(options, ',', true); + + if (tokens.size() != 2) { - 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(stderr, "Log::CreateLoggerFromConfig: Wrong config option Logger.%s=%s\n", name.c_str(), options.c_str()); + return; + } - fprintf((stdout_stream ? stdout : stderr), "\x1b[%d%sm", UnixColorFG[color], (color >= YELLOW && color < Colors ? ";1" : "")); -#endif + std::unique_ptr& logger = loggers[name]; + if (logger) + { + fprintf(stderr, "Error while configuring Logger %s. Already defined\n", name.c_str()); + return; + } + + level = LogLevel(acore::StringTo(tokens[0]).value_or(LOG_LEVEL_INVALID)); + if (level > NUM_ENABLED_LOG_LEVELS) + { + fprintf(stderr, "Log::CreateLoggerFromConfig: Wrong Log Level '%s' for logger %s\n", std::string(tokens[0]).c_str(), name.c_str()); + return; + } + + if (level > highestLogLevel) + highestLogLevel = level; + + logger = std::make_unique(name, level); + //fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Level %u\n", name.c_str(), level); + + for (std::string_view appenderName : acore::Tokenize(tokens[1], ' ', false)) + { + if (Appender* appender = GetAppenderByName(appenderName)) + { + logger->addAppender(appender->getId(), appender); + //fprintf(stdout, "Log::CreateLoggerFromConfig: Added Appender %s to Logger %s\n", appender->getName().c_str(), name.c_str()); + } + else + fprintf(stderr, "Error while configuring Appender %s in Logger %s. Appender does not exist\n", std::string(appenderName).c_str(), name.c_str()); + } } -void Log::ResetColor(bool stdout_stream) +void Log::ReadAppendersFromConfig() { -#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 + std::vector keys = sConfigMgr->GetKeysByString("Appender."); + for (std::string const& appenderName : keys) + CreateAppenderFromConfig(appenderName); +} + +void Log::ReadLoggersFromConfig() +{ + std::vector keys = sConfigMgr->GetKeysByString("Logger."); + for (std::string const& loggerName : keys) + CreateLoggerFromConfig(loggerName); + + // Bad config configuration, creating default config + if (loggers.find(LOGGER_ROOT) == loggers.end()) + { + fprintf(stderr, "Wrong Loggers configuration. Review your Logger config section.\n" + "Creating default loggers [root (Error), server (Info)] to console\n"); + + Close(); // Clean any Logger or Appender created + + AppenderConsole* appender = new AppenderConsole(NextAppenderId(), "Console", LOG_LEVEL_DEBUG, APPENDER_FLAGS_NONE, {}); + appenders[appender->getId()].reset(appender); + + Logger* rootLogger = new Logger(LOGGER_ROOT, LOG_LEVEL_ERROR); + rootLogger->addAppender(appender->getId(), appender); + loggers[LOGGER_ROOT].reset(rootLogger); + + Logger* serverLogger = new Logger("server", LOG_LEVEL_INFO); + serverLogger->addAppender(appender->getId(), appender); + loggers["server"].reset(serverLogger); + } +} + +void Log::RegisterAppender(uint8 index, AppenderCreatorFn appenderCreateFn) +{ + auto itr = appenderFactory.find(index); + ASSERT(itr == appenderFactory.end()); + appenderFactory[index] = appenderCreateFn; +} + +void Log::outMessage(std::string const& filter, LogLevel level, std::string&& message) +{ + write(std::make_unique(level, filter, std::move(message))); +} + +void Log::outCommand(std::string&& message, std::string&& param1) +{ + write(std::make_unique(LOG_LEVEL_INFO, "commands.gm", std::move(message), std::move(param1))); +} + +void Log::write(std::unique_ptr&& msg) const +{ + Logger const* logger = GetLoggerByType(msg->type); + + logger->write(msg.get()); +} + +Logger const* Log::GetLoggerByType(std::string const& type) const +{ + auto it = loggers.find(type); + if (it != loggers.end()) + return it->second.get(); + + if (type == LOGGER_ROOT) + return nullptr; + + std::string parentLogger = LOGGER_ROOT; + size_t found = type.find_last_of('.'); + if (found != std::string::npos) + parentLogger = type.substr(0, found); + + return GetLoggerByType(parentLogger); } std::string Log::GetTimestampStr() { - time_t t = time(nullptr); - tm aTm; - localtime_r(&t, &aTm); + time_t tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + + std::tm aTm; + localtime_r(&tt, &aTm); + // YYYY year // MM month (2 digits 01-12) // DD day (2 digits 01-31) // HH hour (2 digits 00-23) // MM minutes (2 digits 00-59) // SS seconds (2 digits 00-59) - char buf[20]; - int ret = snprintf(buf, 20, "%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); - - if (ret < 0) - { - return std::string("ERROR"); - } - - return std::string(buf); + 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); } -void Log::outDB(LogTypes type, const char* str) +bool Log::SetLogLevel(std::string const& name, int32 newLeveli, bool isLogger /* = true */) { - if (!str || std::string(str).empty() || type >= MAX_LOG_TYPES) - return; + if (newLeveli < 0) + return false; - std::string new_str(str); - LoginDatabase.EscapeString(new_str); + LogLevel newLevel = LogLevel(newLeveli); - LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, string) " - "VALUES (" UI64FMTD ", %u, %u, '%s');", uint64(time(0)), realm, (uint32)type, new_str.c_str()); -} - -void Log::outString(const char* str, ...) -{ - if (!str) - return; - - /*if (m_enableLogDB) + if (isLogger) { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_STRING, nnew_str); - va_end(ap2); - }*/ + auto it = loggers.begin(); + while (it != loggers.end() && it->second->getName() != name) + ++it; - if (m_colored) - SetColor(true, m_colors[LOGL_NORMAL]); + if (it == loggers.end()) + return false; - va_list ap; + it->second->setLogLevel(newLevel); - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf("\n"); - if (logfile) - { - outTimestamp(logfile); - va_start(ap, str); - vfprintf(logfile, str, ap); - fprintf(logfile, "\n"); - va_end(ap); - - fflush(logfile); - } - fflush(stdout); -} - -void Log::outString() -{ - printf("\n"); - if (logfile) - { - outTimestamp(logfile); - fprintf(logfile, "\n"); - fflush(logfile); - } - fflush(stdout); -} - -void Log::outCrash(const char* err, ...) -{ - if (!err) - return; - - if (m_enableLogDB) - { - va_list ap2; - va_start(ap2, err); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2); - outDB(LOG_TYPE_CRASH, nnew_str); - va_end(ap2); - } - - if (m_colored) - SetColor(false, LRED); - - va_list ap; - - va_start(ap, err); - vutf8printf(stderr, err, &ap); - va_end(ap); - - if (m_colored) - ResetColor(false); - - fprintf(stderr, "\n"); - if (logfile) - { - outTimestamp(logfile); - fprintf(logfile, "CRASH ALERT: "); - - va_start(ap, err); - vfprintf(logfile, err, ap); - va_end(ap); - - fprintf(logfile, "\n"); - fflush(logfile); - } - fflush(stderr); -} - -void Log::outError(const char* err, ...) -{ - if (!err) - return; - - if (m_enableLogDB) - { - va_list ap2; - va_start(ap2, err); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2); - outDB(LOG_TYPE_ERROR, nnew_str); - va_end(ap2); - } - - if (m_colored) - SetColor(false, LRED); - - va_list ap; - - va_start(ap, err); - vutf8printf(stderr, err, &ap); - va_end(ap); - - if (m_colored) - ResetColor(false); - - fprintf( stderr, "\n"); - if (logfile) - { - outTimestamp(logfile); - fprintf(logfile, "ERROR: "); - - va_start(ap, err); - vfprintf(logfile, err, ap); - va_end(ap); - - fprintf(logfile, "\n"); - fflush(logfile); - } - fflush(stderr); -} - -void Log::outSQLDriver(const char* str, ...) -{ - if (!str) - return; - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - printf("\n"); - - if (sqlLogFile) - { - outTimestamp(sqlLogFile); - - va_list apSQL; - va_start(apSQL, str); - vfprintf(sqlLogFile, str, apSQL); - va_end(apSQL); - - fprintf(sqlLogFile, "\n"); - fflush(sqlLogFile); - } - - fflush(stdout); -} - -void Log::outErrorDb(const char* err, ...) -{ - if (!err) - return; - - if (m_colored) - SetColor(false, LRED); - - if (m_enableLogDB) - { - va_list ap2; - va_start(ap2, err); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, err, ap2); - outDB(LOG_TYPE_ERROR, nnew_str); - va_end(ap2); - } - - va_list ap; - - va_start(ap, err); - vutf8printf(stderr, err, &ap); - va_end(ap); - - if (m_colored) - ResetColor(false); - - fprintf( stderr, "\n" ); - - if (logfile) - { - outTimestamp(logfile); - fprintf(logfile, "ERROR: " ); - - va_start(ap, err); - vfprintf(logfile, err, ap); - va_end(ap); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - - if (dberLogfile) - { - outTimestamp(dberLogfile); - va_start(ap, err); - vfprintf(dberLogfile, err, ap); - va_end(ap); - - fprintf(dberLogfile, "\n" ); - fflush(dberLogfile); - } - fflush(stderr); -} - -void Log::outBasic(const char* str, ...) -{ - if (!str) - return; - - if (m_enableLogDB && m_dbLogLevel > LOGL_NORMAL) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_BASIC, nnew_str); - va_end(ap2); - } - - if (m_logLevel > LOGL_NORMAL) - { - if (m_colored) - SetColor(true, m_colors[LOGL_BASIC]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf("\n"); - - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - fprintf(logfile, "\n" ); - va_end(ap2); - fflush(logfile); - } - } - fflush(stdout); -} - -void Log::outDetail(const char* str, ...) -{ - if (!str) - return; - - if (m_enableLogDB && m_dbLogLevel > LOGL_BASIC) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_DETAIL, nnew_str); - va_end(ap2); - } - - if (m_logLevel > LOGL_BASIC) - { - if (m_colored) - SetColor(true, m_colors[LOGL_DETAIL]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf("\n"); - - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - - fprintf(logfile, "\n"); - fflush(logfile); - } - } - - fflush(stdout); -} - -void Log::outSQLDev(const char* str, ...) -{ - if (!str) - return; - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - printf("\n"); - - if (sqlDevLogFile) - { - va_list ap2; - va_start(ap2, str); - vfprintf(sqlDevLogFile, str, ap2); - va_end(ap2); - - fprintf(sqlDevLogFile, "\n"); - fflush(sqlDevLogFile); - } - - fflush(stdout); -} - -void Log::outDebug(DebugLogFilters f, const char* str, ...) -{ - if (!(m_DebugLogMask & f)) - return; - - if (!str) - return; - - if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_DEBUG, nnew_str); - va_end(ap2); - } - - if ( m_logLevel > LOGL_DETAIL ) - { - if (m_colored) - SetColor(true, m_colors[LOGL_DEBUG]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf( "\n" ); - - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - } - fflush(stdout); -} - -void Log::outStaticDebug(const char* str, ...) -{ - if (!str) - return; - - if (m_enableLogDB && m_dbLogLevel > LOGL_DETAIL) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_DEBUG, nnew_str); - va_end(ap2); - } - - if ( m_logLevel > LOGL_DETAIL ) - { - if (m_colored) - SetColor(true, m_colors[LOGL_DEBUG]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf( "\n" ); - - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - va_end(ap2); - - fprintf(logfile, "\n" ); - fflush(logfile); - } - } - fflush(stdout); -} - -void Log::outStringInLine(const char* str, ...) -{ - if (!str) - return; - - va_list ap; - - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (logfile) - { - va_start(ap, str); - vfprintf(logfile, str, ap); - va_end(ap); - } -} - -void Log::outCommand(uint32 account, const char* str, ...) -{ - if (!str) - return; - - // TODO: support accountid - if (m_enableLogDB && m_dbGM) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_GM, nnew_str); - va_end(ap2); - } - - if (m_logLevel > LOGL_NORMAL) - { - if (m_colored) - SetColor(true, m_colors[LOGL_BASIC]); - - va_list ap; - va_start(ap, str); - vutf8printf(stdout, str, &ap); - va_end(ap); - - if (m_colored) - ResetColor(true); - - printf("\n"); - - if (logfile) - { - outTimestamp(logfile); - va_list ap2; - va_start(ap2, str); - vfprintf(logfile, str, ap2); - fprintf(logfile, "\n" ); - va_end(ap2); - fflush(logfile); - } - } - - if (m_gmlog_per_account) - { - if (FILE* per_file = openGmlogPerAccount (account)) - { - outTimestamp(per_file); - va_list ap; - va_start(ap, str); - vfprintf(per_file, str, ap); - fprintf(per_file, "\n" ); - va_end(ap); - fclose(per_file); - } - } - else if (gmLogfile) - { - outTimestamp(gmLogfile); - va_list ap; - va_start(ap, str); - vfprintf(gmLogfile, str, ap); - fprintf(gmLogfile, "\n" ); - va_end(ap); - fflush(gmLogfile); - } - - fflush(stdout); -} - -void Log::outChar(const char* str, ...) -{ - if (!str) - return; - - if (m_enableLogDB && m_dbChar) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_CHAR, nnew_str); - va_end(ap2); - } - - if (charLogfile) - { - outTimestamp(charLogfile); - va_list ap; - va_start(ap, str); - vfprintf(charLogfile, str, ap); - fprintf(charLogfile, "\n" ); - va_end(ap); - fflush(charLogfile); - } -} - -void Log::outCharDump(const char* str, uint32 account_id, uint32 guid, const char* name) -{ - FILE* file = nullptr; - if (m_charLog_Dump_Separate) - { - char fileName[29]; // Max length: name(12) + guid(11) + _.log (5) + \0 - snprintf(fileName, 29, "%d_%s.log", guid, name); - std::string sFileName(m_dumpsDir); - sFileName.append(fileName); - file = fopen((m_logsDir + sFileName).c_str(), "w"); + if (newLevel != LOG_LEVEL_DISABLED && newLevel > highestLogLevel) + highestLogLevel = newLevel; } else - file = charLogfile; - if (file) { - fprintf(file, "== START DUMP == (account: %u guid: %u name: %s )\n%s\n== END DUMP ==\n", - account_id, guid, name, str); - fflush(file); - if (m_charLog_Dump_Separate) - fclose(file); + Appender* appender = GetAppenderByName(name); + if (!appender) + return false; + + appender->setLogLevel(newLevel); } + + return true; } -void Log::outChat(const char* str, ...) +void Log::outCharDump(char const* str, uint32 accountId, uint64 guid, char const* name) { - if (!str) + if (!str || !ShouldLog("entities.player.dump", LOG_LEVEL_INFO)) return; - if (m_enableLogDB && m_dbChat) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_CHAT, nnew_str); - va_end(ap2); - } + std::ostringstream ss; + ss << "== START DUMP == (account: " << accountId << " guid: " << guid << " name: " << name + << ")\n" << str << "\n== END DUMP ==\n"; - if (chatLogfile) - { - outTimestamp(chatLogfile); - va_list ap; - va_start(ap, str); - vfprintf(chatLogfile, str, ap); - fprintf(chatLogfile, "\n"); - fflush(chatLogfile); - va_end(ap); - } + std::unique_ptr msg(new LogMessage(LOG_LEVEL_INFO, "entities.player.dump", ss.str())); + std::ostringstream param; + param << guid << '_' << name; + + msg->param1 = param.str(); + + write(std::move(msg)); } -void Log::outRemote(const char* str, ...) +void Log::SetRealmId(uint32 id) { - if (!str) - return; - - if (m_enableLogDB && m_dbRA) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_RA, nnew_str); - va_end(ap2); - } - - if (raLogfile) - { - outTimestamp(raLogfile); - va_list ap; - va_start(ap, str); - vfprintf(raLogfile, str, ap); - fprintf(raLogfile, "\n" ); - va_end(ap); - fflush(raLogfile); - } + for (std::pair>& appender : appenders) + appender.second->setRealmId(id); } -void Log::outMisc(const char* str, ...) +void Log::Close() { - if (!str) - return; - - if (m_enableLogDB) - { - va_list ap2; - va_start(ap2, str); - char nnew_str[MAX_QUERY_LEN]; - vsnprintf(nnew_str, MAX_QUERY_LEN, str, ap2); - outDB(LOG_TYPE_PERF, nnew_str); - va_end(ap2); - } - - if (miscLogFile) - { - outTimestamp(miscLogFile); - va_list ap; - va_start(ap, str); - vfprintf(miscLogFile, str, ap); - fprintf(miscLogFile, "\n" ); - fflush(miscLogFile); - va_end(ap); - } + loggers.clear(); + appenders.clear(); +} + +bool Log::ShouldLog(std::string const& type, LogLevel level) const +{ + // TODO: Use cache to store "Type.sub1.sub2": "Type" equivalence, should + // Speed up in cases where requesting "Type.sub1.sub2" but only configured + // Logger "Type" + + // Don't even look for a logger if the LogLevel is higher than the highest log levels across all loggers + if (level > highestLogLevel) + return false; + + Logger const* logger = GetLoggerByType(type); + if (!logger) + return false; + + LogLevel logLevel = logger->getLogLevel(); + return logLevel != LOG_LEVEL_DISABLED && logLevel >= level; +} + +Log* Log::instance() +{ + static Log instance; + return &instance; +} + +void Log::Initialize() +{ + LoadFromConfig(); +} + +void Log::LoadFromConfig() +{ + Close(); + + highestLogLevel = LOG_LEVEL_FATAL; + AppenderId = 0; + m_logsDir = sConfigMgr->GetOption("LogsDir", "", false); + + if (!m_logsDir.empty()) + if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\')) + m_logsDir.push_back('/'); + + ReadAppendersFromConfig(); + ReadLoggersFromConfig(); + + _debugLogMask = DebugLogFilters(sConfigMgr->GetOption("DebugLogMask", LOG_FILTER_NONE, false)); } diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index cc4f8c12b4..f75069ca6c 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -1,120 +1,256 @@ /* - * Copyright (C) 2016+ AzerothCore , 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 - * Copyright (C) 2005-2009 MaNGOS + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore */ -#ifndef AZEROTHCORE_LOG_H -#define AZEROTHCORE_LOG_H +#ifndef _LOG_H__ +#define _LOG_H__ -#include "Common.h" -#include "ILog.h" -#include +#include "Define.h" +#include "LogCommon.h" +#include "StringFormat.h" -class Log : public ILog +#include +#include +#include + +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 const& extraArgs); + +template +Appender* CreateAppender(uint8 id, std::string const& name, LogLevel level, AppenderFlags flags, std::vector const& extraArgs) { + return new AppenderImpl(id, name, level, flags, extraArgs); +} + +class Log +{ +typedef std::unordered_map 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 + inline void outMessage(std::string const& filter, LogLevel const level, Format&& fmt, Args&&... args) + { + outMessage(filter, level, acore::StringFormat(std::forward(fmt), std::forward(args)...)); + } - void InitColors(const std::string& init_str); - void SetColor(bool stdout_stream, ColorTypes color); - void ResetColor(bool stdout_stream); + template + 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(fmt), std::forward(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 + void RegisterAppender() + { + RegisterAppender(AppenderImpl::type, &CreateAppender); + } + + std::string const& GetLogsDir() const { return m_logsDir; } + std::string const& GetLogsTimestamp() const { return m_logsTimestamp; } + + // Deprecated functions + template + inline void outString(Format&& fmt, Args&& ... args) + { + outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward(fmt), std::forward(args)...)); + } + + inline void outString() + { + outMessage("server", LOG_LEVEL_INFO, " "); + } + + template + inline void outError(Format&& fmt, Args&& ... args) + { + outMessage("server", LOG_LEVEL_ERROR, acore::StringFormat(std::forward(fmt), std::forward(args)...)); + } + + template + void outErrorDb(Format&& fmt, Args&& ... args) + { + if (!ShouldLog("sql.sql", LOG_LEVEL_ERROR)) + return; + + outMessage("sql.sql", LOG_LEVEL_ERROR, acore::StringFormat(std::forward(fmt), std::forward(args)...)); + } + + template + inline void outBasic(Format&& fmt, Args&& ... args) + { + outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward(fmt), std::forward(args)...)); + } + + template + inline void outDetail(Format&& fmt, Args&& ... args) + { + outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward(fmt), std::forward(args)...)); + } + + template + void outSQLDev(Format&& fmt, Args&& ... args) + { + if (!ShouldLog("sql.dev", LOG_LEVEL_INFO)) + return; + + outMessage("sql.dev", LOG_LEVEL_INFO, acore::StringFormat(std::forward(fmt), std::forward(args)...)); + } + + template + void outSQLDriver(Format&& fmt, Args&& ... args) + { + if (!ShouldLog("sql.driver", LOG_LEVEL_INFO)) + return; + + outMessage("sql.driver", LOG_LEVEL_INFO, acore::StringFormat(std::forward(fmt), std::forward(args)...)); + } + + template + inline void outMisc(Format&& fmt, Args&& ... args) + { + outMessage("server", LOG_LEVEL_INFO, acore::StringFormat(std::forward(fmt), std::forward(args)...)); + } + + template + 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(fmt), std::forward(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&& 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 appenderFactory; + std::unordered_map> appenders; + std::unordered_map> 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& 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__ diff --git a/src/common/Logging/LogCommon.h b/src/common/Logging/LogCommon.h new file mode 100644 index 0000000000..ca9d6f59e1 --- /dev/null +++ b/src/common/Logging/LogCommon.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#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__ diff --git a/src/common/Logging/LogMessage.cpp b/src/common/Logging/LogMessage.cpp new file mode 100644 index 0000000000..ef5175d55b --- /dev/null +++ b/src/common/Logging/LogMessage.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#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(_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(_text)), param1(std::forward(_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); +} diff --git a/src/common/Logging/LogMessage.h b/src/common/Logging/LogMessage.h new file mode 100644 index 0000000000..f342b1b5ba --- /dev/null +++ b/src/common/Logging/LogMessage.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#ifndef LogMessage_h__ +#define LogMessage_h__ + +#include "Define.h" +#include "LogCommon.h" +#include +#include + +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(prefix.size() + text.size()); + } +}; + +#endif // LogMessage_h__ diff --git a/src/common/Logging/LogOperation.cpp b/src/common/Logging/LogOperation.cpp new file mode 100644 index 0000000000..22c16327a6 --- /dev/null +++ b/src/common/Logging/LogOperation.cpp @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#include "LogOperation.h" +#include "Logger.h" +#include "LogMessage.h" + +LogOperation::LogOperation(Logger const* _logger, std::unique_ptr&& _msg) : logger(_logger), msg(std::forward>(_msg)) +{ +} + +LogOperation::~LogOperation() +{ +} + +int LogOperation::call() +{ + logger->write(msg.get()); + return 0; +} diff --git a/src/common/Logging/LogOperation.h b/src/common/Logging/LogOperation.h new file mode 100644 index 0000000000..4e90e7e4d0 --- /dev/null +++ b/src/common/Logging/LogOperation.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#ifndef LOGOPERATION_H +#define LOGOPERATION_H + +#include "Define.h" +#include + +class Logger; +struct LogMessage; + +class LogOperation +{ +public: + LogOperation(Logger const* _logger, std::unique_ptr&& _msg); + + ~LogOperation(); + + int call(); + +protected: + Logger const* logger; + std::unique_ptr msg; +}; + +#endif diff --git a/src/common/Logging/Logger.cpp b/src/common/Logging/Logger.cpp new file mode 100644 index 0000000000..c70431c5e7 --- /dev/null +++ b/src/common/Logging/Logger.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#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 const& appender : appenders) + if (appender.second) + appender.second->write(message); +} diff --git a/src/common/Logging/Logger.h b/src/common/Logging/Logger.h new file mode 100644 index 0000000000..f301036c9b --- /dev/null +++ b/src/common/Logging/Logger.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#ifndef LOGGER_H +#define LOGGER_H + +#include "Define.h" +#include "LogCommon.h" +#include +#include + +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 appenders; +}; + +#endif diff --git a/src/common/Logging/enuminfo_AppenderConsole.cpp b/src/common/Logging/enuminfo_AppenderConsole.cpp new file mode 100644 index 0000000000..b986736350 --- /dev/null +++ b/src/common/Logging/enuminfo_AppenderConsole.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2021+ WarheadCore + * Copyright (C) 2008-2021 TrinityCore + */ + +#include "AppenderConsole.h" +#include "Define.h" +#include "SmartEnum.h" +#include + +namespace acore::Impl::EnumUtilsImpl +{ + +/********************************************************************\ +|* data for enum 'ColorTypes' in 'AppenderConsole.h' auto-generated *| +\********************************************************************/ +template <> +EnumText EnumUtils::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::Count() { return 15; } + +template <> +ColorTypes EnumUtils::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::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"); + } +} +} diff --git a/src/common/Logging/enuminfo_LogCommon.cpp b/src/common/Logging/enuminfo_LogCommon.cpp new file mode 100644 index 0000000000..4d0f18cc6b --- /dev/null +++ b/src/common/Logging/enuminfo_LogCommon.cpp @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2021+ WarheadCore + * Copyright (C) 2008-2021 TrinityCore + */ + +#include "LogCommon.h" +#include "Define.h" +#include "SmartEnum.h" +#include + +namespace acore::Impl::EnumUtilsImpl +{ + +/************************************************************\ +|* data for enum 'LogLevel' in 'LogCommon.h' auto-generated *| +\************************************************************/ +template <> +EnumText EnumUtils::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::Count() { return 7; } + +template <> +LogLevel EnumUtils::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::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::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::Count() { return 4; } + +template <> +AppenderType EnumUtils::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::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"); + } +} +} diff --git a/src/common/Packets/ByteBuffer.cpp b/src/common/Packets/ByteBuffer.cpp index 78ad17fc60..455f00a7aa 100644 --- a/src/common/Packets/ByteBuffer.cpp +++ b/src/common/Packets/ByteBuffer.cpp @@ -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()); } diff --git a/src/common/Packets/WorldPacket.h b/src/common/Packets/WorldPacket.h index 650fc14c22..0b35ca57ea 100644 --- a/src/common/Packets/WorldPacket.h +++ b/src/common/Packets/WorldPacket.h @@ -9,6 +9,7 @@ #include "Common.h" #include "ByteBuffer.h" +#include "Duration.h" class WorldPacket : public ByteBuffer { @@ -18,6 +19,11 @@ public: { } explicit WorldPacket(uint16 opcode, size_t res = 200) : ByteBuffer(res), m_opcode(opcode) { } + + WorldPacket(WorldPacket&& packet, TimePoint receivedTime) : ByteBuffer(std::move(packet)), m_opcode(packet.m_opcode), m_receivedTime(receivedTime) + { + } + // copy constructor WorldPacket(const WorldPacket& packet) : ByteBuffer(packet), m_opcode(packet.m_opcode) { @@ -39,7 +45,10 @@ public: [[nodiscard]] uint16 GetOpcode() const { return m_opcode; } void SetOpcode(uint16 opcode) { m_opcode = opcode; } + [[nodiscard]] TimePoint GetReceivedTime() const { return m_receivedTime; } + protected: uint16 m_opcode{0}; + TimePoint m_receivedTime; // only set for a specific set of opcodes, for performance reasons. }; #endif diff --git a/src/common/Platform/ServiceWin32.cpp b/src/common/Platform/ServiceWin32.cpp index 7605901a63..138ddae7c0 100644 --- a/src/common/Platform/ServiceWin32.cpp +++ b/src/common/Platform/ServiceWin32.cpp @@ -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; diff --git a/src/common/Threading/LockedQueue.h b/src/common/Threading/LockedQueue.h index 247f68bf5e..debdf4f1f8 100644 --- a/src/common/Threading/LockedQueue.h +++ b/src/common/Threading/LockedQueue.h @@ -7,137 +7,134 @@ #ifndef LOCKEDQUEUE_H #define LOCKEDQUEUE_H -#include "Debugging/Errors.h" -#include -#include -#include #include +#include -namespace ACE_Based +template > +class LockedQueue { - template > - class LockedQueue + //! Lock access to the queue. + std::mutex _lock; + + //! Storage backing the queue. + StorageType _queue; + + //! Cancellation flag. + volatile bool _canceled; + +public: + + //! Create a LockedQueue. + LockedQueue() + : _canceled(false) { - //! Lock access to the queue. - LockType _lock; + } - //! Storage backing the queue. - StorageType _queue; + //! Destroy a LockedQueue. + virtual ~LockedQueue() + { + } - //! Cancellation flag. - volatile bool _canceled{false}; + //! Adds an item to the queue. + void add(const T& item) + { + lock(); - public: - //! Create a LockedQueue. - LockedQueue() + _queue.push_back(item); - { - } + unlock(); + } - //! Destroy a LockedQueue. - virtual ~LockedQueue() = default; + //! Adds items back to front of the queue + template + void readd(Iterator begin, Iterator end) + { + std::lock_guard lock(_lock); + _queue.insert(_queue.begin(), begin, end); + } - //! Adds an item to the queue. - void add(const T& item) - { - lock(); + //! Gets the next result in the queue, if any. + bool next(T& result) + { + std::lock_guard lock(_lock); - //ASSERT(!this->_canceled); - // throw Cancellation_Exception(); + if (_queue.empty()) + return false; - _queue.push_back(item); + result = _queue.front(); + _queue.pop_front(); + return true; + } + + template + bool next(T& result, Checker& check) + { + std::lock_guard lock(_lock); + + if (_queue.empty()) + return false; + + result = _queue.front(); + if (!check.Process(result)) + return false; + + _queue.pop_front(); + return true; + } + + //! Peeks at the top of the queue. Check if the queue is empty before calling! Remember to unlock after use if autoUnlock == false. + T& peek(bool autoUnlock = false) + { + lock(); + + T& result = _queue.front(); + + if (autoUnlock) unlock(); - } - //! Gets the next result in the queue, if any. - bool next(T& result) - { - // ACE_Guard g(this->_lock); - ACE_GUARD_RETURN (LockType, g, this->_lock, false); + return result; + } - if (_queue.empty()) - return false; + //! Cancels the queue. + void cancel() + { + std::lock_guard lock(_lock); - //ASSERT (!_queue.empty() || !this->_canceled); - // throw Cancellation_Exception(); - result = _queue.front(); - _queue.pop_front(); + _canceled = true; + } - return true; - } + //! Checks if the queue is cancelled. + bool cancelled() + { + std::lock_guard lock(_lock); + return _canceled; + } - template - bool next(T& result, Checker& check) - { - ACE_Guard g(this->_lock); + //! Locks the queue for access. + void lock() + { + this->_lock.lock(); + } - if (_queue.empty()) - return false; + //! Unlocks the queue. + void unlock() + { + this->_lock.unlock(); + } - result = _queue.front(); - if (!check.Process(result)) - return false; + ///! Calls pop_front of the queue + void pop_front() + { + std::lock_guard lock(_lock); + _queue.pop_front(); + } - _queue.pop_front(); - return true; - } - - //! Peeks at the top of the queue. Check if the queue is empty before calling! Remember to unlock after use if autoUnlock == false. - T& peek(bool autoUnlock = false) - { - lock(); - - T& result = _queue.front(); - - if (autoUnlock) - unlock(); - - return result; - } - - //! Cancels the queue. - void cancel() - { - lock(); - - _canceled = true; - - unlock(); - } - - //! Checks if the queue is cancelled. - bool cancelled() - { - ACE_Guard g(this->_lock); - return _canceled; - } - - //! Locks the queue for access. - void lock() - { - this->_lock.acquire(); - } - - //! Unlocks the queue. - void unlock() - { - this->_lock.release(); - } - - ///! Calls pop_front of the queue - void pop_front() - { - ACE_GUARD (LockType, g, this->_lock); - _queue.pop_front(); - } - - ///! Checks if we're empty or not with locks held - bool empty() - { - ACE_GUARD_RETURN (LockType, g, this->_lock, false); - return _queue.empty(); - } - }; -} + ///! Checks if we're empty or not with locks held + bool empty() + { + std::lock_guard lock(_lock); + return _queue.empty(); + } +}; #endif diff --git a/src/common/Utilities/CircularBuffer.h b/src/common/Utilities/CircularBuffer.h new file mode 100644 index 0000000000..dcb95940d7 --- /dev/null +++ b/src/common/Utilities/CircularBuffer.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * + * This file was based on + * https://embeddedartistry.com/blog/2017/05/17/creating-a-circular-buffer-in-c-and-c/ + * https://github.com/embeddedartistry/embedded-resources/blob/master/examples/cpp/circular_buffer.cpp + */ + +#ifndef AZEROTHCORE_CIRCULAR_BUFFER_H +#define AZEROTHCORE_CIRCULAR_BUFFER_H + +#include +#include +#include + +template +class CircularBuffer { +public: + explicit CircularBuffer(size_t size) : + buf_(std::unique_ptr(new T[size])), + max_size_(size) + { + + } + + void put(T item) + { + std::lock_guard lock(mutex_); + + buf_[head_] = item; + + if (full_) + { + tail_ = (tail_ + 1) % max_size_; + } + + head_ = (head_ + 1) % max_size_; + + full_ = head_ == tail_; + } + + bool empty() const + { + //if head and tail are equal, we are empty + return (!full_ && (head_ == tail_)); + } + + bool full() const + { + //If tail is ahead the head by 1, we are full + return full_; + } + + size_t capacity() const + { + return max_size_; + } + + size_t size() const + { + size_t size = max_size_; + + if (!full_) + { + if (head_ >= tail_) + { + size = head_ - tail_; + } + else + { + size += head_ - tail_; + } + } + + return size; + } + + // the implementation of this function is simplified by the fact that head_ will never be lower than tail_ + // when compared to the original implementation of this class + std::vector content() { + std::lock_guard lock(mutex_); + + return std::vector(buf_.get(), buf_.get() + size()); + } + + T peak_back() { + std::lock_guard lock(mutex_); + + return empty() ? T() : buf_[tail_]; + } + +private: + std::mutex mutex_; + std::unique_ptr buf_; + size_t head_ = 0; + size_t tail_ = 0; + const size_t max_size_; + bool full_ = 0; +}; +#endif diff --git a/src/common/Utilities/IteratorPair.h b/src/common/Utilities/IteratorPair.h new file mode 100644 index 0000000000..9b11f82bbf --- /dev/null +++ b/src/common/Utilities/IteratorPair.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#ifndef IteratorPair_h__ +#define IteratorPair_h__ + +#include "Define.h" +#include + +namespace acore +{ + /** + * @class IteratorPair + * + * @brief Utility class to enable range for loop syntax for multimap.equal_range uses + */ + template + class IteratorPair + { + public: + constexpr IteratorPair() : _iterators() { } + constexpr IteratorPair(iterator first, iterator second) : _iterators(first, second) { } + constexpr IteratorPair(std::pair iterators) : _iterators(iterators) { } + + constexpr iterator begin() const { return _iterators.first; } + constexpr iterator end() const { return _iterators.second; } + + private: + std::pair _iterators; + }; + + namespace Containers + { + template + inline auto MapEqualRange(M& map, typename M::key_type const& key) -> IteratorPair + { + return { map.equal_range(key) }; + } + } + //! namespace Containers +} +//! namespace acore + +#endif // IteratorPair_h__ diff --git a/src/common/Utilities/MathUtil.h b/src/common/Utilities/MathUtil.h new file mode 100644 index 0000000000..62943822a7 --- /dev/null +++ b/src/common/Utilities/MathUtil.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + */ + +#ifndef _MATH_UTIL_H +#define _MATH_UTIL_H + +#include +#include +#include +#include + +// based on https://stackoverflow.com/questions/7616511/calculate-mean-and-standard-deviation-from-a-vector-of-samples-in-c-using-boos/12405793#comment32490316_12405793 +template ()))>::type> +inline T standard_deviation(Container&& c) +{ + auto b = std::begin(c), e = std::end(c); + auto size = std::distance(b, e); + auto sum = std::accumulate(b, e, T()); + auto mean = sum / size; + + if (size == 1) + return (T) 0; + + T accum = T(); + for (const auto d : c) + accum += (d - mean) * (d - mean); + return std::sqrt(accum / (size - 1)); +} + + +template ()))>::type> +inline T mean(Container&& c) +{ + auto b = std::begin(c), e = std::end(c); + auto size = std::distance(b, e); + auto sum = std::accumulate(b, e, T()); + return sum / size; +} + +// based off https://www.geeksforgeeks.org/finding-median-of-unsorted-array-in-linear-time-using-c-stl/ +template +inline T median(std::vector a) +{ + size_t n = a.size(); + // If size of the arr[] is even + if (n % 2 == 0) { + + // Applying nth_element + // on n/2th index + std::nth_element(a.begin(), + a.begin() + n / 2, + a.end()); + + // Applying nth_element + // on (n-1)/2 th index + std::nth_element(a.begin(), + a.begin() + (n - 1) / 2, + a.end()); + + // Find the average of value at + // index N/2 and (N-1)/2 + return (T)(a[(n - 1) / 2] + + a[n / 2]) + / 2.0; + } + + // If size of the arr[] is odd + else { + + // Applying nth_element + // on n/2 + std::nth_element(a.begin(), + a.begin() + n / 2, + a.end()); + + // Value at index (N/2)th + // is the median + return (T)a[n / 2]; + } +} + +#endif diff --git a/src/common/Utilities/SmartEnum.h b/src/common/Utilities/SmartEnum.h new file mode 100644 index 0000000000..6115af9688 --- /dev/null +++ b/src/common/Utilities/SmartEnum.h @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#ifndef TRINITY_SMARTENUM_H +#define TRINITY_SMARTENUM_H + +#include "IteratorPair.h" +#include + +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 + 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 + static size_t Count() { return acore::Impl::EnumUtilsImpl::EnumUtils::Count(); } + template + static EnumText ToString(Enum value) { return acore::Impl::EnumUtilsImpl::EnumUtils::ToString(value); } + template + static Enum FromIndex(size_t index) { return acore::Impl::EnumUtilsImpl::EnumUtils::FromIndex(index); } + template + static uint32 ToIndex(Enum value) { return acore::Impl::EnumUtilsImpl::EnumUtils::ToIndex(value);} + + template + static bool IsValid(Enum value) + { + try + { + acore::Impl::EnumUtilsImpl::EnumUtils::ToIndex(value); + return true; + } catch (...) + { + return false; + } + } + + template + static bool IsValid(std::underlying_type_t value) { return IsValid(static_cast(value)); } + + template + 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()) {} + 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(_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 + static Iterator Begin() { return Iterator(0); } + + template + static Iterator End() { return Iterator(); } + + template + static acore::IteratorPair> Iterate() { return { Begin(), End() }; } + + template + static char const* ToConstant(Enum value) { return ToString(value).Constant; } + + template + static char const* ToTitle(Enum value) { return ToString(value).Title; } + + template + static char const* ToDescription(Enum value) { return ToString(value).Description; } +}; + +#endif diff --git a/src/common/Utilities/TaskScheduler.h b/src/common/Utilities/TaskScheduler.h index 6c8d8a6046..5824eace9b 100644 --- a/src/common/Utilities/TaskScheduler.h +++ b/src/common/Utilities/TaskScheduler.h @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include "Util.h" diff --git a/src/common/Utilities/Tokenize.cpp b/src/common/Utilities/Tokenize.cpp new file mode 100644 index 0000000000..96906927e0 --- /dev/null +++ b/src/common/Utilities/Tokenize.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2021+ WarheadCore + */ + +#include "Tokenize.h" + +std::vector acore::Tokenize(std::string_view str, char sep, bool keepEmpty) +{ + std::vector 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; +} diff --git a/src/common/Utilities/Tokenize.h b/src/common/Utilities/Tokenize.h new file mode 100644 index 0000000000..944d5a0116 --- /dev/null +++ b/src/common/Utilities/Tokenize.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2021+ WarheadCore + */ + +#ifndef _ACORE_TOKENIZE_H_ +#define _ACORE_TOKENIZE_H_ + +#include "Common.h" +#include + +namespace acore +{ + std::vector Tokenize(std::string_view str, char sep, bool keepEmpty); + + /* this would return string_view into temporary otherwise */ + std::vector Tokenize(std::string&&, char, bool) = delete; + std::vector Tokenize(std::string const&&, char, bool) = delete; + + /* the delete overload means we need to make this explicit */ + inline std::vector Tokenize(char const* str, char sep, bool keepEmpty) { return Tokenize(std::string_view(str ? str : ""), sep, keepEmpty); } +} + +#endif // _ACORE_TOKENIZE_H_ diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index ee9271ddd0..46ea70c654 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -22,8 +22,9 @@ set(winService ${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.h) endif() -add_subdirectory(shared) -add_subdirectory(game) add_subdirectory(authserver) +add_subdirectory(database) +add_subdirectory(game) +add_subdirectory(shared) add_subdirectory(scripts) add_subdirectory(worldserver) diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index c385c87fbe..bebe54bedb 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -12,7 +12,9 @@ * authentication server */ +#include "Banner.h" #include "Common.h" +#include "AppenderDB.h" #include "DatabaseEnv.h" #include "Config.h" #include "Log.h" @@ -47,7 +49,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 []\n" + LOG_INFO("server.authserver", "Usage: \n %s []\n" " -c config_file use config_file as configuration file\n\r", prog); } @@ -80,27 +82,22 @@ extern int main(int argc, char** argv) if (!sConfigMgr->LoadAppConfigs()) return 1; - sLog->outString("%s (authserver)", GitRevision::GetFullVersion()); - sLog->outString(" to stop.\n"); + // Init logging + sLog->RegisterAppender(); + 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)); + acore::Banner::Show("authserver", + [](char const* text) + { + LOG_INFO("server.authserver", "%s", text); + }, + []() + { + LOG_INFO("server.authserver", "> Using configuration file %s.", sConfigMgr->GetFilename().c_str()); + LOG_INFO("server.authserver", "> Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + LOG_INFO("server.authserver", "> Using ACE version: %s", ACE_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 +105,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("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 +124,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("RealmsStateUpdateDelay", 20)); if (sRealmList->size() == 0) { - sLog->outError("No valid realms specified."); + LOG_ERROR("server.authserver", "No valid realms specified."); return 1; } @@ -145,7 +138,7 @@ extern int main(int argc, char** argv) int32 rmport = sConfigMgr->GetOption("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 +148,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 +185,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 +213,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 +237,6 @@ extern int main(int argc, char** argv) uint32 numLoops = (sConfigMgr->GetOption("MaxPingTime", 30) * (MINUTE * 1000000 / 100000)); uint32 loopCounter = 0; - // possibly enable db logging; avoid massive startup spam by doing it here. - if (sConfigMgr->GetOption("EnableLogDB", false)) - { - sLog->outString("Enabling database logging..."); - sLog->SetLogDB(true); - } - // Wait for termination signal while (!stopEvent) { @@ -263,7 +249,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 +257,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 +276,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; } diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 3262ddc59c..3670972e27 100644 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -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; @@ -273,13 +273,13 @@ void AuthSocket::OnRead() std::map LastLoginAttemptTimeForIP; uint32 LastLoginAttemptCleanTime = 0; -ACE_Thread_Mutex LastLoginAttemptMutex; +std::mutex LastLoginAttemptMutex; // Logon Challenge command handler 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; @@ -289,7 +289,7 @@ bool AuthSocket::_HandleLogonChallenge() // pussywizard: logon flood protection: { - ACORE_GUARD(ACE_Thread_Mutex, LastLoginAttemptMutex); + std::lock_guard guard(LastLoginAttemptMutex); std::string ipaddr = socket().getRemoteAddress(); uint32 currTime = time(nullptr); std::map::iterator itr = LastLoginAttemptTimeForIP.find(ipaddr); @@ -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("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; } diff --git a/src/server/authserver/Server/AuthSocket.h b/src/server/authserver/Server/AuthSocket.h index 267928d0b7..cab5e49d1d 100644 --- a/src/server/authserver/Server/AuthSocket.h +++ b/src/server/authserver/Server/AuthSocket.h @@ -52,7 +52,7 @@ public: bool _HandleXferAccept(); FILE* pPatch; - ACE_Thread_Mutex patcherLock; + std::mutex patcherLock; private: RealmSocket& socket_; diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h index 892d4c6855..1dfd6b568c 100644 --- a/src/server/authserver/Server/RealmAcceptor.h +++ b/src/server/authserver/Server/RealmAcceptor.h @@ -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)); } diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 1ef4263c9b..cfb5833c9b 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -34,7 +34,7 @@ # Description: Logs directory setting. # Important: LogsDir needs to be quoted, as the string might contain space characters. # Logs directory must exists, or log file creation will be disabled. -# Example: "/home/youruser/azeroth-server/logs" +# Example: "/home/youruser/azerothcore/logs" # Default: "" - (Log files will be stored in the current path) LogsDir = "" @@ -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 + +# +################################################################################################### \ No newline at end of file diff --git a/src/server/database/CMakeLists.txt b/src/server/database/CMakeLists.txt new file mode 100644 index 0000000000..1e71108e89 --- /dev/null +++ b/src/server/database/CMakeLists.txt @@ -0,0 +1,58 @@ +# +# Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 +# + +CollectSourceFiles( + ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE_SOURCES + # Exclude + ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders) + +if(USE_COREPCH) + set(PRIVATE_PCH_HEADER PrecompiledHeaders/databasePCH.h) +endif() + +# Group sources +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + +add_library(database + ${PRIVATE_SOURCES}) + +# Do NOT add any extra include directory unless it does not create unneeded extra dependencies, +# and specially, not add any dependency to neither of these: shared, game, scripts +# This way we ensure that if either a PR does that without modifying this file, +# a compile error will be generated, either this file will be modified so it +# is detected more easily. +# While it is OK to include files from other libs as long as they don't require +# linkage (enums, defines...) it is discouraged to do so unless necessary, as it will pullute +# include_directories leading to further unnoticed dependency aditions +# Linker Depencency requirements: common +CollectIncludeDirectories( + ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC_INCLUDES + # Exclude + ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders) + +target_include_directories(database + PUBLIC + ${PUBLIC_INCLUDES} + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}) + +target_link_libraries(database + # PRIVATE + # acore-core-interface + # mysql + PUBLIC + common + mysql) + +set_target_properties(database + PROPERTIES + FOLDER + "server") + +# Generate precompiled header +if(USE_COREPCH) + add_cxx_pch(database ${PRIVATE_PCH_HEADER}) +endif() diff --git a/src/common/Database/AdhocStatement.cpp b/src/server/database/Database/AdhocStatement.cpp similarity index 100% rename from src/common/Database/AdhocStatement.cpp rename to src/server/database/Database/AdhocStatement.cpp diff --git a/src/common/Database/AdhocStatement.h b/src/server/database/Database/AdhocStatement.h similarity index 100% rename from src/common/Database/AdhocStatement.h rename to src/server/database/Database/AdhocStatement.h diff --git a/src/common/Threading/Callback.h b/src/server/database/Database/Callback.h similarity index 100% rename from src/common/Threading/Callback.h rename to src/server/database/Database/Callback.h diff --git a/src/common/Database/DatabaseEnv.cpp b/src/server/database/Database/DatabaseEnv.cpp similarity index 100% rename from src/common/Database/DatabaseEnv.cpp rename to src/server/database/Database/DatabaseEnv.cpp diff --git a/src/common/Database/DatabaseEnv.h b/src/server/database/Database/DatabaseEnv.h similarity index 100% rename from src/common/Database/DatabaseEnv.h rename to src/server/database/Database/DatabaseEnv.h diff --git a/src/common/Database/DatabaseLoader.cpp b/src/server/database/Database/DatabaseLoader.cpp similarity index 84% rename from src/common/Database/DatabaseLoader.cpp rename to src/server/database/Database/DatabaseLoader.cpp index ef712dcca8..300ad292f4 100644 --- a/src/common/Database/DatabaseLoader.cpp +++ b/src/server/database/Database/DatabaseLoader.cpp @@ -19,14 +19,14 @@ DatabaseLoader& DatabaseLoader::AddDatabase(DatabaseWorkerPool& pool, std::st std::string const dbString = sConfigMgr->GetOption(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(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& pool, std::st auto sleepThread = [&]() { - sLog->outSQLDriver("> Retrying after %u seconds", durationSecs.count()); + LOG_INFO("sql.driver", "> Retrying after %u seconds", static_cast(durationSecs.count())); std::this_thread::sleep_for(durationSecs); }; @@ -72,7 +72,7 @@ DatabaseLoader& DatabaseLoader::AddDatabase(DatabaseWorkerPool& 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& 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; } diff --git a/src/common/Database/DatabaseLoader.h b/src/server/database/Database/DatabaseLoader.h similarity index 100% rename from src/common/Database/DatabaseLoader.h rename to src/server/database/Database/DatabaseLoader.h diff --git a/src/common/Database/DatabaseWorker.cpp b/src/server/database/Database/DatabaseWorker.cpp similarity index 100% rename from src/common/Database/DatabaseWorker.cpp rename to src/server/database/Database/DatabaseWorker.cpp diff --git a/src/common/Database/DatabaseWorker.h b/src/server/database/Database/DatabaseWorker.h similarity index 100% rename from src/common/Database/DatabaseWorker.h rename to src/server/database/Database/DatabaseWorker.h diff --git a/src/common/Database/DatabaseWorkerPool.cpp b/src/server/database/Database/DatabaseWorkerPool.cpp similarity index 90% rename from src/common/Database/DatabaseWorkerPool.cpp rename to src/server/database/Database/DatabaseWorkerPool.cpp index 1b5add5469..9c4f20c386 100644 --- a/src/common/Database/DatabaseWorkerPool.cpp +++ b/src/server/database/Database/DatabaseWorkerPool.cpp @@ -38,8 +38,8 @@ uint32 DatabaseWorkerPool::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::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 void DatabaseWorkerPool::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::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::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 @@ -125,7 +127,7 @@ uint32 DatabaseWorkerPool::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::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; diff --git a/src/common/Database/DatabaseWorkerPool.h b/src/server/database/Database/DatabaseWorkerPool.h similarity index 99% rename from src/common/Database/DatabaseWorkerPool.h rename to src/server/database/Database/DatabaseWorkerPool.h index f6290c9c05..81728828f1 100644 --- a/src/common/Database/DatabaseWorkerPool.h +++ b/src/server/database/Database/DatabaseWorkerPool.h @@ -18,7 +18,7 @@ #include "QueryHolder.h" #include "AdhocStatement.h" #include "StringFormat.h" -#include +#include class PingOperation : public SQLOperation { diff --git a/src/common/Database/Field.cpp b/src/server/database/Database/Field.cpp similarity index 100% rename from src/common/Database/Field.cpp rename to src/server/database/Database/Field.cpp diff --git a/src/common/Database/Field.h b/src/server/database/Database/Field.h similarity index 86% rename from src/common/Database/Field.h rename to src/server/database/Database/Field.h index f24e448a15..e4055652b9 100644 --- a/src/common/Database/Field.h +++ b/src/server/database/Database/Field.h @@ -9,9 +9,8 @@ #include "Common.h" #include "Log.h" - -#include #include +#include class Field { @@ -32,7 +31,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 +49,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 +74,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 +92,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 +110,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 +128,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 +146,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 +164,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 +182,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 +200,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 +218,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 +330,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; } } diff --git a/src/common/Database/Implementation/CharacterDatabase.cpp b/src/server/database/Database/Implementation/CharacterDatabase.cpp similarity index 100% rename from src/common/Database/Implementation/CharacterDatabase.cpp rename to src/server/database/Database/Implementation/CharacterDatabase.cpp diff --git a/src/common/Database/Implementation/CharacterDatabase.h b/src/server/database/Database/Implementation/CharacterDatabase.h similarity index 100% rename from src/common/Database/Implementation/CharacterDatabase.h rename to src/server/database/Database/Implementation/CharacterDatabase.h diff --git a/src/common/Database/Implementation/LoginDatabase.cpp b/src/server/database/Database/Implementation/LoginDatabase.cpp similarity index 98% rename from src/common/Database/Implementation/LoginDatabase.cpp rename to src/server/database/Database/Implementation/LoginDatabase.cpp index 8d5c1b252b..cac4680b21 100644 --- a/src/common/Database/Implementation/LoginDatabase.cpp +++ b/src/server/database/Database/Implementation/LoginDatabase.cpp @@ -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); } diff --git a/src/common/Database/Implementation/LoginDatabase.h b/src/server/database/Database/Implementation/LoginDatabase.h similarity index 99% rename from src/common/Database/Implementation/LoginDatabase.h rename to src/server/database/Database/Implementation/LoginDatabase.h index 85fe56af17..6f1cc61c2d 100644 --- a/src/common/Database/Implementation/LoginDatabase.h +++ b/src/server/database/Database/Implementation/LoginDatabase.h @@ -111,6 +111,8 @@ enum LoginDatabaseStatements LOGIN_SEL_ACCOUNT_MUTE_INFO, LOGIN_DEL_ACCOUNT_MUTED, + LOGIN_INS_LOG, + MAX_LOGINDATABASE_STATEMENTS }; diff --git a/src/common/Database/Implementation/WorldDatabase.cpp b/src/server/database/Database/Implementation/WorldDatabase.cpp similarity index 100% rename from src/common/Database/Implementation/WorldDatabase.cpp rename to src/server/database/Database/Implementation/WorldDatabase.cpp diff --git a/src/common/Database/Implementation/WorldDatabase.h b/src/server/database/Database/Implementation/WorldDatabase.h similarity index 100% rename from src/common/Database/Implementation/WorldDatabase.h rename to src/server/database/Database/Implementation/WorldDatabase.h diff --git a/src/common/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp similarity index 76% rename from src/common/Database/MySQLConnection.cpp rename to src/server/database/Database/MySQLConnection.cpp index 06e9fe351c..557548dedf 100644 --- a/src/common/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -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(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; } } diff --git a/src/common/Database/MySQLConnection.h b/src/server/database/Database/MySQLConnection.h similarity index 97% rename from src/common/Database/MySQLConnection.h rename to src/server/database/Database/MySQLConnection.h index b90be5bad0..dfc855d320 100644 --- a/src/common/Database/MySQLConnection.h +++ b/src/server/database/Database/MySQLConnection.h @@ -90,13 +90,13 @@ protected: { /// Tries to acquire lock. If lock is acquired by another thread /// the calling parent will just try another connection - return m_Mutex.tryacquire() != -1; + return m_Mutex.try_lock(); } void Unlock() { /// Called by parent databasepool. Will let other threads access this connection - m_Mutex.release(); + m_Mutex.unlock(); } MYSQL* GetHandle() { return m_Mysql; } @@ -120,7 +120,7 @@ private: MYSQL* m_Mysql; //! MySQL Handle. MySQLConnectionInfo& m_connectionInfo; //! Connection info (used for logging) ConnectionFlags m_connectionFlags; //! Connection flags (for preparing relevant statements) - ACE_Thread_Mutex m_Mutex; + std::mutex m_Mutex; MySQLConnection(MySQLConnection const& right) = delete; MySQLConnection& operator=(MySQLConnection const& right) = delete; diff --git a/src/common/Database/MySQLThreading.h b/src/server/database/Database/MySQLThreading.h similarity index 100% rename from src/common/Database/MySQLThreading.h rename to src/server/database/Database/MySQLThreading.h diff --git a/src/common/Database/PreparedStatement.cpp b/src/server/database/Database/PreparedStatement.cpp similarity index 96% rename from src/common/Database/PreparedStatement.cpp rename to src/server/database/Database/PreparedStatement.cpp index 05c0737017..437799ffb9 100644 --- a/src/common/Database/PreparedStatement.cpp +++ b/src/server/database/Database/PreparedStatement.cpp @@ -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; } diff --git a/src/common/Database/PreparedStatement.h b/src/server/database/Database/PreparedStatement.h similarity index 100% rename from src/common/Database/PreparedStatement.h rename to src/server/database/Database/PreparedStatement.h diff --git a/src/common/Database/QueryHolder.cpp b/src/server/database/Database/QueryHolder.cpp similarity index 91% rename from src/common/Database/QueryHolder.cpp rename to src/server/database/Database/QueryHolder.cpp index bcb19bf3ec..5aee000315 100644 --- a/src/common/Database/QueryHolder.cpp +++ b/src/server/database/Database/QueryHolder.cpp @@ -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; } diff --git a/src/common/Database/QueryHolder.h b/src/server/database/Database/QueryHolder.h similarity index 100% rename from src/common/Database/QueryHolder.h rename to src/server/database/Database/QueryHolder.h diff --git a/src/common/Database/QueryResult.cpp b/src/server/database/Database/QueryResult.cpp similarity index 95% rename from src/common/Database/QueryResult.cpp rename to src/server/database/Database/QueryResult.cpp index 6b3a5081fb..617d137faa 100644 --- a/src/common/Database/QueryResult.cpp +++ b/src/server/database/Database/QueryResult.cpp @@ -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; diff --git a/src/common/Database/QueryResult.h b/src/server/database/Database/QueryResult.h similarity index 98% rename from src/common/Database/QueryResult.h rename to src/server/database/Database/QueryResult.h index 420bce2c15..fedc0a073a 100644 --- a/src/common/Database/QueryResult.h +++ b/src/server/database/Database/QueryResult.h @@ -7,10 +7,9 @@ #ifndef QUERYRESULT_H #define QUERYRESULT_H -#include - #include "Errors.h" #include "Field.h" +#include #ifdef _WIN32 #include diff --git a/src/common/Database/SQLOperation.h b/src/server/database/Database/SQLOperation.h similarity index 100% rename from src/common/Database/SQLOperation.h rename to src/server/database/Database/SQLOperation.h diff --git a/src/common/Database/Transaction.cpp b/src/server/database/Database/Transaction.cpp similarity index 100% rename from src/common/Database/Transaction.cpp rename to src/server/database/Database/Transaction.cpp diff --git a/src/common/Database/Transaction.h b/src/server/database/Database/Transaction.h similarity index 100% rename from src/common/Database/Transaction.h rename to src/server/database/Database/Transaction.h diff --git a/src/server/database/Logging/AppenderDB.cpp b/src/server/database/Logging/AppenderDB.cpp new file mode 100644 index 0000000000..296792897a --- /dev/null +++ b/src/server/database/Logging/AppenderDB.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#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 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; +} diff --git a/src/server/database/Logging/AppenderDB.h b/src/server/database/Logging/AppenderDB.h new file mode 100644 index 0000000000..9cf150161c --- /dev/null +++ b/src/server/database/Logging/AppenderDB.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + * Copyright (C) 2008-2021 TrinityCore + */ + +#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 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 diff --git a/src/server/database/PrecompiledHeaders/databasePCH.h b/src/server/database/PrecompiledHeaders/databasePCH.h new file mode 100644 index 0000000000..34a41616af --- /dev/null +++ b/src/server/database/PrecompiledHeaders/databasePCH.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 + */ + +#include "Define.h" +// #include "DatabaseEnvFwd.h" +#include "Errors.h" +#include "Field.h" +#include "Log.h" +#include "MySQLConnection.h" +// #include "MySQLPreparedStatement.h" +// #include "MySQLWorkaround.h" +#include "PreparedStatement.h" +#include "QueryResult.h" +#include "SQLOperation.h" +#include "Transaction.h" +#include +#include +#include diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp index a04ecb72a4..5cc5c3ff65 100644 --- a/src/server/game/AI/CoreAI/CombatAI.cpp +++ b/src/server/game/AI/CoreAI/CombatAI.cpp @@ -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 } diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index 702f346cf4..bfc7f8604f 100644 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -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(); diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index c513759a7b..f10759bb43 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -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; } diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index 78c9e0d53f..49c63a5028 100644 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -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: diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 4b819dee45..1b1455c3f2 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -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 diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp index 9899131e0b..7aa5c21a1b 100644 --- a/src/server/game/AI/CreatureAISelector.cpp +++ b/src/server/game/AI/CreatureAISelector.cpp @@ -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)); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index d16c9dde6f..96e9bc6e8b 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -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) diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp index 37a0184359..6cc91503f8 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp @@ -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(); diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp index 5fb48e28a5..3f34f96bf3 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp @@ -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; } diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index c1c07984d9..1cab89e7aa 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -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; } @@ -616,7 +616,7 @@ void SmartAI::EnterEvadeMode() if (!me->IsAlive() || me->IsInEvadeMode()) return; - if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED)) { me->AttackStop(); return; @@ -783,7 +783,7 @@ void SmartAI::JustSummoned(Creature* creature) void SmartAI::AttackStart(Unit* who) { // xinef: dont allow charmed npcs to act on their own - if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED)) { if (who && mCanAutoAttack) me->Attack(who, true); @@ -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); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 12d965b825..c76d6dcc70 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -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; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index bdf0e05018..5717755911 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -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; } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index fe6eb12487..126d13df32 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -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; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index dc8cf24ac6..955cd1c34d 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -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; diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index d65587338c..9cc517d97a 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -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", " "); } diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index ac78a84e5c..1ac43a65ec 100644 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -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", " "); } } diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 4aa4d4fc7d..ae73d804ae 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -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; } diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index c3a3204a4e..33de2e98f4 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -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; diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp index b2907a98a8..ea2fcc9f81 100644 --- a/src/server/game/Battlefield/BattlefieldHandler.cpp +++ b/src/server/game/Battlefield/BattlefieldHandler.cpp @@ -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; diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp index 6d7a2a49c8..b1a4d9e2ae 100644 --- a/src/server/game/Battlefield/BattlefieldMgr.cpp +++ b/src/server/game/Battlefield/BattlefieldMgr.cpp @@ -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 } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 98be087111..959aea89b5 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -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; } diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index f07e85b174..6de29b184a 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -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: diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 09b83c3e7a..482749f159 100644 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index 770b8655e6..12f32698b2 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -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() diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 16311747f4..3d233eef70 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index f8402de489..13719e2893 100644 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -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) @@ -746,6 +746,8 @@ BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgType } sScriptMgr->OnArenaTypeIDToQueueID(bgTypeId, arenaType, queueTypeID); + + return static_cast(queueTypeID); } if (BattlegroundMgr::bgToQueue.find(bgTypeId) != BattlegroundMgr::bgToQueue.end()) @@ -846,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; } @@ -863,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; } @@ -883,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() @@ -894,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(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_BATTLEMASTER; } } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 563d42b052..27ca3d7578 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index a6c88730f7..c042ccfe37 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -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 diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index bf151dfb58..a347bf5072 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 7b0b4ce90f..2d6d17ab23 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index e995f6a07d..e7f22df2fd 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 57deab7392..cfe59ca122 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -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); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index ac16e0ff87..7fd1a1a9f8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index 8d5d89b535..78396e5b69 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 2a3e9c6ef2..3a9b479e39 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index ee9c42ef7f..f79e545e2b 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -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; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index f85a70397b..65d49d78f8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -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; } diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index ff4240f5c6..7c17697a72 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -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; } diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index 6c4a109791..c2c004d182 100644 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -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? diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index a0ef7f13b4..d0d67b62c4 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -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) diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 0e536e2c9d..75a45b4c7b 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -316,14 +316,20 @@ bool ChatHandler::ExecuteCommandInTable(std::vector 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& 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& 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; diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp index 12aacce391..ea9da2751f 100644 --- a/src/server/game/Chat/ChatLink.cpp +++ b/src/server/game/Chat/ChatLink.cpp @@ -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; } diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index fbdd0b1bb2..48220eee01 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -27,7 +27,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) if (!object) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "Condition object not found for condition (Entry: %u Type: %u Group: %u)", SourceEntry, SourceType, SourceGroup); + LOG_DEBUG("condition", "Condition object not found for condition (Entry: %u Type: %u Group: %u)", SourceEntry, SourceType, SourceGroup); #endif return false; } @@ -691,7 +691,7 @@ bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "ConditionMgr::IsPlayerMeetToConditionList condType: %u val1: %u", (*i)->ConditionType, (*i)->ConditionValue1); + LOG_DEBUG("condition", "ConditionMgr::IsPlayerMeetToConditionList condType: %u val1: %u", (*i)->ConditionType, (*i)->ConditionValue1); #endif if ((*i)->isLoaded()) { @@ -714,7 +714,7 @@ bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "IsPlayerMeetToConditionList: Reference template -%u not found", (*i)->ReferenceId); + LOG_DEBUG("condition", "IsPlayerMeetToConditionList: Reference template -%u not found", (*i)->ReferenceId); #endif } } @@ -750,7 +750,7 @@ bool ConditionMgr::IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, Con return true; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "ConditionMgr::IsObjectMeetToConditions"); + LOG_DEBUG("condition", "ConditionMgr::IsObjectMeetToConditions"); #endif return IsObjectMeetToConditionList(sourceInfo, conditions); } @@ -796,7 +796,7 @@ ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType { spellCond = (*i).second; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "GetConditionsForNotGroupedEntry: found conditions for type %u and entry %u", uint32(sourceType), entry); + LOG_DEBUG("condition", "GetConditionsForNotGroupedEntry: found conditions for type %u and entry %u", uint32(sourceType), entry); #endif } } @@ -815,7 +815,7 @@ ConditionList ConditionMgr::GetConditionsForSpellClickEvent(uint32 creatureId, u { cond = (*i).second; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "GetConditionsForSpellClickEvent: found conditions for Vehicle entry %u spell %u", creatureId, spellId); + LOG_DEBUG("condition", "GetConditionsForSpellClickEvent: found conditions for Vehicle entry %u spell %u", creatureId, spellId); #endif } } @@ -833,7 +833,7 @@ ConditionList ConditionMgr::GetConditionsForVehicleSpell(uint32 creatureId, uint { cond = (*i).second; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "GetConditionsForVehicleSpell: found conditions for Vehicle entry %u spell %u", creatureId, spellId); + LOG_DEBUG("condition", "GetConditionsForVehicleSpell: found conditions for Vehicle entry %u spell %u", creatureId, spellId); #endif } } @@ -851,7 +851,7 @@ ConditionList ConditionMgr::GetConditionsForSmartEvent(int32 entryOrGuid, uint32 { cond = (*i).second; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "GetConditionsForSmartEvent: found conditions for Smart Event entry or guid %d event_id %u", entryOrGuid, eventId); + LOG_DEBUG("condition", "GetConditionsForSmartEvent: found conditions for Smart Event entry or guid %d event_id %u", entryOrGuid, eventId); #endif } } @@ -868,7 +868,7 @@ ConditionList ConditionMgr::GetConditionsForNpcVendorEvent(uint32 creatureId, ui if (i != (*itr).second.end()) { cond = (*i).second; - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "GetConditionsForNpcVendorEvent: found conditions for creature entry %u item %u", creatureId, itemId); + LOG_DEBUG("condition", "GetConditionsForNpcVendorEvent: found conditions for creature entry %u item %u", creatureId, itemId); } } return cond; @@ -883,7 +883,7 @@ void ConditionMgr::LoadConditions(bool isReload) //must clear all custom handled cases (groupped types) before reload if (isReload) { - sLog->outString("Reseting Loot Conditions..."); + LOG_INFO("server", "Reseting Loot Conditions..."); LootTemplates_Creature.ResetConditions(); LootTemplates_Fishing.ResetConditions(); LootTemplates_Gameobject.ResetConditions(); @@ -897,10 +897,10 @@ void ConditionMgr::LoadConditions(bool isReload) LootTemplates_Prospecting.ResetConditions(); LootTemplates_Spell.ResetConditions(); - sLog->outString("Re-Loading `gossip_menu` Table for Conditions!"); + LOG_INFO("server", "Re-Loading `gossip_menu` Table for Conditions!"); sObjectMgr->LoadGossipMenu(); - sLog->outString("Re-Loading `gossip_menu_option` Table for Conditions!"); + LOG_INFO("server", "Re-Loading `gossip_menu_option` Table for Conditions!"); sObjectMgr->LoadGossipMenuItems(); sSpellMgr->UnloadSpellInfoImplicitTargetConditionLists(); } @@ -910,7 +910,7 @@ void ConditionMgr::LoadConditions(bool isReload) if (!result) { - sLog->outError(">> Loaded 0 conditions. DB table `conditions` is empty!"); + LOG_ERROR("server", ">> Loaded 0 conditions. DB table `conditions` is empty!"); return; } @@ -946,7 +946,7 @@ void ConditionMgr::LoadConditions(bool isReload) { if (iConditionTypeOrReference == iSourceTypeOrReferenceId)//self referencing, skip { - sLog->outErrorDb("Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId); + LOG_ERROR("sql.sql", "Condition reference %i is referencing self, skipped", iSourceTypeOrReferenceId); delete cond; continue; } @@ -957,19 +957,19 @@ void ConditionMgr::LoadConditions(bool isReload) rowType = "reference"; //check for useless data if (cond->ConditionTarget) - sLog->outErrorDb("Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget); + LOG_ERROR("sql.sql", "Condition %s %i has useless data in ConditionTarget (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionTarget); if (cond->ConditionValue1) - sLog->outErrorDb("Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1); + LOG_ERROR("sql.sql", "Condition %s %i has useless data in value1 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue1); if (cond->ConditionValue2) - sLog->outErrorDb("Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2); + LOG_ERROR("sql.sql", "Condition %s %i has useless data in value2 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3); + LOG_ERROR("sql.sql", "Condition %s %i has useless data in value3 (%u)!", rowType, iSourceTypeOrReferenceId, cond->ConditionValue3); if (cond->NegativeCondition) - sLog->outErrorDb("Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition); + LOG_ERROR("sql.sql", "Condition %s %i has useless data in NegativeCondition (%u)!", rowType, iSourceTypeOrReferenceId, cond->NegativeCondition); if (cond->SourceGroup && iSourceTypeOrReferenceId < 0) - sLog->outErrorDb("Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup); + LOG_ERROR("sql.sql", "Condition %s %i has useless data in SourceGroup (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceGroup); if (cond->SourceEntry && iSourceTypeOrReferenceId < 0) - sLog->outErrorDb("Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry); + LOG_ERROR("sql.sql", "Condition %s %i has useless data in SourceEntry (%u)!", rowType, iSourceTypeOrReferenceId, cond->SourceEntry); } else if (!isConditionTypeValid(cond))//doesn't have reference, validate ConditionType { @@ -1000,26 +1000,26 @@ void ConditionMgr::LoadConditions(bool isReload) //Grouping is only allowed for some types (loot templates, gossip menus, gossip items) if (cond->SourceGroup && !CanHaveSourceGroupSet(cond->SourceType)) { - sLog->outErrorDb("Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup); + LOG_ERROR("sql.sql", "Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup); delete cond; continue; } if (cond->SourceId && !CanHaveSourceIdSet(cond->SourceType)) { - sLog->outErrorDb("Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId); + LOG_ERROR("sql.sql", "Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId); delete cond; continue; } if (cond->ErrorType && cond->SourceType != CONDITION_SOURCE_TYPE_SPELL) { - sLog->outError("Condition type %u entry %i can't have ErrorType (%u), set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorType); + LOG_ERROR("server", "Condition type %u entry %i can't have ErrorType (%u), set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorType); cond->ErrorType = 0; } if (cond->ErrorTextId && !cond->ErrorType) { - sLog->outError("Condition type %u entry %i has any ErrorType, ErrorTextId (%u) is set, set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorTextId); + LOG_ERROR("server", "Condition type %u entry %i has any ErrorType, ErrorTextId (%u) is set, set to 0!", uint32(cond->SourceType), cond->SourceEntry, cond->ErrorTextId); cond->ErrorTextId = 0; } @@ -1110,7 +1110,7 @@ void ConditionMgr::LoadConditions(bool isReload) if (!valid) { - sLog->outErrorDb("Not handled grouped condition, SourceGroup %u", cond->SourceGroup); + LOG_ERROR("sql.sql", "Not handled grouped condition, SourceGroup %u", cond->SourceGroup); delete cond; } else @@ -1141,22 +1141,22 @@ void ConditionMgr::LoadConditions(bool isReload) ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } bool ConditionMgr::addToLootTemplate(Condition* cond, LootTemplate* loot) { if (!loot) { - sLog->outErrorDb("ConditionMgr: LootTemplate %u not found", cond->SourceGroup); + LOG_ERROR("sql.sql", "ConditionMgr: LootTemplate %u not found", cond->SourceGroup); return false; } if (loot->addConditionItem(cond)) return true; - sLog->outErrorDb("ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup); + LOG_ERROR("sql.sql", "ConditionMgr: Item %u not found in LootTemplate %u", cond->SourceEntry, cond->SourceGroup); return false; } @@ -1176,7 +1176,7 @@ bool ConditionMgr::addToGossipMenus(Condition* cond) } } - sLog->outErrorDb("addToGossipMenus: GossipMenu %u not found", cond->SourceGroup); + LOG_ERROR("sql.sql", "addToGossipMenus: GossipMenu %u not found", cond->SourceGroup); return false; } @@ -1195,7 +1195,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond) } } - sLog->outErrorDb("addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry); + LOG_ERROR("sql.sql", "addToGossipMenuItems: GossipMenuId %u Item %u not found", cond->SourceGroup, cond->SourceEntry); return false; } @@ -1253,7 +1253,7 @@ bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond) // we have overlapping masks in db if (conditionEffMask != *itr) { - sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - " + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - " "effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring.", cond->SourceEntry, cond->SourceGroup); return false; } @@ -1288,7 +1288,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (cond->SourceType == CONDITION_SOURCE_TYPE_NONE || cond->SourceType >= CONDITION_SOURCE_TYPE_MAX) { - sLog->outErrorDb("Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType)); + LOG_ERROR("sql.sql", "Invalid ConditionSourceType %u in `condition` table, ignoring.", uint32(cond->SourceType)); return false; } @@ -1298,14 +1298,14 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) case CONDITION_SOURCE_TYPE_PHASE: case CONDITION_SOURCE_TYPE_GRAVEYARD: { - sLog->outErrorDb("ConditionSourceType %u in `condition` table is not supported on 3.3.5a, ignoring.", uint32(cond->SourceType)); + LOG_ERROR("sql.sql", "ConditionSourceType %u in `condition` table is not supported on 3.3.5a, ignoring.", uint32(cond->SourceType)); return false; } case CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE: { if (!LootTemplates_Creature.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `creature_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1313,7 +1313,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1322,7 +1322,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Disenchant.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `disenchant_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1330,7 +1330,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1339,7 +1339,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Fishing.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `fishing_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1347,7 +1347,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1356,7 +1356,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Gameobject.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `gameobject_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1364,7 +1364,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1373,7 +1373,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Item.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `item_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1381,7 +1381,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1390,7 +1390,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Mail.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `mail_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1398,7 +1398,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1407,7 +1407,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Milling.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `milling_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1415,7 +1415,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1424,7 +1424,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Pickpocketing.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `pickpocketing_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1432,7 +1432,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1441,7 +1441,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Prospecting.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `prospecting_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1449,7 +1449,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1458,7 +1458,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Reference.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `reference_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1466,7 +1466,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1475,7 +1475,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Skinning.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `skinning_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1483,7 +1483,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1492,7 +1492,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!LootTemplates_Spell.HaveLootFor(cond->SourceGroup)) { - sLog->outErrorDb("SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceGroup %u in `condition` table, does not exist in `spell_loot_template`, ignoring.", cond->SourceGroup); return false; } @@ -1500,7 +1500,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!pItemProto && !loot->isReference(cond->SourceEntry)) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceType, cond->SourceEntry); return false; } break; @@ -1510,13 +1510,13 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cond->SourceEntry); if (!spellInfo) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } if ((cond->SourceGroup > MAX_EFFECT_MASK) || !cond->SourceGroup) { - sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup); return false; } @@ -1553,7 +1553,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) if (spellInfo->Effects[i].ChainTarget > 1) continue; - sLog->outErrorDb("SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i)); + LOG_ERROR("sql.sql", "SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i)); cond->SourceGroup &= ~(1 << i); } // all effects were removed, no need to add the condition at all @@ -1565,7 +1565,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!sObjectMgr->GetCreatureTemplate(cond->SourceEntry)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceEntry); return false; } break; @@ -1576,7 +1576,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->SourceEntry); if (!spellProto) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; @@ -1584,24 +1584,24 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) case CONDITION_SOURCE_TYPE_QUEST_AVAILABLE: if (!sObjectMgr->GetQuestTemplate(cond->SourceEntry)) { - sLog->outErrorDb("CONDITION_SOURCE_TYPE_QUEST_AVAILABLE specifies non-existing quest (%u), skipped", cond->SourceEntry); + LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_QUEST_AVAILABLE specifies non-existing quest (%u), skipped", cond->SourceEntry); return false; } break; case CONDITION_SOURCE_TYPE_UNUSED_20: - sLog->outErrorDb("CONDITION_SOURCE_TYPE_UNUSED_20 is not in use. SourceEntry = (%u), skipped", cond->SourceEntry); + LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_UNUSED_20 is not in use. SourceEntry = (%u), skipped", cond->SourceEntry); break; case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT: if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); return false; } if (!sSpellMgr->GetSpellInfo(cond->SourceEntry)) { - sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry); return false; } break; @@ -1609,13 +1609,13 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) { if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup)) { - sLog->outError("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); + LOG_ERROR("server", "SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->SourceGroup); return false; } ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(cond->SourceEntry); if (!itemTemplate) { - sLog->outError("SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceEntry); + LOG_ERROR("server", "SourceEntry %u in `condition` table, does not exist in `item_template`, ignoring.", cond->SourceEntry); return false; } break; @@ -1637,7 +1637,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) || (cond->ConditionType >= CONDITION_AC_END) ) { - sLog->outErrorDb("SourceEntry %u in `condition` table has an invalid ConditionType (%u), ignoring.", + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table has an invalid ConditionType (%u), ignoring.", cond->SourceEntry, uint32(cond->ConditionType)); return false; } @@ -1645,14 +1645,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { case CONDITION_TERRAIN_SWAP: case CONDITION_DIFFICULTY_ID: - sLog->outErrorDb("SourceEntry %u in `condition` table has a ConditionType that is not supported on 3.3.5a (%u), ignoring.", + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table has a ConditionType that is not supported on 3.3.5a (%u), ignoring.", cond->SourceEntry, uint32(cond->ConditionType)); return false; case CONDITION_STAND_STATE: case CONDITION_CHARMED: case CONDITION_PET_TYPE: case CONDITION_TAXI: - sLog->outErrorDb("SourceEntry %u in `condition` table has a ConditionType that is not yet supported on AzerothCore (%u), ignoring.", + LOG_ERROR("sql.sql", "SourceEntry %u in `condition` table has a ConditionType that is not yet supported on AzerothCore (%u), ignoring.", cond->SourceEntry, uint32(cond->ConditionType)); return false; default: @@ -1661,7 +1661,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) if (cond->ConditionTarget >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry); + LOG_ERROR("sql.sql", "SourceType %u, SourceEntry %u in `condition` table, has incorrect ConditionTarget set, ignoring.", cond->SourceType, cond->SourceEntry); return false; } @@ -1671,17 +1671,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1)) { - sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Aura condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 > EFFECT_2) { - sLog->outErrorDb("Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Aura condition has non existing effect index (%u) (must be 0..2), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("Aura condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Aura condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ITEM: @@ -1689,13 +1689,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1); if (!proto) { - sLog->outErrorDb("Item condition has non existing item (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Item condition has non existing item (%u), skipped", cond->ConditionValue1); return false; } if (!cond->ConditionValue2) { - sLog->outErrorDb("Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Item condition has 0 set for item count in value2 (%u), skipped", cond->ConditionValue2); return false; } break; @@ -1705,14 +1705,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->ConditionValue1); if (!proto) { - sLog->outErrorDb("ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "ItemEquipped condition has non existing item (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "ItemEquipped condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "ItemEquipped condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ZONEID: @@ -1720,20 +1720,20 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(cond->ConditionValue1); if (!areaEntry) { - sLog->outErrorDb("ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "ZoneID condition has non existing area (%u), skipped", cond->ConditionValue1); return false; } if (areaEntry->zone != 0) { - sLog->outErrorDb("ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "ZoneID condition requires to be in area (%u) which is a subzone but zone expected, skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "ZoneID condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "ZoneID condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_REPUTATION_RANK: @@ -1741,25 +1741,25 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) FactionEntry const* factionEntry = sFactionStore.LookupEntry(cond->ConditionValue1); if (!factionEntry) { - sLog->outErrorDb("Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Reputation condition has non existing faction (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Reputation condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TEAM: { if (cond->ConditionValue1 != ALLIANCE && cond->ConditionValue1 != HORDE) { - sLog->outErrorDb("Team condition specifies unknown team (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Team condition specifies unknown team (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Team condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Team condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Team condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Team condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_SKILL: @@ -1767,17 +1767,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(cond->ConditionValue1); if (!pSkill) { - sLog->outErrorDb("Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Skill condition specifies non-existing skill (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 < 1 || cond->ConditionValue2 > sWorld->GetConfigMaxSkillValue()) { - sLog->outErrorDb("Skill condition specifies invalid skill value (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Skill condition specifies invalid skill value (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("Skill condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Skill condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_QUESTREWARDED: @@ -1789,24 +1789,24 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sObjectMgr->GetQuestTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("Quest condition specifies non-existing quest (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Quest condition specifies non-existing quest (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 > 1) { - sLog->outErrorDb("Quest condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Quest condition has useless data in value2 (%u)!", cond->ConditionValue2); } if (cond->ConditionValue3) { - sLog->outErrorDb("Quest condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Quest condition has useless data in value3 (%u)!", cond->ConditionValue3); } break; } case CONDITION_QUESTSTATE: if (cond->ConditionValue2 >= (1 << MAX_QUEST_STATUS)) { - sLog->outErrorDb("ConditionType (%u) has invalid state mask (%u), skipped.", cond->ConditionType, cond->ConditionValue2); + LOG_ERROR("sql.sql", "ConditionType (%u) has invalid state mask (%u), skipped.", cond->ConditionType, cond->ConditionValue2); return false; } break; @@ -1815,14 +1815,14 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap(); if (cond->ConditionValue1 >= events.size() || !events[cond->ConditionValue1].isValid()) { - sLog->outErrorDb("ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "ActiveEvent condition has non existing event id (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "ActiveEvent condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "ActiveEvent condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_ACHIEVEMENT: @@ -1830,56 +1830,56 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) AchievementEntry const* achievement = sAchievementStore.LookupEntry(cond->ConditionValue1); if (!achievement) { - sLog->outErrorDb("Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Achivement condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Achivement condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_CLASS: { if (!(cond->ConditionValue1 & CLASSMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE); + LOG_ERROR("sql.sql", "Class condition has non existing classmask (%u), skipped", cond->ConditionValue1 & ~CLASSMASK_ALL_PLAYABLE); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Class condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Class condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Class condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Class condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_RACE: { if (!(cond->ConditionValue1 & RACEMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE); + LOG_ERROR("sql.sql", "Race condition has non existing racemask (%u), skipped", cond->ConditionValue1 & ~RACEMASK_ALL_PLAYABLE); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Race condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Race condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Race condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Race condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_GENDER: { if (!Player::IsValidGender(uint8(cond->ConditionValue1))) { - sLog->outError("Gender condition has invalid gender (%u), skipped", cond->ConditionValue1); + LOG_ERROR("server", "Gender condition has invalid gender (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outError("Gender condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("server", "Gender condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outError("Gender condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("server", "Gender condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_MAPID: @@ -1887,62 +1887,62 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1); if (!me) { - sLog->outErrorDb("Map condition has non existing map (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Map condition has non existing map (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Map condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Map condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Map condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Map condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_SPELL: { if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1)) { - sLog->outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Spell condition has non existing spell (Id: %d), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("Spell condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Spell condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Spell condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Spell condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_LEVEL: { if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - sLog->outErrorDb("Level condition has invalid option (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Level condition has invalid option (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("Level condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Level condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_DRUNKENSTATE: { if (cond->ConditionValue1 > DRUNKEN_SMASHED) { - sLog->outErrorDb("DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "DrunkState condition has invalid state (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2) { - sLog->outErrorDb("DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "DrunkState condition has useless data in value2 (%u)!", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "DrunkState condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_NEAR_CREATURE: { if (!sObjectMgr->GetCreatureTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "NearCreature condition has non existing creature template entry (%u), skipped", cond->ConditionValue1); return false; } break; @@ -1951,11 +1951,11 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sObjectMgr->GetGameObjectTemplate(cond->ConditionValue1)) { - sLog->outErrorDb("NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "NearGameObject condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "NearGameObject condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_OBJECT_ENTRY_GUID: @@ -1965,7 +1965,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case TYPEID_UNIT: if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2)) { - sLog->outErrorDb("ObjectEntryGuid condition has non existing creature template entry (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "ObjectEntryGuid condition has non existing creature template entry (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3 > 1) @@ -1974,13 +1974,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionValue2 && creatureData->id != cond->ConditionValue2) { - sLog->outErrorDb("ObjectEntryGuid condition has guid %u set but does not match creature entry (%u), skipped", cond->ConditionValue3, cond->ConditionValue2); + LOG_ERROR("sql.sql", "ObjectEntryGuid condition has guid %u set but does not match creature entry (%u), skipped", cond->ConditionValue3, cond->ConditionValue2); return false; } } else { - sLog->outErrorDb("ObjectEntryGuid condition has non existing creature guid (%u), skipped", cond->ConditionValue3); + LOG_ERROR("sql.sql", "ObjectEntryGuid condition has non existing creature guid (%u), skipped", cond->ConditionValue3); return false; } } @@ -1988,7 +1988,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case TYPEID_GAMEOBJECT: if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2)) { - sLog->outErrorDb("ObjectEntryGuid condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "ObjectEntryGuid condition has non existing gameobject template entry (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) @@ -1997,13 +1997,13 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionValue2 && goData->id != cond->ConditionValue2) { - sLog->outErrorDb("ObjectEntryGuid condition has guid %u set but does not match gameobject entry (%u), skipped", cond->ConditionValue3, cond->ConditionValue2); + LOG_ERROR("sql.sql", "ObjectEntryGuid condition has guid %u set but does not match gameobject entry (%u), skipped", cond->ConditionValue3, cond->ConditionValue2); return false; } } else { - sLog->outErrorDb("ObjectEntryGuid condition has non existing gameobject guid (%u), skipped", cond->ConditionValue3); + LOG_ERROR("sql.sql", "ObjectEntryGuid condition has non existing gameobject guid (%u), skipped", cond->ConditionValue3); return false; } } @@ -2011,12 +2011,12 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case TYPEID_PLAYER: case TYPEID_CORPSE: if (cond->ConditionValue2) - sLog->outErrorDb("ObjectEntryGuid condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "ObjectEntryGuid condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("ObjectEntryGuid condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "ObjectEntryGuid condition has useless data in value3 (%u)!", cond->ConditionValue3); break; default: - sLog->outErrorDb("ObjectEntryGuid condition has wrong typeid set (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "ObjectEntryGuid condition has wrong typeid set (%u), skipped", cond->ConditionValue1); return false; } break; @@ -2025,51 +2025,51 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!cond->ConditionValue1 || (cond->ConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE))) { - sLog->outErrorDb("TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "TypeMask condition has invalid typemask set (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue2) - sLog->outErrorDb("TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "TypeMask condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "TypeMask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_RELATION_TO: { if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "RelationTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue1 == cond->ConditionTarget) { - sLog->outErrorDb("RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "RelationTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 >= RELATION_MAX) { - sLog->outErrorDb("RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "RelationTo condition has invalid ConditionValue2(RelationType) (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "RelationTo condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_REACTION_TO: { if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "ReactionTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue1 == cond->ConditionTarget) { - sLog->outErrorDb("ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "ReactionTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } if (!cond->ConditionValue2) { - sLog->outErrorDb("mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "mConditionValue2 condition has invalid ConditionValue2(rankMask) (%u), skipped", cond->ConditionValue2); return false; } break; @@ -2078,17 +2078,17 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionValue1 >= cond->GetMaxAvailableConditionTargets()) { - sLog->outErrorDb("DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "DistanceTo condition has invalid ConditionValue1(ConditionTarget selection) (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue1 == cond->ConditionTarget) { - sLog->outErrorDb("DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "DistanceTo condition has ConditionValue1(ConditionTarget selection) set to self (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3 >= COMP_TYPE_MAX) { - sLog->outErrorDb("DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3); + LOG_ERROR("sql.sql", "DistanceTo condition has invalid ComparisionType (%u), skipped", cond->ConditionValue3); return false; } break; @@ -2096,38 +2096,38 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) case CONDITION_ALIVE: { if (cond->ConditionValue1) - sLog->outErrorDb("Alive condition has useless data in value1 (%u)!", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Alive condition has useless data in value1 (%u)!", cond->ConditionValue1); if (cond->ConditionValue2) - sLog->outErrorDb("Alive condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Alive condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Alive condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Alive condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_HP_VAL: { if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - sLog->outErrorDb("HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "HpVal condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "HpVal condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_HP_PCT: { if (cond->ConditionValue1 > 100) { - sLog->outErrorDb("HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "HpPct condition has too big percent value (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue2 >= COMP_TYPE_MAX) { - sLog->outErrorDb("HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); + LOG_ERROR("sql.sql", "HpPct condition has invalid ComparisionType (%u), skipped", cond->ConditionValue2); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "HpPct condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_AREAID: @@ -2137,19 +2137,19 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!sWorld->getWorldState(cond->ConditionValue1)) { - sLog->outErrorDb("World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "World state condition has non existing world state in value1 (%u), skipped", cond->ConditionValue1); return false; } if (cond->ConditionValue3) - sLog->outErrorDb("World state condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "World state condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_PHASEMASK: { if (cond->ConditionValue2) - sLog->outErrorDb("Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2); + LOG_ERROR("sql.sql", "Phasemask condition has useless data in value2 (%u)!", cond->ConditionValue2); if (cond->ConditionValue3) - sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); + LOG_ERROR("sql.sql", "Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } case CONDITION_TITLE: @@ -2157,7 +2157,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(cond->ConditionValue1); if (!titleEntry) { - sLog->outErrorDb("Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1); return false; } break; @@ -2166,7 +2166,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionValue1 > SPAWNMASK_RAID_ALL) { - sLog->outError("SpawnMask condition has non existing SpawnMask in value1 (%u), skipped", cond->ConditionValue1); + LOG_ERROR("server", "SpawnMask condition has non existing SpawnMask in value1 (%u), skipped", cond->ConditionValue1); return false; } break; @@ -2175,7 +2175,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!(cond->ConditionValue1 & UNIT_STATE_ALL_STATE_SUPPORTED)) { - sLog->outError("UnitState condition has non existing UnitState in value1 (%u), skipped", cond->ConditionValue1); + LOG_ERROR("server", "UnitState condition has non existing UnitState in value1 (%u), skipped", cond->ConditionValue1); return false; } break; @@ -2184,7 +2184,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (!cond->ConditionValue1 || cond->ConditionValue1 > CREATURE_TYPE_GAS_CLOUD) { - sLog->outError("CreatureType condition has non existing CreatureType in value1 (%u), skipped", cond->ConditionValue1); + LOG_ERROR("server", "CreatureType condition has non existing CreatureType in value1 (%u), skipped", cond->ConditionValue1); return false; } break; @@ -2194,7 +2194,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) AchievementEntry const* achievement = sAchievementStore.LookupEntry(cond->ConditionValue1); if (!achievement) { - sLog->outError("CONDITION_REALM_ACHIEVEMENT has non existing realm first achivement id (%u), skipped.", cond->ConditionValue1); + LOG_ERROR("server", "CONDITION_REALM_ACHIEVEMENT has non existing realm first achivement id (%u), skipped.", cond->ConditionValue1); return false; } break; @@ -2208,25 +2208,25 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const Quest* quest = sObjectMgr->GetQuestTemplate(cond->ConditionValue1); if (!quest) { - sLog->outErrorDb("CONDITION_QUEST_OBJECTIVE_PROGRESS points to non-existing quest (%u), skipped.", cond->ConditionValue1); + LOG_ERROR("sql.sql", "CONDITION_QUEST_OBJECTIVE_PROGRESS points to non-existing quest (%u), skipped.", cond->ConditionValue1); return false; } if (cond->ConditionValue2 > 3) { - sLog->outErrorDb("CONDITION_QUEST_OBJECTIVE_PROGRESS has out-of-range quest objective index specified (%u), it must be a number between 0 and 3. skipped.", cond->ConditionValue2); + LOG_ERROR("sql.sql", "CONDITION_QUEST_OBJECTIVE_PROGRESS has out-of-range quest objective index specified (%u), it must be a number between 0 and 3. skipped.", cond->ConditionValue2); return false; } if (quest->RequiredNpcOrGo[cond->ConditionValue2] == 0) { - sLog->outErrorDb("CONDITION_QUEST_OBJECTIVE_PROGRESS has quest objective %u for quest %u, but the field RequiredNPCOrGo%u is 0, skipped.", cond->ConditionValue2, cond->ConditionValue1, cond->ConditionValue2); + LOG_ERROR("sql.sql", "CONDITION_QUEST_OBJECTIVE_PROGRESS has quest objective %u for quest %u, but the field RequiredNPCOrGo%u is 0, skipped.", cond->ConditionValue2, cond->ConditionValue1, cond->ConditionValue2); return false; } if (cond->ConditionValue3 > quest->RequiredNpcOrGoCount[cond->ConditionValue2]) { - sLog->outErrorDb("CONDITION_QUEST_OBJECTIVE_PROGRESS has quest objective count %u in value3, but quest %u has a maximum objective count of %u in RequiredNPCOrGOCount%u, skipped.", cond->ConditionValue3, cond->ConditionValue2, quest->RequiredNpcOrGoCount[cond->ConditionValue2], cond->ConditionValue2); + LOG_ERROR("sql.sql", "CONDITION_QUEST_OBJECTIVE_PROGRESS has quest objective count %u in value3, but quest %u has a maximum objective count of %u in RequiredNPCOrGOCount%u, skipped.", cond->ConditionValue3, cond->ConditionValue2, quest->RequiredNpcOrGoCount[cond->ConditionValue2], cond->ConditionValue2); return false; } break; @@ -2235,7 +2235,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) { if (cond->ConditionValue1 == SPELL_AURA_NONE || cond->ConditionValue1 >= TOTAL_AURAS) { - sLog->outErrorDb("Has Aura Effect condition has non existing aura (%u), skipped", cond->ConditionValue1); + LOG_ERROR("sql.sql", "Has Aura Effect condition has non existing aura (%u), skipped", cond->ConditionValue1); return false; } break; diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index c4113a6360..b33a2e0a44 100644 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -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) diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index e435c82eb3..b0a5e5c7ba 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -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(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(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(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) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 3bfd1b7823..9098a35a75 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -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()) diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp index 92100ca987..252fa71778 100644 --- a/src/server/game/DungeonFinding/LFGQueue.cpp +++ b/src/server/game/DungeonFinding/LFGQueue.cpp @@ -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& 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(); diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 9d1354d3df..46ba514759 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -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 diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 4013af27db..37564870a4 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -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; } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index ee8770d12c..1b18203070 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -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; } @@ -980,7 +980,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST); m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST); } - else if (cinfo->type_flags & CREATURE_TYPE_FLAG_GHOST_VISIBLE) // Xinef: Add ghost visibility for ghost units + else if (cinfo->type_flags & CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS) // Xinef: Add ghost visibility for ghost units m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST); if (Entry == VISUAL_WAYPOINT) @@ -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 diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index e22a88a67e..4a8510702f 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -14,6 +14,7 @@ #include "LootMgr.h" #include "Unit.h" #include "UpdateMask.h" +#include "World.h" #include class SpellInfo; @@ -27,45 +28,44 @@ class CreatureGroup; enum CreatureFlagsExtra : uint32 { // TODO: Implement missing flags from TC in places that custom flags from xinef&pussywizzard use flag values. - CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group - CREATURE_FLAG_EXTRA_CIVILIAN = 0x00000002, // not aggro (ignore faction/reputation hostility) - CREATURE_FLAG_EXTRA_NO_PARRY = 0x00000004, // creature can't parry - CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry - CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // creature can't block - CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // creature can't do crush attacks - CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP - CREATURE_FLAG_EXTRA_TRIGGER = 0x00000080, // trigger creature - CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00000100, // creature is immune to taunt auras and effect attack me - CREATURE_FLAG_EXTRA_UNUSED_10 = 0x00000200, // TODO: Implement CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE (creature won't update movement flags) - CREATURE_FLAG_EXTRA_GHOST_VISIBILITY = 0x00000400, // creature will be only visible for dead players - CREATURE_FLAG_EXTRA_UNUSED_12 = 0x00000800, // TODO: Implement CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK (creature will use offhand attacks) - CREATURE_FLAG_EXTRA_NO_SELL_VENDOR = 0x00001000, // players can't sell items to this vendor - CREATURE_FLAG_EXTRA_UNUSED_14 = 0x00002000, - CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging) - CREATURE_FLAG_EXTRA_GUARD = 0x00008000, // Creature is guard - CREATURE_FLAG_EXTRA_UNUSED_17 = 0x00010000, - CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes - CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills - CREATURE_FLAG_EXTRA_TAUNT_DIMINISH = 0x00080000, // Taunt is a subject to diminishing returns on this creautre - CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // Creature is subject to all diminishing returns as player are - CREATURE_FLAG_EXTRA_UNUSED_22 = 0x00200000, - CREATURE_FLAG_EXTRA_AVOID_AOE = 0x00400000, // pussywizard: ignored by aoe attacks (for icc blood prince council npc - Dark Nucleus) - CREATURE_FLAG_EXTRA_NO_DODGE = 0x00800000, // xinef: target cannot dodge - CREATURE_FLAG_EXTRA_UNUSED_25 = 0x01000000, - CREATURE_FLAG_EXTRA_UNUSED_26 = 0x02000000, - CREATURE_FLAG_EXTRA_UNUSED_27 = 0x04000000, - CREATURE_FLAG_EXTRA_UNUSED_28 = 0x08000000, - CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB) - CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000, // creature ignore pathfinding - CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK = 0x40000000, // creature is immune to knockback effects - CREATURE_FLAG_EXTRA_UNUSED_32 = 0x80000000, + CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group + CREATURE_FLAG_EXTRA_CIVILIAN = 0x00000002, // not aggro (ignore faction/reputation hostility) + CREATURE_FLAG_EXTRA_NO_PARRY = 0x00000004, // creature can't parry + CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry + CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // creature can't block + CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS = 0x00000020, // creature can't do crush attacks + CREATURE_FLAG_EXTRA_NO_XP = 0x00000040, // creature kill does not provide XP + CREATURE_FLAG_EXTRA_TRIGGER = 0x00000080, // trigger creature + CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00000100, // creature is immune to taunt auras and 'attack me' effects + CREATURE_FLAG_EXTRA_UNUSED_10 = 0x00000200, // TODO: Implement CREATURE_FLAG_EXTRA_NO_MOVE_FLAGS_UPDATE (creature won't update movement flags) + CREATURE_FLAG_EXTRA_GHOST_VISIBILITY = 0x00000400, // creature will only be visible to dead players + CREATURE_FLAG_EXTRA_UNUSED_12 = 0x00000800, // TODO: Implement CREATURE_FLAG_EXTRA_USE_OFFHAND_ATTACK (creature will use offhand attacks) + CREATURE_FLAG_EXTRA_NO_SELL_VENDOR = 0x00001000, // players can't sell items to this vendor + CREATURE_FLAG_EXTRA_IGNORE_COMBAT = 0x00002000, + CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging) + CREATURE_FLAG_EXTRA_GUARD = 0x00008000, // Creature is guard + CREATURE_FLAG_EXTRA_UNUSED_17 = 0x00010000, + CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes + CREATURE_FLAG_EXTRA_NO_SKILL_GAINS = 0x00040000, // creature won't increase weapon skills + CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS = 0x00080000, // Taunt is subject to diminishing returns on this creature + CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // creature is subject to all diminishing returns as players are + CREATURE_FLAG_EXTRA_UNUSED_22 = 0x00200000, + CREATURE_FLAG_EXTRA_AVOID_AOE = 0x00400000, // pussywizard: ignored by aoe attacks (for icc blood prince council npc - Dark Nucleus) + CREATURE_FLAG_EXTRA_NO_DODGE = 0x00800000, // xinef: target cannot dodge + CREATURE_FLAG_EXTRA_UNUSED_25 = 0x01000000, + CREATURE_FLAG_EXTRA_UNUSED_26 = 0x02000000, + CREATURE_FLAG_EXTRA_UNUSED_27 = 0x04000000, + CREATURE_FLAG_EXTRA_UNUSED_28 = 0x08000000, + CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB) + CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000, // creature ignore pathfinding + CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK = 0x40000000, // creature is immune to knockback effects + CREATURE_FLAG_EXTRA_UNUSED_32 = 0x80000000, // Masks - CREATURE_FLAG_EXTRA_UNUSED = (CREATURE_FLAG_EXTRA_UNUSED_10 | CREATURE_FLAG_EXTRA_UNUSED_12 | - CREATURE_FLAG_EXTRA_UNUSED_14 | CREATURE_FLAG_EXTRA_UNUSED_17 | CREATURE_FLAG_EXTRA_UNUSED_22 | - CREATURE_FLAG_EXTRA_UNUSED_25 | CREATURE_FLAG_EXTRA_UNUSED_26 | CREATURE_FLAG_EXTRA_UNUSED_27 | - CREATURE_FLAG_EXTRA_UNUSED_28 | CREATURE_FLAG_EXTRA_UNUSED_32), - CREATURE_FLAG_EXTRA_DB_ALLOWED = (0xFFFFFFFF & ~(CREATURE_FLAG_EXTRA_UNUSED | CREATURE_FLAG_EXTRA_DUNGEON_BOSS)) + CREATURE_FLAG_EXTRA_UNUSED = (CREATURE_FLAG_EXTRA_UNUSED_10 | CREATURE_FLAG_EXTRA_UNUSED_12 | CREATURE_FLAG_EXTRA_UNUSED_17 | + CREATURE_FLAG_EXTRA_UNUSED_22 | CREATURE_FLAG_EXTRA_UNUSED_25 | CREATURE_FLAG_EXTRA_UNUSED_26 | + CREATURE_FLAG_EXTRA_UNUSED_27 | CREATURE_FLAG_EXTRA_UNUSED_28 | CREATURE_FLAG_EXTRA_UNUSED_32), + CREATURE_FLAG_EXTRA_DB_ALLOWED = (0xFFFFFFFF & ~(CREATURE_FLAG_EXTRA_UNUSED | CREATURE_FLAG_EXTRA_DUNGEON_BOSS)) }; #define MAX_AGGRO_RESET_TIME 10 // in seconds @@ -146,11 +146,11 @@ struct CreatureTemplate // helpers [[nodiscard]] SkillType GetRequiredLootSkill() const { - if (type_flags & CREATURE_TYPE_FLAG_HERB_SKINNING_SKILL) + if (type_flags & CREATURE_TYPE_FLAG_SKIN_WITH_HERBALISM) return SKILL_HERBALISM; - else if (type_flags & CREATURE_TYPE_FLAG_MINING_SKINNING_SKILL) + else if (type_flags & CREATURE_TYPE_FLAG_SKIN_WITH_MINING) return SKILL_MINING; - else if (type_flags & CREATURE_TYPE_FLAG_ENGINEERING_SKINNING_SKILL) + else if (type_flags & CREATURE_TYPE_FLAG_SKIN_WITH_ENGINEERING) return SKILL_ENGINEERING; else return SKILL_SKINNING; // normal case @@ -158,16 +158,16 @@ struct CreatureTemplate [[nodiscard]] bool IsExotic() const { - return (type_flags & CREATURE_TYPE_FLAG_EXOTIC_PET) != 0; + return (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_EXOTIC) != 0; } [[nodiscard]] bool IsTameable(bool exotic) const { - if (type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_PET) == 0) + if (type != CREATURE_TYPE_BEAST || family == 0 || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE) == 0) return false; // if can tame exotic then can tame any tameable - return exotic || (type_flags & CREATURE_TYPE_FLAG_EXOTIC_PET) == 0; + return exotic || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_EXOTIC) == 0; } void InitializeQueryData(); diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index 4b7f63d554..dafd1a8a60 100644 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -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 } } diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index d9a498cb4b..6c2a656624 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -4,10 +4,11 @@ * Copyright (C) 2005-2009 MaNGOS */ -#include "Formulas.h" #include "GossipDef.h" +#include "Formulas.h" #include "ObjectMgr.h" #include "Opcodes.h" +#include "Player.h" #include "QuestDef.h" #include "WorldPacket.h" #include "WorldSession.h" @@ -178,9 +179,6 @@ void PlayerMenu::ClearMenus() void PlayerMenu::SendGossipMenu(uint32 titleTextId, uint64 objectGUID) const { - //ACE_Read_Guard lock1(_gossipMenu.GetLock()); - //ACE_Read_Guard lock2(_questMenu.GetLock()); - WorldPacket data(SMSG_GOSSIP_MESSAGE, 24 + _gossipMenu.GetMenuItemCount() * 100 + _questMenu.GetMenuItemCount() * 75); // guess size data << uint64(objectGUID); data << uint32(_gossipMenu.GetMenuId()); // new 2.4.0 @@ -236,7 +234,7 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const PointOfInterest const* poi = sObjectMgr->GetPointOfInterest(poiId); if (!poi) { - sLog->outErrorDb("Request to send non-existing POI (Id: %u), ignored.", poiId); + LOG_ERROR("sql.sql", "Request to send non-existing POI (Id: %u), ignored.", poiId); return; } @@ -337,7 +335,7 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote const& eEmote, const std::string data.put(count_pos, count); _session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID)); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID)); #endif } @@ -349,7 +347,7 @@ void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const _session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus); #endif } @@ -453,7 +451,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, _session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); #endif } @@ -586,7 +584,7 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* quest) const _session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId()); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_QUERY_RESPONSE questid=%u", quest->GetQuestId()); #endif } @@ -676,7 +674,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b _session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); #endif } @@ -769,6 +767,6 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, _session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); #endif } diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 5e3eb602e9..4b12ac61de 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -139,7 +139,7 @@ void TempSummon::Update(uint32 diff) } default: UnSummon(); - sLog->outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); + LOG_ERROR("server", "Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); break; } } @@ -263,7 +263,7 @@ void TempSummon::RemoveFromWorld() owner->m_SummonSlot[slot] = 0; //if (GetOwnerGUID()) - // sLog->outError("Unit %u has owner guid when removed from world", GetEntry()); + // LOG_ERROR("server", "Unit %u has owner guid when removed from world", GetEntry()); Creature::RemoveFromWorld(); } @@ -378,10 +378,10 @@ void Puppet::InitSummon() if (!SetCharmedBy(GetOwner(), CHARM_TYPE_POSSESS)) { if (Player* p = GetOwner()) - sLog->outMisc("Puppet::InitSummon (A1) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", p->GetTypeId(), p->GetEntry(), p->GetUnitTypeMask(), p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap()->GetId(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); + LOG_INFO("misc", "Puppet::InitSummon (A1) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", p->GetTypeId(), p->GetEntry(), p->GetUnitTypeMask(), p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap()->GetId(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); else { - sLog->outMisc("Puppet::InitSummon (B1)"); + LOG_INFO("misc", "Puppet::InitSummon (B1)"); //ABORT(); // ZOMG! } } diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index c57b4d0014..013eac3d49 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -89,7 +89,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe Relocate(pos); if (!IsPositionValid()) { - sLog->outError("DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY()); + LOG_ERROR("server", "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, GetPositionX(), GetPositionY()); return false; } diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index b1679d0292..74a1ff170a 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -127,7 +127,7 @@ void GameObject::RemoveFromOwner() else if (IS_PET_GUID(ownerGUID)) ownerType = "pet"; - sLog->outCrash("Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.", + LOG_FATAL("server", "Delete GameObject (GUID: %u Entry: %u SpellId %u LinkedGO %u) that lost references to owner (GUID %u Type '%s') GO list. Crash possible later.", GetGUIDLow(), GetGOInfo()->entry, m_spellId, GetGOInfo()->GetLinkedGameObjectEntry(), GUID_LOPART(ownerGUID), ownerType);*/ SetOwnerGUID(0); } @@ -230,7 +230,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa m_stationaryPosition.Relocate(x, y, z, ang); if (!IsPositionValid()) { - sLog->outError("Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y); + LOG_ERROR("server", "Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y); return false; } @@ -247,7 +247,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id); if (!goinfo) { - sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z); + LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z); return false; } @@ -257,7 +257,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa if (goinfo->type >= MAX_GAMEOBJECT_TYPE) { - sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type); + LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type); return false; } @@ -367,7 +367,7 @@ void GameObject::Update(uint32 diff) if (AI()) AI()->UpdateAI(diff); else if (!AIM_Initialize()) - sLog->outError("Could not initialize GameObjectAI"); + LOG_ERROR("server", "Could not initialize GameObjectAI"); switch (m_lootState) { @@ -847,7 +847,7 @@ void GameObject::SaveToDB() GameObjectData const* data = sObjectMgr->GetGOData(m_DBTableGuid); if (!data) { - sLog->outError("GameObject::SaveToDB failed, cannot get gameobject data!"); + LOG_ERROR("server", "GameObject::SaveToDB failed, cannot get gameobject data!"); return; } @@ -918,7 +918,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap) if (!data) { - sLog->outErrorDb("Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid); + LOG_ERROR("sql.sql", "Gameobject (GUID: %u) not found in table `gameobject`, can't load. ", guid); return false; } @@ -1455,7 +1455,7 @@ void GameObject::Use(Unit* user) if (info->goober.eventId) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow()); + LOG_DEBUG("maps.script", "Goober ScriptStart id %u for GO entry %u (GUID %u).", info->goober.eventId, GetEntry(), GetDBTableGUIDLow()); #endif GetMap()->ScriptsStart(sEventScripts, info->goober.eventId, player, this); EventInform(info->goober.eventId); @@ -1541,7 +1541,7 @@ void GameObject::Use(Unit* user) //provide error, no fishable zone or area should be 0 if (!zone_skill) - sLog->outErrorDb("Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone); + LOG_ERROR("sql.sql", "Fishable areaId %u are not properly defined in `skill_fishing_base_level`.", subzone); int32 skill = player->GetSkillValue(SKILL_FISHING); @@ -1558,7 +1558,7 @@ void GameObject::Use(Unit* user) int32 roll = irand(1, 100); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll); + LOG_DEBUG("server", "Fishing check (skill: %i zone min skill: %i chance %i roll: %i", skill, zone_skill, chance, roll); #endif // but you will likely cause junk in areas that require a high fishing skill (not yet implemented) @@ -1839,7 +1839,7 @@ void GameObject::Use(Unit* user) } default: if (GetGoType() >= MAX_GAMEOBJECT_TYPE) - sLog->outError("GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)", + LOG_ERROR("server", "GameObject::Use(): unit (type: %u, guid: %u, name: %s) tries to use object (guid: %u, entry: %u, name: %s) of unknown type (%u)", user->GetTypeId(), user->GetGUIDLow(), user->GetName().c_str(), GetGUIDLow(), GetEntry(), GetGOInfo()->name.c_str(), GetGoType()); break; } @@ -1851,10 +1851,10 @@ void GameObject::Use(Unit* user) if (!spellInfo) { if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this)) - sLog->outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType()); + LOG_ERROR("server", "WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u)", spellId, GetEntry(), GetGoType()); else #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_OUTDOORPVP, "WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId); + LOG_DEBUG("outdoorpvp", "WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId); #endif return; } @@ -1903,8 +1903,8 @@ void GameObject::CastSpell(Unit* target, uint32 spellId) // needed for GO casts for proper target validation checks trigger->SetOwnerGUID(owner->GetGUID()); // xinef: fixes some duel bugs with traps] - if (owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) - trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + if (owner->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + trigger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); if (owner->IsFFAPvP()) trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index 2fed1ffd4c..cb9a7d824c 100644 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.cpp @@ -29,7 +29,7 @@ Bag::~Bag() { if (item->IsInWorld()) { - sLog->outCrash("Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.", + LOG_FATAL("server", "Item %u (slot %u, bag slot %u) in bag %u (slot %u, bag slot %u, m_bagslot %u) is to be deleted but is still in world.", item->GetEntry(), (uint32)item->GetSlot(), (uint32)item->GetBagSlot(), GetEntry(), (uint32)GetSlot(), (uint32)GetBagSlot(), (uint32)i); item->RemoveFromWorld(); diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 246c5353ba..52de3b548e 100644 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -26,7 +26,7 @@ void AddItemsSetItem(Player* player, Item* item) if (!set) { - sLog->outErrorDb("Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId); + LOG_ERROR("sql.sql", "Item set %u for item (id %u) not found, mods not applied.", setid, proto->ItemId); return; } @@ -86,7 +86,7 @@ void AddItemsSetItem(Player* player, Item* item) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(set->spells[x]); if (!spellInfo) { - sLog->outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid); + LOG_ERROR("server", "WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid); break; } @@ -111,7 +111,7 @@ void RemoveItemsSetItem(Player* player, ItemTemplate const* proto) if (!set) { - sLog->outErrorDb("Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId); + LOG_ERROR("sql.sql", "Item set #%u for item #%u not found, mods not removed.", setid, proto->ItemId); return; } @@ -289,7 +289,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff); + LOG_DEBUG("entities.player.items", "Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff); #endif if (GetUInt32Value(ITEM_FIELD_DURATION) <= diff) @@ -588,7 +588,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) // item can have not null only one from field values if ((itemProto->RandomProperty) && (itemProto->RandomSuffix)) { - sLog->outErrorDb("Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix); + LOG_ERROR("sql.sql", "Item template %u have RandomProperty == %u and RandomSuffix == %u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix); return 0; } @@ -599,7 +599,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); if (!random_id) { - sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); + LOG_ERROR("sql.sql", "Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); return 0; } @@ -612,7 +612,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId); if (!random_id) { - sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); + LOG_ERROR("sql.sql", "Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); return 0; } @@ -706,7 +706,7 @@ void Item::AddToUpdateQueueOf(Player* player) if (player->GetGUID() != GetOwnerGUID()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); #endif return; } @@ -728,7 +728,7 @@ void Item::RemoveFromUpdateQueueOf(Player* player) if (player->GetGUID() != GetOwnerGUID()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); + LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%u) and player's guid (%u) don't match!", GUID_LOPART(GetOwnerGUID()), player->GetGUIDLow()); #endif return; } diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index a61de73218..59e6cb5954 100644 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -59,13 +59,13 @@ void LoadRandomEnchantmentsTable() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } else { - sLog->outErrorDb(">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty."); + LOG_INFO("server", " "); } } @@ -80,7 +80,7 @@ uint32 GetItemEnchantMod(int32 entry) EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry); if (tab == RandomItemEnch.end()) { - sLog->outErrorDb("Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry); + LOG_ERROR("sql.sql", "Item RandomProperty / RandomSuffix id #%u used in `item_template` but it does not have records in `item_enchantment_template` table.", entry); return 0; } diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index d535ac571f..2d9135121e 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -103,7 +103,7 @@ WorldObject::~WorldObject() { if (GetTypeId() == TYPEID_CORPSE) { - sLog->outCrash("Object::~Object Corpse guid=" UI64FMTD ", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry()); + LOG_FATAL("server", "Object::~Object Corpse guid=" UI64FMTD ", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry()); ABORT(); } ResetMap(); @@ -116,16 +116,16 @@ Object::~Object() if (IsInWorld()) { - sLog->outCrash("Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); + LOG_FATAL("server", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry()); if (isType(TYPEMASK_ITEM)) - sLog->outCrash("Item slot %u", ((Item*)this)->GetSlot()); + LOG_FATAL("server", "Item slot %u", ((Item*)this)->GetSlot()); ABORT(); RemoveFromWorld(); } if (m_objectUpdated) { - sLog->outCrash("Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); + LOG_FATAL("server", "Object::~Object - guid=" UI64FMTD ", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry()); ABORT(); sObjectAccessor->RemoveUpdateObject(this); } @@ -246,8 +246,6 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c } } - //sLog->outDebug("BuildCreateUpdate: update-type: %u, object-type: %u got flags: %X, flags2: %X", updatetype, m_objectTypeId, flags, flags2); - ByteBuffer buf(500); buf << (uint8)updatetype; buf.append(GetPackGUID()); @@ -717,7 +715,7 @@ void Object::SetByteValue(uint16 index, uint8 offset, uint8 value) if (offset > 3) { - sLog->outError("Object::SetByteValue: wrong offset %u", offset); + LOG_ERROR("server", "Object::SetByteValue: wrong offset %u", offset); return; } @@ -741,7 +739,7 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value) if (offset > 1) { - sLog->outError("Object::SetUInt16Value: wrong offset %u", offset); + LOG_ERROR("server", "Object::SetUInt16Value: wrong offset %u", offset); return; } @@ -853,7 +851,7 @@ void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag) if (offset > 3) { - sLog->outError("Object::SetByteFlag: wrong offset %u", offset); + LOG_ERROR("server", "Object::SetByteFlag: wrong offset %u", offset); return; } @@ -876,7 +874,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag) if (offset > 3) { - sLog->outError("Object::RemoveByteFlag: wrong offset %u", offset); + LOG_ERROR("server", "Object::RemoveByteFlag: wrong offset %u", offset); return; } @@ -895,7 +893,7 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag) bool Object::PrintIndexError(uint32 index, bool set) const { - sLog->outString("Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType); + LOG_INFO("server", "Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType); // ASSERT must fail after function call return false; @@ -967,32 +965,32 @@ ByteBuffer& operator<<(ByteBuffer& buf, Position::PositionXYZOStreamer const& st void MovementInfo::OutDebug() { - sLog->outString("MOVEMENT INFO"); - sLog->outString("guid " UI64FMTD, guid); - sLog->outString("flags %u", flags); - sLog->outString("flags2 %u", flags2); - sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::time(nullptr))); - sLog->outString("position: `%s`", pos.ToString().c_str()); + LOG_INFO("server", "MOVEMENT INFO"); + LOG_INFO("server", "guid " UI64FMTD, guid); + LOG_INFO("server", "flags %u", flags); + LOG_INFO("server", "flags2 %u", flags2); + LOG_INFO("server", "time %u current time " UI64FMTD "", flags2, uint64(::time(nullptr))); + LOG_INFO("server", "position: `%s`", pos.ToString().c_str()); if (flags & MOVEMENTFLAG_ONTRANSPORT) { - sLog->outString("TRANSPORT:"); - sLog->outString("guid: " UI64FMTD, transport.guid); - sLog->outString("position: `%s`", transport.pos.ToString().c_str()); - sLog->outString("seat: %i", transport.seat); - sLog->outString("time: %u", transport.time); + LOG_INFO("server", "TRANSPORT:"); + LOG_INFO("server", "guid: " UI64FMTD, transport.guid); + LOG_INFO("server", "position: `%s`", transport.pos.ToString().c_str()); + LOG_INFO("server", "seat: %i", transport.seat); + LOG_INFO("server", "time: %u", transport.time); if (flags2 & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT) - sLog->outString("time2: %u", transport.time2); + LOG_INFO("server", "time2: %u", transport.time2); } if ((flags & (MOVEMENTFLAG_SWIMMING | MOVEMENTFLAG_FLYING)) || (flags2 & MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING)) - sLog->outString("pitch: %f", pitch); + LOG_INFO("server", "pitch: %f", pitch); - sLog->outString("fallTime: %u", fallTime); + LOG_INFO("server", "fallTime: %u", fallTime); if (flags & MOVEMENTFLAG_FALLING) - sLog->outString("j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", jump.zspeed, jump.sinAngle, jump.cosAngle, jump.xyspeed); + LOG_INFO("server", "j_zspeed: %f j_sinAngle: %f j_cosAngle: %f j_xyspeed: %f", jump.zspeed, jump.sinAngle, jump.cosAngle, jump.xyspeed); if (flags & MOVEMENTFLAG_SPLINE_ELEVATION) - sLog->outString("splineElevation: %f", splineElevation); + LOG_INFO("server", "splineElevation: %f", splineElevation); } WorldObject::WorldObject(bool isWorldObject) : WorldLocation(), @@ -1979,7 +1977,7 @@ namespace acore ChatHandler::BuildChatPacket(data, i_msgtype, i_language, i_object, i_target, text, 0, "", loc_idx); } else - sLog->outError("MonsterChatBuilder: `broadcast_text` id %i missing", i_textId); + LOG_ERROR("server", "MonsterChatBuilder: `broadcast_text` id %i missing", i_textId); } private: @@ -2151,7 +2149,7 @@ void WorldObject::SetMap(Map* map) return; if (m_currMap) { - sLog->outCrash("WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId()); + LOG_FATAL("server", "WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId()); ABORT(); } m_currMap = map; @@ -2199,7 +2197,7 @@ void WorldObject::AddObjectToRemoveList() Map* map = FindMap(); if (!map) { - sLog->outError("Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId()); + LOG_ERROR("server", "Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).", GetTypeId(), GetEntry(), GetGUIDLow(), GetMapId()); return; } @@ -2327,7 +2325,7 @@ GameObject* Map::SummonGameObject(uint32 entry, float x, float y, float z, float GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { - sLog->outErrorDb("Gameobject template %u not found in database!", entry); + LOG_ERROR("sql.sql", "Gameobject template %u not found in database!", entry); return nullptr; } @@ -2387,7 +2385,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { - sLog->outErrorDb("Gameobject template %u not found in database!", entry); + LOG_ERROR("sql.sql", "Gameobject template %u not found in database!", entry); return nullptr; } @@ -2759,7 +2757,7 @@ void WorldObject::MovePosition(Position& pos, float dist, float angle) // Prevent invalid coordinates here, position is unchanged if (!acore::IsValidMapCoord(destx, desty)) { - sLog->outCrash("WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty); + LOG_FATAL("server", "WorldObject::MovePosition invalid coordinates X: %f and Y: %f were passed!", destx, desty); return; } diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp index 61799f6dfc..ac32ec67a5 100644 --- a/src/server/game/Entities/Object/Updates/UpdateData.cpp +++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp @@ -47,7 +47,7 @@ void UpdateData::Compress(void* dst, uint32* dst_size, void* src, int src_size) int z_res = deflateInit(&c_stream, sWorld->getIntConfig(CONFIG_COMPRESSION)); if (z_res != Z_OK) { - sLog->outError("Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res)); + LOG_ERROR("server", "Can't compress update packet (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } @@ -60,14 +60,14 @@ void UpdateData::Compress(void* dst, uint32* dst_size, void* src, int src_size) z_res = deflate(&c_stream, Z_NO_FLUSH); if (z_res != Z_OK) { - sLog->outError("Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res)); + LOG_ERROR("server", "Can't compress update packet (zlib: deflate) Error code: %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } if (c_stream.avail_in != 0) { - sLog->outError("Can't compress update packet (zlib: deflate not greedy)"); + LOG_ERROR("server", "Can't compress update packet (zlib: deflate not greedy)"); *dst_size = 0; return; } @@ -75,7 +75,7 @@ void UpdateData::Compress(void* dst, uint32* dst_size, void* src, int src_size) z_res = deflate(&c_stream, Z_FINISH); if (z_res != Z_STREAM_END) { - sLog->outError("Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res)); + LOG_ERROR("server", "Can't compress update packet (zlib: deflate should report Z_STREAM_END instead %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } @@ -83,7 +83,7 @@ void UpdateData::Compress(void* dst, uint32* dst_size, void* src, int src_size) z_res = deflateEnd(&c_stream); if (z_res != Z_OK) { - sLog->outError("Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res)); + LOG_ERROR("server", "Can't compress update packet (zlib: deflateEnd) Error code: %i (%s)", z_res, zError(z_res)); *dst_size = 0; return; } diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index ffbe5bf1f1..5e98764746 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -120,7 +120,7 @@ SpellCastResult Pet::TryLoadFromDB(Player* owner, bool current /*= false*/, PetT CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(petentry); if (!creatureInfo) { - sLog->outError("Pet entry %u does not exist but used at pet load (owner: %s).", petentry, owner->GetName().c_str()); + LOG_ERROR("server", "Pet entry %u does not exist but used at pet load (owner: %s).", petentry, owner->GetName().c_str()); return SPELL_FAILED_NO_PET; } @@ -393,7 +393,7 @@ void Pet::Update(uint32 diff) { if (owner->GetPetGUID() != GetGUID()) { - sLog->outError("Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName().c_str()); + LOG_ERROR("server", "Pet %u is not pet of owner %s, removed", GetEntry(), m_owner->GetName().c_str()); Remove(getPetType() == HUNTER_PET ? PET_SAVE_AS_DELETED : PET_SAVE_NOT_IN_SLOT); return; } @@ -644,7 +644,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) if (!IsPositionValid()) { - sLog->outError("Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", + LOG_ERROR("server", "Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); return false; } @@ -652,7 +652,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) CreatureTemplate const* cinfo = GetCreatureTemplate(); if (!cinfo) { - sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!"); + LOG_ERROR("server", "CreateBaseAtCreature() failed, creatureInfo is missing!"); return false; } @@ -682,7 +682,7 @@ bool Pet::CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner) bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PETS, "Pet::CreateBaseForTamed"); + LOG_DEBUG("entities.pet", "Pet::CreateBaseForTamed"); #endif uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_PET); uint32 pet_number = sObjectMgr->GeneratePetNumber(); @@ -748,7 +748,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel) if (petType == HUNTER_PET) m_unitTypeMask |= UNIT_MASK_HUNTER_PET; else if (petType != SUMMON_PET) - sLog->outError("Unknown type pet %u is summoned by player class %u", GetEntry(), owner->getClass()); + LOG_ERROR("server", "Unknown type pet %u is summoned by player class %u", GetEntry(), owner->getClass()); } } @@ -1141,7 +1141,7 @@ void Pet::_LoadSpellCooldowns(PreparedQueryResult result) if (!sSpellMgr->GetSpellInfo(spell_id)) { - sLog->outError("Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id); + LOG_ERROR("server", "Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id); continue; } @@ -1154,7 +1154,7 @@ void Pet::_LoadSpellCooldowns(PreparedQueryResult result) _AddCreatureSpellCooldown(spell_id, cooldown); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PETS, "Pet (Number: %u) spell %u cooldown loaded (%u secs).", m_charmInfo->GetPetNumber(), spell_id, uint32(db_time - curTime)); + LOG_DEBUG("entities.pet", "Pet (Number: %u) spell %u cooldown loaded (%u secs).", m_charmInfo->GetPetNumber(), spell_id, uint32(db_time - curTime)); #endif } while (result->NextRow()); @@ -1260,7 +1260,7 @@ void Pet::_SaveSpells(SQLTransaction& trans) void Pet::_LoadAuras(PreparedQueryResult result, uint32 timediff) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PETS, "Loading auras for pet %u", GetGUIDLow()); + LOG_DEBUG("entities.pet", "Loading auras for pet %u", GetGUIDLow()); #endif if (result) @@ -1291,7 +1291,7 @@ void Pet::_LoadAuras(PreparedQueryResult result, uint32 timediff) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { - sLog->outError("Unknown aura (spellid %u), ignore.", spellid); + LOG_ERROR("server", "Unknown aura (spellid %u), ignore.", spellid); continue; } @@ -1332,7 +1332,7 @@ void Pet::_LoadAuras(PreparedQueryResult result, uint32 timediff) aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]); aura->ApplyForTargets(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); + LOG_DEBUG("server", "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); #endif } } while (result->NextRow()); @@ -1430,7 +1430,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel // do pet spell book cleanup if (state == PETSPELL_UNCHANGED) // spell load case { - sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId); + LOG_ERROR("server", "Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_PET_SPELL); @@ -1439,7 +1439,7 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel CharacterDatabase.Execute(stmt); } else - sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId); + LOG_ERROR("server", "Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } @@ -2186,7 +2186,7 @@ void Pet::HandleAsynchLoadFailed(AsynchPetSummon* info, Player* player, uint8 as uint32 pet_number = sObjectMgr->GeneratePetNumber(); if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, player->GetPhaseMask(), info->m_entry, pet_number)) { - sLog->outError("no such creature entry %u", info->m_entry); + LOG_ERROR("server", "no such creature entry %u", info->m_entry); delete pet; return; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 304246f28b..22effef14a 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -929,11 +929,6 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this) m_ChampioningFaction = 0; - m_timeSyncCounter = 0; - m_timeSyncTimer = 0; - m_timeSyncClient = 0; - m_timeSyncServer = 0; - for (uint8 i = 0; i < MAX_POWERS; ++i) m_powerFraction[i] = 0; @@ -1020,10 +1015,10 @@ Player::~Player() if (!m_isInSharedVisionOf.empty()) { - sLog->outMisc("Player::~Player (A1)"); + LOG_INFO("misc", "Player::~Player (A1)"); do { - sLog->outMisc("Player::~Player (A2)"); + LOG_INFO("misc", "Player::~Player (A2)"); Unit* u = *(m_isInSharedVisionOf.begin()); u->RemovePlayerFromVision(this); } while (!m_isInSharedVisionOf.empty()); @@ -1052,7 +1047,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(createInfo->Race, createInfo->Class); if (!info) { - sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", + LOG_ERROR("server", "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid race/class pair (%u/%u) - refusing to do so.", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Race, createInfo->Class); return false; } @@ -1065,7 +1060,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(createInfo->Class); if (!cEntry) { - sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", + LOG_ERROR("server", "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid character class (%u) - refusing to do so (wrong DBC-files?)", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Class); return false; } @@ -1083,7 +1078,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (!IsValidGender(createInfo->Gender)) { - sLog->outError("Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%u) - refusing to do so", + LOG_ERROR("server", "Player::Create: Possible hacking-attempt: Account %u tried creating a character named '%s' with an invalid gender (%u) - refusing to do so", GetSession()->GetAccountId(), m_name.c_str(), createInfo->Gender); return false; } @@ -1095,7 +1090,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) if (sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || sWorld->getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP) { SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); } SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER); SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // fix cast time showed in spell tooltip on client @@ -1271,7 +1266,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Creating initial item, itemId = %u, count = %u", titem_id, titem_amount); + LOG_DEBUG("entities.player.items", "STORAGE: Creating initial item, itemId = %u, count = %u", titem_id, titem_amount); #endif // attempt equip by one @@ -1301,7 +1296,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) } // item can't be added - sLog->outError("STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(true), getClass(), msg); + LOG_ERROR("server", "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(true), getClass(), msg); return false; } @@ -1369,7 +1364,7 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage) if (type == DAMAGE_FALL) // DealDamage not apply item durability loss at self damage { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("We are fall to death, loosing 10 percents durability"); + LOG_DEBUG("server", "We are fall to death, loosing 10 percents durability"); #endif DurabilityLossAll(0.10f, false); // durability lost message @@ -1632,7 +1627,7 @@ void Player::Update(uint32 p_time) UpdateAfkReport(now); // Xinef: update charm AI only if we are controlled by creature or non-posses player charm - if (IsCharmed() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) + if (IsCharmed() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED)) { m_charmUpdateTimer += p_time; if (m_charmUpdateTimer >= 1000) @@ -1795,7 +1790,7 @@ void Player::Update(uint32 p_time) if (!IsPositionValid()) // pussywizard: will crash below at eg. GetZoneAndAreaId { - sLog->outMisc("Player::Update - invalid position (%.1f, %.1f, %.1f)! Map: %u, MapId: %u, GUID: %u", GetPositionX(), GetPositionY(), GetPositionZ(), (FindMap() ? FindMap()->GetId() : 0), GetMapId(), GetGUIDLow()); + LOG_INFO("misc", "Player::Update - invalid position (%.1f, %.1f, %.1f)! Map: %u, MapId: %u, GUID: %u", GetPositionX(), GetPositionY(), GetPositionZ(), (FindMap() ? FindMap()->GetId() : 0), GetMapId(), GetGUIDLow()); GetSession()->KickPlayer("Invalid position"); return; } @@ -1833,14 +1828,6 @@ void Player::Update(uint32 p_time) m_zoneUpdateTimer -= p_time; } - if (m_timeSyncTimer > 0) - { - if (p_time >= m_timeSyncTimer) - SendTimeSync(); - else - m_timeSyncTimer -= p_time; - } - if (IsAlive()) { m_regenTimer += p_time; @@ -1976,7 +1963,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/) { if (!cur) { - sLog->outError("setDeathState: attempt to kill a dead player %s(%d)", GetName().c_str(), GetGUIDLow()); + LOG_ERROR("server", "setDeathState: attempt to kill a dead player %s(%d)", GetName().c_str(), GetGUIDLow()); return; } @@ -2059,12 +2046,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass); if (!info) { - sLog->outError("Player %u has incorrect race/class pair. Don't build enum.", guid); + LOG_ERROR("server", "Player %u has incorrect race/class pair. Don't build enum.", guid); return false; } else if (!IsValidGender(gender)) { - sLog->outError("Player (%u) has incorrect gender (%u), don't build enum.", guid, gender); + LOG_ERROR("server", "Player (%u) has incorrect gender (%u), don't build enum.", guid, gender); return false; } @@ -2236,14 +2223,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati { if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation)) { - sLog->outError("TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).", + LOG_ERROR("server", "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).", mapid, x, y, z, orientation, GetGUIDLow(), GetName().c_str(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); return false; } if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { - sLog->outError("Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName().c_str(), mapid); + LOG_ERROR("server", "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName().c_str(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); return false; } @@ -2268,7 +2255,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (GetSession()->Expansion() < mEntry->Expansion()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "Player %s using client without required expansion tried teleport to non accessible map %u", GetName().c_str(), mapid); + LOG_DEBUG("maps", "Player %s using client without required expansion tried teleport to non accessible map %u", GetName().c_str(), mapid); #endif if (GetTransport()) @@ -2286,7 +2273,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati } else #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "Player %s is being teleported to map %u", GetName().c_str(), mapid); + LOG_DEBUG("maps", "Player %s is being teleported to map %u", GetName().c_str(), mapid); #endif // xinef: do this here in case teleport failed in above checks @@ -2636,7 +2623,7 @@ void Player::RemoveFromWorld() { if (WorldObject* viewpoint = GetViewpoint()) { - sLog->outCrash("Player %s has viewpoint %u %u when removed from world", GetName().c_str(), viewpoint->GetEntry(), viewpoint->GetTypeId()); + LOG_FATAL("server", "Player %s has viewpoint %u %u when removed from world", GetName().c_str(), viewpoint->GetEntry(), viewpoint->GetTypeId()); SetViewpoint(viewpoint, false); } } @@ -2967,11 +2954,11 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) return nullptr; // Deathstate checks - if (!IsAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_GHOST_VISIBLE)) + if (!IsAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS)) return nullptr; // alive or spirit healer - if (!creature->IsAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_CAN_INTERACT_WHILE_DEAD)) + if (!creature->IsAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_INTERACT_WHILE_DEAD)) return nullptr; // appropriate npc type @@ -3016,7 +3003,7 @@ GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes return go; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "IsGameObjectOfTypeInRange: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name.c_str(), go->GetGUIDLow(), GetName().c_str(), GetGUIDLow(), go->GetDistance(this)); + LOG_DEBUG("maps", "IsGameObjectOfTypeInRange: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name.c_str(), go->GetGUIDLow(), GetName().c_str(), GetGUIDLow(), go->GetDistance(this)); #endif } } @@ -3563,7 +3550,7 @@ void Player::InitStatsForLevel(bool reapplyMods) UNIT_FLAG_STUNNED | UNIT_FLAG_IN_COMBAT | UNIT_FLAG_DISARMED | UNIT_FLAG_CONFUSED | UNIT_FLAG_FLEEING | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_SKINNABLE | UNIT_FLAG_MOUNT | UNIT_FLAG_TAXI_FLIGHT ); - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); // must be set + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); // must be set SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_REGENERATE_POWER);// must be set @@ -3814,11 +3801,6 @@ bool Player::addTalent(uint32 spellId, uint8 addSpecMask, uint8 oldTalentRank) return true; } - // xinef: error case, trying to add already present talent with present mask - else - { - sLog->outError("Player (%u) tries to learn talent %u with covered specMask (curr: %u, add: %u)", GetGUIDLow(), spellId, itr->second->specMask, addSpecMask); - } return false; } @@ -3988,7 +3970,7 @@ bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool l { if (spellInfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL) { - sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN: %u, PLAYER: %u", spellId, GetGUIDLow()); + LOG_INFO("server", "TRYING TO LEARN SPELL WITH EFFECT LEARN: %u, PLAYER: %u", spellId, GetGUIDLow()); return false; //ABORT(); } @@ -4040,7 +4022,7 @@ bool Player::_addSpell(uint32 spellId, uint8 addSpecMask, bool temporary, bool l // xinef: do not add spells with effect learn spell if (spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL)) { - sLog->outString("TRYING TO LEARN SPELL WITH EFFECT LEARN 2: %u, PLAYER: %u", spellId, GetGUIDLow()); + LOG_INFO("server", "TRYING TO LEARN SPELL WITH EFFECT LEARN 2: %u, PLAYER: %u", spellId, GetGUIDLow()); m_spells.erase(spellInfo->Id); // mem leak, but should never happen return false; //ABORT(); @@ -4158,7 +4140,7 @@ void Player::learnSpell(uint32 spellId) // Xinef: don't allow to learn active spell once more if (HasActiveSpell(spellId)) { - sLog->outError("Player (%u) tries to learn already active spell: %u", GetGUIDLow(), spellId); + LOG_ERROR("server", "Player (%u) tries to learn already active spell: %u", GetGUIDLow(), spellId); return; } @@ -4462,7 +4444,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) if (!sSpellMgr->GetSpellInfo(spell_id)) { - sLog->outError("Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); + LOG_ERROR("server", "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id); continue; } @@ -4473,7 +4455,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) AddSpellCooldown(spell_id, item_id, (db_time - curTime)*IN_MILLISECONDS, needSend); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player (GUID: %u) spell %u, item %u cooldown loaded (%u secs).", GetGUIDLow(), spell_id, item_id, uint32(db_time - curTime)); + LOG_DEBUG("entities.player.loading", "Player (GUID: %u) spell %u, item %u cooldown loaded (%u secs).", GetGUIDLow(), spell_id, item_id, uint32(db_time - curTime)); #endif } while (result->NextRow()); } @@ -5165,7 +5147,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC break; } default: - sLog->outError("Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method); + LOG_ERROR("server", "Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method); return; } @@ -5190,8 +5172,8 @@ void Player::DeleteOldCharacters() */ void Player::DeleteOldCharacters(uint32 keepDays) { - sLog->outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays); - sLog->outString(); + LOG_INFO("server", "Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays); + LOG_INFO("server", " "); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS); stmt->setUInt32(0, uint32(time(nullptr) - time_t(keepDays * DAY))); @@ -5199,7 +5181,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) if (result) { - sLog->outString("Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); + LOG_INFO("server", "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount()); do { Field* fields = result->Fetch(); @@ -5226,7 +5208,7 @@ void Player::SetMovement(PlayerMovementType pType) data.Initialize(SMSG_MOVE_LAND_WALK, GetPackGUID().size() + 4); break; default: - sLog->outError("Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType); + LOG_ERROR("server", "Player::SetMovement: Unsupported move type (%d), data not sent to client.", pType); return; } data.append(GetPackGUID()); @@ -5243,55 +5225,45 @@ void Player::BuildPlayerRepop() WorldPacket data(SMSG_PRE_RESURRECT, GetPackGUID().size()); data.append(GetPackGUID()); GetSession()->SendPacket(&data); - if (getRace(true) == RACE_NIGHTELF) + { CastSpell(this, 20584, true); + } CastSpell(this, 8326, true); // there must be SMSG.FORCE_RUN_SPEED_CHANGE, SMSG.FORCE_SWIM_SPEED_CHANGE, SMSG.MOVE_WATER_WALK // there must be SMSG.STOP_MIRROR_TIMER // there we must send 888 opcode - // the player cannot have a corpse already, only bones which are not returned by GetCorpse - if (GetCorpse()) + if (GetCorpse()) // the player cannot have a corpse already, only bones which are not returned by GetCorpse { - sLog->outError("BuildPlayerRepop: player %s(%d) already has a corpse", GetName().c_str(), GetGUIDLow()); + LOG_ERROR("server", "BuildPlayerRepop: player %s(%d) already has a corpse", GetName().c_str(), GetGUIDLow()); return; } - - // create a corpse and place it at the player's location - CreateCorpse(); + CreateCorpse(); // create a corpse and place it at the player's location Corpse* corpse = GetCorpse(); if (!corpse) { - sLog->outError("Error creating corpse for Player %s [%u]", GetName().c_str(), GetGUIDLow()); + LOG_ERROR("server", "Error creating corpse for Player %s [%u]", GetName().c_str(), GetGUIDLow()); return; } GetMap()->AddToMap(corpse); - - // convert player body to ghost - SetHealth(1); - + SetHealth(1); // convert player body to ghost SetMovement(MOVE_WATER_WALK); + SetWaterWalking(true); if (!GetSession()->isLogingOut()) + { SetMovement(MOVE_UNROOT); - - // BG - remove insignia related - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); - + } + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // BG - remove insignia related int32 corpseReclaimDelay = CalculateCorpseReclaimDelay(); - if (corpseReclaimDelay >= 0) + { SendCorpseReclaimDelay(corpseReclaimDelay); - - // to prevent cheating - corpse->ResetGhostTime(); - - StopMirrorTimers(); //disable timers(bars) - - // set and clear other - SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND); - + } + corpse->ResetGhostTime(); // to prevent cheating + StopMirrorTimers(); // disable timers on bars + SetByteValue(UNIT_FIELD_BYTES_1, UNIT_BYTES_1_OFFSET_ANIM_TIER, UNIT_BYTE1_FLAG_ALWAYS_STAND); // set and clear other sScriptMgr->OnPlayerReleasedGhost(this); } @@ -5315,12 +5287,9 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_REFER_A_FRIEND); setDeathState(ALIVE); - SetMovement(MOVE_LAND_WALK); SetMovement(MOVE_UNROOT); - SetWaterWalking(false); - m_deathTimer = 0; // set health/powers (0- will be set in caller) @@ -5653,7 +5622,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if (!dcost) { - sLog->outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); + LOG_ERROR("server", "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); return TotalCost; } @@ -5661,7 +5630,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { - sLog->outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); + LOG_ERROR("server", "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); return TotalCost; } @@ -5678,7 +5647,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g if (GetGuildId() == 0) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("You are not member of a guild"); + LOG_DEBUG("server", "You are not member of a guild"); #endif return TotalCost; } @@ -5695,7 +5664,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g else if (!HasEnoughMoney(costs)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("You do not have enough money"); + LOG_DEBUG("server", "You do not have enough money"); #endif return TotalCost; } @@ -5815,8 +5784,8 @@ void Player::ClearChannelWatch() void Player::UpdateLocalChannels(uint32 newZone) { // pussywizard: mutex needed (tc changed opcode to THREAD UNSAFE) - static ACE_Thread_Mutex channelsLock; - ACORE_GUARD(ACE_Thread_Mutex, channelsLock); + static std::mutex channelsLock; + std::lock_guard guard(channelsLock); if (GetSession()->PlayerLoading() && !IsBeingTeleportedFar()) return; // The client handles it automatically after loading, but not after teleporting @@ -5908,7 +5877,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa { if (modGroup >= BASEMOD_END) { - sLog->outError("ERROR in HandleBaseModValue(): non existed BaseModGroup!"); + LOG_ERROR("server", "ERROR in HandleBaseModValue(): non existed BaseModGroup!"); return; } @@ -5948,7 +5917,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const { if (modGroup >= BASEMOD_END) { - sLog->outError("trial to access non existed BaseModGroup!"); + LOG_ERROR("server", "trial to access non existed BaseModGroup!"); return 0.0f; } @@ -5962,7 +5931,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const { if (modGroup >= BASEMOD_END) { - sLog->outError("wrong BaseModGroup in GetTotalBaseModValue()!"); + LOG_ERROR("server", "wrong BaseModGroup in GetTotalBaseModValue()!"); return 0.0f; } @@ -6339,7 +6308,7 @@ inline int SkillGainChance(uint32 SkillValue, uint32 GrayLevel, uint32 GreenLeve bool Player::UpdateCraftSkill(uint32 spellid) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "UpdateCraftSkill spellid %d", spellid); + LOG_DEBUG("entities.player.skills", "UpdateCraftSkill spellid %d", spellid); #endif SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellid); @@ -6373,7 +6342,7 @@ bool Player::UpdateCraftSkill(uint32 spellid) bool Player::UpdateGatherSkill(uint32 SkillId, uint32 SkillValue, uint32 RedLevel, uint32 Multiplicator) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "UpdateGatherSkill(SkillId %d SkillLevel %d RedLevel %d)", SkillId, SkillValue, RedLevel); + LOG_DEBUG("entities.player.skills", "UpdateGatherSkill(SkillId %d SkillLevel %d RedLevel %d)", SkillId, SkillValue, RedLevel); #endif uint32 gathering_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_GATHERING); @@ -6421,7 +6390,7 @@ float getProbabilityOfLevelUp(uint32 SkillValue) bool Player::UpdateFishingSkill() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "UpdateFishingSkill"); + LOG_DEBUG("entities.player.skills", "UpdateFishingSkill"); #endif uint32 SkillValue = GetPureSkillValue(SKILL_FISHING); @@ -6446,7 +6415,7 @@ static const size_t bonusSkillLevelsSize = sizeof(bonusSkillLevels) / sizeof(uin bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "UpdateSkillPro(SkillId %d, Chance %3.1f%%)", SkillId, Chance / 10.0f); + LOG_DEBUG("entities.player.skills", "UpdateSkillPro(SkillId %d, Chance %3.1f%%)", SkillId, Chance / 10.0f); #endif if (!SkillId) return false; @@ -6454,7 +6423,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) if (Chance <= 0) // speedup in 0 chance case { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f); + LOG_DEBUG("entities.player.skills", "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f); #endif return false; } @@ -6496,13 +6465,13 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) UpdateSkillEnchantments(SkillId, SkillValue, new_value); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL, SkillId); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% taken", Chance / 10.0f); + LOG_DEBUG("entities.player.skills", "Player::UpdateSkillPro Chance=%3.1f%% taken", Chance / 10.0f); #endif return true; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_SKILLS, "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f); + LOG_DEBUG("entities.player.skills", "Player::UpdateSkillPro Chance=%3.1f%% missed", Chance / 10.0f); #endif return false; } @@ -6520,7 +6489,7 @@ void Player::UpdateWeaponSkill(WeaponAttackType attType) if (GetShapeshiftForm() == FORM_TREE) return; // use weapon but not skill up - if (victim && victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN)) + if (victim && victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILL_GAINS)) return; uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON); @@ -6722,7 +6691,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id); if (!pSkill) { - sLog->outError("Skill not found in SkillLineStore: skill #%u", id); + LOG_ERROR("server", "Skill not found in SkillLineStore: skill #%u", id); return; } @@ -6888,7 +6857,7 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const void Player::SendActionButtons(uint32 state) const { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); + LOG_DEBUG("server", "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec); #endif WorldPacket data(SMSG_ACTION_BUTTONS, 1 + (MAX_ACTION_BUTTONS * 4)); @@ -6913,7 +6882,7 @@ void Player::SendActionButtons(uint32 state) const GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); + LOG_DEBUG("server", "Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec); #endif } @@ -6921,13 +6890,13 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) { if (button >= MAX_ACTION_BUTTONS) { - sLog->outError("Action %u not added into button %u for player %s: button must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTONS); + LOG_ERROR("server", "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTONS); return false; } if (action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - sLog->outError("Action %u not added into button %u for player %s: action must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTON_ACTION_VALUE); + LOG_ERROR("server", "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTON_ACTION_VALUE); return false; } @@ -6936,14 +6905,14 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellMgr->GetSpellInfo(action)) { - sLog->outError("Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName().c_str()); + LOG_ERROR("server", "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName().c_str()); return false; } if (!HasSpell(action)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::IsActionButtonDataValid Spell action %u not added into button %u for player %s: player don't known this spell", action, button, GetName().c_str()); + LOG_DEBUG("entities.player.loading", "Player::IsActionButtonDataValid Spell action %u not added into button %u for player %s: player don't known this spell", action, button, GetName().c_str()); #endif return false; } @@ -6951,7 +6920,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_ITEM: if (!sObjectMgr->GetItemTemplate(action)) { - sLog->outError("Item action %u not added into button %u for player %s: item not exist", action, button, GetName().c_str()); + LOG_ERROR("server", "Item action %u not added into button %u for player %s: item not exist", action, button, GetName().c_str()); return false; } break; @@ -6974,7 +6943,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type) ab.SetActionAndType(action, ActionButtonType(type)); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); + LOG_DEBUG("server", "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button); #endif return &ab; } @@ -6991,7 +6960,7 @@ void Player::removeActionButton(uint8 button) buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); + LOG_DEBUG("server", "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow()); #endif } @@ -7098,7 +7067,7 @@ void Player::CheckAreaExploreAndOutdoor() if (!areaEntry) { - sLog->outError("Player '%s' (%u) discovered unknown area (x: %f y: %f z: %f map: %u)", + LOG_ERROR("server", "Player '%s' (%u) discovered unknown area (x: %f y: %f z: %f map: %u)", GetName().c_str(), GetGUIDLow(), GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId()); return; } @@ -7108,7 +7077,7 @@ void Player::CheckAreaExploreAndOutdoor() if (offset >= PLAYER_EXPLORED_ZONES_SIZE) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outError("Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaEntry->flags, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE); + LOG_ERROR("server", "Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).", areaEntry->flags, GetPositionX(), GetPositionY(), offset, offset, PLAYER_EXPLORED_ZONES_SIZE); #endif return; } @@ -7155,7 +7124,7 @@ void Player::CheckAreaExploreAndOutdoor() SendExplorationExperience(areaId, XP); } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Player %u discovered a new area: %u", GetGUIDLow(), areaId); + LOG_DEBUG("server", "Player %u discovered a new area: %u", GetGUIDLow(), areaId); #endif } } @@ -7172,10 +7141,10 @@ TeamId Player::TeamIdForRace(uint8 race) case 7: return TEAM_ALLIANCE; } - sLog->outError("Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID); + LOG_ERROR("server", "Race (%u) has wrong teamid (%u) in DBC: wrong DBC files?", uint32(race), rEntry->TeamID); } else - sLog->outError("Race (%u) not found in DBC: wrong DBC files?", uint32(race)); + LOG_ERROR("server", "Race (%u) not found in DBC: wrong DBC files?", uint32(race)); return TEAM_ALLIANCE; } @@ -7934,7 +7903,7 @@ void Player::DuelComplete(DuelCompleteType type) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "Duel Complete %s %s", GetName().c_str(), duel->opponent->GetName().c_str()); + LOG_DEBUG("entities.unit", "Duel Complete %s %s", GetName().c_str(), duel->opponent->GetName().c_str()); #endif WorldPacket data(SMSG_DUEL_COMPLETE, (1)); @@ -8059,7 +8028,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("applying mods for item %u ", item->GetGUIDLow()); + LOG_DEBUG("server", "applying mods for item %u ", item->GetGUIDLow()); #endif uint8 attacktype = Player::GetAttackBySlot(slot); @@ -8079,7 +8048,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) ApplyEnchantment(item, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "_ApplyItemMods complete."); + LOG_DEBUG("entities.player.items", "_ApplyItemMods complete."); #endif } @@ -8622,7 +8591,7 @@ void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id); + LOG_DEBUG("server", "WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id); #endif CastSpell(this, spellInfo, true, item); @@ -8756,7 +8725,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { - sLog->outError("WORLD: unknown Item spellid %i", spellData.SpellId); + LOG_ERROR("server", "WORLD: unknown Item spellid %i", spellData.SpellId); continue; } @@ -8813,7 +8782,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { - sLog->outError("Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", + LOG_ERROR("server", "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", GetGUIDLow(), GetName().c_str(), pEnchant->ID, pEnchant->spellid[s]); continue; } @@ -8873,7 +8842,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id); if (!spellInfo) { - sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id); + LOG_ERROR("server", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id); SendEquipError(EQUIP_ERR_NONE, item, nullptr); return; } @@ -8906,7 +8875,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { - sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId); + LOG_ERROR("server", "Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId); continue; } @@ -8951,7 +8920,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { - sLog->outError("Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]); + LOG_ERROR("server", "Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]); continue; } @@ -8990,7 +8959,7 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 void Player::_RemoveAllItemMods() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "_RemoveAllItemMods start."); + LOG_DEBUG("entities.player.items", "_RemoveAllItemMods start."); #endif for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i) @@ -9035,14 +9004,14 @@ void Player::_RemoveAllItemMods() } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "_RemoveAllItemMods complete."); + LOG_DEBUG("entities.player.items", "_RemoveAllItemMods complete."); #endif } void Player::_ApplyAllItemMods() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "_ApplyAllItemMods start."); + LOG_DEBUG("entities.player.items", "_ApplyAllItemMods start."); #endif for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i) @@ -9088,7 +9057,7 @@ void Player::_ApplyAllItemMods() } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "_ApplyAllItemMods complete."); + LOG_DEBUG("entities.player.items", "_ApplyAllItemMods complete."); #endif } @@ -9217,12 +9186,12 @@ void Player::SendLoot(uint64 guid, LootType loot_type) PermissionTypes permission = ALL_PERMISSION; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_LOOT, "Player::SendLoot"); + LOG_DEBUG("loot", "Player::SendLoot"); #endif if (IS_GAMEOBJECT_GUID(guid)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_LOOT, "IS_GAMEOBJECT_GUID(guid)"); + LOG_DEBUG("loot", "IS_GAMEOBJECT_GUID(guid)"); #endif GameObject* go = GetMap()->GetGameObject(guid); @@ -9632,7 +9601,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(zoneid); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending SMSG_INIT_WORLD_STATES to Map: %u, Zone: %u", mapid, zoneid); + LOG_DEBUG("network", "Sending SMSG_INIT_WORLD_STATES to Map: %u, Zone: %u", mapid, zoneid); #endif WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (12 * 8))); @@ -10306,7 +10275,7 @@ uint32 Player::GetXPRestBonus(uint32 xp) SetRestBonus(GetRestBonus() - rested_bonus); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp + rested_bonus, rested_bonus, GetRestBonus()); + LOG_DEBUG("server", "Player gain %u xp (+ %u Rested Bonus). Rested points=%f", xp + rested_bonus, rested_bonus, GetRestBonus()); #endif return rested_bonus; } @@ -10339,7 +10308,7 @@ void Player::ResetPetTalents() CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - sLog->outError("Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + LOG_ERROR("server", "Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); return; } pet->resetTalents(); @@ -11402,7 +11371,7 @@ InventoryResult Player::CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 sl InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem, bool swap, uint32* no_space_count) const { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); + LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); #endif ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry); @@ -11894,7 +11863,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const continue; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); + LOG_DEBUG("entities.player.items", "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); #endif ItemTemplate const* pProto = pItem->GetTemplate(); @@ -12113,7 +12082,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool if (pItem) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount()); + LOG_DEBUG("entities.player.items", "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount()); #endif ItemTemplate const* pProto = pItem->GetTemplate(); if (pProto) @@ -12296,7 +12265,7 @@ InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const return EQUIP_ERR_OK; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUnequipItem slot = %u, item = %u, count = %u", pos, pItem->GetEntry(), pItem->GetCount()); + LOG_DEBUG("entities.player.items", "STORAGE: CanUnequipItem slot = %u, item = %u, count = %u", pos, pItem->GetEntry(), pItem->GetCount()); #endif ItemTemplate const* pProto = pItem->GetTemplate(); @@ -12338,7 +12307,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest uint32 count = pItem->GetCount(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); + LOG_DEBUG("entities.player.items", "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); #endif ItemTemplate const* pProto = pItem->GetTemplate(); if (!pProto) @@ -12355,7 +12324,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest uint8 pItemslot = pItem->GetSlot(); if (pItemslot >= CURRENCYTOKEN_SLOT_START && pItemslot < CURRENCYTOKEN_SLOT_END) { - sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!", + LOG_ERROR("server", "Possible hacking attempt: Player %s [guid: %u] tried to move token [guid: %u, entry: %u] out of the currency bag!", GetName().c_str(), GetGUIDLow(), pItem->GetGUIDLow(), pProto->ItemId); return EQUIP_ERR_ITEMS_CANT_BE_SWAPPED; } @@ -12524,7 +12493,7 @@ InventoryResult Player::CanUseItem(Item* pItem, bool not_loading) const if (pItem) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseItem item = %u", pItem->GetEntry()); + LOG_DEBUG("entities.player.items", "STORAGE: CanUseItem item = %u", pItem->GetEntry()); #endif if (!IsAlive() && not_loading) @@ -12708,7 +12677,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje InventoryResult Player::CanUseAmmo(uint32 item) const { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseAmmo item = %u", item); + LOG_DEBUG("entities.player.items", "STORAGE: CanUseAmmo item = %u", item); #endif if (!IsAlive()) return EQUIP_ERR_YOU_ARE_DEAD; @@ -12861,7 +12830,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool uint8 slot = pos & 255; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); + LOG_DEBUG("entities.player.items", "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); #endif Item* pItem2 = GetItemByPos(bag, slot); @@ -13002,7 +12971,7 @@ Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell); if (!spellProto) - sLog->outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); + LOG_ERROR("server", "Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell); else { m_weaponChangeTimer = spellProto->StartRecoveryTime; @@ -13138,7 +13107,7 @@ void Player::VisualizeItem(uint8 slot, Item* pItem) pItem->SetBinding(true); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); + LOG_DEBUG("entities.player.items", "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry()); #endif m_items[slot] = pItem; @@ -13165,7 +13134,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update, bool swap) if (pItem) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + LOG_DEBUG("entities.player.items", "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); #endif RemoveEnchantmentDurations(pItem); @@ -13278,7 +13247,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) if (pItem) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); + LOG_DEBUG("entities.player.items", "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); #endif // Also remove all contained items if the item is a bag. // This if () prevents item saving crashes if the condition for a bag to be empty before being destroyed was bypassed somehow. @@ -13377,7 +13346,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool unequip_check) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item = %u, count = %u", itemEntry, count); + LOG_DEBUG("entities.player.items", "STORAGE: DestroyItemCount item = %u, count = %u", itemEntry, count); #endif uint32 remcount = 0; @@ -13570,7 +13539,7 @@ void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool void Player::DestroyZoneLimitedItem(bool update, uint32 new_zone) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone); + LOG_DEBUG("entities.player.items", "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone); #endif // in inventory @@ -13604,7 +13573,7 @@ void Player::DestroyConjuredItems(bool update) // used when entering arena // destroys all conjured items #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyConjuredItems"); + LOG_DEBUG("entities.player.items", "STORAGE: DestroyConjuredItems"); #endif // in inventory @@ -13662,7 +13631,7 @@ void Player::DestroyItemCount(Item* pItem, uint32& count, bool update) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(), pItem->GetEntry(), count); + LOG_DEBUG("entities.player.items", "STORAGE: DestroyItemCount item (GUID: %u, Entry: %u) count = %u", pItem->GetGUIDLow(), pItem->GetEntry(), count); #endif if (pItem->GetCount() <= count) @@ -13727,7 +13696,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); + LOG_DEBUG("entities.player.items", "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); #endif Item* pNewItem = pSrcItem->CloneItem(count, this); if (!pNewItem) @@ -13814,7 +13783,7 @@ void Player::SwapItem(uint16 src, uint16 dst) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); + LOG_DEBUG("entities.player.items", "STORAGE: SwapItem bag = %u, slot = %u, item = %u", dstbag, dstslot, pSrcItem->GetEntry()); #endif if (!IsAlive()) @@ -14207,7 +14176,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) RemoveItemFromBuyBackSlot(slot, true); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); + LOG_DEBUG("entities.player.items", "STORAGE: AddItemToBuyBackSlot item = %u, slot = %u", pItem->GetEntry(), slot); #endif m_items[slot] = pItem; @@ -14231,7 +14200,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem) Item* Player::GetItemFromBuyBackSlot(uint32 slot) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); + LOG_DEBUG("entities.player.items", "STORAGE: GetItemFromBuyBackSlot slot = %u", slot); #endif if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) return m_items[slot]; @@ -14241,7 +14210,7 @@ Item* Player::GetItemFromBuyBackSlot(uint32 slot) void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); + LOG_DEBUG("entities.player.items", "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); #endif if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) { @@ -14269,7 +14238,7 @@ void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint32 itemid) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); + LOG_DEBUG("network", "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); #endif WorldPacket data(SMSG_INVENTORY_CHANGE_FAILURE, (msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I ? 22 : 18)); data << uint8(msg); @@ -14314,7 +14283,7 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_BUY_FAILED"); + LOG_DEBUG("network", "WORLD: Sent SMSG_BUY_FAILED"); #endif WorldPacket data(SMSG_BUY_FAILED, (8 + 4 + 4 + 1)); data << uint64(creature ? creature->GetGUID() : 0); @@ -14328,7 +14297,7 @@ void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 void Player::SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_SELL_ITEM"); + LOG_DEBUG("network", "WORLD: Sent SMSG_SELL_ITEM"); #endif WorldPacket data(SMSG_SELL_ITEM, (8 + 8 + (param ? 4 : 0) + 1)); // last check 2.0.10 data << uint64(creature ? creature->GetGUID() : 0); @@ -14361,7 +14330,7 @@ void Player::TradeCancel(bool sendback) void Player::UpdateSoulboundTradeItems() { - ACORE_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock); + std::lock_guard guard(m_soulboundTradableLock); if (m_itemSoulboundTradeable.empty()) return; @@ -14385,14 +14354,14 @@ void Player::UpdateSoulboundTradeItems() void Player::AddTradeableItem(Item* item) { - ACORE_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock); + std::lock_guard guard(m_soulboundTradableLock); m_itemSoulboundTradeable.push_back(item); } //TODO: should never allow an item to be added to m_itemSoulboundTradeable twice void Player::RemoveTradeableItem(Item* item) { - ACORE_GUARD(ACE_Thread_Mutex, m_soulboundTradableLock); + std::lock_guard guard(m_soulboundTradableLock); m_itemSoulboundTradeable.remove(item); } @@ -14402,7 +14371,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Player::UpdateItemDuration(%u, %u)", time, realtimeonly); + LOG_DEBUG("entities.player.items", "Player::UpdateItemDuration(%u, %u)", time, realtimeonly); #endif for (ItemDurationList::const_iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end();) @@ -14690,53 +14659,53 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Adding %u to stat nb %u", enchant_amount, enchant_spell_id); + LOG_DEBUG("entities.player.items", "Adding %u to stat nb %u", enchant_amount, enchant_spell_id); #endif switch (enchant_spell_id) { case ITEM_MOD_MANA: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u MANA", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u MANA", enchant_amount); #endif HandleStatModifier(UNIT_MOD_MANA, BASE_VALUE, float(enchant_amount), apply); break; case ITEM_MOD_HEALTH: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u HEALTH", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u HEALTH", enchant_amount); #endif HandleStatModifier(UNIT_MOD_HEALTH, BASE_VALUE, float(enchant_amount), apply); break; case ITEM_MOD_AGILITY: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u AGILITY", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u AGILITY", enchant_amount); #endif HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_AGILITY, (float)enchant_amount, apply); break; case ITEM_MOD_STRENGTH: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u STRENGTH", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u STRENGTH", enchant_amount); #endif HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_STRENGTH, (float)enchant_amount, apply); break; case ITEM_MOD_INTELLECT: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u INTELLECT", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u INTELLECT", enchant_amount); #endif HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_INTELLECT, (float)enchant_amount, apply); break; case ITEM_MOD_SPIRIT: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u SPIRIT", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u SPIRIT", enchant_amount); #endif HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_SPIRIT, (float)enchant_amount, apply); break; case ITEM_MOD_STAMINA: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u STAMINA", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u STAMINA", enchant_amount); #endif HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply); ApplyStatBuffMod(STAT_STAMINA, (float)enchant_amount, apply); @@ -14744,61 +14713,61 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool case ITEM_MOD_DEFENSE_SKILL_RATING: ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u DEFENCE", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u DEFENCE", enchant_amount); #endif break; case ITEM_MOD_DODGE_RATING: ApplyRatingMod(CR_DODGE, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u DODGE", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u DODGE", enchant_amount); #endif break; case ITEM_MOD_PARRY_RATING: ApplyRatingMod(CR_PARRY, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u PARRY", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u PARRY", enchant_amount); #endif break; case ITEM_MOD_BLOCK_RATING: ApplyRatingMod(CR_BLOCK, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u SHIELD_BLOCK", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u SHIELD_BLOCK", enchant_amount); #endif break; case ITEM_MOD_HIT_MELEE_RATING: ApplyRatingMod(CR_HIT_MELEE, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u MELEE_HIT", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u MELEE_HIT", enchant_amount); #endif break; case ITEM_MOD_HIT_RANGED_RATING: ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u RANGED_HIT", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u RANGED_HIT", enchant_amount); #endif break; case ITEM_MOD_HIT_SPELL_RATING: ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_HIT", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u SPELL_HIT", enchant_amount); #endif break; case ITEM_MOD_CRIT_MELEE_RATING: ApplyRatingMod(CR_CRIT_MELEE, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u MELEE_CRIT", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u MELEE_CRIT", enchant_amount); #endif break; case ITEM_MOD_CRIT_RANGED_RATING: ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u RANGED_CRIT", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u RANGED_CRIT", enchant_amount); #endif break; case ITEM_MOD_CRIT_SPELL_RATING: ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_CRIT", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u SPELL_CRIT", enchant_amount); #endif break; // Values from ITEM_STAT_MELEE_HA_RATING to ITEM_MOD_HASTE_RANGED_RATING are never used @@ -14835,7 +14804,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool ApplyRatingMod(CR_HIT_RANGED, enchant_amount, apply); ApplyRatingMod(CR_HIT_SPELL, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u HIT", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u HIT", enchant_amount); #endif break; case ITEM_MOD_CRIT_RATING: @@ -14843,7 +14812,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool ApplyRatingMod(CR_CRIT_RANGED, enchant_amount, apply); ApplyRatingMod(CR_CRIT_SPELL, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u CRITICAL", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u CRITICAL", enchant_amount); #endif break; // Values ITEM_MOD_HIT_TAKEN_RATING and ITEM_MOD_CRIT_TAKEN_RATING are never used in Enchantment @@ -14862,7 +14831,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool ApplyRatingMod(CR_CRIT_TAKEN_RANGED, enchant_amount, apply); ApplyRatingMod(CR_CRIT_TAKEN_SPELL, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u RESILIENCE", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u RESILIENCE", enchant_amount); #endif break; case ITEM_MOD_HASTE_RATING: @@ -14870,68 +14839,68 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool ApplyRatingMod(CR_HASTE_RANGED, enchant_amount, apply); ApplyRatingMod(CR_HASTE_SPELL, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u HASTE", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u HASTE", enchant_amount); #endif break; case ITEM_MOD_EXPERTISE_RATING: ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u EXPERTISE", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u EXPERTISE", enchant_amount); #endif break; case ITEM_MOD_ATTACK_POWER: HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(enchant_amount), apply); HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u ATTACK_POWER", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u ATTACK_POWER", enchant_amount); #endif break; case ITEM_MOD_RANGED_ATTACK_POWER: HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u RANGED_ATTACK_POWER", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u RANGED_ATTACK_POWER", enchant_amount); #endif break; // case ITEM_MOD_FERAL_ATTACK_POWER: // ApplyFeralAPBonus(enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - // sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u FERAL_ATTACK_POWER", enchant_amount); + // LOG_DEBUG("entities.player.items", "+ %u FERAL_ATTACK_POWER", enchant_amount); #endif // break; case ITEM_MOD_MANA_REGENERATION: ApplyManaRegenBonus(enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u MANA_REGENERATION", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u MANA_REGENERATION", enchant_amount); #endif break; case ITEM_MOD_ARMOR_PENETRATION_RATING: ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u ARMOR PENETRATION", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u ARMOR PENETRATION", enchant_amount); #endif break; case ITEM_MOD_SPELL_POWER: ApplySpellPowerBonus(enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_POWER", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u SPELL_POWER", enchant_amount); #endif break; case ITEM_MOD_HEALTH_REGEN: ApplyHealthRegenBonus(enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u HEALTH_REGENERATION", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u HEALTH_REGENERATION", enchant_amount); #endif break; case ITEM_MOD_SPELL_PENETRATION: ApplySpellPenetrationBonus(enchant_amount, apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u SPELL_PENETRATION", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u SPELL_PENETRATION", enchant_amount); #endif break; case ITEM_MOD_BLOCK_VALUE: HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(enchant_amount), apply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "+ %u BLOCK_VALUE", enchant_amount); + LOG_DEBUG("entities.player.items", "+ %u BLOCK_VALUE", enchant_amount); #endif break; case ITEM_MOD_SPELL_HEALING_DONE: // deprecated @@ -14966,7 +14935,7 @@ void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool // nothing do.. break; default: - sLog->outError("Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type); + LOG_ERROR("server", "Unknown item enchantment (id = %d) display type: %d", enchant_id, enchant_display_type); break; } /*switch (enchant_display_type)*/ } /*for*/ @@ -15137,7 +15106,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool VendorItemData const* vendorItems = itr->second.ActionMenuID ? sObjectMgr->GetNpcVendorItemList(itr->second.ActionMenuID) : creature->GetVendorItems(); if (!vendorItems || vendorItems->Empty()) { - sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry()); + LOG_ERROR("sql.sql", "Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry()); canTalk = false; } break; @@ -15189,7 +15158,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool canTalk = false; break; default: - sLog->outErrorDb("Creature entry %u has unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuID); + LOG_ERROR("sql.sql", "Creature entry %u has unknown gossip option %u for menu %u", creature->GetEntry(), itr->second.OptionType, itr->second.MenuID); canTalk = false; break; } @@ -15321,7 +15290,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men { if (gossipOptionId > GOSSIP_OPTION_QUESTGIVER) { - sLog->outError("Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry()); + LOG_ERROR("server", "Player guid %u request invalid gossip option for GameObject entry %u", GetGUIDLow(), source->GetEntry()); return; } } @@ -15426,7 +15395,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men if (bgTypeId == BATTLEGROUND_TYPE_NONE) { - sLog->outError("a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow()); + LOG_ERROR("server", "a user (guid %u) requested battlegroundlist from a npc who is no battlemaster", GetGUIDLow()); return; } @@ -16427,7 +16396,7 @@ bool Player::SatisfyQuestLog(bool msg) WorldPacket data(SMSG_QUESTLOG_FULL, 0); GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTLOG_FULL"); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTLOG_FULL"); #endif } return false; @@ -16601,7 +16570,7 @@ bool Player::SatisfyQuestConditions(Quest const* qInfo, bool msg) if (msg) SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "Player::SatisfyQuestConditions: conditions not met for quest %u", qInfo->GetQuestId()); + LOG_DEBUG("condition", "Player::SatisfyQuestConditions: conditions not met for quest %u", qInfo->GetQuestId()); #endif return false; } @@ -17688,7 +17657,7 @@ void Player::SendQuestComplete(uint32 quest_id) data << uint32(quest_id); GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_COMPLETE quest = %u", quest_id); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_COMPLETE quest = %u", quest_id); #endif } } @@ -17697,7 +17666,7 @@ void Player::SendQuestReward(Quest const* quest, uint32 XP) { uint32 questid = quest->GetQuestId(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid); #endif sGameEventMgr->HandleQuestComplete(questid); WorldPacket data(SMSG_QUESTGIVER_QUEST_COMPLETE, (4 + 4 + 4 + 4 + 4)); @@ -17729,7 +17698,7 @@ void Player::SendQuestFailed(uint32 questId, InventoryResult reason) data << uint32(reason); // failed reason (valid reasons: 4, 16, 50, 17, 74, other values show default message) GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED"); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED"); #endif } } @@ -17742,7 +17711,7 @@ void Player::SendQuestTimerFailed(uint32 quest_id) data << uint32(quest_id); GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_FAILEDTIMER"); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_FAILEDTIMER"); #endif } } @@ -17753,7 +17722,7 @@ void Player::SendCanTakeQuestResponse(uint32 msg) const data << uint32(msg); GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_INVALID"); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTGIVER_QUEST_INVALID"); #endif } @@ -17776,7 +17745,7 @@ void Player::SendQuestConfirmAccept(const Quest* quest, Player* pReceiver) pReceiver->GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUEST_CONFIRM_ACCEPT"); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_CONFIRM_ACCEPT"); #endif } } @@ -17790,7 +17759,7 @@ void Player::SendPushToPartyResponse(Player const* player, uint8 msg) const data << uint8(msg); // valid values: 0-8 GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent MSG_QUEST_PUSH_RESULT"); + LOG_DEBUG("network", "WORLD: Sent MSG_QUEST_PUSH_RESULT"); #endif } } @@ -17799,7 +17768,7 @@ void Player::SendQuestUpdateAddItem(Quest const* /*quest*/, uint32 /*item_idx*/, { WorldPacket data(SMSG_QUESTUPDATE_ADD_ITEM, 0); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM"); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_ITEM"); #endif //data << quest->RequiredItemId[item_idx]; //data << count; @@ -17817,7 +17786,7 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* quest, uint64 guid, uin WorldPacket data(SMSG_QUESTUPDATE_ADD_KILL, (4 * 4 + 8)); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_ADD_KILL"); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_KILL"); #endif data << uint32(quest->GetQuestId()); data << uint32(entry); @@ -17837,7 +17806,7 @@ void Player::SendQuestUpdateAddPlayer(Quest const* quest, uint16 old_count, uint WorldPacket data(SMSG_QUESTUPDATE_ADD_PVP_KILL, (3 * 4)); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_ADD_PVP_KILL"); + LOG_DEBUG("network", "WORLD: Sent SMSG_QUESTUPDATE_ADD_PVP_KILL"); #endif data << uint32(quest->GetQuestId()); data << uint32(old_count + add_count); @@ -18051,7 +18020,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) if (!result) { - sLog->outError("Player (GUID: %u) not found in table `characters`, can't load. ", guid); + LOG_ERROR("server", "Player (GUID: %u) not found in table `characters`, can't load. ", guid); return false; } @@ -18063,13 +18032,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) // player should be able to load/delete character only with correct account! if (dbAccountId != GetSession()->GetAccountId()) { - sLog->outError("Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId); + LOG_ERROR("server", "Player (GUID: %u) loading from wrong account (is: %u, should be: %u)", guid, GetSession()->GetAccountId(), dbAccountId); return false; } if (holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BANNED)) { - sLog->outError("Player (GUID: %u) is banned, can't load.", guid); + LOG_ERROR("server", "Player (GUID: %u) is banned, can't load.", guid); return false; } @@ -18094,7 +18063,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) uint8 Gender = fields[5].GetUInt8(); if (!IsValidGender(Gender)) { - sLog->outError("Player (GUID: %u) has wrong gender (%u), can't be loaded.", guid, Gender); + LOG_ERROR("server", "Player (GUID: %u) has wrong gender (%u), can't be loaded.", guid, Gender); return false; } @@ -18157,7 +18126,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Load Basic value of player %s is: ", m_name.c_str()); + LOG_DEBUG("entities.player.loading", "Load Basic value of player %s is: ", m_name.c_str()); #endif outDebugValues(); @@ -18234,7 +18203,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) if (!mapEntry || !IsPositionValid()) { - sLog->outError("Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + LOG_ERROR("server", "Player (guidlow %d) have invalid coordinates (MapId: %u X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); RelocateToHomebind(); } // Player was saved in Arena or Bg @@ -18340,7 +18309,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) if (GetSession()->Expansion() < mapEntry->Expansion()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player %s using client without required expansion tried login at non accessible map %u", GetName().c_str(), mapId); + LOG_DEBUG("entities.player.loading", "Player %s using client without required expansion tried login at non accessible map %u", GetName().c_str(), mapId); #endif RelocateToHomebind(); } @@ -18374,13 +18343,13 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) AreaTriggerTeleport const* at = sObjectMgr->GetGoBackTrigger(mapId); if (at) { - sLog->outError("Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + LOG_ERROR("server", "Player (guidlow %d) is teleported to gobacktrigger (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); Relocate(at->target_X, at->target_Y, at->target_Z, GetOrientation()); mapId = at->target_mapId; } else { - sLog->outError("Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + LOG_ERROR("server", "Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).", guid, mapId, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); RelocateToHomebind(); } @@ -18390,11 +18359,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); mapId = info->mapId; Relocate(info->positionX, info->positionY, info->positionZ, 0.0f); - sLog->outError("Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + LOG_ERROR("server", "Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); map = sMapMgr->CreateMap(mapId, this); if (!map) { - sLog->outError("Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); + LOG_ERROR("server", "Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); return false; } } @@ -18437,7 +18406,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) m_stableSlots = fields[37].GetUInt8(); if (m_stableSlots > MAX_PET_STABLES) { - sLog->outError("Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots)); + LOG_ERROR("server", "Player can have not more %u stable slots, but have in DB %u", MAX_PET_STABLES, uint32(m_stableSlots)); m_stableSlots = MAX_PET_STABLES; } @@ -18445,7 +18414,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) if (HasAtLoginFlag(AT_LOGIN_RENAME)) { - sLog->outError("Player (GUID: %u) tried to login while forced to rename, can't load.'", GetGUIDLow()); + LOG_ERROR("server", "Player (GUID: %u) tried to login while forced to rename, can't load.'", GetGUIDLow()); return false; } @@ -18599,7 +18568,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder* holder) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "The value of player %s after load item and aura is: ", m_name.c_str()); + LOG_DEBUG("entities.player.loading", "The value of player %s after load item and aura is: ", m_name.c_str()); #endif outDebugValues(); @@ -18781,7 +18750,7 @@ void Player::_LoadActions(PreparedQueryResult result) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outError("ActionButton loading problem, will be deleted from db..."); + LOG_ERROR("server", "ActionButton loading problem, will be deleted from db..."); #endif // Will deleted in DB at next save (it can create data until save but marked as deleted) @@ -18794,7 +18763,7 @@ void Player::_LoadActions(PreparedQueryResult result) void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Loading auras for player %u", GetGUIDLow()); + LOG_DEBUG("entities.player.loading", "Loading auras for player %u", GetGUIDLow()); #endif /* 0 1 2 3 4 5 6 7 8 9 10 @@ -18828,7 +18797,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { - sLog->outError("Unknown aura (spellid %u), ignore.", spellid); + LOG_ERROR("server", "Unknown aura (spellid %u), ignore.", spellid); continue; } @@ -18870,7 +18839,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]); aura->ApplyForTargets(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); + LOG_DEBUG("server", "Added aura spellid %u, effectmask %u", spellInfo->Id, effmask); #endif } } while (result->NextRow()); @@ -18895,13 +18864,13 @@ void Player::_LoadGlyphAuras() continue; } else - sLog->outError("Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), glyphEntry->TypeFlags, glyphSlotEntry->TypeFlags); + LOG_ERROR("server", "Player %s has glyph with typeflags %u in slot with typeflags %u, removing.", m_name.c_str(), glyphEntry->TypeFlags, glyphSlotEntry->TypeFlags); } else - sLog->outError("Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i); + LOG_ERROR("server", "Player %s has not existing glyph slot entry %u on index %u", m_name.c_str(), GetGlyphSlot(i), i); } else - sLog->outError("Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i); + LOG_ERROR("server", "Player %s has not existing glyph entry %u on index %u", m_name.c_str(), glyph, i); // On any error remove glyph SetGlyph(i, 0, true); @@ -19011,7 +18980,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) } else { - sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?", + LOG_ERROR("server", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which doesnt have a valid bag (Bag GUID: %u, slot: %u). Possible cheat?", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot); item->DeleteFromInventoryDB(trans); delete item; @@ -19024,7 +18993,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) item->SetState(ITEM_UNCHANGED, this); else { - sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which can't be loaded into inventory (Bag GUID: %u, slot: %u) by reason %u. Item will be sent by mail.", + LOG_ERROR("server", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) which can't be loaded into inventory (Bag GUID: %u, slot: %u) by reason %u. Item will be sent by mail.", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), bagGuid, slot, err); item->DeleteFromInventoryDB(trans); problematicItems.push_back(item); @@ -19070,7 +19039,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F if (IsAlive() && item->IsLimitedToAnotherMapOrZone(GetMapId(), zoneId)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s', map: %u) has item (GUID: %u, entry: %u) limited to another map (%u). Deleting item.", + LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s', map: %u) has item (GUID: %u, entry: %u) limited to another map (%u). Deleting item.", GetGUIDLow(), GetName().c_str(), GetMapId(), item->GetGUIDLow(), item->GetEntry(), zoneId); #endif remove = true; @@ -19079,7 +19048,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F else if (timeDiff > 15 * MINUTE && proto->Flags & ITEM_FLAG_CONJURED) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s', diff: %u) has conjured item (GUID: %u, entry: %u) with expired lifetime (15 minutes). Deleting item.", + LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s', diff: %u) has conjured item (GUID: %u, entry: %u) with expired lifetime (15 minutes). Deleting item.", GetGUIDLow(), GetName().c_str(), timeDiff, item->GetGUIDLow(), item->GetEntry()); #endif remove = true; @@ -19089,7 +19058,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F if (item->GetPlayedTime() > (2 * HOUR)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with expired refund time (%u). Deleting refund data and removing refundable flag.", + LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with expired refund time (%u). Deleting refund data and removing refundable flag.", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry(), item->GetPlayedTime()); #endif stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_REFUND_INSTANCE); @@ -19114,7 +19083,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with refundable flags, but without data in item_refund_instance. Removing flag.", + LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with refundable flags, but without data in item_refund_instance. Removing flag.", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry()); #endif item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE); @@ -19144,7 +19113,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with ITEM_FIELD_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.", + LOG_DEBUG("entities.player.loading", "Player::_LoadInventory: player (GUID: %u, name: '%s') has item (GUID: %u, entry: %u) with ITEM_FIELD_FLAG_BOP_TRADEABLE flag, but without data in item_soulbound_trade_data. Removing flag.", GetGUIDLow(), GetName().c_str(), item->GetGUIDLow(), item->GetEntry()); #endif item->RemoveFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE); @@ -19167,7 +19136,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.", + LOG_ERROR("server", "Player::_LoadInventory: player (GUID: %u, name: '%s') has broken item (GUID: %u, entry: %u) in inventory. Deleting item.", GetGUIDLow(), GetName().c_str(), itemGuid, itemEntry); remove = true; } @@ -19182,7 +19151,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } else { - sLog->outError("Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.", + LOG_ERROR("server", "Player::_LoadInventory: player (GUID: %u, name: '%s') has unknown item (entry: %u) in inventory. Deleting item.", GetGUIDLow(), GetName().c_str(), itemEntry); Item::DeleteFromInventoryDB(trans, itemGuid); Item::DeleteFromDB(trans, itemGuid); @@ -19213,7 +19182,7 @@ void Player::_LoadMailedItems(Mail* mail) if (!proto) { - sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID); + LOG_ERROR("server", "Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM); stmt->setUInt32(0, itemGuid); @@ -19229,7 +19198,7 @@ void Player::_LoadMailedItems(Mail* mail) if (!item->LoadFromDB(itemGuid, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, itemTemplate)) { - sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid); + LOG_ERROR("server", "Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid); stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); stmt->setUInt32(0, itemGuid); @@ -19323,7 +19292,7 @@ void Player::_LoadMail() if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId)) { - sLog->outError("Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); + LOG_ERROR("server", "Player::_LoadMail - Mail (%u) have not existed MailTemplateId (%u), remove at load", m->messageID, m->mailTemplateId); m->mailTemplateId = 0; } @@ -19377,7 +19346,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) else { questStatusData.Status = QUEST_STATUS_INCOMPLETE; - sLog->outError("Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", + LOG_ERROR("server", "Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", GetName().c_str(), GetGUIDLow(), quest_id, qstatus); } @@ -19426,7 +19395,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.Status, quest_id, GetGUIDLow()); + LOG_DEBUG("entities.player.loading", "Quest status is {%u} for quest {%u} for player (GUID: %u)", questStatusData.Status, quest_id, GetGUIDLow()); #endif } } while (result->NextRow()); @@ -19500,7 +19469,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result) if (quest_daily_idx >= PLAYER_MAX_DAILY_QUESTS) // max amount with exist data in query { - sLog->outError("Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow()); + LOG_ERROR("server", "Player (GUID: %u) have more 25 daily quest records in `charcter_queststatus_daily`", GetGUIDLow()); break; } @@ -19517,7 +19486,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result) ++quest_daily_idx; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Daily quest (%u) cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); + LOG_DEBUG("entities.player.loading", "Daily quest (%u) cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); #endif } while (result->NextRow()); } @@ -19541,7 +19510,7 @@ void Player::_LoadWeeklyQuestStatus(PreparedQueryResult result) m_weeklyquests.insert(quest_id); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Weekly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); + LOG_DEBUG("entities.player.loading", "Weekly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); #endif } while (result->NextRow()); } @@ -19566,7 +19535,7 @@ void Player::_LoadSeasonalQuestStatus(PreparedQueryResult result) m_seasonalquests[event_id].insert(quest_id); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Seasonal quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); + LOG_DEBUG("entities.player.loading", "Seasonal quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); #endif } while (result->NextRow()); } @@ -19589,7 +19558,7 @@ void Player::_LoadMonthlyQuestStatus(PreparedQueryResult result) continue; m_monthlyquests.insert(quest_id); - sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Monthly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); + LOG_DEBUG("entities.player.loading", "Monthly quest {%u} cooldown for player (GUID: %u)", quest_id, GetGUIDLow()); } while (result->NextRow()); } @@ -20105,7 +20074,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); if (!info) { - sLog->outError("Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName().c_str()); + LOG_ERROR("server", "Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName().c_str()); return false; } @@ -20154,7 +20123,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f", + LOG_DEBUG("server", "Setting player home position - mapid: %u, areaid: %u, X: %f, Y: %f, Z: %f", m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ); #endif return true; @@ -20184,7 +20153,7 @@ void Player::SaveToDB(bool create, bool logout) UpdateHonorFields(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "The value of player %s at save: ", m_name.c_str()); + LOG_DEBUG("entities.unit", "The value of player %s at save: ", m_name.c_str()); #endif outDebugValues(); @@ -20413,7 +20382,7 @@ void Player::_SaveInventory(SQLTransaction& trans) } else { - sLog->outError("Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow()); + LOG_ERROR("server", "Can't find item guid %u but is in refundable storage for player %u ! Removing.", *itr, GetGUIDLow()); m_refundableItems.erase(itr); } } @@ -20444,7 +20413,7 @@ void Player::_SaveInventory(SQLTransaction& trans) uint32 bagTestGUID = 0; if (Item* test2 = GetItemByPos(INVENTORY_SLOT_BAG_0, item->GetBagSlot())) bagTestGUID = test2->GetGUIDLow(); - sLog->outError("Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState()); + LOG_ERROR("server", "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u (state %d) are incorrect, the player doesn't have an item at that position!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), (int32)item->GetState()); // according to the test that was just performed nothing should be in this slot, delete stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_BY_BAG_SLOT); stmt->setUInt32(0, bagTestGUID); @@ -20464,7 +20433,7 @@ void Player::_SaveInventory(SQLTransaction& trans) } else if (test != item) { - sLog->outError("Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); + LOG_ERROR("server", "Player(GUID: %u Name: %s)::_SaveInventory - the bag(%u) and slot(%u) values for the item with guid %u are incorrect, the item with guid %u is there instead!", lowGuid, GetName().c_str(), item->GetBagSlot(), item->GetSlot(), item->GetGUIDLow(), test->GetGUIDLow()); // save all changes to the item... if (item->GetState() != ITEM_NEW) // only for existing items, no dupes item->SaveToDB(trans); @@ -20898,22 +20867,22 @@ void Player::_SaveStats(SQLTransaction& trans) void Player::outDebugValues() const { - if (!sLog->IsOutDebug()) // optimize disabled debug output + if (!sLog->ShouldLog("entities.player", LogLevel::LOG_LEVEL_DEBUG)) // optimize disabled debug output return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "HP is: \t\t\t%u\t\tMP is: \t\t\t%u", GetMaxHealth(), GetMaxPower(POWER_MANA)); - sLog->outDebug(LOG_FILTER_UNITS, "AGILITY is: \t\t%f\t\tSTRENGTH is: \t\t%f", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH)); - sLog->outDebug(LOG_FILTER_UNITS, "INTELLECT is: \t\t%f\t\tSPIRIT is: \t\t%f", GetStat(STAT_INTELLECT), GetStat(STAT_SPIRIT)); - sLog->outDebug(LOG_FILTER_UNITS, "STAMINA is: \t\t%f", GetStat(STAT_STAMINA)); - sLog->outDebug(LOG_FILTER_UNITS, "Armor is: \t\t%u\t\tBlock is: \t\t%f", GetArmor(), GetFloatValue(PLAYER_BLOCK_PERCENTAGE)); - sLog->outDebug(LOG_FILTER_UNITS, "HolyRes is: \t\t%u\t\tFireRes is: \t\t%u", GetResistance(SPELL_SCHOOL_HOLY), GetResistance(SPELL_SCHOOL_FIRE)); - sLog->outDebug(LOG_FILTER_UNITS, "NatureRes is: \t\t%u\t\tFrostRes is: \t\t%u", GetResistance(SPELL_SCHOOL_NATURE), GetResistance(SPELL_SCHOOL_FROST)); - sLog->outDebug(LOG_FILTER_UNITS, "ShadowRes is: \t\t%u\t\tArcaneRes is: \t\t%u", GetResistance(SPELL_SCHOOL_SHADOW), GetResistance(SPELL_SCHOOL_ARCANE)); - sLog->outDebug(LOG_FILTER_UNITS, "MIN_DAMAGE is: \t\t%f\tMAX_DAMAGE is: \t\t%f", GetFloatValue(UNIT_FIELD_MINDAMAGE), GetFloatValue(UNIT_FIELD_MAXDAMAGE)); - sLog->outDebug(LOG_FILTER_UNITS, "MIN_OFFHAND_DAMAGE is: \t%f\tMAX_OFFHAND_DAMAGE is: \t%f", GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE), GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE)); - sLog->outDebug(LOG_FILTER_UNITS, "MIN_RANGED_DAMAGE is: \t%f\tMAX_RANGED_DAMAGE is: \t%f", GetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE), GetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE)); - sLog->outDebug(LOG_FILTER_UNITS, "ATTACK_TIME is: \t%u\t\tRANGE_ATTACK_TIME is: \t%u", GetAttackTime(BASE_ATTACK), GetAttackTime(RANGED_ATTACK)); + LOG_DEBUG("entities.player", "HP is: \t\t\t%u\t\tMP is: \t\t\t%u", GetMaxHealth(), GetMaxPower(POWER_MANA)); + LOG_DEBUG("entities.player", "AGILITY is: \t\t%f\t\tSTRENGTH is: \t\t%f", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH)); + LOG_DEBUG("entities.player", "INTELLECT is: \t\t%f\t\tSPIRIT is: \t\t%f", GetStat(STAT_INTELLECT), GetStat(STAT_SPIRIT)); + LOG_DEBUG("entities.player", "STAMINA is: \t\t%f", GetStat(STAT_STAMINA)); + LOG_DEBUG("entities.player", "Armor is: \t\t%u\t\tBlock is: \t\t%f", GetArmor(), GetFloatValue(PLAYER_BLOCK_PERCENTAGE)); + LOG_DEBUG("entities.player", "HolyRes is: \t\t%u\t\tFireRes is: \t\t%u", GetResistance(SPELL_SCHOOL_HOLY), GetResistance(SPELL_SCHOOL_FIRE)); + LOG_DEBUG("entities.player", "NatureRes is: \t\t%u\t\tFrostRes is: \t\t%u", GetResistance(SPELL_SCHOOL_NATURE), GetResistance(SPELL_SCHOOL_FROST)); + LOG_DEBUG("entities.player", "ShadowRes is: \t\t%u\t\tArcaneRes is: \t\t%u", GetResistance(SPELL_SCHOOL_SHADOW), GetResistance(SPELL_SCHOOL_ARCANE)); + LOG_DEBUG("entities.player", "MIN_DAMAGE is: \t\t%f\tMAX_DAMAGE is: \t\t%f", GetFloatValue(UNIT_FIELD_MINDAMAGE), GetFloatValue(UNIT_FIELD_MAXDAMAGE)); + LOG_DEBUG("entities.player", "MIN_OFFHAND_DAMAGE is: \t%f\tMAX_OFFHAND_DAMAGE is: \t%f", GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE), GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE)); + LOG_DEBUG("entities.player", "MIN_RANGED_DAMAGE is: \t%f\tMAX_RANGED_DAMAGE is: \t%f", GetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE), GetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE)); + LOG_DEBUG("entities.player", "ATTACK_TIME is: \t%u\t\tRANGE_ATTACK_TIME is: \t%u", GetAttackTime(BASE_ATTACK), GetAttackTime(RANGED_ATTACK)); #endif } @@ -21316,7 +21285,7 @@ Pet* Player::GetPet() const return pet; //there may be a guardian in slot - //sLog->outError("Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid)); + //LOG_ERROR("server", "Player::GetPet: Pet %u not exist.", GUID_LOPART(pet_guid)); //const_cast(this)->SetPetGUID(0); } @@ -21338,7 +21307,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PETS, "RemovePet %u, %u, %u", pet->GetEntry(), mode, returnreagent); + LOG_DEBUG("entities.pet", "RemovePet %u, %u, %u", pet->GetEntry(), mode, returnreagent); #endif if (pet->m_removed) return; @@ -21418,10 +21387,10 @@ void Player::StopCastingCharm() if (GetCharmGUID()) { - sLog->outCrash("Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName().c_str(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId()); + LOG_FATAL("server", "Player %s (GUID: " UI64FMTD " is not able to uncharm unit (GUID: " UI64FMTD " Entry: %u, Type: %u)", GetName().c_str(), GetGUID(), GetCharmGUID(), charm->GetEntry(), charm->GetTypeId()); if (charm->GetCharmerGUID()) { - sLog->outCrash("Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); + LOG_FATAL("server", "Charmed unit has charmer guid " UI64FMTD, charm->GetCharmerGUID()); ABORT(); } else @@ -21539,7 +21508,7 @@ void Player::PetSpellInitialize() return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PETS, "Pet Spells Groups"); + LOG_DEBUG("entities.pet", "Pet Spells Groups"); #endif CharmInfo* charmInfo = pet->GetCharmInfo(); @@ -21604,7 +21573,7 @@ void Player::PossessSpellInitialize() if (!charmInfo) { - sLog->outError("Player::PossessSpellInitialize(): charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); + LOG_ERROR("server", "Player::PossessSpellInitialize(): charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); return; } @@ -21653,7 +21622,7 @@ void Player::VehicleSpellInitialize() if (!sConditionMgr->IsObjectMeetToConditions(this, vehicle, conditions)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CONDITIONSYS, "VehicleSpellInitialize: conditions not met for Vehicle entry %u spell %u", vehicle->ToCreature()->GetEntry(), spellId); + LOG_DEBUG("condition", "VehicleSpellInitialize: conditions not met for Vehicle entry %u spell %u", vehicle->ToCreature()->GetEntry(), spellId); #endif data << uint16(0) << uint8(0) << uint8(i + 8); continue; @@ -21696,7 +21665,7 @@ void Player::CharmSpellInitialize() CharmInfo* charmInfo = charm->GetCharmInfo(); if (!charmInfo) { - sLog->outError("Player::CharmSpellInitialize(): the player's charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); + LOG_ERROR("server", "Player::CharmSpellInitialize(): the player's charm (" UI64FMTD ") has no charminfo!", charm->GetGUID()); return; } @@ -21803,7 +21772,7 @@ public: void Player::AddSpellMod(SpellModifier* mod, bool apply) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Player::AddSpellMod %d", mod->spellId); + LOG_DEBUG("spells.aura", "Player::AddSpellMod %d", mod->spellId); #endif uint16 Opcode = (mod->type == SPELLMOD_FLAT) ? SMSG_SET_FLAT_SPELL_MODIFIER : SMSG_SET_PCT_SPELL_MODIFIER; @@ -21994,17 +21963,17 @@ void Player::SetSpellModTakingSpell(Spell* spell, bool apply) { if (apply && m_spellModTakingSpell != nullptr) { - sLog->outMisc("Player::SetSpellModTakingSpell (A1) - %u, %u", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id); + LOG_INFO("misc", "Player::SetSpellModTakingSpell (A1) - %u, %u", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id); return; //ASSERT(m_spellModTakingSpell == nullptr); } else if (!apply) { if (!m_spellModTakingSpell) - sLog->outMisc("Player::SetSpellModTakingSpell (B1) - %u", spell->m_spellInfo->Id); + LOG_INFO("misc", "Player::SetSpellModTakingSpell (B1) - %u", spell->m_spellInfo->Id); else if (m_spellModTakingSpell != spell) { - sLog->outMisc("Player::SetSpellModTakingSpell (C1) - %u, %u", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id); + LOG_INFO("misc", "Player::SetSpellModTakingSpell (C1) - %u, %u", spell->m_spellInfo->Id, m_spellModTakingSpell->m_spellInfo->Id); return; } //ASSERT(m_spellModTakingSpell && m_spellModTakingSpell == spell); @@ -22372,7 +22341,7 @@ void Player::ContinueTaxiFlight() return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Restart character %u taxi flight", GetGUIDLow()); + LOG_DEBUG("entities.unit", "WORLD: Restart character %u taxi flight", GetGUIDLow()); #endif uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourceNode, GetTeamId(true), true); @@ -22507,7 +22476,7 @@ void Player::InitDisplayIds() PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(true), getClass()); if (!info) { - sLog->outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow()); + LOG_ERROR("server", "Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow()); return; } @@ -22523,7 +22492,7 @@ void Player::InitDisplayIds() SetNativeDisplayId(info->displayId_m); break; default: - sLog->outError("Invalid gender %u for player", gender); + LOG_ERROR("server", "Invalid gender %u for player", gender); return; } } @@ -22632,7 +22601,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); + LOG_DEBUG("network", "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); #endif SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, nullptr, item, 0); return false; @@ -22688,7 +22657,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 ItemExtendedCostEntry const* iece = sItemExtendedCostStore.LookupEntry(crItem->ExtendedCost); if (!iece) { - sLog->outError("Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost); + LOG_ERROR("server", "Item %u have wrong ExtendedCost field value %u", pProto->ItemId, crItem->ExtendedCost); return false; } @@ -22731,7 +22700,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 uint32 maxCount = MAX_MONEY_AMOUNT / pProto->BuyPrice; if ((uint32)count > maxCount) { - sLog->outError("Player %s tried to buy %u item id %u, causing overflow", GetName().c_str(), (uint32)count, pProto->ItemId); + LOG_ERROR("server", "Player %s tried to buy %u item id %u, causing overflow", GetName().c_str(), (uint32)count, pProto->ItemId); count = (uint8)maxCount; } price = pProto->BuyPrice * count; //it should not exceed MAX_MONEY_AMOUNT @@ -22829,7 +22798,7 @@ void Player::UpdateHomebindTime(uint32 time) data << uint32(1); GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "PLAYER: Player '%s' (GUID: %u) will be teleported to homebind in 60 seconds", GetName().c_str(), GetGUIDLow()); + LOG_DEBUG("maps", "PLAYER: Player '%s' (GUID: %u) will be teleported to homebind in 60 seconds", GetName().c_str(), GetGUIDLow()); #endif } } @@ -23184,7 +23153,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Checking Condition %u, there are %u Meta Gems, %u Red Gems, %u Yellow Gems and %u Blue Gems, Activate:%s", enchantmentcondition, curcount[0], curcount[1], curcount[2], curcount[3], activate ? "yes" : "no"); + LOG_DEBUG("entities.player.items", "Checking Condition %u, there are %u Meta Gems, %u Red Gems, %u Yellow Gems and %u Blue Gems, Activate:%s", enchantmentcondition, curcount[0], curcount[1], curcount[2], curcount[3], activate ? "yes" : "no"); #endif return activate; @@ -23822,8 +23791,8 @@ void Player::SendInitialPacketsAfterAddToMap() { UpdateVisibilityForPlayer(true); - ResetTimeSync(); - SendTimeSync(); + GetSession()->ResetTimeSync(); + GetSession()->SendTimeSync(); CastSpell(this, 836, true); // LOGINEFFECT @@ -24570,7 +24539,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons break; } default: - sLog->outError("HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass); + LOG_ERROR("server", "HasItemFitToSpellRequirements: Not handled spell requirement for item class %u", spellInfo->EquippedItemClass); break; } @@ -24661,7 +24630,7 @@ uint32 Player::GetResurrectionSpellId() spell_id = 47882; break; // rank 7 default: - sLog->outError("Unhandled spell %u: S.Resurrection", (*itr)->GetId()); + LOG_ERROR("server", "Unhandled spell %u: S.Resurrection", (*itr)->GetId()); continue; } @@ -24696,7 +24665,7 @@ bool Player::isHonorOrXPTarget(Unit* victim) const { if (victim->IsTotem() || victim->IsPet() || - victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) + victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP) return false; } return true; @@ -24891,14 +24860,14 @@ void Player::SetMover(Unit* target) { if (this != target && target->m_movedByPlayer && target->m_movedByPlayer != target && target->m_movedByPlayer != this) { - sLog->outMisc("Player::SetMover (A1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); - sLog->outMisc("Player::SetMover (A2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); - sLog->outMisc("Player::SetMover (A3) - %u, %u, %u, %u, %u, %u, %u, %u", target->m_movedByPlayer->GetGUIDLow(), target->m_movedByPlayer->GetMapId(), target->m_movedByPlayer->GetInstanceId(), target->m_movedByPlayer->FindMap()->GetId(), target->m_movedByPlayer->IsInWorld() ? 1 : 0, target->m_movedByPlayer->IsDuringRemoveFromWorld() ? 1 : 0, target->m_movedByPlayer->ToPlayer()->IsBeingTeleported() ? 1 : 0, target->m_movedByPlayer->isBeingLoaded() ? 1 : 0); + LOG_INFO("misc", "Player::SetMover (A1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); + LOG_INFO("misc", "Player::SetMover (A2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); + LOG_INFO("misc", "Player::SetMover (A3) - %u, %u, %u, %u, %u, %u, %u, %u", target->m_movedByPlayer->GetGUIDLow(), target->m_movedByPlayer->GetMapId(), target->m_movedByPlayer->GetInstanceId(), target->m_movedByPlayer->FindMap()->GetId(), target->m_movedByPlayer->IsInWorld() ? 1 : 0, target->m_movedByPlayer->IsDuringRemoveFromWorld() ? 1 : 0, target->m_movedByPlayer->ToPlayer()->IsBeingTeleported() ? 1 : 0, target->m_movedByPlayer->isBeingLoaded() ? 1 : 0); } if (this != target && (!target->IsInWorld() || target->IsDuringRemoveFromWorld() || GetMapId() != target->GetMapId() || GetInstanceId() != target->GetInstanceId())) { - sLog->outMisc("Player::SetMover (B1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); - sLog->outMisc("Player::SetMover (B2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); + LOG_INFO("misc", "Player::SetMover (B1) - %u, %u, %u, %u, %u, %u, %u, %u", GetGUIDLow(), GetMapId(), GetInstanceId(), FindMap()->GetId(), IsInWorld() ? 1 : 0, IsDuringRemoveFromWorld() ? 1 : 0, IsBeingTeleported() ? 1 : 0, isBeingLoaded() ? 1 : 0); + LOG_INFO("misc", "Player::SetMover (B2) - %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u", target->GetTypeId(), target->GetEntry(), target->GetUnitTypeMask(), target->GetGUIDLow(), target->GetMapId(), target->GetInstanceId(), target->FindMap()->GetId(), target->IsInWorld() ? 1 : 0, target->IsDuringRemoveFromWorld() ? 1 : 0, (target->ToPlayer() && target->ToPlayer()->IsBeingTeleported() ? 1 : 0), target->isBeingLoaded() ? 1 : 0); } m_mover->m_movedByPlayer = nullptr; m_mover = target; @@ -25149,7 +25118,7 @@ void Player::SetBattlegroundOrBattlefieldRaid(Group* group, int8 subgroup) //we must move references from m_group to m_originalGroup if (GetGroup() && (GetGroup()->isBGGroup() || GetGroup()->isBFGroup())) { - sLog->outMisc("Player::SetBattlegroundOrBattlefieldRaid - current group is %s group!", (GetGroup()->isBGGroup() ? "BG" : "BF")); + LOG_INFO("misc", "Player::SetBattlegroundOrBattlefieldRaid - current group is %s group!", (GetGroup()->isBGGroup() ? "BG" : "BF")); //ABORT(); // pussywizard: origanal group can never be bf/bg group } @@ -25322,12 +25291,12 @@ void Player::SetViewpoint(WorldObject* target, bool apply) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId()); + LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s create seer %u (TypeId: %u).", GetName().c_str(), target->GetEntry(), target->GetTypeId()); #endif if (!AddUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) { - sLog->outCrash("Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName().c_str()); + LOG_FATAL("server", "Player::CreateViewpoint: Player %s cannot add new viewpoint!", GetName().c_str()); return; } @@ -25343,7 +25312,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply) m_seer = this; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "Player::CreateViewpoint: Player %s remove seer", GetName().c_str()); + LOG_DEBUG("maps", "Player::CreateViewpoint: Player %s remove seer", GetName().c_str()); #endif if (target->isType(TYPEMASK_UNIT) && !GetVehicle()) @@ -25351,7 +25320,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply) if (!RemoveUInt64Value(PLAYER_FARSIGHT, target->GetGUID())) { - sLog->outCrash("Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str()); + LOG_FATAL("server", "Player::CreateViewpoint: Player %s cannot remove current viewpoint!", GetName().c_str()); return; } @@ -25982,7 +25951,7 @@ void Player::_LoadSkills(PreparedQueryResult result) SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); if (!pSkill) { - sLog->outError("Character %u has skill %u that does not exist.", GetGUIDLow(), skill); + LOG_ERROR("server", "Character %u has skill %u that does not exist.", GetGUIDLow(), skill); continue; } @@ -26000,7 +25969,7 @@ void Player::_LoadSkills(PreparedQueryResult result) } if (value == 0) { - sLog->outError("Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill); + LOG_ERROR("server", "Character %u has skill %u with value 0. Will be deleted.", GetGUIDLow(), skill); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_SKILL); @@ -26029,7 +25998,7 @@ void Player::_LoadSkills(PreparedQueryResult result) if (count >= PLAYER_MAX_SKILLS) // client limit { - sLog->outError("Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS); + LOG_ERROR("server", "Character %u has more than %u skills.", GetGUIDLow(), PLAYER_MAX_SKILLS); break; } } while (result->NextRow()); @@ -26153,7 +26122,6 @@ void Player::HandleFall(MovementInfo const& movementInfo) { // calculate total z distance of the fall float z_diff = m_lastFallZ - movementInfo.pos.GetPositionZ(); - //sLog->outDebug("zDiff = %f", z_diff); //Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored // 14.57 can be calculated by resolving damageperc formula below to 0 @@ -26195,7 +26163,7 @@ void Player::HandleFall(MovementInfo const& movementInfo) //Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("FALLDAMAGE mZ=%f z=%f fallTime=%u damage=%u SF=%d", movementInfo.pos.GetPositionZ(), GetPositionZ(), movementInfo.fallTime, damage, safe_fall); + LOG_DEBUG("server", "FALLDAMAGE mZ=%f z=%f fallTime=%u damage=%u SF=%d", movementInfo.pos.GetPositionZ(), GetPositionZ(), movementInfo.fallTime, damage, safe_fall); #endif } @@ -26488,7 +26456,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) uint32 spellid = talentInfo->RankID[talentRank]; if (spellid == 0) { - sLog->outError("Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); + LOG_ERROR("server", "Talent.dbc have for talent: %u Rank: %u spell id = 0", talentId, talentRank); return; } @@ -26499,7 +26467,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) // learn! (other talent ranks will unlearned at learning) pet->learnSpell(spellid); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid); + LOG_DEBUG("server", "PetTalentID: %u Rank: %u Spell: %u\n", talentId, talentRank, spellid); #endif // update free talent points @@ -26800,7 +26768,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset) if (!found) // something wrong... { - sLog->outError("Player %s tried to save equipment set " UI64FMTD " (index %u), but that equipment set not found!", GetName().c_str(), eqset.Guid, index); + LOG_ERROR("server", "Player %s tried to save equipment set " UI64FMTD " (index %u), but that equipment set not found!", GetName().c_str(), eqset.Guid, index); return; } } @@ -27577,25 +27545,6 @@ uint8 Player::GetMostPointsTalentTree() const return maxIndex; } -void Player::ResetTimeSync() -{ - m_timeSyncCounter = 0; - m_timeSyncTimer = 0; - m_timeSyncClient = 0; - m_timeSyncServer = World::GetGameTimeMS(); -} - -void Player::SendTimeSync() -{ - WorldPacket data(SMSG_TIME_SYNC_REQ, 4); - data << uint32(m_timeSyncCounter++); - GetSession()->SendPacket(&data); - - // Schedule next sync in 10 sec - m_timeSyncTimer = 10000; - m_timeSyncServer = World::GetGameTimeMS(); -} - void Player::SetReputation(uint32 factionentry, uint32 value) { GetReputationMgr().SetReputation(sFactionStore.LookupEntry(factionentry), value); @@ -27778,7 +27727,7 @@ void Player::SendRefundInfo(Item* item) if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item refund: item not refundable!"); + LOG_DEBUG("entities.player.items", "Item refund: item not refundable!"); #endif return; } @@ -27786,7 +27735,7 @@ void Player::SendRefundInfo(Item* item) if (GetGUIDLow() != item->GetRefundRecipient()) // Formerly refundable item got traded { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item refund: item was traded!"); + LOG_DEBUG("entities.player.items", "Item refund: item was traded!"); #endif item->SetNotRefundable(this); return; @@ -27796,7 +27745,7 @@ void Player::SendRefundInfo(Item* item) if (!iece) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item refund: cannot find extendedcost data."); + LOG_DEBUG("entities.player.items", "Item refund: cannot find extendedcost data."); #endif return; } @@ -27844,7 +27793,7 @@ void Player::RefundItem(Item* item) if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item refund: item not refundable!"); + LOG_DEBUG("entities.player.items", "Item refund: item not refundable!"); #endif return; } @@ -27862,7 +27811,7 @@ void Player::RefundItem(Item* item) if (GetGUIDLow() != item->GetRefundRecipient()) // Formerly refundable item got traded { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item refund: item was traded!"); + LOG_DEBUG("entities.player.items", "Item refund: item was traded!"); #endif item->SetNotRefundable(this); return; @@ -27872,7 +27821,7 @@ void Player::RefundItem(Item* item) if (!iece) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item refund: cannot find extendedcost data."); + LOG_DEBUG("entities.player.items", "Item refund: cannot find extendedcost data."); #endif return; } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 654b2aefef..6cafa79908 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -2821,10 +2821,7 @@ protected: EnchantDurationList m_enchantDuration; ItemDurationList m_itemDuration; ItemDurationList m_itemSoulboundTradeable; - ACE_Thread_Mutex m_soulboundTradableLock; - - void ResetTimeSync(); - void SendTimeSync(); + std::mutex m_soulboundTradableLock; uint64 m_resurrectGUID; uint32 m_resurrectMap; @@ -2966,11 +2963,6 @@ private: uint32 m_ChampioningFaction; - uint32 m_timeSyncCounter; - uint32 m_timeSyncTimer; - uint32 m_timeSyncClient; - uint32 m_timeSyncServer; - InstanceTimeMap _instanceResetTimes; uint32 _pendingBindId; uint32 _pendingBindTimer; diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index 35d1b527a2..1181981c8b 100644 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -162,7 +162,7 @@ void PlayerSocial::SendSocialList(Player* player, uint32 flags) data.put(countPos, totalCount); player->GetSession()->SendPacket(&data); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CONTACT_LIST"); + LOG_DEBUG("network", "WORLD: Sent SMSG_CONTACT_LIST"); } bool PlayerSocial::_checkContact(uint64 guid, SocialFlag flags) const diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index a4004af203..bd4a9f7be5 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -38,7 +38,7 @@ bool MotionTransport::CreateMoTrans(uint32 guidlow, uint32 entry, uint32 mapid, if (!IsPositionValid()) { - sLog->outError("Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", + LOG_ERROR("server", "Transport (GUID: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, x, y); return false; } @@ -49,7 +49,7 @@ bool MotionTransport::CreateMoTrans(uint32 guidlow, uint32 entry, uint32 mapid, if (!goinfo) { - sLog->outError("Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang); + LOG_ERROR("server", "Transport not created: entry in `gameobject_template` not found, guidlow: %u map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang); return false; } @@ -58,7 +58,7 @@ bool MotionTransport::CreateMoTrans(uint32 guidlow, uint32 entry, uint32 mapid, TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry); if (!tInfo) { - sLog->outError("Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str()); + LOG_ERROR("server", "Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str()); return false; } @@ -129,7 +129,7 @@ void MotionTransport::Update(uint32 diff) if (AI()) AI()->UpdateAI(diff); else if (!AIM_Initialize()) - sLog->outError("Could not initialize GameObjectAI for Transport"); + LOG_ERROR("server", "Could not initialize GameObjectAI for Transport"); if (GetKeyFrames().size() <= 1) return; @@ -250,7 +250,7 @@ void MotionTransport::UpdatePosition(float x, float y, float z, float o) void MotionTransport::AddPassenger(WorldObject* passenger, bool withAll) { - ACORE_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard guard(Lock); if (_passengers.insert(passenger).second) { if (Player* plr = passenger->ToPlayer()) @@ -279,7 +279,7 @@ void MotionTransport::AddPassenger(WorldObject* passenger, bool withAll) void MotionTransport::RemovePassenger(WorldObject* passenger, bool withAll) { - ACORE_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard guard(Lock); if (_passengers.erase(passenger) || _staticPassengers.erase(passenger)) { if (Player* plr = passenger->ToPlayer()) @@ -333,7 +333,7 @@ Creature* MotionTransport::CreateNPCPassenger(uint32 guid, CreatureData const* d if (!creature->IsPositionValid()) { - sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY()); + LOG_ERROR("server", "Creature (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY()); delete creature; return nullptr; } @@ -374,7 +374,7 @@ GameObject* MotionTransport::CreateGOPassenger(uint32 guid, GameObjectData const if (!go->IsPositionValid()) { - sLog->outError("GameObject (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", go->GetGUIDLow(), go->GetEntry(), go->GetPositionX(), go->GetPositionY()); + LOG_ERROR("server", "GameObject (guidlow %d, entry %d) not created. Suggested coordinates aren't valid (X: %f Y: %f)", go->GetGUIDLow(), go->GetEntry(), go->GetPositionX(), go->GetPositionY()); delete go; return nullptr; } @@ -669,7 +669,7 @@ bool StaticTransport::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 ph m_stationaryPosition.Relocate(x, y, z, ang); if (!IsPositionValid()) { - sLog->outError("Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y); + LOG_ERROR("server", "Gameobject (GUID: %u Entry: %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, name_id, x, y); return false; } @@ -686,7 +686,7 @@ bool StaticTransport::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 ph GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id); if (!goinfo) { - sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z); + LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry: %u) not created: non-existing entry in `gameobject_template`. Map: %u (X: %f Y: %f Z: %f)", guidlow, name_id, map->GetId(), x, y, z); return false; } @@ -696,7 +696,7 @@ bool StaticTransport::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 ph if (goinfo->type >= MAX_GAMEOBJECT_TYPE) { - sLog->outErrorDb("Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type); + LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry: %u) not created: non-existing GO type '%u' in `gameobject_template`. It will crash client if created.", guidlow, name_id, goinfo->type); return false; } diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h index 45eaba73b7..42d5024232 100644 --- a/src/server/game/Entities/Transport/Transport.h +++ b/src/server/game/Entities/Transport/Transport.h @@ -91,7 +91,7 @@ private: bool _triggeredDepartureEvent; PassengerSet _staticPassengers; - mutable ACE_Thread_Mutex Lock; + mutable std::mutex Lock; bool _passengersLoaded; bool _delayedTeleport; }; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index c219cfc1f9..25bee45c81 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -333,10 +333,10 @@ Unit::~Unit() // pussywizard: clear m_sharedVision along with back references if (!m_sharedVision.empty()) { - sLog->outMisc("Unit::~Unit (B1)"); + LOG_INFO("misc", "Unit::~Unit (B1)"); do { - sLog->outMisc("Unit::~Unit (B2)"); + LOG_INFO("misc", "Unit::~Unit (B2)"); Player* p = *(m_sharedVision.begin()); p->m_isInSharedVisionOf.erase(this); m_sharedVision.erase(p); @@ -351,7 +351,7 @@ Unit::~Unit() ASSERT(m_dynObj.empty()); if (m_movedByPlayer && m_movedByPlayer != this) - sLog->outMisc("Unit::~Unit (A1)"); + LOG_INFO("misc", "Unit::~Unit (A1)"); HandleSafeUnitPointersOnDelete(this); } @@ -843,12 +843,12 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("DealDamageStart"); + LOG_DEBUG("server", "DealDamageStart"); #endif uint32 health = victim->GetHealth(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("deal dmg:%d to health:%d ", damage, health); + LOG_DEBUG("server", "deal dmg:%d to health:%d ", damage, health); #endif // duel ends when player has 1 or less hp @@ -914,7 +914,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage if (health <= damage) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("DealDamage: victim just died"); + LOG_DEBUG("server", "DealDamage: victim just died"); #endif //if (attacker && victim->GetTypeId() == TYPEID_PLAYER && victim != attacker) @@ -925,7 +925,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("DealDamageAlive"); + LOG_DEBUG("server", "DealDamageAlive"); #endif //if (victim->GetTypeId() == TYPEID_PLAYER) @@ -1018,7 +1018,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("DealDamageEnd returned %d damage", damage); + LOG_DEBUG("server", "DealDamageEnd returned %d damage", damage); #endif return damage; @@ -1035,7 +1035,7 @@ SpellCastResult Unit::CastSpell(SpellCastTargets const& targets, SpellInfo const { if (!spellInfo) { - sLog->outError("CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + LOG_ERROR("server", "CastSpell: unknown spell by caster: %s %u)", (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return SPELL_FAILED_SPELL_UNAVAILABLE; } @@ -1069,7 +1069,7 @@ SpellCastResult Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags t SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + LOG_ERROR("server", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return SPELL_FAILED_SPELL_UNAVAILABLE; } @@ -1119,7 +1119,7 @@ SpellCastResult Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& v SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + LOG_ERROR("server", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return SPELL_FAILED_SPELL_UNAVAILABLE; } SpellCastTargets targets; @@ -1133,7 +1133,7 @@ SpellCastResult Unit::CastSpell(float x, float y, float z, uint32 spellId, bool SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + LOG_ERROR("server", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return SPELL_FAILED_SPELL_UNAVAILABLE; } SpellCastTargets targets; @@ -1147,7 +1147,7 @@ SpellCastResult Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); + LOG_ERROR("server", "CastSpell: unknown spell id %u by caster: %s %u)", spellId, (GetTypeId() == TYPEID_PLAYER ? "player (GUID:" : "creature (Entry:"), (GetTypeId() == TYPEID_PLAYER ? GetGUIDLow() : GetEntry())); return SPELL_FAILED_SPELL_UNAVAILABLE; } SpellCastTargets targets; @@ -1286,7 +1286,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss) if (spellProto == nullptr) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "Unit::DealSpellDamage has wrong damageInfo->SpellID: %u", damageInfo->SpellID); + LOG_DEBUG("entities.unit", "Unit::DealSpellDamage has wrong damageInfo->SpellID: %u", damageInfo->SpellID); #endif return; } @@ -2221,10 +2221,10 @@ void Unit::AttackerStateUpdate(Unit* victim, WeaponAttackType attType, bool extr #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) if (GetTypeId() == TYPEID_PLAYER) - sLog->outStaticDebug("AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", + LOG_DEBUG("server", "AttackerStateUpdate: (Player) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist); else - sLog->outStaticDebug("AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", + LOG_DEBUG("server", "AttackerStateUpdate: (NPC) %u attacked %u (TypeId: %u) for %u dmg, absorbed %u, blocked %u, resisted %u.", GetGUIDLow(), victim->GetGUIDLow(), victim->GetTypeId(), damageInfo.damage, damageInfo.absorb, damageInfo.blocked_amount, damageInfo.resist); #endif } @@ -2346,7 +2346,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy float parry_chance = victim->GetUnitParryChance(); // Useful if want to specify crit & miss chances for melee, else it could be removed - //sLog->outStaticDebug("MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance); + //LOG_DEBUG("server", "MELEE OUTCOME: miss %f crit %f dodge %f parry %f block %f", miss_chance, crit_chance, dodge_chance, parry_chance, block_chance); return RollMeleeOutcomeAgainst(victim, attType, int32(crit_chance * 100), int32(miss_chance * 100), int32(dodge_chance * 100), int32(parry_chance * 100), int32(block_chance * 100)); } @@ -2369,15 +2369,15 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy int32 sum = 0, tmp = 0; int32 roll = urand (0, 10000); - //sLog->outStaticDebug ("RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus); - //sLog->outStaticDebug ("RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d", + //LOG_DEBUG("server", "RollMeleeOutcomeAgainst: skill bonus of %d for attacker", skillBonus); + //LOG_DEBUG("server", "RollMeleeOutcomeAgainst: rolled %d, miss %d, dodge %d, parry %d, block %d, crit %d", // roll, miss_chance, dodge_chance, parry_chance, block_chance, crit_chance); tmp = miss_chance; if (tmp > 0 && roll < (sum += tmp)) { - //sLog->outStaticDebug ("RollMeleeOutcomeAgainst: MISS"); + //LOG_DEBUG("server", "RollMeleeOutcomeAgainst: MISS"); return MELEE_HIT_MISS; } @@ -2385,7 +2385,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy if (victim->GetTypeId() == TYPEID_PLAYER && crit_chance > 0 && !victim->IsStandState()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT (sitting victim)"); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: CRIT (sitting victim)"); #endif return MELEE_HIT_CRIT; } @@ -2395,7 +2395,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy // only players can't dodge if attacker is behind if (victim->GetTypeId() == TYPEID_PLAYER && !victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) { - //sLog->outStaticDebug ("RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); + //LOG_DEBUG("server", "RollMeleeOutcomeAgainst: attack came from behind and victim was a player."); } // Xinef: do not allow to dodge with CREATURE_FLAG_EXTRA_NO_DODGE flag else if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_DODGE)) @@ -2421,7 +2421,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy && roll < (sum += tmp)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum - tmp, sum); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: DODGE <%d, %d)", sum - tmp, sum); #endif return MELEE_HIT_DODGE; } @@ -2433,7 +2433,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy if (!victim->HasInArc(M_PI, this) && !victim->HasAuraType(SPELL_AURA_IGNORE_HIT_DIRECTION)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("RollMeleeOutcomeAgainst: attack came from behind."); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: attack came from behind."); #endif } else @@ -2457,7 +2457,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy && roll < (sum += tmp)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum - tmp, sum); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: PARRY <%d, %d)", sum - tmp, sum); #endif return MELEE_HIT_PARRY; } @@ -2476,7 +2476,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy && roll < (sum += tmp)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum - tmp, sum); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: BLOCK <%d, %d)", sum - tmp, sum); #endif return MELEE_HIT_BLOCK; } @@ -2499,7 +2499,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy if (roll < (sum += tmp)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum - 4000, sum); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: GLANCING <%d, %d)", sum - 4000, sum); #endif return MELEE_HIT_GLANCING; } @@ -2509,7 +2509,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 && // can be from by creature (if can) or from controlled player that considered as creature !IsControlledByPlayer() && - !(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH)) + !(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSHING_BLOWS)) { // when their weapon skill is 15 or more above victim's defense skill tmp = victimDefenseSkill; @@ -2525,7 +2525,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy if (roll < (sum += tmp)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum - tmp, sum); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: CRUSHING <%d, %d)", sum - tmp, sum); #endif return MELEE_HIT_CRUSHING; } @@ -2538,12 +2538,12 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy if (tmp > 0 && roll < (sum += tmp)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum - tmp, sum); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum - tmp, sum); #endif if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("RollMeleeOutcomeAgainst: CRIT DISABLED)"); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: CRIT DISABLED)"); #endif } else @@ -2551,7 +2551,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("RollMeleeOutcomeAgainst: NORMAL"); + LOG_DEBUG("server", "RollMeleeOutcomeAgainst: NORMAL"); #endif return MELEE_HIT_NORMAL; } @@ -2625,7 +2625,7 @@ void Unit::SendMeleeAttackStart(Unit* victim, Player* sendTo) else SendMessageToSet(&data, true); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTART"); + LOG_DEBUG("server", "WORLD: Sent SMSG_ATTACKSTART"); #endif } @@ -2641,12 +2641,12 @@ void Unit::SendMeleeAttackStop(Unit* victim) data << uint32(0); //! Can also take the value 0x01, which seems related to updating rotation SendMessageToSet(&data, true); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTOP"); + LOG_DEBUG("server", "WORLD: Sent SMSG_ATTACKSTOP"); if (victim) - sLog->outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow()); + LOG_DEBUG("server", "%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow()); else - sLog->outDetail("%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow()); + LOG_DEBUG("server", "%s %u stopped attacking", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow()); #endif } @@ -2813,7 +2813,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) break; default: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue()); + LOG_DEBUG("server", "Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT has unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue()); #endif break; } @@ -3483,7 +3483,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell) void Unit::InterruptSpell(CurrentSpellTypes spellType, bool withDelayed, bool withInstant, bool bySelf) { - //sLog->outDebug(LOG_FILTER_UNITS, "Interrupt spell for unit %u.", GetEntry()); + //LOG_DEBUG("entities.unit", "Interrupt spell for unit %u.", GetEntry()); Spell* spell = m_currentSpells[spellType]; if (spell && (withDelayed || spell->getState() != SPELL_STATE_DELAYED) @@ -3888,20 +3888,20 @@ void SafeUnitPointer::SetPointedTo(Unit* u) void SafeUnitPointer::UnitDeleted() { - sLog->outMisc("SafeUnitPointer::UnitDeleted !!!"); + LOG_INFO("misc", "SafeUnitPointer::UnitDeleted !!!"); if (defaultValue) { if (Player* p = defaultValue->ToPlayer()) { - sLog->outMisc("SafeUnitPointer::UnitDeleted (A1) - %u, %u, %u, %u, %u, %u, %u, %u", p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap()->GetId(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); + LOG_INFO("misc", "SafeUnitPointer::UnitDeleted (A1) - %u, %u, %u, %u, %u, %u, %u, %u", p->GetGUIDLow(), p->GetMapId(), p->GetInstanceId(), p->FindMap()->GetId(), p->IsInWorld() ? 1 : 0, p->IsDuringRemoveFromWorld() ? 1 : 0, p->IsBeingTeleported() ? 1 : 0, p->isBeingLoaded() ? 1 : 0); if (ptr) - sLog->outMisc("SafeUnitPointer::UnitDeleted (A2)"); + LOG_INFO("misc", "SafeUnitPointer::UnitDeleted (A2)"); p->GetSession()->KickPlayer("Unit deleted"); } } else if (ptr) - sLog->outMisc("SafeUnitPointer::UnitDeleted (B1)"); + LOG_INFO("misc", "SafeUnitPointer::UnitDeleted (B1)"); ptr = defaultValue; } @@ -3915,7 +3915,7 @@ void Unit::HandleSafeUnitPointersOnDelete(Unit* thisUnit) thisUnit->SafeUnitPointerSet.clear(); ACE_Stack_Trace trace(0, 50); - sLog->outMisc("Unit::HandleSafeUnitPointersOnDelete CALL STACK (1):\n%s\n", trace.c_str()); + LOG_INFO("misc", "Unit::HandleSafeUnitPointersOnDelete CALL STACK (1):\n%s\n", trace.c_str()); } bool Unit::IsInWater(bool allowAbove) const @@ -4150,7 +4150,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveMode removeMo aurApp->SetRemoveMode(removeMode); Aura* aura = aurApp->GetBase(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura %u now is remove mode %d", aura->GetId(), removeMode); + LOG_DEBUG("spells.aura", "Aura %u now is remove mode %d", aura->GetId(), removeMode); #endif // dead loop is killing the server probably @@ -5032,7 +5032,7 @@ void Unit::DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime) // update for out of range group members (on 1 slot use) aura->SetNeedClientUpdateForTargets(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura %u partially interrupted on unit %u, new duration: %u ms", aura->GetId(), GetGUIDLow(), aura->GetDuration()); + LOG_DEBUG("spells.aura", "Aura %u partially interrupted on unit %u, new duration: %u ms", aura->GetId(), GetGUIDLow(), aura->GetDuration()); #endif } } @@ -5924,7 +5924,7 @@ void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo) data << float(pInfo->multiplier); // gain multiplier break; default: - sLog->outError("Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType())); + LOG_ERROR("server", "Unit::SendPeriodicAuraLog: unknown aura %u", uint32(aura->GetAuraType())); return; } @@ -5968,7 +5968,7 @@ void Unit::SendSpellDamageImmune(Unit* target, uint32 spellId) void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); + LOG_DEBUG("entities.unit", "WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); #endif //IF we are in cheat mode we swap absorb with damage and set damage to 0, this way we can still debug damage but our hp bar will not drop @@ -6641,7 +6641,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere triggered_spell_id = 42771; break; default: - sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id); + LOG_ERROR("server", "Unit::HandleDummyAuraProc: non handled spell id: %u (SW)", dummySpell->Id); return false; } @@ -7646,7 +7646,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere break; // 8 Rank default: { - sLog->outError("Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)", + LOG_ERROR("server", "Unit::HandleDummyAuraProc: non handled item enchantment (rank?) %u for spell id: %u (Windfury)", castItem->GetEnchantmentId(EnchantmentSlot(TEMP_ENCHANTMENT_SLOT)), dummySpell->Id); return false; } @@ -7655,7 +7655,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere SpellInfo const* windfurySpellInfo = sSpellMgr->GetSpellInfo(spellId); if (!windfurySpellInfo) { - sLog->outError("Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId); + LOG_ERROR("server", "Unit::HandleDummyAuraProc: non-existing spell id: %u (Windfury)", spellId); return false; } @@ -8233,7 +8233,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere SpellInfo const* triggerEntry = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!triggerEntry) { - sLog->outError("Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); + LOG_ERROR("server", "Unit::HandleDummyAuraProc: Spell %u has non-existing triggered spell %u", dummySpell->Id, triggered_spell_id); return false; } @@ -8549,7 +8549,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 31643; break; default: - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id); + LOG_ERROR("server", "Unit::HandleProcTriggerSpell: Spell %u miss posibly Blazing Speed", auraSpellInfo->Id); return false; } } @@ -8626,7 +8626,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 27818; break; default: - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id); + LOG_ERROR("server", "Unit::HandleProcTriggerSpell: Spell %u not handled in BR", auraSpellInfo->Id); return false; } basepoints0 = CalculatePct(int32(damage), triggerAmount) / 3; @@ -8704,7 +8704,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg trigger_spell_id = 63468; break; default: - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id); + LOG_ERROR("server", "Unit::HandleProcTriggerSpell: Spell %u miss posibly Piercing Shots", auraSpellInfo->Id); return false; } SpellInfo const* TriggerPS = sSpellMgr->GetSpellInfo(trigger_spell_id); @@ -8835,14 +8835,14 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg originalSpellId = 48825; break; default: - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id); + LOG_ERROR("server", "Unit::HandleProcTriggerSpell: Spell %u not handled in HShock", procSpell->Id); return false; } } SpellInfo const* originalSpell = sSpellMgr->GetSpellInfo(originalSpellId); if (!originalSpell) { - sLog->outError("Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId); + LOG_ERROR("server", "Unit::HandleProcTriggerSpell: Spell %u unknown but selected as original in Illu", originalSpellId); return false; } // percent stored in effect 1 (class scripts) base points @@ -8930,7 +8930,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg if (triggerEntry == nullptr) { // Don't cast unknown spell - // sLog->outError("Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex()); + // LOG_ERROR("server", "Unit::HandleProcTriggerSpell: Spell %u has 0 in EffectTriggered[%d]. Unhandled custom case?", auraSpellInfo->Id, triggeredByAura->GetEffIndex()); return false; } @@ -9507,7 +9507,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit* victim, uint32 /*damage*/, Au if (!triggerEntry) { - sLog->outError("Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId); + LOG_ERROR("server", "Unit::HandleOverrideClassScriptAuraProc: Spell %u triggering for class script id %u", triggered_spell_id, scriptId); return false; } @@ -9589,11 +9589,11 @@ FactionTemplateEntry const* Unit::GetFactionTemplateEntry() const if (GetGUID() != guid) { if (Player const* player = ToPlayer()) - sLog->outError("Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction()); + LOG_ERROR("server", "Player %s has invalid faction (faction template id) #%u", player->GetName().c_str(), getFaction()); else if (Creature const* creature = ToCreature()) - sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); + LOG_ERROR("server", "Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction()); else - sLog->outError("Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction()); + LOG_ERROR("server", "Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName().c_str(), uint32(GetTypeId()), getFaction()); guid = GetGUID(); } @@ -9636,9 +9636,9 @@ ReputationRank Unit::GetReactionTo(Unit const* target) const return *repRank; } - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) { - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) { if (selfPlayerOwner && targetPlayerOwner) { @@ -9992,7 +9992,7 @@ void Unit::RemoveAllAttackers() AttackerSet::iterator iter = m_attackers.begin(); if (!(*iter)->AttackStop()) { - sLog->outError("WORLD: Unit has an attacker that isn't attacking it!"); + LOG_ERROR("server", "WORLD: Unit has an attacker that isn't attacking it!"); m_attackers.erase(iter); } } @@ -10145,7 +10145,7 @@ Minion* Unit::GetFirstMinion() const if (pet->HasUnitTypeMask(UNIT_MASK_MINION)) return (Minion*)pet; - sLog->outError("Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid)); + LOG_ERROR("server", "Unit::GetFirstMinion: Minion %u not exist.", GUID_LOPART(pet_guid)); const_cast(this)->SetMinionGUID(0); } @@ -10160,7 +10160,7 @@ Guardian* Unit::GetGuardianPet() const if (pet->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) return (Guardian*)pet; - sLog->outCrash("Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid); + LOG_FATAL("server", "Unit::GetGuardianPet: Guardian " UI64FMTD " not exist.", pet_guid); const_cast(this)->SetPetGUID(0); } @@ -10174,7 +10174,7 @@ Unit* Unit::GetCharm() const if (Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid)) return pet; - sLog->outError("Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid)); + LOG_ERROR("server", "Unit::GetCharm: Charmed creature %u not exist.", GUID_LOPART(charm_guid)); const_cast(this)->SetUInt64Value(UNIT_FIELD_CHARM, 0); } @@ -10184,14 +10184,14 @@ Unit* Unit::GetCharm() const void Unit::SetMinion(Minion* minion, bool apply) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "SetMinion %u for %u, apply %u", minion->GetEntry(), GetEntry(), apply); + LOG_DEBUG("entities.unit", "SetMinion %u for %u, apply %u", minion->GetEntry(), GetEntry(), apply); #endif if (apply) { if (minion->GetOwnerGUID()) { - sLog->outCrash("SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); + LOG_FATAL("server", "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); return; } @@ -10202,7 +10202,7 @@ void Unit::SetMinion(Minion* minion, bool apply) if (GetTypeId() == TYPEID_PLAYER) { minion->m_ControlledByPlayer = true; - minion->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + minion->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); } // Can only have one pet. If a new one is summoned, dismiss the old one. @@ -10265,7 +10265,7 @@ void Unit::SetMinion(Minion* minion, bool apply) { if (minion->GetOwnerGUID() != GetGUID()) { - sLog->outCrash("SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); + LOG_FATAL("server", "SetMinion: Minion %u is not the minion of owner %u", minion->GetEntry(), GetEntry()); return; } @@ -10381,11 +10381,11 @@ void Unit::SetCharm(Unit* charm, bool apply) if (GetTypeId() == TYPEID_PLAYER) { if (!AddUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - sLog->outCrash("Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); + LOG_FATAL("server", "Player %s is trying to charm unit %u, but it already has a charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); charm->m_ControlledByPlayer = true; // TODO: maybe we can use this flag to check if controlled by player - charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); } else charm->m_ControlledByPlayer = false; @@ -10394,7 +10394,7 @@ void Unit::SetCharm(Unit* charm, bool apply) charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1)); if (!charm->AddUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) - sLog->outCrash("Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); + LOG_FATAL("server", "Unit %u is being charmed, but it already has a charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING)) charm->SetWalk(false); @@ -10406,22 +10406,22 @@ void Unit::SetCharm(Unit* charm, bool apply) if (GetTypeId() == TYPEID_PLAYER) { if (!RemoveUInt64Value(UNIT_FIELD_CHARM, charm->GetGUID())) - sLog->outCrash("Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); + LOG_FATAL("server", "Player %s is trying to uncharm unit %u, but it has another charmed unit " UI64FMTD "", GetName().c_str(), charm->GetEntry(), GetCharmGUID()); } if (!charm->RemoveUInt64Value(UNIT_FIELD_CHARMEDBY, GetGUID())) - sLog->outCrash("Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); + LOG_FATAL("server", "Unit %u is being uncharmed, but it has another charmer " UI64FMTD "", charm->GetEntry(), charm->GetCharmerGUID()); if (charm->GetTypeId() == TYPEID_PLAYER) { charm->m_ControlledByPlayer = true; - charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); charm->ToPlayer()->UpdatePvPState(); } else if (Player* player = charm->GetCharmerOrOwnerPlayerOrPlayerItself()) { charm->m_ControlledByPlayer = true; - charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + charm->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, player->GetByteValue(UNIT_FIELD_BYTES_2, 1)); // Xinef: skip controlled erase if charmed unit is owned by charmer @@ -10431,7 +10431,7 @@ void Unit::SetCharm(Unit* charm, bool apply) else { charm->m_ControlledByPlayer = false; - charm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + charm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); charm->SetByteValue(UNIT_FIELD_BYTES_2, 1, 0); } @@ -10589,14 +10589,14 @@ void Unit::RemoveAllControlled() else if (target->GetOwnerGUID() == GetGUID() && target->IsSummon()) target->ToTempSummon()->UnSummon(); else - sLog->outError("Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry()); + LOG_ERROR("server", "Unit %u is trying to release unit %u which is neither charmed nor owned by it", GetEntry(), target->GetEntry()); } if (GetPetGUID()) - sLog->outCrash("Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID()); + LOG_FATAL("server", "Unit %u is not able to release its pet " UI64FMTD, GetEntry(), GetPetGUID()); if (GetMinionGUID()) - sLog->outCrash("Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID()); + LOG_FATAL("server", "Unit %u is not able to release its minion " UI64FMTD, GetEntry(), GetMinionGUID()); if (GetCharmGUID()) - sLog->outCrash("Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID()); + LOG_FATAL("server", "Unit %u is not able to release its charm " UI64FMTD, GetEntry(), GetCharmGUID()); } Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) @@ -13005,7 +13005,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy, uint32 duration) UpdateSpeed(MOVE_FLIGHT, true); } - if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_MOUNTED_COMBAT_ALLOWED)) + if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT)) Dismount(); if (!IsStandState()) // pussywizard: already done in CombatStart(target, initialAggro) for the target, but when aggro'ing from MoveInLOS CombatStart is not called! SetStandState(UNIT_STAND_STATE_STAND); @@ -13133,15 +13133,15 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo } // check flags if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_TAXI_FLIGHT | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_NON_ATTACKABLE_2) - || (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) - || (!target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) - || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) + || (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) + || (!target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC)) + || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) // check if this is a world trigger cast - GOs are using world triggers to cast their spells, so we need to ignore their immunity flag here, this is a temp workaround, needs removal when go cast is implemented properly - || (GetEntry() != WORLD_TRIGGER && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))) + || (GetEntry() != WORLD_TRIGGER && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC))) return false; // CvC case - can attack each other only when one of them is hostile - if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE; // PvP, PvC, CvP case @@ -13180,8 +13180,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT) return false; - Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : nullptr; - Player const* playerAffectingTarget = target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? target->GetAffectingPlayer() : nullptr; + Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) ? GetAffectingPlayer() : nullptr; + Player const* playerAffectingTarget = target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) ? target->GetAffectingPlayer() : nullptr; // check duel - before sanctuary checks if (playerAffectingAttacker && playerAffectingTarget) @@ -13190,7 +13190,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo // PvP case - can't attack when attacker or target are in sanctuary // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && (target->IsInSanctuary() || IsInSanctuary())) + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && (target->IsInSanctuary() || IsInSanctuary())) return false; // additional checks - only PvP case @@ -13250,7 +13250,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) return false; - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) { if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC)) return false; @@ -13269,10 +13269,10 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co return false; // PvP case - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) { Player const* targetPlayerOwner = target->GetAffectingPlayer(); - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) { Player const* selfPlayerOwner = GetAffectingPlayer(); if (selfPlayerOwner && targetPlayerOwner) @@ -13293,8 +13293,8 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co } } // PvC case - player can assist creature only if has specific type flags - // !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && - else if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) + // !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && + else if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && (!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_ASSIST_IGNORE_IMMUNE_FLAG)) && !target->IsPvP()) { @@ -13544,7 +13544,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) break; } default: - sLog->outError("Unit::UpdateSpeed: Unsupported move type (%d)", mtype); + LOG_ERROR("server", "Unit::UpdateSpeed: Unsupported move type (%d)", mtype); return; } @@ -13562,7 +13562,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) if (GetTypeId() == TYPEID_UNIT) { Unit* pOwner = GetCharmerOrOwner(); - if (pOwner && !IsInCombat() && !IsVehicle() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) && (IsPet() || IsGuardian() || GetGUID() == pOwner->GetCritterGUID() || GetCharmerGUID() == pOwner->GetGUID())) + if (pOwner && !IsInCombat() && !IsVehicle() && !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) && (IsPet() || IsGuardian() || GetGUID() == pOwner->GetCritterGUID() || GetCharmerGUID() == pOwner->GetGUID())) { if (pOwner->GetTypeId() != TYPEID_PLAYER) { @@ -13697,7 +13697,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data.Initialize(MSG_MOVE_SET_PITCH_RATE, 8 + 4 + 2 + 4 + 4 + 4 + 4 + 4 + 4 + 4); break; default: - sLog->outError("Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); + LOG_ERROR("server", "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); return; } @@ -13721,7 +13721,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) pet = GetCharm(); // xinef: do not affect vehicles and possesed pets - if (pet && (pet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED) || pet->IsVehicle())) + if (pet && (pet->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED) || pet->IsVehicle())) pet = nullptr; if (pet && pet->GetTypeId() == TYPEID_UNIT && !pet->IsInCombat() && pet->GetMotionMaster()->GetCurrentMovementGeneratorType() == FOLLOW_MOTION_TYPE) @@ -13761,7 +13761,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) data.Initialize(SMSG_FORCE_PITCH_RATE_CHANGE, 16); break; default: - sLog->outError("Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); + LOG_ERROR("server", "Unit::SetSpeed: Unsupported move type (%d), data not sent to client.", mtype); return; } data.append(GetPackGUID()); @@ -14298,7 +14298,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32& duration, if (group == DIMINISHING_TAUNT) { - if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH)) + if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS)) { DiminishingLevels diminish = Level; switch (diminish) @@ -14417,7 +14417,7 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f { if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) { - sLog->outError("ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!"); + LOG_ERROR("server", "ERROR in HandleStatModifier(): non-existing UnitMods or wrong UnitModifierType!"); return false; } @@ -14502,7 +14502,7 @@ float Unit::GetModifierValue(UnitMods unitMod, UnitModifierType modifierType) co { if (unitMod >= UNIT_MOD_END || modifierType >= MODIFIER_TYPE_END) { - sLog->outError("attempt to access non-existing modifier value from UnitMods!"); + LOG_ERROR("server", "attempt to access non-existing modifier value from UnitMods!"); return 0.0f; } @@ -14532,7 +14532,7 @@ float Unit::GetTotalAuraModValue(UnitMods unitMod) const { if (unitMod >= UNIT_MOD_END) { - sLog->outError("attempt to access non-existing UnitMods in GetTotalAuraModValue()!"); + LOG_ERROR("server", "attempt to access non-existing UnitMods in GetTotalAuraModValue()!"); return 0.0f; } @@ -14900,7 +14900,7 @@ void Unit::RemoveFromWorld() if (GetCharmerGUID()) { - sLog->outCrash("Unit %u has charmer guid when removed from world", GetEntry()); + LOG_FATAL("server", "Unit %u has charmer guid when removed from world", GetEntry()); ABORT(); } @@ -14910,7 +14910,7 @@ void Unit::RemoveFromWorld() { if (HasUnitTypeMask(UNIT_MASK_MINION | UNIT_MASK_GUARDIAN)) owner->SetMinion((Minion*)this, false); - sLog->outString("Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry()); + LOG_INFO("server", "Unit %u is in controlled list of %u when removed from world", GetEntry(), owner->GetEntry()); //ABORT(); } } @@ -15743,7 +15743,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) uint32 Id = i->aura->GetId(); - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), Id); + LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), Id); #endif takeCharges = true; } @@ -15769,7 +15769,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_PROC_TRIGGER_SPELL: { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); + LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); #endif // Don`t drop charge or add cooldown for not started trigger if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) @@ -15790,7 +15790,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_DUMMY: { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); + LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); #endif if (HandleDummyAuraProc(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) takeCharges = true; @@ -15800,13 +15800,13 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: case SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN: case SPELL_AURA_MOD_MELEE_HASTE: - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, isVictim ? "a victim's" : "an attacker's", triggeredByAura->GetId()); + LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, isVictim ? "a victim's" : "an attacker's", triggeredByAura->GetId()); takeCharges = true; break; case SPELL_AURA_OVERRIDE_CLASS_SCRIPTS: { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); + LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); #endif if (HandleOverrideClassScriptAuraProc(target, damage, triggeredByAura, procSpell, cooldown)) takeCharges = true; @@ -15815,7 +15815,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE: { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", + LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); #endif if (damage > 0) @@ -15828,7 +15828,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_RAID_PROC_FROM_CHARGE: { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", + LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)", (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); #endif HandleAuraRaidProcFromCharge(triggeredByAura); @@ -15838,7 +15838,7 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u case SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE: { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); + LOG_DEBUG("spells.aura", "ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id, (isVictim ? "a victim's" : "an attacker's"), triggeredByAura->GetId()); #endif if (HandleProcTriggerSpell(target, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown)) @@ -16652,11 +16652,11 @@ bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id) pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); if (GetTypeId() == TYPEID_PLAYER) - pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); if (!pet->InitStatsForLevel(level)) { - sLog->outError("Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry()); + LOG_ERROR("server", "Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pet->GetEntry()); return false; } @@ -16802,7 +16802,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura) if (!(spellProto->SpellFamilyName == SPELLFAMILY_PRIEST && spellProto->SpellFamilyFlags[1] & 0x20)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: %u", spellProto->Id); + LOG_DEBUG("spells.aura", "Unit::HandleAuraRaidProcFromChargeWithValue, received not handled spell: %u", spellProto->Id); #endif return false; } @@ -16901,7 +16901,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura) damageSpellId = 43594; break; default: - sLog->outError("Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id); + LOG_ERROR("server", "Unit::HandleAuraRaidProcFromCharge, received unhandled spell: %u", spellProto->Id); return false; } @@ -17076,12 +17076,12 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp // Xinef: aura_spirit_of_redemption is triggered by 27827 shapeshift if (victim->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION) || victim->HasAura(27827)) { - /*sLog->outMisc("Player (%u) died with spirit of redemption. Killer (Entry: %u, Name: %s), Map: %u, x: %f, y: %f, z: %f", + /*LOG_INFO("misc", "Player (%u) died with spirit of redemption. Killer (Entry: %u, Name: %s), Map: %u, x: %f, y: %f, z: %f", victim->GetGUIDLow(), killer ? killer->GetEntry() : 1, killer ? killer->GetName().c_str() : "", victim->GetMapId(), victim->GetPositionX(), victim->GetPositionY(), victim->GetPositionZ()); ACE_Stack_Trace trace(0, 50); - sLog->outMisc("TRACE: %s\n\n", trace.c_str());*/ + LOG_INFO("misc", "TRACE: %s\n\n", trace.c_str());*/ } else { @@ -17110,7 +17110,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp if (!spiritOfRedemption) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("SET JUST_DIED"); + LOG_DEBUG("server", "SET JUST_DIED"); #endif victim->setDeathState(JUST_DIED); } @@ -17137,7 +17137,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp if ((durabilityLoss && !player && !plrVictim->InBattleground()) || (player && sWorld->getBoolConfig(CONFIG_DURABILITY_LOSS_IN_PVP))) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH)); + LOG_DEBUG("server", "We are dead, losing %f percent durability", sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH)); #endif plrVictim->DurabilityLossAll(sWorld->getRate(RATE_DURABILITY_LOSS_ON_DEATH), false); // durability lost message @@ -17159,7 +17159,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp else // creature died { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("DealDamageNotPlayer"); + LOG_DEBUG("server", "DealDamageNotPlayer"); #endif if (!creature->IsPet() && creature->GetLootMode() > 0) @@ -17482,9 +17482,9 @@ void Unit::DisableRotate(bool apply) return; if (apply) - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); else if (!HasUnitState(UNIT_STATE_POSSESSED)) - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); } void Unit::SetFeared(bool apply) @@ -17566,7 +17566,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au if (!charmer->IsInWorld() || charmer->IsDuringRemoveFromWorld()) { ACE_Stack_Trace trace(0, 50); - sLog->outMisc("Unit::SetCharmedBy CALL STACK (1):\n%s\n", trace.c_str()); + LOG_INFO("misc", "Unit::SetCharmedBy CALL STACK (1):\n%s\n", trace.c_str()); return false; } @@ -17583,12 +17583,12 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au ASSERT((type == CHARM_TYPE_VEHICLE) == IsVehicle()); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "SetCharmedBy: charmer %u (GUID %u), charmed %u (GUID %u), type %u.", charmer->GetEntry(), charmer->GetGUIDLow(), GetEntry(), GetGUIDLow(), uint32(type)); + LOG_DEBUG("entities.unit", "SetCharmedBy: charmer %u (GUID %u), charmed %u (GUID %u), type %u.", charmer->GetEntry(), charmer->GetGUIDLow(), GetEntry(), GetGUIDLow(), uint32(type)); #endif if (this == charmer) { - sLog->outCrash("Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow()); + LOG_FATAL("server", "Unit::SetCharmedBy: Unit %u (GUID %u) is trying to charm itself!", GetEntry(), GetGUIDLow()); return false; } @@ -17597,14 +17597,14 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetTransport()) { - sLog->outCrash("Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow()); + LOG_FATAL("server", "Unit::SetCharmedBy: Player on transport is trying to charm %u (GUID %u)", GetEntry(), GetGUIDLow()); return false; } // Already charmed if (GetCharmerGUID()) { - sLog->outCrash("Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); + LOG_FATAL("server", "Unit::SetCharmedBy: %u (GUID %u) has already been charmed but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); return false; } @@ -17634,7 +17634,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au // StopCastingCharm may remove a possessed pet? if (!IsInWorld()) { - sLog->outCrash("Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); + LOG_FATAL("server", "Unit::SetCharmedBy: %u (GUID %u) is not in world but %u (GUID %u) is trying to charm it!", GetEntry(), GetGUIDLow(), charmer->GetEntry(), charmer->GetGUIDLow()); return false; } @@ -17694,7 +17694,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au switch (type) { case CHARM_TYPE_VEHICLE: - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); playerCharmer->SetClientControl(this, true); // verified playerCharmer->VehicleSpellInitialize(); @@ -17702,7 +17702,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au case CHARM_TYPE_POSSESS: AddUnitState(UNIT_STATE_POSSESSED); AddUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); - SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); charmer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); playerCharmer->SetClientControl(this, true); // verified playerCharmer->PossessSpellInitialize(); @@ -17763,7 +17763,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) charmer = GetCharmer(); if (charmer != GetCharmer()) // one aura overrides another? { - // sLog->outCrash("Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD, + // LOG_FATAL("server", "Unit::RemoveCharmedBy: this: " UI64FMTD " true charmer: " UI64FMTD " false charmer: " UI64FMTD, // GetGUID(), GetCharmerGUID(), charmer->GetGUID()); // ABORT(); return; @@ -17827,14 +17827,14 @@ void Unit::RemoveCharmedBy(Unit* charmer) case CHARM_TYPE_VEHICLE: playerCharmer->SetClientControl(this, false); playerCharmer->SetClientControl(charmer, true); // verified - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); break; case CHARM_TYPE_POSSESS: playerCharmer->SetClientControl(this, false); playerCharmer->SetClientControl(charmer, true); // verified charmer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); - RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); ClearUnitState(UNIT_STATE_POSSESSED); ClearUnitState(UNIT_STATE_NO_ENVIRONMENT_UPD); break; @@ -17848,7 +17848,7 @@ void Unit::RemoveCharmedBy(Unit* charmer) if (GetCharmInfo()) GetCharmInfo()->SetPetNumber(0, true); else - sLog->outError("Aura::HandleModCharm: target=" UI64FMTD " with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId()); + LOG_ERROR("server", "Aura::HandleModCharm: target=" UI64FMTD " with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId()); } } break; @@ -18752,7 +18752,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId) if (!valid) { - sLog->outErrorDb("Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId); + LOG_ERROR("sql.sql", "Spell %u specified in npc_spellclick_spells is not a valid vehicle enter aura!", itr->second.spellId); continue; } @@ -18809,7 +18809,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a if (seatId >= 0 && seatId != GetTransSeat()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "EnterVehicle: %u leave vehicle %u seat %d and enter %d.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId); + LOG_DEBUG("vehicles", "EnterVehicle: %u leave vehicle %u seat %d and enter %d.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId); #endif ChangeSeat(seatId); } @@ -18819,7 +18819,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "EnterVehicle: %u exit %u and enter %u.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry()); + LOG_DEBUG("vehicles", "EnterVehicle: %u exit %u and enter %u.", GetEntry(), m_vehicle->GetBase()->GetEntry(), vehicle->GetBase()->GetEntry()); #endif ExitVehicle(); } @@ -19094,7 +19094,7 @@ bool Unit::CanSwim() const // Mirror client behavior, if this method returns false then client will not use swimming animation and for players will apply gravity as if there was no water if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CANNOT_SWIM)) return false; - if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED)) // is player + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED)) // is player return true; if (HasFlag(UNIT_FIELD_FLAGS_2, 0x1000000)) return false; @@ -19195,7 +19195,7 @@ void Unit::SendThreatListUpdate() { uint32 count = getThreatManager().getThreatList().size(); - //sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Send SMSG_THREAT_UPDATE Message"); + //LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message"); WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); data.append(GetPackGUID()); data << uint32(count); @@ -19216,7 +19216,7 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) uint32 count = getThreatManager().getThreatList().size(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); + LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); #endif WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); data.append(GetPackGUID()); @@ -19235,7 +19235,7 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) void Unit::SendClearThreatListOpcode() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Send SMSG_THREAT_CLEAR Message"); + LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_CLEAR Message"); #endif WorldPacket data(SMSG_THREAT_CLEAR, 8); data.append(GetPackGUID()); @@ -19245,7 +19245,7 @@ void Unit::SendClearThreatListOpcode() void Unit::SendRemoveFromThreatListOpcode(HostileReference* pHostileReference) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Send SMSG_THREAT_REMOVE Message"); + LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_REMOVE Message"); #endif WorldPacket data(SMSG_THREAT_REMOVE, 8 + 8); data.append(GetPackGUID()); @@ -19320,39 +19320,39 @@ void Unit::StopAttackFaction(uint32 faction_id) void Unit::OutDebugInfo() const { - sLog->outError("Unit::OutDebugInfo"); - sLog->outString("GUID " UI64FMTD ", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str()); - sLog->outString("OwnerGUID " UI64FMTD ", MinionGUID " UI64FMTD ", CharmerGUID " UI64FMTD ", CharmedGUID " UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID()); - sLog->outString("In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask); + LOG_ERROR("server", "Unit::OutDebugInfo"); + LOG_INFO("server", "GUID " UI64FMTD ", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str()); + LOG_INFO("server", "OwnerGUID " UI64FMTD ", MinionGUID " UI64FMTD ", CharmerGUID " UI64FMTD ", CharmedGUID " UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID()); + LOG_INFO("server", "In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask); if (IsInWorld()) - sLog->outString("Mapid %u", GetMapId()); + LOG_INFO("server", "Mapid %u", GetMapId()); - sLog->outStringInLine("Summon Slot: "); + LOG_INFO("server", "Summon Slot: "); for (uint32 i = 0; i < MAX_SUMMON_SLOT; ++i) - sLog->outStringInLine(UI64FMTD", ", m_SummonSlot[i]); - sLog->outString(); + LOG_INFO("server", UI64FMTD", ", m_SummonSlot[i]); + LOG_INFO("server", " "); - sLog->outStringInLine("Controlled List: "); + LOG_INFO("server", "Controlled List: "); for (ControlSet::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr) - sLog->outStringInLine(UI64FMTD", ", (*itr)->GetGUID()); - sLog->outString(); + LOG_INFO("server", UI64FMTD", ", (*itr)->GetGUID()); + LOG_INFO("server", " "); - sLog->outStringInLine("Aura List: "); + LOG_INFO("server", "Aura List: "); for (AuraApplicationMap::const_iterator itr = m_appliedAuras.begin(); itr != m_appliedAuras.end(); ++itr) - sLog->outStringInLine("%u, ", itr->first); - sLog->outString(); + LOG_INFO("server", "%u, ", itr->first); + LOG_INFO("server", " "); if (IsVehicle()) { - sLog->outStringInLine("Passenger List: "); + LOG_INFO("server", "Passenger List: "); for (SeatMap::iterator itr = GetVehicleKit()->Seats.begin(); itr != GetVehicleKit()->Seats.end(); ++itr) if (Unit* passenger = ObjectAccessor::GetUnit(*GetVehicleBase(), itr->second.Passenger.Guid)) - sLog->outStringInLine(UI64FMTD", ", passenger->GetGUID()); - sLog->outString(); + LOG_INFO("server", UI64FMTD", ", passenger->GetGUID()); + LOG_INFO("server", " "); } if (GetVehicle()) - sLog->outString("On vehicle %u.", GetVehicleBase()->GetEntry()); + LOG_INFO("server", "On vehicle %u.", GetVehicleBase()->GetEntry()); } class AuraMunchingQueue : public BasicEvent diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index d547f2a92d..bbbd9dc7aa 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -15,6 +15,7 @@ #include "Object.h" #include "SpellAuraDefines.h" #include "ThreatManager.h" +#include #define WORLD_TRIGGER 12999 @@ -280,20 +281,21 @@ enum HitInfo HITINFO_FULL_RESIST = 0x00000080, HITINFO_PARTIAL_RESIST = 0x00000100, HITINFO_CRITICALHIT = 0x00000200, // critical hit - // 0x00000400 - // 0x00000800 - // 0x00001000 + HITINFO_UNK10 = 0x00000400, + HITINFO_UNK11 = 0x00000800, + HITINFO_UNK12 = 0x00001000, HITINFO_BLOCK = 0x00002000, // blocked damage - // 0x00004000 // Hides worldtext for 0 damage - // 0x00008000 // Related to blood visual + HITINFO_UNK14 = 0x00004000, // set only if meleespellid is present// no world text when victim is hit for 0 dmg(HideWorldTextForNoDamage?) + HITINFO_UNK15 = 0x00008000, // player victim?// something related to blod sprut visual (BloodSpurtInBack?) HITINFO_GLANCING = 0x00010000, HITINFO_CRUSHING = 0x00020000, HITINFO_NO_ANIMATION = 0x00040000, - // 0x00080000 - // 0x00100000 + HITINFO_UNK19 = 0x00080000, + HITINFO_UNK20 = 0x00100000, HITINFO_SWINGNOHITSOUND = 0x00200000, // unused? - // 0x00400000 - HITINFO_RAGE_GAIN = 0x00800000 + HITINFO_UNK22 = 0x00400000, + HITINFO_RAGE_GAIN = 0x00800000, + HITINFO_FAKE_DAMAGE = 0x01000000 // enables damage animation even if no damage done, set only if no damage }; //i would like to remove this: (it is defined in item.h @@ -581,49 +583,49 @@ enum DamageEffectType // Value masks for UNIT_FIELD_FLAGS enum UnitFlags { - UNIT_FLAG_SERVER_CONTROLLED = 0x00000001, // set only when unit movement is controlled by server - by SPLINE/MONSTER_MOVE packets, together with UNIT_FLAG_STUNNED; only set to units controlled by client; client function CGUnit_C::IsClientControlled returns false when set for owner - UNIT_FLAG_NON_ATTACKABLE = 0x00000002, // not attackable - UNIT_FLAG_DISABLE_MOVE = 0x00000004, - UNIT_FLAG_PVP_ATTACKABLE = 0x00000008, // allow apply pvp rules to attackable state in addition to faction dependent state - UNIT_FLAG_RENAME = 0x00000010, - UNIT_FLAG_PREPARATION = 0x00000020, // don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_WHILE_PREP - UNIT_FLAG_UNK_6 = 0x00000040, - UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE - UNIT_FLAG_IMMUNE_TO_PC = 0x00000100, // disables combat/assistance with PlayerCharacters (PC) - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget - UNIT_FLAG_IMMUNE_TO_NPC = 0x00000200, // disables combat/assistance with NonPlayerCharacters (NPC) - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget - UNIT_FLAG_LOOTING = 0x00000400, // loot animation - UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8 - UNIT_FLAG_PVP = 0x00001000, // changed in 3.0.3 - UNIT_FLAG_SILENCED = 0x00002000, // silenced, 2.1.1 - UNIT_FLAG_CANNOT_SWIM = 0x00004000, // 2.0.8 - UNIT_FLAG_SWIMMING = 0x00008000, // shows swim animation in water - UNIT_FLAG_NON_ATTACKABLE_2 = 0x00010000, // removes attackable icon, if on yourself, cannot assist self but can cast TARGET_SELF spells - added by SPELL_AURA_MOD_UNATTACKABLE - UNIT_FLAG_PACIFIED = 0x00020000, // 3.0.3 ok - UNIT_FLAG_STUNNED = 0x00040000, // 3.0.3 ok - UNIT_FLAG_IN_COMBAT = 0x00080000, - UNIT_FLAG_TAXI_FLIGHT = 0x00100000, // disable casting at client side spell not allowed by taxi flight (mounted?), probably used with 0x4 flag - UNIT_FLAG_DISARMED = 0x00200000, // 3.0.3, disable melee spells casting..., "Required melee weapon" added to melee spells tooltip. - UNIT_FLAG_CONFUSED = 0x00400000, - UNIT_FLAG_FLEEING = 0x00800000, - UNIT_FLAG_PLAYER_CONTROLLED = 0x01000000, // used in spell Eyes of the Beast for pet... let attack by controlled creature - UNIT_FLAG_NOT_SELECTABLE = 0x02000000, - UNIT_FLAG_SKINNABLE = 0x04000000, - UNIT_FLAG_MOUNT = 0x08000000, - UNIT_FLAG_UNK_28 = 0x10000000, - UNIT_FLAG_UNK_29 = 0x20000000, // used in Feing Death spell - UNIT_FLAG_SHEATHE = 0x40000000, - UNIT_FLAG_IMMUNE = 0x80000000, // Immune to damage + UNIT_FLAG_SERVER_CONTROLLED = 0x00000001, // set only when unit movement is controlled by server - by SPLINE/MONSTER_MOVE packets, together with UNIT_FLAG_STUNNED; only set to units controlled by client; client function CGUnit_C::IsClientControlled returns false when set for owner + UNIT_FLAG_NON_ATTACKABLE = 0x00000002, // not attackable + UNIT_FLAG_DISABLE_MOVE = 0x00000004, + UNIT_FLAG_PLAYER_CONTROLLED = 0x00000008, // controlled by player, use _IMMUNE_TO_PC instead of _IMMUNE_TO_NPC + UNIT_FLAG_RENAME = 0x00000010, + UNIT_FLAG_PREPARATION = 0x00000020, // don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_WHILE_PREP + UNIT_FLAG_UNK_6 = 0x00000040, + UNIT_FLAG_NOT_ATTACKABLE_1 = 0x00000080, // ?? (UNIT_FLAG_PLAYER_CONTROLLED | UNIT_FLAG_NOT_ATTACKABLE_1) is NON_PVP_ATTACKABLE + UNIT_FLAG_IMMUNE_TO_PC = 0x00000100, // disables combat/assistance with PlayerCharacters (PC) - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget + UNIT_FLAG_IMMUNE_TO_NPC = 0x00000200, // disables combat/assistance with NonPlayerCharacters (NPC) - see Unit::_IsValidAttackTarget, Unit::_IsValidAssistTarget + UNIT_FLAG_LOOTING = 0x00000400, // loot animation + UNIT_FLAG_PET_IN_COMBAT = 0x00000800, // in combat?, 2.0.8 + UNIT_FLAG_PVP = 0x00001000, // changed in 3.0.3 + UNIT_FLAG_SILENCED = 0x00002000, // silenced, 2.1.1 + UNIT_FLAG_CANNOT_SWIM = 0x00004000, // 2.0.8 + UNIT_FLAG_SWIMMING = 0x00008000, // shows swim animation in water + UNIT_FLAG_NON_ATTACKABLE_2 = 0x00010000, // removes attackable icon, if on yourself, cannot assist self but can cast TARGET_SELF spells - added by SPELL_AURA_MOD_UNATTACKABLE + UNIT_FLAG_PACIFIED = 0x00020000, // 3.0.3 ok + UNIT_FLAG_STUNNED = 0x00040000, // 3.0.3 ok + UNIT_FLAG_IN_COMBAT = 0x00080000, + UNIT_FLAG_TAXI_FLIGHT = 0x00100000, // disable casting at client side spell not allowed by taxi flight (mounted?), probably used with 0x4 flag + UNIT_FLAG_DISARMED = 0x00200000, // 3.0.3, disable melee spells casting..., "Required melee weapon" added to melee spells tooltip. + UNIT_FLAG_CONFUSED = 0x00400000, + UNIT_FLAG_FLEEING = 0x00800000, + UNIT_FLAG_POSSESSED = 0x01000000, // under direct client control by a player (possess or vehicle) + UNIT_FLAG_NOT_SELECTABLE = 0x02000000, + UNIT_FLAG_SKINNABLE = 0x04000000, + UNIT_FLAG_MOUNT = 0x08000000, + UNIT_FLAG_UNK_28 = 0x10000000, + UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT = 0x20000000, // Prevent automatically playing emotes from parsing chat text, for example "lol" in /say, ending message with ? or !, or using /yell + UNIT_FLAG_SHEATHE = 0x40000000, + UNIT_FLAG_IMMUNE = 0x80000000, // Immune to damage }; // Value masks for UNIT_FIELD_FLAGS_2 enum UnitFlags2 { UNIT_FLAG2_FEIGN_DEATH = 0x00000001, - UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip) + UNIT_FLAG2_HIDE_BODY = 0x00000002, // Hide unit model (show only player equip) UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004, UNIT_FLAG2_COMPREHEND_LANG = 0x00000008, UNIT_FLAG2_MIRROR_IMAGE = 0x00000010, - UNIT_FLAG2_INSTANTLY_APPEAR_MODEL = 0x00000020, // Unit model instantly appears when summoned (does not fade in) + UNIT_FLAG2_DO_NOT_FADE_IN = 0x00000020, // Unit model instantly appears when summoned (does not fade in) UNIT_FLAG2_FORCE_MOVEMENT = 0x00000040, UNIT_FLAG2_DISARM_OFFHAND = 0x00000080, UNIT_FLAG2_DISABLE_PRED_STATS = 0x00000100, // Player has disabled predicted stats (Used by raid frames) @@ -632,7 +634,7 @@ enum UnitFlags2 UNIT_FLAG2_RESTRICT_PARTY_INTERACTION = 0x00001000, // Restrict interaction to party or raid UNIT_FLAG2_PREVENT_SPELL_CLICK = 0x00002000, // Prevent spellclick UNIT_FLAG2_ALLOW_ENEMY_INTERACT = 0x00004000, - UNIT_FLAG2_DISABLE_TURN = 0x00008000, + UNIT_FLAG2_CANNOT_TURN = 0x00008000, UNIT_FLAG2_UNK2 = 0x00010000, UNIT_FLAG2_PLAY_DEATH_ANIM = 0x00020000, // Plays special death animation upon death UNIT_FLAG2_ALLOW_CHEAT_SPELLS = 0x00040000, // Allows casting spells with AttributesEx7 & SPELL_ATTR7_IS_CHEAT_SPELL @@ -641,34 +643,34 @@ enum UnitFlags2 /// Non Player Character flags enum NPCFlags { - UNIT_NPC_FLAG_NONE = 0x00000000, - UNIT_NPC_FLAG_GOSSIP = 0x00000001, // 100% - UNIT_NPC_FLAG_QUESTGIVER = 0x00000002, // guessed, probably ok + UNIT_NPC_FLAG_NONE = 0x00000000, // SKIP + UNIT_NPC_FLAG_GOSSIP = 0x00000001, // TITLE has gossip menu DESCRIPTION 100% + UNIT_NPC_FLAG_QUESTGIVER = 0x00000002, // TITLE is quest giver DESCRIPTION guessed, probably ok UNIT_NPC_FLAG_UNK1 = 0x00000004, UNIT_NPC_FLAG_UNK2 = 0x00000008, - UNIT_NPC_FLAG_TRAINER = 0x00000010, // 100% - UNIT_NPC_FLAG_TRAINER_CLASS = 0x00000020, // 100% - UNIT_NPC_FLAG_TRAINER_PROFESSION = 0x00000040, // 100% - UNIT_NPC_FLAG_VENDOR = 0x00000080, // 100% - UNIT_NPC_FLAG_VENDOR_AMMO = 0x00000100, // 100%, general goods vendor - UNIT_NPC_FLAG_VENDOR_FOOD = 0x00000200, // 100% - UNIT_NPC_FLAG_VENDOR_POISON = 0x00000400, // guessed - UNIT_NPC_FLAG_VENDOR_REAGENT = 0x00000800, // 100% - UNIT_NPC_FLAG_REPAIR = 0x00001000, // 100% - UNIT_NPC_FLAG_FLIGHTMASTER = 0x00002000, // 100% - UNIT_NPC_FLAG_SPIRITHEALER = 0x00004000, // guessed - UNIT_NPC_FLAG_SPIRITGUIDE = 0x00008000, // guessed - UNIT_NPC_FLAG_INNKEEPER = 0x00010000, // 100% - UNIT_NPC_FLAG_BANKER = 0x00020000, // 100% - UNIT_NPC_FLAG_PETITIONER = 0x00040000, // 100% 0xC0000 = guild petitions, 0x40000 = arena team petitions - UNIT_NPC_FLAG_TABARDDESIGNER = 0x00080000, // 100% - UNIT_NPC_FLAG_BATTLEMASTER = 0x00100000, // 100% - UNIT_NPC_FLAG_AUCTIONEER = 0x00200000, // 100% - UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // 100% - UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // cause client to send 997 opcode - UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // cause client to send 1015 opcode (spell click) - UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000, // players with mounts that have vehicle data should have it set - UNIT_NPC_FLAG_MAILBOX = 0x04000000 // + UNIT_NPC_FLAG_TRAINER = 0x00000010, // TITLE is trainer DESCRIPTION 100% + UNIT_NPC_FLAG_TRAINER_CLASS = 0x00000020, // TITLE is class trainer DESCRIPTION 100% + UNIT_NPC_FLAG_TRAINER_PROFESSION = 0x00000040, // TITLE is profession trainer DESCRIPTION 100% + UNIT_NPC_FLAG_VENDOR = 0x00000080, // TITLE is vendor (generic) DESCRIPTION 100% + UNIT_NPC_FLAG_VENDOR_AMMO = 0x00000100, // TITLE is vendor (ammo) DESCRIPTION 100%, general goods vendor + UNIT_NPC_FLAG_VENDOR_FOOD = 0x00000200, // TITLE is vendor (food) DESCRIPTION 100% + UNIT_NPC_FLAG_VENDOR_POISON = 0x00000400, // TITLE is vendor (poison) DESCRIPTION guessed + UNIT_NPC_FLAG_VENDOR_REAGENT = 0x00000800, // TITLE is vendor (reagents) DESCRIPTION 100% + UNIT_NPC_FLAG_REPAIR = 0x00001000, // TITLE can repair DESCRIPTION 100% + UNIT_NPC_FLAG_FLIGHTMASTER = 0x00002000, // TITLE is flight master DESCRIPTION 100% + UNIT_NPC_FLAG_SPIRITHEALER = 0x00004000, // TITLE is spirit healer DESCRIPTION guessed + UNIT_NPC_FLAG_SPIRITGUIDE = 0x00008000, // TITLE is spirit guide DESCRIPTION guessed + UNIT_NPC_FLAG_INNKEEPER = 0x00010000, // TITLE is innkeeper + UNIT_NPC_FLAG_BANKER = 0x00020000, // TITLE is banker DESCRIPTION 100% + UNIT_NPC_FLAG_PETITIONER = 0x00040000, // TITLE handles guild/arena petitions DESCRIPTION 100% 0xC0000 = guild petitions, 0x40000 = arena team petitions + UNIT_NPC_FLAG_TABARDDESIGNER = 0x00080000, // TITLE is guild tabard designer DESCRIPTION 100% + UNIT_NPC_FLAG_BATTLEMASTER = 0x00100000, // TITLE is battlemaster DESCRIPTION 100% + UNIT_NPC_FLAG_AUCTIONEER = 0x00200000, // TITLE is auctioneer DESCRIPTION 100% + UNIT_NPC_FLAG_STABLEMASTER = 0x00400000, // TITLE is stable master DESCRIPTION 100% + UNIT_NPC_FLAG_GUILD_BANKER = 0x00800000, // TITLE is guild banker DESCRIPTION cause client to send 997 opcode + UNIT_NPC_FLAG_SPELLCLICK = 0x01000000, // TITLE has spell click enabled DESCRIPTION cause client to send 1015 opcode (spell click) + UNIT_NPC_FLAG_PLAYER_VEHICLE = 0x02000000, // TITLE is player vehicle DESCRIPTION players with mounts that have vehicle data should have it set + UNIT_NPC_FLAG_MAILBOX = 0x04000000 // TITLE is mailbox }; enum MovementFlags diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 3b91ddc2de..86d35aedfb 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -52,11 +52,11 @@ Vehicle::~Vehicle() { if (Unit* unit = ObjectAccessor::FindUnit(itr->second.Passenger.Guid)) { - sLog->outString("ZOMG! ~Vehicle(), unit: %s, entry: %u, typeid: %u, this_entry: %u, this_typeid: %u!", unit->GetName().c_str(), unit->GetEntry(), unit->GetTypeId(), _me ? _me->GetEntry() : 0, _me ? _me->GetTypeId() : 0); + LOG_INFO("server", "ZOMG! ~Vehicle(), unit: %s, entry: %u, typeid: %u, this_entry: %u, this_typeid: %u!", unit->GetName().c_str(), unit->GetEntry(), unit->GetTypeId(), _me ? _me->GetEntry() : 0, _me ? _me->GetTypeId() : 0); unit->_ExitVehicle(); } else - sLog->outString("ZOMG! ~Vehicle(), unknown guid!"); + LOG_INFO("server", "ZOMG! ~Vehicle(), unknown guid!"); } //ASSERT(!itr->second.IsEmpty()); } @@ -95,13 +95,13 @@ void Vehicle::Uninstall() /// @Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING && !GetBase()->HasUnitTypeMask(UNIT_MASK_MINION)) { - sLog->outError("Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! " + LOG_ERROR("server", "Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! " "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry()); return; } _status = STATUS_UNINSTALLING; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Uninstall Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); + LOG_DEBUG("vehicles", "Vehicle::Uninstall Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); #endif RemoveAllPassengers(); @@ -112,7 +112,7 @@ void Vehicle::Uninstall() void Vehicle::Reset(bool evading /*= false*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Reset Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); + LOG_DEBUG("vehicles", "Vehicle::Reset Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); #endif if (_me->GetTypeId() == TYPEID_PLAYER) { @@ -198,7 +198,7 @@ void Vehicle::ApplyAllImmunities() void Vehicle::RemoveAllPassengers() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::RemoveAllPassengers. Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); + LOG_DEBUG("vehicles", "Vehicle::RemoveAllPassengers. Entry: %u, GuidLow: %u", _creatureEntry, _me->GetGUIDLow()); #endif // Passengers always cast an aura with SPELL_AURA_CONTROL_VEHICLE on the vehicle @@ -263,13 +263,13 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ /// @Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.) if (_status == STATUS_UNINSTALLING) { - sLog->outError("Vehicle GuidLow: %u, Entry: %u attempts to install accessory Entry: %u on seat %d with STATUS_UNINSTALLING! " + LOG_ERROR("server", "Vehicle GuidLow: %u, Entry: %u attempts to install accessory Entry: %u on seat %d with STATUS_UNINSTALLING! " "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry(), entry, (int32)seatId); return; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle: Installing accessory entry %u on vehicle entry %u (seat:%i)", entry, GetCreatureEntry(), seatId); + LOG_DEBUG("vehicles", "Vehicle: Installing accessory entry %u on vehicle entry %u (seat:%i)", entry, GetCreatureEntry(), seatId); #endif if (Unit* passenger = GetPassenger(seatId)) { @@ -310,7 +310,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) if (_status == STATUS_UNINSTALLING) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "Passenger GuidLow: %u, Entry: %u, attempting to board vehicle GuidLow: %u, Entry: %u during uninstall! SeatId: %i", unit->GetGUIDLow(), unit->GetEntry(), _me->GetGUIDLow(), _me->GetEntry(), (int32)seatId); + LOG_DEBUG("vehicles", "Passenger GuidLow: %u, Entry: %u, attempting to board vehicle GuidLow: %u, Entry: %u during uninstall! SeatId: %i", unit->GetGUIDLow(), unit->GetEntry(), _me->GetGUIDLow(), _me->GetEntry(), (int32)seatId); #endif return false; } @@ -346,7 +346,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); + LOG_DEBUG("vehicles", "Unit %s enter vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); #endif seat->second.Passenger.Guid = unit->GetGUID(); @@ -394,15 +394,15 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId) } catch (...) { - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy()!"); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). not null: %u", _me ? 1 : 0); + LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy()!"); + LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). not null: %u", _me ? 1 : 0); if (!_me) return false; - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is: %u!", _me->IsInWorld()); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is2: %u!", _me->IsDuringRemoveFromWorld()); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s!", _me->GetName().c_str()); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). typeid: %u!", _me->GetTypeId()); - sLog->outString("ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s, typeid: %u, in world: %u, duringremove: %u has wrong CharmType! Charmer %s, typeid: %u, in world: %u, duringremove: %u.", _me->GetName().c_str(), _me->GetTypeId(), _me->IsInWorld(), _me->IsDuringRemoveFromWorld(), unit->GetName().c_str(), unit->GetTypeId(), unit->IsInWorld(), unit->IsDuringRemoveFromWorld()); + LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is: %u!", _me->IsInWorld()); + LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Is2: %u!", _me->IsDuringRemoveFromWorld()); + LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s!", _me->GetName().c_str()); + LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). typeid: %u!", _me->GetTypeId()); + LOG_INFO("server", "ZOMG! CRASH! Try-catch in Unit::SetCharmedBy(). Unit %s, typeid: %u, in world: %u, duringremove: %u has wrong CharmType! Charmer %s, typeid: %u, in world: %u, duringremove: %u.", _me->GetName().c_str(), _me->GetTypeId(), _me->IsInWorld(), _me->IsDuringRemoveFromWorld(), unit->GetName().c_str(), unit->GetTypeId(), unit->IsInWorld(), unit->IsDuringRemoveFromWorld()); return false; } } @@ -457,7 +457,7 @@ void Vehicle::RemovePassenger(Unit* unit) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); + LOG_DEBUG("vehicles", "Unit %s exit vehicle entry %u id %u dbguid %u seat %d", unit->GetName().c_str(), _me->GetEntry(), _vehicleInfo->m_ID, _me->GetGUIDLow(), (int32)seat->first); #endif if (seat->second.SeatInfo->CanEnterOrExit() && ++_usableSeatNum) @@ -525,7 +525,7 @@ void Vehicle::Dismiss() return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Dismiss Entry: %u, GuidLow %u", _creatureEntry, _me->GetGUIDLow()); + LOG_DEBUG("vehicles", "Vehicle::Dismiss Entry: %u, GuidLow %u", _creatureEntry, _me->GetGUIDLow()); #endif Uninstall(); GetBase()->ToCreature()->DespawnOrUnsummon(); diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 7f2736b62b..bbdc5a2643 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -222,8 +222,8 @@ void GameEventMgr::LoadFromDB() if (!result) { mGameEvent.clear(); - sLog->outErrorDb(">> Loaded 0 game events. DB table `game_event` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 game events. DB table `game_event` is empty."); + LOG_INFO("server", " "); return; } @@ -235,7 +235,7 @@ void GameEventMgr::LoadFromDB() uint8 event_id = fields[0].GetUInt8(); if (event_id == 0) { - sLog->outErrorDb("`game_event` game event entry 0 is reserved and can't be used."); + LOG_ERROR("sql.sql", "`game_event` game event entry 0 is reserved and can't be used."); continue; } @@ -260,7 +260,7 @@ void GameEventMgr::LoadFromDB() if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check { - sLog->outErrorDb("`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id); + LOG_ERROR("sql.sql", "`game_event` game event id (%i) isn't a world event and has length = 0, thus it can't be used.", event_id); continue; } @@ -268,7 +268,7 @@ void GameEventMgr::LoadFromDB() { if (!sHolidaysStore.LookupEntry(pGameEvent.holiday_id)) { - sLog->outErrorDb("`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id); + LOG_ERROR("sql.sql", "`game_event` game event id (%i) have not existed holiday id %u.", event_id, pGameEvent.holiday_id); pGameEvent.holiday_id = HOLIDAY_NONE; } @@ -276,11 +276,11 @@ void GameEventMgr::LoadFromDB() } } while (result->NextRow()); - sLog->outString(">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } - sLog->outString("Loading Game Event Saves Data..."); + LOG_INFO("server", "Loading Game Event Saves Data..."); { uint32 oldMSTime = getMSTime(); @@ -289,8 +289,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty."); + LOG_INFO("server", " "); } else { @@ -303,7 +303,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_save` game event entry (%i) is out of range compared to max event entry in `game_event`", event_id); continue; } @@ -314,19 +314,19 @@ void GameEventMgr::LoadFromDB() } else { - sLog->outErrorDb("game_event_save includes event save for non-worldevent id %u", event_id); + LOG_ERROR("sql.sql", "game_event_save includes event save for non-worldevent id %u", event_id); continue; } ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Prerequisite Data..."); + LOG_INFO("server", "Loading Game Event Prerequisite Data..."); { uint32 oldMSTime = getMSTime(); @@ -334,8 +334,8 @@ void GameEventMgr::LoadFromDB() QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite"); if (!result) { - sLog->outString(">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty."); + LOG_INFO("server", " "); } else { @@ -348,7 +348,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_prerequisite` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -357,26 +357,26 @@ void GameEventMgr::LoadFromDB() uint16 prerequisite_event = fields[1].GetUInt32(); if (prerequisite_event >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event); + LOG_ERROR("sql.sql", "`game_event_prerequisite` game event prerequisite id (%i) is out of range compared to max event id in `game_event`", prerequisite_event); continue; } mGameEvent[event_id].prerequisite_events.insert(prerequisite_event); } else { - sLog->outErrorDb("game_event_prerequisiste includes event entry for non-worldevent id %u", event_id); + LOG_ERROR("sql.sql", "game_event_prerequisiste includes event entry for non-worldevent id %u", event_id); continue; } ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Creature Data..."); + LOG_INFO("server", "Loading Game Event Creature Data..."); { uint32 oldMSTime = getMSTime(); @@ -386,8 +386,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty"); + LOG_INFO("server", " "); } else { @@ -403,7 +403,7 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - sLog->outErrorDb("`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_creature` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -413,12 +413,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event GO Data..."); + LOG_INFO("server", "Loading Game Event GO Data..."); { uint32 oldMSTime = getMSTime(); @@ -428,8 +428,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty."); + LOG_INFO("server", " "); } else { @@ -445,7 +445,7 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - sLog->outErrorDb("`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_gameobject` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -455,12 +455,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Model/Equipment Change Data..."); + LOG_INFO("server", "Loading Game Event Model/Equipment Change Data..."); { uint32 oldMSTime = getMSTime(); @@ -470,8 +470,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty."); + LOG_INFO("server", " "); } else { @@ -486,7 +486,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventModelEquip.size()) { - sLog->outErrorDb("`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_model_equip` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -502,7 +502,7 @@ void GameEventMgr::LoadFromDB() int8 equipId = static_cast(newModelEquipSet.equipment_id); if (!sObjectMgr->GetEquipmentInfo(entry, equipId)) { - sLog->outErrorDb("Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", + LOG_ERROR("sql.sql", "Table `game_event_model_equip` have creature (Guid: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", guid, newModelEquipSet.equipment_id); continue; } @@ -513,12 +513,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Quest Data..."); + LOG_INFO("server", "Loading Game Event Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -527,8 +527,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty."); + LOG_INFO("server", " "); } else { @@ -543,7 +543,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventCreatureQuests.size()) { - sLog->outErrorDb("`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_creature_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -553,12 +553,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event GO Quest Data..."); + LOG_INFO("server", "Loading Game Event GO Quest Data..."); { uint32 oldMSTime = getMSTime(); @@ -567,8 +567,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty."); + LOG_INFO("server", " "); } else { @@ -583,7 +583,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventGameObjectQuests.size()) { - sLog->outErrorDb("`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_gameobject_quest` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -593,12 +593,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Quest Condition Data..."); + LOG_INFO("server", "Loading Game Event Quest Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -607,8 +607,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty."); + LOG_INFO("server", " "); } else { @@ -624,7 +624,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_quest_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -635,12 +635,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Condition Data..."); + LOG_INFO("server", "Loading Game Event Condition Data..."); { uint32 oldMSTime = getMSTime(); @@ -649,8 +649,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty."); + LOG_INFO("server", " "); } else { @@ -664,7 +664,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_condition` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -676,12 +676,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Condition Save Data..."); + LOG_INFO("server", "Loading Game Event Condition Save Data..."); { uint32 oldMSTime = getMSTime(); @@ -690,8 +690,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty."); + LOG_INFO("server", " "); } else { @@ -705,7 +705,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_condition_save` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -716,19 +716,19 @@ void GameEventMgr::LoadFromDB() } else { - sLog->outErrorDb("game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition); + LOG_ERROR("sql.sql", "game_event_condition_save contains not present condition evt id %u cond id %u", event_id, condition); continue; } ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event NPCflag Data..."); + LOG_INFO("server", "Loading Game Event NPCflag Data..."); { uint32 oldMSTime = getMSTime(); @@ -737,8 +737,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty."); + LOG_INFO("server", " "); } else { @@ -753,7 +753,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_npcflag` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -762,12 +762,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Seasonal Quest Relations..."); + LOG_INFO("server", "Loading Game Event Seasonal Quest Relations..."); { uint32 oldMSTime = getMSTime(); @@ -776,8 +776,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty."); + LOG_INFO("server", " "); } else { @@ -793,13 +793,13 @@ void GameEventMgr::LoadFromDB() if (!questTemplate) { - sLog->outErrorDb("`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId); + LOG_ERROR("sql.sql", "`game_event_seasonal_questrelation` quest id (%u) does not exist in `quest_template`", questId); continue; } if (eventEntry >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry); + LOG_ERROR("sql.sql", "`game_event_seasonal_questrelation` event id (%u) is out of range compared to max event in `game_event`", eventEntry); continue; } @@ -807,12 +807,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Vendor Additions Data..."); + LOG_INFO("server", "Loading Game Event Vendor Additions Data..."); { uint32 oldMSTime = getMSTime(); @@ -821,8 +821,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty."); + LOG_INFO("server", " "); } else { @@ -835,7 +835,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEventVendors.size()) { - sLog->outErrorDb("`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_npc_vendor` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -872,12 +872,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Battleground Data..."); + LOG_INFO("server", "Loading Game Event Battleground Data..."); { uint32 oldMSTime = getMSTime(); @@ -886,8 +886,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 battleground holidays in game events. DB table `game_event_battleground_holiday` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 battleground holidays in game events. DB table `game_event_battleground_holiday` is empty."); + LOG_INFO("server", " "); } else { @@ -900,7 +900,7 @@ void GameEventMgr::LoadFromDB() if (event_id >= mGameEvent.size()) { - sLog->outErrorDb("`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_battleground_holiday` game event id (%u) is out of range compared to max event id in `game_event`", event_id); continue; } @@ -909,12 +909,12 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Game Event Pool Data..."); + LOG_INFO("server", "Loading Game Event Pool Data..."); { uint32 oldMSTime = getMSTime(); @@ -924,8 +924,8 @@ void GameEventMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty."); + LOG_INFO("server", " "); } else { @@ -941,13 +941,13 @@ void GameEventMgr::LoadFromDB() if (internal_event_id < 0 || internal_event_id >= int32(mGameEventPoolIds.size())) { - sLog->outErrorDb("`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id); + LOG_ERROR("sql.sql", "`game_event_pool` game event id (%i) is out of range compared to max event id in `game_event`", event_id); continue; } if (!sPoolMgr->CheckPool(entry)) { - sLog->outErrorDb("Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry); + LOG_ERROR("sql.sql", "Pool Id (%u) has all creatures or gameobjects with explicit chance sum <>100 and no equal chance defined. The pool system cannot pick one to spawn.", entry); continue; } @@ -957,8 +957,8 @@ void GameEventMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } } @@ -972,7 +972,7 @@ void GameEventMgr::LoadHolidayDates() if (!result) { - sLog->outString(">> Loaded 0 holiday dates. DB table `holiday_dates` is empty."); + LOG_INFO("server", ">> Loaded 0 holiday dates. DB table `holiday_dates` is empty."); return; } @@ -985,14 +985,14 @@ void GameEventMgr::LoadHolidayDates() HolidaysEntry* entry = const_cast(sHolidaysStore.LookupEntry(holidayId)); if (!entry) { - sLog->outErrorDb("holiday_dates entry has invalid holiday id %u.", holidayId); + LOG_ERROR("sql.sql", "holiday_dates entry has invalid holiday id %u.", holidayId); continue; } uint8 dateId = fields[1].GetUInt8(); if (dateId >= MAX_HOLIDAY_DATES) { - sLog->outErrorDb("holiday_dates entry has out of range date_id %u.", dateId); + LOG_ERROR("sql.sql", "holiday_dates entry has out of range date_id %u.", dateId); continue; } entry->Date[dateId] = fields[2].GetUInt32(); @@ -1009,7 +1009,7 @@ void GameEventMgr::LoadHolidayDates() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u holiday dates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u holiday dates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } uint32 GameEventMgr::GetNPCFlag(Creature* cr) @@ -1069,7 +1069,7 @@ void GameEventMgr::StartArenaSeason() if (!result) { - sLog->outError("ArenaSeason (%u) must be an existant Arena Season", season); + LOG_ERROR("server", "ArenaSeason (%u) must be an existant Arena Season", season); return; } @@ -1078,13 +1078,13 @@ void GameEventMgr::StartArenaSeason() if (eventId >= mGameEvent.size()) { - sLog->outError("EventEntry %u for ArenaSeason (%u) does not exists", eventId, season); + LOG_ERROR("server", "EventEntry %u for ArenaSeason (%u) does not exists", eventId, season); return; } StartEvent(eventId, true); - sLog->outString("Arena Season %u started...", season); - sLog->outString(); + LOG_INFO("server", "Arena Season %u started...", season); + LOG_INFO("server", " "); } uint32 GameEventMgr::Update() // return the next event delay in ms @@ -1097,7 +1097,7 @@ uint32 GameEventMgr::Update() // return the next e { // must do the activating first, and after that the deactivating // so first queue it - //sLog->outErrorDb("Checking event %u", itr); + //LOG_ERROR("sql.sql", "Checking event %u", itr); if (CheckOneGameEvent(itr)) { // if the world event is in NEXTPHASE state, and the time has passed to finish this event, then do so @@ -1118,14 +1118,12 @@ uint32 GameEventMgr::Update() // return the next e // changed, save to DB the gameevent state, will be updated in next update cycle SaveWorldEventStateToDB(itr); - //sLog->outDebug("GameEvent %u is active", itr->first); // queue for activation if (!IsActiveEvent(itr)) activate.insert(itr); } else { - //sLog->outDebug("GameEvent %u is not active", itr->first); if (IsActiveEvent(itr)) { // Xinef: do not deactivate internal events on whim @@ -1159,7 +1157,7 @@ uint32 GameEventMgr::Update() // return the next e StopEvent(*itr); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Next game event check in %u seconds.", nextEventDelay + 1); + LOG_DEBUG("server", "Next game event check in %u seconds.", nextEventDelay + 1); #endif return (nextEventDelay + 1) * IN_MILLISECONDS; // Add 1 second to be sure event has started/stopped at next call } @@ -1167,7 +1165,7 @@ uint32 GameEventMgr::Update() // return the next e void GameEventMgr::UnApplyEvent(uint16 event_id) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str()); + LOG_DEBUG("server", "GameEvent %u \"%s\" removed.", event_id, mGameEvent[event_id].description.c_str()); #endif //! Run SAI scripts with SMART_EVENT_GAME_EVENT_END RunSmartAIScripts(event_id, false); @@ -1198,7 +1196,7 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id) sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str()); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str()); + LOG_DEBUG("server", "GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str()); #endif //! Run SAI scripts with SMART_EVENT_GAME_EVENT_END @@ -1271,7 +1269,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SZFMTD ")", + LOG_ERROR("server", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SZFMTD ")", internal_event_id, mGameEventCreatureGuids.size()); return; } @@ -1289,7 +1287,6 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { Creature* creature = new Creature; - //sLog->outDebug("Spawning creature %u", *itr); if (!creature->LoadCreatureFromDB(*itr, map)) delete creature; } @@ -1298,7 +1295,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SZFMTD ")", + LOG_ERROR("server", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SZFMTD ")", internal_event_id, mGameEventGameobjectGuids.size()); return; } @@ -1316,7 +1313,6 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { GameObject* pGameobject = sObjectMgr->IsGameObjectStaticTransport(data->id) ? new StaticTransport() : new GameObject(); - //sLog->outDebug("Spawning gameobject %u", *itr); //TODO: find out when it is add to map if (!pGameobject->LoadGameObjectFromDB(*itr, map, false)) delete pGameobject; @@ -1331,7 +1327,7 @@ void GameEventMgr::GameEventSpawn(int16 event_id) if (internal_event_id >= int32(mGameEventPoolIds.size())) { - sLog->outError("GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SZFMTD ")", + LOG_ERROR("server", "GameEventMgr::GameEventSpawn attempt access to out of range mGameEventPoolIds element %u (size: " SZFMTD ")", internal_event_id, mGameEventPoolIds.size()); return; } @@ -1346,7 +1342,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) if (internal_event_id < 0 || internal_event_id >= int32(mGameEventCreatureGuids.size())) { - sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SZFMTD ")", + LOG_ERROR("server", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventCreatureGuids element %i (size: " SZFMTD ")", internal_event_id, mGameEventCreatureGuids.size()); return; } @@ -1368,7 +1364,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) if (internal_event_id >= int32(mGameEventGameobjectGuids.size())) { - sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SZFMTD ")", + LOG_ERROR("server", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventGameobjectGuids element %i (size: " SZFMTD ")", internal_event_id, mGameEventGameobjectGuids.size()); return; } @@ -1389,7 +1385,7 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) } if (internal_event_id >= int32(mGameEventPoolIds.size())) { - sLog->outError("GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SZFMTD ")", internal_event_id, mGameEventPoolIds.size()); + LOG_ERROR("server", "GameEventMgr::GameEventUnspawn attempt access to out of range mGameEventPoolIds element %u (size: " SZFMTD ")", internal_event_id, mGameEventPoolIds.size()); return; } @@ -1710,14 +1706,14 @@ void GameEventMgr::RunSmartAIScripts(uint16 event_id, bool activate) //! Iterate over every supported source type (creature and gameobject) //! Not entirely sure how this will affect units in non-loaded grids. { - ACORE_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + std::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& m = ObjectAccessor::GetCreatures(); for (HashMapHolder::MapType::const_iterator iter = m.begin(); iter != m.end(); ++iter) if (iter->second->IsInWorld() && !iter->second->IsDuringRemoveFromWorld() && iter->second->FindMap() && iter->second->IsAIEnabled && iter->second->AI()) iter->second->AI()->sOnGameEvent(activate, event_id); } { - ACORE_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + std::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& m = ObjectAccessor::GetGameObjects(); for (HashMapHolder::MapType::const_iterator iter = m.begin(); iter != m.end(); ++iter) if (iter->second->IsInWorld() && iter->second->FindMap() && iter->second->AI()) @@ -1734,7 +1730,7 @@ void GameEventMgr::SetHolidayEventTime(GameEventData& event) if (!holiday->Date[0] || !holiday->Duration[0]) // Invalid definitions { - sLog->outErrorDb("Missing date or duration for holiday %u.", event.holiday_id); + LOG_ERROR("sql.sql", "Missing date or duration for holiday %u.", event.holiday_id); return; } diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index f744199774..1e5f7fb518 100644 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -12,6 +12,7 @@ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "Item.h" +#include "Log.h" #include "Map.h" #include "MapInstanced.h" #include "MapManager.h" @@ -26,6 +27,35 @@ #include "WorldPacket.h" #include +template +void HashMapHolder::Insert(T* o) +{ + std::unique_lock lock(*GetLock()); + m_objectMap[o->GetGUID()] = o; +} + +template +void HashMapHolder::Remove(T* o) +{ + std::unique_lock lock(*GetLock()); + m_objectMap.erase(o->GetGUID()); +} + +template +T* HashMapHolder::Find(uint64 guid) +{ + std::shared_lock lock(*GetLock()); + typename MapType::iterator itr = m_objectMap.find(guid); + return (itr != m_objectMap.end()) ? itr->second : nullptr; +} + +template +std::shared_mutex* HashMapHolder::GetLock() +{ + static std::shared_mutex _lock; + return &_lock; +} + ObjectAccessor::ObjectAccessor() { } @@ -190,20 +220,6 @@ Player* ObjectAccessor::FindConnectedPlayer(uint64 const& guid) Player* ObjectAccessor::FindPlayerByName(std::string const& name, bool checkInWorld) { - /*ACORE_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); - std::string nameStr = name; - std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); - HashMapHolder::MapType const& m = GetPlayers(); - for (HashMapHolder::MapType::const_iterator iter = m.begin(); iter != m.end(); ++iter) - { - if (!iter->second->IsInWorld()) - continue; - std::string currentName = iter->second->GetName(); - std::transform(currentName.begin(), currentName.end(), currentName.begin(), ::tolower); - if (nameStr.compare(currentName) == 0) - return iter->second; - }*/ - // pussywizard: optimization std::string nameStr = name; std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower); @@ -217,7 +233,8 @@ Player* ObjectAccessor::FindPlayerByName(std::string const& name, bool checkInWo void ObjectAccessor::SaveAllPlayers() { - ACORE_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + std::shared_lock lock(*HashMapHolder::GetLock()); + HashMapHolder::MapType const& m = GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) itr->second->SaveToDB(false, false); @@ -225,7 +242,7 @@ void ObjectAccessor::SaveAllPlayers() Corpse* ObjectAccessor::GetCorpseForPlayerGUID(uint64 guid) { - ACORE_READ_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + std::shared_lock lock(i_corpseLock); Player2CorpsesMapType::iterator iter = i_player2corpse.find(guid); if (iter == i_player2corpse.end()) @@ -242,7 +259,7 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse, bool final) if (!final) { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + std::unique_lock guard(i_corpseLock); Player2CorpsesMapType::iterator iter = i_player2corpse.find(corpse->GetOwnerGUID()); if (iter == i_player2corpse.end()) return; @@ -269,7 +286,7 @@ void ObjectAccessor::RemoveCorpse(Corpse* corpse, bool final) // Critical section { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + std::unique_lock guard(i_corpseLock); // build mapid*cellid -> guid_set map CellCoord cellCoord = acore::ComputeCellCoord(corpse->GetPositionX(), corpse->GetPositionY()); @@ -285,7 +302,7 @@ void ObjectAccessor::AddCorpse(Corpse* corpse) // Critical section { - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + std::unique_lock guard(i_corpseLock); ASSERT(i_player2corpse.find(corpse->GetOwnerGUID()) == i_player2corpse.end()); i_player2corpse[corpse->GetOwnerGUID()] = corpse; @@ -298,7 +315,7 @@ void ObjectAccessor::AddCorpse(Corpse* corpse) void ObjectAccessor::AddCorpsesToGrid(GridCoord const& gridpair, GridType& grid, Map* map) { - ACORE_READ_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + std::shared_lock guard(i_corpseLock); for (Player2CorpsesMapType::iterator iter = i_player2corpse.begin(); iter != i_player2corpse.end(); ++iter) { @@ -331,7 +348,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Deleting Corpse and spawned bones."); + LOG_DEBUG("server", "Deleting Corpse and spawned bones."); #endif // Map can be nullptr @@ -386,7 +403,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia } // pussywizard: for deleting bones - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + std::unique_lock guard(i_corpseLock); i_playerBones.push_back(bones->GetGUID()); } @@ -413,7 +430,7 @@ void ObjectAccessor::RemoveOldCorpses() // pussywizard: for deleting bones std::list::iterator next2; - ACORE_WRITE_GUARD(ACE_RW_Thread_Mutex, i_corpseLock); + std::unique_lock guard(i_corpseLock); for (std::list::iterator itr = i_playerBones.begin(); itr != i_playerBones.end(); itr = next2) { next2 = itr; @@ -446,13 +463,13 @@ void ObjectAccessor::RemoveOldCorpses() void ObjectAccessor::AddDelayedCorpseAction(Corpse* corpse, uint8 action, uint32 mapId, uint32 instanceId) { - ACORE_GUARD(ACE_Thread_Mutex, DelayedCorpseLock); + std::lock_guard guard(DelayedCorpseLock); i_delayedCorpseActions.push_back(DelayedCorpseAction(corpse, action, mapId, instanceId)); } void ObjectAccessor::ProcessDelayedCorpseActions() { - ACORE_GUARD(ACE_Thread_Mutex, DelayedCorpseLock); + std::lock_guard guard(DelayedCorpseLock); for (std::list::iterator itr = i_delayedCorpseActions.begin(); itr != i_delayedCorpseActions.end(); ++itr) { DelayedCorpseAction a = (*itr); @@ -527,6 +544,36 @@ void ObjectAccessor::UnloadAll() } } +template +/*static*/ T* ObjectAccessor::GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/) +{ + T* obj = HashMapHolder::Find(guid); + if (!obj || obj->GetMapId() != mapid) + return nullptr; + + CellCoord p = acore::ComputeCellCoord(x, y); + if (!p.IsCoordValid()) + { + LOG_ERROR("server", "ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); + return nullptr; + } + + CellCoord q = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); + if (!q.IsCoordValid()) + { + LOG_ERROR("server", "ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); + return nullptr; + } + + int32 dx = int32(p.x_coord) - int32(q.x_coord); + int32 dy = int32(p.y_coord) - int32(q.y_coord); + + if (dx > -2 && dx < 2 && dy > -2 && dy < 2) + return obj; + + return nullptr; +} + std::map ObjectAccessor::playerNameToPlayerPointer; /// Global definitions for the hashmap storage diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 4f2c1f1cde..ca66739165 100644 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -11,8 +11,9 @@ #include "GridDefines.h" #include "Object.h" #include "UpdateData.h" -#include +#include #include +#include #include class Creature; @@ -33,43 +34,24 @@ class HashMapHolder { public: typedef std::unordered_map MapType; - typedef ACE_RW_Thread_Mutex LockType; - static void Insert(T* o) - { - ACORE_WRITE_GUARD(LockType, i_lock); - m_objectMap[o->GetGUID()] = o; - } - - static void Remove(T* o) - { - ACORE_WRITE_GUARD(LockType, i_lock); - m_objectMap.erase(o->GetGUID()); - } - - static T* Find(uint64 guid) - { - ACORE_READ_GUARD(LockType, i_lock); - typename MapType::iterator itr = m_objectMap.find(guid); - return (itr != m_objectMap.end()) ? itr->second : nullptr; - } + static void Insert(T* o); + static void Remove(T* o); + static T* Find(uint64 guid); static MapType& GetContainer() { return m_objectMap; } - - static LockType* GetLock() { return &i_lock; } + static std::shared_mutex* GetLock(); private: //Non instanceable only static HashMapHolder() = default; - static LockType i_lock; - static MapType m_objectMap; + static MapType m_objectMap; }; /// Define the static members of HashMapHolder template std::unordered_map< uint64, T* > HashMapHolder::m_objectMap; -template typename HashMapHolder::LockType HashMapHolder::i_lock; // pussywizard: class DelayedCorpseAction @@ -140,34 +122,8 @@ public: return nullptr; } - template static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/) - { - T* obj = HashMapHolder::Find(guid); - if (!obj || obj->GetMapId() != mapid) - return nullptr; - - CellCoord p = acore::ComputeCellCoord(x, y); - if (!p.IsCoordValid()) - { - sLog->outError("ObjectAccessor::GetObjectInWorld: invalid coordinates supplied X:%f Y:%f grid cell [%u:%u]", x, y, p.x_coord, p.y_coord); - return nullptr; - } - - CellCoord q = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); - if (!q.IsCoordValid()) - { - sLog->outError("ObjectAccessor::GetObjecInWorld: object (GUID: %u TypeId: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUIDLow(), obj->GetTypeId(), obj->GetPositionX(), obj->GetPositionY(), q.x_coord, q.y_coord); - return nullptr; - } - - int32 dx = int32(p.x_coord) - int32(q.x_coord); - int32 dy = int32(p.y_coord) - int32(q.y_coord); - - if (dx > -2 && dx < 2 && dy > -2 && dy < 2) - return obj; - else - return nullptr; - } + template + static T* GetObjectInWorld(uint32 mapid, float x, float y, uint64 guid, T* /*fake*/); // these functions return objects only if in map of specified object static WorldObject* GetWorldObject(WorldObject const&, uint64); @@ -226,7 +182,7 @@ public: //non-static functions void AddUpdateObject(Object* obj) { - ACORE_GUARD(ACE_Thread_Mutex, i_objectLock); + std::lock_guard guard(i_objectLock); if (obj->GetTypeId() < TYPEID_UNIT) // these are not in map: TYPEID_OBJECT, TYPEID_ITEM, TYPEID_CONTAINER i_objects.insert(obj); else @@ -235,7 +191,7 @@ public: void RemoveUpdateObject(Object* obj) { - ACORE_GUARD(ACE_Thread_Mutex, i_objectLock); + std::lock_guard guard(i_objectLock); if (obj->GetTypeId() < TYPEID_UNIT) // these are not in map: TYPEID_OBJECT, TYPEID_ITEM, TYPEID_CONTAINER i_objects.erase(obj); else @@ -270,10 +226,10 @@ private: Player2CorpsesMapType i_player2corpse; std::list i_playerBones; - ACE_Thread_Mutex i_objectLock; - ACE_RW_Thread_Mutex i_corpseLock; + std::mutex i_objectLock; + std::shared_mutex i_corpseLock; std::list i_delayedCorpseActions; - mutable ACE_Thread_Mutex DelayedCorpseLock; + mutable std::mutex DelayedCorpseLock; }; #define sObjectAccessor ObjectAccessor::instance() diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 52d5edfb20..d26e777a83 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -409,7 +409,7 @@ void ObjectMgr::LoadCreatureLocales() AddLocaleString(Title, locale, data.Title); } while (result->NextRow()); - sLog->outString(">> Loaded %lu Creature Locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %lu Creature Locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadGossipMenuItemsLocales() @@ -443,7 +443,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() AddLocaleString(BoxText, locale, data.BoxText); } while (result->NextRow()); - sLog->outString(">> Loaded %u Gossip Menu Option Locale strings in %u ms", (uint32)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u Gossip Menu Option Locale strings in %u ms", (uint32)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadPointOfInterestLocales() @@ -474,7 +474,7 @@ void ObjectMgr::LoadPointOfInterestLocales() AddLocaleString(Name, locale, data.Name); } while (result->NextRow()); - sLog->outString(">> Loaded %u Points Of Interest Locale strings in %u ms", (uint32)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u Points Of Interest Locale strings in %u ms", (uint32)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadCreatureTemplates() @@ -497,7 +497,7 @@ void ObjectMgr::LoadCreatureTemplates() if (!result) { - sLog->outString(">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); + LOG_INFO("server", ">> Loaded 0 creature template definitions. DB table `creature_template` is empty."); return; } @@ -536,8 +536,8 @@ void ObjectMgr::LoadCreatureTemplates() itr->second.InitializeQueryData(); } - sLog->outString(">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadCreatureTemplate(Field* fields) @@ -635,8 +635,8 @@ void ObjectMgr::LoadCreatureTemplateResistances() if (!result) { - sLog->outString(">> Loaded 0 creature template resistance definitions. DB table `creature_template_resistance` is empty."); - sLog->outString(); + LOG_INFO("server.loading", ">> Loaded 0 creature template resistance definitions. DB table `creature_template_resistance` is empty."); + LOG_INFO("server.loading", " "); return; } @@ -651,14 +651,14 @@ void ObjectMgr::LoadCreatureTemplateResistances() if (school == SPELL_SCHOOL_NORMAL || school >= MAX_SPELL_SCHOOL) { - sLog->outErrorDb("creature_template_resistance has resistance definitions for creature %u but this school %u doesn't exist", creatureID, school); + LOG_ERROR("sql.sql", "creature_template_resistance has resistance definitions for creature %u but this school %u doesn't exist", creatureID, school); continue; } CreatureTemplateContainer::iterator itr = _creatureTemplateStore.find(creatureID); if (itr == _creatureTemplateStore.end()) { - sLog->outErrorDb("creature_template_resistance has resistance definitions for creature %u but this creature doesn't exist", creatureID); + LOG_ERROR("sql.sql", "creature_template_resistance has resistance definitions for creature %u but this creature doesn't exist", creatureID); continue; } @@ -668,8 +668,8 @@ void ObjectMgr::LoadCreatureTemplateResistances() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature template resistances in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server.loading", ">> Loaded %u creature template resistances in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server.loading", " "); } void ObjectMgr::LoadCreatureTemplateSpells() @@ -681,8 +681,8 @@ void ObjectMgr::LoadCreatureTemplateSpells() if (!result) { - sLog->outString(">> Loaded 0 creature template spell definitions. DB table `creature_template_spell` is empty."); - sLog->outString(); + LOG_INFO("server.loading", ">> Loaded 0 creature template spell definitions. DB table `creature_template_spell` is empty."); + LOG_INFO("server.loading", " "); return; } @@ -697,14 +697,14 @@ void ObjectMgr::LoadCreatureTemplateSpells() if (index >= MAX_CREATURE_SPELLS) { - sLog->outErrorDb("creature_template_spell has spell definitions for creature %u with a incorrect index %u", creatureID, index); + LOG_ERROR("sql.sql", "creature_template_spell has spell definitions for creature %u with a incorrect index %u", creatureID, index); continue; } CreatureTemplateContainer::iterator itr = _creatureTemplateStore.find(creatureID); if (itr == _creatureTemplateStore.end()) { - sLog->outErrorDb("creature_template_spell has spell definitions for creature %u but this creature doesn't exist", creatureID); + LOG_ERROR("sql.sql", "creature_template_spell has spell definitions for creature %u but this creature doesn't exist", creatureID); continue; } @@ -714,8 +714,8 @@ void ObjectMgr::LoadCreatureTemplateSpells() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature template spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server.loading", ">> Loaded %u creature template spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server.loading", " "); } void ObjectMgr::LoadCreatureTemplateAddons() @@ -727,8 +727,8 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!result) { - sLog->outString(">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty."); + LOG_INFO("server", " "); return; } @@ -741,7 +741,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() if (!sObjectMgr->GetCreatureTemplate(entry)) { - sLog->outErrorDb("Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry); + LOG_ERROR("sql.sql", "Creature template (Entry: %u) does not exist but has a record in `creature_template_addon`", entry); continue; } @@ -762,7 +762,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); if (!AdditionalSpellInfo) { - sLog->outErrorDb("Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr))); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong spell %u defined in `auras` field in `creature_template_addon`.", entry, uint32(atol(*itr))); continue; } creatureAddon.auras[i++] = uint32(atol(*itr)); @@ -772,22 +772,22 @@ void ObjectMgr::LoadCreatureTemplateAddons() { if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount)) { - sLog->outErrorDb("Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid displayInfoId (%u) for mount defined in `creature_template_addon`", entry, creatureAddon.mount); creatureAddon.mount = 0; } } if (!sEmotesStore.LookupEntry(creatureAddon.emote)) { - sLog->outErrorDb("Creature (Entry: %u) has invalid emote (%u) defined in `creature_addon`.", entry, creatureAddon.emote); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid emote (%u) defined in `creature_addon`.", entry, creatureAddon.emote); creatureAddon.emote = 0; } ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) @@ -805,7 +805,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureTemplate const* difficultyInfo = GetCreatureTemplate(cInfo->DifficultyEntry[diff]); if (!difficultyInfo) { - sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.", + LOG_ERROR("sql.sql", "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u does not exist.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff]); continue; } @@ -816,20 +816,20 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) ok2 = false; if (_difficultyEntries[diff2].find(cInfo->Entry) != _difficultyEntries[diff2].end()) { - sLog->outErrorDb("Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.", + LOG_ERROR("sql.sql", "Creature (Entry: %u) is listed as `difficulty_entry_%u` of another creature, but itself lists %u in `difficulty_entry_%u`.", cInfo->Entry, diff2 + 1, cInfo->DifficultyEntry[diff], diff + 1); continue; } if (_difficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _difficultyEntries[diff2].end()) { - sLog->outErrorDb("Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1); + LOG_ERROR("sql.sql", "Creature (Entry: %u) already listed as `difficulty_entry_%u` for another entry.", cInfo->DifficultyEntry[diff], diff2 + 1); continue; } if (_hasDifficultyEntries[diff2].find(cInfo->DifficultyEntry[diff]) != _hasDifficultyEntries[diff2].end()) { - sLog->outErrorDb("Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.", + LOG_ERROR("sql.sql", "Creature (Entry: %u) has `difficulty_entry_%u`=%u but creature entry %u has itself a value in `difficulty_entry_%u`.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff], cInfo->DifficultyEntry[diff], diff2 + 1); continue; } @@ -840,87 +840,87 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->expansion > difficultyInfo->expansion) { - sLog->outErrorDb("Creature (Entry: %u, expansion %u) has different `expansion` in difficulty %u mode (Entry: %u, expansion %u).", + LOG_ERROR("sql.sql", "Creature (Entry: %u, expansion %u) has different `expansion` in difficulty %u mode (Entry: %u, expansion %u).", cInfo->Entry, cInfo->expansion, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->expansion); } if (cInfo->faction != difficultyInfo->faction) { - sLog->outErrorDb("Creature (Entry: %u, faction %u) has different `faction` in difficulty %u mode (Entry: %u, faction %u).", + LOG_ERROR("sql.sql", "Creature (Entry: %u, faction %u) has different `faction` in difficulty %u mode (Entry: %u, faction %u).", cInfo->Entry, cInfo->faction, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->faction); } if (cInfo->unit_class != difficultyInfo->unit_class) { - sLog->outErrorDb("Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).", + LOG_ERROR("sql.sql", "Creature (Entry: %u, class %u) has different `unit_class` in difficulty %u mode (Entry: %u, class %u).", cInfo->Entry, cInfo->unit_class, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->unit_class); continue; } if (cInfo->npcflag != difficultyInfo->npcflag) { - sLog->outErrorDb("Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `npcflag` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->family != difficultyInfo->family) { - sLog->outErrorDb("Creature (Entry: %u, family %u) has different `family` in difficulty %u mode (Entry: %u, family %u).", + LOG_ERROR("sql.sql", "Creature (Entry: %u, family %u) has different `family` in difficulty %u mode (Entry: %u, family %u).", cInfo->Entry, cInfo->family, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->family); } if (cInfo->trainer_class != difficultyInfo->trainer_class) { - sLog->outErrorDb("Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `trainer_class` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_race != difficultyInfo->trainer_race) { - sLog->outErrorDb("Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `trainer_race` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_type != difficultyInfo->trainer_type) { - sLog->outErrorDb("Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `trainer_type` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->trainer_spell != difficultyInfo->trainer_spell) { - sLog->outErrorDb("Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `trainer_spell` in difficulty %u mode (Entry: %u).", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (cInfo->type != difficultyInfo->type) { - sLog->outErrorDb("Creature (Entry: %u, type %u) has different `type` in difficulty %u mode (Entry: %u, type %u).", + LOG_ERROR("sql.sql", "Creature (Entry: %u, type %u) has different `type` in difficulty %u mode (Entry: %u, type %u).", cInfo->Entry, cInfo->type, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->type); } if (!cInfo->VehicleId && difficultyInfo->VehicleId) { - sLog->outErrorDb("Creature (Entry: %u, VehicleId %u) has different `VehicleId` in difficulty %u mode (Entry: %u, VehicleId %u).", + LOG_ERROR("sql.sql", "Creature (Entry: %u, VehicleId %u) has different `VehicleId` in difficulty %u mode (Entry: %u, VehicleId %u).", cInfo->Entry, cInfo->VehicleId, diff + 1, cInfo->DifficultyEntry[diff], difficultyInfo->VehicleId); } // Xinef: check dmg school if (cInfo->dmgschool != difficultyInfo->dmgschool) { - sLog->outErrorDb("Creature (Entry: %u) has different `dmgschool` in difficulty %u mode (Entry: %u)", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has different `dmgschool` in difficulty %u mode (Entry: %u)", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); } if (!difficultyInfo->AIName.empty()) { - sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.", + LOG_ERROR("sql.sql", "Creature (Entry: %u) lists difficulty %u mode entry %u with `AIName` filled in. `AIName` of difficulty 0 mode creature is always used instead.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } if (difficultyInfo->ScriptID) { - sLog->outErrorDb("Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.", + LOG_ERROR("sql.sql", "Creature (Entry: %u) lists difficulty %u mode entry %u with `ScriptName` filled in. `ScriptName` of difficulty 0 mode creature is always used instead.", cInfo->Entry, diff + 1, cInfo->DifficultyEntry[diff]); continue; } @@ -932,7 +932,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction); if (!factionTemplate) - sLog->outErrorDb("Creature (Entry: %u) has non-existing faction template (%u).", cInfo->Entry, cInfo->faction); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing faction template (%u).", cInfo->Entry, cInfo->faction); // used later for scale CreatureDisplayInfoEntry const* displayScaleEntry = nullptr; @@ -942,7 +942,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid1); if (!displayEntry) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1); + LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid1 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid1); const_cast(cInfo)->Modelid1 = 0; } else if (!displayScaleEntry) @@ -950,7 +950,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid1); if (!modelInfo) - sLog->outErrorDb("No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry); + LOG_ERROR("sql.sql", "No model data exist for `Modelid1` = %u listed by creature (Entry: %u).", cInfo->Modelid1, cInfo->Entry); } if (cInfo->Modelid2) @@ -958,7 +958,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid2); if (!displayEntry) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2); + LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid2 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid2); const_cast(cInfo)->Modelid2 = 0; } else if (!displayScaleEntry) @@ -966,7 +966,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2); if (!modelInfo) - sLog->outErrorDb("No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry); + LOG_ERROR("sql.sql", "No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry); } if (cInfo->Modelid3) @@ -974,7 +974,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid3); if (!displayEntry) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3); + LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid3 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid3); const_cast(cInfo)->Modelid3 = 0; } else if (!displayScaleEntry) @@ -982,7 +982,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid3); if (!modelInfo) - sLog->outErrorDb("No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry); + LOG_ERROR("sql.sql", "No model data exist for `Modelid3` = %u listed by creature (Entry: %u).", cInfo->Modelid3, cInfo->Entry); } if (cInfo->Modelid4) @@ -990,7 +990,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->Modelid4); if (!displayEntry) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4); + LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing Modelid4 id (%u), this can crash the client.", cInfo->Entry, cInfo->Modelid4); const_cast(cInfo)->Modelid4 = 0; } else if (!displayScaleEntry) @@ -998,11 +998,11 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4); if (!modelInfo) - sLog->outErrorDb("No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry); + LOG_ERROR("sql.sql", "No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry); } if (!displayScaleEntry) - sLog->outErrorDb("Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry); + LOG_ERROR("sql.sql", "Creature (Entry: %u) does not have any existing display id in Modelid1/Modelid2/Modelid3/Modelid4.", cInfo->Entry); for (int k = 0; k < MAX_KILL_CREDIT; ++k) { @@ -1010,7 +1010,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) { if (!GetCreatureTemplate(cInfo->KillCredit[k])) { - sLog->outErrorDb("Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1); + LOG_ERROR("sql.sql", "Creature (Entry: %u) lists non-existing creature entry %u in `KillCredit%d`.", cInfo->Entry, cInfo->KillCredit[k], k + 1); const_cast(cInfo)->KillCredit[k] = 0; } } @@ -1018,13 +1018,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (!cInfo->unit_class || ((1 << (cInfo->unit_class - 1)) & CLASSMASK_ALL_CREATURES) == 0) { - sLog->outErrorDb("Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid unit_class (%u) in creature_template. Set to 1 (UNIT_CLASS_WARRIOR).", cInfo->Entry, cInfo->unit_class); const_cast(cInfo)->unit_class = UNIT_CLASS_WARRIOR; } if (cInfo->dmgschool >= MAX_SPELL_SCHOOL) { - sLog->outErrorDb("Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid spell school value (%u) in `dmgschool`.", cInfo->Entry, cInfo->dmgschool); const_cast(cInfo)->dmgschool = SPELL_SCHOOL_NORMAL; } @@ -1035,42 +1035,42 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) const_cast(cInfo)->RangeAttackTime = BASE_ATTACK_TIME; if ((cInfo->npcflag & UNIT_NPC_FLAG_TRAINER) && cInfo->trainer_type >= MAX_TRAINER_TYPE) - sLog->outErrorDb("Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong trainer type %u.", cInfo->Entry, cInfo->trainer_type); if (cInfo->speed_walk == 0.0f) { - sLog->outErrorDb("Creature (Entry: %u) has wrong value (%f) in speed_walk, set to 1.", cInfo->Entry, cInfo->speed_walk); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%f) in speed_walk, set to 1.", cInfo->Entry, cInfo->speed_walk); const_cast(cInfo)->speed_walk = 1.0f; } if (cInfo->speed_run == 0.0f) { - sLog->outErrorDb("Creature (Entry: %u) has wrong value (%f) in speed_run, set to 1.14286.", cInfo->Entry, cInfo->speed_run); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%f) in speed_run, set to 1.14286.", cInfo->Entry, cInfo->speed_run); const_cast(cInfo)->speed_run = 1.14286f; } if (cInfo->type && !sCreatureTypeStore.LookupEntry(cInfo->type)) { - sLog->outErrorDb("Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid creature type (%u) in `type`.", cInfo->Entry, cInfo->type); const_cast(cInfo)->type = CREATURE_TYPE_HUMANOID; } // must exist or used hidden but used in data horse case if (cInfo->family && !sCreatureFamilyStore.LookupEntry(cInfo->family) && cInfo->family != CREATURE_FAMILY_HORSE_CUSTOM) { - sLog->outErrorDb("Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has invalid creature family (%u) in `family`.", cInfo->Entry, cInfo->family); const_cast(cInfo)->family = 0; } if (cInfo->InhabitType <= 0 || cInfo->InhabitType > INHABIT_ANYWHERE) { - sLog->outErrorDb("Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%u) in `InhabitType`, creature will not correctly walk/swim/fly.", cInfo->Entry, cInfo->InhabitType); const_cast(cInfo)->InhabitType = INHABIT_ANYWHERE; } if (cInfo->HoverHeight < 0.0f) { - sLog->outErrorDb("Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong value (%f) in `HoverHeight`", cInfo->Entry, cInfo->HoverHeight); const_cast(cInfo)->HoverHeight = 1.0f; } @@ -1079,7 +1079,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) VehicleEntry const* vehId = sVehicleStore.LookupEntry(cInfo->VehicleId); if (!vehId) { - sLog->outErrorDb("Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has a non-existing VehicleId (%u). This *WILL* cause the client to freeze!", cInfo->Entry, cInfo->VehicleId); const_cast(cInfo)->VehicleId = 0; } } @@ -1088,21 +1088,21 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) { CreatureSpellDataEntry const* spellDataId = sCreatureSpellDataStore.LookupEntry(cInfo->PetSpellDataId); if (!spellDataId) - sLog->outErrorDb("Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing PetSpellDataId (%u).", cInfo->Entry, cInfo->PetSpellDataId); } for (uint8 j = 0; j < MAX_CREATURE_SPELLS; ++j) { if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j])) { - sLog->outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j + 1, cInfo->spells[j]); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j + 1, cInfo->spells[j]); const_cast(cInfo)->spells[j] = 0; } } if (cInfo->MovementType >= MAX_DB_MOTION_TYPE) { - sLog->outErrorDb("Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType); + LOG_ERROR("sql.sql", "Creature (Entry: %u) has wrong movement generator type (%u), ignored and set to IDLE.", cInfo->Entry, cInfo->MovementType); const_cast(cInfo)->MovementType = IDLE_MOTION_TYPE; } @@ -1117,13 +1117,13 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) if (cInfo->expansion > (MAX_EXPANSIONS - 1)) { - sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion); + LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with expansion %u. Ignored and set to 0.", cInfo->Entry, cInfo->expansion); const_cast(cInfo)->expansion = 0; } if (uint32 badFlags = (cInfo->flags_extra & ~CREATURE_FLAG_EXTRA_DB_ALLOWED)) { - sLog->outErrorDb("Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags); + LOG_ERROR("sql.sql", "Table `creature_template` lists creature (Entry: %u) with disallowed `flags_extra` %u, removing incorrect flag.", cInfo->Entry, badFlags); const_cast(cInfo)->flags_extra &= CREATURE_FLAG_EXTRA_DB_ALLOWED; } @@ -1139,8 +1139,8 @@ void ObjectMgr::LoadCreatureAddons() if (!result) { - sLog->outString(">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty."); + LOG_INFO("server", " "); return; } @@ -1154,7 +1154,7 @@ void ObjectMgr::LoadCreatureAddons() CreatureData const* creData = GetCreatureData(guid); if (!creData) { - sLog->outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid); + LOG_ERROR("sql.sql", "Creature (GUID: %u) does not exist but has a record in `creature_addon`", guid); continue; } @@ -1164,7 +1164,7 @@ void ObjectMgr::LoadCreatureAddons() if (creData->movementType == WAYPOINT_MOTION_TYPE && !creatureAddon.path_id) { const_cast(creData)->movementType = IDLE_MOTION_TYPE; - sLog->outErrorDb("Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid); + LOG_ERROR("sql.sql", "Creature (GUID %u) has movement type set to WAYPOINT_MOTION_TYPE but no path assigned", guid); } creatureAddon.mount = fields[2].GetUInt32(); @@ -1181,7 +1181,7 @@ void ObjectMgr::LoadCreatureAddons() SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); if (!AdditionalSpellInfo) { - sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr))); + LOG_ERROR("sql.sql", "Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr))); continue; } creatureAddon.auras[i++] = uint32(atol(*itr)); @@ -1191,22 +1191,22 @@ void ObjectMgr::LoadCreatureAddons() { if (!sCreatureDisplayInfoStore.LookupEntry(creatureAddon.mount)) { - sLog->outErrorDb("Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount); + LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid displayInfoId (%u) for mount defined in `creature_addon`", guid, creatureAddon.mount); creatureAddon.mount = 0; } } if (!sEmotesStore.LookupEntry(creatureAddon.emote)) { - sLog->outErrorDb("Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote); + LOG_ERROR("sql.sql", "Creature (GUID: %u) has invalid emote (%u) defined in `creature_addon`.", guid, creatureAddon.emote); creatureAddon.emote = 0; } ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadGameObjectAddons() @@ -1218,8 +1218,8 @@ void ObjectMgr::LoadGameObjectAddons() if (!result) { - sLog->outString(">> Loaded 0 gameobject addon definitions. DB table `gameobject_addon` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 gameobject addon definitions. DB table `gameobject_addon` is empty."); + LOG_INFO("server", " "); return; } @@ -1233,7 +1233,7 @@ void ObjectMgr::LoadGameObjectAddons() const GameObjectData* goData = GetGOData(guid); if (!goData) { - sLog->outErrorDb("GameObject (GUID: %u) does not exist but has a record in `gameobject_addon`", guid); + LOG_ERROR("sql.sql", "GameObject (GUID: %u) does not exist but has a record in `gameobject_addon`", guid); continue; } @@ -1243,22 +1243,22 @@ void ObjectMgr::LoadGameObjectAddons() if (gameObjectAddon.invisibilityType >= TOTAL_INVISIBILITY_TYPES) { - sLog->outErrorDb("GameObject (GUID: %u) has invalid InvisibilityType in `gameobject_addon`", guid); + LOG_ERROR("sql.sql", "GameObject (GUID: %u) has invalid InvisibilityType in `gameobject_addon`", guid); gameObjectAddon.invisibilityType = INVISIBILITY_GENERAL; gameObjectAddon.InvisibilityValue = 0; } if (gameObjectAddon.invisibilityType && !gameObjectAddon.InvisibilityValue) { - sLog->outErrorDb("GameObject (GUID: %u) has InvisibilityType set but has no InvisibilityValue in `gameobject_addon`, set to 1", guid); + LOG_ERROR("sql.sql", "GameObject (GUID: %u) has InvisibilityType set but has no InvisibilityValue in `gameobject_addon`, set to 1", guid); gameObjectAddon.InvisibilityValue = 1; } ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u gameobject addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u gameobject addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } GameObjectAddon const* ObjectMgr::GetGameObjectAddon(uint32 lowguid) @@ -1323,8 +1323,8 @@ void ObjectMgr::LoadEquipmentTemplates() if (!result) { - sLog->outString(">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!"); + LOG_INFO("server", " "); return; } @@ -1337,14 +1337,14 @@ void ObjectMgr::LoadEquipmentTemplates() if (!sObjectMgr->GetCreatureTemplate(entry)) { - sLog->outError("Creature template (CreatureID: %u) does not exist but has a record in `creature_equip_template`", entry); + LOG_ERROR("server", "Creature template (CreatureID: %u) does not exist but has a record in `creature_equip_template`", entry); continue; } uint8 id = fields[1].GetUInt8(); if (!id) { - sLog->outError("Creature equipment template with id 0 found for creature %u, skipped.", entry); + LOG_ERROR("server", "Creature equipment template with id 0 found for creature %u, skipped.", entry); continue; } @@ -1363,7 +1363,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!item) { - sLog->outErrorDb("Unknown item (ID=%u) in creature_equip_template.ItemID%u for CreatureID = %u and ID = %u, forced to 0.", + LOG_ERROR("sql.sql", "Unknown item (ID=%u) in creature_equip_template.ItemID%u for CreatureID = %u and ID = %u, forced to 0.", equipmentInfo.ItemEntry[i], i + 1, entry, id); equipmentInfo.ItemEntry[i] = 0; continue; @@ -1379,7 +1379,7 @@ void ObjectMgr::LoadEquipmentTemplates() item->InventoryType != INVTYPE_THROWN && item->InventoryType != INVTYPE_RANGEDRIGHT) { - sLog->outErrorDb("Item (ID=%u) in creature_equip_template.ItemID%u for CreatureID = %u and ID = %u is not equipable in a hand, forced to 0.", + LOG_ERROR("sql.sql", "Item (ID=%u) in creature_equip_template.ItemID%u for CreatureID = %u and ID = %u is not equipable in a hand, forced to 0.", equipmentInfo.ItemEntry[i], i + 1, entry, id); equipmentInfo.ItemEntry[i] = 0; } @@ -1388,8 +1388,8 @@ void ObjectMgr::LoadEquipmentTemplates() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) @@ -1440,7 +1440,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display { CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender); if (!minfo_tmp) - sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender); + LOG_ERROR("sql.sql", "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender); else { // Model ID changed @@ -1461,8 +1461,8 @@ void ObjectMgr::LoadCreatureModelInfo() if (!result) { - sLog->outString(">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty."); + LOG_INFO("server", " "); return; } @@ -1485,17 +1485,17 @@ void ObjectMgr::LoadCreatureModelInfo() // Checks if (!sCreatureDisplayInfoStore.LookupEntry(modelId)) - sLog->outErrorDb("Table `creature_model_info` has model for not existed display id (%u).", modelId); + LOG_ERROR("sql.sql", "Table `creature_model_info` has model for not existed display id (%u).", modelId); if (modelInfo.gender > GENDER_NONE) { - sLog->outErrorDb("Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId); + LOG_ERROR("sql.sql", "Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId); modelInfo.gender = GENDER_MALE; } if (modelInfo.modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.modelid_other_gender)) { - sLog->outErrorDb("Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId); + LOG_ERROR("sql.sql", "Table `creature_model_info` has not existed alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId); modelInfo.modelid_other_gender = 0; } @@ -1505,8 +1505,8 @@ void ObjectMgr::LoadCreatureModelInfo() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadLinkedRespawn() @@ -1519,8 +1519,8 @@ void ObjectMgr::LoadLinkedRespawn() if (!result) { - sLog->outErrorDb(">> Loaded 0 linked respawns. DB table `linked_respawn` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 linked respawns. DB table `linked_respawn` is empty."); + LOG_INFO("server", " "); return; } @@ -1541,7 +1541,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* slave = GetCreatureData(guidLow); if (!slave) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow); + LOG_ERROR("sql.sql", "Couldn't get creature data for GUIDLow %u", guidLow); error = true; break; } @@ -1549,7 +1549,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* master = GetCreatureData(linkedGuidLow); if (!master) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow); + LOG_ERROR("sql.sql", "Couldn't get creature data for GUIDLow %u", linkedGuidLow); error = true; break; } @@ -1557,14 +1557,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1578,7 +1578,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* slave = GetCreatureData(guidLow); if (!slave) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", guidLow); + LOG_ERROR("sql.sql", "Couldn't get creature data for GUIDLow %u", guidLow); error = true; break; } @@ -1586,7 +1586,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* master = GetGOData(linkedGuidLow); if (!master) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + LOG_ERROR("sql.sql", "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); error = true; break; } @@ -1594,14 +1594,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1615,7 +1615,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* slave = GetGOData(guidLow); if (!slave) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow); + LOG_ERROR("sql.sql", "Couldn't get gameobject data for GUIDLow %u", guidLow); error = true; break; } @@ -1623,7 +1623,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* master = GetGOData(linkedGuidLow); if (!master) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); + LOG_ERROR("sql.sql", "Couldn't get gameobject data for GUIDLow %u", linkedGuidLow); error = true; break; } @@ -1631,14 +1631,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1652,7 +1652,7 @@ void ObjectMgr::LoadLinkedRespawn() const GameObjectData* slave = GetGOData(guidLow); if (!slave) { - sLog->outErrorDb("Couldn't get gameobject data for GUIDLow %u", guidLow); + LOG_ERROR("sql.sql", "Couldn't get gameobject data for GUIDLow %u", guidLow); error = true; break; } @@ -1660,7 +1660,7 @@ void ObjectMgr::LoadLinkedRespawn() const CreatureData* master = GetCreatureData(linkedGuidLow); if (!master) { - sLog->outErrorDb("Couldn't get creature data for GUIDLow %u", linkedGuidLow); + LOG_ERROR("sql.sql", "Couldn't get creature data for GUIDLow %u", linkedGuidLow); error = true; break; } @@ -1668,14 +1668,14 @@ void ObjectMgr::LoadLinkedRespawn() const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); error = true; break; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); error = true; break; } @@ -1690,8 +1690,8 @@ void ObjectMgr::LoadLinkedRespawn() _linkedRespawnStore[guid] = linkedGuid; } while (result->NextRow()); - sLog->outString(">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) @@ -1714,20 +1714,20 @@ bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow) const CreatureData* slave = GetCreatureData(linkedGuidLow); if (!slave) { - // sLog->outError("sql.sql", "Creature '%u' linking to non-existent creature '%u'.", guidLow, linkedGuidLow); + // LOG_ERROR("server", "sql.sql", "Creature '%u' linking to non-existent creature '%u'.", guidLow, linkedGuidLow); return false; } const MapEntry* const map = sMapStore.LookupEntry(master->mapid); if (!map || !map->Instanceable() || (master->mapid != slave->mapid)) { - sLog->outErrorDb("Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "Creature '%u' linking to '%u' on an unpermitted map.", guidLow, linkedGuidLow); return false; } if (!(master->spawnMask & slave->spawnMask)) // they must have a possibility to meet (normal/heroic difficulty) { - sLog->outErrorDb("LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); + LOG_ERROR("sql.sql", "LinkedRespawn: Creature '%u' linking to '%u' with not corresponding spawnMask", guidLow, linkedGuidLow); return false; } @@ -1750,7 +1750,7 @@ void ObjectMgr::LoadTempSummons() if (!result) { - sLog->outString(">> Loaded 0 temp summons. DB table `creature_summon_groups` is empty."); + LOG_INFO("server", ">> Loaded 0 temp summons. DB table `creature_summon_groups` is empty."); return; } @@ -1768,26 +1768,26 @@ void ObjectMgr::LoadTempSummons() case SUMMONER_TYPE_CREATURE: if (!GetCreatureTemplate(summonerId)) { - sLog->outError("Table `creature_summon_groups` has summoner with non existing entry %u for creature summoner type, skipped.", summonerId); + LOG_ERROR("server", "Table `creature_summon_groups` has summoner with non existing entry %u for creature summoner type, skipped.", summonerId); continue; } break; case SUMMONER_TYPE_GAMEOBJECT: if (!GetGameObjectTemplate(summonerId)) { - sLog->outError("Table `creature_summon_groups` has summoner with non existing entry %u for gameobject summoner type, skipped.", summonerId); + LOG_ERROR("server", "Table `creature_summon_groups` has summoner with non existing entry %u for gameobject summoner type, skipped.", summonerId); continue; } break; case SUMMONER_TYPE_MAP: if (!sMapStore.LookupEntry(summonerId)) { - sLog->outError("Table `creature_summon_groups` has summoner with non existing entry %u for map summoner type, skipped.", summonerId); + LOG_ERROR("server", "Table `creature_summon_groups` has summoner with non existing entry %u for map summoner type, skipped.", summonerId); continue; } break; default: - sLog->outError("Table `creature_summon_groups` has unhandled summoner type %u for summoner %u, skipped.", summonerType, summonerId); + LOG_ERROR("server", "Table `creature_summon_groups` has unhandled summoner type %u for summoner %u, skipped.", summonerType, summonerId); continue; } @@ -1796,7 +1796,7 @@ void ObjectMgr::LoadTempSummons() if (!GetCreatureTemplate(data.entry)) { - sLog->outError("Table `creature_summon_groups` has creature in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] with non existing creature entry %u, skipped.", summonerId, summonerType, group, data.entry); + LOG_ERROR("server", "Table `creature_summon_groups` has creature in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] with non existing creature entry %u, skipped.", summonerId, summonerType, group, data.entry); continue; } @@ -1811,7 +1811,7 @@ void ObjectMgr::LoadTempSummons() if (data.type > TEMPSUMMON_MANUAL_DESPAWN) { - sLog->outError("Table `creature_summon_groups` has unhandled temp summon type %u in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] for creature entry %u, skipped.", data.type, summonerId, summonerType, group, data.entry); + LOG_ERROR("server", "Table `creature_summon_groups` has unhandled temp summon type %u in group [Summoner ID: %u, Summoner Type: %u, Group ID: %u] for creature entry %u, skipped.", data.type, summonerId, summonerType, group, data.entry); continue; } @@ -1823,8 +1823,8 @@ void ObjectMgr::LoadTempSummons() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u temp summons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u temp summons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadCreatures() @@ -1841,8 +1841,8 @@ void ObjectMgr::LoadCreatures() if (!result) { - sLog->outErrorDb(">> Loaded 0 creatures. DB table `creature` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 creatures. DB table `creature` is empty."); + LOG_INFO("server", " "); return; } @@ -1866,7 +1866,7 @@ void ObjectMgr::LoadCreatures() CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) { - sLog->outErrorDb("Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry); + LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry); continue; } @@ -1896,7 +1896,7 @@ void ObjectMgr::LoadCreatures() MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid); + LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u) that spawned at not existed map (Id: %u), skipped.", guid, data.mapid); continue; } @@ -1906,14 +1906,14 @@ void ObjectMgr::LoadCreatures() // Skip spawnMask check for transport maps if (!_transportMaps.count(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid]) - sLog->outErrorDb("Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid); + LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u) that have wrong spawn mask %u including not supported difficulty modes for map (Id: %u).", guid, data.spawnMask, data.mapid); bool ok = true; for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1 && ok; ++diff) { if (_difficultyEntries[diff].find(data.id) != _difficultyEntries[diff].end()) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.", + LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u) that listed as difficulty %u template (entry: %u) in `creature_template`, skipped.", guid, diff + 1, data.id); ok = false; } @@ -1926,7 +1926,7 @@ void ObjectMgr::LoadCreatures() { if (!GetEquipmentInfo(data.id, data.equipmentId)) { - sLog->outErrorDb("Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId); + LOG_ERROR("sql.sql", "Table `creature` have creature (Entry: %u) with equipment_id %u not found in table `creature_equip_template`, set to no equipment.", data.id, data.equipmentId); data.equipmentId = 0; } } @@ -1934,19 +1934,19 @@ void ObjectMgr::LoadCreatures() if (cInfo->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) { if (!mapEntry->IsDungeon()) - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id); + LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature are not in instance.", guid, data.id); } if (data.wander_distance < 0.0f) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `wander_distance`< 0, set to 0.", guid, data.id); + LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `wander_distance`< 0, set to 0.", guid, data.id); data.wander_distance = 0.0f; } else if (data.movementType == RANDOM_MOTION_TYPE) { if (data.wander_distance == 0.0f) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `wander_distance`=0, replace by idle movement type (0).", guid, data.id); + LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=1 (random movement) but with `wander_distance`=0, replace by idle movement type (0).", guid, data.id); data.movementType = IDLE_MOTION_TYPE; } } @@ -1954,14 +1954,14 @@ void ObjectMgr::LoadCreatures() { if (data.wander_distance != 0.0f) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `wander_distance`<>0, set to 0.", guid, data.id); + LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `MovementType`=0 (idle) have `wander_distance`<>0, set to 0.", guid, data.id); data.wander_distance = 0.0f; } } if (data.phaseMask == 0) { - sLog->outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); + LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); data.phaseMask = 1; } @@ -1986,8 +1986,8 @@ void ObjectMgr::LoadCreatures() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data) @@ -2057,14 +2057,14 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float GameObject* go = sObjectMgr->IsGameObjectStaticTransport(data.id) ? new StaticTransport() : new GameObject(); if (!go->LoadGameObjectFromDB(guid, map)) { - sLog->outError("AddGOData: cannot add gameobject entry %u to map", entry); + LOG_ERROR("server", "AddGOData: cannot add gameobject entry %u to map", entry); delete go; return 0; } } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "AddGOData: dbguid %u entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o); + LOG_DEBUG("maps", "AddGOData: dbguid %u entry %u map %u x %f y %f z %f o %f", guid, entry, mapId, x, y, z, o); #endif return guid; @@ -2094,7 +2094,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos) Creature* creature = new Creature(); if (!creature->LoadCreatureFromDB(guid, map)) { - sLog->outError("MoveCreData: Cannot add creature guid %u to map", guid); + LOG_ERROR("server", "MoveCreData: Cannot add creature guid %u to map", guid); delete creature; return false; } @@ -2146,7 +2146,7 @@ uint32 ObjectMgr::AddCreData(uint32 entry, uint32 mapId, float x, float y, float Creature* creature = new Creature(); if (!creature->LoadCreatureFromDB(guid, map)) { - sLog->outError("AddCreature: Cannot add creature entry %u to map", entry); + LOG_ERROR("server", "AddCreature: Cannot add creature entry %u to map", entry); delete creature; return 0; } @@ -2171,8 +2171,8 @@ void ObjectMgr::LoadGameobjects() if (!result) { - sLog->outErrorDb(">> Loaded 0 gameobjects. DB table `gameobject` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 gameobjects. DB table `gameobject` is empty."); + LOG_INFO("server", " "); return; } @@ -2195,7 +2195,7 @@ void ObjectMgr::LoadGameobjects() GameObjectTemplate const* gInfo = GetGameObjectTemplate(entry); if (!gInfo) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry); continue; } @@ -2207,14 +2207,14 @@ void ObjectMgr::LoadGameobjects() case GAMEOBJECT_TYPE_SPELL_FOCUS: break; default: - sLog->outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); + LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry %u GoType: %u) doesn't have a displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); break; } } if (gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId)) { - sLog->outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); + LOG_ERROR("sql.sql", "Gameobject (GUID: %u Entry %u GoType: %u) has an invalid displayId (%u), not loaded.", guid, entry, gInfo->type, gInfo->displayId); continue; } @@ -2235,13 +2235,13 @@ void ObjectMgr::LoadGameobjects() MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid); if (!mapEntry) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) spawned on a non-existed map (Id: %u), skip", guid, data.id, data.mapid); continue; } if (data.spawntimesecs == 0 && gInfo->IsDespawnAtAction()) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `spawntimesecs` (0) value, but the gameobejct is marked as despawnable at action.", guid, data.id); } data.animprogress = fields[12].GetUInt8(); @@ -2250,7 +2250,7 @@ void ObjectMgr::LoadGameobjects() uint32 go_state = fields[13].GetUInt8(); if (go_state >= MAX_GO_STATE) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid `state` (%u) value, skip", guid, data.id, go_state); continue; } data.go_state = GOState(go_state); @@ -2258,7 +2258,7 @@ void ObjectMgr::LoadGameobjects() data.spawnMask = fields[14].GetUInt8(); if (!_transportMaps.count(data.mapid) && data.spawnMask & ~spawnMasks[data.mapid]) - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) that has wrong spawn mask %u including not supported difficulty modes for map (Id: %u), skip", guid, data.id, data.spawnMask, data.mapid); data.phaseMask = fields[15].GetUInt32(); int16 gameEvent = fields[16].GetInt8(); @@ -2266,37 +2266,37 @@ void ObjectMgr::LoadGameobjects() if (data.rotation.x < -1.0f || data.rotation.x > 1.0f) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationX (%f) value, skip", guid, data.id, data.rotation.x); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationX (%f) value, skip", guid, data.id, data.rotation.x); continue; } if (data.rotation.y < -1.0f || data.rotation.y > 1.0f) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationY (%f) value, skip", guid, data.id, data.rotation.y); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationY (%f) value, skip", guid, data.id, data.rotation.y); continue; } if (data.rotation.z < -1.0f || data.rotation.z > 1.0f) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationZ (%f) value, skip", guid, data.id, data.rotation.z); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationZ (%f) value, skip", guid, data.id, data.rotation.z); continue; } if (data.rotation.w < -1.0f || data.rotation.w > 1.0f) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationW (%f) value, skip", guid, data.id, data.rotation.w); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid rotationW (%f) value, skip", guid, data.id, data.rotation.w); continue; } if (!MapManager::IsValidMapCoord(data.mapid, data.posX, data.posY, data.posZ, data.orientation)) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with invalid coordinates, skip", guid, data.id); continue; } if (data.phaseMask == 0) { - sLog->outErrorDb("Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); + LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.", guid, data.id); data.phaseMask = 1; } @@ -2319,8 +2319,8 @@ void ObjectMgr::LoadGameobjects() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data) @@ -2429,7 +2429,7 @@ void ObjectMgr::LoadItemLocales() AddLocaleString(Description, locale, data.Description); } while (result->NextRow()); - sLog->outString(">> Loaded %u Item Locale strings in %u ms", (uint32)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u Item Locale strings in %u ms", (uint32)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadItemTemplates() @@ -2471,8 +2471,8 @@ void ObjectMgr::LoadItemTemplates() if (!result) { - sLog->outString(">> Loaded 0 item templates. DB table `item_template` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 item templates. DB table `item_template` is empty."); + LOG_INFO("server", " "); return; } @@ -2596,19 +2596,19 @@ void ObjectMgr::LoadItemTemplates() // Checks if (itemTemplate.Class >= MAX_ITEM_CLASS) { - sLog->outErrorDb("Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Class value (%u)", entry, itemTemplate.Class); itemTemplate.Class = ITEM_CLASS_MISC; } if (itemTemplate.SubClass >= MaxItemSubclassValues[itemTemplate.Class]) { - sLog->outErrorDb("Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Subclass value (%u) for class %u", entry, itemTemplate.SubClass, itemTemplate.Class); itemTemplate.SubClass = 0;// exist for all item classes } if (itemTemplate.Quality >= MAX_ITEM_QUALITY) { - sLog->outErrorDb("Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Quality value (%u)", entry, itemTemplate.Quality); itemTemplate.Quality = ITEM_QUALITY_NORMAL; } @@ -2616,36 +2616,36 @@ void ObjectMgr::LoadItemTemplates() { if (FactionEntry const* faction = sFactionStore.LookupEntry(HORDE)) if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", + LOG_ERROR("sql.sql", "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_HORDE_ONLY); if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.", + LOG_ERROR("sql.sql", "Item (Entry: %u) has value (%u) in `Flags2` flags (ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) and ITEM_FLAGS_EXTRA_HORDE_ONLY (%u) in Flags field, this is a wrong combination.", entry, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY, ITEM_FLAGS_EXTRA_HORDE_ONLY); } else if (itemTemplate.Flags2 & ITEM_FLAGS_EXTRA_ALLIANCE_ONLY) { if (FactionEntry const* faction = sFactionStore.LookupEntry(ALLIANCE)) if ((itemTemplate.AllowableRace & faction->BaseRepRaceMask[0]) == 0) - sLog->outErrorDb("Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", + LOG_ERROR("sql.sql", "Item (Entry: %u) has value (%u) in `AllowableRace` races, not compatible with ITEM_FLAGS_EXTRA_ALLIANCE_ONLY (%u) in Flags field, item cannot be equipped or used by these races.", entry, itemTemplate.AllowableRace, ITEM_FLAGS_EXTRA_ALLIANCE_ONLY); } if (itemTemplate.BuyCount <= 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong BuyCount value (%u), set to default(1).", entry, itemTemplate.BuyCount); itemTemplate.BuyCount = 1; } if (itemTemplate.InventoryType >= MAX_INVTYPE) { - sLog->outErrorDb("Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong InventoryType value (%u)", entry, itemTemplate.InventoryType); itemTemplate.InventoryType = INVTYPE_NON_EQUIP; } if (itemTemplate.RequiredSkill >= MAX_SKILL_TYPE) { - sLog->outErrorDb("Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong RequiredSkill value (%u)", entry, itemTemplate.RequiredSkill); itemTemplate.RequiredSkill = 0; } @@ -2665,60 +2665,60 @@ void ObjectMgr::LoadItemTemplates() if (req) { if (!(itemTemplate.AllowableClass & CLASSMASK_ALL_PLAYABLE)) - sLog->outErrorDb("Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass); + LOG_ERROR("sql.sql", "Item (Entry: %u) does not have any playable classes (%u) in `AllowableClass` and can't be equipped or used.", entry, itemTemplate.AllowableClass); if (!(itemTemplate.AllowableRace & RACEMASK_ALL_PLAYABLE)) - sLog->outErrorDb("Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace); + LOG_ERROR("sql.sql", "Item (Entry: %u) does not have any playable races (%u) in `AllowableRace` and can't be equipped or used.", entry, itemTemplate.AllowableRace); } } if (itemTemplate.RequiredSpell && !sSpellMgr->GetSpellInfo(itemTemplate.RequiredSpell)) { - sLog->outErrorDb("Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell); + LOG_ERROR("sql.sql", "Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell); itemTemplate.RequiredSpell = 0; } if (itemTemplate.RequiredReputationRank >= MAX_REPUTATION_RANK) - sLog->outErrorDb("Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong reputation rank in RequiredReputationRank (%u), item can't be used.", entry, itemTemplate.RequiredReputationRank); if (itemTemplate.RequiredReputationFaction) { if (!sFactionStore.LookupEntry(itemTemplate.RequiredReputationFaction)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong (not existing) faction in RequiredReputationFaction (%u)", entry, itemTemplate.RequiredReputationFaction); itemTemplate.RequiredReputationFaction = 0; } if (itemTemplate.RequiredReputationRank == MIN_REPUTATION_RANK) - sLog->outErrorDb("Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry); + LOG_ERROR("sql.sql", "Item (Entry: %u) has min. reputation rank in RequiredReputationRank (0) but RequiredReputationFaction > 0, faction setting is useless.", entry); } if (itemTemplate.MaxCount < -1) { - sLog->outErrorDb("Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount); + LOG_ERROR("sql.sql", "Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.", entry, itemTemplate.MaxCount); itemTemplate.MaxCount = -1; } if (itemTemplate.Stackable == 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.", entry, itemTemplate.Stackable); itemTemplate.Stackable = 1; } else if (itemTemplate.Stackable < -1) { - sLog->outErrorDb("Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable); + LOG_ERROR("sql.sql", "Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.", entry, itemTemplate.Stackable); itemTemplate.Stackable = -1; } if (itemTemplate.ContainerSlots > MAX_BAG_SIZE) { - sLog->outErrorDb("Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE); + LOG_ERROR("sql.sql", "Item (Entry: %u) has too large value in ContainerSlots (%u), replace by hardcoded limit (%u).", entry, itemTemplate.ContainerSlots, MAX_BAG_SIZE); itemTemplate.ContainerSlots = MAX_BAG_SIZE; } if (itemTemplate.StatsCount > MAX_ITEM_PROTO_STATS) { - sLog->outErrorDb("Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS); + LOG_ERROR("sql.sql", "Item (Entry: %u) has too large value in statscount (%u), replace by hardcoded limit (%u).", entry, itemTemplate.StatsCount, MAX_ITEM_PROTO_STATS); itemTemplate.StatsCount = MAX_ITEM_PROTO_STATS; } @@ -2727,7 +2727,7 @@ void ObjectMgr::LoadItemTemplates() // for ItemStatValue != 0 if (itemTemplate.ItemStat[j].ItemStatValue && itemTemplate.ItemStat[j].ItemStatType >= MAX_ITEM_MOD) { - sLog->outErrorDb("Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j + 1, itemTemplate.ItemStat[j].ItemStatType); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong (non-existing?) stat_type%d (%u)", entry, j + 1, itemTemplate.ItemStat[j].ItemStatType); itemTemplate.ItemStat[j].ItemStatType = 0; } @@ -2735,7 +2735,7 @@ void ObjectMgr::LoadItemTemplates() { case ITEM_MOD_SPELL_HEALING_DONE: case ITEM_MOD_SPELL_DAMAGE_DONE: - sLog->outErrorDb("Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j + 1, itemTemplate.ItemStat[j].ItemStatType); + LOG_ERROR("sql.sql", "Item (Entry: %u) has deprecated stat_type%d (%u)", entry, j + 1, itemTemplate.ItemStat[j].ItemStatType); break; default: break; @@ -2746,7 +2746,7 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Damage[j].DamageType >= MAX_SPELL_SCHOOL) { - sLog->outErrorDb("Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j + 1, itemTemplate.Damage[j].DamageType); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong dmg_type%d (%u)", entry, j + 1, itemTemplate.Damage[j].DamageType); itemTemplate.Damage[j].DamageType = 0; } } @@ -2757,7 +2757,7 @@ void ObjectMgr::LoadItemTemplates() // spell_1 if (itemTemplate.Spells[0].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0 + 1, itemTemplate.Spells[0].SpellTrigger); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format", entry, 0 + 1, itemTemplate.Spells[0].SpellTrigger); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[0].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; itemTemplate.Spells[1].SpellId = 0; @@ -2767,14 +2767,14 @@ void ObjectMgr::LoadItemTemplates() // spell_2 have learning spell if (itemTemplate.Spells[1].SpellTrigger != ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1 + 1, itemTemplate.Spells[1].SpellTrigger); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u) for special learning format.", entry, 1 + 1, itemTemplate.Spells[1].SpellTrigger); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (!itemTemplate.Spells[1].SpellId) { - sLog->outErrorDb("Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1 + 1); + LOG_ERROR("sql.sql", "Item (Entry: %u) does not have an expected spell in spellid_%d in special learning format.", entry, 1 + 1); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2783,7 +2783,7 @@ void ObjectMgr::LoadItemTemplates() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, nullptr)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1 + 1, itemTemplate.Spells[1].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1 + 1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2791,7 +2791,7 @@ void ObjectMgr::LoadItemTemplates() // allowed only in special format else if ((itemTemplate.Spells[1].SpellId == 483) || (itemTemplate.Spells[1].SpellId == 55884)) { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1 + 1, itemTemplate.Spells[1].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, 1 + 1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; itemTemplate.Spells[1].SpellId = 0; itemTemplate.Spells[1].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; @@ -2803,13 +2803,13 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Spells[j].SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j + 1, itemTemplate.Spells[j].SpellTrigger); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j + 1, itemTemplate.Spells[j].SpellTrigger); itemTemplate.Spells[j].SpellId = 0; itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } else if (itemTemplate.Spells[j].SpellId != 0) { - sLog->outErrorDb("Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j + 1, itemTemplate.Spells[j].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong spell in spellid_%d (%d) for learning special format", entry, j + 1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } } @@ -2821,7 +2821,7 @@ void ObjectMgr::LoadItemTemplates() { if (itemTemplate.Spells[j].SpellTrigger >= MAX_ITEM_SPELLTRIGGER || itemTemplate.Spells[j].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID) { - sLog->outErrorDb("Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j + 1, itemTemplate.Spells[j].SpellTrigger); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong item spell trigger value in spelltrigger_%d (%u)", entry, j + 1, itemTemplate.Spells[j].SpellTrigger); itemTemplate.Spells[j].SpellId = 0; itemTemplate.Spells[j].SpellTrigger = ITEM_SPELLTRIGGER_ON_USE; } @@ -2831,13 +2831,13 @@ void ObjectMgr::LoadItemTemplates() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId); if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, nullptr)) { - sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j + 1, itemTemplate.Spells[j].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j + 1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } // allowed only in special format else if ((itemTemplate.Spells[j].SpellId == 483) || (itemTemplate.Spells[j].SpellId == 55884)) { - sLog->outErrorDb("Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j + 1, itemTemplate.Spells[j].SpellId); + LOG_ERROR("sql.sql", "Item (Entry: %u) has broken spell in spellid_%d (%d)", entry, j + 1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; } } @@ -2845,17 +2845,17 @@ void ObjectMgr::LoadItemTemplates() } if (itemTemplate.Bonding >= MAX_BIND_TYPE) - sLog->outErrorDb("Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Bonding value (%u)", entry, itemTemplate.Bonding); if (itemTemplate.PageText && !GetPageText(itemTemplate.PageText)) - sLog->outErrorDb("Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText); + LOG_ERROR("sql.sql", "Item (Entry: %u) has non existing first page (Id:%u)", entry, itemTemplate.PageText); if (itemTemplate.LockID && !sLockStore.LookupEntry(itemTemplate.LockID)) - sLog->outErrorDb("Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong LockID (%u)", entry, itemTemplate.LockID); if (itemTemplate.Sheath >= MAX_SHEATHETYPE) { - sLog->outErrorDb("Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Sheath (%u)", entry, itemTemplate.Sheath); itemTemplate.Sheath = SHEATHETYPE_NONE; } @@ -2867,28 +2867,28 @@ void ObjectMgr::LoadItemTemplates() else if (!sItemRandomPropertiesStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomProperty))) { - sLog->outErrorDb("Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty); + LOG_ERROR("sql.sql", "Item (Entry: %u) has unknown (wrong or not listed in `item_enchantment_template`) RandomProperty (%u)", entry, itemTemplate.RandomProperty); itemTemplate.RandomProperty = 0; } } if (itemTemplate.RandomSuffix && !sItemRandomSuffixStore.LookupEntry(GetItemEnchantMod(itemTemplate.RandomSuffix))) { - sLog->outErrorDb("Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong RandomSuffix (%u)", entry, itemTemplate.RandomSuffix); itemTemplate.RandomSuffix = 0; } if (itemTemplate.ItemSet && !sItemSetStore.LookupEntry(itemTemplate.ItemSet)) { - sLog->outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet); + LOG_ERROR("sql.sql", "Item (Entry: %u) have wrong ItemSet (%u)", entry, itemTemplate.ItemSet); itemTemplate.ItemSet = 0; } if (itemTemplate.Area && !sAreaTableStore.LookupEntry(itemTemplate.Area)) - sLog->outErrorDb("Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Area (%u)", entry, itemTemplate.Area); if (itemTemplate.Map && !sMapStore.LookupEntry(itemTemplate.Map)) - sLog->outErrorDb("Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong Map (%u)", entry, itemTemplate.Map); if (itemTemplate.BagFamily) { @@ -2902,7 +2902,7 @@ void ObjectMgr::LoadItemTemplates() ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j + 1); if (!bf) { - sLog->outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry); + LOG_ERROR("sql.sql", "Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit", entry); itemTemplate.BagFamily &= ~mask; continue; } @@ -2912,7 +2912,7 @@ void ObjectMgr::LoadItemTemplates() CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemTemplate.ItemId); if (!ctEntry) { - sLog->outErrorDb("Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry); + LOG_ERROR("sql.sql", "Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit", entry); itemTemplate.BagFamily &= ~mask; } } @@ -2920,41 +2920,41 @@ void ObjectMgr::LoadItemTemplates() } if (itemTemplate.TotemCategory && !sTotemCategoryStore.LookupEntry(itemTemplate.TotemCategory)) - sLog->outErrorDb("Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong TotemCategory (%u)", entry, itemTemplate.TotemCategory); for (uint8 j = 0; j < MAX_ITEM_PROTO_SOCKETS; ++j) { if (itemTemplate.Socket[j].Color && (itemTemplate.Socket[j].Color & SOCKET_COLOR_ALL) != itemTemplate.Socket[j].Color) { - sLog->outErrorDb("Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j + 1, itemTemplate.Socket[j].Color); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong socketColor_%d (%u)", entry, j + 1, itemTemplate.Socket[j].Color); itemTemplate.Socket[j].Color = 0; } } if (itemTemplate.GemProperties && !sGemPropertiesStore.LookupEntry(itemTemplate.GemProperties)) - sLog->outErrorDb("Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong GemProperties (%u)", entry, itemTemplate.GemProperties); if (itemTemplate.FoodType >= MAX_PET_DIET) { - sLog->outErrorDb("Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong FoodType value (%u)", entry, itemTemplate.FoodType); itemTemplate.FoodType = 0; } if (itemTemplate.ItemLimitCategory && !sItemLimitCategoryStore.LookupEntry(itemTemplate.ItemLimitCategory)) { - sLog->outErrorDb("Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong LimitCategory value (%u)", entry, itemTemplate.ItemLimitCategory); itemTemplate.ItemLimitCategory = 0; } if (itemTemplate.HolidayId && !sHolidaysStore.LookupEntry(itemTemplate.HolidayId)) { - sLog->outErrorDb("Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId); + LOG_ERROR("sql.sql", "Item (Entry: %u) has wrong HolidayId value (%u)", entry, itemTemplate.HolidayId); itemTemplate.HolidayId = 0; } if (itemTemplate.FlagsCu & ITEM_FLAGS_CU_DURATION_REAL_TIME && !itemTemplate.Duration) { - sLog->outErrorDb("Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry); + LOG_ERROR("sql.sql", "Item (Entry %u) has flag ITEM_FLAGS_CU_DURATION_REAL_TIME but it does not have duration limit", entry); itemTemplate.FlagsCu &= ~ITEM_FLAGS_CU_DURATION_REAL_TIME; } @@ -3015,10 +3015,10 @@ void ObjectMgr::LoadItemTemplates() } for (std::set::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr) - sLog->outErrorDb("Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); + LOG_ERROR("sql.sql", "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr); - sLog->outString(">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry) @@ -3053,7 +3053,7 @@ void ObjectMgr::LoadItemSetNameLocales() AddLocaleString(Name, locale, data.Name); } while (result->NextRow()); - sLog->outString(">> Loaded %u Item Set Name Locale strings in %u ms", uint32(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u Item Set Name Locale strings in %u ms", uint32(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadItemSetNames() @@ -3081,8 +3081,8 @@ void ObjectMgr::LoadItemSetNames() if (!result) { - sLog->outString(">> Loaded 0 item set names. DB table `item_set_names` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 item set names. DB table `item_set_names` is empty."); + LOG_INFO("server", " "); return; } @@ -3096,7 +3096,7 @@ void ObjectMgr::LoadItemSetNames() uint32 entry = fields[0].GetUInt32(); if (itemSetItems.find(entry) == itemSetItems.end()) { - sLog->outErrorDb("Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry); + LOG_ERROR("sql.sql", "Item set name (Entry: %u) not found in ItemSet.dbc, data useless.", entry); continue; } @@ -3106,7 +3106,7 @@ void ObjectMgr::LoadItemSetNames() uint32 invType = fields[2].GetUInt8(); if (invType >= MAX_INVTYPE) { - sLog->outErrorDb("Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType); + LOG_ERROR("sql.sql", "Item set name (Entry: %u) has wrong InventoryType value (%u)", entry, invType); invType = INVTYPE_NON_EQUIP; } @@ -3125,19 +3125,19 @@ void ObjectMgr::LoadItemSetNames() pProto = sObjectMgr->GetItemTemplate(entry); if (pProto) { - sLog->outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry); + LOG_ERROR("sql.sql", "Item set part (Entry: %u) does not have entry in `item_set_names`, adding data from `item_template`.", entry); ItemSetNameEntry& data = _itemSetNameStore[entry]; data.name = pProto->Name1; data.InventoryType = pProto->InventoryType; ++count; } else - sLog->outErrorDb("Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry); + LOG_ERROR("sql.sql", "Item set part (Entry: %u) does not have entry in `item_set_names`, set will not display properly.", entry); } } - sLog->outString(">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadVehicleTemplateAccessories() @@ -3153,8 +3153,8 @@ void ObjectMgr::LoadVehicleTemplateAccessories() if (!result) { - sLog->outErrorDb(">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 vehicle template accessories. DB table `vehicle_template_accessory` is empty."); + LOG_INFO("server", " "); return; } @@ -3171,19 +3171,19 @@ void ObjectMgr::LoadVehicleTemplateAccessories() if (!sObjectMgr->GetCreatureTemplate(uiEntry)) { - sLog->outErrorDb("Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry); + LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u does not exist.", uiEntry); continue; } if (!sObjectMgr->GetCreatureTemplate(uiAccessory)) { - sLog->outErrorDb("Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory); + LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: Accessory %u does not exist.", uiAccessory); continue; } if (_spellClickInfoStore.find(uiEntry) == _spellClickInfoStore.end()) { - sLog->outErrorDb("Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry); + LOG_ERROR("sql.sql", "Table `vehicle_template_accessory`: creature template entry %u has no data in npc_spellclick_spells", uiEntry); continue; } @@ -3192,8 +3192,8 @@ void ObjectMgr::LoadVehicleTemplateAccessories() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadVehicleAccessories() @@ -3209,8 +3209,8 @@ void ObjectMgr::LoadVehicleAccessories() if (!result) { - sLog->outString(">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); return; } @@ -3227,7 +3227,7 @@ void ObjectMgr::LoadVehicleAccessories() if (!sObjectMgr->GetCreatureTemplate(uiAccessory)) { - sLog->outErrorDb("Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory); + LOG_ERROR("sql.sql", "Table `vehicle_accessory`: Accessory %u does not exist.", uiAccessory); continue; } @@ -3236,8 +3236,8 @@ void ObjectMgr::LoadVehicleAccessories() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadPetLevelInfo() @@ -3249,8 +3249,8 @@ void ObjectMgr::LoadPetLevelInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 level pet stats definitions. DB table `pet_levelstats` is empty."); + LOG_INFO("server", " "); return; } @@ -3263,7 +3263,7 @@ void ObjectMgr::LoadPetLevelInfo() uint32 creature_id = fields[0].GetUInt32(); if (!sObjectMgr->GetCreatureTemplate(creature_id)) { - sLog->outErrorDb("Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id); + LOG_ERROR("sql.sql", "Wrong creature id %u in `pet_levelstats` table, ignoring.", creature_id); continue; } @@ -3271,11 +3271,11 @@ void ObjectMgr::LoadPetLevelInfo() if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - sLog->outErrorDb("Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); + LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `pet_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level); + LOG_DEBUG("server", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `pet_levelstats` table, ignoring.", current_level); #endif ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } @@ -3283,7 +3283,7 @@ void ObjectMgr::LoadPetLevelInfo() } else if (current_level < 1) { - sLog->outErrorDb("Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level); + LOG_ERROR("sql.sql", "Wrong (<1) level %u in `pet_levelstats` table, ignoring.", current_level); continue; } @@ -3316,7 +3316,7 @@ void ObjectMgr::LoadPetLevelInfo() // fatal error if no level 1 data if (!pInfo || pInfo[0].health == 0) { - sLog->outErrorDb("Creature %u does not have pet stats data for Level 1!", itr->first); + LOG_ERROR("sql.sql", "Creature %u does not have pet stats data for Level 1!", itr->first); exit(1); } @@ -3325,14 +3325,14 @@ void ObjectMgr::LoadPetLevelInfo() { if (pInfo[level].health == 0) { - sLog->outErrorDb("Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level + 1, level); + LOG_ERROR("sql.sql", "Creature %u has no data for Level %i pet stats data, using data of Level %i.", itr->first, level + 1, level); pInfo[level] = pInfo[level - 1]; } } } - sLog->outString(">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const @@ -3357,7 +3357,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3 else { if (count < -1) - sLog->outError("Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId); + LOG_ERROR("server", "Invalid count %i specified on item %u be removed from original player create info (use -1)!", count, itemId); for (uint32 gender = 0; gender < GENDER_NONE; ++gender) { @@ -3375,7 +3375,7 @@ void ObjectMgr::PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint3 } if (!found) - sLog->outError("Item %u specified to be removed from original create info not found in dbc!", itemId); + LOG_ERROR("server", "Item %u specified to be removed from original create info not found in dbc!", itemId); } } } @@ -3391,8 +3391,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outString(); - sLog->outErrorDb(">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty."); + LOG_INFO("server", " "); + LOG_ERROR("sql.sql", ">> Loaded 0 player create definitions. DB table `playercreateinfo` is empty."); exit(1); } else @@ -3414,39 +3414,39 @@ void ObjectMgr::LoadPlayerInfo() if (current_race >= MAX_RACES) { - sLog->outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race); + LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo` table, ignoring.", current_race); continue; } ChrRacesEntry const* rEntry = sChrRacesStore.LookupEntry(current_race); if (!rEntry) { - sLog->outErrorDb("Wrong race %u in `playercreateinfo` table, ignoring.", current_race); + LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo` table, ignoring.", current_race); continue; } if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class); + LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo` table, ignoring.", current_class); continue; } if (!sChrClassesStore.LookupEntry(current_class)) { - sLog->outErrorDb("Wrong class %u in `playercreateinfo` table, ignoring.", current_class); + LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo` table, ignoring.", current_class); continue; } // accept DB data only for valid position (and non instanceable) if (!MapManager::IsValidMapCoord(mapId, positionX, positionY, positionZ, orientation)) { - sLog->outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); + LOG_ERROR("sql.sql", "Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); continue; } if (sMapStore.LookupEntry(mapId)->Instanceable()) { - sLog->outError("Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); + LOG_ERROR("server", "Home position in instanceable map for class %u race %u pair in `playercreateinfo` table, ignoring.", current_class, current_race); continue; } @@ -3464,13 +3464,13 @@ void ObjectMgr::LoadPlayerInfo() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // Load playercreate items - sLog->outString("Loading Player Create Items Data..."); + LOG_INFO("server", "Loading Player Create Items Data..."); { uint32 oldMSTime = getMSTime(); // 0 1 2 3 @@ -3478,8 +3478,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outString(">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty."); + LOG_INFO("server", " "); } else { @@ -3492,14 +3492,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - sLog->outErrorDb("Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); + LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo_item` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); + LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo_item` table, ignoring.", current_class); continue; } @@ -3507,7 +3507,7 @@ void ObjectMgr::LoadPlayerInfo() if (!GetItemTemplate(item_id)) { - sLog->outErrorDb("Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class); + LOG_ERROR("sql.sql", "Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class); continue; } @@ -3515,7 +3515,7 @@ void ObjectMgr::LoadPlayerInfo() if (!amount) { - sLog->outErrorDb("Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class); + LOG_ERROR("sql.sql", "Item id %u (class %u race %u) have amount == 0 in `playercreateinfo_item` table, ignoring.", item_id, current_race, current_class); continue; } @@ -3535,13 +3535,13 @@ void ObjectMgr::LoadPlayerInfo() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // Load playercreate spells - sLog->outString("Loading Player Create Spell Data..."); + LOG_INFO("server", "Loading Player Create Spell Data..."); { uint32 oldMSTime = getMSTime(); @@ -3550,7 +3550,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"); + LOG_ERROR("sql.sql", ">> Loaded 0 player create spells. DB table `%s` is empty.", sWorld->getBoolConfig(CONFIG_START_ALL_SPELLS) ? "playercreateinfo_spell_custom" : "playercreateinfo_spell"); } else { @@ -3565,13 +3565,13 @@ void ObjectMgr::LoadPlayerInfo() if (raceMask != 0 && !(raceMask & RACEMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Wrong race mask %u in `playercreateinfo_spell` table, ignoring.", raceMask); + LOG_ERROR("sql.sql", "Wrong race mask %u in `playercreateinfo_spell` table, ignoring.", raceMask); continue; } if (classMask != 0 && !(classMask & CLASSMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Wrong class mask %u in `playercreateinfo_spell` table, ignoring.", classMask); + LOG_ERROR("sql.sql", "Wrong class mask %u in `playercreateinfo_spell` table, ignoring.", classMask); continue; } @@ -3591,20 +3591,20 @@ void ObjectMgr::LoadPlayerInfo() // We need something better here, the check is not accounting for spells used by multiple races/classes but not all of them. // Either split the masks per class, or per race, which kind of kills the point yet. // else if (raceMask != 0 && classMask != 0) - // sLog->outError(LOG_FILTER_SQL, "Racemask/classmask (%u/%u) combination was found containing an invalid race/class combination (%u/%u) in `playercreateinfo_spell` (Spell %u), ignoring.", raceMask, classMask, raceIndex, classIndex, spellId); + // LOG_ERROR("server", LOG_FILTER_SQL, "Racemask/classmask (%u/%u) combination was found containing an invalid race/class combination (%u/%u) in `playercreateinfo_spell` (Spell %u), ignoring.", raceMask, classMask, raceIndex, classIndex, spellId); } } } } } while (result->NextRow()); - sLog->outString(">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // Load playercreate actions - sLog->outString("Loading Player Create Action Data..."); + LOG_INFO("server", "Loading Player Create Action Data..."); { uint32 oldMSTime = getMSTime(); @@ -3613,8 +3613,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 player create actions. DB table `playercreateinfo_action` is empty."); + LOG_INFO("server", " "); } else { @@ -3627,14 +3627,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - sLog->outErrorDb("Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); + LOG_ERROR("sql.sql", "Wrong race %u in `playercreateinfo_action` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); + LOG_ERROR("sql.sql", "Wrong class %u in `playercreateinfo_action` table, ignoring.", current_class); continue; } @@ -3644,13 +3644,13 @@ void ObjectMgr::LoadPlayerInfo() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // Loading levels data (class only dependent) - sLog->outString("Loading Player Create Level HP/Mana Data..."); + LOG_INFO("server", "Loading Player Create Level HP/Mana Data..."); { uint32 oldMSTime = getMSTime(); @@ -3659,7 +3659,7 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outError(">> Loaded 0 level health/mana definitions. DB table `player_classlevelstats` is empty."); + LOG_ERROR("server", ">> Loaded 0 level health/mana definitions. DB table `player_classlevelstats` is empty."); exit(1); } @@ -3672,14 +3672,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_class = fields[0].GetUInt8(); if (current_class >= MAX_CLASSES) { - sLog->outError("Wrong class %u in `player_classlevelstats` table, ignoring.", current_class); + LOG_ERROR("server", "Wrong class %u in `player_classlevelstats` table, ignoring.", current_class); continue; } uint8 current_level = fields[1].GetUInt8(); // Can't be > than STRONG_MAX_LEVEL (hardcoded level maximum) due to var type if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { - sLog->outString("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level); + LOG_INFO("server", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_classlevelstats` table, ignoring.", current_level); ++count; // make result loading percent "expected" correct in case disabled detail mode for example. continue; } @@ -3712,7 +3712,7 @@ void ObjectMgr::LoadPlayerInfo() // fatal error if no level 1 data if (!pClassInfo->levelInfo || pClassInfo->levelInfo[0].basehealth == 0) { - sLog->outError("Class %i Level 1 does not have health/mana data!", class_); + LOG_ERROR("server", "Class %i Level 1 does not have health/mana data!", class_); exit(1); } @@ -3721,18 +3721,18 @@ void ObjectMgr::LoadPlayerInfo() { if (pClassInfo->levelInfo[level].basehealth == 0) { - sLog->outError("Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level + 1, level); + LOG_ERROR("server", "Class %i Level %i does not have health/mana data. Using stats data of level %i.", class_, level + 1, level); pClassInfo->levelInfo[level] = pClassInfo->levelInfo[level - 1]; } } } - sLog->outString(">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } // Loading levels data (class/race dependent) - sLog->outString("Loading Player Create Level Stats Data..."); + LOG_INFO("server", "Loading Player Create Level Stats Data..."); { uint32 oldMSTime = getMSTime(); @@ -3741,8 +3741,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 level stats definitions. DB table `player_levelstats` is empty."); + LOG_INFO("server", " "); exit(1); } @@ -3755,14 +3755,14 @@ void ObjectMgr::LoadPlayerInfo() uint32 current_race = fields[0].GetUInt8(); if (current_race >= MAX_RACES) { - sLog->outErrorDb("Wrong race %u in `player_levelstats` table, ignoring.", current_race); + LOG_ERROR("sql.sql", "Wrong race %u in `player_levelstats` table, ignoring.", current_race); continue; } uint32 current_class = fields[1].GetUInt8(); if (current_class >= MAX_CLASSES) { - sLog->outErrorDb("Wrong class %u in `player_levelstats` table, ignoring.", current_class); + LOG_ERROR("sql.sql", "Wrong class %u in `player_levelstats` table, ignoring.", current_class); continue; } @@ -3770,11 +3770,11 @@ void ObjectMgr::LoadPlayerInfo() if (current_level > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - sLog->outErrorDb("Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); + LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `player_levelstats` table, ignoring.", STRONG_MAX_LEVEL, current_level); else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level); + LOG_DEBUG("server", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_levelstats` table, ignoring.", current_level); #endif ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } @@ -3822,7 +3822,7 @@ void ObjectMgr::LoadPlayerInfo() // fatal error if no level 1 data if (!info->levelInfo || info->levelInfo[0].stats[0] == 0) { - sLog->outError("Race %i Class %i Level 1 does not have stats data!", race, class_); + LOG_ERROR("server", "Race %i Class %i Level 1 does not have stats data!", race, class_); exit(1); } @@ -3831,19 +3831,19 @@ void ObjectMgr::LoadPlayerInfo() { if (info->levelInfo[level].stats[0] == 0) { - sLog->outError("Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level + 1, level); + LOG_ERROR("server", "Race %i Class %i Level %i does not have stats data. Using stats data of level %i.", race, class_, level + 1, level); info->levelInfo[level] = info->levelInfo[level - 1]; } } } } - sLog->outString(">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } // Loading xp per level data - sLog->outString("Loading Player Create XP Data..."); + LOG_INFO("server", "Loading Player Create XP Data..."); { uint32 oldMSTime = getMSTime(); @@ -3856,8 +3856,8 @@ void ObjectMgr::LoadPlayerInfo() if (!result) { - sLog->outErrorDb(">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 xp for level definitions. DB table `player_xp_for_level` is empty."); + LOG_INFO("server", " "); exit(1); } @@ -3873,11 +3873,11 @@ void ObjectMgr::LoadPlayerInfo() if (current_level >= sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { if (current_level > STRONG_MAX_LEVEL) // hardcoded level maximum - sLog->outErrorDb("Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); + LOG_ERROR("sql.sql", "Wrong (> %u) level %u in `player_xp_for_level` table, ignoring.", STRONG_MAX_LEVEL, current_level); else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level); + LOG_DEBUG("server", "Unused (> MaxPlayerLevel in worldserver.conf) level %u in `player_xp_for_levels` table, ignoring.", current_level); #endif ++count; // make result loading percent "expected" correct in case disabled detail mode for example. } @@ -3893,13 +3893,13 @@ void ObjectMgr::LoadPlayerInfo() { if (_playerXPperLevel[level] == 0) { - sLog->outErrorDb("Level %i does not have XP for level data. Using data of level [%i] + 100.", level + 1, level); + LOG_ERROR("sql.sql", "Level %i does not have XP for level data. Using data of level [%i] + 100.", level + 1, level); _playerXPperLevel[level] = _playerXPperLevel[level - 1] + 100; } } - sLog->outString(">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } @@ -4048,8 +4048,8 @@ void ObjectMgr::LoadQuests() " FROM quest_template"); if (!result) { - sLog->outErrorDb(">> Loaded 0 quests definitions. DB table `quest_template` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 quests definitions. DB table `quest_template` is empty."); + LOG_INFO("server", " "); return; } @@ -4090,7 +4090,7 @@ void ObjectMgr::LoadQuests() if (!result) { - sLog->outError(">> Loaded 0 quest details. DB table `quest_details` is empty."); + LOG_ERROR("server", ">> Loaded 0 quest details. DB table `quest_details` is empty."); } else { @@ -4103,7 +4103,7 @@ void ObjectMgr::LoadQuests() if (itr != _questTemplates.end()) itr->second->LoadQuestDetails(fields); else - sLog->outError("Table `quest_details` has data for quest %u but such quest does not exist", questId); + LOG_ERROR("server", "Table `quest_details` has data for quest %u but such quest does not exist", questId); } while (result->NextRow()); } @@ -4113,7 +4113,7 @@ void ObjectMgr::LoadQuests() if (!result) { - sLog->outError(">> Loaded 0 quest request items. DB table `quest_request_items` is empty."); + LOG_ERROR("server", ">> Loaded 0 quest request items. DB table `quest_request_items` is empty."); } else { @@ -4126,7 +4126,7 @@ void ObjectMgr::LoadQuests() if (itr != _questTemplates.end()) itr->second->LoadQuestRequestItems(fields); else - sLog->outError("Table `quest_request_items` has data for quest %u but such quest does not exist", questId); + LOG_ERROR("server", "Table `quest_request_items` has data for quest %u but such quest does not exist", questId); } while (result->NextRow()); } @@ -4136,7 +4136,7 @@ void ObjectMgr::LoadQuests() if (!result) { - sLog->outError(">> Loaded 0 quest reward emotes. DB table `quest_offer_reward` is empty."); + LOG_ERROR("server", ">> Loaded 0 quest reward emotes. DB table `quest_offer_reward` is empty."); } else { @@ -4149,7 +4149,7 @@ void ObjectMgr::LoadQuests() if (itr != _questTemplates.end()) itr->second->LoadQuestOfferReward(fields); else - sLog->outError("Table `quest_offer_reward` has data for quest %u but such quest does not exist", questId); + LOG_ERROR("server", "Table `quest_offer_reward` has data for quest %u but such quest does not exist", questId); } while (result->NextRow()); } @@ -4161,7 +4161,7 @@ void ObjectMgr::LoadQuests() if (!result) { - sLog->outError(">> Loaded 0 quest template addons. DB table `quest_template_addon` is empty."); + LOG_ERROR("server", ">> Loaded 0 quest template addons. DB table `quest_template_addon` is empty."); } else { @@ -4174,7 +4174,7 @@ void ObjectMgr::LoadQuests() if (itr != _questTemplates.end()) itr->second->LoadQuestTemplateAddon(fields); else - sLog->outError("Table `quest_template_addon` has data for quest %u but such quest does not exist", questId); + LOG_ERROR("server", "Table `quest_template_addon` has data for quest %u but such quest does not exist", questId); } while (result->NextRow()); } @@ -4190,18 +4190,18 @@ void ObjectMgr::LoadQuests() // additional quest integrity checks (GO, creature_template and item_template must be loaded already) if (qinfo->GetQuestMethod() >= 3) - sLog->outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod()); + LOG_ERROR("sql.sql", "Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod()); if (qinfo->SpecialFlags & ~QUEST_SPECIAL_FLAGS_DB_ALLOWED) { - sLog->outErrorDb("Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", + LOG_ERROR("sql.sql", "Quest %u has `SpecialFlags` = %u > max allowed value. Correct `SpecialFlags` to value <= %u", qinfo->GetQuestId(), qinfo->SpecialFlags, QUEST_SPECIAL_FLAGS_DB_ALLOWED); qinfo->SpecialFlags &= QUEST_SPECIAL_FLAGS_DB_ALLOWED; } if (qinfo->Flags & QUEST_FLAGS_DAILY && qinfo->Flags & QUEST_FLAGS_WEEKLY) { - sLog->outErrorDb("Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId()); + LOG_ERROR("sql.sql", "Weekly Quest %u is marked as daily quest in `Flags`, removed daily flag.", qinfo->GetQuestId()); qinfo->Flags &= ~QUEST_FLAGS_DAILY; } @@ -4209,7 +4209,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE)) { - sLog->outErrorDb("Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); + LOG_ERROR("sql.sql", "Daily Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); qinfo->SpecialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE; } } @@ -4218,7 +4218,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE)) { - sLog->outErrorDb("Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); + LOG_ERROR("sql.sql", "Weekly Quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); qinfo->SpecialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE; } } @@ -4227,7 +4227,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->SpecialFlags & QUEST_SPECIAL_FLAGS_REPEATABLE)) { - sLog->outError("Monthly quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); + LOG_ERROR("server", "Monthly quest %u not marked as repeatable in `SpecialFlags`, added.", qinfo->GetQuestId()); qinfo->SpecialFlags |= QUEST_SPECIAL_FLAGS_REPEATABLE; } } @@ -4239,7 +4239,7 @@ void ObjectMgr::LoadQuests() { if (uint32 id = qinfo->RewardChoiceItemId[j]) { - sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_TRACKING.", + LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but item from `RewardChoiceItemId%d` can't be rewarded with quest flag QUEST_FLAGS_TRACKING.", qinfo->GetQuestId(), j + 1, id, j + 1); // no changes, quest ignore this data } @@ -4251,7 +4251,7 @@ void ObjectMgr::LoadQuests() { if (!sAreaTableStore.LookupEntry(qinfo->ZoneOrSort)) { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", + LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %u (zone case) but zone with this id does not exist.", qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client } @@ -4262,7 +4262,7 @@ void ObjectMgr::LoadQuests() QuestSortEntry const* qSort = sQuestSortStore.LookupEntry(-int32(qinfo->ZoneOrSort)); if (!qSort) { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", + LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %i (sort case) but quest sort with this id does not exist.", qinfo->GetQuestId(), qinfo->ZoneOrSort); // no changes, quest not dependent from this value but can have problems at client (note some may be 0, we must allow this so no check) } @@ -4271,7 +4271,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredSkillId != skill_id) { - sLog->outErrorDb("Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).", + LOG_ERROR("sql.sql", "Quest %u has `ZoneOrSort` = %i but `RequiredSkillId` does not have a corresponding value (%d).", qinfo->GetQuestId(), qinfo->ZoneOrSort, skill_id); //override, and force proper value here? } @@ -4283,7 +4283,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->RequiredClasses & CLASSMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses); + LOG_ERROR("sql.sql", "Quest %u does not contain any playable classes in `RequiredClasses` (%u), value set to 0 (all classes).", qinfo->GetQuestId(), qinfo->RequiredClasses); qinfo->RequiredClasses = 0; } } @@ -4292,7 +4292,7 @@ void ObjectMgr::LoadQuests() { if (!(qinfo->AllowableRaces & RACEMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Quest %u does not contain any playable races in `AllowableRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->AllowableRaces); + LOG_ERROR("sql.sql", "Quest %u does not contain any playable races in `AllowableRaces` (%u), value set to 0 (all races).", qinfo->GetQuestId(), qinfo->AllowableRaces); qinfo->AllowableRaces = 0; } } @@ -4301,7 +4301,7 @@ void ObjectMgr::LoadQuests() { if (!sSkillLineStore.LookupEntry(qinfo->RequiredSkillId)) { - sLog->outErrorDb("Quest %u has `RequiredSkillId` = %u but this skill does not exist", + LOG_ERROR("sql.sql", "Quest %u has `RequiredSkillId` = %u but this skill does not exist", qinfo->GetQuestId(), qinfo->RequiredSkillId); } } @@ -4310,7 +4310,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredSkillPoints > sWorld->GetConfigMaxSkillValue()) { - sLog->outErrorDb("Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredSkillPoints` = %u but max possible skill is %u, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredSkillPoints, sWorld->GetConfigMaxSkillValue()); // no changes, quest can't be done for this requirement } @@ -4319,77 +4319,77 @@ void ObjectMgr::LoadQuests() if (qinfo->RequiredFactionId2 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId2)) { - sLog->outErrorDb("Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionId2` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredFactionId2, qinfo->RequiredFactionId2); // no changes, quest can't be done for this requirement } if (qinfo->RequiredFactionId1 && !sFactionStore.LookupEntry(qinfo->RequiredFactionId1)) { - sLog->outErrorDb("Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionId1` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredFactionId1, qinfo->RequiredFactionId1); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMinRepFaction)) { - sLog->outErrorDb("Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepFaction` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMinRepFaction, qinfo->RequiredMinRepFaction); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMaxRepFaction && !sFactionStore.LookupEntry(qinfo->RequiredMaxRepFaction)) { - sLog->outErrorDb("Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepFaction` = %u but faction template %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMaxRepFaction, qinfo->RequiredMaxRepFaction); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepValue && qinfo->RequiredMinRepValue > ReputationMgr::Reputation_Cap) { - sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepValue` = %d but max reputation is %u, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMinRepValue, ReputationMgr::Reputation_Cap); // no changes, quest can't be done for this requirement } if (qinfo->RequiredMinRepValue && qinfo->RequiredMaxRepValue && qinfo->RequiredMaxRepValue <= qinfo->RequiredMinRepValue) { - sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepValue` = %d and `RequiredMinRepValue` = %d, quest can't be done.", qinfo->GetQuestId(), qinfo->RequiredMaxRepValue, qinfo->RequiredMinRepValue); // no changes, quest can't be done for this requirement } if (!qinfo->RequiredFactionId1 && qinfo->RequiredFactionValue1 != 0) { - sLog->outErrorDb("Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect", + LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionValue1` = %d but `RequiredFactionId1` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredFactionValue1); // warning } if (!qinfo->RequiredFactionId2 && qinfo->RequiredFactionValue2 != 0) { - sLog->outErrorDb("Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect", + LOG_ERROR("sql.sql", "Quest %u has `RequiredFactionValue2` = %d but `RequiredFactionId2` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredFactionValue2); // warning } if (!qinfo->RequiredMinRepFaction && qinfo->RequiredMinRepValue != 0) { - sLog->outErrorDb("Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", + LOG_ERROR("sql.sql", "Quest %u has `RequiredMinRepValue` = %d but `RequiredMinRepFaction` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredMinRepValue); // warning } if (!qinfo->RequiredMaxRepFaction && qinfo->RequiredMaxRepValue != 0) { - sLog->outErrorDb("Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", + LOG_ERROR("sql.sql", "Quest %u has `RequiredMaxRepValue` = %d but `RequiredMaxRepFaction` is 0, value has no effect", qinfo->GetQuestId(), qinfo->RequiredMaxRepValue); // warning } if (qinfo->RewardTitleId && !sCharTitlesStore.LookupEntry(qinfo->RewardTitleId)) { - sLog->outErrorDb("Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", + LOG_ERROR("sql.sql", "Quest %u has `RewardTitleId` = %u but CharTitle Id %u does not exist, quest can't be rewarded with title.", qinfo->GetQuestId(), qinfo->GetCharTitleId(), qinfo->GetCharTitleId()); qinfo->RewardTitleId = 0; // quest can't reward this title @@ -4399,20 +4399,20 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(qinfo->StartItem)) { - sLog->outErrorDb("Quest %u has `StartItem` = %u but item with entry %u does not exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `StartItem` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), qinfo->StartItem, qinfo->StartItem); qinfo->StartItem = 0; // quest can't be done for this requirement } else if (qinfo->StartItemCount == 0) { - sLog->outErrorDb("Quest %u has `StartItem` = %u but `StartItemCount` = 0, set to 1 but need fix in DB.", + LOG_ERROR("sql.sql", "Quest %u has `StartItem` = %u but `StartItemCount` = 0, set to 1 but need fix in DB.", qinfo->GetQuestId(), qinfo->StartItem); qinfo->StartItemCount = 1; // update to 1 for allow quest work for backward compatibility with DB } } else if (qinfo->StartItemCount > 0) { - sLog->outErrorDb("Quest %u has `StartItem` = 0 but `StartItemCount` = %u, useless value.", + LOG_ERROR("sql.sql", "Quest %u has `StartItem` = 0 but `StartItemCount` = %u, useless value.", qinfo->GetQuestId(), qinfo->StartItemCount); qinfo->StartItemCount = 0; // no quest work changes in fact } @@ -4422,13 +4422,13 @@ void ObjectMgr::LoadQuests() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SourceSpellid); if (!spellInfo) { - sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `SourceSpellid` = %u but spell %u doesn't exist, quest can't be done.", qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); qinfo->SourceSpellid = 0; // quest can't be done for this requirement } else if (!SpellMgr::ComputeIsSpellValid(spellInfo)) { - sLog->outErrorDb("Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `SourceSpellid` = %u but spell %u is broken, quest can't be done.", qinfo->GetQuestId(), qinfo->SourceSpellid, qinfo->SourceSpellid); qinfo->SourceSpellid = 0; // quest can't be done for this requirement } @@ -4441,7 +4441,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->RequiredItemCount[j] == 0) { - sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredItemId%d` = %u but `RequiredItemCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j + 1, id, j + 1); // no changes, quest can't be done for this requirement } @@ -4450,14 +4450,14 @@ void ObjectMgr::LoadQuests() if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredItemId%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, id); qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } } else if (qinfo->RequiredItemCount[j] > 0) { - sLog->outErrorDb("Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredItemId%d` = 0 but `RequiredItemCount%d` = %u, quest can't be done.", qinfo->GetQuestId(), j + 1, j + 1, qinfo->RequiredItemCount[j]); qinfo->RequiredItemCount[j] = 0; // prevent incorrect work of quest } @@ -4470,7 +4470,7 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `ItemDrop%d` = %u but item with entry %u does not exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `ItemDrop%d` = %u but item with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, id); // no changes, quest can't be done for this requirement } @@ -4479,7 +4479,7 @@ void ObjectMgr::LoadQuests() { if (qinfo->ItemDropQuantity[j] > 0) { - sLog->outErrorDb("Quest %u has `ItemDrop%d` = 0 but `ItemDropQuantity%d` = %u.", + LOG_ERROR("sql.sql", "Quest %u has `ItemDrop%d` = 0 but `ItemDropQuantity%d` = %u.", qinfo->GetQuestId(), j + 1, j + 1, qinfo->ItemDropQuantity[j]); // no changes, quest ignore this data } @@ -4491,14 +4491,14 @@ void ObjectMgr::LoadQuests() int32 id = qinfo->RequiredNpcOrGo[j]; if (id < 0 && !sObjectMgr->GetGameObjectTemplate(-id)) { - sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredNpcOrGo%d` = %i but gameobject %u does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, uint32(-id)); qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } if (id > 0 && !sObjectMgr->GetCreatureTemplate(id)) { - sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredNpcOrGo%d` = %i but creature with entry %u does not exist, quest can't be done.", qinfo->GetQuestId(), j + 1, id, uint32(id)); qinfo->RequiredNpcOrGo[j] = 0; // quest can't be done for this requirement } @@ -4511,14 +4511,14 @@ void ObjectMgr::LoadQuests() if (!qinfo->RequiredNpcOrGoCount[j]) { - sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredNpcOrGo%d` = %u but `RequiredNpcOrGoCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j + 1, id, j + 1); // no changes, quest can be incorrectly done, but we already report this } } else if (qinfo->RequiredNpcOrGoCount[j] > 0) { - sLog->outErrorDb("Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.", + LOG_ERROR("sql.sql", "Quest %u has `RequiredNpcOrGo%d` = 0 but `RequiredNpcOrGoCount%d` = %u.", qinfo->GetQuestId(), j + 1, j + 1, qinfo->RequiredNpcOrGoCount[j]); // no changes, quest ignore this data } @@ -4531,21 +4531,21 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", + LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j + 1, id, id); qinfo->RewardChoiceItemId[j] = 0; // no changes, quest will not reward this } if (!qinfo->RewardChoiceItemCount[j]) { - sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.", + LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = %u but `RewardChoiceItemCount%d` = 0, quest can't be done.", qinfo->GetQuestId(), j + 1, id, j + 1); // no changes, quest can't be done } } else if (qinfo->RewardChoiceItemCount[j] > 0) { - sLog->outErrorDb("Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.", + LOG_ERROR("sql.sql", "Quest %u has `RewardChoiceItemId%d` = 0 but `RewardChoiceItemCount%d` = %u.", qinfo->GetQuestId(), j + 1, j + 1, qinfo->RewardChoiceItemCount[j]); // no changes, quest ignore this data } @@ -4558,21 +4558,21 @@ void ObjectMgr::LoadQuests() { if (!sObjectMgr->GetItemTemplate(id)) { - sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", + LOG_ERROR("sql.sql", "Quest %u has `RewardItemId%d` = %u but item with entry %u does not exist, quest will not reward this item.", qinfo->GetQuestId(), j + 1, id, id); qinfo->RewardItemId[j] = 0; // no changes, quest will not reward this item } if (!qinfo->RewardItemIdCount[j]) { - sLog->outErrorDb("Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.", + LOG_ERROR("sql.sql", "Quest %u has `RewardItemId%d` = %u but `RewardItemIdCount%d` = 0, quest will not reward this item.", qinfo->GetQuestId(), j + 1, id, j + 1); // no changes } } else if (qinfo->RewardItemIdCount[j] > 0) { - sLog->outErrorDb("Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.", + LOG_ERROR("sql.sql", "Quest %u has `RewardItemId%d` = 0 but `RewardItemIdCount%d` = %u.", qinfo->GetQuestId(), j + 1, j + 1, qinfo->RewardItemIdCount[j]); // no changes, quest ignore this data } @@ -4584,18 +4584,18 @@ void ObjectMgr::LoadQuests() { if (abs(qinfo->RewardFactionValueId[j]) > 9) { - sLog->outErrorDb("Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j + 1, qinfo->RewardFactionValueId[j]); + LOG_ERROR("sql.sql", "Quest %u has RewardFactionValueId%d = %i. That is outside the range of valid values (-9 to 9).", qinfo->GetQuestId(), j + 1, qinfo->RewardFactionValueId[j]); } if (!sFactionStore.LookupEntry(qinfo->RewardFactionId[j])) { - sLog->outErrorDb("Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j + 1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]); + LOG_ERROR("sql.sql", "Quest %u has `RewardFactionId%d` = %u but raw faction (faction.dbc) %u does not exist, quest will not reward reputation for this faction.", qinfo->GetQuestId(), j + 1, qinfo->RewardFactionId[j], qinfo->RewardFactionId[j]); qinfo->RewardFactionId[j] = 0; // quest will not reward this } } else if (qinfo->RewardFactionValueIdOverride[j] != 0) { - sLog->outErrorDb("Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.", + LOG_ERROR("sql.sql", "Quest %u has `RewardFactionId%d` = 0 but `RewardFactionValueIdOverride%d` = %i.", qinfo->GetQuestId(), j + 1, j + 1, qinfo->RewardFactionValueIdOverride[j]); // no changes, quest ignore this data } @@ -4607,21 +4607,21 @@ void ObjectMgr::LoadQuests() if (!spellInfo) { - sLog->outErrorDb("Quest %u has `RewardDisplaySpell` = %u but spell %u does not exist, spell removed as display reward.", + LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u does not exist, spell removed as display reward.", qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell); qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest } else if (!SpellMgr::ComputeIsSpellValid(spellInfo)) { - sLog->outErrorDb("Quest %u has `RewardDisplaySpell` = %u but spell %u is broken, quest will not have a spell reward.", + LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell); qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest } else if (GetTalentSpellCost(qinfo->RewardDisplaySpell)) { - sLog->outErrorDb("Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.", + LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardDisplaySpell, qinfo->RewardDisplaySpell); qinfo->RewardDisplaySpell = 0; // no spell reward will display for this quest } @@ -4633,21 +4633,21 @@ void ObjectMgr::LoadQuests() if (!spellInfo) { - sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u does not exist, quest will not have a spell reward.", + LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u does not exist, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell will be casted on player } else if (!SpellMgr::ComputeIsSpellValid(spellInfo)) { - sLog->outErrorDb("Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.", + LOG_ERROR("sql.sql", "Quest %u has `RewardSpell` = %u but spell %u is broken, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell will be casted on player } else if (GetTalentSpellCost(qinfo->RewardSpell)) { - sLog->outErrorDb("Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.", + LOG_ERROR("sql.sql", "Quest %u has `RewardDisplaySpell` = %u but spell %u is talent, quest will not have a spell reward.", qinfo->GetQuestId(), qinfo->RewardSpell, qinfo->RewardSpell); qinfo->RewardSpell = 0; // no spell will be casted on player } @@ -4657,7 +4657,7 @@ void ObjectMgr::LoadQuests() { if (!sMailTemplateStore.LookupEntry(qinfo->RewardMailTemplateId)) { - sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", + LOG_ERROR("sql.sql", "Quest %u has `RewardMailTemplateId` = %u but mail template %u does not exist, quest will not have a mail reward.", qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId); qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player @@ -4666,7 +4666,7 @@ void ObjectMgr::LoadQuests() else if (usedMailTemplates.find(qinfo->RewardMailTemplateId) != usedMailTemplates.end()) { std::map::const_iterator used_mt_itr = usedMailTemplates.find(qinfo->RewardMailTemplateId); - sLog->outErrorDb("Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.", + LOG_ERROR("sql.sql", "Quest %u has `RewardMailTemplateId` = %u but mail template %u already used for quest %u, quest will not have a mail reward.", qinfo->GetQuestId(), qinfo->RewardMailTemplateId, qinfo->RewardMailTemplateId, used_mt_itr->second); qinfo->RewardMailTemplateId = 0; // no mail will send to player qinfo->RewardMailDelay = 0; // no mail will send to player @@ -4681,7 +4681,7 @@ void ObjectMgr::LoadQuests() QuestMap::iterator qNextItr = _questTemplates.find(qinfo->RewardNextQuest); if (qNextItr == _questTemplates.end()) { - sLog->outErrorDb("Quest %u has `RewardNextQuest` = %u but quest %u does not exist, quest chain will not work.", + LOG_ERROR("sql.sql", "Quest %u has `RewardNextQuest` = %u but quest %u does not exist, quest chain will not work.", qinfo->GetQuestId(), qinfo->RewardNextQuest, qinfo->RewardNextQuest); qinfo->RewardNextQuest = 0; } @@ -4694,7 +4694,7 @@ void ObjectMgr::LoadQuests() { if (_questTemplates.find(abs(qinfo->GetPrevQuestId())) == _questTemplates.end()) { - sLog->outErrorDb("Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId()); + LOG_ERROR("sql.sql", "Quest %d has PrevQuestId %i, but no such quest", qinfo->GetQuestId(), qinfo->GetPrevQuestId()); } else { @@ -4707,7 +4707,7 @@ void ObjectMgr::LoadQuests() QuestMap::iterator qNextItr = _questTemplates.find(qinfo->GetNextQuestId()); if (qNextItr == _questTemplates.end()) { - sLog->outErrorDb("Quest %d has NextQuestId %u, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId()); + LOG_ERROR("sql.sql", "Quest %d has NextQuestId %u, but no such quest", qinfo->GetQuestId(), qinfo->GetNextQuestId()); } else qNextItr->second->prevQuests.push_back(static_cast(qinfo->GetQuestId())); @@ -4743,7 +4743,7 @@ void ObjectMgr::LoadQuests() if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) { - sLog->outErrorDb("Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have specialflag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id); + LOG_ERROR("sql.sql", "Spell (id: %u) have SPELL_EFFECT_QUEST_COMPLETE for quest %u, but quest not have specialflag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Quest flags must be fixed, quest modified to enable objective.", spellInfo->Id, quest_id); // this will prevent quest completing without objective // xinef: remove this, leave error but do not break the quest @@ -4752,8 +4752,8 @@ void ObjectMgr::LoadQuests() } } - sLog->outString(">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadQuestLocales() @@ -4790,7 +4790,7 @@ void ObjectMgr::LoadQuestLocales() AddLocaleString(fields[i + 7].GetString(), locale, data.ObjectiveText[i]); } while (result->NextRow()); - sLog->outString(">> Loaded %u Quest Locale strings in %u ms", (uint32)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u Quest Locale strings in %u ms", (uint32)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadScripts(ScriptsType type) @@ -4808,7 +4808,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use. return; - sLog->outString("Loading %s...", tableName.c_str()); + LOG_INFO("server", "Loading %s...", tableName.c_str()); scripts->clear(); // need for reload support @@ -4818,8 +4818,8 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (!result) { - sLog->outString(">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str()); + LOG_INFO("server", " "); return; } @@ -4850,13 +4850,13 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (tmp.Talk.ChatType > CHAT_TYPE_WHISPER && tmp.Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER) { - sLog->outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u", tableName.c_str(), tmp.Talk.ChatType, tmp.id); continue; } if (!tmp.Talk.TextID) { - sLog->outErrorDb("Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid talk text id (dataint = %i) in SCRIPT_COMMAND_TALK for script id %u", tableName.c_str(), tmp.Talk.TextID, tmp.id); continue; } @@ -4867,7 +4867,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sEmotesStore.LookupEntry(tmp.Emote.EmoteID)) { - sLog->outErrorDb("Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid emote id (datalong = %u) in SCRIPT_COMMAND_EMOTE for script id %u", tableName.c_str(), tmp.Emote.EmoteID, tmp.id); continue; } @@ -4878,14 +4878,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sMapStore.LookupEntry(tmp.TeleportTo.MapID)) { - sLog->outErrorDb("Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid map (Id: %u) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tableName.c_str(), tmp.TeleportTo.MapID, tmp.id); continue; } if (!acore::IsValidMapCoord(tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation)) { - sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TELEPORT_TO for script id %u", tableName.c_str(), tmp.TeleportTo.DestX, tmp.TeleportTo.DestY, tmp.TeleportTo.DestZ, tmp.TeleportTo.Orientation, tmp.id); continue; } @@ -4897,14 +4897,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) Quest const* quest = GetQuestTemplate(tmp.QuestExplored.QuestID); if (!quest) { - sLog->outErrorDb("Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); continue; } if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) { - sLog->outErrorDb("Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have specialflag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", + LOG_ERROR("sql.sql", "Table `%s` has quest (ID: %u) in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, but quest not have specialflag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT in quest flags. Script command or quest flags wrong. Quest modified to require objective.", tableName.c_str(), tmp.QuestExplored.QuestID, tmp.id); // this will prevent quest completing without objective @@ -4915,21 +4915,21 @@ void ObjectMgr::LoadScripts(ScriptsType type) if (float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE) { - sLog->outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u", tableName.c_str(), tmp.QuestExplored.Distance, tmp.id); continue; } if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) > DEFAULT_VISIBILITY_DISTANCE) { - sLog->outErrorDb("Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check", + LOG_ERROR("sql.sql", "Table `%s` has too large distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, max distance is %f or 0 for disable distance check", tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, DEFAULT_VISIBILITY_DISTANCE); continue; } if (tmp.QuestExplored.Distance && float(tmp.QuestExplored.Distance) < INTERACTION_DISTANCE) { - sLog->outErrorDb("Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check", + LOG_ERROR("sql.sql", "Table `%s` has too small distance (%u) for exploring objective complete in `datalong2` in SCRIPT_COMMAND_QUEST_EXPLORED in `datalong` for script id %u, min distance is %f or 0 for disable distance check", tableName.c_str(), tmp.QuestExplored.Distance, tmp.id, INTERACTION_DISTANCE); continue; } @@ -4941,7 +4941,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!GetCreatureTemplate(tmp.KillCredit.CreatureEntry)) { - sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_KILL_CREDIT for script id %u", tableName.c_str(), tmp.KillCredit.CreatureEntry, tmp.id); continue; } @@ -4953,7 +4953,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectData const* data = GetGOData(tmp.RespawnGameobject.GOGuid); if (!data) { - sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid gameobject (GUID: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tableName.c_str(), tmp.RespawnGameobject.GOGuid, tmp.id); continue; } @@ -4961,7 +4961,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectTemplate const* info = GetGameObjectTemplate(data->id); if (!info) { - sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tableName.c_str(), tmp.RespawnGameobject.GOGuid, data->id, tmp.id); continue; } @@ -4972,7 +4972,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) info->type == GAMEOBJECT_TYPE_BUTTON || info->type == GAMEOBJECT_TYPE_TRAP) { - sLog->outErrorDb("Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", + LOG_ERROR("sql.sql", "Table `%s` have gameobject type (%u) unsupported by command SCRIPT_COMMAND_RESPAWN_GAMEOBJECT for script id %u", tableName.c_str(), info->entry, tmp.id); continue; } @@ -4983,7 +4983,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!acore::IsValidMapCoord(tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation)) { - sLog->outErrorDb("Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid coordinates (X: %f Y: %f Z: %f O: %f) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tableName.c_str(), tmp.TempSummonCreature.PosX, tmp.TempSummonCreature.PosY, tmp.TempSummonCreature.PosZ, tmp.TempSummonCreature.Orientation, tmp.id); continue; } @@ -4991,7 +4991,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) uint32 entry = tmp.TempSummonCreature.CreatureEntry; if (!GetCreatureTemplate(entry)) { - sLog->outErrorDb("Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid creature (Entry: %u) in SCRIPT_COMMAND_TEMP_SUMMON_CREATURE for script id %u", tableName.c_str(), tmp.TempSummonCreature.CreatureEntry, tmp.id); continue; } @@ -5004,7 +5004,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectData const* data = GetGOData(tmp.ToggleDoor.GOGuid); if (!data) { - sLog->outErrorDb("Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has invalid gameobject (GUID: %u) in %s for script id %u", tableName.c_str(), tmp.ToggleDoor.GOGuid, GetScriptCommandName(tmp.command).c_str(), tmp.id); continue; } @@ -5012,14 +5012,14 @@ void ObjectMgr::LoadScripts(ScriptsType type) GameObjectTemplate const* info = GetGameObjectTemplate(data->id); if (!info) { - sLog->outErrorDb("Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has gameobject with invalid entry (GUID: %u Entry: %u) in %s for script id %u", tableName.c_str(), tmp.ToggleDoor.GOGuid, data->id, GetScriptCommandName(tmp.command).c_str(), tmp.id); continue; } if (info->type != GAMEOBJECT_TYPE_DOOR) { - sLog->outErrorDb("Table `%s` has gameobject type (%u) non supported by command %s for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has gameobject type (%u) non supported by command %s for script id %u", tableName.c_str(), info->entry, GetScriptCommandName(tmp.command).c_str(), tmp.id); continue; } @@ -5031,13 +5031,13 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID)) { - sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", + LOG_ERROR("sql.sql", "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id); continue; } if (tmp.RemoveAura.Flags & ~0x1) // 1 bits (0, 1) { - sLog->outErrorDb("Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", + LOG_ERROR("sql.sql", "Table `%s` using unknown flags in datalong2 (%u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u", tableName.c_str(), tmp.RemoveAura.Flags, tmp.id); continue; } @@ -5048,25 +5048,25 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID)) { - sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + LOG_ERROR("sql.sql", "Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.SpellID, tmp.id); continue; } if (tmp.CastSpell.Flags > 4) // targeting type { - sLog->outErrorDb("Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + LOG_ERROR("sql.sql", "Table `%s` using unknown target in datalong2 (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.Flags, tmp.id); continue; } if (tmp.CastSpell.Flags != 4 && tmp.CastSpell.CreatureEntry & ~0x1) // 1 bit (0, 1) { - sLog->outErrorDb("Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + LOG_ERROR("sql.sql", "Table `%s` using unknown flags in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); continue; } else if (tmp.CastSpell.Flags == 4 && !GetCreatureTemplate(tmp.CastSpell.CreatureEntry)) { - sLog->outErrorDb("Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", + LOG_ERROR("sql.sql", "Table `%s` using invalid creature entry in dataint (%u) in SCRIPT_COMMAND_CAST_SPELL for script id %u", tableName.c_str(), tmp.CastSpell.CreatureEntry, tmp.id); continue; } @@ -5077,13 +5077,13 @@ void ObjectMgr::LoadScripts(ScriptsType type) { if (!GetItemTemplate(tmp.CreateItem.ItemEntry)) { - sLog->outErrorDb("Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", + LOG_ERROR("sql.sql", "Table `%s` has nonexistent item (entry: %u) in SCRIPT_COMMAND_CREATE_ITEM for script id %u", tableName.c_str(), tmp.CreateItem.ItemEntry, tmp.id); continue; } if (!tmp.CreateItem.Amount) { - sLog->outErrorDb("Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u", + LOG_ERROR("sql.sql", "Table `%s` SCRIPT_COMMAND_CREATE_ITEM but amount is %u for script id %u", tableName.c_str(), tmp.CreateItem.Amount, tmp.id); continue; } @@ -5103,8 +5103,8 @@ void ObjectMgr::LoadScripts(ScriptsType type) ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadSpellScripts() @@ -5119,14 +5119,14 @@ void ObjectMgr::LoadSpellScripts() if (!spellInfo) { - sLog->outErrorDb("Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId); + LOG_ERROR("sql.sql", "Table `spell_scripts` has not existing spell (Id: %u) as script id", spellId); continue; } uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF); //check for correct spellEffect if (!spellInfo->Effects[i].Effect || (spellInfo->Effects[i].Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effects[i].Effect != SPELL_EFFECT_DUMMY)) - sLog->outErrorDb("Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i); + LOG_ERROR("sql.sql", "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i); } } @@ -5168,7 +5168,7 @@ void ObjectMgr::LoadEventScripts() { std::set::const_iterator itr2 = evt_scripts.find(itr->first); if (itr2 == evt_scripts.end()) - sLog->outErrorDb("Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u", + LOG_ERROR("sql.sql", "Table `event_scripts` has script (Id: %u) not referring to any gameobject_template type 10 data2 field, type 3 data6 field, type 13 data 2 field or any spell effect %u", itr->first, SPELL_EFFECT_SEND_EVENT); } } @@ -5198,7 +5198,7 @@ void ObjectMgr::LoadWaypointScripts() } for (std::set::iterator itr = actionSet.begin(); itr != actionSet.end(); ++itr) - sLog->outErrorDb("There is no waypoint which links to the waypoint script %u", *itr); + LOG_ERROR("sql.sql", "There is no waypoint which links to the waypoint script %u", *itr); } void ObjectMgr::LoadSpellScriptNames() @@ -5211,8 +5211,8 @@ void ObjectMgr::LoadSpellScriptNames() if (!result) { - sLog->outString(">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!"); + LOG_INFO("server", " "); return; } @@ -5235,7 +5235,7 @@ void ObjectMgr::LoadSpellScriptNames() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32()); + LOG_ERROR("sql.sql", "Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32()); continue; } @@ -5243,7 +5243,7 @@ void ObjectMgr::LoadSpellScriptNames() { if (sSpellMgr->GetFirstSpellInChain(spellId) != uint32(spellId)) { - sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32()); + LOG_ERROR("sql.sql", "Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32()); continue; } while (spellInfo) @@ -5257,8 +5257,8 @@ void ObjectMgr::LoadSpellScriptNames() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::ValidateSpellScripts() @@ -5267,8 +5267,8 @@ void ObjectMgr::ValidateSpellScripts() if (_spellScriptsStore.empty()) { - sLog->outString(">> Validated 0 scripts."); - sLog->outString(); + LOG_INFO("server", ">> Validated 0 scripts."); + LOG_INFO("server", " "); return; } @@ -5288,7 +5288,7 @@ void ObjectMgr::ValidateSpellScripts() bool valid = true; if (!spellScript && !auraScript) { - sLog->outError("TSCR: Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second).c_str()); + LOG_ERROR("server", "TSCR: Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second).c_str()); valid = false; } if (spellScript) @@ -5315,8 +5315,8 @@ void ObjectMgr::ValidateSpellScripts() ++count; } - sLog->outString(">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::InitializeSpellInfoPrecomputedData() @@ -5340,8 +5340,8 @@ void ObjectMgr::LoadPageTexts() if (!result) { - sLog->outString(">> Loaded 0 page texts. DB table `page_text` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 page texts. DB table `page_text` is empty!"); + LOG_INFO("server", " "); return; } @@ -5364,12 +5364,12 @@ void ObjectMgr::LoadPageTexts() { PageTextContainer::const_iterator itr2 = _pageTextStore.find(itr->second.NextPage); if (itr2 == _pageTextStore.end()) - sLog->outErrorDb("Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage); + LOG_ERROR("sql.sql", "Page text (Id: %u) has not existing next page (Id: %u)", itr->first, itr->second.NextPage); } } - sLog->outString(">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } PageText const* ObjectMgr::GetPageText(uint32 pageEntry) @@ -5407,7 +5407,7 @@ void ObjectMgr::LoadPageTextLocales() AddLocaleString(Text, locale, data.Text); } while (result->NextRow()); - sLog->outString(">> Loaded %u Page Text Locale strings in %u ms", (uint32)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u Page Text Locale strings in %u ms", (uint32)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadInstanceTemplate() @@ -5419,8 +5419,8 @@ void ObjectMgr::LoadInstanceTemplate() if (!result) { - sLog->outString(">> Loaded 0 instance templates. DB table `page_text` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 instance templates. DB table `page_text` is empty!"); + LOG_INFO("server", " "); return; } @@ -5433,7 +5433,7 @@ void ObjectMgr::LoadInstanceTemplate() if (!MapManager::IsValidMAP(mapID, true)) { - sLog->outErrorDb("ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID); + LOG_ERROR("sql.sql", "ObjectMgr::LoadInstanceTemplate: bad mapid %d for template!", mapID); continue; } @@ -5448,8 +5448,8 @@ void ObjectMgr::LoadInstanceTemplate() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID) @@ -5469,8 +5469,8 @@ void ObjectMgr::LoadInstanceEncounters() QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters"); if (!result) { - sLog->outErrorDb(">> Loaded 0 instance encounters, table is empty!"); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 instance encounters, table is empty!"); + LOG_INFO("server", " "); return; } @@ -5486,13 +5486,13 @@ void ObjectMgr::LoadInstanceEncounters() DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry); if (!dungeonEncounter) { - sLog->outErrorDb("Table `instance_encounters` has an invalid encounter id %u, skipped!", entry); + LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid encounter id %u, skipped!", entry); continue; } if (lastEncounterDungeon && !sLFGMgr->GetLFGDungeonEntry(lastEncounterDungeon)) { - sLog->outErrorDb("Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon); + LOG_ERROR("sql.sql", "Table `instance_encounters` has an encounter %u (%s) marked as final for invalid dungeon id %u, skipped!", entry, dungeonEncounter->encounterName[0], lastEncounterDungeon); continue; } @@ -5501,7 +5501,7 @@ void ObjectMgr::LoadInstanceEncounters() { if (itr != dungeonLastBosses.end()) { - sLog->outErrorDb("Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]); + LOG_ERROR("sql.sql", "Table `instance_encounters` specified encounter %u (%s) as last encounter but %u (%s) is already marked as one, skipped!", entry, dungeonEncounter->encounterName[0], itr->second->id, itr->second->encounterName[0]); continue; } @@ -5515,7 +5515,7 @@ void ObjectMgr::LoadInstanceEncounters() CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry); if (!creatureInfo) { - sLog->outErrorDb("Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); + LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid creature (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); continue; } const_cast(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS; @@ -5526,14 +5526,14 @@ void ObjectMgr::LoadInstanceEncounters() SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(creditEntry); if (!spellInfo) { - sLog->outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); + LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]); continue; } const_cast(spellInfo)->AttributesCu |= SPELL_ATTR0_CU_ENCOUNTER_REWARD; break; } default: - sLog->outErrorDb("Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]); + LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid credit type (%u) for encounter %u (%s), skipped!", creditType, entry, dungeonEncounter->encounterName[0]); continue; } @@ -5542,8 +5542,8 @@ void ObjectMgr::LoadInstanceEncounters() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const @@ -5571,8 +5571,8 @@ void ObjectMgr::LoadGossipText() if (!result) { - sLog->outErrorDb(">> Loaded 0 npc texts, table is empty!"); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 npc texts, table is empty!"); + LOG_INFO("server", " "); return; } @@ -5590,7 +5590,7 @@ void ObjectMgr::LoadGossipText() uint32 id = fields[cic++].GetUInt32(); if (!id) { - sLog->outErrorDb("Table `npc_text` has record wit reserved id 0, ignore."); + LOG_ERROR("sql.sql", "Table `npc_text` has record wit reserved id 0, ignore."); continue; } @@ -5617,7 +5617,7 @@ void ObjectMgr::LoadGossipText() { if (!sObjectMgr->GetBroadcastText(gText.Options[i].BroadcastTextID)) { - sLog->outErrorDb("GossipText (Id: %u) in table `npc_text` has non-existing or incompatible BroadcastTextID%u %u.", id, i, gText.Options[i].BroadcastTextID); + LOG_ERROR("sql.sql", "GossipText (Id: %u) in table `npc_text` has non-existing or incompatible BroadcastTextID%u %u.", id, i, gText.Options[i].BroadcastTextID); gText.Options[i].BroadcastTextID = 0; } } @@ -5626,8 +5626,8 @@ void ObjectMgr::LoadGossipText() count++; } while (result->NextRow()); - sLog->outString(">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadNpcTextLocales() @@ -5663,7 +5663,7 @@ void ObjectMgr::LoadNpcTextLocales() } } while (result->NextRow()); - sLog->outString(">> Loaded %u Npc Text Locale strings in %u ms", (uint32)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u Npc Text Locale strings in %u ms", (uint32)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) @@ -5786,8 +5786,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) ++deletedCount; } while (result->NextRow()); - sLog->outString(">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadQuestAreaTriggers() @@ -5800,8 +5800,8 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!result) { - sLog->outString(">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty."); + LOG_INFO("server", " "); return; } @@ -5819,7 +5819,7 @@ void ObjectMgr::LoadQuestAreaTriggers() AreaTrigger const* atEntry = GetAreaTrigger(trigger_ID); if (!atEntry) { - sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID); + LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", trigger_ID); continue; } @@ -5827,13 +5827,13 @@ void ObjectMgr::LoadQuestAreaTriggers() if (!quest) { - sLog->outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID); + LOG_ERROR("sql.sql", "Table `areatrigger_involvedrelation` has record (id: %u) for not existing quest %u", trigger_ID, quest_ID); continue; } if (!quest->HasSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT)) { - sLog->outErrorDb("Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have specialflag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID); + LOG_ERROR("sql.sql", "Table `areatrigger_involvedrelation` has record (id: %u) for not quest %u, but quest not have specialflag QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT. Trigger or quest flags must be fixed, quest modified to require objective.", trigger_ID, quest_ID); // this will prevent quest completing without objective const_cast(quest)->SetSpecialFlag(QUEST_SPECIAL_FLAGS_EXPLORATION_OR_EVENT); @@ -5844,8 +5844,8 @@ void ObjectMgr::LoadQuestAreaTriggers() _questAreaTriggerStore[trigger_ID] = quest_ID; } while (result->NextRow()); - sLog->outString(">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadQuestOfferRewardLocale() @@ -5874,7 +5874,7 @@ void ObjectMgr::LoadQuestOfferRewardLocale() AddLocaleString(fields[2].GetString(), locale, data.RewardText); } while (result->NextRow()); - sLog->outString(">> Loaded %lu Quest Offer Reward locale strings in %u ms", _questOfferRewardLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %lu Quest Offer Reward locale strings in %u ms", _questOfferRewardLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadQuestRequestItemsLocale() @@ -5903,7 +5903,7 @@ void ObjectMgr::LoadQuestRequestItemsLocale() AddLocaleString(fields[2].GetString(), locale, data.CompletionText); } while (result->NextRow()); - sLog->outString(">> Loaded %lu Quest Request Items locale strings in %u ms", _questRequestItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %lu Quest Request Items locale strings in %u ms", _questRequestItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadTavernAreaTriggers() @@ -5916,8 +5916,8 @@ void ObjectMgr::LoadTavernAreaTriggers() if (!result) { - sLog->outString(">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty."); + LOG_INFO("server", " "); return; } @@ -5934,15 +5934,15 @@ void ObjectMgr::LoadTavernAreaTriggers() AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID); if (!atEntry) { - sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); + LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); continue; } _tavernAreaTriggerStore.insert(Trigger_ID); } while (result->NextRow()); - sLog->outString(">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadAreaTriggerScripts() @@ -5954,8 +5954,8 @@ void ObjectMgr::LoadAreaTriggerScripts() if (!result) { - sLog->outString(">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty."); + LOG_INFO("server", " "); return; } @@ -5973,14 +5973,14 @@ void ObjectMgr::LoadAreaTriggerScripts() AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID); if (!atEntry) { - sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); + LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); continue; } _areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName); } while (result->NextRow()); - sLog->outString(">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 teamId) @@ -6075,7 +6075,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, TeamId teamId, bool allowed_a mount_id = mount_info->GetRandomValidModelId(); if (!mount_id) { - sLog->outErrorDb("No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry); + LOG_ERROR("sql.sql", "No displayid found for the taxi mount with the entry %u! Can't load it!", mount_entry); return 0; } } @@ -6097,8 +6097,8 @@ void ObjectMgr::LoadAreaTriggers() if (!result) { - sLog->outString(">> Loaded 0 area trigger definitions. DB table `areatrigger` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 area trigger definitions. DB table `areatrigger` is empty."); + LOG_INFO("server", " "); return; } @@ -6126,15 +6126,15 @@ void ObjectMgr::LoadAreaTriggers() MapEntry const* mapEntry = sMapStore.LookupEntry(at.map); if (!mapEntry) { - sLog->outErrorDb("Area trigger (ID:%u) map (ID: %u) does not exist in `Map.dbc`.", at.entry, at.map); + LOG_ERROR("sql.sql", "Area trigger (ID:%u) map (ID: %u) does not exist in `Map.dbc`.", at.entry, at.map); continue; } _areaTriggerStore[at.entry] = at; } while (result->NextRow()); - sLog->outString(">> Loaded %u area trigger definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u area trigger definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadAreaTriggerTeleports() @@ -6148,8 +6148,8 @@ void ObjectMgr::LoadAreaTriggerTeleports() if (!result) { - sLog->outString(">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty."); + LOG_INFO("server", " "); return; } @@ -6174,28 +6174,28 @@ void ObjectMgr::LoadAreaTriggerTeleports() AreaTrigger const* atEntry = GetAreaTrigger(Trigger_ID); if (!atEntry) { - sLog->outErrorDb("Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); + LOG_ERROR("sql.sql", "Area trigger (ID:%u) does not exist in `AreaTrigger.dbc`.", Trigger_ID); continue; } MapEntry const* mapEntry = sMapStore.LookupEntry(at.target_mapId); if (!mapEntry) { - sLog->outErrorDb("Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId); + LOG_ERROR("sql.sql", "Area trigger (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Trigger_ID, at.target_mapId); continue; } if (at.target_X == 0 && at.target_Y == 0 && at.target_Z == 0) { - sLog->outErrorDb("Area trigger (ID:%u) target coordinates not provided.", Trigger_ID); + LOG_ERROR("sql.sql", "Area trigger (ID:%u) target coordinates not provided.", Trigger_ID); continue; } _areaTriggerTeleportStore[Trigger_ID] = at; } while (result->NextRow()); - sLog->outString(">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadAccessRequirements() @@ -6234,8 +6234,8 @@ void ObjectMgr::LoadAccessRequirements() QueryResult access_template_result = WorldDatabase.Query("SELECT id, map_id, difficulty, min_level, max_level, min_avg_item_level FROM dungeon_access_template"); if (!access_template_result) { - sLog->outString(">> Loaded 0 access requirement definitions. DB table `dungeon_access_template` is empty."); - sLog->outString(); + LOG_INFO("server.loading", ">> Loaded 0 access requirement definitions. DB table `dungeon_access_template` is empty."); + LOG_INFO("server.loading", " "); return; } @@ -6288,7 +6288,7 @@ void ObjectMgr::LoadAccessRequirements() //Achievement if (!sAchievementStore.LookupEntry(progression_requirement->id)) { - sLog->outErrorDb("Required achievement %u for faction %u does not exist for map %u difficulty %u, remove or fix this achievement requirement.", progression_requirement->id, requirement_faction, mapid, difficulty); + LOG_ERROR("sql.sql", "Required achievement %u for faction %u does not exist for map %u difficulty %u, remove or fix this achievement requirement.", progression_requirement->id, requirement_faction, mapid, difficulty); break; } @@ -6300,7 +6300,7 @@ void ObjectMgr::LoadAccessRequirements() //Quest if (!GetQuestTemplate(progression_requirement->id)) { - sLog->outErrorDb("Required quest %u for faction %u does not exist for map %u difficulty %u, remove or fix this quest requirement.", progression_requirement->id, requirement_faction, mapid, difficulty); + LOG_ERROR("sql.sql", "Required quest %u for faction %u does not exist for map %u difficulty %u, remove or fix this quest requirement.", progression_requirement->id, requirement_faction, mapid, difficulty); break; } @@ -6313,7 +6313,7 @@ void ObjectMgr::LoadAccessRequirements() ItemTemplate const* pProto = GetItemTemplate(progression_requirement->id); if (!pProto) { - sLog->outError("Required item %u for faction %u does not exist for map %u difficulty %u, remove or fix this item requirement.", progression_requirement->id, requirement_faction, mapid, difficulty); + LOG_ERROR("server", "Required item %u for faction %u does not exist for map %u difficulty %u, remove or fix this item requirement.", progression_requirement->id, requirement_faction, mapid, difficulty); break; } @@ -6321,7 +6321,7 @@ void ObjectMgr::LoadAccessRequirements() break; } default: - sLog->outError("requirement_type of %u is not valid for map %u difficulty %u. Please use 0 for achievements, 1 for quest, 2 for items or remove this entry from the db.", requirement_type, mapid, difficulty); + LOG_ERROR("server", "requirement_type of %u is not valid for map %u difficulty %u. Please use 0 for achievements, 1 for quest, 2 for items or remove this entry from the db.", requirement_type, mapid, difficulty); break; } @@ -6359,8 +6359,8 @@ void ObjectMgr::LoadAccessRequirements() _accessRequirementStore[mapid][difficulty] = ar; } while (access_template_result->NextRow()); - sLog->outString(">> Loaded %u rows from dungeon_access_template and %u rows from dungeon_access_requirements in %u ms", count, countProgressionRequirements, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server.loading", ">> Loaded %u rows from dungeon_access_template and %u rows from dungeon_access_requirements in %u ms", count, countProgressionRequirements, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server.loading", " "); } /* @@ -6485,7 +6485,7 @@ uint32 ObjectMgr::GenerateAuctionID() { if (_auctionId >= 0xFFFFFFFE) { - sLog->outError("Auctions ids overflow!! Can't continue, shutting down server. "); + LOG_ERROR("server", "Auctions ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return _auctionId++; @@ -6495,7 +6495,7 @@ uint64 ObjectMgr::GenerateEquipmentSetGuid() { if (_equipmentSetGuid >= uint64(0xFFFFFFFFFFFFFFFELL)) { - sLog->outError("EquipmentSet guid overflow!! Can't continue, shutting down server. "); + LOG_ERROR("server", "EquipmentSet guid overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } return _equipmentSetGuid++; @@ -6505,10 +6505,10 @@ uint32 ObjectMgr::GenerateMailID() { if (_mailId >= 0xFFFFFFFE) { - sLog->outError("Mail ids overflow!! Can't continue, shutting down server. "); + LOG_ERROR("server", "Mail ids overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } - ACORE_GUARD(ACE_Thread_Mutex, _mailIdMutex); + std::lock_guard guard(_mailIdMutex); return _mailId++; } @@ -6519,25 +6519,25 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) case HIGHGUID_ITEM: { ASSERT(_hiItemGuid < 0xFFFFFFFE && "Item guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiItemGuidMutex); + std::lock_guard guard(_hiItemGuidMutex); return _hiItemGuid++; } case HIGHGUID_UNIT: { ASSERT(_hiCreatureGuid < 0x00FFFFFE && "Creature guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiCreatureGuidMutex); + std::lock_guard guard(_hiCreatureGuidMutex); return _hiCreatureGuid++; } case HIGHGUID_PET: { ASSERT(_hiPetGuid < 0x00FFFFFE && "Pet guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiPetGuidMutex); + std::lock_guard guard(_hiPetGuidMutex); return _hiPetGuid++; } case HIGHGUID_VEHICLE: { ASSERT(_hiVehicleGuid < 0x00FFFFFF && "Vehicle guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiVehicleGuidMutex); + std::lock_guard guard(_hiVehicleGuidMutex); return _hiVehicleGuid++; } case HIGHGUID_PLAYER: @@ -6548,25 +6548,25 @@ uint32 ObjectMgr::GenerateLowGuid(HighGuid guidhigh) case HIGHGUID_GAMEOBJECT: { ASSERT(_hiGoGuid < 0x00FFFFFE && "Gameobject guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiGoGuidMutex); + std::lock_guard guard(_hiGoGuidMutex); return _hiGoGuid++; } case HIGHGUID_CORPSE: { ASSERT(_hiCorpseGuid < 0xFFFFFFFE && "Corpse guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiCorpseGuidMutex); + std::lock_guard guard(_hiCorpseGuidMutex); return _hiCorpseGuid++; } case HIGHGUID_DYNAMICOBJECT: { ASSERT(_hiDoGuid < 0xFFFFFFFE && "DynamicObject guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiDoGuidMutex); + std::lock_guard guard(_hiDoGuidMutex); return _hiDoGuid++; } case HIGHGUID_MO_TRANSPORT: { ASSERT(_hiMoTransGuid < 0xFFFFFFFE && "MO Transport guid overflow!"); - ACORE_GUARD(ACE_Thread_Mutex, _hiMoTransGuidMutex); + std::lock_guard guard(_hiMoTransGuidMutex); return _hiMoTransGuid++; } default: @@ -6629,7 +6629,7 @@ void ObjectMgr::LoadGameObjectLocales() AddLocaleString(CastBarCaption, locale, data.CastBarCaption); } while (result->NextRow()); - sLog->outString(">> Loaded %u Gameobject Locale strings in %u ms", (uint32)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u Gameobject Locale strings in %u ms", (uint32)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime)); } inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6637,7 +6637,7 @@ inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 if (sLockStore.LookupEntry(dataN)) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.", + LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but lock (Id: %u) not found.", goInfo->entry, goInfo->type, N, goInfo->door.lockId, goInfo->door.lockId); } @@ -6646,7 +6646,7 @@ inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo, uint32 dataN, if (GameObjectTemplate const* trapInfo = sObjectMgr->GetGameObjectTemplate(dataN)) { if (trapInfo->type != GAMEOBJECT_TYPE_TRAP) - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", + LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but GO (Entry %u) have not GAMEOBJECT_TYPE_TRAP (%u) type.", goInfo->entry, goInfo->type, N, dataN, dataN, GAMEOBJECT_TYPE_TRAP); } } @@ -6656,7 +6656,7 @@ inline void CheckGOSpellId(GameObjectTemplate const* goInfo, uint32 dataN, uint3 if (sSpellMgr->GetSpellInfo(dataN)) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.", + LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.", goInfo->entry, goInfo->type, N, dataN, dataN); } @@ -6665,7 +6665,7 @@ inline void CheckAndFixGOChairHeightId(GameObjectTemplate const* goInfo, uint32 if (dataN <= (UNIT_STAND_STATE_SIT_HIGH_CHAIR - UNIT_STAND_STATE_SIT_LOW_CHAIR)) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.", + LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but correct chair height in range 0..%i.", goInfo->entry, goInfo->type, N, dataN, UNIT_STAND_STATE_SIT_HIGH_CHAIR - UNIT_STAND_STATE_SIT_LOW_CHAIR); // prevent client and server unexpected work @@ -6678,7 +6678,7 @@ inline void CheckGONoDamageImmuneId(GameObjectTemplate* goTemplate, uint32 dataN if (dataN <= 1) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN); + LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) noDamageImmune field value.", goTemplate->entry, goTemplate->type, N, dataN); } inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) @@ -6687,7 +6687,7 @@ inline void CheckGOConsumable(GameObjectTemplate const* goInfo, uint32 dataN, ui if (dataN <= 1) return; - sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.", + LOG_ERROR("sql.sql", "Gameobject (Entry: %u GoType: %u) have data%d=%u but expected boolean (0/1) consumable field value.", goInfo->entry, goInfo->type, N, dataN); } @@ -6705,8 +6705,8 @@ void ObjectMgr::LoadGameObjectTemplate() if (!result) { - sLog->outString(">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty."); + LOG_INFO("server", " "); return; } @@ -6786,7 +6786,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (got.spellFocus.focusId) { if (!sSpellFocusObjectStore.LookupEntry(got.spellFocus.focusId)) - sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", + LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data0=%u but SpellFocus (Id: %u) not exist.", entry, got.type, got.spellFocus.focusId, got.spellFocus.focusId); } @@ -6804,7 +6804,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (got.goober.pageId) // pageId { if (!GetPageText(got.goober.pageId)) - sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.", + LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data7=%u but PageText (Entry %u) not exist.", entry, got.type, got.goober.pageId, got.goober.pageId); } CheckGONoDamageImmuneId(&got, got.goober.noDamageImmune, 11); @@ -6829,7 +6829,7 @@ void ObjectMgr::LoadGameObjectTemplate() if (got.moTransport.taxiPathId) { if (got.moTransport.taxiPathId >= sTaxiPathNodesByPath.size() || sTaxiPathNodesByPath[got.moTransport.taxiPathId].empty()) - sLog->outErrorDb("GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.", + LOG_ERROR("sql.sql", "GameObject (Entry: %u GoType: %u) have data0=%u but TaxiPath (Id: %u) not exist.", entry, got.type, got.moTransport.taxiPathId, got.moTransport.taxiPathId); } if (uint32 transportMap = got.moTransport.mapID) @@ -6872,8 +6872,8 @@ void ObjectMgr::LoadGameObjectTemplate() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadGameObjectTemplateAddons() @@ -6885,8 +6885,8 @@ void ObjectMgr::LoadGameObjectTemplateAddons() if (!result) { - sLog->outString(">> Loaded 0 gameobject template addon definitions. DB table `gameobject_template_addon` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 gameobject template addon definitions. DB table `gameobject_template_addon` is empty."); + LOG_INFO("server", " "); return; } @@ -6900,7 +6900,7 @@ void ObjectMgr::LoadGameObjectTemplateAddons() GameObjectTemplate const* got = sObjectMgr->GetGameObjectTemplate(entry); if (!got) { - sLog->outErrorDb( + LOG_ERROR("sql.sql", "GameObject template (Entry: %u) does not exist but has a record in `gameobject_template_addon`", entry); continue; @@ -6914,7 +6914,7 @@ void ObjectMgr::LoadGameObjectTemplateAddons() // checks if (gameObjectAddon.faction && !sFactionTemplateStore.LookupEntry(gameObjectAddon.faction)) - sLog->outErrorDb( + LOG_ERROR("sql.sql", "GameObject (Entry: %u) has invalid faction (%u) defined in `gameobject_template_addon`.", entry, gameObjectAddon.faction); @@ -6926,7 +6926,7 @@ void ObjectMgr::LoadGameObjectTemplateAddons() case GAMEOBJECT_TYPE_FISHINGHOLE: break; default: - sLog->outErrorDb( + LOG_ERROR("sql.sql", "GameObject (Entry %u GoType: %u) cannot be looted but has maxgold set in `gameobject_template_addon`.", entry, got->type); break; @@ -6936,8 +6936,8 @@ void ObjectMgr::LoadGameObjectTemplateAddons() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u game object template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u game object template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadExplorationBaseXP() @@ -6948,8 +6948,8 @@ void ObjectMgr::LoadExplorationBaseXP() if (!result) { - sLog->outErrorDb(">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 BaseXP definitions. DB table `exploration_basexp` is empty."); + LOG_INFO("server", " "); return; } @@ -6964,8 +6964,8 @@ void ObjectMgr::LoadExplorationBaseXP() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } uint32 ObjectMgr::GetBaseXP(uint8 level) @@ -6988,8 +6988,8 @@ void ObjectMgr::LoadPetNames() if (!result) { - sLog->outString(">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!"); + LOG_INFO("server", " "); return; } @@ -7008,8 +7008,8 @@ void ObjectMgr::LoadPetNames() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadPetNumber() @@ -7023,8 +7023,8 @@ void ObjectMgr::LoadPetNumber() _hiPetNumber = fields[0].GetUInt32() + 1; } - sLog->outString(">> Loaded the max pet number: %d in %u ms", _hiPetNumber - 1, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded the max pet number: %d in %u ms", _hiPetNumber - 1, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } std::string ObjectMgr::GeneratePetName(uint32 entry) @@ -7047,7 +7047,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry) uint32 ObjectMgr::GeneratePetNumber() { - ACORE_GUARD(ACE_Thread_Mutex, _hiPetNumberMutex); + std::lock_guard guard(_hiPetNumberMutex); return ++_hiPetNumber; } @@ -7058,8 +7058,8 @@ void ObjectMgr::LoadCorpses() PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES)); if (!result) { - sLog->outString(">> Loaded 0 corpses. DB table `corpse` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 corpses. DB table `corpse` is empty."); + LOG_INFO("server", " "); return; } @@ -7071,7 +7071,7 @@ void ObjectMgr::LoadCorpses() CorpseType type = CorpseType(fields[13].GetUInt8()); if (type >= MAX_CORPSE_TYPE) { - sLog->outError("Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type); + LOG_ERROR("server", "Corpse (guid: %u) have wrong corpse type (%u), not loading.", guid, type); continue; } @@ -7086,8 +7086,8 @@ void ObjectMgr::LoadCorpses() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadReputationRewardRate() @@ -7100,7 +7100,7 @@ void ObjectMgr::LoadReputationRewardRate() QueryResult result = WorldDatabase.Query("SELECT faction, quest_rate, quest_daily_rate, quest_weekly_rate, quest_monthly_rate, quest_repeatable_rate, creature_rate, spell_rate FROM reputation_reward_rate"); if (!result) { - sLog->outError(">> Loaded `reputation_reward_rate`, table is empty!"); + LOG_ERROR("server", ">> Loaded `reputation_reward_rate`, table is empty!"); return; } @@ -7123,49 +7123,49 @@ void ObjectMgr::LoadReputationRewardRate() FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) { - sLog->outError("Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId); + LOG_ERROR("server", "Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId); continue; } if (repRate.questRate < 0.0f) { - sLog->outError("Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.questRate, factionId); + LOG_ERROR("server", "Table reputation_reward_rate has quest_rate with invalid rate %f, skipping data for faction %u", repRate.questRate, factionId); continue; } if (repRate.questDailyRate < 0.0f) { - sLog->outError("Table reputation_reward_rate has quest_daily_rate with invalid rate %f, skipping data for faction %u", repRate.questDailyRate, factionId); + LOG_ERROR("server", "Table reputation_reward_rate has quest_daily_rate with invalid rate %f, skipping data for faction %u", repRate.questDailyRate, factionId); continue; } if (repRate.questWeeklyRate < 0.0f) { - sLog->outError("Table reputation_reward_rate has quest_weekly_rate with invalid rate %f, skipping data for faction %u", repRate.questWeeklyRate, factionId); + LOG_ERROR("server", "Table reputation_reward_rate has quest_weekly_rate with invalid rate %f, skipping data for faction %u", repRate.questWeeklyRate, factionId); continue; } if (repRate.questMonthlyRate < 0.0f) { - sLog->outError("Table reputation_reward_rate has quest_monthly_rate with invalid rate %f, skipping data for faction %u", repRate.questMonthlyRate, factionId); + LOG_ERROR("server", "Table reputation_reward_rate has quest_monthly_rate with invalid rate %f, skipping data for faction %u", repRate.questMonthlyRate, factionId); continue; } if (repRate.questRepeatableRate < 0.0f) { - sLog->outError("Table reputation_reward_rate has quest_repeatable_rate with invalid rate %f, skipping data for faction %u", repRate.questRepeatableRate, factionId); + LOG_ERROR("server", "Table reputation_reward_rate has quest_repeatable_rate with invalid rate %f, skipping data for faction %u", repRate.questRepeatableRate, factionId); continue; } if (repRate.creatureRate < 0.0f) { - sLog->outError("Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creatureRate, factionId); + LOG_ERROR("server", "Table reputation_reward_rate has creature_rate with invalid rate %f, skipping data for faction %u", repRate.creatureRate, factionId); continue; } if (repRate.spellRate < 0.0f) { - sLog->outError("Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spellRate, factionId); + LOG_ERROR("server", "Table reputation_reward_rate has spell_rate with invalid rate %f, skipping data for faction %u", repRate.spellRate, factionId); continue; } @@ -7174,8 +7174,8 @@ void ObjectMgr::LoadReputationRewardRate() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadReputationOnKill() @@ -7195,8 +7195,8 @@ void ObjectMgr::LoadReputationOnKill() if (!result) { - sLog->outErrorDb(">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 creature award reputation definitions. DB table `creature_onkill_reputation` is empty."); + LOG_INFO("server", " "); return; } @@ -7219,7 +7219,7 @@ void ObjectMgr::LoadReputationOnKill() if (!GetCreatureTemplate(creature_id)) { - sLog->outErrorDb("Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id); + LOG_ERROR("sql.sql", "Table `creature_onkill_reputation` have data for not existed creature entry (%u), skipped", creature_id); continue; } @@ -7228,7 +7228,7 @@ void ObjectMgr::LoadReputationOnKill() FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.RepFaction1); if (!factionEntry1) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1); + LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction1); continue; } } @@ -7238,7 +7238,7 @@ void ObjectMgr::LoadReputationOnKill() FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.RepFaction2); if (!factionEntry2) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2); + LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.RepFaction2); continue; } } @@ -7248,8 +7248,8 @@ void ObjectMgr::LoadReputationOnKill() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadReputationSpilloverTemplate() @@ -7263,8 +7263,8 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!result) { - sLog->outString(">> Loaded `reputation_spillover_template`, table is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded `reputation_spillover_template`, table is empty."); + LOG_INFO("server", " "); return; } @@ -7293,13 +7293,13 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!factionEntry) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId); + LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", factionId); continue; } if (factionEntry->team == 0) { - sLog->outErrorDb("Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId); + LOG_ERROR("sql.sql", "Faction (faction.dbc) %u in `reputation_spillover_template` does not belong to any team, skipping", factionId); continue; } @@ -7311,19 +7311,19 @@ void ObjectMgr::LoadReputationSpilloverTemplate() if (!factionSpillover) { - sLog->outErrorDb("Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId); + LOG_ERROR("sql.sql", "Spillover faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template` for faction %u, skipping", repTemplate.faction[i], factionId); continue; } if (factionSpillover->reputationListID < 0) { - sLog->outErrorDb("Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId); + LOG_ERROR("sql.sql", "Spillover faction (faction.dbc) %u for faction %u in `reputation_spillover_template` can not be listed for client, and then useless, skipping", repTemplate.faction[i], factionId); continue; } if (repTemplate.faction_rank[i] >= MAX_REPUTATION_RANK) { - sLog->outErrorDb("Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]); + LOG_ERROR("sql.sql", "Rank %u used in `reputation_spillover_template` for spillover faction %u is not valid, skipping", repTemplate.faction_rank[i], repTemplate.faction[i]); continue; } } @@ -7332,25 +7332,25 @@ void ObjectMgr::LoadReputationSpilloverTemplate() FactionEntry const* factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]); if (repTemplate.faction[0] && !factionEntry0) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]); + LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]); continue; } FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]); if (repTemplate.faction[1] && !factionEntry1) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]); + LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]); continue; } FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]); if (repTemplate.faction[2] && !factionEntry2) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]); + LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]); continue; } FactionEntry const* factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]); if (repTemplate.faction[3] && !factionEntry3) { - sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]); + LOG_ERROR("sql.sql", "Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]); continue; } @@ -7359,8 +7359,8 @@ void ObjectMgr::LoadReputationSpilloverTemplate() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadPointsOfInterest() @@ -7376,8 +7376,8 @@ void ObjectMgr::LoadPointsOfInterest() if (!result) { - sLog->outErrorDb(">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 Points of Interest definitions. DB table `points_of_interest` is empty."); + LOG_INFO("server", " "); return; } @@ -7398,7 +7398,7 @@ void ObjectMgr::LoadPointsOfInterest() if (!acore::IsValidMapCoord(POI.PositionX, POI.PositionY)) { - sLog->outErrorDb("Table `points_of_interest` (ID: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.PositionX, POI.PositionY); + LOG_ERROR("sql.sql", "Table `points_of_interest` (ID: %u) have invalid coordinates (X: %f Y: %f), ignored.", point_id, POI.PositionX, POI.PositionY); continue; } @@ -7407,8 +7407,8 @@ void ObjectMgr::LoadPointsOfInterest() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadQuestPOI() @@ -7424,8 +7424,8 @@ void ObjectMgr::LoadQuestPOI() if (!result) { - sLog->outErrorDb(">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 quest POI definitions. DB table `quest_poi` is empty."); + LOG_INFO("server", " "); return; } @@ -7478,13 +7478,13 @@ void ObjectMgr::LoadQuestPOI() _questPOIStore[questId].push_back(POI); } else - sLog->outError("Table quest_poi references unknown quest points for quest %u POI id %u", questId, id); + LOG_ERROR("server", "Table quest_poi references unknown quest points for quest %u POI id %u", questId, id); ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadNPCSpellClickSpells() @@ -7497,8 +7497,8 @@ void ObjectMgr::LoadNPCSpellClickSpells() if (!result) { - sLog->outErrorDb(">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty."); + LOG_INFO("server", " "); return; } @@ -7512,7 +7512,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() CreatureTemplate const* cInfo = GetCreatureTemplate(npc_entry); if (!cInfo) { - sLog->outErrorDb("Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry); + LOG_ERROR("sql.sql", "Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry); continue; } @@ -7520,13 +7520,13 @@ void ObjectMgr::LoadNPCSpellClickSpells() SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spellid); if (!spellinfo) { - sLog->outErrorDb("Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid); + LOG_ERROR("sql.sql", "Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid); continue; } uint8 userType = fields[3].GetUInt16(); if (userType >= SPELL_CLICK_USER_MAX) - sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType)); + LOG_ERROR("sql.sql", "Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType)); uint8 castFlags = fields[2].GetUInt8(); SpellClickInfo info; @@ -7545,13 +7545,13 @@ void ObjectMgr::LoadNPCSpellClickSpells() { if ((itr->second.npcflag & UNIT_NPC_FLAG_SPELLCLICK) && _spellClickInfoStore.find(itr->second.Entry) == _spellClickInfoStore.end()) { - sLog->outErrorDb("npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry); + LOG_ERROR("sql.sql", "npc_spellclick_spells: Creature template %u has UNIT_NPC_FLAG_SPELLCLICK but no data in spellclick table! Removing flag", itr->second.Entry); const_cast(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_SPELLCLICK; } } - sLog->outString(">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::DeleteCreatureData(uint32 guid) @@ -7600,8 +7600,8 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& if (!result) { - sLog->outErrorDb(">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str()); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str()); + LOG_INFO("server", " "); return; } @@ -7617,7 +7617,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& if (_questTemplates.find(quest) == _questTemplates.end()) { - sLog->outErrorDb("Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id); + LOG_ERROR("sql.sql", "Table `%s`: Quest %u listed for entry %u does not exist.", table.c_str(), quest, id); continue; } @@ -7629,8 +7629,8 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadGameobjectQuestStarters() @@ -7641,9 +7641,9 @@ void ObjectMgr::LoadGameobjectQuestStarters() { GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first); if (!goInfo) - sLog->outErrorDb("Table `gameobject_queststarter` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); + LOG_ERROR("sql.sql", "Table `gameobject_queststarter` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER) - sLog->outErrorDb("Table `gameobject_queststarter` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); + LOG_ERROR("sql.sql", "Table `gameobject_queststarter` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); } } @@ -7655,9 +7655,9 @@ void ObjectMgr::LoadGameobjectQuestEnders() { GameObjectTemplate const* goInfo = GetGameObjectTemplate(itr->first); if (!goInfo) - sLog->outErrorDb("Table `gameobject_questender` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); + LOG_ERROR("sql.sql", "Table `gameobject_questender` have data for not existed gameobject entry (%u) and existed quest %u", itr->first, itr->second); else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER) - sLog->outErrorDb("Table `gameobject_questender` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); + LOG_ERROR("sql.sql", "Table `gameobject_questender` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); } } @@ -7669,9 +7669,9 @@ void ObjectMgr::LoadCreatureQuestStarters() { CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first); if (!cInfo) - sLog->outErrorDb("Table `creature_queststarter` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); + LOG_ERROR("sql.sql", "Table `creature_queststarter` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER)) - sLog->outErrorDb("Table `creature_queststarter` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); + LOG_ERROR("sql.sql", "Table `creature_queststarter` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); } } @@ -7683,9 +7683,9 @@ void ObjectMgr::LoadCreatureQuestEnders() { CreatureTemplate const* cInfo = GetCreatureTemplate(itr->first); if (!cInfo) - sLog->outErrorDb("Table `creature_questender` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); + LOG_ERROR("sql.sql", "Table `creature_questender` have data for not existed creature entry (%u) and existed quest %u", itr->first, itr->second); else if (!(cInfo->npcflag & UNIT_NPC_FLAG_QUESTGIVER)) - sLog->outErrorDb("Table `creature_questender` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); + LOG_ERROR("sql.sql", "Table `creature_questender` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); } } @@ -7699,8 +7699,8 @@ void ObjectMgr::LoadReservedPlayersNames() if (!result) { - sLog->outString(">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!"); + LOG_INFO("server", " "); return; } @@ -7715,7 +7715,7 @@ void ObjectMgr::LoadReservedPlayersNames() std::wstring wstr; if (!Utf8toWStr (name, wstr)) { - sLog->outError("Table `reserved_name` have invalid name: %s", name.c_str()); + LOG_ERROR("server", "Table `reserved_name` have invalid name: %s", name.c_str()); continue; } @@ -7725,8 +7725,8 @@ void ObjectMgr::LoadReservedPlayersNames() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } bool ObjectMgr::IsReservedName(const std::string& name) const @@ -7900,8 +7900,8 @@ void ObjectMgr::LoadGameObjectForQuests() if (sObjectMgr->GetGameObjectTemplates()->empty()) { - sLog->outString(">> Loaded 0 GameObjects for quests"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 GameObjects for quests"); + LOG_INFO("server", " "); return; } @@ -7963,8 +7963,8 @@ void ObjectMgr::LoadGameObjectForQuests() } } - sLog->outString(">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } bool ObjectMgr::LoadAcoreStrings() @@ -7975,8 +7975,8 @@ bool ObjectMgr::LoadAcoreStrings() QueryResult result = WorldDatabase.PQuery("SELECT entry, content_default, locale_koKR, locale_frFR, locale_deDE, locale_zhCN, locale_zhTW, locale_esES, locale_esMX, locale_ruRU FROM acore_string"); if (!result) { - sLog->outString(">> Loaded 0 acore strings. DB table `acore_strings` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 acore strings. DB table `acore_strings` is empty."); + LOG_INFO("server", " "); return false; } @@ -7994,8 +7994,8 @@ bool ObjectMgr::LoadAcoreStrings() AddLocaleString(fields[i + 1].GetString(), LocaleConstant(i), data.Content); } while (result->NextRow()); - sLog->outString(">> Loaded %u acore strings in %u ms", (uint32)_acoreStringStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u acore strings in %u ms", (uint32)_acoreStringStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); return true; } @@ -8010,7 +8010,7 @@ char const* ObjectMgr::GetAcoreString(uint32 entry, LocaleConstant locale) const return ts->Content[DEFAULT_LOCALE].c_str(); } - sLog->outErrorDb("Acore string entry %u not found in DB.", entry); + LOG_ERROR("sql.sql", "Acore string entry %u not found in DB.", entry); return ""; } @@ -8025,8 +8025,8 @@ void ObjectMgr::LoadFishingBaseSkillLevel() if (!result) { - sLog->outErrorDb(">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 areas for fishing base skill level. DB table `skill_fishing_base_level` is empty."); + LOG_INFO("server", " "); return; } @@ -8041,7 +8041,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() AreaTableEntry const* fArea = sAreaTableStore.LookupEntry(entry); if (!fArea) { - sLog->outErrorDb("AreaId %u defined in `skill_fishing_base_level` does not exist", entry); + LOG_ERROR("sql.sql", "AreaId %u defined in `skill_fishing_base_level` does not exist", entry); continue; } @@ -8049,8 +8049,8 @@ void ObjectMgr::LoadFishingBaseSkillLevel() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::ChangeFishingBaseSkillLevel(uint32 entry, int32 skill) @@ -8058,14 +8058,14 @@ void ObjectMgr::ChangeFishingBaseSkillLevel(uint32 entry, int32 skill) AreaTableEntry const* fArea = sAreaTableStore.LookupEntry(entry); if (!fArea) { - sLog->outErrorDb("AreaId %u defined in `skill_fishing_base_level` does not exist", entry); + LOG_ERROR("sql.sql", "AreaId %u defined in `skill_fishing_base_level` does not exist", entry); return; } _fishingBaseForAreaStore[entry] = skill; - sLog->outString(">> Fishing base skill level of area %u changed to %u", entry, skill); - sLog->outString(); + LOG_INFO("server", ">> Fishing base skill level of area %u changed to %u", entry, skill); + LOG_INFO("server", " "); } bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names) @@ -8170,8 +8170,8 @@ void ObjectMgr::LoadGameTele() if (!result) { - sLog->outErrorDb(">> Loaded 0 GameTeleports. DB table `game_tele` is empty!"); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 GameTeleports. DB table `game_tele` is empty!"); + LOG_INFO("server", " "); return; } @@ -8194,13 +8194,13 @@ void ObjectMgr::LoadGameTele() if (!MapManager::IsValidMapCoord(gt.mapId, gt.position_x, gt.position_y, gt.position_z, gt.orientation)) { - sLog->outErrorDb("Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str()); + LOG_ERROR("sql.sql", "Wrong position for id %u (name: %s) in `game_tele` table, ignoring.", id, gt.name.c_str()); continue; } if (!Utf8toWStr(gt.name, gt.wnameLow)) { - sLog->outErrorDb("Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id); + LOG_ERROR("sql.sql", "Wrong UTF8 name for id %u in `game_tele` table, ignoring.", id); continue; } @@ -8211,8 +8211,8 @@ void ObjectMgr::LoadGameTele() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } GameTele const* ObjectMgr::GetGameTele(const std::string& name) const @@ -8310,8 +8310,8 @@ void ObjectMgr::LoadMailLevelRewards() if (!result) { - sLog->outErrorDb(">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 level dependent mail rewards. DB table `mail_level_reward` is empty."); + LOG_INFO("server", " "); return; } @@ -8328,25 +8328,25 @@ void ObjectMgr::LoadMailLevelRewards() if (level > MAX_LEVEL) { - sLog->outErrorDb("Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL); + LOG_ERROR("sql.sql", "Table `mail_level_reward` have data for level %u that more supported by client (%u), ignoring.", level, MAX_LEVEL); continue; } if (!(raceMask & RACEMASK_ALL_PLAYABLE)) { - sLog->outErrorDb("Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level); + LOG_ERROR("sql.sql", "Table `mail_level_reward` have raceMask (%u) for level %u that not include any player races, ignoring.", raceMask, level); continue; } if (!sMailTemplateStore.LookupEntry(mailTemplateId)) { - sLog->outErrorDb("Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level); + LOG_ERROR("sql.sql", "Table `mail_level_reward` have invalid mailTemplateId (%u) for level %u that invalid not include any player races, ignoring.", mailTemplateId, level); continue; } if (!GetCreatureTemplate(senderEntry)) { - sLog->outErrorDb("Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level); + LOG_ERROR("sql.sql", "Table `mail_level_reward` have not existed sender creature entry (%u) for level %u that invalid not include any player races, ignoring.", senderEntry, level); continue; } @@ -8355,8 +8355,8 @@ void ObjectMgr::LoadMailLevelRewards() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel) @@ -8367,32 +8367,32 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) { - sLog->outErrorDb("Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry); + LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry); return; } if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER)) { - sLog->outErrorDb("Table `npc_trainer` contains an entry for a creature template (Entry: %u) without trainer flag, ignoring", entry); + LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry for a creature template (Entry: %u) without trainer flag, ignoring", entry); return; } SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spell); if (!spellinfo) { - sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell); + LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell); return; } if (!SpellMgr::ComputeIsSpellValid(spellinfo)) { - sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell); + LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a broken spell (Spell: %u), ignoring", entry, spell); return; } if (GetTalentSpellCost(spell)) { - sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell); + LOG_ERROR("sql.sql", "Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u) which is a talent, ignoring", entry, spell); return; } @@ -8420,7 +8420,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, if (spellinfo->Effects[i].TargetA.GetTarget() != 0 && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ALLY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA.GetTarget() != TARGET_UNIT_CASTER) { - sLog->outErrorDb("Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry); + LOG_ERROR("sql.sql", "Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry); continue; } @@ -8450,8 +8450,8 @@ void ObjectMgr::LoadTrainerSpell() if (!result) { - sLog->outErrorDb(">> Loaded 0 Trainers. DB table `npc_trainer` is empty!"); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 Trainers. DB table `npc_trainer` is empty!"); + LOG_INFO("server", " "); return; } @@ -8473,8 +8473,8 @@ void ObjectMgr::LoadTrainerSpell() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set* skip_vendors) @@ -8530,8 +8530,8 @@ void ObjectMgr::LoadVendors() QueryResult result = WorldDatabase.Query("SELECT entry, item, maxcount, incrtime, ExtendedCost FROM npc_vendor ORDER BY entry, slot ASC, item, ExtendedCost"); if (!result) { - sLog->outString(); - sLog->outErrorDb(">> Loaded 0 Vendors. DB table `npc_vendor` is empty!"); + LOG_INFO("server", " "); + LOG_ERROR("sql.sql", ">> Loaded 0 Vendors. DB table `npc_vendor` is empty!"); return; } @@ -8563,8 +8563,8 @@ void ObjectMgr::LoadVendors() } } while (result->NextRow()); - sLog->outString(">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadGossipMenu() @@ -8577,8 +8577,8 @@ void ObjectMgr::LoadGossipMenu() if (!result) { - sLog->outErrorDb(">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); + LOG_INFO("server", " "); return; } @@ -8593,15 +8593,15 @@ void ObjectMgr::LoadGossipMenu() if (!GetGossipText(gMenu.TextID)) { - sLog->outErrorDb("Table gossip_menu entry %u are using non-existing TextID %u", gMenu.MenuID, gMenu.TextID); + LOG_ERROR("sql.sql", "Table gossip_menu entry %u are using non-existing TextID %u", gMenu.MenuID, gMenu.TextID); continue; } _gossipMenusStore.insert(GossipMenusContainer::value_type(gMenu.MenuID, gMenu)); } while (result->NextRow()); - sLog->outString(">> Loaded %u gossip_menu entries in %u ms", (uint32)_gossipMenusStore.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u gossip_menu entries in %u ms", (uint32)_gossipMenusStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadGossipMenuItems() @@ -8617,8 +8617,8 @@ void ObjectMgr::LoadGossipMenuItems() if (!result) { - sLog->outErrorDb(">> Loaded 0 gossip_menu_option IDs. DB table `gossip_menu_option` is empty!"); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 gossip_menu_option IDs. DB table `gossip_menu_option` is empty!"); + LOG_INFO("server", " "); return; } @@ -8644,36 +8644,36 @@ void ObjectMgr::LoadGossipMenuItems() if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX) { - sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionIcon); + LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionIcon); gMenuItem.OptionIcon = GOSSIP_ICON_CHAT; } if (gMenuItem.OptionBroadcastTextID && !GetBroadcastText(gMenuItem.OptionBroadcastTextID)) { - sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible OptionBroadcastTextID %u, ignoring.", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionBroadcastTextID); + LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible OptionBroadcastTextID %u, ignoring.", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionBroadcastTextID); gMenuItem.OptionBroadcastTextID = 0; } if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX) - sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionType); + LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has unknown option id %u. Option will not be used", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionType); if (gMenuItem.ActionPoiID && !GetPointOfInterest(gMenuItem.ActionPoiID)) { - sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u use non-existing ActionPoiID %u, ignoring", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.ActionPoiID); + LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u use non-existing ActionPoiID %u, ignoring", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.ActionPoiID); gMenuItem.ActionPoiID = 0; } if (gMenuItem.BoxBroadcastTextID && !GetBroadcastText(gMenuItem.BoxBroadcastTextID)) { - sLog->outErrorDb("Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible BoxBroadcastTextID %u, ignoring.", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.BoxBroadcastTextID); + LOG_ERROR("sql.sql", "Table `gossip_menu_option` for menu %u, id %u has non-existing or incompatible BoxBroadcastTextID %u, ignoring.", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.BoxBroadcastTextID); gMenuItem.BoxBroadcastTextID = 0; } _gossipMenuItemsStore.insert(GossipMenuItemsContainer::value_type(gMenuItem.MenuID, gMenuItem)); } while (result->NextRow()); - sLog->outString(">> Loaded %u gossip_menu_option entries in %u ms", uint32(_gossipMenuItemsStore.size()), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u gossip_menu_option entries in %u ms", uint32(_gossipMenuItemsStore.size()), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/) @@ -8726,7 +8726,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); + LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry); return false; } @@ -8737,7 +8737,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).SendSysMessage(LANG_COMMAND_VENDORSELECTION); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); + LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry); if (skip_vendors) skip_vendors->insert(vendor_entry); @@ -8751,7 +8751,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id); + LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id); return false; } @@ -8760,7 +8760,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry); + LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry); return false; } @@ -8769,7 +8769,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); + LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry); return false; } else if (maxcount == 0 && incrtime > 0) @@ -8777,7 +8777,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0"); else - sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); + LOG_ERROR("sql.sql", "Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry); return false; } @@ -8790,7 +8790,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (player) ChatHandler(player->GetSession()).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost); else - sLog->outErrorDb("Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry); + LOG_ERROR("sql.sql", "Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry); return false; } @@ -8829,8 +8829,8 @@ void ObjectMgr::LoadScriptNames() if (!result) { - sLog->outString(); - sLog->outErrorDb(">> Loaded empty set of Script Names!"); + LOG_INFO("server", " "); + LOG_ERROR("sql.sql", ">> Loaded empty set of Script Names!"); return; } @@ -8843,8 +8843,8 @@ void ObjectMgr::LoadScriptNames() } while (result->NextRow()); std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end()); - sLog->outString(">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } std::string const& ObjectMgr::GetScriptName(uint32 id) const @@ -8877,8 +8877,8 @@ void ObjectMgr::LoadBroadcastTexts() QueryResult result = WorldDatabase.Query("SELECT ID, Language, MaleText, FemaleText, EmoteID0, EmoteID1, EmoteID2, EmoteDelay0, EmoteDelay1, EmoteDelay2, SoundId, Unk1, Unk2 FROM broadcast_text"); if (!result) { - sLog->outString(">> Loaded 0 broadcast texts. DB table `broadcast_text` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 broadcast texts. DB table `broadcast_text` is empty."); + LOG_INFO("server", " "); return; } @@ -8908,14 +8908,14 @@ void ObjectMgr::LoadBroadcastTexts() { if (!sSoundEntriesStore.LookupEntry(bct.SoundId)) { - sLog->outDebug(LOG_FILTER_NONE, "BroadcastText (Id: %u) in table `broadcast_text` has SoundId %u but sound does not exist.", bct.Id, bct.SoundId); + LOG_DEBUG("misc", "BroadcastText (Id: %u) in table `broadcast_text` has SoundId %u but sound does not exist.", bct.Id, bct.SoundId); bct.SoundId = 0; } } if (!GetLanguageDescByID(bct.Language)) { - sLog->outDebug(LOG_FILTER_NONE, "BroadcastText (Id: %u) in table `broadcast_text` using Language %u but Language does not exist.", bct.Id, bct.Language); + LOG_DEBUG("misc", "BroadcastText (Id: %u) in table `broadcast_text` using Language %u but Language does not exist.", bct.Id, bct.Language); bct.Language = LANG_UNIVERSAL; } @@ -8923,7 +8923,7 @@ void ObjectMgr::LoadBroadcastTexts() { if (!sEmotesStore.LookupEntry(bct.EmoteId0)) { - sLog->outDebug(LOG_FILTER_NONE, "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId0 %u but emote does not exist.", bct.Id, bct.EmoteId0); + LOG_DEBUG("misc", "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId0 %u but emote does not exist.", bct.Id, bct.EmoteId0); bct.EmoteId0 = 0; } } @@ -8932,7 +8932,7 @@ void ObjectMgr::LoadBroadcastTexts() { if (!sEmotesStore.LookupEntry(bct.EmoteId1)) { - sLog->outDebug(LOG_FILTER_NONE, "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId1 %u but emote does not exist.", bct.Id, bct.EmoteId1); + LOG_DEBUG("misc", "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId1 %u but emote does not exist.", bct.Id, bct.EmoteId1); bct.EmoteId1 = 0; } } @@ -8941,7 +8941,7 @@ void ObjectMgr::LoadBroadcastTexts() { if (!sEmotesStore.LookupEntry(bct.EmoteId2)) { - sLog->outDebug(LOG_FILTER_NONE, "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId2 %u but emote does not exist.", bct.Id, bct.EmoteId2); + LOG_DEBUG("misc", "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId2 %u but emote does not exist.", bct.Id, bct.EmoteId2); bct.EmoteId2 = 0; } } @@ -8949,7 +8949,7 @@ void ObjectMgr::LoadBroadcastTexts() _broadcastTextStore[bct.Id] = bct; } while (result->NextRow()); - sLog->outString(">> Loaded " SZFMTD " broadcast texts in %u ms", _broadcastTextStore.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded " SZFMTD " broadcast texts in %u ms", _broadcastTextStore.size(), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadBroadcastTextLocales() @@ -8961,8 +8961,8 @@ void ObjectMgr::LoadBroadcastTextLocales() if (!result) { - sLog->outString(">> Loaded 0 broadcast text locales. DB table `broadcast_text_locale` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 broadcast text locales. DB table `broadcast_text_locale` is empty."); + LOG_INFO("server", " "); return; } @@ -8978,7 +8978,7 @@ void ObjectMgr::LoadBroadcastTextLocales() BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id); if (bct == _broadcastTextStore.end()) { - sLog->outErrorDb("BroadcastText (Id: %u) in table `broadcast_text_locale` does not exist. Skipped!", id); + LOG_ERROR("sql.sql", "BroadcastText (Id: %u) in table `broadcast_text_locale` does not exist. Skipped!", id); continue; } @@ -8990,8 +8990,8 @@ void ObjectMgr::LoadBroadcastTextLocales() AddLocaleString(FemaleText, locale, bct->second.FemaleText); } while (result->NextRow()); - sLog->outString(">> Loaded %u Broadcast Text Locales in %u ms", uint32(_broadcastTextStore.size()), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u Broadcast Text Locales in %u ms", uint32(_broadcastTextStore.size()), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 level, uint8 unitClass) @@ -9028,8 +9028,8 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (!result) { - sLog->outString(">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty."); + LOG_INFO("server", " "); return; } @@ -9042,7 +9042,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() uint8 Class = fields[1].GetUInt8(); if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0) - sLog->outErrorDb("Creature base stats for level %u has invalid class %u", Level, Class); + LOG_ERROR("sql.sql", "Creature base stats for level %u has invalid class %u", Level, Class); CreatureBaseStats stats; @@ -9052,7 +9052,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() if (stats.BaseHealth[i] == 0) { - sLog->outErrorDb("Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i); + LOG_ERROR("sql.sql", "Creature base stats for class %u, level %u has invalid zero base HP[%u] - set to 1", Class, Level, i); stats.BaseHealth[i] = 1; } @@ -9073,7 +9073,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() stats.BaseDamage[i] = fields[9 + i].GetFloat(); if (stats.BaseDamage[i] < 0.0f) { - sLog->outErrorDb("Creature base stats for class %u, level %u has invalid negative base damage[%u] - set to 0.0", Class, Level, i); + LOG_ERROR("sql.sql", "Creature base stats for class %u, level %u has invalid negative base damage[%u] - set to 0.0", Class, Level, i); stats.BaseDamage[i] = 0.0f; } } @@ -9095,12 +9095,12 @@ void ObjectMgr::LoadCreatureClassLevelStats() for (uint16 lvl = itr->second.minlevel; lvl <= itr->second.maxlevel; ++lvl) { if (_creatureBaseStatsStore.find(MAKE_PAIR16(lvl, itr->second.unit_class)) == _creatureBaseStatsStore.end()) - sLog->outErrorDb("Missing base stats for creature class %u level %u", itr->second.unit_class, lvl); + LOG_ERROR("sql.sql", "Missing base stats for creature class %u level %u", itr->second.unit_class, lvl); } } - sLog->outString(">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadFactionChangeAchievements() @@ -9111,8 +9111,8 @@ void ObjectMgr::LoadFactionChangeAchievements() if (!result) { - sLog->outErrorDb(">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 faction change achievement pairs. DB table `player_factionchange_achievement` is empty."); + LOG_INFO("server", " "); return; } @@ -9126,17 +9126,17 @@ void ObjectMgr::LoadFactionChangeAchievements() uint32 horde = fields[1].GetUInt32(); if (!sAchievementStore.LookupEntry(alliance)) - sLog->outErrorDb("Achievement %u (alliance_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance); + LOG_ERROR("sql.sql", "Achievement %u (alliance_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", alliance); else if (!sAchievementStore.LookupEntry(horde)) - sLog->outErrorDb("Achievement %u (horde_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde); + LOG_ERROR("sql.sql", "Achievement %u (horde_id) referenced in `player_factionchange_achievement` does not exist, pair skipped!", horde); else FactionChangeAchievements[alliance] = horde; ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadFactionChangeItems() @@ -9147,8 +9147,8 @@ void ObjectMgr::LoadFactionChangeItems() if (!result) { - sLog->outString(">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty."); + LOG_INFO("server", " "); return; } @@ -9162,17 +9162,17 @@ void ObjectMgr::LoadFactionChangeItems() uint32 horde = fields[1].GetUInt32(); if (!GetItemTemplate(alliance)) - sLog->outErrorDb("Item %u (alliance_id) referenced in `player_factionchange_items` does not exist, pair skipped!", alliance); + LOG_ERROR("sql.sql", "Item %u (alliance_id) referenced in `player_factionchange_items` does not exist, pair skipped!", alliance); else if (!GetItemTemplate(horde)) - sLog->outErrorDb("Item %u (horde_id) referenced in `player_factionchange_items` does not exist, pair skipped!", horde); + LOG_ERROR("sql.sql", "Item %u (horde_id) referenced in `player_factionchange_items` does not exist, pair skipped!", horde); else FactionChangeItems[alliance] = horde; ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadFactionChangeQuests() @@ -9183,8 +9183,8 @@ void ObjectMgr::LoadFactionChangeQuests() if (!result) { - sLog->outErrorDb(">> Loaded 0 faction change quest pairs. DB table `player_factionchange_quests` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 faction change quest pairs. DB table `player_factionchange_quests` is empty."); + LOG_INFO("server", " "); return; } @@ -9198,17 +9198,17 @@ void ObjectMgr::LoadFactionChangeQuests() uint32 horde = fields[1].GetUInt32(); if (!sObjectMgr->GetQuestTemplate(alliance)) - sLog->outError("Quest %u (alliance_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", alliance); + LOG_ERROR("server", "Quest %u (alliance_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", alliance); else if (!sObjectMgr->GetQuestTemplate(horde)) - sLog->outError("Quest %u (horde_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", horde); + LOG_ERROR("server", "Quest %u (horde_id) referenced in `player_factionchange_quests` does not exist, pair skipped!", horde); else FactionChangeQuests[alliance] = horde; ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change quest pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u faction change quest pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadFactionChangeReputations() @@ -9219,8 +9219,8 @@ void ObjectMgr::LoadFactionChangeReputations() if (!result) { - sLog->outErrorDb(">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty."); + LOG_INFO("server", " "); return; } @@ -9234,17 +9234,17 @@ void ObjectMgr::LoadFactionChangeReputations() uint32 horde = fields[1].GetUInt32(); if (!sFactionStore.LookupEntry(alliance)) - sLog->outError("Reputation %u (alliance_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance); + LOG_ERROR("server", "Reputation %u (alliance_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", alliance); else if (!sFactionStore.LookupEntry(horde)) - sLog->outError("Reputation %u (horde_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde); + LOG_ERROR("server", "Reputation %u (horde_id) referenced in `player_factionchange_reputations` does not exist, pair skipped!", horde); else FactionChangeReputation[alliance] = horde; ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadFactionChangeSpells() @@ -9255,8 +9255,8 @@ void ObjectMgr::LoadFactionChangeSpells() if (!result) { - sLog->outErrorDb(">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 faction change spell pairs. DB table `player_factionchange_spells` is empty."); + LOG_INFO("server", " "); return; } @@ -9270,17 +9270,17 @@ void ObjectMgr::LoadFactionChangeSpells() uint32 horde = fields[1].GetUInt32(); if (!sSpellMgr->GetSpellInfo(alliance)) - sLog->outErrorDb("Spell %u (alliance_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance); + LOG_ERROR("sql.sql", "Spell %u (alliance_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance); else if (!sSpellMgr->GetSpellInfo(horde)) - sLog->outErrorDb("Spell %u (horde_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", horde); + LOG_ERROR("sql.sql", "Spell %u (horde_id) referenced in `player_factionchange_spells` does not exist, pair skipped!", horde); else FactionChangeSpells[alliance] = horde; ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadFactionChangeTitles() @@ -9291,7 +9291,7 @@ void ObjectMgr::LoadFactionChangeTitles() if (!result) { - sLog->outString(">> Loaded 0 faction change title pairs. DB table `player_factionchange_title` is empty."); + LOG_INFO("server", ">> Loaded 0 faction change title pairs. DB table `player_factionchange_title` is empty."); return; } @@ -9305,17 +9305,17 @@ void ObjectMgr::LoadFactionChangeTitles() uint32 horde = fields[1].GetUInt32(); if (!sCharTitlesStore.LookupEntry(alliance)) - sLog->outError("Title %u (alliance_id) referenced in `player_factionchange_title` does not exist, pair skipped!", alliance); + LOG_ERROR("server", "Title %u (alliance_id) referenced in `player_factionchange_title` does not exist, pair skipped!", alliance); else if (!sCharTitlesStore.LookupEntry(horde)) - sLog->outError("Title %u (horde_id) referenced in `player_factionchange_title` does not exist, pair skipped!", horde); + LOG_ERROR("server", "Title %u (horde_id) referenced in `player_factionchange_title` does not exist, pair skipped!", horde); else FactionChangeTitles[alliance] = horde; ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u faction change title pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u faction change title pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry) @@ -9391,7 +9391,7 @@ void ObjectMgr::LoadGameObjectQuestItems() if (!result) { - sLog->outString(">> Loaded 0 gameobject quest items. DB table `gameobject_questitem` is empty."); + LOG_INFO("server", ">> Loaded 0 gameobject quest items. DB table `gameobject_questitem` is empty."); return; } @@ -9408,8 +9408,8 @@ void ObjectMgr::LoadGameObjectQuestItems() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u gameobject quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u gameobject quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void ObjectMgr::LoadCreatureQuestItems() @@ -9421,7 +9421,7 @@ void ObjectMgr::LoadCreatureQuestItems() if (!result) { - sLog->outString(">> Loaded 0 creature quest items. DB table `creature_questitem` is empty."); + LOG_INFO("server", ">> Loaded 0 creature quest items. DB table `creature_questitem` is empty."); return; } @@ -9438,6 +9438,6 @@ void ObjectMgr::LoadCreatureQuestItems() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creature quest items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 333f29a27c..839821d8aa 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -910,13 +910,13 @@ public: void LoadQuests(); void LoadQuestStartersAndEnders() { - sLog->outString("Loading GO Start Quest Data..."); + LOG_INFO("server", "Loading GO Start Quest Data..."); LoadGameobjectQuestStarters(); - sLog->outString("Loading GO End Quest Data..."); + LOG_INFO("server", "Loading GO End Quest Data..."); LoadGameobjectQuestEnders(); - sLog->outString("Loading Creature Start Quest Data..."); + LOG_INFO("server", "Loading Creature Start Quest Data..."); LoadCreatureQuestStarters(); - sLog->outString("Loading Creature End Quest Data..."); + LOG_INFO("server", "Loading Creature End Quest Data..."); LoadCreatureQuestEnders(); } void LoadGameobjectQuestStarters(); @@ -1353,28 +1353,28 @@ private: uint64 _equipmentSetGuid; // pussywizard: accessed by a single thread uint32 _itemTextId; // pussywizard: unused? xD uint32 _mailId; - ACE_Thread_Mutex _mailIdMutex; + std::mutex _mailIdMutex; uint32 _hiPetNumber; - ACE_Thread_Mutex _hiPetNumberMutex; + std::mutex _hiPetNumberMutex; // first free low guid for selected guid type uint32 _hiCharGuid; // pussywizard: accessed by a single thread uint32 _hiCreatureGuid; - ACE_Thread_Mutex _hiCreatureGuidMutex; + std::mutex _hiCreatureGuidMutex; uint32 _hiPetGuid; - ACE_Thread_Mutex _hiPetGuidMutex; + std::mutex _hiPetGuidMutex; uint32 _hiVehicleGuid; - ACE_Thread_Mutex _hiVehicleGuidMutex; + std::mutex _hiVehicleGuidMutex; uint32 _hiItemGuid; - ACE_Thread_Mutex _hiItemGuidMutex; + std::mutex _hiItemGuidMutex; uint32 _hiGoGuid; - ACE_Thread_Mutex _hiGoGuidMutex; + std::mutex _hiGoGuidMutex; uint32 _hiDoGuid; - ACE_Thread_Mutex _hiDoGuidMutex; + std::mutex _hiDoGuidMutex; uint32 _hiCorpseGuid; - ACE_Thread_Mutex _hiCorpseGuidMutex; + std::mutex _hiCorpseGuidMutex; uint32 _hiMoTransGuid; - ACE_Thread_Mutex _hiMoTransGuidMutex; + std::mutex _hiMoTransGuidMutex; uint32 _hiCreatureRecycledGuidMax; uint32 _hiCreatureRecycledGuid; diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index 62904caacf..d69f8d1fc1 100644 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -94,7 +94,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord& cell, GridRefManager& { T* obj = new T; uint32 guid = *i_guid; - //sLog->outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid); + //LOG_INFO("server", "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid); if (!obj->LoadFromDB(guid, map)) { delete obj; @@ -113,7 +113,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord& cell, GridRefManagerGetGOData(guid); GameObject* obj = data && sObjectMgr->IsGameObjectStaticTransport(data->id) ? new StaticTransport() : new GameObject(); - //sLog->outString("DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid); + //LOG_INFO("server", "DEBUG: LoadHelper from table: %s for (guid: %u) Loading", table, guid); if (!obj->LoadFromDB(guid, map)) { delete obj; @@ -207,7 +207,7 @@ void ObjectGridLoader::LoadN(void) } } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "%u GameObjects, %u Creatures, and %u Corpses/Bones loaded for grid %u on map %u", i_gameObjects, i_creatures, i_corpses, i_grid.GetGridId(), i_map->GetId()); + LOG_DEBUG("maps", "%u GameObjects, %u Creatures, and %u Corpses/Bones loaded for grid %u on map %u", i_gameObjects, i_creatures, i_corpses, i_grid.GetGridId(), i_map->GetId()); #endif } diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 05db6332a0..f9ef31010a 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -69,11 +69,11 @@ Group::~Group() if (m_bgGroup) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Group::~Group: battleground group being deleted."); + LOG_DEBUG("bg.battleground", "Group::~Group: battleground group being deleted."); #endif if (m_bgGroup->GetBgRaid(TEAM_ALLIANCE) == this) m_bgGroup->SetBgRaid(TEAM_ALLIANCE, nullptr); else if (m_bgGroup->GetBgRaid(TEAM_HORDE) == this) m_bgGroup->SetBgRaid(TEAM_HORDE, nullptr); - else sLog->outError("Group::~Group: battleground group is not linked to the correct battleground."); + else LOG_ERROR("server", "Group::~Group: battleground group is not linked to the correct battleground."); } Rolls::iterator itr; while (!RollId.empty()) @@ -940,7 +940,6 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) item = sObjectMgr->GetItemTemplate(i->itemid); if (!item) { - //sLog->outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); continue; } @@ -1027,7 +1026,6 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) item = sObjectMgr->GetItemTemplate(i->itemid); if (!item) { - //sLog->outDebug("Group::GroupLoot: missing item prototype for item with id: %d", i->itemid); continue; } @@ -1223,7 +1221,7 @@ void Group::NeedBeforeGreed(Loot* loot, WorldObject* lootedObject) void Group::MasterLoot(Loot* loot, WorldObject* pLootedObject) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Group::MasterLoot (SMSG_LOOT_MASTER_LIST, 330)"); + LOG_DEBUG("network", "Group::MasterLoot (SMSG_LOOT_MASTER_LIST, 330)"); #endif for (std::vector::iterator i = loot->items.begin(); i != loot->items.end(); ++i) @@ -2037,7 +2035,7 @@ void Group::BroadcastGroupUpdate(void) pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2); pp->ForceValuesUpdateAtIndex(UNIT_FIELD_FACTIONTEMPLATE); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("-- Forced group value update for '%s'", pp->GetName().c_str()); + LOG_DEBUG("server", "-- Forced group value update for '%s'", pp->GetName().c_str()); #endif } } diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp index 2092ab81ed..8e97adea6a 100644 --- a/src/server/game/Groups/GroupMgr.cpp +++ b/src/server/game/Groups/GroupMgr.cpp @@ -59,7 +59,7 @@ uint32 GroupMgr::GenerateGroupId() if (_nextGroupId == 0xFFFFFFFF) { - sLog->outError("Group ID overflow!! Can't continue, shutting down server."); + LOG_ERROR("server", "Group ID overflow!! Can't continue, shutting down server."); World::StopNow(ERROR_EXIT_CODE); } @@ -109,8 +109,8 @@ void GroupMgr::LoadGroups() if (!result) { - sLog->outString(">> Loaded 0 group definitions. DB table `groups` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 group definitions. DB table `groups` is empty!"); + LOG_INFO("server", " "); } else { @@ -131,12 +131,12 @@ void GroupMgr::LoadGroups() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Group members..."); + LOG_INFO("server", "Loading Group members..."); { uint32 oldMSTime = getMSTime(); @@ -149,8 +149,8 @@ void GroupMgr::LoadGroups() QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid"); if (!result) { - sLog->outString(">> Loaded 0 group members. DB table `group_member` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 group members. DB table `group_member` is empty!"); + LOG_INFO("server", " "); } else { @@ -163,13 +163,13 @@ void GroupMgr::LoadGroups() if (group) group->LoadMemberFromDB(fields[1].GetUInt32(), fields[2].GetUInt8(), fields[3].GetUInt8(), fields[4].GetUInt8()); //else - // sLog->outError("GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32()); + // LOG_ERROR("server", "GroupMgr::LoadGroups: Consistency failed, can't find group (storage id: %u)", fields[0].GetUInt32()); ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } } diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index b45c2fb12d..31ced0df17 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -100,7 +100,7 @@ void Guild::SendCommandResult(WorldSession* session, GuildCommandType type, Guil session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_COMMAND_RESULT [%s]: Type: %u, code: %u, param: %s", session->GetPlayerInfo().c_str(), type, errCode, param.c_str()); + LOG_DEBUG("guild", "SMSG_GUILD_COMMAND_RESULT [%s]: Type: %u, code: %u, param: %s", session->GetPlayerInfo().c_str(), type, errCode, param.c_str()); #endif } @@ -111,7 +111,7 @@ void Guild::SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_SAVE_GUILD_EMBLEM [%s] Code: %u", session->GetPlayerInfo().c_str(), errCode); + LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s] Code: %u", session->GetPlayerInfo().c_str(), errCode); #endif } @@ -288,7 +288,7 @@ void Guild::RankInfo::CreateMissingTabsIfNeeded(uint8 tabs, SQLTransaction& tran rightsAndSlots.SetGuildMasterValues(); if (logOnCreate) - sLog->outError("Guild %u has broken Tab %u for rank %u. Created default tab.", m_guildId, i, m_rankId); + LOG_ERROR("server", "Guild %u has broken Tab %u for rank %u. Created default tab.", m_guildId, i, m_rankId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_BANK_RIGHT); stmt->setUInt32(0, m_guildId); @@ -397,21 +397,21 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields) uint32 itemEntry = fields[15].GetUInt32(); if (slotId >= GUILD_BANK_MAX_SLOTS) { - sLog->outError("Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); + LOG_ERROR("server", "Invalid slot for item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); return false; } ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry); if (!proto) { - sLog->outError("Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); + LOG_ERROR("server", "Unknown item (GUID: %u, id: %u) in guild bank, skipped.", itemGuid, itemEntry); return false; } Item* pItem = NewItemOrBag(proto); if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry)) { - sLog->outError("Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); + LOG_ERROR("server", "Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_NONEXISTENT_GUILD_BANK_ITEM); stmt->setUInt32(0, m_guildId); @@ -571,7 +571,7 @@ void Guild::BankTab::SendText(Guild const* guild, WorldSession* session) const if (session) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_QUERY_GUILD_BANK_TEXT [%s]: Tabid: %u, Text: %s" + LOG_DEBUG("guild", "MSG_QUERY_GUILD_BANK_TEXT [%s]: Tabid: %u, Text: %s" , session->GetPlayerInfo().c_str(), m_tabId, m_text.c_str()); #endif session->SendPacket(&data); @@ -579,7 +579,7 @@ void Guild::BankTab::SendText(Guild const* guild, WorldSession* session) const else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_QUERY_GUILD_BANK_TEXT [Broadcast]: Tabid: %u, Text: %s", m_tabId, m_text.c_str()); + LOG_DEBUG("guild", "MSG_QUERY_GUILD_BANK_TEXT [Broadcast]: Tabid: %u, Text: %s", m_tabId, m_text.c_str()); #endif guild->BroadcastPacket(&data); } @@ -681,7 +681,7 @@ bool Guild::Member::LoadFromDB(Field* fields) if (!m_zoneId) { - sLog->outError("Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid)); + LOG_ERROR("server", "Player (GUID: %u) has broken zone-data", GUID_LOPART(m_guid)); m_zoneId = Player::GetZoneIdFromDB(m_guid); } ResetFlags(); @@ -693,13 +693,13 @@ bool Guild::Member::CheckStats() const { if (m_level < 1) { - sLog->outError("Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid)); + LOG_ERROR("server", "Player (GUID: %u) has a broken data in field `characters`.`level`, deleting him from guild!", GUID_LOPART(m_guid)); return false; } if (m_class < CLASS_WARRIOR || m_class >= MAX_CLASSES) { - sLog->outError("Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid)); + LOG_ERROR("server", "Player (GUID: %u) has a broken data in field `characters`.`class`, deleting him from guild!", GUID_LOPART(m_guid)); return false; } return true; @@ -970,7 +970,7 @@ Item* Guild::BankMoveItemData::StoreItem(SQLTransaction& trans, Item* pItem) ++itr; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", + LOG_DEBUG("guild", "GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", m_container, m_slotId, pItem->GetEntry(), pItem->GetCount()); #endif pLastItem = _StoreItem(trans, pTab, pItem, pos, itr != m_vec.end()); @@ -1075,7 +1075,7 @@ void Guild::BankMoveItemData::CanStoreItemInTab(Item* pItem, uint8 skipSlotId, b InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "GUILD STORAGE: CanStore() tab = %u, slot = %u, item = %u, count = %u", + LOG_DEBUG("guild", "GUILD STORAGE: CanStore() tab = %u, slot = %u, item = %u, count = %u", m_container, m_slotId, pItem->GetEntry(), pItem->GetCount()); #endif uint32 count = pItem->GetCount(); @@ -1174,7 +1174,7 @@ bool Guild::Create(Player* pLeader, std::string const& name) _CreateLogHolders(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "GUILD: creating guild [%s] for leader %s (%u)", + LOG_DEBUG("guild", "GUILD: creating guild [%s] for leader %s (%u)", name.c_str(), pLeader->GetName().c_str(), GUID_LOPART(m_leaderGuid)); #endif SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -1278,7 +1278,7 @@ void Guild::UpdateMemberData(Player* player, uint8 dataid, uint32 value) member->SetLevel(value); break; default: - sLog->outError("Guild::UpdateMemberData: Called with incorrect DATAID %u (value %u)", dataid, value); + LOG_ERROR("server", "Guild::UpdateMemberData: Called with incorrect DATAID %u (value %u)", dataid, value); return; } //HandleRoster(); @@ -1311,7 +1311,7 @@ void Guild::HandleRoster(WorldSession* session) itr->second->WritePacket(data, _HasRankRight(session->GetPlayer(), GR_RIGHT_VIEWOFFNOTE)); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "SMSG_GUILD_ROSTER [%s]", session->GetPlayerInfo().c_str()); #endif session->SendPacket(&data); } @@ -1336,7 +1336,7 @@ void Guild::HandleQuery(WorldSession* session) session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_QUERY_RESPONSE [%s]", session->GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "SMSG_GUILD_QUERY_RESPONSE [%s]", session->GetPlayerInfo().c_str()); #endif } @@ -1426,7 +1426,7 @@ void Guild::HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string BankTab* tab = GetBankTab(tabId); if (!tab) { - sLog->outError("Guild::HandleSetBankTabInfo: Player %s trying to change bank tab info from unexisting tab %d.", + LOG_ERROR("server", "Guild::HandleSetBankTabInfo: Player %s trying to change bank tab info from unexisting tab %d.", session->GetPlayerInfo().c_str(), tabId); return; } @@ -1459,7 +1459,7 @@ void Guild::HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string c else if (RankInfo* rankInfo = GetRankInfo(rankId)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "Changed RankName to '%s', rights to 0x%08X", name.c_str(), rights); + LOG_DEBUG("guild", "Changed RankName to '%s', rights to 0x%08X", name.c_str(), rights); #endif rankInfo->SetName(name); @@ -1545,7 +1545,7 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name) SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_COMMAND_SUCCESS, name); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "Player %s invited %s to join his Guild", player->GetName().c_str(), name.c_str()); + LOG_DEBUG("guild", "Player %s invited %s to join his Guild", player->GetName().c_str(), name.c_str()); #endif pInvitee->SetGuildIdInvited(m_id); @@ -1556,7 +1556,7 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name) data << m_name; pInvitee->GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_INVITE [%s]", pInvitee->GetName().c_str()); + LOG_DEBUG("guild", "SMSG_GUILD_INVITE [%s]", pInvitee->GetName().c_str()); #endif } @@ -1813,7 +1813,7 @@ void Guild::HandleDisband(WorldSession* session) { Disband(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "Guild Successfully Disbanded"); + LOG_DEBUG("guild", "Guild Successfully Disbanded"); #endif delete this; } @@ -1830,7 +1830,7 @@ void Guild::SendInfo(WorldSession* session) const session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_INFO [%s]", session->GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "SMSG_GUILD_INFO [%s]", session->GetPlayerInfo().c_str()); #endif } @@ -1840,7 +1840,7 @@ void Guild::SendEventLog(WorldSession* session) const m_eventLog->WritePacket(data); session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_EVENT_LOG_QUERY [%s]", session->GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "MSG_GUILD_EVENT_LOG_QUERY [%s]", session->GetPlayerInfo().c_str()); #endif } @@ -1855,7 +1855,7 @@ void Guild::SendBankLog(WorldSession* session, uint8 tabId) const pLog->WritePacket(data); session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_BANK_LOG_QUERY [%s]", session->GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "MSG_GUILD_BANK_LOG_QUERY [%s]", session->GetPlayerInfo().c_str()); #endif } } @@ -1898,7 +1898,7 @@ void Guild::SendPermissions(WorldSession* session) const session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_PERMISSIONS [%s] Rank: %u", session->GetPlayerInfo().c_str(), rankId); + LOG_DEBUG("guild", "MSG_GUILD_PERMISSIONS [%s] Rank: %u", session->GetPlayerInfo().c_str(), rankId); #endif } @@ -1913,7 +1913,7 @@ void Guild::SendMoneyInfo(WorldSession* session) const data << int32(amount); session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s] Money: %u", session->GetPlayerInfo().c_str(), amount); + LOG_DEBUG("guild", "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s] Money: %u", session->GetPlayerInfo().c_str(), amount); #endif } @@ -1926,7 +1926,7 @@ void Guild::SendLoginInfo(WorldSession* session) session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_EVENT [%s] MOTD", session->GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "SMSG_GUILD_EVENT [%s] MOTD", session->GetPlayerInfo().c_str()); #endif SendBankTabsInfo(session); @@ -2032,13 +2032,13 @@ bool Guild::LoadBankEventLogFromDB(Field* fields) { if (!isMoneyTab) { - sLog->outError("GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId); + LOG_ERROR("server", "GuildBankEventLog ERROR: MoneyEvent(LogGuid: %u, Guild: %u) does not belong to money tab (%u), ignoring...", guid, m_id, dbTabId); return false; } } else if (isMoneyTab) { - sLog->outError("GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id); + LOG_ERROR("server", "GuildBankEventLog ERROR: non-money event (LogGuid: %u, Guild: %u) belongs to money tab, ignoring...", guid, m_id); return false; } pLog->LoadEvent(new BankEventLogEntry( @@ -2060,7 +2060,7 @@ void Guild::LoadBankTabFromDB(Field* fields) { uint8 tabId = fields[1].GetUInt8(); if (tabId >= _GetPurchasedTabsSize()) - sLog->outError("Invalid tab (tabId: %u) in guild bank, skipped.", tabId); + LOG_ERROR("server", "Invalid tab (tabId: %u) in guild bank, skipped.", tabId); else m_bankTabs[tabId]->LoadFromDB(fields); } @@ -2070,7 +2070,7 @@ bool Guild::LoadBankItemFromDB(Field* fields) uint8 tabId = fields[12].GetUInt8(); if (tabId >= _GetPurchasedTabsSize()) { - sLog->outError("Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.", + LOG_ERROR("server", "Invalid tab for item (GUID: %u, id: #%u) in guild bank, skipped.", fields[14].GetUInt32(), fields[15].GetUInt32()); return false; } @@ -2089,7 +2089,7 @@ bool Guild::Validate() uint8 ranks = _GetRanksSize(); if (ranks < GUILD_RANKS_MIN_COUNT || ranks > GUILD_RANKS_MAX_COUNT) { - sLog->outError("Guild %u has invalid number of ranks, creating new...", m_id); + LOG_ERROR("server", "Guild %u has invalid number of ranks, creating new...", m_id); broken_ranks = true; } else @@ -2099,7 +2099,7 @@ bool Guild::Validate() RankInfo* rankInfo = GetRankInfo(rankId); if (rankInfo->GetId() != rankId) { - sLog->outError("Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId); + LOG_ERROR("server", "Guild %u has broken rank id %u, creating default set of ranks...", m_id, rankId); broken_ranks = true; } else @@ -2702,14 +2702,6 @@ void Guild::_MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAm // 2. Check source item if (!pSrc->CheckItem(splitedAmount)) return; // Source item or splited amount is invalid - /* - if (pItemSrc->GetCount() == 0) - { - sLog->outFatal(LOG_FILTER_GUILD, "Guild::SwapItems: Player %s(GUIDLow: %u) tried to move item %u from tab %u slot %u to tab %u slot %u, but item %u has a stack of zero!", - player->GetName().c_str(), player->GetGUIDLow(), pItemSrc->GetEntry(), tabId, slotId, destTabId, destSlotId, pItemSrc->GetEntry()); - //return; // Commented out for now, uncomment when it's verified that this causes a crash!! - } - // */ // 3. Check destination rights if (!pDest->HasStoreRights(pSrc)) @@ -2869,7 +2861,7 @@ void Guild::_BroadcastEvent(GuildEvents guildEvent, uint64 guid, const char* par BroadcastPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_EVENT [Broadcast] Event: %u", guildEvent); + LOG_DEBUG("guild", "SMSG_GUILD_EVENT [Broadcast] Event: %u", guildEvent); #endif } @@ -2914,7 +2906,7 @@ void Guild::_SendBankList(WorldSession* session /* = nullptr*/, uint8 tabId /*= data.put(rempos, numSlots); session->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %d", + LOG_DEBUG("guild", "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %d", session->GetPlayerInfo().c_str(), tabId, sendAllSlots, numSlots); #endif } @@ -2932,7 +2924,7 @@ void Guild::_SendBankList(WorldSession* session /* = nullptr*/, uint8 tabId /*= data.put(rempos, numSlots); player->GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %u" + LOG_DEBUG("guild", "SMSG_GUILD_BANK_LIST [%s]: TabId: %u, FullSlots: %u, slots: %u" , player->GetName().c_str(), tabId, sendAllSlots, numSlots); #endif } diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp index 022c999b0d..223143ca2c 100644 --- a/src/server/game/Guilds/GuildMgr.cpp +++ b/src/server/game/Guilds/GuildMgr.cpp @@ -36,7 +36,7 @@ uint32 GuildMgr::GenerateGuildId() { if (NextGuildId >= 0xFFFFFFFE) { - sLog->outError("Guild ids overflow!! Can't continue, shutting down server."); + LOG_ERROR("server", "Guild ids overflow!! Can't continue, shutting down server."); World::StopNow(ERROR_EXIT_CODE); } return NextGuildId++; @@ -86,7 +86,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const void GuildMgr::LoadGuilds() { // 1. Load all guilds - sLog->outString("Loading guilds definitions..."); + LOG_INFO("server", "Loading guilds definitions..."); { uint32 oldMSTime = getMSTime(); @@ -100,8 +100,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild definitions. DB table `guild` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 guild definitions. DB table `guild` is empty."); + LOG_INFO("server", " "); } else { @@ -122,13 +122,13 @@ void GuildMgr::LoadGuilds() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // 2. Load all guild ranks - sLog->outString("Loading guild ranks..."); + LOG_INFO("server", "Loading guild ranks..."); { uint32 oldMSTime = getMSTime(); @@ -140,8 +140,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 guild ranks. DB table `guild_rank` is empty."); + LOG_INFO("server", " "); } else { @@ -157,13 +157,13 @@ void GuildMgr::LoadGuilds() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // 3. Load all guild members - sLog->outString("Loading guild members..."); + LOG_INFO("server", "Loading guild members..."); { uint32 oldMSTime = getMSTime(); @@ -181,8 +181,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild members. DB table `guild_member` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 guild members. DB table `guild_member` is empty."); + LOG_INFO("server", " "); } else { @@ -199,13 +199,13 @@ void GuildMgr::LoadGuilds() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // 4. Load all guild bank tab rights - sLog->outString("Loading bank tab rights..."); + LOG_INFO("server", "Loading bank tab rights..."); { uint32 oldMSTime = getMSTime(); @@ -217,8 +217,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty."); + LOG_INFO("server", " "); } else { @@ -234,13 +234,13 @@ void GuildMgr::LoadGuilds() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // 5. Load all event logs - sLog->outString("Loading guild event logs..."); + LOG_INFO("server", "Loading guild event logs..."); { uint32 oldMSTime = getMSTime(); @@ -251,8 +251,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty."); + LOG_INFO("server", " "); } else { @@ -268,13 +268,13 @@ void GuildMgr::LoadGuilds() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // 6. Load all bank event logs - sLog->outString("Loading guild bank event logs..."); + LOG_INFO("server", "Loading guild bank event logs..."); { uint32 oldMSTime = getMSTime(); @@ -286,8 +286,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty."); + LOG_INFO("server", " "); } else { @@ -303,13 +303,13 @@ void GuildMgr::LoadGuilds() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // 7. Load all guild bank tabs - sLog->outString("Loading guild bank tabs..."); + LOG_INFO("server", "Loading guild bank tabs..."); { uint32 oldMSTime = getMSTime(); @@ -321,8 +321,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty."); + LOG_INFO("server", " "); } else { @@ -338,13 +338,13 @@ void GuildMgr::LoadGuilds() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // 8. Fill all guild bank tabs - sLog->outString("Filling bank tabs with items..."); + LOG_INFO("server", "Filling bank tabs with items..."); { uint32 oldMSTime = getMSTime(); @@ -358,8 +358,8 @@ void GuildMgr::LoadGuilds() if (!result) { - sLog->outString(">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty."); + LOG_INFO("server", " "); } else { @@ -375,13 +375,13 @@ void GuildMgr::LoadGuilds() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // 9. Validate loaded guild data - sLog->outString("Validating data of loaded guilds..."); + LOG_INFO("server", "Validating data of loaded guilds..."); { uint32 oldMSTime = getMSTime(); @@ -393,8 +393,8 @@ void GuildMgr::LoadGuilds() delete guild; } - sLog->outString(">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } diff --git a/src/server/game/Handlers/AddonHandler.cpp b/src/server/game/Handlers/AddonHandler.cpp index d15fbf7331..56fd9996b5 100644 --- a/src/server/game/Handlers/AddonHandler.cpp +++ b/src/server/game/Handlers/AddonHandler.cpp @@ -73,7 +73,7 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target) AddOnPacked >> enabled >> crc >> unk2; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk2); + LOG_DEBUG("network", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk2); #endif uint8 state = (enabled ? 2 : 1); @@ -129,12 +129,12 @@ bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) if (AddOnPacked.rpos() != AddOnPacked.size()) - sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under read!"); + LOG_DEBUG("network", "packet under read!"); #endif } else { - sLog->outError("Addon packet uncompress error :("); + LOG_ERROR("server", "Addon packet uncompress error :("); return false; } return true; diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp index 37800c4c55..f99139d1a1 100644 --- a/src/server/game/Handlers/ArenaTeamHandler.cpp +++ b/src/server/game/Handlers/ArenaTeamHandler.cpp @@ -20,13 +20,13 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_INSPECT_ARENA_TEAMS"); + LOG_DEBUG("network", "MSG_INSPECT_ARENA_TEAMS"); #endif uint64 guid; recvData >> guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + LOG_DEBUG("network", "Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); #endif if (Player* player = ObjectAccessor::FindPlayer(guid)) @@ -45,7 +45,7 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_QUERY"); + LOG_DEBUG("network", "WORLD: Received CMSG_ARENA_TEAM_QUERY"); #endif uint32 arenaTeamId; @@ -61,7 +61,7 @@ void WorldSession::HandleArenaTeamQueryOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ARENA_TEAM_ROSTER"); + LOG_DEBUG("network", "WORLD: Received CMSG_ARENA_TEAM_ROSTER"); #endif uint32 arenaTeamId; // arena team id @@ -74,7 +74,7 @@ void WorldSession::HandleArenaTeamRosterOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_INVITE"); + LOG_DEBUG("network", "CMSG_ARENA_TEAM_INVITE"); #endif uint32 arenaTeamId; // arena team id @@ -146,7 +146,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName().c_str(), invitedName.c_str()); + LOG_DEBUG("bg.battleground", "Player %s Invited %s to Join his ArenaTeam", GetPlayer()->GetName().c_str(), invitedName.c_str()); #endif player->SetArenaTeamIdInvited(arenaTeam->GetId()); @@ -157,14 +157,14 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData) player->GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_INVITE"); + LOG_DEBUG("network", "WORLD: Sent SMSG_ARENA_TEAM_INVITE"); #endif } void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_ACCEPT"); // empty opcode + LOG_DEBUG("network", "CMSG_ARENA_TEAM_ACCEPT"); // empty opcode #endif ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(_player->GetArenaTeamIdInvited()); @@ -199,7 +199,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_DECLINE"); // empty opcode + LOG_DEBUG("network", "CMSG_ARENA_TEAM_DECLINE"); // empty opcode #endif // Remove invite from player @@ -209,7 +209,7 @@ void WorldSession::HandleArenaTeamDeclineOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEAVE"); + LOG_DEBUG("network", "CMSG_ARENA_TEAM_LEAVE"); #endif uint32 arenaTeamId; @@ -268,7 +268,7 @@ void WorldSession::HandleArenaTeamLeaveOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_DISBAND"); + LOG_DEBUG("network", "CMSG_ARENA_TEAM_DISBAND"); #endif uint32 arenaTeamId; @@ -302,7 +302,7 @@ void WorldSession::HandleArenaTeamDisbandOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_REMOVE"); + LOG_DEBUG("network", "CMSG_ARENA_TEAM_REMOVE"); #endif uint32 arenaTeamId; @@ -369,7 +369,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData) void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ARENA_TEAM_LEADER"); + LOG_DEBUG("network", "CMSG_ARENA_TEAM_LEADER"); #endif uint32 arenaTeamId; diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index a3241a4a7e..6a9848ee5b 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -30,7 +30,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -147,7 +147,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) if (bid > MAX_MONEY_AMOUNT || buyout > MAX_MONEY_AMOUNT) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Player %s (GUID %u) attempted to sell item with higher price than max gold amount.", _player->GetName().c_str(), _player->GetGUIDLow()); + LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Player %s (GUID %u) attempted to sell item with higher price than max gold amount.", _player->GetName().c_str(), _player->GetGUIDLow()); #endif SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR); return; @@ -157,7 +157,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(auctioneer)); + LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(auctioneer)); #endif return; } @@ -166,7 +166,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) if (!auctionHouseEntry) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", GUID_LOPART(auctioneer)); + LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", GUID_LOPART(auctioneer)); #endif return; } @@ -286,7 +286,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->auctionHouseEntry = auctionHouseEntry; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + LOG_DEBUG("server", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); #endif sAuctionMgr->AddAItem(item); auctionHouse->AddAuction(AH); @@ -310,7 +310,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) Item* newItem = item->CloneItem(finalCount, _player); if (!newItem) { - sLog->outError("CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry()); + LOG_ERROR("server", "CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry()); SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR); return; } @@ -328,7 +328,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->auctionHouseEntry = auctionHouseEntry; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + LOG_DEBUG("server", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); #endif sAuctionMgr->AddAItem(newItem); auctionHouse->AddAuction(AH); @@ -379,7 +379,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_PLACE_BID"); + LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_PLACE_BID"); #endif uint64 auctioneer; @@ -395,7 +395,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); + LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); #endif return; } @@ -509,20 +509,19 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_REMOVE_ITEM"); + LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_REMOVE_ITEM"); #endif uint64 auctioneer; uint32 auctionId; recvData >> auctioneer; recvData >> auctionId; - //sLog->outDebug("Cancel AUCTION AuctionID: %u", auctionId); Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); + LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); #endif return; } @@ -559,7 +558,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) } else { - sLog->outError("Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow); + LOG_ERROR("server", "Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow); SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR); return; } @@ -568,7 +567,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) { SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR); //this code isn't possible ... maybe there should be assert - sLog->outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is nullptr", player->GetGUIDLow(), auctionId); + LOG_ERROR("server", "CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is nullptr", player->GetGUIDLow(), auctionId); return; } @@ -589,7 +588,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS"); + LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS"); #endif uint64 guid; //NPC guid @@ -601,7 +600,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData) recvData >> outbiddedCount; if (recvData.size() != (16 + outbiddedCount * 4)) { - sLog->outError("Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recvData.size(), (16 + outbiddedCount * 4)); + LOG_ERROR("server", "Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recvData.size(), (16 + outbiddedCount * 4)); outbiddedCount = 0; } @@ -609,7 +608,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData) if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); #endif recvData.rfinish(); return; @@ -672,7 +671,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData) void WorldSession::HandleAuctionListOwnerItemsEvent(uint64 creatureGuid) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS"); + LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS"); #endif _lastAuctionListOwnerItemsMSTime = World::GetGameTimeMS(); // pussywizard @@ -681,7 +680,7 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(uint64 creatureGuid) if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(creatureGuid))); + LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(creatureGuid))); #endif return; } @@ -709,7 +708,7 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(uint64 creatureGuid) void WorldSession::HandleAuctionListItems(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_ITEMS"); + LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_ITEMS"); #endif std::string searchedname; @@ -749,14 +748,14 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData) if (diff > delay) diff = delay; _lastAuctionListItemsMSTime = now + delay - diff; - ACORE_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetTempLock()); + std::lock_guard guard(AsyncAuctionListingMgr::GetTempLock()); AsyncAuctionListingMgr::GetTempList().push_back( AuctionListItemsDelayEvent(delay - diff, _player->GetGUID(), guid, searchedname, listfrom, levelmin, levelmax, usable, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, getAll) ); } void WorldSession::HandleAuctionListPendingSales(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES"); + LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES"); #endif recvData.read_skip(); diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp index 1fde7b10ab..705310fdc1 100644 --- a/src/server/game/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Handlers/BattleGroundHandler.cpp @@ -28,7 +28,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData) uint64 guid; recvData >> guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); + LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); #endif Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); @@ -268,7 +268,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData) void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message"); + LOG_DEBUG("network", "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message"); #endif Battleground* bg = _player->GetBattleground(); @@ -321,7 +321,7 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvDa void WorldSession::HandlePVPLogDataOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_PVP_LOG_DATA Message"); + LOG_DEBUG("network", "WORLD: Recvd MSG_PVP_LOG_DATA Message"); #endif Battleground* bg = _player->GetBattleground(); @@ -337,14 +337,14 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket& /*recvData*/) SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent MSG_PVP_LOG_DATA Message"); + LOG_DEBUG("network", "WORLD: Sent MSG_PVP_LOG_DATA Message"); #endif } void WorldSession::HandleBattlefieldListOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEFIELD_LIST Message"); #endif uint32 bgTypeId; @@ -496,7 +496,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData) void WorldSession::HandleBattlefieldLeaveOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_LEAVE_BATTLEFIELD Message"); #endif recvData.read_skip(); // unk1 @@ -808,13 +808,13 @@ void WorldSession::HandleReportPvPAFK(WorldPacket& recvData) if (!reportedPlayer) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "WorldSession::HandleReportPvPAFK: player not found"); + LOG_DEBUG("bg.battleground", "WorldSession::HandleReportPvPAFK: player not found"); #endif return; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_BATTLEGROUND, "WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName().c_str(), reportedPlayer->GetName().c_str()); + LOG_DEBUG("bg.battleground", "WorldSession::HandleReportPvPAFK: %s reported %s", _player->GetName().c_str(), reportedPlayer->GetName().c_str()); #endif reportedPlayer->ReportedAfkBy(_player); diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index fc71c3b8d0..6d2c40c369 100644 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -39,7 +39,7 @@ Copied events should probably have a new owner void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/) { uint64 guid = _player->GetGUID(); - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); + LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid); time_t currTime = time(nullptr); @@ -171,7 +171,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) uint64 eventId; recvData >> eventId; - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_EVENT. Player [" + LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [" UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) @@ -182,7 +182,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData) void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID()); + LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID()); uint32 minLevel; uint32 maxLevel; @@ -193,12 +193,12 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId())) guild->MassInviteToEvent(this, minLevel, maxLevel, minRank); - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GUILD_FILTER: Min level [%d], Max level [%d], Min rank [%d]", minLevel, maxLevel, minRank); + LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER: Min level [%d], Max level [%d], Min rank [%d]", minLevel, maxLevel, minRank); } void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID()); + LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID()); uint32 arenaTeamId; recvData >> arenaTeamId; @@ -211,7 +211,7 @@ bool validUtf8String(WorldPacket& recvData, std::string& s, std::string action, { if (!utf8::is_valid(s.begin(), s.end())) { - sLog->outString("CalendarHandler: Player with guid %llu attempt to %s an event with invalid name or description (packet modification)", (unsigned long long)playerGUID, action.c_str()); + LOG_INFO("server", "CalendarHandler: Player with guid %llu attempt to %s an event with invalid name or description (packet modification)", (unsigned long long)playerGUID, action.c_str()); recvData.rfinish(); return false; } @@ -382,7 +382,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData) return; } - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD + LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD "], InviteId [" UI64FMTD "] Title %s, Description %s, type %u " "Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u " "Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(), @@ -428,7 +428,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) recvData >> eventId >> inviteId; recvData.ReadPackedTime(eventTime); - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD + LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD "] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, eventTime); // prevent events in the past @@ -507,7 +507,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData) void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_INVITE"); + LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_INVITE"); uint64 playerGuid = _player->GetGUID(); @@ -606,7 +606,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData) bool tentative; recvData >> eventId >> tentative; - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" UI64FMTD "] Tentative %u", guid, eventId, tentative); + LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" UI64FMTD "] Tentative %u", guid, eventId, tentative); if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId)) { @@ -633,7 +633,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData) uint32 status; recvData >> eventId >> inviteId >> status; - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD"] EventId [" + LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD"] EventId [" UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId, inviteId, status); @@ -673,7 +673,7 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData) recvData.readPackGUID(invitee); recvData >> inviteId >> ownerInviteId >> eventId; - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_REMOVE_INVITE [" + LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE [" UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])", guid, eventId, ownerInviteId, invitee, inviteId); @@ -703,7 +703,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData) recvData.readPackGUID(invitee); recvData >> eventId >> inviteId >> ownerInviteId >> status; - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId [" + LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId [" UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status); @@ -737,7 +737,7 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData) recvData.readPackGUID(invitee); recvData >> eventId >> inviteId >> ownerInviteId >> rank; - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId [" + LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId [" UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank); @@ -763,7 +763,7 @@ void WorldSession::HandleCalendarComplain(WorldPacket& recvData) uint64 complainGUID; recvData >> eventId >> complainGUID; - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId [" + LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId [" UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID); // what to do with complains? @@ -774,7 +774,7 @@ void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/) uint64 guid = _player->GetGUID(); uint32 pending = sCalendarMgr->GetPlayerNumPending(guid); - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD + LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD "] Pending: %u", guid, pending); WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4); @@ -812,7 +812,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData) void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED"); + LOG_DEBUG("network", "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED"); time_t currTime = time(nullptr); WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8); diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp index 6a1b2d5c53..1f18fb98b4 100644 --- a/src/server/game/Handlers/ChannelHandler.cpp +++ b/src/server/game/Handlers/ChannelHandler.cpp @@ -19,7 +19,7 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) recvPacket >> channelId >> unknown1 >> unknown2 >> channelName >> password; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_JOIN_CHANNEL %s Channel: %u, unk1: %u, unk2: %u, channel: %s, password: %s", GetPlayerInfo().c_str(), channelId, unknown1, unknown2, channelName.c_str(), password.c_str()); + LOG_DEBUG("chat.system", "CMSG_JOIN_CHANNEL %s Channel: %u, unk1: %u, unk2: %u, channel: %s, password: %s", GetPlayerInfo().c_str(), channelId, unknown1, unknown2, channelName.c_str(), password.c_str()); #endif if (channelId) { @@ -57,7 +57,7 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) recvPacket >> unk >> channelName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_LEAVE_CHANNEL %s Channel: %s, unk1: %u", + LOG_DEBUG("chat.system", "CMSG_LEAVE_CHANNEL %s Channel: %s, unk1: %u", GetPlayerInfo().c_str(), channelName.c_str(), unk); #endif if (channelName.empty()) @@ -76,7 +76,7 @@ void WorldSession::HandleChannelList(WorldPacket& recvPacket) recvPacket >> channelName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "%s %s Channel: %s", + LOG_DEBUG("chat.system", "%s %s Channel: %s", recvPacket.GetOpcode() == CMSG_CHANNEL_DISPLAY_LIST ? "CMSG_CHANNEL_DISPLAY_LIST" : "CMSG_CHANNEL_LIST", GetPlayerInfo().c_str(), channelName.c_str()); #endif @@ -91,7 +91,7 @@ void WorldSession::HandleChannelPassword(WorldPacket& recvPacket) recvPacket >> channelName >> password; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_PASSWORD %s Channel: %s, Password: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_PASSWORD %s Channel: %s, Password: %s", GetPlayerInfo().c_str(), channelName.c_str(), password.c_str()); #endif if (password.length() > MAX_CHANNEL_PASS_STR) @@ -108,7 +108,7 @@ void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) recvPacket >> channelName >> targetName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_SET_OWNER %s Channel: %s, Target: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_SET_OWNER %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); #endif if (!normalizePlayerName(targetName)) @@ -125,7 +125,7 @@ void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) recvPacket >> channelName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_OWNER %s Channel: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_OWNER %s Channel: %s", GetPlayerInfo().c_str(), channelName.c_str()); #endif if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeamId())) @@ -139,7 +139,7 @@ void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) recvPacket >> channelName >> targetName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MODERATOR %s Channel: %s, Target: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_MODERATOR %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); #endif if (!normalizePlayerName(targetName)) @@ -156,7 +156,7 @@ void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) recvPacket >> channelName >> targetName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMODERATOR %s Channel: %s, Target: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_UNMODERATOR %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); #endif if (!normalizePlayerName(targetName)) @@ -173,7 +173,7 @@ void WorldSession::HandleChannelMute(WorldPacket& recvPacket) recvPacket >> channelName >> targetName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MUTE %s Channel: %s, Target: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_MUTE %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); #endif if (!normalizePlayerName(targetName)) @@ -190,7 +190,7 @@ void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) recvPacket >> channelName >> targetName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNMUTE %s Channel: %s, Target: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_UNMUTE %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); #endif if (!normalizePlayerName(targetName)) @@ -207,7 +207,7 @@ void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) recvPacket >> channelName >> targetName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_INVITE %s Channel: %s, Target: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_INVITE %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); #endif if (!normalizePlayerName(targetName)) @@ -224,7 +224,7 @@ void WorldSession::HandleChannelKick(WorldPacket& recvPacket) recvPacket >> channelName >> targetName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_KICK %s Channel: %s, Target: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_KICK %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); #endif if (!normalizePlayerName(targetName)) @@ -241,7 +241,7 @@ void WorldSession::HandleChannelBan(WorldPacket& recvPacket) recvPacket >> channelName >> targetName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_BAN %s Channel: %s, Target: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_BAN %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); #endif if (!normalizePlayerName(targetName)) @@ -258,7 +258,7 @@ void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) recvPacket >> channelName >> targetName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_UNBAN %s Channel: %s, Target: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_UNBAN %s Channel: %s, Target: %s", GetPlayerInfo().c_str(), channelName.c_str(), targetName.c_str()); #endif if (!normalizePlayerName(targetName)) @@ -275,7 +275,7 @@ void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) recvPacket >> channelName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_ANNOUNCEMENTS %s Channel: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_ANNOUNCEMENTS %s Channel: %s", GetPlayerInfo().c_str(), channelName.c_str()); #endif if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeamId())) @@ -289,7 +289,7 @@ void WorldSession::HandleChannelModerateOpcode(WorldPacket& recvPacket) recvPacket >> channelName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_CHANNEL_MODERATE %s Channel: %s", + LOG_DEBUG("chat.system", "CMSG_CHANNEL_MODERATE %s Channel: %s", GetPlayerInfo().c_str(), channelName.c_str()); #endif @@ -310,14 +310,14 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket& recvPacket) recvPacket >> channelName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, "CMSG_GET_CHANNEL_MEMBER_COUNT %s Channel: %s", + LOG_DEBUG("chat.system", "CMSG_GET_CHANNEL_MEMBER_COUNT %s Channel: %s", GetPlayerInfo().c_str(), channelName.c_str()); #endif if (ChannelMgr* cMgr = ChannelMgr::forTeam(GetPlayer()->GetTeamId())) { if (Channel* channel = cMgr->GetChannel(channelName, GetPlayer())) { - sLog->outDebug(LOG_FILTER_CHATSYS, "SMSG_CHANNEL_MEMBER_COUNT %s Channel: %s Count: %u", + LOG_DEBUG("chat.system", "SMSG_CHANNEL_MEMBER_COUNT %s Channel: %s Count: %u", GetPlayerInfo().c_str(), channelName.c_str(), channel->GetNumPlayers()); WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, channel->GetName().size() + 1 + 4); diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index d3b8b09ed2..2346dd793f 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -211,7 +211,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result) { uint32 guidlow = (*result)[0].GetUInt32(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Loading char guid %u from account %u.", guidlow, GetAccountId()); + LOG_DEBUG("server", "Loading char guid %u from account %u.", guidlow, GetAccountId()); #endif if (Player::BuildEnumData(result, &data)) { @@ -282,7 +282,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) { data << (uint8)CHAR_CREATE_FAILED; SendPacket(&data); - sLog->outError("Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId()); + LOG_ERROR("server", "Class (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", class_, GetAccountId()); return; } @@ -291,7 +291,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) { data << (uint8)CHAR_CREATE_FAILED; SendPacket(&data); - sLog->outError("Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId()); + LOG_ERROR("server", "Race (%u) not found in DBC while creating new char for account (ID: %u): wrong DBC files or cheater?", race_, GetAccountId()); return; } @@ -299,7 +299,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) if (raceEntry->expansion > Expansion()) { data << (uint8)CHAR_CREATE_EXPANSION; - sLog->outError("Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_); + LOG_ERROR("server", "Expansion %u account:[%d] tried to Create character with expansion %u race (%u)", Expansion(), GetAccountId(), raceEntry->expansion, race_); SendPacket(&data); return; } @@ -308,7 +308,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) if (classEntry->expansion > Expansion()) { data << (uint8)CHAR_CREATE_EXPANSION_CLASS; - sLog->outError("Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_); + LOG_ERROR("server", "Expansion %u account:[%d] tried to Create character with expansion %u class (%u)", Expansion(), GetAccountId(), classEntry->expansion, class_); SendPacket(&data); return; } @@ -337,7 +337,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData) { data << (uint8)CHAR_NAME_NO_NAME; SendPacket(&data); - sLog->outError("Account:[%d] but tried to Create character with empty [name] ", GetAccountId()); + LOG_ERROR("server", "Account:[%d] but tried to Create character with empty [name] ", GetAccountId()); return; } @@ -600,7 +600,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte uint8 unk; createInfo->Data >> unk; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk); + LOG_DEBUG("network", "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk); #endif } @@ -660,9 +660,9 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte std::string IP_str = GetRemoteAddress(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + LOG_DEBUG("server", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); #endif - sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + LOG_INFO("entities.player", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); sScriptMgr->OnPlayerCreate(&newChar); sWorld->AddGlobalPlayerData(newChar.GetGUIDLow(), GetAccountId(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel(), 0, 0); @@ -729,19 +729,20 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) std::string IP_str = GetRemoteAddress(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); + LOG_DEBUG("server", "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); #endif - sLog->outChar("Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); + LOG_INFO("entities.player", "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid)); // To prevent hook failure, place hook before removing reference from DB sScriptMgr->OnPlayerDelete(guid, initAccountId); // To prevent race conditioning, but as it also makes sense, we hand the accountId over for successful delete. // Shouldn't interfere with character deletion though - if (sLog->IsOutCharDump()) // optimize GetPlayerDump call + if (sLog->ShouldLog("entities.player.dump", LogLevel::LOG_LEVEL_INFO)) // optimize GetPlayerDump call { std::string dump; - if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump)) - sLog->outCharDump(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); + + if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))\ + LOG_CHAR_DUMP(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str()); } sCalendarMgr->RemoveAllPlayerEventsAndInvites(guid); @@ -757,7 +758,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) { if (PlayerLoading() || GetPlayer() != nullptr) { - sLog->outError("Player tries to login again, AccountId = %d", GetAccountId()); + LOG_ERROR("server", "Player tries to login again, AccountId = %d", GetAccountId()); KickPlayer("Player tries to login again"); return; } @@ -767,7 +768,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid))) { - sLog->outError("Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid)); + LOG_ERROR("server", "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid)); KickPlayer("Account can't login with this character"); return; } @@ -811,14 +812,14 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) { if (limitA == 0 || --limitA == 0) { - sLog->outMisc("HandlePlayerLoginOpcode A"); + LOG_INFO("misc", "HandlePlayerLoginOpcode A"); break; } while (sess->GetPlayer() && sess->GetPlayer()->IsBeingTeleportedFar()) { if (limitB == 0 || --limitB == 0) { - sLog->outMisc("HandlePlayerLoginOpcode B"); + LOG_INFO("misc", "HandlePlayerLoginOpcode B"); break; } sess->HandleMoveWorldportAckOpcode(); @@ -827,7 +828,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData) { if (limitC == 0 || --limitC == 0) { - sLog->outMisc("HandlePlayerLoginOpcode C"); + LOG_INFO("misc", "HandlePlayerLoginOpcode C"); break; } Player* plMover = sess->GetPlayer()->m_mover->ToPlayer(); @@ -919,7 +920,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) chH.PSendSysMessage("%s", GitRevision::GetFullVersion()); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WORLD: Sent server info"); + LOG_DEBUG("server", "WORLD: Sent server info"); #endif } @@ -935,7 +936,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) } else { - sLog->outError("Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), guildId); + LOG_ERROR("server", "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), guildId); pCurrChar->SetInGuild(0); pCurrChar->SetRank(0); } @@ -983,8 +984,6 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation()); } - //sLog->outDebug("Player %s added to Map.", pCurrChar->GetName().c_str()); - // pussywizard: optimization std::string charName = pCurrChar->GetName(); std::transform(charName.begin(), charName.end(), charName.begin(), ::tolower); @@ -1129,7 +1128,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder) SendNotification(LANG_GM_ON); std::string IP_str = GetRemoteAddress(); - sLog->outChar("Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", + LOG_INFO("entities.player", "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d", GetAccountId(), IP_str.c_str(), pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel()); if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED)) @@ -1234,7 +1233,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar) chH.PSendSysMessage("%s", GitRevision::GetFullVersion()); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WORLD: Sent server info"); + LOG_DEBUG("server", "WORLD: Sent server info"); #endif } @@ -1335,7 +1334,7 @@ void WorldSession::HandlePlayerLoginToCharOutOfWorld(Player* /*pCurrChar*/) void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WORLD: Received CMSG_SET_FACTION_ATWAR"); + LOG_DEBUG("server", "WORLD: Received CMSG_SET_FACTION_ATWAR"); #endif uint32 repListID; @@ -1350,7 +1349,7 @@ void WorldSession::HandleSetFactionAtWar(WorldPacket& recvData) //I think this function is never used :/ I dunno, but i guess this opcode not exists void WorldSession::HandleSetFactionCheat(WorldPacket& /*recvData*/) { - sLog->outError("WORLD SESSION: HandleSetFactionCheat, not expected call, please report."); + LOG_ERROR("server", "WORLD SESSION: HandleSetFactionCheat, not expected call, please report."); GetPlayer()->GetReputationMgr().SendStates(); } @@ -1385,7 +1384,7 @@ void WorldSession::HandleTutorialReset(WorldPacket& /*recvData*/) void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WORLD: Received CMSG_SET_WATCHED_FACTION"); + LOG_DEBUG("server", "WORLD: Received CMSG_SET_WATCHED_FACTION"); #endif uint32 fact; recvData >> fact; @@ -1395,7 +1394,7 @@ void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recvData) void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WORLD: Received CMSG_SET_FACTION_INACTIVE"); + LOG_DEBUG("server", "WORLD: Received CMSG_SET_FACTION_INACTIVE"); #endif uint32 replistid; uint8 inactive; @@ -1407,7 +1406,7 @@ void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket& recvData) void WorldSession::HandleShowingHelmOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("CMSG_SHOWING_HELM for %s", _player->GetName().c_str()); + LOG_DEBUG("server", "CMSG_SHOWING_HELM for %s", _player->GetName().c_str()); #endif recvData.read_skip(); // unknown, bool? _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM); @@ -1416,7 +1415,7 @@ void WorldSession::HandleShowingHelmOpcode(WorldPacket& recvData) void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str()); + LOG_DEBUG("server", "CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str()); #endif recvData.read_skip(); // unknown, bool? _player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK); @@ -1519,7 +1518,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu CharacterDatabase.Execute(stmt); } - sLog->outChar("Account: %d (IP: %s), Character [%s] (guid: %u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); + LOG_INFO("entities.player", "Account: %d (IP: %s), Character [%s] (guid: %u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str()); WorldPacket data(SMSG_CHAR_RENAME, 1 + 8 + (newName.size() + 1)); data << uint8(RESPONSE_SUCCESS); @@ -1636,7 +1635,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData) void WorldSession::HandleAlterAppearance(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ALTER_APPEARANCE"); + LOG_DEBUG("network", "CMSG_ALTER_APPEARANCE"); #endif uint32 Hair, Color, FacialHair, SkinColor; @@ -1715,7 +1714,7 @@ void WorldSession::HandleRemoveGlyph(WorldPacket& recvData) if (slot >= MAX_GLYPH_SLOT_INDEX) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot); + LOG_DEBUG("network", "Client sent wrong glyph slot number in opcode CMSG_REMOVE_GLYPH %u", slot); #endif return; } @@ -1739,7 +1738,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) recvData >> guid; if (!IsLegitCharacterForAccount(GUID_LOPART(guid))) { - sLog->outError("Account %u, IP: %s tried to customise character %u, but it does not belong to their account!", + LOG_ERROR("server", "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!", GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid)); recvData.rfinish(); KickPlayer("HandleCharCustomize"); @@ -1836,7 +1835,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) } } - sLog->outChar("Account: %d (IP: %s), Character [%s] (guid: %u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), playerData->name.c_str(), GUID_LOPART(guid), newName.c_str()); + LOG_INFO("entities.player", "Account: %d (IP: %s), Character [%s] (guid: %u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), playerData->name.c_str(), GUID_LOPART(guid), newName.c_str()); Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair); @@ -1877,7 +1876,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData) void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_SAVE"); + LOG_DEBUG("network", "CMSG_EQUIPMENT_SET_SAVE"); #endif uint64 setGuid; @@ -1938,7 +1937,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData) void WorldSession::HandleEquipmentSetDelete(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_DELETE"); + LOG_DEBUG("network", "CMSG_EQUIPMENT_SET_DELETE"); #endif uint64 setGuid; @@ -1950,7 +1949,7 @@ void WorldSession::HandleEquipmentSetDelete(WorldPacket& recvData) void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_USE"); + LOG_DEBUG("network", "CMSG_EQUIPMENT_SET_USE"); #endif for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) @@ -1962,7 +1961,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData) recvData >> srcbag >> srcslot; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); + LOG_DEBUG("entities.player.items", "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); #endif // check if item slot is set to "ignored" (raw value == 1), must not be unequipped then @@ -2044,7 +2043,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) if (!IsLegitCharacterForAccount(GUID_LOPART(guid))) { - sLog->outError("Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!", + LOG_ERROR("server", "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!", GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid)); recvData.rfinish(); KickPlayer("HandleCharFactionOrRaceChange"); @@ -2266,7 +2265,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) stmt->setUInt32(0, lowGuid); trans->Append(stmt); - sLog->outChar("Account: %d (IP: %s), Character [%s] (guid: %u) Changed Race/Faction to: %s", GetAccountId(), GetRemoteAddress().c_str(), playerData->name.c_str(), lowGuid, newname.c_str()); + LOG_INFO("entities.player", "Account: %d (IP: %s), Character [%s] (guid: %u) Changed Race/Faction to: %s", GetAccountId(), GetRemoteAddress().c_str(), playerData->name.c_str(), lowGuid, newname.c_str()); // xinef: update global data sWorld->UpdateGlobalNameData(GUID_LOPART(guid), playerData->name, newname); @@ -2673,7 +2672,6 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData) } std::string IP_str = GetRemoteAddress(); - //sLog->outDebug(LOG_FILTER_PLAYER, "%s (IP: %s) changed race from %u to %u", GetPlayerInfo().c_str(), IP_str.c_str(), oldRace, race); WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1 + 8 + (newname.size() + 1) + 1 + 1 + 1 + 1 + 1 + 1 + 1); data << uint8(RESPONSE_SUCCESS); diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index 6d16e07a94..fc42514556 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -43,15 +43,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) if (type >= MAX_CHAT_MSG_TYPE) { - sLog->outError("CHAT: Wrong message type received: %u", type); + LOG_ERROR("server", "CHAT: Wrong message type received: %u", type); recvData.rfinish(); return; } Player* sender = GetPlayer(); - //sLog->outDebug("CHAT: packet received. type %u, lang %u", type, lang); - // pussywizard: chatting on most chat types requires 2 hours played to prevent spam/abuse if (AccountMgr::IsPlayerAccount(GetSecurity())) switch (type) @@ -145,29 +143,6 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) case CHAT_MSG_RAID: case CHAT_MSG_GUILD: case CHAT_MSG_BATTLEGROUND: - // check if addon messages are disabled - if (!sWorld->getBoolConfig(CONFIG_ADDON_CHANNEL)) - { - recvData.rfinish(); - return; - } - - if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - { - std::string msg; - recvData >> msg; - - if (msg.empty()) - return; - - sScriptMgr->OnPlayerChat(sender, type, lang, msg); -#ifdef ELUNA - if (!sEluna->OnChat(sender, type, lang, msg)) - return; -#endif - } - - break; case CHAT_MSG_WHISPER: // check if addon messages are disabled if (!sWorld->getBoolConfig(CONFIG_ADDON_CHANNEL)) @@ -175,19 +150,10 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) recvData.rfinish(); return; } - - if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - { - std::string to, msg; - recvData >> to >> msg; - if (msg.empty()) - return; - } - break; default: - sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination", - GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); + LOG_ERROR("network", "Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination", + GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); recvData.rfinish(); return; @@ -310,7 +276,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) { if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && !ChatHandler(this).isValidChatMessage(msg.c_str())) { - //sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName().c_str(), + //LOG_ERROR("server", "Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName().c_str(), // GetPlayer()->GetGUIDLow(), msg.c_str()); if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK)) @@ -646,7 +612,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) break; } default: - sLog->outError("CHAT: unknown message type %u, lang: %u", type, lang); + LOG_ERROR("server", "CHAT: unknown message type %u, lang: %u", type, lang); break; } } @@ -773,7 +739,6 @@ void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData) { uint64 iguid; uint8 unk; - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_CHAT_IGNORED"); recvData >> iguid; recvData >> unk; // probably related to spam reporting @@ -793,7 +758,7 @@ void WorldSession::HandleChannelDeclineInvite(WorldPacket& recvPacket) UNUSED(recvPacket); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); + LOG_DEBUG("network", "Opcode %u", recvPacket.GetOpcode()); #endif } diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp index 73759bd86c..06cbbd77cc 100644 --- a/src/server/game/Handlers/CombatHandler.cpp +++ b/src/server/game/Handlers/CombatHandler.cpp @@ -22,7 +22,7 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData) recvData >> guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid)); + LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid)); #endif Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid); @@ -68,11 +68,9 @@ void WorldSession::HandleSetSheathedOpcode(WorldPacket& recvData) uint32 sheathed; recvData >> sheathed; - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Recvd CMSG_SETSHEATHED Message guidlow:%u value1:%u", GetPlayer()->GetGUIDLow(), sheathed); - if (sheathed >= MAX_SHEATH_STATE) { - sLog->outError("Unknown sheath state %u ??", sheathed); + LOG_ERROR("server", "Unknown sheath state %u ??", sheathed); return; } diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp index 67ec793494..c4e102f279 100644 --- a/src/server/game/Handlers/DuelHandler.cpp +++ b/src/server/game/Handlers/DuelHandler.cpp @@ -29,10 +29,9 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0) return; - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED"); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName().c_str()); - sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str()); + LOG_DEBUG("server", "Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName().c_str()); + LOG_DEBUG("server", "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str()); #endif time_t now = time(nullptr); @@ -46,7 +45,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DUEL_CANCELLED"); + LOG_DEBUG("network", "WORLD: Received CMSG_DUEL_CANCELLED"); #endif uint64 guid; recvPacket >> guid; diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 0920474e6d..cac059de7b 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -50,7 +50,7 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string& void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_INVITE"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_INVITE"); #endif std::string membername; @@ -210,7 +210,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData) void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ACCEPT"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_ACCEPT"); #endif recvData.read_skip(); @@ -233,7 +233,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData) if (group->GetLeaderGUID() == GetPlayer()->GetGUID()) { - sLog->outError("HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); + LOG_ERROR("server", "HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } @@ -273,7 +273,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData) void WorldSession::HandleGroupDeclineOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DECLINE"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_DECLINE"); #endif Group* group = GetPlayer()->GetGroupInvite(); @@ -298,7 +298,7 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_UNINVITE_GUID"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE_GUID"); #endif uint64 guid; @@ -309,7 +309,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) //can't uninvite yourself if (guid == GetPlayer()->GetGUID()) { - sLog->outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); + LOG_ERROR("server", "WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } @@ -358,7 +358,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData) void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_UNINVITE"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE"); #endif std::string membername; @@ -371,7 +371,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData) // can't uninvite yourself if (GetPlayer()->GetName() == membername) { - sLog->outError("WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); + LOG_ERROR("server", "WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); return; } @@ -404,7 +404,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData) void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_SET_LEADER"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_SET_LEADER"); #endif uint64 guid; @@ -427,7 +427,7 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData) void WorldSession::HandleGroupDisbandOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DISBAND"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_DISBAND"); #endif Group* grp = GetPlayer()->GetGroup(); @@ -452,7 +452,7 @@ void WorldSession::HandleGroupDisbandOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_LOOT_METHOD"); + LOG_DEBUG("network", "WORLD: Received CMSG_LOOT_METHOD"); #endif uint32 lootMethod; @@ -515,7 +515,7 @@ void WorldSession::HandleLootRoll(WorldPacket& recvData) void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_MINIMAP_PING"); + LOG_DEBUG("network", "WORLD: Received MSG_MINIMAP_PING"); #endif if (!GetPlayer()->GetGroup()) @@ -525,8 +525,6 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData) recvData >> x; recvData >> y; - //sLog->outDebug("Received opcode MSG_MINIMAP_PING X: %f, Y: %f", x, y); - /** error handling **/ /********************/ @@ -541,7 +539,7 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData) void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RANDOM_ROLL"); + LOG_DEBUG("network", "WORLD: Received MSG_RANDOM_ROLL"); #endif uint32 minimum, maximum, roll; @@ -556,8 +554,6 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData) // everything's fine, do it roll = urand(minimum, maximum); - //sLog->outDebug("ROLL: MIN: %u, MAX: %u, ROLL: %u", minimum, maximum, roll); - WorldPacket data(MSG_RANDOM_ROLL, 4 + 4 + 4 + 8); data << uint32(minimum); data << uint32(maximum); @@ -572,7 +568,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData) void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RAID_TARGET_UPDATE"); + LOG_DEBUG("network", "WORLD: Received MSG_RAID_TARGET_UPDATE"); #endif Group* group = GetPlayer()->GetGroup(); @@ -613,7 +609,7 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData) void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_RAID_CONVERT"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_RAID_CONVERT"); #endif Group* group = GetPlayer()->GetGroup(); @@ -636,7 +632,7 @@ void WorldSession::HandleGroupRaidConvertOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_CHANGE_SUB_GROUP"); #endif // we will get correct pointer for group here, so we don't have to check if group is BG raid @@ -677,7 +673,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData) void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_ASSISTANT_LEADER"); + LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_ASSISTANT_LEADER"); #endif Group* group = GetPlayer()->GetGroup(); @@ -700,7 +696,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData) void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_PARTY_ASSIGNMENT"); + LOG_DEBUG("network", "WORLD: Received MSG_PARTY_ASSIGNMENT"); #endif Group* group = GetPlayer()->GetGroup(); @@ -736,7 +732,7 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData) void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_RAID_READY_CHECK"); + LOG_DEBUG("network", "WORLD: Received MSG_RAID_READY_CHECK"); #endif Group* group = GetPlayer()->GetGroup(); @@ -981,7 +977,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke /*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS"); + LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS"); uint64 Guid; recvData >> Guid; @@ -1114,23 +1110,16 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData) SendPacket(&data); } -/*!*/void WorldSession::HandleRequestRaidInfoOpcode(WorldPacket& /*recvData*/) +void WorldSession::HandleRequestRaidInfoOpcode(WorldPacket& /*recvData*/) { // every time the player checks the character screen _player->SendRaidInfo(); } -/*void WorldSession::HandleGroupCancelOpcode(WorldPacket & recvData) -{ -#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug("WORLD: got CMSG_GROUP_CANCEL."); -#endif -}*/ - void WorldSession::HandleOptOutOfLootOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_OPT_OUT_OF_LOOT"); + LOG_DEBUG("network", "WORLD: Received CMSG_OPT_OUT_OF_LOOT"); #endif uint32 passOnLoot; diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index 42782f8f17..a424e26f3a 100644 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.cpp @@ -28,7 +28,7 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket) recvPacket >> guildId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_QUERY [%s]: Guild: %u", GetPlayerInfo().c_str(), guildId); + LOG_DEBUG("guild", "CMSG_GUILD_QUERY [%s]: Guild: %u", GetPlayerInfo().c_str(), guildId); #endif if (!guildId) return; @@ -42,7 +42,7 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket) std::string name; recvPacket >> name; - sLog->outError("CMSG_GUILD_CREATE: Possible hacking-attempt: %s tried to create a guild [Name: %s] using cheats", GetPlayerInfo().c_str(), name.c_str()); + LOG_ERROR("server", "CMSG_GUILD_CREATE: Possible hacking-attempt: %s tried to create a guild [Name: %s] using cheats", GetPlayerInfo().c_str(), name.c_str()); } void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) @@ -51,7 +51,7 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) recvPacket >> invitedName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_INVITE [%s]: Invited: %s", GetPlayerInfo().c_str(), invitedName.c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_INVITE [%s]: Invited: %s", GetPlayerInfo().c_str(), invitedName.c_str()); #endif if (normalizePlayerName(invitedName)) if (Guild* guild = GetPlayer()->GetGuild()) @@ -64,7 +64,7 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) recvPacket >> playerName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_REMOVE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_REMOVE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); #endif if (normalizePlayerName(playerName)) @@ -75,7 +75,7 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_ACCEPT [%s]", GetPlayer()->GetName().c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_ACCEPT [%s]", GetPlayer()->GetName().c_str()); #endif if (!GetPlayer()->GetGuildId()) @@ -86,7 +86,7 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_DECLINE [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_DECLINE [%s]", GetPlayerInfo().c_str()); #endif GetPlayer()->SetGuildIdInvited(0); @@ -96,7 +96,7 @@ void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_INFO [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_INFO [%s]", GetPlayerInfo().c_str()); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -106,7 +106,7 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_ROSTER [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_ROSTER [%s]", GetPlayerInfo().c_str()); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -121,7 +121,7 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) recvPacket >> playerName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_PROMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_PROMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); #endif if (normalizePlayerName(playerName)) @@ -135,7 +135,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) recvPacket >> playerName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_DEMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_DEMOTE [%s]: Target: %s", GetPlayerInfo().c_str(), playerName.c_str()); #endif if (normalizePlayerName(playerName)) @@ -146,7 +146,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_LEAVE [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_LEAVE [%s]", GetPlayerInfo().c_str()); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -156,7 +156,7 @@ void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_DISBAND [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_DISBAND [%s]", GetPlayerInfo().c_str()); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -169,7 +169,7 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) recvPacket >> name; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_LEADER [%s]: Target: %s", GetPlayerInfo().c_str(), name.c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_LEADER [%s]: Target: %s", GetPlayerInfo().c_str(), name.c_str()); #endif if (normalizePlayerName(name)) @@ -183,7 +183,7 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket) recvPacket >> motd; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_MOTD [%s]: MOTD: %s", GetPlayerInfo().c_str(), motd.c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_MOTD [%s]: MOTD: %s", GetPlayerInfo().c_str(), motd.c_str()); #endif // Check for overflow @@ -204,7 +204,7 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) recvPacket >> playerName >> note; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_SET_PUBLIC_NOTE [%s]: Target: %s, Note: %s", GetPlayerInfo().c_str(), playerName.c_str(), note.c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_SET_PUBLIC_NOTE [%s]: Target: %s, Note: %s", GetPlayerInfo().c_str(), playerName.c_str(), note.c_str()); #endif // Check for overflow @@ -226,7 +226,7 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket) recvPacket >> playerName >> note; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_SET_OFFICER_NOTE [%s]: Target: %s, Note: %s", + LOG_DEBUG("guild", "CMSG_GUILD_SET_OFFICER_NOTE [%s]: Target: %s, Note: %s", GetPlayerInfo().c_str(), playerName.c_str(), note.c_str()); #endif @@ -257,7 +257,7 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket) recvPacket >> money; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_RANK [%s]: Rank: %s (%u)", GetPlayerInfo().c_str(), rankName.c_str(), rankId); + LOG_DEBUG("guild", "CMSG_GUILD_RANK [%s]: Rank: %s (%u)", GetPlayerInfo().c_str(), rankName.c_str(), rankId); #endif Guild* guild = GetPlayer()->GetGuild(); @@ -296,7 +296,7 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) recvPacket >> rankName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_ADD_RANK [%s]: Rank: %s", GetPlayerInfo().c_str(), rankName.c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_ADD_RANK [%s]: Rank: %s", GetPlayerInfo().c_str(), rankName.c_str()); #endif // Check for overflow @@ -313,7 +313,7 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_DEL_RANK [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_DEL_RANK [%s]", GetPlayerInfo().c_str()); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -326,7 +326,7 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket) recvPacket >> info; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_INFO_TEXT [%s]: %s", GetPlayerInfo().c_str(), info.c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_INFO_TEXT [%s]: %s", GetPlayerInfo().c_str(), info.c_str()); #endif // Check for overflow @@ -349,7 +349,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) emblemInfo.ReadPacket(recvPacket); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD + LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD "] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d" , GetPlayerInfo().c_str(), vendorGuid, emblemInfo.GetStyle() , emblemInfo.GetColor(), emblemInfo.GetBorderStyle() @@ -373,7 +373,7 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_EVENT_LOG_QUERY [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "MSG_GUILD_EVENT_LOG_QUERY [%s]", GetPlayerInfo().c_str()); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -383,7 +383,7 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket& /* recvData */) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "MSG_GUILD_BANK_MONEY_WITHDRAWN [%s]", GetPlayerInfo().c_str()); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -393,7 +393,7 @@ void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket& /* recvData */) void WorldSession::HandleGuildPermissions(WorldPacket& /* recvData */) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_PERMISSIONS [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "MSG_GUILD_PERMISSIONS [%s]", GetPlayerInfo().c_str()); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -408,7 +408,7 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData) recvData >> guid >> sendAllSlots; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u" + LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u" , GetPlayerInfo().c_str(), guid, sendAllSlots); #endif Guild* const guild = GetPlayer()->GetGuild(); @@ -431,7 +431,7 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData) recvData >> guid >> tabId >> full; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, ShowTabs: %u" + LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, ShowTabs: %u" , GetPlayerInfo().c_str(), guid, tabId, full); #endif if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -446,7 +446,7 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData) recvData >> guid >> money; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u", + LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u", GetPlayerInfo().c_str(), guid, money); #endif if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -462,7 +462,7 @@ void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData) recvData >> guid >> money; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: %u", + LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: %u", GetPlayerInfo().c_str(), guid, money); #endif if (money && GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -473,7 +473,7 @@ void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData) void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str()); + LOG_DEBUG("guild", "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str()); #endif uint64 GoGuid; @@ -561,7 +561,7 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData) recvData >> guid >> tabId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u", GetPlayerInfo().c_str(), guid, tabId); + LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u", GetPlayerInfo().c_str(), guid, tabId); #endif if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK)) @@ -578,7 +578,7 @@ void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recvData) recvData >> guid >> tabId >> name >> icon; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s" + LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s" , GetPlayerInfo().c_str(), guid, tabId, name.c_str(), icon.c_str()); #endif @@ -601,7 +601,7 @@ void WorldSession::HandleGuildBankLogQuery(WorldPacket& recvData) recvData >> tabId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_GUILD_BANK_LOG_QUERY [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId); + LOG_DEBUG("guild", "MSG_GUILD_BANK_LOG_QUERY [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -614,7 +614,7 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket& recvData) recvData >> tabId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "MSG_QUERY_GUILD_BANK_TEXT [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId); + LOG_DEBUG("guild", "MSG_QUERY_GUILD_BANK_TEXT [%s]: TabId: %u", GetPlayerInfo().c_str(), tabId); #endif if (Guild* guild = GetPlayer()->GetGuild()) @@ -628,7 +628,7 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket& recvData) recvData >> tabId >> text; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_GUILD, "CMSG_SET_GUILD_BANK_TEXT [%s]: TabId: %u, Text: %s", GetPlayerInfo().c_str(), tabId, text.c_str()); + LOG_DEBUG("guild", "CMSG_SET_GUILD_BANK_TEXT [%s]: TabId: %u, Text: %s", GetPlayerInfo().c_str(), tabId, text.c_str()); #endif // Check for overflow diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp index 205c73ba4e..049cc3a634 100644 --- a/src/server/game/Handlers/ItemHandler.cpp +++ b/src/server/game/Handlers/ItemHandler.cpp @@ -19,12 +19,11 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket& recvData) { - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SPLIT_ITEM"); + //LOG_DEBUG("network.opcode", "WORLD: CMSG_SPLIT_ITEM"); uint8 srcbag, srcslot, dstbag, dstslot; uint32 count; recvData >> srcbag >> srcslot >> dstbag >> dstslot >> count; - //sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u, dstslot = %u, count = %u", srcbag, srcslot, dstbag, dstslot, count); uint16 src = ((srcbag << 8) | srcslot); uint16 dst = ((dstbag << 8) | dstslot); @@ -52,11 +51,10 @@ void WorldSession::HandleSplitItemOpcode(WorldPacket& recvData) void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData) { - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_INV_ITEM"); + //LOG_DEBUG("network.opcode", "WORLD: CMSG_SWAP_INV_ITEM"); uint8 srcslot, dstslot; recvData >> dstslot >> srcslot; - //sLog->outDebug("STORAGE: receive srcslot = %u, dstslot = %u", srcslot, dstslot); // prevent attempt swap same item to current position generated by client at special checting sequence if (srcslot == dstslot) @@ -113,11 +111,10 @@ void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData) void WorldSession::HandleSwapItem(WorldPacket& recvData) { - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_SWAP_ITEM"); + //LOG_DEBUG("network.opcode", "WORLD: CMSG_SWAP_ITEM"); uint8 dstbag, dstslot, srcbag, srcslot; recvData >> dstbag >> dstslot >> srcbag >> srcslot; - //sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u, dstslot = %u", srcbag, srcslot, dstbag, dstslot); uint16 src = ((srcbag << 8) | srcslot); uint16 dst = ((dstbag << 8) | dstslot); @@ -155,11 +152,10 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData) void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData) { - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOEQUIP_ITEM"); + //LOG_DEBUG("network.opcode", "WORLD: CMSG_AUTOEQUIP_ITEM"); uint8 srcbag, srcslot; recvData >> srcbag >> srcslot; - //sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); Item* pSrcItem = _player->GetItemByPos(srcbag, srcslot); if (!pSrcItem) @@ -252,11 +248,10 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket& recvData) void WorldSession::HandleDestroyItemOpcode(WorldPacket& recvData) { - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_DESTROYITEM"); + //LOG_DEBUG("network.opcode", "WORLD: CMSG_DESTROYITEM"); uint8 bag, slot, count, data1, data2, data3; recvData >> bag >> slot >> count >> data1 >> data2 >> data3; - //sLog->outDebug("STORAGE: receive bag = %u, slot = %u, count = %u", bag, slot, count); uint16 pos = (bag << 8) | slot; @@ -427,12 +422,12 @@ void ItemTemplate::InitializeQueryData() // Only _static_ data send in this packet !!! void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData) { - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_ITEM_QUERY_SINGLE"); + //LOG_DEBUG("network.opcode", "WORLD: CMSG_ITEM_QUERY_SINGLE"); uint32 item; recvData >> item; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("STORAGE: Item Query = %u", item); + LOG_DEBUG("server", "STORAGE: Item Query = %u", item); #endif ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); @@ -580,7 +575,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item); + LOG_DEBUG("network", "WORLD: CMSG_ITEM_QUERY_SINGLE - NO item INFO! (ENTRY: %u)", item); #endif WorldPacket queryData(SMSG_ITEM_QUERY_SINGLE_RESPONSE, 4); queryData << uint32(item | 0x80000000); @@ -590,12 +585,12 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket& recvData) void WorldSession::HandleReadItem(WorldPacket& recvData) { - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_READ_ITEM"); + //LOG_DEBUG("network.opcode", "WORLD: CMSG_READ_ITEM"); uint8 bag, slot; recvData >> bag >> slot; - //sLog->outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot); + //LOG_DEBUG("server", "STORAGE: Read bag = %u, slot = %u", bag, slot); Item* pItem = _player->GetItemByPos(bag, slot); if (pItem && pItem->GetTemplate()->PageText) @@ -607,14 +602,14 @@ void WorldSession::HandleReadItem(WorldPacket& recvData) { data.Initialize (SMSG_READ_ITEM_OK, 8); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("STORAGE: Item page sent"); + LOG_DEBUG("server", "STORAGE: Item page sent"); #endif } else { data.Initialize(SMSG_READ_ITEM_FAILED, 8); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("STORAGE: Unable to read item"); + LOG_DEBUG("server", "STORAGE: Unable to read item"); #endif _player->SendEquipError(msg, pItem, nullptr); } @@ -628,7 +623,7 @@ void WorldSession::HandleReadItem(WorldPacket& recvData) void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SELL_ITEM"); + LOG_DEBUG("network", "WORLD: Received CMSG_SELL_ITEM"); #endif uint64 vendorguid, itemguid; uint32 count; @@ -642,7 +637,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); + LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); #endif _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, itemguid, 0); return; @@ -719,7 +714,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) Item* pNewItem = pItem->CloneItem(count, _player); if (!pNewItem) { - sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count); + LOG_ERROR("server", "WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count); _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0); return; } @@ -759,7 +754,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData) void WorldSession::HandleBuybackItem(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUYBACK_ITEM"); + LOG_DEBUG("network", "WORLD: Received CMSG_BUYBACK_ITEM"); #endif uint64 vendorguid; uint32 slot; @@ -770,7 +765,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData) if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); + LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); #endif _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, 0, 0); return; @@ -820,7 +815,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData) void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM_IN_SLOT"); + LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM_IN_SLOT"); #endif uint64 vendorguid, bagguid; uint32 item, slot, count; @@ -864,7 +859,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData) void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUY_ITEM"); + LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM"); #endif uint64 vendorguid; uint32 item, slot, count; @@ -891,7 +886,7 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LIST_INVENTORY"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_LIST_INVENTORY"); #endif SendListInventory(guid); @@ -900,14 +895,14 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData) void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LIST_INVENTORY"); + LOG_DEBUG("network", "WORLD: Sent SMSG_LIST_INVENTORY"); #endif Creature* vendor = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid, UNIT_NPC_FLAG_VENDOR); if (!vendor) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorGuid))); + LOG_DEBUG("network", "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorGuid))); #endif _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, 0, 0); return; @@ -967,7 +962,7 @@ void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry) if (!sConditionMgr->IsObjectMeetToConditions(_player, vendor, conditions)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SendListInventory: conditions not met for creature entry %u item %u", vendor->GetEntry(), item->item); + LOG_DEBUG("network", "SendListInventory: conditions not met for creature entry %u item %u", vendor->GetEntry(), item->item); #endif continue; } @@ -1003,11 +998,10 @@ void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry) void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData) { - //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_AUTOSTORE_BAG_ITEM"); + //LOG_DEBUG("network.opcode", "WORLD: CMSG_AUTOSTORE_BAG_ITEM"); uint8 srcbag, srcslot, dstbag; recvData >> srcbag >> srcslot >> dstbag; - //sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag); Item* pItem = _player->GetItemByPos(srcbag, srcslot); if (!pItem) @@ -1056,7 +1050,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket& recvData) void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BUY_BANK_SLOT"); + LOG_DEBUG("network", "WORLD: CMSG_BUY_BANK_SLOT"); #endif uint64 guid; @@ -1074,7 +1068,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) ++slot; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("PLAYER: Buy bank bag slot, slot number = %u", slot); + LOG_DEBUG("server", "PLAYER: Buy bank bag slot, slot number = %u", slot); #endif BankBagSlotPricesEntry const* slotEntry = sBankBagSlotPricesStore.LookupEntry(slot); @@ -1109,13 +1103,13 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AUTOBANK_ITEM"); + LOG_DEBUG("network", "WORLD: CMSG_AUTOBANK_ITEM"); #endif uint8 srcbag, srcslot; recvPacket >> srcbag >> srcslot; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); + LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); #endif if (!CanUseBank()) @@ -1151,13 +1145,13 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AUTOSTORE_BANK_ITEM"); + LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_BANK_ITEM"); #endif uint8 srcbag, srcslot; recvPacket >> srcbag >> srcslot; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); + LOG_DEBUG("network", "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); #endif if (!CanUseBank()) @@ -1209,7 +1203,7 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_AMMO"); + LOG_DEBUG("network", "WORLD: CMSG_SET_AMMO"); #endif uint32 item; @@ -1257,7 +1251,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData) recvData.read_skip(); // guid #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_NAME_QUERY %u", itemid); + LOG_DEBUG("network", "WORLD: CMSG_ITEM_NAME_QUERY %u", itemid); #endif ItemSetNameEntry const* pName = sObjectMgr->GetItemSetNameEntry(itemid); if (pName) @@ -1279,7 +1273,7 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket& recvData) void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_WRAP_ITEM"); + LOG_DEBUG("network", "Received opcode CMSG_WRAP_ITEM"); #endif uint8 gift_bag, gift_slot, item_bag, item_slot; @@ -1288,7 +1282,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) recvData >> item_bag >> item_slot; // item #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot); + LOG_DEBUG("network", "WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot); #endif Item* gift = _player->GetItemByPos(gift_bag, gift_slot); @@ -1410,7 +1404,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData) void WorldSession::HandleSocketOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SOCKET_GEMS"); + LOG_DEBUG("network", "WORLD: CMSG_SOCKET_GEMS"); #endif uint64 item_guid; @@ -1610,7 +1604,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData) void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT"); + LOG_DEBUG("network", "WORLD: CMSG_CANCEL_TEMP_ENCHANTMENT"); #endif uint32 eslot; @@ -1636,7 +1630,7 @@ void WorldSession::HandleCancelTempEnchantmentOpcode(WorldPacket& recvData) void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_REFUND_INFO"); + LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND_INFO"); #endif uint64 guid; @@ -1646,7 +1640,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData) if (!item) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Item refund: item not found!"); + LOG_DEBUG("network", "Item refund: item not found!"); #endif return; } @@ -1657,7 +1651,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData) void WorldSession::HandleItemRefund(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_REFUND"); + LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND"); #endif uint64 guid; recvData >> guid; // item guid @@ -1666,7 +1660,7 @@ void WorldSession::HandleItemRefund(WorldPacket& recvData) if (!item) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Item refund: item not found!"); + LOG_DEBUG("network", "Item refund: item not found!"); #endif return; } @@ -1689,7 +1683,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket& recvData ) recvData >> itemGuid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid)); + LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid)); #endif WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, 50); // guess size diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index 364bceeffe..428550e45b 100644 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -57,7 +57,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) if (!numDungeons) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] no dungeons selected", GetPlayer()->GetGUID()); + LOG_DEBUG("network", "CMSG_LFG_JOIN [" UI64FMTD "] no dungeons selected", GetPlayer()->GetGUID()); #endif recvData.rfinish(); return; @@ -78,7 +78,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData) std::string comment; recvData >> comment; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str()); + LOG_DEBUG("network", "CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str()); #endif sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment); @@ -91,7 +91,7 @@ void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/) uint64 gguid = group ? group->GetGUID() : guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_LEAVE [" UI64FMTD "] in group: %u", guid, group ? 1 : 0); + LOG_DEBUG("network", "CMSG_LFG_LEAVE [" UI64FMTD "] in group: %u", guid, group ? 1 : 0); #endif // Check cheating - only leader can leave the queue @@ -110,7 +110,7 @@ void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData) recvData >> accept; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_PROPOSAL_RESULT [" UI64FMTD "] proposal: %u accept: %u", GetPlayer()->GetGUID(), proposalID, accept ? 1 : 0); + LOG_DEBUG("network", "CMSG_LFG_PROPOSAL_RESULT [" UI64FMTD "] proposal: %u accept: %u", GetPlayer()->GetGUID(), proposalID, accept ? 1 : 0); #endif sLFGMgr->UpdateProposal(proposalID, GetPlayer()->GetGUID(), accept); } @@ -124,13 +124,13 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData) if (!group) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_SET_ROLES [" UI64FMTD "] Not in group", guid); + LOG_DEBUG("network", "CMSG_LFG_SET_ROLES [" UI64FMTD "] Not in group", guid); #endif return; } uint64 gguid = group->GetGUID(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_SET_ROLES: Group [" UI64FMTD "], Player [" UI64FMTD "], Roles: %u", gguid, guid, roles); + LOG_DEBUG("network", "CMSG_LFG_SET_ROLES: Group [" UI64FMTD "], Player [" UI64FMTD "], Roles: %u", gguid, guid, roles); #endif sLFGMgr->UpdateRoleCheck(gguid, guid, roles); } @@ -141,7 +141,7 @@ void WorldSession::HandleLfgSetCommentOpcode(WorldPacket& recvData) recvData >> comment; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) uint64 guid = GetPlayer()->GetGUID(); - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_SET_COMMENT [" UI64FMTD "] comment: %s", guid, comment.c_str()); + LOG_DEBUG("network", "CMSG_LFG_SET_COMMENT [" UI64FMTD "] comment: %s", guid, comment.c_str()); #endif sLFGMgr->SetComment(GetPlayer()->GetGUID(), comment); @@ -155,7 +155,7 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData) uint64 guid = GetPlayer()->GetGUID(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_SET_BOOT_VOTE [" UI64FMTD "] agree: %u", guid, agree ? 1 : 0); + LOG_DEBUG("network", "CMSG_LFG_SET_BOOT_VOTE [" UI64FMTD "] agree: %u", guid, agree ? 1 : 0); #endif sLFGMgr->UpdateBoot(guid, agree); } @@ -166,7 +166,7 @@ void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData) recvData >> out; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_TELEPORT [" UI64FMTD "] out: %u", GetPlayer()->GetGUID(), out ? 1 : 0); + LOG_DEBUG("network", "CMSG_LFG_TELEPORT [" UI64FMTD "] out: %u", GetPlayer()->GetGUID(), out ? 1 : 0); #endif sLFGMgr->TeleportPlayer(GetPlayer(), out, true); } @@ -175,7 +175,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData* { uint64 guid = GetPlayer()->GetGUID(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); + LOG_DEBUG("network", "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); #endif // Get Random dungeons that can be done at a certain level and expansion @@ -190,7 +190,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData* uint32 lsize = uint32(lock.size()); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid); + LOG_DEBUG("network", "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid); #endif WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4)); @@ -250,7 +250,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData* { uint64 guid = GetPlayer()->GetGUID(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LFG_PARTY_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); + LOG_DEBUG("network", "CMSG_LFG_PARTY_LOCK_INFO_REQUEST [" UI64FMTD "]", guid); #endif Group* group = GetPlayer()->GetGroup(); @@ -278,7 +278,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData* size += 8 + 4 + uint32(it->second.size()) * (4 + 4); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PARTY_INFO [" UI64FMTD "]", guid); + LOG_DEBUG("network", "SMSG_LFG_PARTY_INFO [" UI64FMTD "]", guid); #endif WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size); BuildPartyLockDungeonBlock(data, lockMap); @@ -304,7 +304,7 @@ void WorldSession::HandleLfrSearchLeaveOpcode(WorldPacket& recvData) void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); + LOG_DEBUG("lfg", "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str()); #endif uint64 guid = GetPlayer()->GetGUID(); @@ -343,7 +343,7 @@ void WorldSession::SendLfgUpdatePlayer(lfg::LfgUpdateData const& updateData) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u", + LOG_DEBUG("lfg", "SMSG_LFG_UPDATE_PLAYER %s updatetype: %u", GetPlayerInfo().c_str(), updateData.updateType); #endif WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); @@ -386,7 +386,7 @@ void WorldSession::SendLfgUpdateParty(lfg::LfgUpdateData const& updateData) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_UPDATE_PARTY %s updatetype: %u", + LOG_DEBUG("lfg", "SMSG_LFG_UPDATE_PARTY %s updatetype: %u", GetPlayerInfo().c_str(), updateData.updateType); #endif WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (size > 0 ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length())); @@ -412,7 +412,7 @@ void WorldSession::SendLfgUpdateParty(lfg::LfgUpdateData const& updateData) void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_ROLE_CHOSEN [" UI64FMTD "] guid: [" UI64FMTD "] roles: %u", GetPlayer()->GetGUID(), guid, roles); + LOG_DEBUG("network", "SMSG_LFG_ROLE_CHOSEN [" UI64FMTD "] guid: [" UI64FMTD "] roles: %u", GetPlayer()->GetGUID(), guid, roles); #endif WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4); @@ -431,7 +431,7 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck) dungeons = roleCheck.dungeons; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_ROLE_CHECK_UPDATE [" UI64FMTD "]", GetPlayer()->GetGUID()); + LOG_DEBUG("network", "SMSG_LFG_ROLE_CHECK_UPDATE [" UI64FMTD "]", GetPlayer()->GetGUID()); #endif WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + roleCheck.roles.size() * (8 + 1 + 4 + 1)); @@ -478,7 +478,7 @@ void WorldSession::SendLfgJoinResult(lfg::LfgJoinResultData const& joinData) size += 8 + 4 + uint32(it->second.size()) * (4 + 4); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_JOIN_RESULT [" UI64FMTD "] checkResult: %u checkValue: %u", GetPlayer()->GetGUID(), joinData.result, joinData.state); + LOG_DEBUG("network", "SMSG_LFG_JOIN_RESULT [" UI64FMTD "] checkResult: %u checkValue: %u", GetPlayer()->GetGUID(), joinData.result, joinData.state); #endif WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size); data << uint32(joinData.result); // Check Result @@ -491,7 +491,7 @@ void WorldSession::SendLfgJoinResult(lfg::LfgJoinResultData const& joinData) void WorldSession::SendLfgQueueStatus(lfg::LfgQueueStatusData const& queueData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_QUEUE_STATUS [" UI64FMTD "] dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u", + LOG_DEBUG("network", "SMSG_LFG_QUEUE_STATUS [" UI64FMTD "] dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u", GetPlayer()->GetGUID(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps); #endif WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 + 4 + 1 + 1 + 1 + 4); @@ -513,7 +513,7 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat if (!rewardData.rdungeonEntry || !rewardData.sdungeonEntry || !rewardData.quest) return; - sLog->outDebug(LOG_FILTER_LFG, "SMSG_LFG_PLAYER_REWARD %s rdungeonEntry: %u, sdungeonEntry: %u, done: %u", + LOG_DEBUG("lfg", "SMSG_LFG_PLAYER_REWARD %s rdungeonEntry: %u, sdungeonEntry: %u, done: %u", GetPlayerInfo().c_str(), rewardData.rdungeonEntry, rewardData.sdungeonEntry, rewardData.done); uint8 itemNum = rewardData.quest->GetRewItemsCount(); @@ -559,7 +559,7 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot) } } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_BOOT_PROPOSAL_UPDATE [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s", + LOG_DEBUG("network", "SMSG_LFG_BOOT_PROPOSAL_UPDATE [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s", guid, uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING), uint8(playerVote == lfg::LFG_ANSWER_AGREE), boot.victim, votesNum, agreeNum, secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str()); #endif WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length()); @@ -583,7 +583,7 @@ void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal) uint32 dungeonEntry = proposal.dungeonId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_PROPOSAL_UPDATE [" UI64FMTD "] state: %u", guid, proposal.state); + LOG_DEBUG("network", "SMSG_LFG_PROPOSAL_UPDATE [" UI64FMTD "] state: %u", guid, proposal.state); #endif // show random dungeon if player selected random dungeon and it's not lfg group @@ -628,7 +628,7 @@ void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal) void WorldSession::SendLfgLfrList(bool update) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_LFR_LIST [" UI64FMTD "] update: %u", GetPlayer()->GetGUID(), update ? 1 : 0); + LOG_DEBUG("network", "SMSG_LFG_LFR_LIST [" UI64FMTD "] update: %u", GetPlayer()->GetGUID(), update ? 1 : 0); #endif WorldPacket data(SMSG_LFG_UPDATE_SEARCH, 1); data << uint8(update); // In Lfg Queue? @@ -638,7 +638,7 @@ void WorldSession::SendLfgLfrList(bool update) void WorldSession::SendLfgDisabled() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_DISABLED [" UI64FMTD "]", GetPlayer()->GetGUID()); + LOG_DEBUG("network", "SMSG_LFG_DISABLED [" UI64FMTD "]", GetPlayer()->GetGUID()); #endif WorldPacket data(SMSG_LFG_DISABLED, 0); SendPacket(&data); @@ -647,7 +647,7 @@ void WorldSession::SendLfgDisabled() void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_OFFER_CONTINUE [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), dungeonEntry); + LOG_DEBUG("network", "SMSG_LFG_OFFER_CONTINUE [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), dungeonEntry); #endif WorldPacket data(SMSG_LFG_OFFER_CONTINUE, 4); data << uint32(dungeonEntry); @@ -657,7 +657,7 @@ void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry) void WorldSession::SendLfgTeleportError(uint8 err) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_LFG_TELEPORT_DENIED [" UI64FMTD "] reason: %u", GetPlayer()->GetGUID(), err); + LOG_DEBUG("network", "SMSG_LFG_TELEPORT_DENIED [" UI64FMTD "] reason: %u", GetPlayer()->GetGUID(), err); #endif WorldPacket data(SMSG_LFG_TELEPORT_DENIED, 4); data << uint32(err); // Error diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index 72cfad8de3..16acd2f7b9 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -28,7 +28,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AUTOSTORE_LOOT_ITEM"); + LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_LOOT_ITEM"); #endif Player* player = GetPlayer(); uint64 lguid = player->GetLootGUID(); @@ -100,7 +100,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData) void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_MONEY"); + LOG_DEBUG("network", "WORLD: CMSG_LOOT_MONEY"); #endif Player* player = GetPlayer(); @@ -222,7 +222,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleLootOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT"); + LOG_DEBUG("network", "WORLD: CMSG_LOOT"); #endif uint64 guid; @@ -242,7 +242,7 @@ void WorldSession::HandleLootOpcode(WorldPacket& recvData) void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_LOOT_RELEASE"); + LOG_DEBUG("network", "WORLD: CMSG_LOOT_RELEASE"); #endif // cheaters can modify lguid to prevent correct apply loot release code and re-loot @@ -304,7 +304,7 @@ void WorldSession::DoLootRelease(uint64 lguid) if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.eventId) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Chest ScriptStart id %u for GO %u", go->GetGOInfo()->chest.eventId, go->GetDBTableGUIDLow()); + LOG_DEBUG("spells.aura", "Chest ScriptStart id %u for GO %u", go->GetGOInfo()->chest.eventId, go->GetDBTableGUIDLow()); #endif player->GetMap()->ScriptsStart(sEventScripts, go->GetGOInfo()->chest.eventId, player, go); } @@ -424,7 +424,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName().c_str()); + LOG_DEBUG("network", "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [%s].", target->GetName().c_str()); #endif if (_player->GetLootGUID() != lootguid) @@ -436,7 +436,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) if (!_player->IsInRaidWith(target)) { _player->SendLootError(lootguid, LOOT_ERROR_MASTER_OTHER); - //sLog->outDebug(LOG_FILTER_NETWORKIO, "MasterLootItem: Player %s tried to give an item to ineligible player %s !", GetPlayer()->GetName().c_str(), target->GetName().c_str()); + //LOG_DEBUG("network", "MasterLootItem: Player %s tried to give an item to ineligible player %s !", GetPlayer()->GetName().c_str(), target->GetName().c_str()); return; } @@ -465,7 +465,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData) if (slotid >= loot->items.size() + loot->quest_items.size()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName().c_str(), slotid, (unsigned long)loot->items.size()); + LOG_DEBUG("loot", "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName().c_str(), slotid, (unsigned long)loot->items.size()); #endif return; } diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index 81e370eed7..34c17df300 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -27,7 +27,7 @@ bool WorldSession::CanOpenMailBox(uint64 guid) { if (_player->GetSession()->GetSecurity() < SEC_MODERATOR) { - sLog->outError("%s attempt open mailbox in cheating way.", _player->GetName().c_str()); + LOG_ERROR("server", "%s attempt open mailbox in cheating way.", _player->GetName().c_str()); return false; } } @@ -115,14 +115,14 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) if (!rc) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); + LOG_DEBUG("server", "Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); #endif player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND); return; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); + LOG_DEBUG("server", "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2); #endif if (player->GetGUID() == rc) @@ -133,7 +133,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) if (money && COD) // cannot send money in a COD mail { - sLog->outError("%s attempt to dupe money!!!.", receiver.c_str()); + LOG_ERROR("server", "%s attempt to dupe money!!!.", receiver.c_str()); player->SendMailResult(0, MAIL_SEND, MAIL_ERR_INTERNAL_ERROR); return; } @@ -747,7 +747,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData) bodyItem->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_MAIL_TEXT_MASK); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("HandleMailCreateTextItem mailid=%u", mailId); + LOG_DEBUG("server", "HandleMailCreateTextItem mailid=%u", mailId); #endif ItemPosCountVec dest; diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 3116aca43a..d55aa041b5 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -49,7 +49,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REPOP_REQUEST Message"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_REPOP_REQUEST Message"); #endif recv_data.read_skip(); @@ -68,7 +68,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data) if (GetPlayer()->getDeathState() == JUST_DIED) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); + LOG_DEBUG("network", "HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); #endif GetPlayer()->KillPlayer(); } @@ -86,7 +86,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data) void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION"); + LOG_DEBUG("network", "WORLD: CMSG_GOSSIP_SELECT_OPTION"); #endif uint32 gossipListId; @@ -108,7 +108,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -119,7 +119,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data) if (!go) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid))); #endif return; } @@ -144,7 +144,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid))); #endif return; } @@ -156,7 +156,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data) if ((unit && unit->GetCreatureTemplate()->ScriptID != unit->LastUsedScriptID) || (go && go->GetGOInfo()->ScriptId != go->LastUsedScriptID)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - Script reloaded while in use, ignoring and set new scipt id"); + LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Script reloaded while in use, ignoring and set new scipt id"); #endif if (unit) unit->LastUsedScriptID = unit->GetCreatureTemplate()->ScriptID; @@ -214,7 +214,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data) void WorldSession::HandleWhoOpcode(WorldPacket& recvData) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_WHO Message"); time_t now = time(nullptr); if (now < timeWhoCommandAllowed) @@ -245,7 +245,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) uint32 temp; recvData >> temp; // zone id, 0 if zone is unknown... zoneids[i] = temp; - sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]); + LOG_DEBUG("network", "Zone %u: %u", i, zoneids[i]); } recvData >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10) @@ -253,7 +253,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) if (str_count > 4) return; // can't be received from real client or broken packet - sLog->outDebug(LOG_FILTER_NETWORKIO, "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count); + LOG_DEBUG("network", "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count); std::wstring str[4]; // 4 is client limit for (uint32 i = 0; i < str_count; ++i) @@ -266,7 +266,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) wstrToLower(str[i]); - sLog->outDebug(LOG_FILTER_NETWORKIO, "String %u: %s", i, temp.c_str()); + LOG_DEBUG("network", "String %u: %s", i, temp.c_str()); } std::wstring wplayer_name; @@ -291,7 +291,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) data << uint32(matchcount); // placeholder, count of players matching criteria data << uint32(displaycount); // placeholder, count of players displayed - ACORE_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + std::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { @@ -406,13 +406,13 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData) data.put(4, matchcount); // insert right count, count of matches SendPacket(&data); - // sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message"); + // LOG_DEBUG("network", "WORLD: Send SMSG_WHO Message"); } void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recv_data*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity()); + LOG_DEBUG("network", "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity()); #endif if (uint64 lguid = GetPlayer()->GetLootGUID()) @@ -475,7 +475,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recv_data*/) void WorldSession::HandlePlayerLogoutOpcode(WorldPacket& /*recv_data*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_PLAYER_LOGOUT Message"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_PLAYER_LOGOUT Message"); #endif } @@ -526,7 +526,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recv_data) recv_data >> newZone; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd ZONE_UPDATE: %u", newZone); + LOG_DEBUG("network", "WORLD: Recvd ZONE_UPDATE: %u", newZone); #endif // use server size data @@ -611,12 +611,12 @@ void WorldSession::HandleBugOpcode(WorldPacket& recv_data) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) if (suggestion == 0) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUG [Bug Report]"); + LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Bug Report]"); else - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BUG [Suggestion]"); + LOG_DEBUG("network", "WORLD: Received CMSG_BUG [Suggestion]"); - sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", type.c_str()); - sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", content.c_str()); + LOG_DEBUG("network", "%s", type.c_str()); + LOG_DEBUG("network", "%s", content.c_str()); #endif PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_BUG_REPORT); @@ -630,7 +630,7 @@ void WorldSession::HandleBugOpcode(WorldPacket& recv_data) void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RECLAIM_CORPSE"); + LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE"); #endif uint64 guid; @@ -669,7 +669,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data) void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_RESURRECT_RESPONSE"); + LOG_DEBUG("network", "WORLD: Received CMSG_RESURRECT_RESPONSE"); #endif uint64 guid; @@ -716,14 +716,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) recv_data >> triggerId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_AREATRIGGER. Trigger ID: %u", triggerId); + LOG_DEBUG("network", "CMSG_AREATRIGGER. Trigger ID: %u", triggerId); #endif Player* player = GetPlayer(); if (player->IsInFlight()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", + LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", player->GetName().c_str(), player->GetGUIDLow(), triggerId); #endif return; @@ -733,7 +733,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) if (!atEntry) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", + LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", player->GetName().c_str(), player->GetGUIDLow(), triggerId); #endif return; @@ -742,7 +742,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) if (!player->IsInAreaTriggerRadius(atEntry)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", + LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", player->GetName().c_str(), atEntry->map, player->GetMapId(), player->GetGUIDLow(), triggerId); #endif return; @@ -803,14 +803,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA"); + LOG_DEBUG("network", "WORLD: Received CMSG_UPDATE_ACCOUNT_DATA"); #endif uint32 type, timestamp, decompressedSize; recv_data >> type >> timestamp >> decompressedSize; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "UAD: type %u, time %u, decompressedSize %u", type, timestamp, decompressedSize); + LOG_DEBUG("network", "UAD: type %u, time %u, decompressedSize %u", type, timestamp, decompressedSize); #endif if (type > NUM_ACCOUNT_DATA_TYPES) @@ -831,7 +831,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data) if (decompressedSize > 0xFFFF) { recv_data.rfinish(); // unnneded warning spam in this case - sLog->outError("UAD: Account data packet too big, size %u", decompressedSize); + LOG_ERROR("server", "UAD: Account data packet too big, size %u", decompressedSize); return; } @@ -842,7 +842,7 @@ void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data) if (uncompress(dest.contents(), &realSize, recv_data.contents() + recv_data.rpos(), recv_data.size() - recv_data.rpos()) != Z_OK) { recv_data.rfinish(); // unnneded warning spam in this case - sLog->outError("UAD: Failed to decompress account data"); + LOG_ERROR("server", "UAD: Failed to decompress account data"); return; } @@ -862,14 +862,14 @@ void WorldSession::HandleUpdateAccountData(WorldPacket& recv_data) void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA"); + LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_ACCOUNT_DATA"); #endif uint32 type; recv_data >> type; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "RAD: type %u", type); + LOG_DEBUG("network", "RAD: type %u", type); #endif if (type >= NUM_ACCOUNT_DATA_TYPES) @@ -887,7 +887,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) if (size && compress(dest.contents(), &destSize, (uint8 const*)adata->Data.c_str(), size) != Z_OK) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "RAD: Failed to compress account data"); + LOG_DEBUG("network", "RAD: Failed to compress account data"); #endif return; } @@ -906,7 +906,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_ACTION_BUTTON"); + LOG_DEBUG("network", "WORLD: Received CMSG_SET_ACTION_BUTTON"); #endif uint8 button; uint32 packetData; @@ -916,12 +916,12 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) uint8 type = ACTION_BUTTON_TYPE(packetData); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("BUTTON: %u ACTION: %u TYPE: %u", button, action, type); + LOG_DEBUG("server", "BUTTON: %u ACTION: %u TYPE: %u", button, action, type); #endif if (!packetData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("MISC: Remove action from button %u", button); + LOG_DEBUG("server", "MISC: Remove action from button %u", button); #endif GetPlayer()->removeActionButton(button); } @@ -932,26 +932,26 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data) case ACTION_BUTTON_MACRO: case ACTION_BUTTON_CMACRO: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("MISC: Added Macro %u into button %u", action, button); + LOG_DEBUG("server", "MISC: Added Macro %u into button %u", action, button); #endif break; case ACTION_BUTTON_EQSET: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("MISC: Added EquipmentSet %u into button %u", action, button); + LOG_DEBUG("server", "MISC: Added EquipmentSet %u into button %u", action, button); #endif break; case ACTION_BUTTON_SPELL: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("MISC: Added Spell %u into button %u", action, button); + LOG_DEBUG("server", "MISC: Added Spell %u into button %u", action, button); #endif break; case ACTION_BUTTON_ITEM: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("MISC: Added Item %u into button %u", action, button); + LOG_DEBUG("server", "MISC: Added Item %u into button %u", action, button); #endif break; default: - sLog->outError("MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName().c_str(), _player->GetGUIDLow()); + LOG_ERROR("server", "MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName().c_str(), _player->GetGUIDLow()); return; } GetPlayer()->addActionButton(button, action, type); @@ -962,7 +962,7 @@ void WorldSession::HandleCompleteCinematic(WorldPacket& /*recv_data*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_COMPLETE_CINEMATIC"); + LOG_DEBUG("network", "WORLD: Received CMSG_COMPLETE_CINEMATIC"); } #endif // If player has sight bound to visual waypoint NPC we should remove it @@ -973,7 +973,7 @@ void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recv_data*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA"); + LOG_DEBUG("network", "WORLD: Received CMSG_NEXT_CINEMATIC_CAMERA"); } #endif // Sent by client when cinematic actually begun. So we begin the server side process @@ -983,7 +983,7 @@ void WorldSession::HandleNextCinematicCamera(WorldPacket& /*recv_data*/) void WorldSession::HandleFeatherFallAck(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_FEATHER_FALL_ACK"); + LOG_DEBUG("network", "WORLD: CMSG_MOVE_FEATHER_FALL_ACK"); #endif // no used @@ -1006,7 +1006,7 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK"); + LOG_DEBUG("network.opcode", "WORLD: CMSG_FORCE_MOVE_UNROOT_ACK"); #endif recv_data.read_skip(); // unk @@ -1034,7 +1034,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recv_data) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_FORCE_MOVE_ROOT_ACK"); + LOG_DEBUG("network.opcode", "WORLD: CMSG_FORCE_MOVE_ROOT_ACK"); #endif recv_data.read_skip(); // unk @@ -1053,7 +1053,7 @@ void WorldSession::HandleSetActionBarToggles(WorldPacket& recv_data) if (!GetPlayer()) // ignore until not logged (check needed because STATUS_AUTHED) { if (ActionBar != 0) - sLog->outError("WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(ActionBar)); + LOG_ERROR("server", "WorldSession::HandleSetActionBarToggles in not logged state with value: %u, ignored", uint32(ActionBar)); return; } @@ -1078,14 +1078,14 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) recv_data >> guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_INSPECT"); + LOG_DEBUG("network", "WORLD: Received CMSG_INSPECT"); #endif Player* player = ObjectAccessor::GetPlayer(*_player, guid); if (!player) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid); + LOG_DEBUG("network", "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid); #endif return; } @@ -1119,7 +1119,7 @@ void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data) if (!player) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid); + LOG_DEBUG("network", "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid); #endif return; } @@ -1151,19 +1151,19 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) recv_data >> Orientation; // o (3.141593 = 180 degrees) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_WORLD_TELEPORT"); + LOG_DEBUG("network", "WORLD: Received CMSG_WORLD_TELEPORT"); #endif if (GetPlayer()->IsInFlight()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore worldport command.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); + LOG_DEBUG("network", "Player '%s' (GUID: %u) in flight, ignore worldport command.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow()); #endif return; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f", GetPlayer()->GetName().c_str(), time, mapid, PositionX, PositionY, PositionZ, Orientation); + LOG_DEBUG("network", "CMSG_WORLD_TELEPORT: Player = %s, Time = %u, map = %u, x = %f, y = %f, z = %f, o = %f", GetPlayer()->GetName().c_str(), time, mapid, PositionX, PositionY, PositionZ, Orientation); #endif if (AccountMgr::IsAdminAccount(GetSecurity())) @@ -1175,7 +1175,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_WHOIS"); + LOG_DEBUG("network", "Received opcode CMSG_WHOIS"); #endif std::string charname; recv_data >> charname; @@ -1232,14 +1232,14 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received whois command from player %s for character %s", GetPlayer()->GetName().c_str(), charname.c_str()); + LOG_DEBUG("network", "Received whois command from player %s for character %s", GetPlayer()->GetName().c_str(), charname.c_str()); #endif } void WorldSession::HandleComplainOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_COMPLAIN"); + LOG_DEBUG("network", "WORLD: CMSG_COMPLAIN"); #endif uint8 spam_type; // 0 - mail, 1 - chat @@ -1276,14 +1276,14 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recv_data) SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str()); + LOG_DEBUG("network", "REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str()); #endif } void WorldSession::HandleRealmSplitOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_REALM_SPLIT"); + LOG_DEBUG("network", "CMSG_REALM_SPLIT"); #endif uint32 unk; @@ -1299,13 +1299,12 @@ void WorldSession::HandleRealmSplitOpcode(WorldPacket& recv_data) // 0x2 realm split pending data << split_date; SendPacket(&data); - //sLog->outDebug("response sent %u", unk); } void WorldSession::HandleFarSightOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_FAR_SIGHT"); + LOG_DEBUG("network", "WORLD: CMSG_FAR_SIGHT"); #endif bool apply; @@ -1314,21 +1313,21 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData) if (apply) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow()); + LOG_DEBUG("network", "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow()); #endif if (WorldObject* target = _player->GetViewpoint()) _player->SetSeer(target); else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outError("Player %s requests non-existing seer " UI64FMTD, _player->GetName().c_str(), _player->GetUInt64Value(PLAYER_FARSIGHT)); + LOG_ERROR("server", "Player %s requests non-existing seer " UI64FMTD, _player->GetName().c_str(), _player->GetUInt64Value(PLAYER_FARSIGHT)); #endif } } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player %u set vision to self", _player->GetGUIDLow()); + LOG_DEBUG("network", "Player %u set vision to self", _player->GetGUIDLow()); #endif _player->SetSeer(_player); } @@ -1339,7 +1338,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData) void WorldSession::HandleSetTitleOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_TITLE"); + LOG_DEBUG("network", "CMSG_SET_TITLE"); #endif int32 title; @@ -1357,18 +1356,10 @@ void WorldSession::HandleSetTitleOpcode(WorldPacket& recv_data) GetPlayer()->SetUInt32Value(PLAYER_CHOSEN_TITLE, title); } -void WorldSession::HandleTimeSyncResp(WorldPacket& recv_data) -{ - uint32 counter, clientTicks; - recv_data >> counter >> clientTicks; - //uint32 ourTicks = clientTicks + (World::GetGameTimeMS() - _player->m_timeSyncServer); - _player->m_timeSyncClient = clientTicks; -} - void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recv_data*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_RESET_INSTANCES"); + LOG_DEBUG("network", "WORLD: CMSG_RESET_INSTANCES"); #endif if (Group* group = _player->GetGroup()) @@ -1383,7 +1374,7 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recv_data*/) void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_SET_DUNGEON_DIFFICULTY"); + LOG_DEBUG("network", "MSG_SET_DUNGEON_DIFFICULTY"); #endif uint32 mode; @@ -1438,7 +1429,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recv_data) void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_SET_RAID_DIFFICULTY"); + LOG_DEBUG("network", "MSG_SET_RAID_DIFFICULTY"); #endif uint32 mode; @@ -1600,7 +1591,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recv_data) void WorldSession::HandleCancelMountAuraOpcode(WorldPacket& /*recv_data*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CANCEL_MOUNT_AURA"); + LOG_DEBUG("network", "WORLD: CMSG_CANCEL_MOUNT_AURA"); #endif //If player is not mounted, so go out :) @@ -1624,7 +1615,7 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data) { // fly mode on/off #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); + LOG_DEBUG("network", "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); #endif uint64 guid; // guid - unused @@ -1652,7 +1643,7 @@ void WorldSession::HandleRequestPetInfoOpcode(WorldPacket& /*recv_data */) { /* #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_REQUEST_PET_INFO"); + LOG_DEBUG("network.opcode", "WORLD: CMSG_REQUEST_PET_INFO"); #endif recv_data.hexlike(); */ @@ -1671,7 +1662,7 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data) mode ? _player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK) : _player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Client used \"/timetest %d\" command", mode); + LOG_DEBUG("network", "Client used \"/timetest %d\" command", mode); #endif } @@ -1691,7 +1682,7 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recv_data*/) { // empty opcode #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE"); + LOG_DEBUG("network", "WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE"); #endif WorldPacket data(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4); @@ -1703,7 +1694,7 @@ void WorldSession::HandleReadyForAccountDataTimes(WorldPacket& /*recv_data*/) { // empty opcode #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_READY_FOR_ACCOUNT_DATA_TIMES"); + LOG_DEBUG("network", "WORLD: CMSG_READY_FOR_ACCOUNT_DATA_TIMES"); #endif SendAccountDataTimes(GLOBAL_CACHE_MASK); @@ -1720,7 +1711,7 @@ void WorldSession::SendSetPhaseShift(uint32 PhaseShift) void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); + LOG_DEBUG("network", "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); #endif Battleground* bg = _player->GetBattleground(); @@ -1745,7 +1736,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data) void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); + LOG_DEBUG("network", "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); #endif Battleground* bg = _player->GetBattleground(); @@ -1796,7 +1787,7 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket) if (!_player->HasPendingBind() || _player->GetPendingBind() != _player->GetInstanceId() || (_player->GetGroup() && _player->GetGroup()->isLFGGroup() && _player->GetGroup()->IsLfgRandomInstance())) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", _player->GetName().c_str(), _player->GetGUIDLow()); + LOG_DEBUG("server", "InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", _player->GetName().c_str(), _player->GetGUIDLow()); #endif return; } @@ -1812,7 +1803,7 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket) void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY"); + LOG_DEBUG("network", "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY"); #endif uint64 guid; diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 4dcb49b5b3..d56e1a9fff 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -14,6 +14,7 @@ #include "GameGraveyard.h" #include "InstanceSaveMgr.h" #include "Log.h" +#include "MathUtil.h" #include "MapManager.h" #include "ObjectMgr.h" #include "Opcodes.h" @@ -31,7 +32,7 @@ void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: got MSG_MOVE_WORLDPORT_ACK."); + LOG_DEBUG("network", "WORLD: got MSG_MOVE_WORLDPORT_ACK."); #endif HandleMoveWorldportAckOpcode(); } @@ -61,7 +62,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() Map* oldMap = GetPlayer()->GetMap(); if (GetPlayer()->IsInWorld()) { - sLog->outError("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName().c_str(), oldMap->GetId(), loc.GetMapId()); + LOG_ERROR("server", "Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName().c_str(), oldMap->GetId(), loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } @@ -80,7 +81,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() // while the player is in transit, for example the map may get full if (!newMap || !newMap->CanEnter(GetPlayer(), false)) { - sLog->outError("Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow()); + LOG_ERROR("server", "Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow()); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); return; } @@ -94,7 +95,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SendInitialPacketsBeforeAddToMap(); if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer())) { - sLog->outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId()); + LOG_ERROR("server", "WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId()); GetPlayer()->ResetMap(); GetPlayer()->SetMap(oldMap); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); @@ -227,7 +228,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_MOVE_TELEPORT_ACK"); + LOG_DEBUG("network", "MSG_MOVE_TELEPORT_ACK"); #endif uint64 guid; @@ -236,10 +237,10 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData) uint32 flags, time; recvData >> flags >> time; // unused #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Guid " UI64FMTD, guid); + LOG_DEBUG("server", "Guid " UI64FMTD, guid); #endif #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Flags %u, time %u", flags, time / IN_MILLISECONDS); + LOG_DEBUG("server", "Flags %u, time %u", flags, time / IN_MILLISECONDS); #endif Player* plMover = _player->m_mover->ToPlayer(); @@ -419,11 +420,6 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) if (mover->GetGUID() != _player->GetGUID()) movementInfo.flags &= ~MOVEMENTFLAG_WALKING; - uint32 mstime = World::GetGameTimeMS(); - /*----------------------*/ - if(m_clientTimeDelay == 0) - m_clientTimeDelay = mstime > movementInfo.time ? std::min(mstime - movementInfo.time, (uint32)100) : 0; - // Xinef: do not allow to move with UNIT_FLAG_DISABLE_MOVE if (mover->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) { @@ -442,8 +438,16 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) /* process position-change */ WorldPacket data(opcode, recvData.size()); - //movementInfo.time = movementInfo.time + m_clientTimeDelay + MOVEMENT_PACKET_TIME_DELAY; - movementInfo.time = mstime; // pussywizard: set to time of relocation (server time), constant addition may smoothen movement clientside, but client sees target on different position than the real serverside position + int64 movementTime = (int64)movementInfo.time + _timeSyncClockDelta; + if (_timeSyncClockDelta == 0 || movementTime < 0 || movementTime > 0xFFFFFFFF) + { + LOG_INFO("misc", "The computed movement time using clockDelta is erronous. Using fallback instead"); + movementInfo.time = getMSTime(); + } + else + { + movementInfo.time = (uint32) movementTime; + } movementInfo.guid = mover->GetGUID(); WriteMovementInfo(&data, &movementInfo); @@ -515,7 +519,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData) { uint32 opcode = recvData.GetOpcode(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode); + LOG_DEBUG("network", "WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode); #endif /* extract packet */ @@ -589,7 +593,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData) force_move_type = MOVE_PITCH_RATE; break; default: - sLog->outError("WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode); + LOG_ERROR("server", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode); return; } @@ -606,13 +610,13 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData) { if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct { - sLog->outError("%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value", + LOG_ERROR("server", "%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value", move_type_name[move_type], _player->GetName().c_str(), _player->GetSpeed(move_type), newspeed); _player->SetSpeed(move_type, _player->GetSpeedRate(move_type), true); } else // must be lesser - cheating { - sLog->outBasic("Player %s from account id %u kicked for incorrect speed (must be %f instead %f)", + LOG_INFO("server", "Player %s from account id %u kicked for incorrect speed (must be %f instead %f)", _player->GetName().c_str(), GetAccountId(), _player->GetSpeed(move_type), newspeed); KickPlayer("Incorrect speed"); } @@ -622,7 +626,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData) void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_SET_ACTIVE_MOVER"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_SET_ACTIVE_MOVER"); #endif uint64 guid; @@ -631,14 +635,14 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recvData) if (GetPlayer()->IsInWorld() && _player->m_mover && _player->m_mover->IsInWorld()) { if (_player->m_mover->GetGUID() != guid) - sLog->outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID()); + LOG_ERROR("server", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID()); } } void WorldSession::HandleMoveNotActiveMover(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER"); #endif uint64 old_mover_guid; @@ -669,7 +673,7 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_KNOCK_BACK_ACK"); + LOG_DEBUG("network", "CMSG_MOVE_KNOCK_BACK_ACK"); #endif uint64 guid; @@ -706,7 +710,7 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData) void WorldSession::HandleMoveHoverAck(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_HOVER_ACK"); + LOG_DEBUG("network", "CMSG_MOVE_HOVER_ACK"); #endif uint64 guid; // guid - unused @@ -724,7 +728,7 @@ void WorldSession::HandleMoveHoverAck(WorldPacket& recvData) void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_MOVE_WATER_WALK_ACK"); + LOG_DEBUG("network", "CMSG_MOVE_WATER_WALK_ACK"); #endif uint64 guid; // guid - unused @@ -766,7 +770,7 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData) void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_MOVE_TIME_SKIPPED"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_MOVE_TIME_SKIPPED"); #endif uint64 guid; @@ -778,14 +782,14 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData) if (!mover) { - sLog->outError("WorldSession::HandleMoveTimeSkippedOpcode wrong mover state from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID()); + LOG_ERROR("server", "WorldSession::HandleMoveTimeSkippedOpcode wrong mover state from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID()); return; } // prevent tampered movement data if (guid != mover->GetGUID()) { - sLog->outError("WorldSession::HandleMoveTimeSkippedOpcode wrong guid from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID()); + LOG_ERROR("server", "WorldSession::HandleMoveTimeSkippedOpcode wrong guid from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID()); return; } @@ -796,3 +800,76 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData) data << timeSkipped; GetPlayer()->SendMessageToSet(&data, false); } + +void WorldSession::HandleTimeSyncResp(WorldPacket& recvData) +{ +#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) + LOG_DEBUG("network", "CMSG_TIME_SYNC_RESP"); +#endif + + uint32 counter, clientTimestamp; + recvData >> counter >> clientTimestamp; + + if (_pendingTimeSyncRequests.count(counter) == 0) + return; + + uint32 serverTimeAtSent = _pendingTimeSyncRequests.at(counter); + _pendingTimeSyncRequests.erase(counter); + + // time it took for the request to travel to the client, for the client to process it and reply and for response to travel back to the server. + // we are going to make 2 assumptions: + // 1) we assume that the request processing time equals 0. + // 2) we assume that the packet took as much time to travel from server to client than it took to travel from client to server. + uint32 roundTripDuration = getMSTimeDiff(serverTimeAtSent, recvData.GetReceivedTime()); + uint32 lagDelay = roundTripDuration / 2; + + /* + clockDelta = serverTime - clientTime + where + serverTime: time that was displayed on the clock of the SERVER at the moment when the client processed the SMSG_TIME_SYNC_REQUEST packet. + clientTime: time that was displayed on the clock of the CLIENT at the moment when the client processed the SMSG_TIME_SYNC_REQUEST packet. + + Once clockDelta has been computed, we can compute the time of an event on server clock when we know the time of that same event on the client clock, + using the following relation: + serverTime = clockDelta + clientTime + */ + int64 clockDelta = (int64)serverTimeAtSent + (int64)lagDelay - (int64)clientTimestamp; + _timeSyncClockDeltaQueue.put(std::pair(clockDelta, roundTripDuration)); + ComputeNewClockDelta(); +} + +void WorldSession::ComputeNewClockDelta() +{ + // implementation of the technique described here: https://web.archive.org/web/20180430214420/http://www.mine-control.com/zack/timesync/timesync.html + // to reduce the skew induced by dropped TCP packets that get resent. + + std::vector latencies; + std::vector clockDeltasAfterFiltering; + + for (auto pair : _timeSyncClockDeltaQueue.content()) + latencies.push_back(pair.second); + + uint32 latencyMedian = median(latencies); + uint32 latencyStandardDeviation = standard_deviation(latencies); + + uint32 sampleSizeAfterFiltering = 0; + for (auto pair : _timeSyncClockDeltaQueue.content()) + { + if (pair.second <= latencyMedian + latencyStandardDeviation) { + clockDeltasAfterFiltering.push_back(pair.first); + sampleSizeAfterFiltering++; + } + } + + if (sampleSizeAfterFiltering != 0) + { + int64 meanClockDelta = static_cast(mean(clockDeltasAfterFiltering)); + if (std::abs(meanClockDelta - _timeSyncClockDelta) > 25) + _timeSyncClockDelta = meanClockDelta; + } + else if (_timeSyncClockDelta == 0) + { + std::pair back = _timeSyncClockDeltaQueue.peak_back(); + _timeSyncClockDelta = back.first; + } +} diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 6f06b9b3d2..b4161d5e19 100644 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -46,7 +46,7 @@ void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -70,7 +70,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) uint64 guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_BANKER_ACTIVATE"); + LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE"); #endif recvData >> guid; @@ -79,7 +79,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -123,14 +123,14 @@ void WorldSession::SendTrainerList(uint64 guid) void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList"); + LOG_DEBUG("network", "WORLD: SendTrainerList"); #endif Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -144,7 +144,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) if (!ci) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid)); + LOG_DEBUG("network", "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid)); #endif return; } @@ -153,7 +153,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) if (!trainer_spells) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", GUID_LOPART(guid), unit->GetEntry()); + LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", GUID_LOPART(guid), unit->GetEntry()); #endif return; } @@ -248,14 +248,14 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) recvData >> guid >> spellId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId); + LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId); #endif Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER); if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -305,7 +305,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData) void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GOSSIP_HELLO"); + LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO"); #endif uint64 guid; @@ -315,7 +315,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -368,7 +368,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) /*void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: CMSG_GOSSIP_SELECT_OPTION"); + LOG_DEBUG("network.opcode", "WORLD: CMSG_GOSSIP_SELECT_OPTION"); #endif uint32 option; @@ -381,11 +381,11 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) if (_player->PlayerTalkClass->GossipOptionCoded(option)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PACKETIO, "reading string"); + LOG_DEBUG("network.opcode", "reading string"); #endif recvData >> code; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PACKETIO, "string read: %s", code.c_str()); + LOG_DEBUG("network.opcode", "string read: %s", code.c_str()); #endif } @@ -393,7 +393,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network.opcode", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -417,7 +417,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData) void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE"); + LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE"); #endif uint64 guid; @@ -428,7 +428,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -483,7 +483,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); + LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); #endif return; } @@ -517,7 +517,7 @@ void WorldSession::SendBindPoint(Creature* npc) void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS"); + LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS"); #endif uint64 npcGUID; @@ -555,7 +555,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv MSG_LIST_STABLED_PETS Send."); + LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS Send."); #endif WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size @@ -630,7 +630,7 @@ void WorldSession::SendStableResult(uint8 res) void WorldSession::HandleStablePet(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_PET"); + LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET"); #endif uint64 npcGUID; @@ -737,7 +737,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result) void WorldSession::HandleUnstablePet(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_UNSTABLE_PET."); + LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET."); #endif uint64 npcGUID; uint32 petnumber; @@ -840,7 +840,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32 void WorldSession::HandleBuyStableSlot(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_BUY_STABLE_SLOT."); + LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT."); #endif uint64 npcGUID; @@ -875,14 +875,14 @@ void WorldSession::HandleBuyStableSlot(WorldPacket& recvData) void WorldSession::HandleStableRevivePet(WorldPacket& /* recvData */) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleStableRevivePet: Not implemented"); + LOG_DEBUG("network", "HandleStableRevivePet: Not implemented"); #endif } void WorldSession::HandleStableSwapPet(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_STABLE_SWAP_PET."); + LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET."); #endif uint64 npcGUID; uint32 petId; @@ -995,7 +995,7 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3 void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_REPAIR_ITEM"); + LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM"); #endif uint64 npcGUID, itemGUID; @@ -1007,7 +1007,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); + LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID))); #endif return; } @@ -1024,7 +1024,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) if (itemGUID) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID)); + LOG_DEBUG("network", "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID)); #endif Item* item = _player->GetItemByGuid(itemGUID); @@ -1034,7 +1034,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID)); + LOG_DEBUG("network", "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID)); #endif _player->DurabilityRepairAll(true, discountMod, guildBank); } diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index deb1a30f58..a53cc6c85a 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -140,7 +140,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, owner->GetClosePoint(px, py, pz, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle()); if (!pet->IsPositionValid()) { - sLog->outError("Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); + LOG_ERROR("server", "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); delete pet; delete holder; return PET_LOAD_ERROR; @@ -180,7 +180,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, else pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 0x800); // class = mage - pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); // this enables popup window (pet dismiss, cancel) break; case HUNTER_PET: @@ -188,7 +188,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, pet->SetSheath(SHEATH_STATE_MELEE); pet->SetByteFlag(UNIT_FIELD_BYTES_2, 2, fields[9].GetBool() ? UNIT_CAN_BE_ABANDONED : UNIT_CAN_BE_RENAMED | UNIT_CAN_BE_ABANDONED); - pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + pet->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); // this enables popup window (pet abandon, cancel) pet->SetMaxPower(POWER_HAPPINESS, pet->GetCreatePowers(POWER_HAPPINESS)); pet->SetPower(POWER_HAPPINESS, fields[12].GetUInt32()); @@ -196,7 +196,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, break; default: if (!pet->IsPetGhoul()) - sLog->outError("Pet have incorrect type (%u) for pet loading.", pet->getPetType()); + LOG_ERROR("server", "Pet have incorrect type (%u) for pet loading.", pet->getPetType()); break; } @@ -358,7 +358,7 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData) recvData >> guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid); + LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid); #endif Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); @@ -366,7 +366,7 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData) if (!pet) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId()); + LOG_DEBUG("network", "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId()); #endif return; } @@ -393,18 +393,18 @@ void WorldSession::HandlePetAction(WorldPacket& recvData) // used also for charmed creature Unit* pet = ObjectAccessor::GetUnit(*_player, guid1); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2))); + LOG_DEBUG("server", "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2))); #endif if (!pet) { - sLog->outError("HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str()); + LOG_ERROR("server", "HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str()); return; } if (pet != GetPlayer()->GetFirstControlled()) { - sLog->outError("HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str()); + LOG_ERROR("server", "HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str()); return; } @@ -449,20 +449,20 @@ void WorldSession::HandlePetStopAttack(WorldPacket& recvData) recvData >> guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid); + LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid); #endif Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if (!pet) { - sLog->outError("HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid))); + LOG_ERROR("server", "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid))); return; } if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm()) { - sLog->outError("HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + LOG_ERROR("server", "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } @@ -478,7 +478,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - sLog->outError("WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", + LOG_ERROR("server", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetTypeId()); return; } @@ -635,7 +635,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid } break; default: - sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); + LOG_ERROR("server", "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); } break; case ACT_REACTION: // 0x6 @@ -667,7 +667,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { - sLog->outError("WORLD: unknown PET spell id %i", spellid); + LOG_ERROR("server", "WORLD: unknown PET spell id %i", spellid); return; } @@ -898,14 +898,14 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid break; } default: - sLog->outError("WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); + LOG_ERROR("server", "WORLD: unknown PET flag Action %i and spellid %i.", uint32(flag), spellid); } } void WorldSession::HandlePetNameQuery(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("HandlePetNameQuery. CMSG_PET_NAME_QUERY"); + LOG_DEBUG("server", "HandlePetNameQuery. CMSG_PET_NAME_QUERY"); #endif uint32 petnumber; @@ -969,7 +969,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid)); + LOG_DEBUG("server", "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid)); #endif return false; } @@ -980,7 +980,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid)); + LOG_DEBUG("server", "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid)); #endif return false; } @@ -991,7 +991,7 @@ bool WorldSession::CheckStableMaster(uint64 guid) void WorldSession::HandlePetSetAction(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("HandlePetSetAction. CMSG_PET_SET_ACTION"); + LOG_DEBUG("server", "HandlePetSetAction. CMSG_PET_SET_ACTION"); #endif uint64 petguid; @@ -1002,7 +1002,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) Unit* checkPet = ObjectAccessor::GetUnit(*_player, petguid); if (!checkPet || checkPet != _player->GetFirstControlled()) { - sLog->outError("HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow()); + LOG_ERROR("server", "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow()); return; } @@ -1051,7 +1051,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - sLog->outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + LOG_ERROR("server", "WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); continue; } @@ -1120,7 +1120,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData) void WorldSession::HandlePetRename(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("HandlePetRename. CMSG_PET_RENAME"); + LOG_DEBUG("server", "HandlePetRename. CMSG_PET_RENAME"); #endif uint64 petguid; @@ -1212,7 +1212,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData) uint64 guid; recvData >> guid; //pet guid #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid)); + LOG_DEBUG("server", "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid)); #endif if (!_player->IsInWorld()) @@ -1240,7 +1240,7 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData) void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("CMSG_PET_SPELL_AUTOCAST"); + LOG_DEBUG("server", "CMSG_PET_SPELL_AUTOCAST"); #endif uint64 guid; uint32 spellid; @@ -1260,7 +1260,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) Creature* checkPet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid); if (!checkPet || (checkPet != _player->GetGuardianPet() && checkPet != _player->GetCharm())) { - sLog->outError("HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + LOG_ERROR("server", "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } @@ -1284,7 +1284,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { - sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); + LOG_ERROR("server", "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); continue; } @@ -1300,7 +1300,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL"); + LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL"); #endif uint64 guid; @@ -1311,7 +1311,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) recvPacket >> guid >> castCount >> spellId >> castFlags; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags); + LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags); #endif // This opcode is also sent from charmed and possessed units (players and creatures) @@ -1322,14 +1322,14 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm())) { - sLog->outError("HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + LOG_ERROR("server", "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("WORLD: unknown PET spell id %i", spellId); + LOG_ERROR("server", "WORLD: unknown PET spell id %i", spellId); return; } @@ -1421,7 +1421,7 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec void WorldSession::HandlePetLearnTalent(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_PET_LEARN_TALENT"); + LOG_DEBUG("network", "WORLD: CMSG_PET_LEARN_TALENT"); #endif uint64 guid; @@ -1435,7 +1435,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket& recvData) void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LEARN_PREVIEW_TALENTS_PET"); + LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS_PET"); #endif uint64 guid; diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp index dda123537e..96a4d10ca3 100644 --- a/src/server/game/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Handlers/PetitionsHandler.cpp @@ -24,7 +24,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_BUY"); + LOG_DEBUG("network", "Received opcode CMSG_PETITION_BUY"); #endif uint64 guidNPC; @@ -55,7 +55,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) recvData.read_skip(); // 0 #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str()); + LOG_DEBUG("network", "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str()); #endif // prevent cheating @@ -63,7 +63,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC)); + LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC)); #endif return; } @@ -114,7 +114,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) break; default: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "unknown selection at buy arena petition: %u", clientIndex); + LOG_DEBUG("network", "unknown selection at buy arena petition: %u", clientIndex); #endif return; } @@ -200,7 +200,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) if (petition) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Invalid petition GUIDs: %u", petition->petitionGuid); + LOG_DEBUG("network", "Invalid petition GUIDs: %u", petition->petitionGuid); #endif trans->PAppend("DELETE FROM petition WHERE petitionguid = %u", petition->petitionGuid); @@ -227,7 +227,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SHOW_SIGNATURES"); + LOG_DEBUG("network", "Received opcode CMSG_PETITION_SHOW_SIGNATURES"); #endif uint64 petitionguid; @@ -250,7 +250,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) uint8 signs = signatures ? signatures->signatureMap.size() : 0; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow); + LOG_DEBUG("network", "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow); #endif WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8 + 8 + 4 + 1 + signs * 12)); @@ -272,7 +272,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_QUERY"); // ok + LOG_DEBUG("network", "Received opcode CMSG_PETITION_QUERY"); // ok #endif uint32 guildguid; @@ -280,7 +280,7 @@ void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData) recvData >> guildguid; // in Trinity always same as GUID_LOPART(petitionguid) recvData >> petitionguid; // petition guid #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid); + LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid); #endif SendPetitionQueryOpcode(petitionguid); @@ -292,7 +292,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) if (!petition) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid)); + LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid)); #endif return; } @@ -338,7 +338,7 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_RENAME"); // ok + LOG_DEBUG("network", "Received opcode MSG_PETITION_RENAME"); // ok #endif uint64 petitionGuid; @@ -355,7 +355,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) if (!petition) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionGuid)); + LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionGuid)); #endif return; } @@ -398,7 +398,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) const_cast(petition)->petitionName = newName; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str()); + LOG_DEBUG("network", "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str()); #endif WorldPacket data(MSG_PETITION_RENAME, (8 + newName.size() + 1)); data << uint64(petitionGuid); @@ -409,7 +409,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SIGN"); // ok + LOG_DEBUG("network", "Received opcode CMSG_PETITION_SIGN"); // ok #endif uint64 petitionGuid; @@ -420,7 +420,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid)); if (!petition) { - sLog->outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); + LOG_ERROR("server", "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); return; } @@ -527,7 +527,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) sPetitionMgr->AddSignature(GUID_LOPART(petitionGuid), GetAccountId(), playerGuid); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId()); + LOG_DEBUG("network", "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId()); #endif WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8 + 8 + 4)); @@ -551,14 +551,14 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_DECLINE"); // ok + LOG_DEBUG("network", "Received opcode MSG_PETITION_DECLINE"); // ok #endif uint64 petitionguid; uint64 ownerguid; recvData >> petitionguid; // petition guid #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow()); + LOG_DEBUG("network", "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow()); #endif Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid)); @@ -577,7 +577,7 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData) void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_OFFER_PETITION"); // ok + LOG_DEBUG("network", "Received opcode CMSG_OFFER_PETITION"); // ok #endif uint64 petitionguid, plguid; @@ -667,7 +667,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData) void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_TURN_IN_PETITION"); + LOG_DEBUG("network", "Received opcode CMSG_TURN_IN_PETITION"); #endif // Get petition guid from packet @@ -682,13 +682,13 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow()); + LOG_DEBUG("network", "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow()); #endif Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid)); if (!petition) { - sLog->outError("Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid)); + LOG_ERROR("server", "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid)); return; } @@ -807,7 +807,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) // Register arena team sArenaTeamMgr->AddArenaTeam(arenaTeam); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitonsHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId()); + LOG_DEBUG("network", "PetitonsHandler: Arena team (guid: %u) added to ObjectMgr", arenaTeam->GetId()); #endif // Add members @@ -815,7 +815,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) for (SignatureMap::const_iterator itr = signatureCopy.begin(); itr != signatureCopy.end(); ++itr) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), itr->first); + LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), itr->first); #endif arenaTeam->AddMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); } @@ -838,7 +838,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) // created #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid)); + LOG_DEBUG("network", "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid)); #endif data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4); @@ -849,7 +849,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData) void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Received CMSG_PETITION_SHOWLIST"); + LOG_DEBUG("network", "Received CMSG_PETITION_SHOWLIST"); #endif uint64 guid; @@ -864,7 +864,7 @@ void WorldSession::SendPetitionShowList(uint64 guid) if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -937,6 +937,6 @@ void WorldSession::SendPetitionShowList(uint64 guid) SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Sent SMSG_PETITION_SHOWLIST"); + LOG_DEBUG("network", "Sent SMSG_PETITION_SHOWLIST"); #endif } diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 674ec3d45e..569894cbd5 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -61,7 +61,7 @@ void WorldSession::HandleNameQueryOpcode(WorldPacket& recvData) recvData >> guid; // This is disable by default to prevent lots of console spam - // sLog->outString("HandleNameQueryOpcode %u", guid); + // LOG_INFO("server", "HandleNameQueryOpcode %u", guid); SendNameQueryOpcode(guid); } @@ -138,13 +138,13 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entry); + LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entry); #endif WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 4); data << uint32(entry | 0x80000000); SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE"); + LOG_DEBUG("network", "WORLD: Sent SMSG_CREATURE_QUERY_RESPONSE"); #endif } } @@ -177,7 +177,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); + LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); #endif WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 150); data << uint32(entry); @@ -201,20 +201,20 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); + LOG_DEBUG("network", "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); #endif } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", + LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entry); #endif WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4); data << uint32(entry | 0x80000000); SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); + LOG_DEBUG("network", "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE"); #endif } } @@ -222,7 +222,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_CORPSE_QUERY"); + LOG_DEBUG("network", "WORLD: Received MSG_CORPSE_QUERY"); #endif Corpse* corpse = GetPlayer()->GetCorpse(); @@ -279,7 +279,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData) recvData >> textID; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_NPC_TEXT_QUERY TextId: %u", textID); + LOG_DEBUG("network", "WORLD: CMSG_NPC_TEXT_QUERY TextId: %u", textID); #endif recvData >> guid; @@ -358,7 +358,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData) SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_NPC_TEXT_UPDATE"); + LOG_DEBUG("network", "WORLD: Sent SMSG_NPC_TEXT_UPDATE"); #endif } @@ -366,7 +366,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData) void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PAGE_TEXT_QUERY"); + LOG_DEBUG("network", "WORLD: Received CMSG_PAGE_TEXT_QUERY"); #endif uint32 pageID; @@ -402,7 +402,7 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData) SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE"); + LOG_DEBUG("network", "WORLD: Sent SMSG_PAGE_TEXT_QUERY_RESPONSE"); #endif } } @@ -410,7 +410,7 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket& recvData) void WorldSession::HandleCorpseMapPositionQuery(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY"); + LOG_DEBUG("network", "WORLD: Recv CMSG_CORPSE_MAP_POSITION_QUERY"); #endif uint32 unk; diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index bd1b64e88d..20bbc854ac 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -36,7 +36,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData) if (!questGiver) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid)); + LOG_DEBUG("server", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid)); #endif return; } @@ -46,7 +46,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData) case TYPEID_UNIT: { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid))); #endif if (!questGiver->ToCreature()->IsHostileTo(_player)) // do not show quest status to enemies questStatus = _player->GetQuestDialogStatus(questGiver); @@ -55,13 +55,13 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData) case TYPEID_GAMEOBJECT: { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid))); #endif questStatus = _player->GetQuestDialogStatus(questGiver); break; } default: - sLog->outError("QuestGiver called for unexpected type %u", questGiver->GetTypeId()); + LOG_ERROR("server", "QuestGiver called for unexpected type %u", questGiver->GetTypeId()); break; } @@ -75,14 +75,14 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData) recvData >> guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid)); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid)); #endif Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!creature) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guid)); + LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guid)); #endif return; } @@ -116,7 +116,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData) recvData >> guid >> questId >> unk1; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); #endif Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM | TYPEMASK_PLAYER); @@ -207,7 +207,7 @@ void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData) uint8 unk1; recvData >> guid >> questId >> unk1; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1); #endif // Verify that the guid is valid and is a questgiver or involved in the requested quest @@ -244,7 +244,7 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData) uint32 questId; recvData >> questId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_QUERY quest = %u", questId); + LOG_DEBUG("network", "WORLD: Received CMSG_QUEST_QUERY quest = %u", questId); #endif if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) @@ -259,12 +259,12 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) if (reward >= QUEST_REWARD_CHOICES_COUNT) { - sLog->outError("Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName().c_str(), _player->GetGUIDLow(), reward); + LOG_ERROR("server", "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName().c_str(), _player->GetGUIDLow(), reward); return; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), questId, reward); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), questId, reward); #endif Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); @@ -280,7 +280,7 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) || (_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete())) { - sLog->outError("HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!", + LOG_ERROR("server", "HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!", _player->GetName().c_str(), _player->GetGUIDLow(), questId); return; } @@ -346,7 +346,7 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData) recvData >> guid >> questId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); #endif Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); @@ -370,7 +370,7 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData) void WorldSession::HandleQuestgiverCancel(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CANCEL"); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CANCEL"); #endif _player->PlayerTalkClass->SendCloseGossip(); @@ -385,7 +385,7 @@ void WorldSession::HandleQuestLogSwapQuest(WorldPacket& recvData) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTLOG_SWAP_QUEST slot 1 = %u, slot 2 = %u", slot1, slot2); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTLOG_SWAP_QUEST slot 1 = %u, slot 2 = %u", slot1, slot2); #endif GetPlayer()->SwapQuestSlot(slot1, slot2); @@ -397,7 +397,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData) recvData >> slot; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u", slot); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTLOG_REMOVE_QUEST slot = %u", slot); #endif if (slot < MAX_QUEST_LOG_SIZE) @@ -427,7 +427,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData) sEluna->OnQuestAbandon(_player, questId); #endif #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Player %u abandoned quest %u", _player->GetGUIDLow(), questId); + LOG_DEBUG("server", "Player %u abandoned quest %u", _player->GetGUIDLow(), questId); #endif // check if Quest Tracker is enabled if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) @@ -454,7 +454,7 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData) recvData >> questId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", questId); + LOG_DEBUG("network", "WORLD: Received CMSG_QUEST_CONFIRM_ACCEPT quest = %u", questId); #endif if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) @@ -493,7 +493,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) recvData >> guid >> questId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId); #endif Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT); @@ -508,7 +508,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) { if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) { - sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!", + LOG_ERROR("server", "Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!", _player->GetName().c_str(), _player->GetGUIDLow(), questId); return; } @@ -537,7 +537,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData) void WorldSession::HandleQuestgiverQuestAutoLaunch(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH"); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUEST_AUTOLAUNCH"); #endif } @@ -550,7 +550,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", questId); + LOG_DEBUG("network", "WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", questId); #endif if (Quest const* quest = sObjectMgr->GetQuestTemplate(questId)) @@ -630,7 +630,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) recvPacket >> guid >> questId >> msg; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_QUEST_PUSH_RESULT"); + LOG_DEBUG("network", "WORLD: Received MSG_QUEST_PUSH_RESULT"); #endif if (_player->GetDivider() && _player->GetDivider() == guid) @@ -649,7 +649,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY"); + LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_MULTIPLE_QUERY"); #endif uint32 count = 0; diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp index e2785e95ba..927ce9fd2f 100644 --- a/src/server/game/Handlers/ReferAFriendHandler.cpp +++ b/src/server/game/Handlers/ReferAFriendHandler.cpp @@ -13,7 +13,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GRANT_LEVEL"); + LOG_DEBUG("network", "WORLD: CMSG_GRANT_LEVEL"); #endif uint64 guid; @@ -58,7 +58,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData) void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ACCEPT_LEVEL_GRANT"); + LOG_DEBUG("network", "WORLD: CMSG_ACCEPT_LEVEL_GRANT"); #endif uint64 guid; diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 7caad2550d..00c26c8a0b 100644 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -27,7 +27,7 @@ void WorldSession::HandleLearnTalentOpcode(WorldPacket& recvData) void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_LEARN_PREVIEW_TALENTS"); + LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS"); #endif uint32 talentsCount; @@ -53,7 +53,7 @@ void WorldSession::HandleLearnPreviewTalents(WorldPacket& recvPacket) void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "MSG_TALENT_WIPE_CONFIRM"); + LOG_DEBUG("network", "MSG_TALENT_WIPE_CONFIRM"); #endif uint64 guid; recvData >> guid; @@ -62,7 +62,7 @@ void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); #endif return; } diff --git a/src/server/game/Handlers/Socialhandler.cpp b/src/server/game/Handlers/Socialhandler.cpp index 7134c699f9..ac3f5dd92e 100644 --- a/src/server/game/Handlers/Socialhandler.cpp +++ b/src/server/game/Handlers/Socialhandler.cpp @@ -19,14 +19,14 @@ void WorldSession::HandleContactListOpcode(WorldPacket& recv_data) uint32 flags; recv_data >> flags; - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_CONTACT_LIST - Unk: %d", flags); + LOG_DEBUG("network", "WORLD: Received CMSG_CONTACT_LIST - Unk: %d", flags); _player->GetSocial()->SendSocialList(_player, flags); } void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ADD_FRIEND"); + LOG_DEBUG("network", "WORLD: Received CMSG_ADD_FRIEND"); std::string friendName = GetAcoreString(LANG_FRIEND_IGNORE_UNKNOWN); std::string friendNote; @@ -37,7 +37,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data) if (!normalizePlayerName(friendName)) return; - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to add friend : '%s'", GetPlayer()->GetName().c_str(), friendName.c_str()); + LOG_DEBUG("network", "WORLD: %s asked to add friend : '%s'", GetPlayer()->GetName().c_str(), friendName.c_str()); // xinef: Get Data From global storage uint32 guidLow = sWorld->GetGlobalPlayerGUID(friendName); @@ -81,7 +81,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data) sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, guidLow, false); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_FRIEND_STATUS)"); + LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)"); } void WorldSession::HandleDelFriendOpcode(WorldPacket& recv_data) @@ -93,7 +93,7 @@ void WorldSession::HandleDelFriendOpcode(WorldPacket& recv_data) sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, GUID_LOPART(FriendGUID), false); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); + LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); } void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recv_data) @@ -105,7 +105,7 @@ void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recv_data) if (!normalizePlayerName(ignoreName)) return; - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: %s asked to Ignore: '%s'", GetPlayer()->GetName().c_str(), ignoreName.c_str()); + LOG_DEBUG("network", "WORLD: %s asked to Ignore: '%s'", GetPlayer()->GetName().c_str(), ignoreName.c_str()); uint32 lowGuid = sWorld->GetGlobalPlayerGUID(ignoreName); if (!lowGuid) @@ -129,7 +129,7 @@ void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recv_data) sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, lowGuid, false); - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_FRIEND_STATUS)"); + LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)"); } void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recv_data) diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 4b5bc5285f..435e6e5237 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -88,7 +88,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size()); + LOG_DEBUG("network", "WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size()); #endif ItemTemplate const* proto = pItem->GetTemplate(); @@ -166,7 +166,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size()); + LOG_DEBUG("network", "WORLD: CMSG_OPEN_ITEM packet, data length = %i", (uint32)recvPacket.size()); #endif Player* pUser = _player; @@ -187,7 +187,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) recvPacket >> bagIndex >> slot; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("bagIndex: %u, slot: %u", bagIndex, slot); + LOG_DEBUG("server", "bagIndex: %u, slot: %u", bagIndex, slot); #endif Item* item = pUser->GetItemByPos(bagIndex, slot); @@ -208,7 +208,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!(proto->Flags & ITEM_FLAG_HAS_LOOT) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED)) { pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr); - sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!", + LOG_ERROR("server", "Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!", pUser->GetName().c_str(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId); return; } @@ -222,7 +222,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) if (!lockInfo) { pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr); - sLog->outError("WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId); + LOG_ERROR("server", "WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId); return; } @@ -263,7 +263,7 @@ void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uin if (!result) { - sLog->outError("Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow()); + LOG_ERROR("server", "Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow()); GetPlayer()->DestroyItem(item->GetBagSlot(), item->GetSlot(), true); return; } @@ -295,7 +295,7 @@ void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData) recvData >> guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); + LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid)); #endif if (GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid)) @@ -318,7 +318,7 @@ void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket) recvPacket >> guid; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [in game guid: %u]", GUID_LOPART(guid)); + LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [in game guid: %u]", GUID_LOPART(guid)); #endif // ignore for remote control state @@ -347,7 +347,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) uint32 oldSpellId = spellId; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: got cast spell packet, castCount: %u, spellId: %u, castFlags: %u, data length = %u", castCount, spellId, castFlags, (uint32)recvPacket.size()); + LOG_DEBUG("network", "WORLD: got cast spell packet, castCount: %u, spellId: %u, castFlags: %u, data length = %u", castCount, spellId, castFlags, (uint32)recvPacket.size()); #endif // ignore for remote control state (for player case) @@ -362,7 +362,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) if (!spellInfo) { - sLog->outError("WORLD: unknown spell id %u", spellId); + LOG_ERROR("server", "WORLD: unknown spell id %u", spellId); recvPacket.rfinish(); // prevent spam at ignore packet return; } @@ -507,7 +507,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { - sLog->outError("WORLD: unknown PET spell id %u", spellId); + LOG_ERROR("server", "WORLD: unknown PET spell id %u", spellId); return; } @@ -515,13 +515,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) if (!pet) { - sLog->outError("HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + LOG_ERROR("server", "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm()) { - sLog->outError("HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + LOG_ERROR("server", "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); return; } @@ -585,7 +585,7 @@ void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket) void WorldSession::HandleSelfResOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SELF_RES"); // empty opcode + LOG_DEBUG("network", "WORLD: CMSG_SELF_RES"); // empty opcode #endif if (_player->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) @@ -625,7 +625,7 @@ void WorldSession::HandleSpellClick(WorldPacket& recvData) void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_GET_MIRRORIMAGE_DATA"); + LOG_DEBUG("network", "WORLD: CMSG_GET_MIRRORIMAGE_DATA"); #endif uint64 guid; recvData >> guid; @@ -720,7 +720,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData) void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_UPDATE_PROJECTILE_POSITION"); + LOG_DEBUG("network", "WORLD: CMSG_UPDATE_PROJECTILE_POSITION"); #endif uint64 casterGuid; diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index 6c1ee4fb6d..c72f8b2878 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -18,7 +18,7 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXINODE_STATUS_QUERY"); + LOG_DEBUG("network", "WORLD: Received CMSG_TAXINODE_STATUS_QUERY"); #endif uint64 guid; @@ -34,7 +34,7 @@ void WorldSession::SendTaxiStatus(uint64 guid) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid))); #endif return; } @@ -46,7 +46,7 @@ void WorldSession::SendTaxiStatus(uint64 guid) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: current location %u ", curloc); + LOG_DEBUG("network", "WORLD: current location %u ", curloc); #endif WorldPacket data(SMSG_TAXINODE_STATUS, 9); @@ -54,14 +54,14 @@ void WorldSession::SendTaxiStatus(uint64 guid) data << uint8(GetPlayer()->m_taxi.IsTaximaskNodeKnown(curloc) ? 1 : 0); SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_TAXINODE_STATUS"); + LOG_DEBUG("network", "WORLD: Sent SMSG_TAXINODE_STATUS"); #endif } void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES"); + LOG_DEBUG("network", "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES"); #endif uint64 guid; @@ -72,7 +72,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData) if (!unit) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); #endif return; } @@ -101,7 +101,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) if (unit->GetEntry() == 29480) GetPlayer()->SetTaxiCheater(true); // Grimwing in Ebon Hold, special case. NOTE: Not perfect, Zul'Aman should not be included according to WoWhead, and I think taxicheat includes it. #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_TAXINODE_STATUS_QUERY %u ", curloc); + LOG_DEBUG("network", "WORLD: CMSG_TAXINODE_STATUS_QUERY %u ", curloc); #endif WorldPacket data(SMSG_SHOWTAXINODES, (4 + 8 + 4 + 8 * 4)); @@ -112,7 +112,7 @@ void WorldSession::SendTaxiMenu(Creature* unit) SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_SHOWTAXINODES"); + LOG_DEBUG("network", "WORLD: Sent SMSG_SHOWTAXINODES"); #endif GetPlayer()->SetTaxiCheater(lastTaxiCheaterState); @@ -169,7 +169,7 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid) void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXIEXPRESS"); + LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS"); #endif uint64 guid; @@ -181,7 +181,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData) if (!npc) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); #endif return; } @@ -206,7 +206,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d", nodes.front(), nodes.back()); + LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d", nodes.front(), nodes.back()); #endif GetPlayer()->ActivateTaxiPathTo(nodes, npc, 0); @@ -215,7 +215,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData) void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_MOVE_SPLINE_DONE"); + LOG_DEBUG("network", "WORLD: Received CMSG_MOVE_SPLINE_DONE"); #endif uint64 guid; // used only for proper packet read @@ -231,7 +231,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData) void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI"); + LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI"); #endif uint64 guid; @@ -240,13 +240,13 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData) recvData >> guid >> nodes[0] >> nodes[1]; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI from %d to %d", nodes[0], nodes[1]); + LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI from %d to %d", nodes[0], nodes[1]); #endif Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); + LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); #endif return; } @@ -270,6 +270,6 @@ void WorldSession::SendActivateTaxiReply(ActivateTaxiReply reply) SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ACTIVATETAXIREPLY"); + LOG_DEBUG("network", "WORLD: Sent SMSG_ACTIVATETAXIREPLY"); #endif } diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index b582e67383..d045ee68c8 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -79,7 +79,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) } else { - sLog->outError("CMSG_GMTICKET_CREATE possibly corrupt. Uncompression failed."); + LOG_ERROR("server", "CMSG_GMTICKET_CREATE possibly corrupt. Uncompression failed."); recvData.rfinish(); return; } diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index ea93790f33..9756e67394 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -60,7 +60,7 @@ void WorldSession::SendTradeStatus(TradeStatus status) void WorldSession::HandleIgnoreTradeOpcode(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Ignore Trade %u", _player->GetGUIDLow()); + LOG_DEBUG("network", "WORLD: Ignore Trade %u", _player->GetGUIDLow()); #endif // recvPacket.print_storage(); } @@ -68,7 +68,7 @@ void WorldSession::HandleIgnoreTradeOpcode(WorldPacket& /*recvPacket*/) void WorldSession::HandleBusyTradeOpcode(WorldPacket& /*recvPacket*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Busy Trade %u", _player->GetGUIDLow()); + LOG_DEBUG("network", "WORLD: Busy Trade %u", _player->GetGUIDLow()); #endif // recvPacket.print_storage(); } @@ -145,7 +145,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { // logging #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "partner storing: %u", myItems[i]->GetGUIDLow()); + LOG_DEBUG("network", "partner storing: %u", myItems[i]->GetGUIDLow()); #endif // adjust time (depends on /played) @@ -158,7 +158,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { // logging #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "player storing: %u", hisItems[i]->GetGUIDLow()); + LOG_DEBUG("network", "player storing: %u", hisItems[i]->GetGUIDLow()); #endif // adjust time (depends on /played) @@ -175,21 +175,21 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) if (myItems[i]) { if (!traderCanTrade) - sLog->outError("trader can't store item: %u", myItems[i]->GetGUIDLow()); + LOG_ERROR("server", "trader can't store item: %u", myItems[i]->GetGUIDLow()); if (_player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, myItems[i], false) == EQUIP_ERR_OK) _player->MoveItemToInventory(playerDst, myItems[i], true, true); else - sLog->outError("player can't take item back: %u", myItems[i]->GetGUIDLow()); + LOG_ERROR("server", "player can't take item back: %u", myItems[i]->GetGUIDLow()); } // return the already removed items to the original owner if (hisItems[i]) { if (!playerCanTrade) - sLog->outError("player can't store item: %u", hisItems[i]->GetGUIDLow()); + LOG_ERROR("server", "player can't store item: %u", hisItems[i]->GetGUIDLow()); if (trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false) == EQUIP_ERR_OK) trader->MoveItemToInventory(traderDst, hisItems[i], true, true); else - sLog->outError("trader can't take item back: %u", hisItems[i]->GetGUIDLow()); + LOG_ERROR("server", "trader can't take item back: %u", hisItems[i]->GetGUIDLow()); } } } @@ -208,7 +208,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item * * if (Item* item = myTrade->GetItem(TradeSlots(i))) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); + LOG_DEBUG("server", "player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); #endif //Can return nullptr myItems[i] = item; @@ -218,7 +218,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item * * if (Item* item = hisTrade->GetItem(TradeSlots(i))) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); + LOG_DEBUG("server", "partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot()); #endif hisItems[i] = item; hisItems[i]->SetInTrade(); diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp index 7a00778df0..f25e2ab300 100644 --- a/src/server/game/Handlers/VehicleHandler.cpp +++ b/src/server/game/Handlers/VehicleHandler.cpp @@ -15,7 +15,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE"); #endif uint64 vehicleGUID = _player->GetCharmGUID(); @@ -50,7 +50,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket& recvData) void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE"); #endif Unit* vehicle_base = GetPlayer()->GetVehicleBase(); @@ -64,7 +64,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData) if (!seat->CanSwitchFromSeat()) { recvData.rfinish(); // prevent warnings spam - sLog->outError("HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.", + LOG_ERROR("server", "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.", recvData.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags); return; } @@ -159,7 +159,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data) if (!vehicle) { data.rfinish(); // prevent warnings spam - sLog->outError("HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow()); + LOG_ERROR("server", "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow()); return; } @@ -171,13 +171,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data) Player* player = ObjectAccessor::GetPlayer(*_player, guid); if (!player) { - sLog->outError("Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + LOG_ERROR("server", "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } if (!player->IsOnVehicle(vehicle->GetBase())) { - sLog->outError("Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + LOG_ERROR("server", "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } @@ -186,7 +186,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data) if (seat->IsEjectable()) player->ExitVehicle(); else - sLog->outError("Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + LOG_ERROR("server", "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); } else if (IS_CREATURE_GUID(guid)) @@ -194,13 +194,13 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data) Unit* unit = ObjectAccessor::GetUnit(*_player, guid); if (!unit) // creatures can be ejected too from player mounts { - sLog->outError("Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + LOG_ERROR("server", "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } if (!unit->IsOnVehicle(vehicle->GetBase())) { - sLog->outError("Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + LOG_ERROR("server", "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); return; } @@ -212,16 +212,16 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data) unit->ExitVehicle(); } else - sLog->outError("Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); + LOG_ERROR("server", "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); } else - sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid); + LOG_ERROR("server", "HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid); } void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT"); + LOG_DEBUG("network", "WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT"); #endif if (Vehicle* vehicle = GetPlayer()->GetVehicle()) @@ -231,7 +231,7 @@ void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/) if (seat->CanEnterOrExit()) GetPlayer()->ExitVehicle(); else - sLog->outError("Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.", + LOG_ERROR("server", "Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.", GetPlayer()->GetGUIDLow(), seat->m_ID, seat->m_flags); } } diff --git a/src/server/game/Handlers/VoiceChatHandler.cpp b/src/server/game/Handlers/VoiceChatHandler.cpp index 9c0c7383a1..eb0bcb12a3 100644 --- a/src/server/game/Handlers/VoiceChatHandler.cpp +++ b/src/server/game/Handlers/VoiceChatHandler.cpp @@ -13,7 +13,7 @@ void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_VOICE_SESSION_ENABLE"); + LOG_DEBUG("network", "WORLD: CMSG_VOICE_SESSION_ENABLE"); #endif // uint8 isVoiceEnabled, uint8 isMicrophoneEnabled recvData.read_skip(); @@ -23,7 +23,7 @@ void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recvData) void WorldSession::HandleChannelVoiceOnOpcode(WorldPacket& /*recvData*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CHANNEL_VOICE_ON"); + LOG_DEBUG("network", "WORLD: CMSG_CHANNEL_VOICE_ON"); #endif // Enable Voice button in channel context menu } @@ -31,7 +31,7 @@ void WorldSession::HandleChannelVoiceOnOpcode(WorldPacket& /*recvData*/) void WorldSession::HandleSetActiveVoiceChannel(WorldPacket& recvData) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL"); + LOG_DEBUG("network", "WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL"); #endif recvData.read_skip(); recvData.read_skip(); diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 1d23fe4317..1a49d4530c 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -59,19 +59,19 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance const MapEntry* entry = sMapStore.LookupEntry(mapId); if (!entry) { - sLog->outError("InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId); + LOG_ERROR("server", "InstanceSaveManager::AddInstanceSave: wrong mapid = %d, instanceid = %d!", mapId, instanceId); return nullptr; } if (instanceId == 0) { - sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId); + LOG_ERROR("server", "InstanceSaveManager::AddInstanceSave: mapid = %d, wrong instanceid = %d!", mapId, instanceId); return nullptr; } if (difficulty >= (entry->IsRaid() ? MAX_RAID_DIFFICULTY : MAX_DUNGEON_DIFFICULTY)) { - sLog->outError("InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty); + LOG_ERROR("server", "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d, wrong dificalty %u!", mapId, instanceId, difficulty); return nullptr; } @@ -199,13 +199,13 @@ MapEntry const* InstanceSave::GetMapEntry() void InstanceSave::AddPlayer(uint32 guidLow) { - ACORE_GUARD(ACE_Thread_Mutex, _lock); + std::lock_guard guard(_lock); m_playerList.push_back(guidLow); } bool InstanceSave::RemovePlayer(uint32 guidLow, InstanceSaveManager* ism) { - ACORE_GUARD(ACE_Thread_Mutex, _lock); + std::lock_guard guard(_lock); m_playerList.remove(guidLow); // ism passed as an argument to avoid calling via singleton (might result in a deadlock) @@ -244,8 +244,8 @@ void InstanceSaveManager::LoadInstances() LoadInstanceSaves(); LoadCharacterBinds(); - sLog->outString(">> Loaded instances and binds in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded instances and binds in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void InstanceSaveManager::LoadResetTimes() @@ -268,7 +268,7 @@ void InstanceSaveManager::LoadResetTimes() MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty); if (!mapDiff) { - sLog->outError("InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty); + LOG_ERROR("server", "InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty); CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid, difficulty); continue; } @@ -445,7 +445,7 @@ void InstanceSaveManager::Update() // pussywizard: send updated calendar and raid info if (resetOccurred) { - sLog->outString("Instance ID reset occurred, sending updated calendar and raid info to all players!"); + LOG_INFO("server", "Instance ID reset occurred, sending updated calendar and raid info to all players!"); WorldPacket dummy; for (SessionMap::const_iterator itr = sWorld->GetAllSessions().begin(); itr != sWorld->GetAllSessions().end(); ++itr) if (Player* plr = itr->second->GetPlayer()) @@ -519,7 +519,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty); if (!mapDiff || !mapDiff->resetTime) { - sLog->outError("InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid); + LOG_ERROR("server", "InstanceSaveManager::ResetOrWarnAll: not valid difficulty or no reset delay for map %d", mapid); return; } diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h index 85eb94f7c8..287f350ce7 100644 --- a/src/server/game/Instances/InstanceSaveMgr.h +++ b/src/server/game/Instances/InstanceSaveMgr.h @@ -11,10 +11,9 @@ #include "DBCEnums.h" #include "Define.h" #include "ObjectDefines.h" -#include -#include #include #include +#include #include struct InstanceTemplate; @@ -88,7 +87,7 @@ private: std::string m_instanceData; uint32 m_completedEncounterMask; - ACE_Thread_Mutex _lock; + std::mutex _lock; }; typedef std::unordered_map ResetTimeByMapDifficultyMap; diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index c2510d7153..11c99c2a2c 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -45,7 +45,7 @@ void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject* go) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: InstanceScript: HandleGameObject failed"); + LOG_DEBUG("scripts.ai", "TSCR: InstanceScript: HandleGameObject failed"); #endif } } @@ -69,7 +69,7 @@ void InstanceScript::LoadMinionData(const MinionData* data) ++data; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_TSCR, "InstanceScript::LoadMinionData: " UI64FMTD " minions loaded.", uint64(minions.size())); + LOG_DEBUG("scripts.ai", "InstanceScript::LoadMinionData: " UI64FMTD " minions loaded.", uint64(minions.size())); #endif } @@ -83,7 +83,7 @@ void InstanceScript::LoadDoorData(const DoorData* data) ++data; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_TSCR, "InstanceScript::LoadDoorData: " UI64FMTD " doors loaded.", uint64(doors.size())); + LOG_DEBUG("scripts.ai", "InstanceScript::LoadDoorData: " UI64FMTD " doors loaded.", uint64(doors.size())); #endif } @@ -202,7 +202,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state) if (bossInfo->state == TO_BE_DECIDED) // loading { bossInfo->state = state; - //sLog->outError("Inialize boss %u state as %u.", id, (uint32)state); + //LOG_ERROR("server", "Inialize boss %u state as %u.", id, (uint32)state); return false; } else @@ -272,7 +272,7 @@ void InstanceScript::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, go->ResetDoorOrButton(); } else - sLog->outError("SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType()); + LOG_ERROR("server", "SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType()); } } @@ -305,7 +305,7 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: DoUpdateWorldState attempt send data but no players in map."); + LOG_DEBUG("scripts.ai", "TSCR: DoUpdateWorldState attempt send data but no players in map."); #endif } } @@ -392,7 +392,7 @@ void InstanceScript::DoCastSpellOnPlayers(uint32 spell) bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= nullptr*/, uint32 /*miscvalue1*/ /*= 0*/) { - sLog->outError("Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u", + LOG_ERROR("server", "Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u", instance->GetId(), criteria_id); return false; } diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 1bf4075f72..3204aab17b 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -13,11 +13,11 @@ #include "World.h" #include "ZoneScript.h" -#define OUT_SAVE_INST_DATA sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_SAVE_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_LOAD_INST_DATA(a) sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) -#define OUT_LOAD_INST_DATA_COMPLETE sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -#define OUT_LOAD_INST_DATA_FAIL sLog->outError("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_SAVE_INST_DATA LOG_DEBUG("scripts.ai", "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_SAVE_INST_DATA_COMPLETE LOG_DEBUG("scripts.ai", "TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA(a) LOG_DEBUG("scripts.ai", "TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a) +#define OUT_LOAD_INST_DATA_COMPLETE LOG_DEBUG("scripts.ai", "TSCR: Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) +#define OUT_LOAD_INST_DATA_FAIL LOG_ERROR("server", "TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) class Map; class Unit; diff --git a/src/server/game/Loot/LootItemStorage.cpp b/src/server/game/Loot/LootItemStorage.cpp index 6efcb2ce9c..7ecbd1f105 100644 --- a/src/server/game/Loot/LootItemStorage.cpp +++ b/src/server/game/Loot/LootItemStorage.cpp @@ -30,8 +30,8 @@ void LootItemStorage::LoadStorageFromDB() PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - sLog->outString(">> Loaded 0 stored items!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 stored items!"); + LOG_INFO("server", " "); return; } @@ -46,8 +46,8 @@ void LootItemStorage::LoadStorageFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %d stored items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %d stored items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void LootItemStorage::RemoveEntryFromDB(uint32 containerId, uint32 itemid, uint32 count) @@ -66,7 +66,7 @@ void LootItemStorage::AddNewStoredLoot(Loot* loot, Player* /*player*/) { if (lootItemStore.find(loot->containerId) != lootItemStore.end()) { - sLog->outMisc("LootItemStorage::AddNewStoredLoot (A1) - %u!", loot->containerId); + LOG_INFO("misc", "LootItemStorage::AddNewStoredLoot (A1) - %u!", loot->containerId); return; } diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index c40916dab3..3f6576c059 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -154,13 +154,13 @@ uint32 LootStore::LoadLootTable() if (maxcount > std::numeric_limits::max()) { - sLog->outErrorDb("Table '%s' Entry %d Item %d: MaxCount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits::max()); + LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: MaxCount value (%u) to large. must be less %u - skipped", GetName(), entry, item, maxcount, std::numeric_limits::max()); continue; // error already printed to log/console. } if (lootmode == 0) { - sLog->outError("Table '%s' Entry %d Item %d: LootMode is equal to 0, item will never drop - setting mode 1", GetName(), entry, item); + LOG_ERROR("server", "Table '%s' Entry %d Item %d: LootMode is equal to 0, item will never drop - setting mode 1", GetName(), entry, item); lootmode = 1; } @@ -266,17 +266,17 @@ void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const { // all still listed ids isn't referenced for (LootIdSet::const_iterator itr = lootIdSet.begin(); itr != lootIdSet.end(); ++itr) - sLog->outErrorDb("Table '%s' Entry %d isn't %s and not referenced from loot, and thus useless.", GetName(), *itr, GetEntryName()); + LOG_ERROR("sql.sql", "Table '%s' Entry %d isn't %s and not referenced from loot, and thus useless.", GetName(), *itr, GetEntryName()); } void LootStore::ReportNonExistingId(uint32 lootId) const { - sLog->outErrorDb("Table '%s' Entry %d does not exist", GetName(), lootId); + LOG_ERROR("sql.sql", "Table '%s' Entry %d does not exist", GetName(), lootId); } void LootStore::ReportNonExistingId(uint32 lootId, const char* ownerType, uint32 ownerId) const { - sLog->outErrorDb("Table '%s' Entry %d does not exist but it is used by %s %d", GetName(), lootId, ownerType, ownerId); + LOG_ERROR("sql.sql", "Table '%s' Entry %d does not exist but it is used by %s %d", GetName(), lootId, ownerType, ownerId); } // @@ -309,13 +309,13 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const { if (groupid >= 1 << 7) // it stored in 7 bit field { - sLog->outErrorDb("Table '%s' Entry %d Item %d: GroupId (%u) must be less %u - skipped", store.GetName(), entry, itemid, groupid, 1 << 7); + LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: GroupId (%u) must be less %u - skipped", store.GetName(), entry, itemid, groupid, 1 << 7); return false; } if (mincount == 0) { - sLog->outErrorDb("Table '%s' Entry %d Item %d: wrong MinCount (%d) - skipped", store.GetName(), entry, itemid, mincount); + LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: wrong MinCount (%d) - skipped", store.GetName(), entry, itemid, mincount); return false; } @@ -324,36 +324,36 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid); if (!proto) { - sLog->outErrorDb("Table '%s' Entry %d Item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); + LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); return false; } if (chance == 0 && groupid == 0) // Zero chance is allowed for grouped entries only { - sLog->outErrorDb("Table '%s' Entry %d Item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid); + LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: equal-chanced grouped entry, but group not defined - skipped", store.GetName(), entry, itemid); return false; } if (chance != 0 && chance < 0.000001f) // loot with low chance { - sLog->outErrorDb("Table '%s' Entry %d Item %d: low chance (%f) - skipped", + LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: low chance (%f) - skipped", store.GetName(), entry, itemid, chance); return false; } if (maxcount < mincount) // wrong max count { - sLog->outErrorDb("Table '%s' Entry %d Item %d: MaxCount (%u) less that MinCount (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincount); + LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: MaxCount (%u) less that MinCount (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincount); return false; } } else // if reference loot { if (needs_quest) - sLog->outErrorDb("Table '%s' Entry %d Item %d: quest required will be ignored", store.GetName(), entry, itemid); + LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: quest required will be ignored", store.GetName(), entry, itemid); else if (chance == 0) // no chance for the reference { - sLog->outErrorDb("Table '%s' Entry %d Item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid); + LOG_ERROR("sql.sql", "Table '%s' Entry %d Item %d: zero chance is specified for a reference, skipped", store.GetName(), entry, itemid); return false; } } @@ -494,7 +494,7 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo if (!tab) { if (!noEmptyError) - sLog->outErrorDb("Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId); + LOG_ERROR("sql.sql", "Table '%s' loot id #%u used but it doesn't have records.", store.GetName(), lootId); return false; } @@ -1264,12 +1264,12 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint float chance = RawTotalChance(); if (chance > 101.0f) // TODO: replace with 100% when DBs will be ready { - sLog->outErrorDb("Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance); + LOG_ERROR("sql.sql", "Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance); } if (chance >= 100.0f && !EqualChanced.empty()) { - sLog->outErrorDb("Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance); + LOG_ERROR("sql.sql", "Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance); } } @@ -1520,7 +1520,7 @@ bool LootTemplate::addConditionItem(Condition* cond) { if (!cond || !cond->isLoaded())//should never happen, checked at loading { - sLog->outError("LootTemplate::addConditionItem: condition is null"); + LOG_ERROR("server", "LootTemplate::addConditionItem: condition is null"); return false; } @@ -1585,7 +1585,7 @@ bool LootTemplate::isReference(uint32 id) const void LoadLootTemplates_Creature() { - sLog->outString("Loading creature loot templates..."); + LOG_INFO("server", "Loading creature loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1612,16 +1612,16 @@ void LoadLootTemplates_Creature() LootTemplates_Creature.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); + LOG_ERROR("sql.sql", ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty"); - sLog->outString(); + LOG_INFO("server", " "); } void LoadLootTemplates_Disenchant() { - sLog->outString("Loading disenchanting loot templates..."); + LOG_INFO("server", "Loading disenchanting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1647,15 +1647,15 @@ void LoadLootTemplates_Disenchant() LootTemplates_Disenchant.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty"); + LOG_INFO("server", " "); } void LoadLootTemplates_Fishing() { - sLog->outString("Loading fishing loot templates..."); + LOG_INFO("server", "Loading fishing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1672,16 +1672,16 @@ void LoadLootTemplates_Fishing() LootTemplates_Fishing.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); + LOG_ERROR("sql.sql", ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty"); - sLog->outString(); + LOG_INFO("server", " "); } void LoadLootTemplates_Gameobject() { - sLog->outString("Loading gameobject loot templates..."); + LOG_INFO("server", "Loading gameobject loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1708,16 +1708,16 @@ void LoadLootTemplates_Gameobject() LootTemplates_Gameobject.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); + LOG_ERROR("sql.sql", ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty"); - sLog->outString(); + LOG_INFO("server", " "); } void LoadLootTemplates_Item() { - sLog->outString("Loading item loot templates..."); + LOG_INFO("server", "Loading item loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1734,16 +1734,16 @@ void LoadLootTemplates_Item() LootTemplates_Item.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); + LOG_ERROR("sql.sql", ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty"); - sLog->outString(); + LOG_INFO("server", " "); } void LoadLootTemplates_Milling() { - sLog->outString("Loading milling loot templates..."); + LOG_INFO("server", "Loading milling loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1765,16 +1765,16 @@ void LoadLootTemplates_Milling() LootTemplates_Milling.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); + LOG_ERROR("sql.sql", ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty"); - sLog->outString(); + LOG_INFO("server", " "); } void LoadLootTemplates_Pickpocketing() { - sLog->outString("Loading pickpocketing loot templates..."); + LOG_INFO("server", "Loading pickpocketing loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1801,16 +1801,16 @@ void LoadLootTemplates_Pickpocketing() LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); + LOG_ERROR("sql.sql", ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty"); - sLog->outString(); + LOG_INFO("server", " "); } void LoadLootTemplates_Prospecting() { - sLog->outString("Loading prospecting loot templates..."); + LOG_INFO("server", "Loading prospecting loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1832,16 +1832,16 @@ void LoadLootTemplates_Prospecting() LootTemplates_Prospecting.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); + LOG_ERROR("sql.sql", ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty"); - sLog->outString(); + LOG_INFO("server", " "); } void LoadLootTemplates_Mail() { - sLog->outString("Loading mail loot templates..."); + LOG_INFO("server", "Loading mail loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1858,16 +1858,16 @@ void LoadLootTemplates_Mail() LootTemplates_Mail.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); + LOG_ERROR("sql.sql", ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty"); - sLog->outString(); + LOG_INFO("server", " "); } void LoadLootTemplates_Skinning() { - sLog->outString("Loading skinning loot templates..."); + LOG_INFO("server", "Loading skinning loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1894,16 +1894,16 @@ void LoadLootTemplates_Skinning() LootTemplates_Skinning.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); + LOG_ERROR("sql.sql", ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty"); - sLog->outString(); + LOG_INFO("server", " "); } void LoadLootTemplates_Spell() { - sLog->outString("Loading spell loot templates..."); + LOG_INFO("server", "Loading spell loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1938,15 +1938,15 @@ void LoadLootTemplates_Spell() LootTemplates_Spell.ReportUnusedIds(lootIdSet); if (count) - sLog->outString(">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); else - sLog->outErrorDb(">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty"); + LOG_INFO("server", " "); } void LoadLootTemplates_Reference() { - sLog->outString("Loading reference loot templates..."); + LOG_INFO("server", "Loading reference loot templates..."); uint32 oldMSTime = getMSTime(); @@ -1969,6 +1969,6 @@ void LoadLootTemplates_Reference() // output error for any still listed ids (not referenced from any loot table) LootTemplates_Reference.ReportUnusedIds(lootIdSet); - sLog->outString(">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index b305a5e24c..ea29f82c2b 100644 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -40,7 +40,7 @@ MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery default: m_messageType = MAIL_NORMAL; m_senderId = 0; // will show mail from not existed player - sLog->outError("MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId()); + LOG_ERROR("server", "MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId()); break; } } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index f7f54b8464..73bf418030 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -73,14 +73,14 @@ bool Map::ExistMap(uint32 mapid, int gx, int gy) FILE* pf = fopen(tmp, "rb"); if (!pf) - sLog->outError("Map file '%s': does not exist!", tmp); + LOG_ERROR("server", "Map file '%s': does not exist!", tmp); else { map_fileheader header; if (fread(&header, sizeof(header), 1, pf) == 1) { if (header.mapMagic != MapMagic.asUInt || header.versionMagic != MapVersionMagic.asUInt) - sLog->outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp); + LOG_ERROR("server", "Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", tmp); else ret = true; } @@ -100,7 +100,7 @@ bool Map::ExistVMap(uint32 mapid, int gx, int gy) if (!exists) { std::string name = vmgr->getDirFileName(mapid, gx, gy); - sLog->outError("VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath() + "vmaps/" + name).c_str()); + LOG_ERROR("server", "VMap file '%s' is missing or points to wrong version of vmap file. Redo vmaps with latest version of vmap_assembler.exe.", (sWorld->GetDataPath() + "vmaps/" + name).c_str()); return false; } } @@ -119,17 +119,17 @@ void Map::LoadMMap(int gx, int gy) { case MMAP::MMAP_LOAD_RESULT_OK: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("MMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + LOG_DEBUG("server", "MMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); #endif break; case MMAP::MMAP_LOAD_RESULT_ERROR: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Could not load MMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + LOG_DEBUG("server", "Could not load MMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); #endif break; case MMAP::MMAP_LOAD_RESULT_IGNORED: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Ignored MMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + LOG_DEBUG("server", "Ignored MMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); #endif break; } @@ -143,17 +143,17 @@ void Map::LoadVMap(int gx, int gy) { case VMAP::VMAP_LOAD_RESULT_OK: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + LOG_DEBUG("server", "VMAP loaded name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); #endif break; case VMAP::VMAP_LOAD_RESULT_ERROR: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + LOG_DEBUG("server", "Could not load VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); #endif break; case VMAP::VMAP_LOAD_RESULT_IGNORED: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); + LOG_DEBUG("server", "Ignored VMAP name:%s, id:%d, x:%d, y:%d (vmap rep.: x:%d, y:%d)", GetMapName(), GetId(), gx, gy, gx, gy); #endif break; } @@ -180,7 +180,7 @@ void Map::LoadMap(int gx, int gy, bool reload) if (GridMaps[gx][gy]) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Unloading previously loaded map %u before reloading.", GetId()); + LOG_DEBUG("server", "Unloading previously loaded map %u before reloading.", GetId()); #endif sScriptMgr->OnUnloadGridMap(this, GridMaps[gx][gy], gx, gy); @@ -194,13 +194,13 @@ void Map::LoadMap(int gx, int gy, bool reload) tmp = new char[len]; snprintf(tmp, len, (char*)(sWorld->GetDataPath() + "maps/%03u%02u%02u.map").c_str(), GetId(), gx, gy); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Loading map %s", tmp); + LOG_DEBUG("server", "Loading map %s", tmp); #endif // loading data GridMaps[gx][gy] = new GridMap(); if (!GridMaps[gx][gy]->loadData(tmp)) { - sLog->outError("Error loading map file: \n %s\n", tmp); + LOG_ERROR("server", "Error loading map file: \n %s\n", tmp); } delete [] tmp; @@ -312,7 +312,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on) CellCoord p = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!p.IsCoordValid()) { - sLog->outError("Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + LOG_ERROR("server", "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -321,7 +321,7 @@ void Map::SwitchGridContainers(Creature* obj, bool on) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Switch object " UI64FMTD " from grid[%u, %u] %u", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y, on); + LOG_DEBUG("maps", "Switch object " SZFMTD " from grid[%u, %u] %d", obj->GetGUID(), cell.GridX(), cell.GridY(), on); #endif NGridType* ngrid = getNGrid(cell.GridX(), cell.GridY()); ASSERT(ngrid != nullptr); @@ -351,7 +351,7 @@ void Map::SwitchGridContainers(GameObject* obj, bool on) CellCoord p = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!p.IsCoordValid()) { - sLog->outError("Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + LOG_ERROR("server", "Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -404,7 +404,7 @@ void Map::EnsureGridCreated(const GridCoord& p) { if (getNGrid(p.x_coord, p.y_coord)) // pussywizard return; - ACORE_GUARD(ACE_Thread_Mutex, GridLock); + std::lock_guard guard(GridLock); EnsureGridCreated_i(p); } @@ -446,7 +446,7 @@ bool Map::EnsureGridLoaded(const Cell& cell) //if (!isGridObjectDataLoaded(cell.GridX(), cell.GridY())) //{ #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "Loading grid[%u, %u] for map %u instance %u", cell.GridX(), cell.GridY(), GetId(), i_InstanceId); + LOG_DEBUG("maps", "Loading grid[%u, %u] for map %u instance %u", cell.GridX(), cell.GridY(), GetId(), i_InstanceId); #endif setGridObjectDataLoaded(true, cell.GridX(), cell.GridY()); @@ -481,7 +481,7 @@ bool Map::AddPlayerToMap(Player* player) CellCoord cellCoord = acore::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()); if (!cellCoord.IsCoordValid()) { - sLog->outError("Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + LOG_ERROR("server", "Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; } @@ -540,7 +540,7 @@ bool Map::AddToMap(T* obj, bool checkTransport) ASSERT(cellCoord.IsCoordValid()); if (!cellCoord.IsCoordValid()) { - sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + LOG_ERROR("server", "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; //Should delete object } @@ -588,7 +588,7 @@ bool Map::AddToMap(MotionTransport* obj, bool /*checkTransport*/) CellCoord cellCoord = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY()); if (!cellCoord.IsCoordValid()) { - sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); + LOG_ERROR("server", "Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord); return false; //Should delete object } @@ -1214,7 +1214,7 @@ bool Map::UnloadGrid(NGridType& ngrid) GridMaps[gx][gy] = nullptr; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Unloading grid[%u, %u] for map %u finished", x, y, GetId()); + LOG_DEBUG("server", "Unloading grid[%u, %u] for map %u finished", x, y, GetId()); #endif return true; } @@ -1229,7 +1229,7 @@ void Map::RemoveAllPlayers() if (!player->IsBeingTeleportedFar()) { // this is happening for bg - sLog->outError("Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName().c_str(), GetId()); + LOG_ERROR("server", "Map::UnloadAll: player %s is still in map %u during unload, this should not happen!", player->GetName().c_str(), GetId()); player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation()); } } @@ -1321,28 +1321,28 @@ bool GridMap::loadData(char* filename) // loadup area data if (header.areaMapOffset && !loadAreaData(in, header.areaMapOffset, header.areaMapSize)) { - sLog->outError("Error loading map area data\n"); + LOG_ERROR("server", "Error loading map area data\n"); fclose(in); return false; } // loadup height data if (header.heightMapOffset && !loadHeightData(in, header.heightMapOffset, header.heightMapSize)) { - sLog->outError("Error loading map height data\n"); + LOG_ERROR("server", "Error loading map height data\n"); fclose(in); return false; } // loadup liquid data if (header.liquidMapOffset && !loadLiquidData(in, header.liquidMapOffset, header.liquidMapSize)) { - sLog->outError("Error loading map liquids data\n"); + LOG_ERROR("server", "Error loading map liquids data\n"); fclose(in); return false; } fclose(in); return true; } - sLog->outError("Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", filename); + LOG_ERROR("server", "Map file '%s' is from an incompatible clientversion. Please recreate using the mapextractor.", filename); fclose(in); return false; } @@ -2053,7 +2053,7 @@ bool Map::IsOutdoors(float x, float y, float z) const if (wmoEntry) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId); + LOG_DEBUG("server", "Got WMOAreaTableEntry! flag %u, areaid %u", wmoEntry->Flags, wmoEntry->areaId); #endif atEntry = sAreaTableStore.LookupEntry(wmoEntry->areaId); } @@ -2159,7 +2159,7 @@ ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidTyp if (vmgr->GetLiquidLevel(GetId(), x, y, z, ReqLiquidType, liquid_level, ground_level, liquid_type)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "getLiquidStatus(): vmap liquid level: %f ground: %f type: %u", liquid_level, ground_level, liquid_type); + LOG_DEBUG("maps", "getLiquidStatus(): vmap liquid level: %f ground: %f type: %u", liquid_level, ground_level, liquid_type); #endif // Check water level and ground level if (liquid_level > ground_level && z > ground_level - 2) @@ -2333,7 +2333,7 @@ void Map::UpdateObjectsVisibilityFor(Player* player, Cell cell, CellCoord cellpa void Map::SendInitSelf(Player* player) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Creating player data for himself %u", player->GetGUIDLow()); + LOG_DEBUG("server", "Creating player data for himself %u", player->GetGUIDLow()); #endif UpdateData data; @@ -2398,7 +2398,7 @@ inline void Map::setNGrid(NGridType* grid, uint32 x, uint32 y) { if (x >= MAX_NUMBER_OF_GRIDS || y >= MAX_NUMBER_OF_GRIDS) { - sLog->outError("map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y); + LOG_ERROR("server", "map::setNGrid() Invalid grid coordinates found: %d, %d!", x, y); ABORT(); } i_grids[x][y] = grid; @@ -2427,7 +2427,7 @@ void Map::AddObjectToRemoveList(WorldObject* obj) obj->CleanupsBeforeDelete(false); // remove or simplify at least cross referenced links i_objectsToRemove.insert(obj); - //sLog->outDebug(LOG_FILTER_MAPS, "Object (GUID: %u TypeId: %u) added to removing list.", obj->GetGUIDLow(), obj->GetTypeId()); + //LOG_DEBUG("maps", "Object (GUID: %u TypeId: %u) added to removing list.", obj->GetGUIDLow(), obj->GetTypeId()); } void Map::AddObjectToSwitchList(WorldObject* obj, bool on) @@ -2472,7 +2472,7 @@ void Map::RemoveAllObjectsInRemoveList() } } - //sLog->outDebug(LOG_FILTER_MAPS, "Object remover 1 check."); + //LOG_DEBUG("maps", "Object remover 1 check."); while (!i_objectsToRemove.empty()) { std::unordered_set::iterator itr = i_objectsToRemove.begin(); @@ -2485,7 +2485,7 @@ void Map::RemoveAllObjectsInRemoveList() { Corpse* corpse = ObjectAccessor::GetCorpse(*obj, obj->GetGUID()); if (!corpse) - sLog->outError("Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow()); + LOG_ERROR("server", "Tried to delete corpse/bones %u that is not in map.", obj->GetGUIDLow()); else RemoveFromMap(corpse, true); break; @@ -2506,12 +2506,12 @@ void Map::RemoveAllObjectsInRemoveList() RemoveFromMap(obj->ToCreature(), true); break; default: - sLog->outError("Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId()); + LOG_ERROR("server", "Non-grid object (TypeId: %u) is in grid object remove list, ignored.", obj->GetTypeId()); break; } } - //sLog->outDebug(LOG_FILTER_MAPS, "Object remover 2 check."); + //LOG_DEBUG("maps", "Object remover 2 check."); } uint32 Map::GetPlayersCountExceptGMs() const @@ -2651,7 +2651,7 @@ bool InstanceMap::CanEnter(Player* player, bool loginCheck) { if (!loginCheck && player->GetMapRef().getTarget() == this) { - sLog->outError("InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); + LOG_ERROR("server", "InstanceMap::CanEnter - player %s(%u) already in map %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetId(), GetInstanceId(), GetSpawnMode()); ABORT(); return false; } @@ -2665,7 +2665,7 @@ bool InstanceMap::CanEnter(Player* player, bool loginCheck) if (GetPlayersCountExceptGMs() >= (loginCheck ? maxPlayers + 1 : maxPlayers)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName().c_str()); + LOG_DEBUG("server", "MAP: Instance '%u' of map '%s' cannot have more than '%u' players. Player '%s' rejected", GetInstanceId(), GetMapName(), maxPlayers, player->GetName().c_str()); #endif player->SendTransferAborted(GetId(), TRANSFER_ABORT_MAX_PLAYERS); return false; @@ -2731,7 +2731,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); if (!mapSave) { - sLog->outError("InstanceMap::Add: InstanceSave does not exist for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); + LOG_ERROR("server", "InstanceMap::Add: InstanceSave does not exist for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); return false; } @@ -2741,7 +2741,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) { if (playerBind->save != mapSave) { - sLog->outError("InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->CanReset()); + LOG_ERROR("server", "InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->CanReset()); return false; } } @@ -2912,7 +2912,7 @@ void InstanceMap::PermBindAllPlayers() InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); if (!save) { - sLog->outError("Cannot bind players because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", GetMapName(), GetId(), GetInstanceId()); + LOG_ERROR("server", "Cannot bind players because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", GetMapName(), GetId(), GetInstanceId()); return; } @@ -3010,7 +3010,7 @@ bool BattlegroundMap::CanEnter(Player* player, bool loginCheck) { if (!loginCheck && player->GetMapRef().getTarget() == this) { - sLog->outError("BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow()); + LOG_ERROR("server", "BGMap::CanEnter - player %u is already in map!", player->GetGUIDLow()); ABORT(); return false; } @@ -3548,7 +3548,7 @@ bool Map::CheckCollisionAndGetValidCoords(const WorldObject* source, float start // Prevent invalid coordinates here, position is unchanged if (!acore::IsValidMapCoord(startX, startY, startZ) || !acore::IsValidMapCoord(destX, destY, destZ)) { - sLog->outCrash("Map::CheckCollisionAndGetValidCoords invalid coordinates startX: %f, startY: %f, startZ: %f, destX: %f, destY: %f, destZ: %f", startX, startY, startZ, destX, destY, destZ); + LOG_FATAL("server", "Map::CheckCollisionAndGetValidCoords invalid coordinates startX: %f, startY: %f, startZ: %f, destX: %f, destY: %f, destZ: %f", startX, startY, startZ, destX, destY, destZ); return false; } diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 6ecafeda11..dab380a4ff 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -20,10 +20,10 @@ #include "PathGenerator.h" #include "SharedDefines.h" #include "Timer.h" -#include -#include #include #include +#include +#include class Unit; class WorldPacket; @@ -338,7 +338,7 @@ public: [[nodiscard]] Map const* GetParent() const { return m_parentMap; } // pussywizard: movemaps, mmaps - [[nodiscard]] ACE_RW_Thread_Mutex& GetMMapLock() const { return *(const_cast(&MMapLock)); } + [[nodiscard]] std::shared_mutex& GetMMapLock() const { return *(const_cast(&MMapLock)); } // pussywizard: std::unordered_set i_objectsToUpdate; void BuildAndSendUpdateForObjects(); // definition in ObjectAccessor.cpp, below ObjectAccessor::Update, because it does the same for a map @@ -580,9 +580,9 @@ private: void UpdateActiveCells(const float& x, const float& y, const uint32 t_diff); protected: - ACE_Thread_Mutex Lock; - ACE_Thread_Mutex GridLock; - ACE_RW_Thread_Mutex MMapLock; + std::mutex Lock; + std::mutex GridLock; + std::shared_mutex MMapLock; MapEntry const* i_mapEntry; uint8 i_spawnMode; diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index b97eed9dd1..de2ddd0ae5 100644 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -175,19 +175,19 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player) InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty) { // load/create a map - ACORE_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard guard(Lock); // make sure we have a valid map id const MapEntry* entry = sMapStore.LookupEntry(GetId()); if (!entry) { - sLog->outError("CreateInstance: no entry for map %d", GetId()); + LOG_ERROR("server", "CreateInstance: no entry for map %d", GetId()); ABORT(); } const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); if (!iTemplate) { - sLog->outError("CreateInstance: no instance template for map %d", GetId()); + LOG_ERROR("server", "CreateInstance: no instance template for map %d", GetId()); ABORT(); } @@ -195,7 +195,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, GetDownscaledMapDifficultyData(GetId(), difficulty); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save ? "" : "new ", InstanceId, GetId(), difficulty ? "heroic" : "normal"); + LOG_DEBUG("maps", "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save ? "" : "new ", InstanceId, GetId(), difficulty ? "heroic" : "normal"); #endif InstanceMap* map = new InstanceMap(GetId(), InstanceId, difficulty, this); @@ -218,10 +218,10 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battleground* bg) { // load/create a map - ACORE_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard guard(Lock); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId()); + LOG_DEBUG("maps", "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId()); #endif PvPDifficultyEntry const* bracketEntry = GetBattlegroundBracketByLevel(bg->GetMapId(), bg->GetMinLevel()); diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index d05378a422..dca34904a1 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -71,7 +71,7 @@ Map* MapManager::CreateBaseMap(uint32 id) if (map == nullptr) { - ACORE_GUARD(ACE_Thread_Mutex, Lock); + std::lock_guard guard(Lock); map = FindBaseMap(id); if (map == nullptr) // pussywizard: check again after acquiring mutex @@ -167,7 +167,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) // TODO: this is not a good place to send the message player->GetSession()->SendAreaTriggerMessage(player->GetSession()->GetAcoreString(LANG_INSTANCE_RAID_GROUP_ONLY), mapName); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' must be in a raid group to enter instance '%s'", player->GetName().c_str(), mapName); + LOG_DEBUG("maps", "MAP: Player '%s' must be in a raid group to enter instance '%s'", player->GetName().c_str(), mapName); #endif return false; } @@ -202,12 +202,12 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) WorldPacket data(SMSG_CORPSE_NOT_IN_INSTANCE, 0); player->GetSession()->SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter.", player->GetName().c_str(), mapName); + LOG_DEBUG("maps", "MAP: Player '%s' does not have a corpse in instance '%s' and cannot enter.", player->GetName().c_str(), mapName); #endif return false; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' has corpse in instance '%s' and can enter.", player->GetName().c_str(), mapName); + LOG_DEBUG("maps", "MAP: Player '%s' has corpse in instance '%s' and can enter.", player->GetName().c_str(), mapName); #endif player->ResurrectPlayer(0.5f, false); player->SpawnCorpseBones(); @@ -215,7 +215,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPS, "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName().c_str()); + LOG_DEBUG("maps", "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName().c_str()); #endif } } @@ -419,7 +419,7 @@ uint32 MapManager::GenerateInstanceId() if (_nextInstanceId == 0xFFFFFFFF) { - sLog->outError("Instance ID overflow!! Can't continue, shutting down server. "); + LOG_ERROR("server", "Instance ID overflow!! Can't continue, shutting down server. "); World::StopNow(ERROR_EXIT_CODE); } diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 19252a97e0..c9816c57b2 100644 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -12,7 +12,7 @@ #include "Map.h" #include "MapUpdater.h" #include "Object.h" -#include +#include class Transport; class StaticTransport; @@ -130,7 +130,7 @@ private: MapManager(const MapManager&); MapManager& operator=(const MapManager&); - ACE_Thread_Mutex Lock; + std::mutex Lock; MapMapType i_maps; IntervalTimer i_timer[4]; // continents, bgs/arenas, instances, total from the beginning uint8 mapUpdateStep; diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index 1ad2a71f03..bae872d01b 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -44,7 +44,7 @@ void TransportMgr::LoadTransportTemplates() if (!result) { - sLog->outString(">> Loaded 0 transport templates. DB table `gameobject_template` has no transports!"); + LOG_INFO("server", ">> Loaded 0 transport templates. DB table `gameobject_template` has no transports!"); return; } @@ -57,13 +57,13 @@ void TransportMgr::LoadTransportTemplates() GameObjectTemplate const* goInfo = sObjectMgr->GetGameObjectTemplate(entry); if (goInfo == nullptr) { - sLog->outError("Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry); + LOG_ERROR("server", "Transport %u has no associated GameObjectTemplate from `gameobject_template` , skipped.", entry); continue; } if (goInfo->moTransport.taxiPathId >= sTaxiPathNodesByPath.size()) { - sLog->outError("Transport %u (name: %s) has an invalid path specified in `gameobject_template`.`data0` (%u) field, skipped.", entry, goInfo->name.c_str(), goInfo->moTransport.taxiPathId); + LOG_ERROR("server", "Transport %u (name: %s) has an invalid path specified in `gameobject_template`.`data0` (%u) field, skipped.", entry, goInfo->name.c_str(), goInfo->moTransport.taxiPathId); continue; } @@ -79,8 +79,8 @@ void TransportMgr::LoadTransportTemplates() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u transport templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u transport templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } class SplineRawInitializer @@ -361,7 +361,7 @@ MotionTransport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/ TransportTemplate const* tInfo = GetTransportTemplate(entry); if (!tInfo) { - sLog->outError("Transport %u will not be loaded, `transport_template` missing", entry); + LOG_ERROR("server", "Transport %u will not be loaded, `transport_template` missing", entry); return nullptr; } @@ -388,7 +388,7 @@ MotionTransport* TransportMgr::CreateTransport(uint32 entry, uint32 guid /*= 0*/ { if (mapEntry->Instanceable() != tInfo->inInstance) { - sLog->outError("Transport %u (name: %s) attempted creation in instance map (id: %u) but it is not an instanced transport!", entry, trans->GetName().c_str(), mapId); + LOG_ERROR("server", "Transport %u (name: %s) attempted creation in instance map (id: %u) but it is not an instanced transport!", entry, trans->GetName().c_str(), mapId); delete trans; return nullptr; } @@ -432,8 +432,8 @@ void TransportMgr::SpawnContinentTransports() } while (result->NextRow()); } - sLog->outString(">> Spawned %u continent motion transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Spawned %u continent motion transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING)) { @@ -460,7 +460,7 @@ void TransportMgr::SpawnContinentTransports() } while (result->NextRow()); } - sLog->outString(">> Preloaded grids for %u continent static transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Preloaded grids for %u continent static transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } } } diff --git a/src/server/game/Misc/AsyncAuctionListing.cpp b/src/server/game/Misc/AsyncAuctionListing.cpp index 73e5eb2373..5f1da03c85 100644 --- a/src/server/game/Misc/AsyncAuctionListing.cpp +++ b/src/server/game/Misc/AsyncAuctionListing.cpp @@ -10,8 +10,8 @@ uint32 AsyncAuctionListingMgr::auctionListingDiff = 0; bool AsyncAuctionListingMgr::auctionListingAllowed = false; std::list AsyncAuctionListingMgr::auctionListingList; std::list AsyncAuctionListingMgr::auctionListingListTemp; -ACE_Thread_Mutex AsyncAuctionListingMgr::auctionListingLock; -ACE_Thread_Mutex AsyncAuctionListingMgr::auctionListingTempLock; +std::mutex AsyncAuctionListingMgr::auctionListingLock; +std::mutex AsyncAuctionListingMgr::auctionListingTempLock; bool AuctionListOwnerItemsDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) { @@ -32,9 +32,6 @@ bool AuctionListItemsDelayEvent::Execute() AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); - //sLog->outDebug("Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", - // GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); - WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4 + 4 + 4) + 50 * ((16 + MAX_INSPECTED_ENCHANTMENT_SLOT * 3) * 4)); uint32 count = 0; uint32 totalcount = 0; diff --git a/src/server/game/Misc/AsyncAuctionListing.h b/src/server/game/Misc/AsyncAuctionListing.h index 3c07821c4d..6b810efd76 100644 --- a/src/server/game/Misc/AsyncAuctionListing.h +++ b/src/server/game/Misc/AsyncAuctionListing.h @@ -55,16 +55,16 @@ public: static std::list& GetList() { return auctionListingList; } static std::list& GetTempList() { return auctionListingListTemp; } - static ACE_Thread_Mutex& GetLock() { return auctionListingLock; } - static ACE_Thread_Mutex& GetTempLock() { return auctionListingTempLock; } + static std::mutex& GetLock() { return auctionListingLock; } + static std::mutex& GetTempLock() { return auctionListingTempLock; } private: static uint32 auctionListingDiff; static bool auctionListingAllowed; static std::list auctionListingList; static std::list auctionListingListTemp; - static ACE_Thread_Mutex auctionListingLock; - static ACE_Thread_Mutex auctionListingTempLock; + static std::mutex auctionListingLock; + static std::mutex auctionListingTempLock; }; #endif diff --git a/src/server/game/Misc/GameGraveyard.cpp b/src/server/game/Misc/GameGraveyard.cpp index 05dc66acf6..bc4b3956b5 100644 --- a/src/server/game/Misc/GameGraveyard.cpp +++ b/src/server/game/Misc/GameGraveyard.cpp @@ -19,8 +19,8 @@ void Graveyard::LoadGraveyardFromDB() QueryResult result = WorldDatabase.Query("SELECT ID, Map, x, y, z, Comment FROM game_graveyard"); if (!result) { - sLog->outString(">> Loaded 0 graveyard. Table `game_graveyard` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 graveyard. Table `game_graveyard` is empty!"); + LOG_INFO("server", " "); return; } @@ -41,7 +41,7 @@ void Graveyard::LoadGraveyardFromDB() if (!Utf8toWStr(Graveyard.name, Graveyard.wnameLow)) { - sLog->outErrorDb("Wrong UTF8 name for id %u in `game_graveyard` table, ignoring.", ID); + LOG_ERROR("sql.sql", "Wrong UTF8 name for id %u in `game_graveyard` table, ignoring.", ID); continue; } @@ -52,8 +52,8 @@ void Graveyard::LoadGraveyardFromDB() ++Count; } while (result->NextRow()); - sLog->outString(">> Loaded %i graveyard in %u ms", Count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %i graveyard in %u ms", Count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } GraveyardStruct const* Graveyard::GetGraveyard(uint32 ID) const @@ -85,7 +85,7 @@ GraveyardStruct const* Graveyard::GetClosestGraveyard(float x, float y, float z, { if (z > -500) { - sLog->outError("ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z); + LOG_ERROR("server", "ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z); return GetDefaultGraveyard(teamId); } } @@ -103,7 +103,7 @@ GraveyardStruct const* Graveyard::GetClosestGraveyard(float x, float y, float z, // not need to check validity of map object; MapId _MUST_ be valid here if (range.first == range.second && !map->IsBattlegroundOrArena()) { - sLog->outErrorDb("Table `graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, teamId); + LOG_ERROR("sql.sql", "Table `graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, teamId); return GetDefaultGraveyard(teamId); } @@ -128,7 +128,7 @@ GraveyardStruct const* Graveyard::GetClosestGraveyard(float x, float y, float z, GraveyardStruct const* entry = sGraveyard->GetGraveyard(data.safeLocId); if (!entry) { - sLog->outErrorDb("Table `graveyard_zone` has record for not existing `game_graveyard` table %u, skipped.", data.safeLocId); + LOG_ERROR("sql.sql", "Table `graveyard_zone` has record for not existing `game_graveyard` table %u, skipped.", data.safeLocId); continue; } @@ -245,7 +245,7 @@ void Graveyard::RemoveGraveyardLink(uint32 id, uint32 zoneId, TeamId teamId, boo GraveyardMapBoundsNonConst range = GraveyardStore.equal_range(zoneId); if (range.first == range.second) { - sLog->outError("Table `graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, teamId); + LOG_ERROR("server", "Table `graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, teamId); return; } @@ -300,8 +300,8 @@ void Graveyard::LoadGraveyardZones() if (!result) { - sLog->outString(">> Loaded 0 graveyard-zone links. DB table `graveyard_zone` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 graveyard-zone links. DB table `graveyard_zone` is empty."); + LOG_INFO("server", " "); return; } @@ -321,35 +321,35 @@ void Graveyard::LoadGraveyardZones() GraveyardStruct const* entry = sGraveyard->GetGraveyard(safeLocId); if (!entry) { - sLog->outErrorDb("Table `graveyard_zone` has a record for not existing `game_graveyard` table %u, skipped.", safeLocId); + LOG_ERROR("sql.sql", "Table `graveyard_zone` has a record for not existing `game_graveyard` table %u, skipped.", safeLocId); continue; } AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(zoneId); if (!areaEntry) { - sLog->outErrorDb("Table `graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId); + LOG_ERROR("sql.sql", "Table `graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId); continue; } if (areaEntry->zone != 0) { - sLog->outErrorDb("Table `graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId); + LOG_ERROR("sql.sql", "Table `graveyard_zone` has a record for subzone id (%u) instead of zone, skipped.", zoneId); continue; } if (team != 0 && team != HORDE && team != ALLIANCE) { - sLog->outErrorDb("Table `graveyard_zone` has a record for non player faction (%u), skipped.", team); + LOG_ERROR("sql.sql", "Table `graveyard_zone` has a record for non player faction (%u), skipped.", team); continue; } if (!AddGraveyardLink(safeLocId, zoneId, teamId, false)) - sLog->outErrorDb("Table `graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); + LOG_ERROR("sql.sql", "Table `graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId); } while (result->NextRow()); - sLog->outString(">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } GraveyardStruct const* Graveyard::GetGraveyard(const std::string& name) const diff --git a/src/server/game/Misc/SavingSystem.cpp b/src/server/game/Misc/SavingSystem.cpp index 4134aa6538..8774640fc9 100644 --- a/src/server/game/Misc/SavingSystem.cpp +++ b/src/server/game/Misc/SavingSystem.cpp @@ -5,7 +5,7 @@ uint32 SavingSystemMgr::m_savingCurrentValue = 0; uint32 SavingSystemMgr::m_savingMaxValueAssigned = 0; uint32 SavingSystemMgr::m_savingDiffSum = 0; std::list SavingSystemMgr::m_savingSkipList; -ACE_Thread_Mutex SavingSystemMgr::_savingLock; +std::mutex SavingSystemMgr::_savingLock; void SavingSystemMgr::Update(uint32 diff) { diff --git a/src/server/game/Misc/SavingSystem.h b/src/server/game/Misc/SavingSystem.h index da1f7a892a..ba538f789d 100644 --- a/src/server/game/Misc/SavingSystem.h +++ b/src/server/game/Misc/SavingSystem.h @@ -13,15 +13,15 @@ public: static uint32 GetSavingCurrentValue() { return m_savingCurrentValue; } // modified only during single thread static uint32 GetSavingMaxValue() { return m_savingMaxValueAssigned; } // modified only during single thread static void IncreaseSavingCurrentValue(uint32 inc) { m_savingCurrentValue += inc; } // used and modified only during single thread - static uint32 IncreaseSavingMaxValue(uint32 inc) { ACORE_GUARD(ACE_Thread_Mutex, _savingLock); return (m_savingMaxValueAssigned += inc); } - static void InsertToSavingSkipListIfNeeded(uint32 id) { if (id > m_savingCurrentValue) { ACORE_GUARD(ACE_Thread_Mutex, _savingLock); m_savingSkipList.push_back(id); } } + static uint32 IncreaseSavingMaxValue(uint32 inc) { std::lock_guard guard(_savingLock); return (m_savingMaxValueAssigned += inc); } + static void InsertToSavingSkipListIfNeeded(uint32 id) { if (id > m_savingCurrentValue) { std::lock_guard guard(_savingLock); m_savingSkipList.push_back(id); } } protected: static uint32 m_savingCurrentValue; static uint32 m_savingMaxValueAssigned; static uint32 m_savingDiffSum; static std::list m_savingSkipList; - static ACE_Thread_Mutex _savingLock; + static std::mutex _savingLock; }; #endif diff --git a/src/server/game/Misc/WhoListCache.cpp b/src/server/game/Misc/WhoListCache.cpp index f857ac3b74..e39eccf466 100644 --- a/src/server/game/Misc/WhoListCache.cpp +++ b/src/server/game/Misc/WhoListCache.cpp @@ -12,7 +12,7 @@ void WhoListCacheMgr::Update() m_whoOpcodeList.clear(); m_whoOpcodeList.reserve(sWorld->GetPlayerCount() + 1); - ACORE_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + std::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { diff --git a/src/server/game/Miscellaneous/Formulas.cpp b/src/server/game/Miscellaneous/Formulas.cpp new file mode 100644 index 0000000000..5f45325967 --- /dev/null +++ b/src/server/game/Miscellaneous/Formulas.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2016+ AzerothCore , released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2 + * Copyright (C) 2008-2016 TrinityCore + * Copyright (C) 2005-2009 MaNGOS + */ + +#include "Formulas.h" +#include "Log.h" +#include "Creature.h" +#include "Player.h" +#include "World.h" + +uint32 acore::XP::BaseGain(uint8 pl_level, uint8 mob_level, ContentLevels content) +{ + uint32 baseGain; + uint32 nBaseExp; + + switch (content) + { + case CONTENT_1_60: + nBaseExp = 45; + break; + case CONTENT_61_70: + nBaseExp = 235; + break; + case CONTENT_71_80: + nBaseExp = 580; + break; + default: + LOG_ERROR("server", "BaseGain: Unsupported content level %u", content); + nBaseExp = 45; + break; + } + + if (mob_level >= pl_level) + { + uint8 nLevelDiff = mob_level - pl_level; + if (nLevelDiff > 4) + nLevelDiff = 4; + + baseGain = ((pl_level * 5 + nBaseExp) * (20 + nLevelDiff) / 10 + 1) / 2; + } + else + { + uint8 gray_level = GetGrayLevel(pl_level); + if (mob_level > gray_level) + { + uint8 ZD = GetZeroDifference(pl_level); + baseGain = (pl_level * 5 + nBaseExp) * (ZD + mob_level - pl_level) / ZD; + } + else + baseGain = 0; + } + + //sScriptMgr->OnBaseGainCalculation(baseGain, pl_level, mob_level, content); // pussywizard: optimization + return baseGain; +} + +uint32 acore::XP::Gain(Player* player, Unit* unit, bool isBattleGround /*= false*/) +{ + Creature* creature = unit->ToCreature(); + uint32 gain = 0; + + if (!creature || (!creature->IsTotem() && !creature->IsPet() && !creature->IsCritter() && + !(creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP))) + { + float xpMod = 1.0f; + + gain = BaseGain(player->getLevel(), unit->getLevel(), GetContentLevelsForMapAndZone(unit->GetMapId(), unit->GetZoneId())); + + if (gain && creature) + { + if (creature->isElite()) + { + // Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus. + if (unit->GetMap() && unit->GetMap()->IsDungeon()) + xpMod *= 2.75f; + else + xpMod *= 2.0f; + } + + // This requires TrinityCore creature_template.ExperienceModifier feature + // xpMod *= creature->GetCreatureTemplate()->ModExperience; + } + + xpMod *= isBattleGround ? sWorld->getRate(RATE_XP_BG_KILL) : sWorld->getRate(RATE_XP_KILL); + gain = uint32(gain * xpMod); + } + + //sScriptMgr->OnGainCalculation(gain, player, u); // pussywizard: optimization + return gain; +} diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index cc4374ae11..ebd3ba5625 100644 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -7,213 +7,131 @@ #ifndef ACORE_FORMULAS_H #define ACORE_FORMULAS_H -#include "Creature.h" -#include "Player.h" #include "ScriptMgr.h" #include "SharedDefines.h" -#include "World.h" -namespace acore +namespace acore::Honor { - namespace Honor + inline float hk_honor_at_level_f(uint8 level, float multiplier = 1.0f) { - inline float hk_honor_at_level_f(uint8 level, float multiplier = 1.0f) - { - float honor = multiplier * level * 1.55f; - //sScriptMgr->OnHonorCalculation(honor, level, multiplier); // pussywizard: optimization - return honor; - } - - inline uint32 hk_honor_at_level(uint8 level, float multiplier = 1.0f) - { - return uint32(ceil(hk_honor_at_level_f(level, multiplier))); - } + float honor = multiplier * level * 1.55f; + //sScriptMgr->OnHonorCalculation(honor, level, multiplier); // pussywizard: optimization + return honor; } - namespace XP + + inline uint32 hk_honor_at_level(uint8 level, float multiplier = 1.0f) { - inline uint8 GetGrayLevel(uint8 pl_level) + return uint32(ceil(hk_honor_at_level_f(level, multiplier))); + } +} + +namespace acore::XP +{ + inline uint8 GetGrayLevel(uint8 pl_level) + { + uint8 level; + + if (pl_level <= 5) + level = 0; + else if (pl_level <= 39) + level = pl_level - 5 - pl_level / 10; + else if (pl_level <= 59) + level = pl_level - 1 - pl_level / 5; + else + level = pl_level - 9; + + //sScriptMgr->OnGrayLevelCalculation(level, pl_level); // pussywizard: optimization + return level; + } + + inline XPColorChar GetColorCode(uint8 pl_level, uint8 mob_level) + { + XPColorChar color; + + if (mob_level >= pl_level + 5) + color = XP_RED; + else if (mob_level >= pl_level + 3) + color = XP_ORANGE; + else if (mob_level >= pl_level - 2) + color = XP_YELLOW; + else if (mob_level > GetGrayLevel(pl_level)) + color = XP_GREEN; + else + color = XP_GRAY; + + //sScriptMgr->OnColorCodeCalculation(color, pl_level, mob_level); // pussywizard: optimization + return color; + } + + inline uint8 GetZeroDifference(uint8 pl_level) + { + uint8 diff; + + if (pl_level < 8) + diff = 5; + else if (pl_level < 10) + diff = 6; + else if (pl_level < 12) + diff = 7; + else if (pl_level < 16) + diff = 8; + else if (pl_level < 20) + diff = 9; + else if (pl_level < 30) + diff = 11; + else if (pl_level < 40) + diff = 12; + else if (pl_level < 45) + diff = 13; + else if (pl_level < 50) + diff = 14; + else if (pl_level < 55) + diff = 15; + else if (pl_level < 60) + diff = 16; + else + diff = 17; + + //sScriptMgr->OnZeroDifferenceCalculation(diff, pl_level); // pussywizard: optimization + return diff; + } + + uint32 BaseGain(uint8 pl_level, uint8 mob_level, ContentLevels content); + + uint32 Gain(Player* player, Unit* unit, bool isBattleGround = false); + + inline float xp_in_group_rate(uint32 count, bool isRaid) + { + float rate; + + if (isRaid) { - uint8 level; - - if (pl_level <= 5) - level = 0; - else if (pl_level <= 39) - level = pl_level - 5 - pl_level / 10; - else if (pl_level <= 59) - level = pl_level - 1 - pl_level / 5; - else - level = pl_level - 9; - - //sScriptMgr->OnGrayLevelCalculation(level, pl_level); // pussywizard: optimization - return level; + // FIXME: Must apply decrease modifiers depending on raid size. + rate = 1.0f; } - - inline XPColorChar GetColorCode(uint8 pl_level, uint8 mob_level) + else { - XPColorChar color; - - if (mob_level >= pl_level + 5) - color = XP_RED; - else if (mob_level >= pl_level + 3) - color = XP_ORANGE; - else if (mob_level >= pl_level - 2) - color = XP_YELLOW; - else if (mob_level > GetGrayLevel(pl_level)) - color = XP_GREEN; - else - color = XP_GRAY; - - //sScriptMgr->OnColorCodeCalculation(color, pl_level, mob_level); // pussywizard: optimization - return color; - } - - inline uint8 GetZeroDifference(uint8 pl_level) - { - uint8 diff; - - if (pl_level < 8) - diff = 5; - else if (pl_level < 10) - diff = 6; - else if (pl_level < 12) - diff = 7; - else if (pl_level < 16) - diff = 8; - else if (pl_level < 20) - diff = 9; - else if (pl_level < 30) - diff = 11; - else if (pl_level < 40) - diff = 12; - else if (pl_level < 45) - diff = 13; - else if (pl_level < 50) - diff = 14; - else if (pl_level < 55) - diff = 15; - else if (pl_level < 60) - diff = 16; - else - diff = 17; - - //sScriptMgr->OnZeroDifferenceCalculation(diff, pl_level); // pussywizard: optimization - return diff; - } - - inline uint32 BaseGain(uint8 pl_level, uint8 mob_level, ContentLevels content) - { - uint32 baseGain; - uint32 nBaseExp; - - switch (content) + switch (count) { - case CONTENT_1_60: - nBaseExp = 45; - break; - case CONTENT_61_70: - nBaseExp = 235; - break; - case CONTENT_71_80: - nBaseExp = 580; - break; - default: - sLog->outError("BaseGain: Unsupported content level %u", content); - nBaseExp = 45; - break; - } - - if (mob_level >= pl_level) - { - uint8 nLevelDiff = mob_level - pl_level; - if (nLevelDiff > 4) - nLevelDiff = 4; - - baseGain = ((pl_level * 5 + nBaseExp) * (20 + nLevelDiff) / 10 + 1) / 2; - } - else - { - uint8 gray_level = GetGrayLevel(pl_level); - if (mob_level > gray_level) - { - uint8 ZD = GetZeroDifference(pl_level); - baseGain = (pl_level * 5 + nBaseExp) * (ZD + mob_level - pl_level) / ZD; - } - else - baseGain = 0; - } - - //sScriptMgr->OnBaseGainCalculation(baseGain, pl_level, mob_level, content); // pussywizard: optimization - return baseGain; - } - - inline uint32 Gain(Player* player, Unit* u, bool isBattleGround = false) - { - Creature* creature = u->ToCreature(); - uint32 gain = 0; - - if (!creature || (!creature->IsTotem() && !creature->IsPet() && !creature->IsCritter() && - !(creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL))) - { - float xpMod = 1.0f; - - gain = BaseGain(player->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId())); - - if (gain && creature) - { - if (creature->isElite()) - { - // Elites in instances have a 2.75x XP bonus instead of the regular 2x world bonus. - if (u->GetMap() && u->GetMap()->IsDungeon()) - xpMod *= 2.75f; - else - xpMod *= 2.0f; - } - - // This requires TrinityCore creature_template.ExperienceModifier feature - // xpMod *= creature->GetCreatureTemplate()->ModExperience; - } - - xpMod *= isBattleGround ? sWorld->getRate(RATE_XP_BG_KILL) : sWorld->getRate(RATE_XP_KILL); - gain = uint32(gain * xpMod); - } - - //sScriptMgr->OnGainCalculation(gain, player, u); // pussywizard: optimization - return gain; - } - - inline float xp_in_group_rate(uint32 count, bool isRaid) - { - float rate; - - if (isRaid) - { - // FIXME: Must apply decrease modifiers depending on raid size. + case 0: + case 1: + case 2: rate = 1.0f; + break; + case 3: + rate = 1.166f; + break; + case 4: + rate = 1.3f; + break; + case 5: + default: + rate = 1.4f; } - else - { - switch (count) - { - case 0: - case 1: - case 2: - rate = 1.0f; - break; - case 3: - rate = 1.166f; - break; - case 4: - rate = 1.3f; - break; - case 5: - default: - rate = 1.4f; - } - } - - //sScriptMgr->OnGroupRateCalculation(rate, count, isRaid); // pussywizard: optimization - return rate; } + + //sScriptMgr->OnGroupRateCalculation(rate, count, isRaid); // pussywizard: optimization + return rate; } } diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 1ad0a2cf10..2ac64f3eb4 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -327,7 +327,7 @@ enum SpellAttr1 SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY = 0x00008000, // TITLE Immunity cancels preapplied auras DESCRIPTION For immunity spells, cancel all auras that this spell would make you immune to when the spell is applied SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE = 0x00010000, // TITLE Unaffected by school immunities DESCRIPTION Will not pierce Divine Shield, Ice Block and other full invulnerabilities SPELL_ATTR1_UNAUTOCASTABLE_BY_PET = 0x00020000, // TITLE Cannot be autocast by pet - SPELL_ATTR1_UNK18 = 0x00040000, // TITLE Unknown attribute 18@Attr1 DESCRIPTION Stun, Polymorph, Daze, Hex - CC? + SPELL_ATTR1_PREVENTS_ANIM = 0x00040000, // TITLE NYI, auras apply UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT SPELL_ATTR1_CANT_TARGET_SELF = 0x00080000, // TITLE Cannot be self-cast SPELL_ATTR1_REQ_COMBO_POINTS1 = 0x00100000, // TITLE Requires combo points (type 1) SPELL_ATTR1_UNK21 = 0x00200000, // TITLE Unknown attribute 21@Attr1 @@ -2571,38 +2571,38 @@ enum CreatureFamily enum CreatureTypeFlags { - CREATURE_TYPE_FLAG_TAMEABLE_PET = 0x00000001, // Makes the mob tameable (must also be a beast and have family set) - CREATURE_TYPE_FLAG_GHOST_VISIBLE = 0x00000002, // Creature are also visible for not alive player. Allow gossip interaction if npcflag allow? - CREATURE_TYPE_FLAG_BOSS_MOB = 0x00000004, // Changes creature's visible level to "??" in the creature's portrait - Immune Knockback. - CREATURE_TYPE_FLAG_DO_NOT_PLAY_WOUND_PARRY_ANIMATION = 0x00000008, - CREATURE_TYPE_FLAG_HIDE_FACTION_TOOLTIP = 0x00000010, - CREATURE_TYPE_FLAG_UNK5 = 0x00000020, // Sound related - CREATURE_TYPE_FLAG_SPELL_ATTACKABLE = 0x00000040, - CREATURE_TYPE_FLAG_CAN_INTERACT_WHILE_DEAD = 0x00000080, // Player can interact with the creature if its dead (not player dead) - CREATURE_TYPE_FLAG_HERB_SKINNING_SKILL = 0x00000100, // Can be looted by herbalist - CREATURE_TYPE_FLAG_MINING_SKINNING_SKILL = 0x00000200, // Can be looted by miner - CREATURE_TYPE_FLAG_DO_NOT_LOG_DEATH = 0x00000400, // Death event will not show up in combat log - CREATURE_TYPE_FLAG_MOUNTED_COMBAT_ALLOWED = 0x00000800, // Creature can remain mounted when entering combat - CREATURE_TYPE_FLAG_CAN_ASSIST = 0x00001000, // ? Can aid any player in combat if in range? - CREATURE_TYPE_FLAG_IS_PET_BAR_USED = 0x00002000, - CREATURE_TYPE_FLAG_MASK_UID = 0x00004000, - CREATURE_TYPE_FLAG_ENGINEERING_SKINNING_SKILL = 0x00008000, // Can be looted by engineer - CREATURE_TYPE_FLAG_EXOTIC_PET = 0x00010000, // Can be tamed by hunter as exotic pet - CREATURE_TYPE_FLAG_USE_DEFAULT_COLLISION_BOX = 0x00020000, // Collision related. (always using default collision box?) - CREATURE_TYPE_FLAG_IS_SIEGE_WEAPON = 0x00040000, - CREATURE_TYPE_FLAG_CAN_COLLIDE_WITH_MISSILES = 0x00080000, // Projectiles can collide with this creature - interacts with TARGET_DEST_TRAJ - CREATURE_TYPE_FLAG_HIDE_NAME_PLATE = 0x00100000, - CREATURE_TYPE_FLAG_DO_NOT_PLAY_MOUNTED_ANIMATIONS = 0x00200000, - CREATURE_TYPE_FLAG_IS_LINK_ALL = 0x00400000, - CREATURE_TYPE_FLAG_INTERACT_ONLY_WITH_CREATOR = 0x00800000, - CREATURE_TYPE_FLAG_DO_NOT_PLAY_UNIT_EVENT_SOUNDS = 0x01000000, - CREATURE_TYPE_FLAG_HAS_NO_SHADOW_BLOB = 0x02000000, - CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT = 0x04000000, // ! Creature can be targeted by spells that require target to be in caster's party/raid - CREATURE_TYPE_FLAG_FORCE_GOSSIP = 0x08000000, // Allows the creature to display a single gossip option. - CREATURE_TYPE_FLAG_DO_NOT_SHEATHE = 0x10000000, - CREATURE_TYPE_FLAG_DO_NOT_TARGET_ON_INTERACTION = 0x20000000, - CREATURE_TYPE_FLAG_DO_NOT_RENDER_OBJECT_NAME = 0x40000000, - CREATURE_TYPE_FLAG_UNIT_IS_QUEST_BOSS = 0x80000000 // Not verified + CREATURE_TYPE_FLAG_TAMEABLE = 0x00000001, // Makes the mob tameable (must also be a beast and have family set) + CREATURE_TYPE_FLAG_VISIBLE_TO_GHOSTS = 0x00000002, // Creature is also visible for not alive player. Allows gossip interaction if npcflag allows? + CREATURE_TYPE_FLAG_BOSS_MOB = 0x00000004, // Changes creature's visible level to "??" in the creature's portrait - Immune Knockback. + CREATURE_TYPE_FLAG_DO_NOT_PLAY_WOUND_PARRY_ANIMATION = 0x00000008, + CREATURE_TYPE_FLAG_NO_FACTION_TOOLTIP = 0x00000010, + CREATURE_TYPE_FLAG_MORE_AUDIBLE = 0x00000020, // Sound related + CREATURE_TYPE_FLAG_SPELL_ATTACKABLE = 0x00000040, + CREATURE_TYPE_FLAG_INTERACT_WHILE_DEAD = 0x00000080, // Player can interact with the creature if creature is dead (not if player is dead) + CREATURE_TYPE_FLAG_SKIN_WITH_HERBALISM = 0x00000100, // Can be looted by herbalist + CREATURE_TYPE_FLAG_SKIN_WITH_MINING = 0x00000200, // Can be looted by miner + CREATURE_TYPE_FLAG_NO_DEATH_MESSAGE = 0x00000400, // Death event will not show up in combat log + CREATURE_TYPE_FLAG_ALLOW_MOUNTED_COMBAT = 0x00000800, // Creature can remain mounted when entering combat + CREATURE_TYPE_FLAG_CAN_ASSIST = 0x00001000, // ? Can aid any player in combat if in range? + CREATURE_TYPE_FLAG_NO_PET_BAR = 0x00002000, + CREATURE_TYPE_FLAG_MASK_UID = 0x00004000, + CREATURE_TYPE_FLAG_SKIN_WITH_ENGINEERING = 0x00008000, // Can be looted by engineer + CREATURE_TYPE_FLAG_TAMEABLE_EXOTIC = 0x00010000, // Can be tamed by hunter as exotic pet + CREATURE_TYPE_FLAG_USE_MODEL_COLLISION_SIZE = 0x00020000, // Collision related. (always using default collision box?) + CREATURE_TYPE_FLAG_ALLOW_INTERACTION_WHILE_IN_COMBAT = 0x00040000, + CREATURE_TYPE_FLAG_COLLIDE_WITH_MISSILES = 0x00080000, // Projectiles can collide with this creature - interacts with TARGET_DEST_TRAJ + CREATURE_TYPE_FLAG_NO_NAME_PLATE = 0x00100000, + CREATURE_TYPE_FLAG_DO_NOT_PLAY_MOUNTED_ANIMATIONS = 0x00200000, + CREATURE_TYPE_FLAG_IS_LINK_ALL = 0x00400000, + CREATURE_TYPE_FLAG_INTERACT_ONLY_WITH_CREATOR = 0x00800000, + CREATURE_TYPE_FLAG_DO_NOT_PLAY_UNIT_EVENT_SOUNDS = 0x01000000, + CREATURE_TYPE_FLAG_HAS_NO_SHADOW_BLOB = 0x02000000, + CREATURE_TYPE_FLAG_TREAT_AS_RAID_UNIT = 0x04000000, // ! Creature can be targeted by spells that require target to be in caster's party/raid + CREATURE_TYPE_FLAG_FORCE_GOSSIP = 0x08000000, // Allows the creature to display a single gossip option. + CREATURE_TYPE_FLAG_DO_NOT_SHEATHE = 0x10000000, + CREATURE_TYPE_FLAG_DO_NOT_TARGET_ON_INTERACTION = 0x20000000, + CREATURE_TYPE_FLAG_DO_NOT_RENDER_OBJECT_NAME = 0x40000000, + CREATURE_TYPE_FLAG_UNIT_IS_QUEST_BOSS = 0x80000000 // Not verified }; enum CreatureEliteType diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 3d038e9271..bf7d35c1c5 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -241,7 +241,7 @@ void MotionMaster::MoveRandom(float wanderDistance) if (_owner->GetTypeId() == TYPEID_UNIT) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (GUID: %u) start moving random", _owner->GetGUIDLow()); + LOG_DEBUG("server", "Creature (GUID: %u) start moving random", _owner->GetGUIDLow()); #endif Mutate(new RandomMovementGenerator(wanderDistance), MOTION_SLOT_IDLE); } @@ -254,7 +254,7 @@ void MotionMaster::MoveTargetedHome() if (_owner->GetTypeId() == TYPEID_UNIT && !_owner->ToCreature()->GetCharmerOrOwnerGUID()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow()); + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) targeted home", _owner->GetEntry(), _owner->GetGUIDLow()); #endif Mutate(new HomeMovementGenerator(), MOTION_SLOT_ACTIVE); } @@ -266,20 +266,20 @@ void MotionMaster::MoveTargetedHome() return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow()); + LOG_DEBUG("server", "Pet or controlled creature (Entry: %u GUID: %u) targeting home", _owner->GetEntry(), _owner->GetGUIDLow()); #endif Unit* target = _owner->ToCreature()->GetCharmerOrOwner(); if (target) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow()); + LOG_DEBUG("server", "Following %s (GUID: %u)", target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : ((Creature*)target)->GetDBTableGUIDLow()); #endif Mutate(new FollowMovementGenerator(target, PET_FOLLOW_DIST, _owner->GetFollowAngle()), MOTION_SLOT_ACTIVE); } } else { - sLog->outError("Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow()); + LOG_ERROR("server", "Player (GUID: %u) attempt targeted home", _owner->GetGUIDLow()); } } @@ -292,14 +292,14 @@ void MotionMaster::MoveConfused() if (_owner->GetTypeId() == TYPEID_PLAYER) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Player (GUID: %u) move confused", _owner->GetGUIDLow()); + LOG_DEBUG("server", "Player (GUID: %u) move confused", _owner->GetGUIDLow()); #endif Mutate(new ConfusedMovementGenerator(), MOTION_SLOT_CONTROLLED); } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) move confused", _owner->GetEntry(), _owner->GetGUIDLow()); + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) move confused", _owner->GetEntry(), _owner->GetGUIDLow()); #endif Mutate(new ConfusedMovementGenerator(), MOTION_SLOT_CONTROLLED); } @@ -316,7 +316,7 @@ void MotionMaster::MoveChase(Unit* target, std::optional dist, std: if (_owner->GetTypeId() == TYPEID_PLAYER) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Player (GUID: %u) chase to %s (GUID: %u)", + LOG_DEBUG("server", "Player (GUID: %u) chase to %s (GUID: %u)", _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); @@ -326,7 +326,7 @@ void MotionMaster::MoveChase(Unit* target, std::optional dist, std: else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)", + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) chase to %s (GUID: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); @@ -394,7 +394,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo if (_owner->GetTypeId() == TYPEID_PLAYER) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(), + LOG_DEBUG("server", "Player (GUID: %u) follow to %s (GUID: %u)", _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); #endif @@ -403,7 +403,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle, MovementSlo else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)", + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) follow to %s (GUID: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), target->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", target->GetTypeId() == TYPEID_PLAYER ? target->GetGUIDLow() : target->ToCreature()->GetDBTableGUIDLow()); @@ -421,14 +421,14 @@ void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generate if (_owner->GetTypeId() == TYPEID_PLAYER) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z); + LOG_DEBUG("server", "Player (GUID: %u) targeted point (Id: %u X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), id, x, y, z); #endif Mutate(new PointMovementGenerator(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot); } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)", + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) targeted point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), _owner->GetGUIDLow(), id, x, y, z); #endif Mutate(new PointMovementGenerator(id, x, y, z, 0.0f, orientation, nullptr, generatePath, forceDestination), slot); @@ -461,7 +461,7 @@ void MotionMaster::MoveLand(uint32 id, Position const& pos, float speed /* = 0.0 pos.GetPosition(x, y, z); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); + LOG_DEBUG("server", "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); #endif Movement::MoveSplineInit init(_owner); @@ -493,7 +493,7 @@ void MotionMaster::MoveTakeoff(uint32 id, Position const& pos, float speed /* = pos.GetPosition(x, y, z); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); + LOG_DEBUG("server", "Creature (Entry: %u) landing point (ID: %u X: %f Y: %f Z: %f)", _owner->GetEntry(), id, x, y, z); #endif Movement::MoveSplineInit init(_owner); @@ -558,7 +558,7 @@ void MotionMaster::MoveJumpTo(float angle, float speedXY, float speedZ) void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id, Unit const* target) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); + LOG_DEBUG("server", "Unit (GUID: %u) jump to point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); #endif if (speedXY <= 0.1f) @@ -588,7 +588,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC) if (tz <= INVALID_HEIGHT) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", + LOG_DEBUG("server", "MotionMaster::MoveFall: unable retrive a proper height at map %u (x: %f, y: %f, z: %f).", _owner->GetMap()->GetId(), _owner->GetPositionX(), _owner->GetPositionX(), _owner->GetPositionZ() + _owner->GetPositionZ()); #endif return; @@ -632,14 +632,14 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id, if (_owner->GetTypeId() == TYPEID_PLAYER) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); + LOG_DEBUG("server", "Player (GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetGUIDLow(), x, y, z); #endif Mutate(new PointMovementGenerator(id, x, y, z, speed, orientation, path, generatePath, generatePath), MOTION_SLOT_CONTROLLED); } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)", + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) charge point (X: %f Y: %f Z: %f)", _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); #endif Mutate(new PointMovementGenerator(id, x, y, z, speed, orientation, path, generatePath, generatePath), MOTION_SLOT_CONTROLLED); @@ -654,12 +654,12 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z) if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outError("Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow()); + LOG_ERROR("server", "Player (GUID: %u) attempt to seek assistance", _owner->GetGUIDLow()); } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) seek assistance (X: %f Y: %f Z: %f)", _owner->GetEntry(), _owner->GetGUIDLow(), x, y, z); #endif _owner->AttackStop(); @@ -677,12 +677,12 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time) if (_owner->GetTypeId() == TYPEID_PLAYER) { - sLog->outError("Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow()); + LOG_ERROR("server", "Player (GUID: %u) attempt to call distract after assistance", _owner->GetGUIDLow()); } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)", + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) is distracted after assistance call (Time: %u)", _owner->GetEntry(), _owner->GetGUIDLow(), time); #endif Mutate(new AssistanceDistractMovementGenerator(time), MOTION_SLOT_ACTIVE); @@ -701,7 +701,7 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) if (_owner->GetTypeId() == TYPEID_PLAYER) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(), + LOG_DEBUG("server", "Player (GUID: %u) flee from %s (GUID: %u)", _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow()); #endif @@ -710,7 +710,7 @@ void MotionMaster::MoveFleeing(Unit* enemy, uint32 time) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s", + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) flee from %s (GUID: %u)%s", _owner->GetEntry(), _owner->GetGUIDLow(), enemy->GetTypeId() == TYPEID_PLAYER ? "player" : "creature", enemy->GetTypeId() == TYPEID_PLAYER ? enemy->GetGUIDLow() : enemy->ToCreature()->GetDBTableGUIDLow(), @@ -730,7 +730,7 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) if (path < sTaxiPathNodesByPath.size()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("%s taxi to (Path %u node %u)", _owner->GetName().c_str(), path, pathnode); + LOG_DEBUG("server", "%s taxi to (Path %u node %u)", _owner->GetName().c_str(), path, pathnode); #endif FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(pathnode); mgen->LoadPath(_owner->ToPlayer()); @@ -738,13 +738,13 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) } else { - sLog->outError("%s attempt taxi to (not existed Path %u node %u)", + LOG_ERROR("server", "%s attempt taxi to (not existed Path %u node %u)", _owner->GetName().c_str(), path, pathnode); } } else { - sLog->outError("Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)", + LOG_ERROR("server", "Creature (Entry: %u GUID: %u) attempt taxi to (Path %u node %u)", _owner->GetEntry(), _owner->GetGUIDLow(), path, pathnode); } } @@ -761,13 +761,13 @@ void MotionMaster::MoveDistract(uint32 timer) /*if (_owner->GetTypeId() == TYPEID_PLAYER) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer); + LOG_DEBUG("server", "Player (GUID: %u) distracted (timer: %u)", _owner->GetGUIDLow(), timer); #endif } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Creature (Entry: %u GUID: %u) (timer: %u)", + LOG_DEBUG("server", "Creature (Entry: %u GUID: %u) (timer: %u)", #endif _owner->GetEntry(), _owner->GetGUIDLow(), timer); }*/ @@ -831,7 +831,7 @@ void MotionMaster::MovePath(uint32 path_id, bool repeatable) Mutate(new WaypointMovementGenerator(path_id, repeatable), MOTION_SLOT_IDLE); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", + LOG_DEBUG("server", "%s (GUID: %u) start moving over path(Id:%u, repeatable: %s)", _owner->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature", _owner->GetGUIDLow(), path_id, repeatable ? "YES" : "NO"); #endif @@ -909,7 +909,7 @@ void MotionMaster::DirectDelete(_Ty curr) void MotionMaster::DelayedDelete(_Ty curr) { - sLog->outCrash("Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType()); + LOG_FATAL("server", "Unit (Entry %u) is trying to delete its updating MG (Type %u)!", _owner->GetEntry(), curr->GetMovementGeneratorType()); if (isStatic(curr)) return; if (!_expList) diff --git a/src/server/game/Movement/MovementGenerators/PathGenerator.cpp b/src/server/game/Movement/MovementGenerators/PathGenerator.cpp index 65eba508e4..8b1c7d38a6 100644 --- a/src/server/game/Movement/MovementGenerators/PathGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/PathGenerator.cpp @@ -369,7 +369,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con // this is probably an error state, but we'll leave it // and hopefully recover on the next Update // we still need to copy our preffix - sLog->outError("PathGenerator::BuildPolyPath: Path Build failed\n%lu", _source->GetGUID()); + LOG_ERROR("server", "PathGenerator::BuildPolyPath: Path Build failed %u", _source->GetGUIDLow()); } // new path = prefix + suffix - overlap @@ -470,7 +470,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con if (!_polyLength || dtStatusFailed(dtResult)) { // only happens if we passed bad data to findPath(), or navmesh is messed up - sLog->outError("PathGenerator::BuildPolyPath: %lu Path Build failed: 0 length path", _source->GetGUID()); + LOG_ERROR("server", "PathGenerator::BuildPolyPath: %u Path Build failed: 0 length path", _source->GetGUIDLow()); BuildShortcut(); _type = PATHFIND_NOPATH; return; @@ -479,7 +479,7 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con if (!_polyLength) { - sLog->outError("PathGenerator::BuildPolyPath: %lu Path Build failed: 0 length path", _source->GetGUID()); + LOG_ERROR("server", "PathGenerator::BuildPolyPath: %u Path Build failed: 0 length path", _source->GetGUIDLow()); BuildShortcut(); _type = PATHFIND_NOPATH; return; @@ -509,7 +509,7 @@ void PathGenerator::BuildPointPath(const float* startPoint, const float* endPoin if (_useRaycast) { // _straightLine uses raycast and it currently doesn't support building a point path, only a 2-point path with start and hitpoint/end is returned - sLog->outError("PathGenerator::BuildPointPath() called with _useRaycast for unit %lu", _source->GetGUID()); + LOG_ERROR("server", "PathGenerator::BuildPointPath() called with _useRaycast for unit %u", _source->GetGUIDLow()); BuildShortcut(); _type = PATHFIND_NOPATH; return; @@ -893,7 +893,7 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo npolys = FixupCorridor(polys, npolys, MAX_PATH_LENGTH, visited, nvisited); if (dtStatusFailed(_navMeshQuery->getPolyHeight(polys[0], result, &result[1]))) - sLog->outDebug(LOG_FILTER_MAPS, "PathGenerator::FindSmoothPath: Cannot find height at position X: %f Y: %f Z: %f for %lu", result[2], result[0], result[1], _source->GetGUID()); + LOG_DEBUG("maps", "PathGenerator::FindSmoothPath: Cannot find height at position X: %f Y: %f Z: %f for %u", result[2], result[0], result[1], _source->GetGUIDLow()); result[1] += 0.5f; dtVcopy(iterPos, result); @@ -1040,7 +1040,7 @@ void PathGenerator::ShortenPathUntilDist(G3D::Vector3 const& target, float dist) { if (GetPathType() == PATHFIND_BLANK || _pathPoints.size() < 2) { - sLog->outError("PathGenerator::ReducePathLengthByDist called before path was successfully built"); + LOG_ERROR("server", "PathGenerator::ReducePathLengthByDist called before path was successfully built"); return; } diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index 6fd98b2562..529beb24a5 100644 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -151,12 +151,13 @@ bool ChaseMovementGenerator::DoUpdate(T* owner, uint32 time_diff) if (owner->IsHovering()) owner->UpdateAllowedPositionZ(x, y, z); + i_recalculateTravel = true; + bool success = i_path->CalculatePath(x, y, z, forceDest); if (!success || i_path->GetPathType() & PATHFIND_NOPATH) { if (cOwner) cOwner->SetCannotReachTarget(true); - owner->StopMoving(); return true; } @@ -173,7 +174,6 @@ bool ChaseMovementGenerator::DoUpdate(T* owner, uint32 time_diff) } owner->AddUnitState(UNIT_STATE_CHASE_MOVE); - i_recalculateTravel = true; Movement::MoveSplineInit init(owner); init.MovebyPath(i_path->GetPath()); @@ -333,17 +333,18 @@ bool FollowMovementGenerator::DoUpdate(T* owner, uint32 time_diff) target->GetNearPoint(owner, x, y, z, _range, 0.f, target->ToAbsoluteAngle(tAngle)); + i_recalculateTravel = true; + bool success = i_path->CalculatePath(x, y, z, forceDest); if (!success || i_path->GetPathType() & PATHFIND_NOPATH) { - owner->StopMoving(); + if (cOwner) + cOwner->SetCannotReachTarget(true); return true; } owner->AddUnitState(UNIT_STATE_FOLLOW_MOVE); - i_recalculateTravel = true; - Movement::MoveSplineInit init(owner); init.MovebyPath(i_path->GetPath()); init.SetFacing(target->GetOrientation()); diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 1f173a3862..fb158d26af 100644 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -27,7 +27,7 @@ void WaypointMovementGenerator::LoadPath(Creature* creature) if (!i_path) { // No movement found for entry - sLog->outErrorDb("WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path id: %u", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUIDLow(), path_id); + LOG_ERROR("sql.sql", "WaypointMovementGenerator::LoadPath: creature %s (Entry: %u GUID: %u) doesn't have waypoint path id: %u", creature->GetName().c_str(), creature->GetEntry(), creature->GetGUIDLow(), path_id); return; } @@ -65,7 +65,7 @@ void WaypointMovementGenerator::OnArrived(Creature* creature) if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID()); + LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID()); #endif creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, nullptr); @@ -363,14 +363,14 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/) { if (i_currentNode >= i_path.size()) { - sLog->outMisc("TAXI NODE WAS GREATER THAN PATH SIZE, GUID: %u, POINTID: %u, NODESIZE: %lu, CURRENT: %u", player->GetGUIDLow(), pointId, i_path.size(), i_currentNode); + LOG_INFO("misc", "TAXI NODE WAS GREATER THAN PATH SIZE, GUID: %u, POINTID: %u, NODESIZE: %lu, CURRENT: %u", player->GetGUIDLow(), pointId, i_path.size(), i_currentNode); player->CleanupAfterTaxiFlight(); return false; } if (i_path[i_currentNode]->mapid != player->GetMapId()) { - sLog->outMisc("Player on different map, curmap: %u, pointmap: %u, nodesize: %lu, currentnode: %u", player->GetMapId(), i_path[i_currentNode]->mapid, i_path.size(), i_currentNode); + LOG_INFO("misc", "Player on different map, curmap: %u, pointmap: %u, nodesize: %lu, currentnode: %u", player->GetMapId(), i_path[i_currentNode]->mapid, i_path.size(), i_currentNode); player->CleanupAfterTaxiFlight(); return false; } @@ -440,7 +440,7 @@ void FlightPathMovementGenerator::DoEventIfAny(Player* player, TaxiPathNodeEntry if (uint32 eventid = departure ? node->departureEventID : node->arrivalEventID) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node->index, node->path, player->GetName().c_str()); + LOG_DEBUG("maps.script", "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node->index, node->path, player->GetName().c_str()); #endif player->GetMap()->ScriptsStart(sEventScripts, eventid, player, player); } @@ -478,14 +478,14 @@ void FlightPathMovementGenerator::PreloadEndGrid() if (endMap) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path.size() - 1)); + LOG_DEBUG("server", "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path.size() - 1)); #endif endMap->LoadGrid(_endGridX, _endGridY); } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Unable to determine map to preload flightmaster grid"); + LOG_DEBUG("server", "Unable to determine map to preload flightmaster grid"); #endif } } diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 45b9794577..a44efd65af 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -137,7 +137,7 @@ namespace Movement // TODO: what to do in such cases? problem is in input data (all points are at same coords) if (spline.length() < minimal_duration) { - //sLog->outError("MoveSpline::init_spline: zero length spline, wrong input data?"); // ZOMG! temp comment to avoid console spam from transports + //LOG_ERROR("server", "MoveSpline::init_spline: zero length spline, wrong input data?"); // ZOMG! temp comment to avoid console spam from transports spline.set_length(spline.last(), spline.isCyclic() ? 1000 : 1); } point_Idx = spline.first(); @@ -191,7 +191,7 @@ namespace Movement #define CHECK(exp) \ if (!(exp))\ {\ - sLog->outError("MoveSplineInitArgs::Validate: expression '%s' failed for GUID: %u Entry: %u", #exp, unit->GetTypeId() == TYPEID_PLAYER ? unit->GetGUIDLow() : unit->ToCreature()->GetDBTableGUIDLow(), unit->GetEntry());\ + LOG_ERROR("server", "MoveSplineInitArgs::Validate: expression '%s' failed for GUID: %u Entry: %u", #exp, unit->GetTypeId() == TYPEID_PLAYER ? unit->GetGUIDLow() : unit->ToCreature()->GetDBTableGUIDLow(), unit->GetEntry());\ return false;\ } CHECK(path.size() > 1); @@ -219,7 +219,7 @@ namespace Movement offset = path[i] - middle; if (fabs(offset.x) >= MAX_OFFSET || fabs(offset.y) >= MAX_OFFSET || fabs(offset.z) >= MAX_OFFSET) { - sLog->outError("MoveSplineInitArgs::_checkPathBounds check failed"); + LOG_ERROR("server", "MoveSplineInitArgs::_checkPathBounds check failed"); return false; } } diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h index ea765c69f7..b1a8dfa9c6 100644 --- a/src/server/game/Movement/Spline/Spline.h +++ b/src/server/game/Movement/Spline/Spline.h @@ -8,12 +8,12 @@ #define TRINITYSERVER_SPLINE_H #include "MovementTypedefs.h" +#include "Errors.h" #include #include namespace Movement { - class SplineBase { public: diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 32cf904ee5..f7dff41df3 100644 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -42,8 +42,8 @@ void WaypointMgr::Load() if (!result) { - sLog->outErrorDb(">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 waypoints. DB table `waypoint_data` is empty!"); + LOG_INFO("server", " "); return; } @@ -87,8 +87,8 @@ void WaypointMgr::Load() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void WaypointMgr::ReloadPath(uint32 id) diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index d2df21ef43..9bfb4913a3 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -104,14 +104,14 @@ bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 map, float bool OPvPCapturePoint::SetCapturePointData(uint32 entry, uint32 map, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Creating capture point %u", entry); + LOG_DEBUG("outdoorpvp", "Creating capture point %u", entry); #endif // check info existence GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo || goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT) { - sLog->outError("OutdoorPvP: GO %u is not capture point!", entry); + LOG_ERROR("server", "OutdoorPvP: GO %u is not capture point!", entry); return false; } @@ -133,7 +133,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type) if (!m_Creatures[type]) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_OUTDOORPVP, "opvp creature type %u was already deleted", type); + LOG_DEBUG("outdoorpvp", "opvp creature type %u was already deleted", type); #endif return false; } @@ -146,7 +146,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type) return false; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_OUTDOORPVP, "deleting opvp creature type %u", type); + LOG_DEBUG("outdoorpvp", "deleting opvp creature type %u", type); #endif uint32 guid = cr->GetDBTableGUIDLow(); // Don't save respawn time @@ -246,7 +246,7 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/) SendRemoveWorldStates(player); m_players[player->GetTeamId()].erase(player->GetGUID()); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %s left an outdoorpvp zone", player->GetName().c_str()); + LOG_DEBUG("outdoorpvp", "Player %s left an outdoorpvp zone", player->GetName().c_str()); #endif } @@ -377,7 +377,7 @@ bool OPvPCapturePoint::Update(uint32 diff) if (m_OldState != m_State) { - //sLog->outError(LOG_FILTER_OUTDOORPVP, "%u->%u", m_OldState, m_State); + //LOG_ERROR("server", LOG_FILTER_OUTDOORPVP, "%u->%u", m_OldState, m_State); if (oldTeam != m_team) ChangeTeam(oldTeam); ChangeState(); diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index d8ae6a32f5..e7d4786f75 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -13,7 +13,7 @@ OutdoorPvPMgr::OutdoorPvPMgr() { m_UpdateTimer = 0; - //sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Instantiating OutdoorPvPMgr"); + //LOG_DEBUG("outdoorpvp", "Instantiating OutdoorPvPMgr"); } OutdoorPvPMgr* OutdoorPvPMgr::instance() @@ -24,7 +24,7 @@ OutdoorPvPMgr* OutdoorPvPMgr::instance() void OutdoorPvPMgr::Die() { - //sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Deleting OutdoorPvPMgr"); + //LOG_DEBUG("outdoorpvp", "Deleting OutdoorPvPMgr"); for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) delete *itr; @@ -41,8 +41,8 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (!result) { - sLog->outErrorDb(">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty."); + LOG_INFO("server", " "); return; } @@ -60,7 +60,7 @@ void OutdoorPvPMgr::InitOutdoorPvP() if (typeId >= MAX_OUTDOORPVP_TYPES) { - sLog->outErrorDb("Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId); + LOG_ERROR("sql.sql", "Invalid OutdoorPvPTypes value %u in outdoorpvp_template; skipped.", typeId); continue; } @@ -79,20 +79,20 @@ void OutdoorPvPMgr::InitOutdoorPvP() OutdoorPvPDataMap::iterator iter = m_OutdoorPvPDatas.find(OutdoorPvPTypes(i)); if (iter == m_OutdoorPvPDatas.end()) { - sLog->outErrorDb("Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i)); + LOG_ERROR("sql.sql", "Could not initialize OutdoorPvP object for type ID %u; no entry in database.", uint32(i)); continue; } pvp = sScriptMgr->CreateOutdoorPvP(iter->second); if (!pvp) { - sLog->outError("Could not initialize OutdoorPvP object for type ID %u; got nullptr pointer from script.", uint32(i)); + LOG_ERROR("server", "Could not initialize OutdoorPvP object for type ID %u; got nullptr pointer from script.", uint32(i)); continue; } if (!pvp->SetupOutdoorPvP()) { - sLog->outError("Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i)); + LOG_ERROR("server", "Could not initialize OutdoorPvP object for type ID %u; SetupOutdoorPvP failed.", uint32(i)); delete pvp; continue; } @@ -100,8 +100,8 @@ void OutdoorPvPMgr::InitOutdoorPvP() m_OutdoorPvPSet.push_back(pvp); } - sLog->outString(">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle) @@ -115,14 +115,14 @@ void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid) if (itr == m_OutdoorPvPMap.end()) return; - ACORE_GUARD(ACE_Thread_Mutex, _lock); // pussywizard + std::lock_guard guard(_lock); // pussywizard if (itr->second->HasPlayer(player)) return; itr->second->HandlePlayerEnterZone(player, zoneid); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); + LOG_DEBUG("outdoorpvp", "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); #endif } @@ -132,7 +132,7 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid) if (itr == m_OutdoorPvPMap.end()) return; - ACORE_GUARD(ACE_Thread_Mutex, _lock); // pussywizard + std::lock_guard guard(_lock); // pussywizard // teleport: remove once in removefromworld, once in updatezone if (!itr->second->HasPlayer(player)) @@ -140,7 +140,7 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid) itr->second->HandlePlayerLeaveZone(player, zoneid); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); + LOG_DEBUG("outdoorpvp", "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId()); #endif } @@ -188,7 +188,7 @@ ZoneScript* OutdoorPvPMgr::GetZoneScript(uint32 zoneId) bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid) { - ACORE_GUARD(ACE_Thread_Mutex, _lock); // pussywizard + std::lock_guard guard(_lock); // pussywizard for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) { if ((*itr)->HandleOpenGo(player, guid)) @@ -199,7 +199,7 @@ bool OutdoorPvPMgr::HandleOpenGo(Player* player, uint64 guid) void OutdoorPvPMgr::HandleGossipOption(Player* player, uint64 guid, uint32 gossipid) { - ACORE_GUARD(ACE_Thread_Mutex, _lock); // pussywizard + std::lock_guard guard(_lock); // pussywizard for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) { if ((*itr)->HandleGossipOption(player, guid, gossipid)) diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h index dca5660397..08b46a2d04 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h @@ -70,7 +70,7 @@ public: void HandleDropFlag(Player* player, uint32 spellId); // pussywizard: lock required because different functions affect m_players - ACE_Thread_Mutex _lock; + std::mutex _lock; private: typedef std::vector OutdoorPvPSet; diff --git a/src/server/game/Petitions/PetitionMgr.cpp b/src/server/game/Petitions/PetitionMgr.cpp index 432c9eacb5..a497824685 100644 --- a/src/server/game/Petitions/PetitionMgr.cpp +++ b/src/server/game/Petitions/PetitionMgr.cpp @@ -30,8 +30,8 @@ void PetitionMgr::LoadPetitions() QueryResult result = CharacterDatabase.Query("SELECT ownerguid, petitionguid, name, type FROM petition"); if (!result) { - sLog->outString(">> Loaded 0 Petitions!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 Petitions!"); + LOG_INFO("server", " "); return; } @@ -43,8 +43,8 @@ void PetitionMgr::LoadPetitions() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %d Petitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %d Petitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void PetitionMgr::LoadSignatures() @@ -55,8 +55,8 @@ void PetitionMgr::LoadSignatures() QueryResult result = CharacterDatabase.Query("SELECT petitionguid, playerguid, player_account FROM petition_sign"); if (!result) { - sLog->outString(">> Loaded 0 Petition signs!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 Petition signs!"); + LOG_INFO("server", " "); return; } @@ -68,8 +68,8 @@ void PetitionMgr::LoadSignatures() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %d Petition signs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %d Petition signs in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void PetitionMgr::AddPetition(uint32 petitionId, uint32 ownerGuid, std::string const& name, uint8 type) diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index 27228b21e6..da3555608e 100644 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -354,7 +354,7 @@ void PoolGroup::Spawn1Object(PoolObject* obj) if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { Creature* creature = new Creature; - //sLog->outDebug(LOG_FILTER_POOLSYS, "Spawning creature %u", guid); + //LOG_DEBUG("pool", "Spawning creature %u", guid); if (!creature->LoadCreatureFromDB(obj->guid, map)) { delete creature; @@ -378,7 +378,7 @@ void PoolGroup::Spawn1Object(PoolObject* obj) if (!map->Instanceable() && map->IsGridLoaded(data->posX, data->posY)) { GameObject* pGameobject = sObjectMgr->IsGameObjectStaticTransport(data->id) ? new StaticTransport() : new GameObject(); - //sLog->outDebug(LOG_FILTER_POOLSYS, "Spawning gameobject %u", guid); + //LOG_DEBUG("pool", "Spawning gameobject %u", guid); if (!pGameobject->LoadGameObjectFromDB(obj->guid, map, false)) { delete pGameobject; @@ -410,7 +410,7 @@ void PoolGroup::Spawn1Object(PoolObject* obj) for (PooledQuestRelation::iterator itr = qr.first; itr != qr.second; ++itr) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_POOLSYS, "PoolGroup: Adding quest %u to creature %u", itr->first, itr->second); + LOG_DEBUG("pool", "PoolGroup: Adding quest %u to creature %u", itr->first, itr->second); #endif questMap->insert(QuestRelations::value_type(itr->second, itr->first)); } @@ -421,7 +421,7 @@ void PoolGroup::Spawn1Object(PoolObject* obj) for (PooledQuestRelation::iterator itr = qr.first; itr != qr.second; ++itr) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_POOLSYS, "PoolGroup: Adding quest %u to GO %u", itr->first, itr->second); + LOG_DEBUG("pool", "PoolGroup: Adding quest %u to GO %u", itr->first, itr->second); #endif questMap->insert(QuestRelations::value_type(itr->second, itr->first)); } @@ -431,7 +431,7 @@ template <> void PoolGroup::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 triggerFrom) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_POOLSYS, "PoolGroup: Spawning pool %u", poolId); + LOG_DEBUG("pool", "PoolGroup: Spawning pool %u", poolId); #endif // load state from db if (!triggerFrom) @@ -560,8 +560,8 @@ void PoolMgr::LoadFromDB() if (!result) { mPoolTemplate.clear(); - sLog->outString(">> Loaded 0 object pools. DB table `pool_template` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 object pools. DB table `pool_template` is empty."); + LOG_INFO("server", " "); return; } @@ -578,13 +578,13 @@ void PoolMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } // Creatures - sLog->outString("Loading Creatures Pooling Data..."); + LOG_INFO("server", "Loading Creatures Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -593,8 +593,8 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty."); + LOG_INFO("server", " "); } else { @@ -610,18 +610,18 @@ void PoolMgr::LoadFromDB() CreatureData const* data = sObjectMgr->GetCreatureData(guid); if (!data) { - sLog->outErrorDb("`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); + LOG_ERROR("sql.sql", "`pool_creature` has a non existing creature spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); continue; } auto it = mPoolTemplate.find(pool_id); if (it == mPoolTemplate.end()) { - sLog->outErrorDb("`pool_creature` pool id (%u) is not in `pool_template`, skipped.", pool_id); + LOG_ERROR("sql.sql", "`pool_creature` pool id (%u) is not in `pool_template`, skipped.", pool_id); continue; } if (chance < 0 || chance > 100) { - sLog->outErrorDb("`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); + LOG_ERROR("sql.sql", "`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); continue; } PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id]; @@ -635,14 +635,14 @@ void PoolMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // Gameobjects - sLog->outString("Loading Gameobject Pooling Data..."); + LOG_INFO("server", "Loading Gameobject Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -651,8 +651,8 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty."); + LOG_INFO("server", " "); } else { @@ -668,7 +668,7 @@ void PoolMgr::LoadFromDB() GameObjectData const* data = sObjectMgr->GetGOData(guid); if (!data) { - sLog->outErrorDb("`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); + LOG_ERROR("sql.sql", "`pool_gameobject` has a non existing gameobject spawn (GUID: %u) defined for pool id (%u), skipped.", guid, pool_id); continue; } @@ -677,20 +677,20 @@ void PoolMgr::LoadFromDB() goinfo->type != GAMEOBJECT_TYPE_GOOBER && goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE) { - sLog->outErrorDb("`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id); + LOG_ERROR("sql.sql", "`pool_gameobject` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", guid, goinfo->type, pool_id); continue; } auto it = mPoolTemplate.find(pool_id); if (it == mPoolTemplate.end()) { - sLog->outErrorDb("`pool_gameobject` pool id (%u) is not in `pool_template`, skipped.", pool_id); + LOG_ERROR("sql.sql", "`pool_gameobject` pool id (%u) is not in `pool_template`, skipped.", pool_id); continue; } if (chance < 0 || chance > 100) { - sLog->outErrorDb("`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); + LOG_ERROR("sql.sql", "`pool_gameobject` has an invalid chance (%f) for gameobject guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); continue; } @@ -705,14 +705,14 @@ void PoolMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // Pool of pools - sLog->outString("Loading Mother Pooling Data..."); + LOG_INFO("server", "Loading Mother Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -721,8 +721,8 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 pools in pools"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 pools in pools"); + LOG_INFO("server", " "); } else { @@ -739,7 +739,7 @@ void PoolMgr::LoadFromDB() auto it = mPoolTemplate.find(mother_pool_id); if (it == mPoolTemplate.end()) { - sLog->outErrorDb("`pool_pool` mother_pool id (%u) is not in `pool_template`, skipped.", mother_pool_id); + LOG_ERROR("sql.sql", "`pool_pool` mother_pool id (%u) is not in `pool_template`, skipped.", mother_pool_id); continue; } } @@ -747,18 +747,18 @@ void PoolMgr::LoadFromDB() auto it = mPoolTemplate.find(child_pool_id); if (it == mPoolTemplate.end()) { - sLog->outErrorDb("`pool_pool` included pool_id (%u) is not in `pool_template`, skipped.", child_pool_id); + LOG_ERROR("sql.sql", "`pool_pool` included pool_id (%u) is not in `pool_template`, skipped.", child_pool_id); continue; } } if (mother_pool_id == child_pool_id) { - sLog->outErrorDb("`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id); + LOG_ERROR("sql.sql", "`pool_pool` pool_id (%u) includes itself, dead-lock detected, skipped.", child_pool_id); continue; } if (chance < 0 || chance > 100) { - sLog->outErrorDb("`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id); + LOG_ERROR("sql.sql", "`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id); continue; } PoolTemplateData* pPoolTemplateMother = &mPoolTemplate[mother_pool_id]; @@ -788,7 +788,7 @@ void PoolMgr::LoadFromDB() ss << *itr << ' '; ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool " << poolItr->first << " and child pool " << poolItr->second; - sLog->outErrorDb("%s", ss.str().c_str()); + LOG_ERROR("sql.sql", "%s", ss.str().c_str()); mPoolPoolGroups[poolItr->second].RemoveOneRelation(poolItr->first); mPoolSearchMap.erase(poolItr); --count; @@ -797,12 +797,12 @@ void PoolMgr::LoadFromDB() } } - sLog->outString(">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } - sLog->outString("Loading Quest Pooling Data..."); + LOG_INFO("server", "Loading Quest Pooling Data..."); { uint32 oldMSTime = getMSTime(); @@ -811,8 +811,8 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Loaded 0 quests in pools"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 quests in pools"); + LOG_INFO("server", " "); } else { @@ -838,20 +838,20 @@ void PoolMgr::LoadFromDB() Quest const* quest = sObjectMgr->GetQuestTemplate(entry); if (!quest) { - sLog->outErrorDb("`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id); + LOG_ERROR("sql.sql", "`pool_quest` has a non existing quest template (Entry: %u) defined for pool id (%u), skipped.", entry, pool_id); continue; } auto it = mPoolTemplate.find(pool_id); if (it == mPoolTemplate.end()) { - sLog->outErrorDb("`pool_quest` pool id (%u) is not in `pool_template`, skipped.", pool_id); + LOG_ERROR("sql.sql", "`pool_quest` pool id (%u) is not in `pool_template`, skipped.", pool_id); continue; } if (!quest->IsDailyOrWeekly()) { - sLog->outErrorDb("`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id); + LOG_ERROR("sql.sql", "`pool_quest` has an quest (%u) which is not daily or weekly in pool id (%u), use ExclusiveGroup instead, skipped.", entry, pool_id); continue; } @@ -862,7 +862,7 @@ void PoolMgr::LoadFromDB() if (poolTypeMap[pool_id] != currType) { - sLog->outErrorDb("`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.", + LOG_ERROR("sql.sql", "`pool_quest` quest %u is %s but pool (%u) is specified for %s, mixing not allowed, skipped.", entry, currType == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY", pool_id, poolTypeMap[pool_id] == QUEST_DAILY ? "QUEST_DAILY" : "QUEST_WEEKLY"); continue; } @@ -872,7 +872,7 @@ void PoolMgr::LoadFromDB() if (creBounds.first == creBounds.second && goBounds.first == goBounds.second) { - sLog->outErrorDb("`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id); + LOG_ERROR("sql.sql", "`pool_quest` lists entry (%u) as member of pool (%u) but is not started anywhere, skipped.", entry, pool_id); continue; } @@ -887,13 +887,13 @@ void PoolMgr::LoadFromDB() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } // The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks - sLog->outString("Starting objects pooling system..."); + LOG_INFO("server", "Starting objects pooling system..."); { uint32 oldMSTime = getMSTime(); @@ -903,8 +903,8 @@ void PoolMgr::LoadFromDB() if (!result) { - sLog->outString(">> Pool handling system initialized, 0 pools spawned."); - sLog->outString(); + LOG_INFO("server", ">> Pool handling system initialized, 0 pools spawned."); + LOG_INFO("server", " "); } else { @@ -920,9 +920,9 @@ void PoolMgr::LoadFromDB() if (pool_pool_id) // The pool is a child pool in pool_pool table. Ideally we should remove it from the pool handler to ensure it never gets spawned, // however that could recursively invalidate entire chain of mother pools. It can be done in the future but for now we'll do nothing. - sLog->outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32()); + LOG_ERROR("sql.sql", "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. This broken pool is a child pool of Id %u and cannot be safely removed.", pool_entry, fields[2].GetUInt32()); else - sLog->outErrorDb("Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry); + LOG_ERROR("sql.sql", "Pool Id %u has no equal chance pooled entites defined and explicit chance sum is not 100. The pool will not be spawned.", pool_entry); continue; } @@ -934,8 +934,8 @@ void PoolMgr::LoadFromDB() } } while (result->NextRow()); - sLog->outBasic("Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", "Pool handling system initialized, %u pools spawned in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } } } diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index 7fe9b35fdc..90c8ee8360 100644 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -15,6 +15,8 @@ #include "WorldSession.h" const int32 ReputationMgr::PointsInRank[MAX_REPUTATION_RANK] = {36000, 3000, 3000, 3000, 6000, 12000, 21000, 1000}; +const int32 ReputationMgr::Reputation_Cap = 42999; +const int32 ReputationMgr::Reputation_Bottom = -42000; ReputationRank ReputationMgr::ReputationToRank(int32 standing) { @@ -34,7 +36,7 @@ bool ReputationMgr::IsAtWar(uint32 faction_id) const if (!factionEntry) { - sLog->outError("ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); + LOG_ERROR("server", "ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); return 0; } @@ -57,7 +59,7 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const if (!factionEntry) { - sLog->outError("ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); + LOG_ERROR("server", "ReputationMgr::GetReputation: Can't get reputation of %s for unknown faction (faction id) #%u.", _player->GetName().c_str(), faction_id); return 0; } diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h index 5b8beb3af9..73d2a65efb 100644 --- a/src/server/game/Reputation/ReputationMgr.h +++ b/src/server/game/Reputation/ReputationMgr.h @@ -60,8 +60,8 @@ public: // constructors and glob void LoadFromDB(PreparedQueryResult result); public: // statics static const int32 PointsInRank[MAX_REPUTATION_RANK]; - static const int32 Reputation_Cap = 42999; - static const int32 Reputation_Bottom = -42000; + static const int32 Reputation_Cap; + static const int32 Reputation_Bottom; static ReputationRank ReputationToRank(int32 standing); public: // accessors diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index d1e52f03fa..1b5ade8111 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -91,7 +91,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe { Player* player = nullptr; if (!source && !target) - sLog->outError("%s source and target objects are nullptr.", scriptInfo->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s source and target objects are nullptr.", scriptInfo->GetDebugInfo().c_str()); else { // Check target first, then source. @@ -101,7 +101,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe player = source->ToPlayer(); if (!player) - sLog->outError("%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", + LOG_ERROR("server", "%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0, target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0); @@ -113,7 +113,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t { Creature* creature = nullptr; if (!source && !target) - sLog->outError("%s source and target objects are nullptr.", scriptInfo->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s source and target objects are nullptr.", scriptInfo->GetDebugInfo().c_str()); else { if (bReverse) @@ -134,7 +134,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t } if (!creature) - sLog->outError("%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", + LOG_ERROR("server", "%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0, target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0); @@ -146,15 +146,15 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s { Unit* unit = nullptr; if (!obj) - sLog->outError("%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); + LOG_ERROR("server", "%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else if (!obj->isType(TYPEMASK_UNIT)) - sLog->outError("%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", + LOG_ERROR("server", "%s %s object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); else { unit = obj->ToUnit(); if (!unit) - sLog->outError("%s %s object could not be casted to unit.", + LOG_ERROR("server", "%s %s object could not be casted to unit.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); } return unit; @@ -164,12 +164,12 @@ inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInf { Player* player = nullptr; if (!obj) - sLog->outError("%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); + LOG_ERROR("server", "%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { player = obj->ToPlayer(); if (!player) - sLog->outError("%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).", + LOG_ERROR("server", "%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } return player; @@ -179,12 +179,12 @@ inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const Scrip { Creature* creature = nullptr; if (!obj) - sLog->outError("%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); + LOG_ERROR("server", "%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { creature = obj->ToCreature(); if (!creature) - sLog->outError("%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), + LOG_ERROR("server", "%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } return creature; @@ -194,13 +194,13 @@ inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const { WorldObject* pWorldObject = nullptr; if (!obj) - sLog->outError("%s %s object is nullptr.", + LOG_ERROR("server", "%s %s object is nullptr.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { pWorldObject = dynamic_cast(obj); if (!pWorldObject) - sLog->outError("%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).", + LOG_ERROR("server", "%s %s object is not a world object (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } return pWorldObject; @@ -219,29 +219,29 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script case SCRIPT_COMMAND_CLOSE_DOOR: break; default: - sLog->outError("%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s unknown command for _ScriptProcessDoor.", scriptInfo->GetDebugInfo().c_str()); return; } if (!guid) - sLog->outError("%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s door guid is not specified.", scriptInfo->GetDebugInfo().c_str()); else if (!source) - sLog->outError("%s source object is nullptr.", scriptInfo->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s source object is nullptr.", scriptInfo->GetDebugInfo().c_str()); else if (!source->isType(TYPEMASK_UNIT)) - sLog->outError("%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), + LOG_ERROR("server", "%s source object is not unit (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); else { WorldObject* wSource = dynamic_cast (source); if (!wSource) - sLog->outError("%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.", + LOG_ERROR("server", "%s source object could not be casted to world object (TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); else { GameObject* pDoor = _FindGameObject(wSource, guid); if (!pDoor) - sLog->outError("%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid); + LOG_ERROR("server", "%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid); else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR) - sLog->outError("%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).", + LOG_ERROR("server", "%s gameobject is not a door (GoType: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), pDoor->GetGoType(), pDoor->GetEntry(), pDoor->GetGUIDLow()); else if (bOpen == (pDoor->GetGoState() == GO_STATE_READY)) { @@ -320,7 +320,7 @@ void Map::ScriptsProcess() break; } default: - sLog->outError("%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", + LOG_ERROR("server", "%s source with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", step.script->GetDebugInfo().c_str(), step.sourceGUID, GUID_HIPART(step.sourceGUID)); break; } @@ -355,7 +355,7 @@ void Map::ScriptsProcess() break; } default: - sLog->outError("%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", + LOG_ERROR("server", "%s target with unsupported high guid (GUID: " UI64FMTD ", high guid: %u).", step.script->GetDebugInfo().c_str(), step.targetGUID, GUID_HIPART(step.targetGUID)); break; } @@ -366,7 +366,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_TALK: if (step.script->Talk.ChatType > CHAT_TYPE_WHISPER && step.script->Talk.ChatType != CHAT_MSG_RAID_BOSS_WHISPER) { - sLog->outError("%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType); + LOG_ERROR("server", "%s invalid chat type (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->Talk.ChatType); break; } if (step.script->Talk.Flags & SF_TALK_USE_PLAYER) @@ -394,7 +394,7 @@ void Map::ScriptsProcess() { uint64 targetGUID = target ? target->GetGUID() : 0; if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) - sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else player->Whisper(text, LANG_UNIVERSAL, targetGUID); break; @@ -426,13 +426,13 @@ void Map::ScriptsProcess() break; case CHAT_TYPE_WHISPER: if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) - sLog->outError("%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s attempt to whisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else cSource->MonsterWhisper(step.script->Talk.TextID, target->ToPlayer()); break; case CHAT_MSG_RAID_BOSS_WHISPER: if (!targetGUID || !IS_PLAYER_GUID(targetGUID)) - sLog->outError("%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s attempt to raidbosswhisper to non-player unit, skipping.", step.script->GetDebugInfo().c_str()); else cSource->MonsterWhisper(step.script->Talk.TextID, target->ToPlayer(), true); break; @@ -460,7 +460,7 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount()) - sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FieldSet.FieldID, cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow()); else @@ -489,7 +489,7 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount()) - sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID, cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow()); else @@ -503,7 +503,7 @@ void Map::ScriptsProcess() { // Validate field number. if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount()) - sLog->outError("%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", + LOG_ERROR("server", "%s wrong field %u (max count: %u) in object (TypeId: %u, Entry: %u, GUID: %u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->FlagToggle.FieldID, cSource->GetValuesCount(), cSource->GetTypeId(), cSource->GetEntry(), cSource->GetGUIDLow()); else @@ -530,12 +530,12 @@ void Map::ScriptsProcess() { if (!source) { - sLog->outError("%s source object is nullptr.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s source object is nullptr.", step.script->GetDebugInfo().c_str()); break; } if (!target) { - sLog->outError("%s target object is nullptr.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s target object is nullptr.", step.script->GetDebugInfo().c_str()); break; } @@ -546,7 +546,7 @@ void Map::ScriptsProcess() { if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER) { - sLog->outError("%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", + LOG_ERROR("server", "%s source is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); break; } @@ -559,7 +559,7 @@ void Map::ScriptsProcess() { if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER) { - sLog->outError("%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", + LOG_ERROR("server", "%s target is not unit, gameobject or player (TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; } @@ -567,7 +567,7 @@ void Map::ScriptsProcess() } else { - sLog->outError("%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", + LOG_ERROR("server", "%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; @@ -598,7 +598,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: if (!step.script->RespawnGameobject.GOGuid) { - sLog->outError("%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s gameobject guid (datalong) is not specified.", step.script->GetDebugInfo().c_str()); break; } @@ -608,7 +608,7 @@ void Map::ScriptsProcess() GameObject* pGO = _FindGameObject(pSummoner, step.script->RespawnGameobject.GOGuid); if (!pGO) { - sLog->outError("%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid); + LOG_ERROR("server", "%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid); break; } @@ -617,7 +617,7 @@ void Map::ScriptsProcess() pGO->GetGoType() == GAMEOBJECT_TYPE_BUTTON || pGO->GetGoType() == GAMEOBJECT_TYPE_TRAP) { - sLog->outError("%s can not be used with gameobject of type %u (guid: %u).", + LOG_ERROR("server", "%s can not be used with gameobject of type %u (guid: %u).", step.script->GetDebugInfo().c_str(), uint32(pGO->GetGoType()), step.script->RespawnGameobject.GOGuid); break; } @@ -640,7 +640,7 @@ void Map::ScriptsProcess() if (WorldObject* pSummoner = _GetScriptWorldObject(source, true, step.script)) { if (!step.script->TempSummonCreature.CreatureEntry) - sLog->outError("%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s creature entry (datalong) is not specified.", step.script->GetDebugInfo().c_str()); else { uint32 entry = step.script->TempSummonCreature.CreatureEntry; @@ -656,7 +656,7 @@ void Map::ScriptsProcess() break; if (!pSummoner->SummonCreature(entry, x, y, z, o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, step.script->TempSummonCreature.DespawnDelay)) - sLog->outError("%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry); + LOG_ERROR("server", "%s creature was not spawned (entry: %u).", step.script->GetDebugInfo().c_str(), step.script->TempSummonCreature.CreatureEntry); } } break; @@ -674,13 +674,13 @@ void Map::ScriptsProcess() // Target must be GameObject. if (!target) { - sLog->outError("%s target object is nullptr.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s target object is nullptr.", step.script->GetDebugInfo().c_str()); break; } if (target->GetTypeId() != TYPEID_GAMEOBJECT) { - sLog->outError("%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.", + LOG_ERROR("server", "%s target object is not gameobject (TypeId: %u, Entry: %u, GUID: %u), skipping.", step.script->GetDebugInfo().c_str(), target->GetTypeId(), target->GetEntry(), target->GetGUIDLow()); break; } @@ -704,7 +704,7 @@ void Map::ScriptsProcess() // TODO: Allow gameobjects to be targets and casters if (!source && !target) { - sLog->outError("%s source and target objects are nullptr.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s source and target objects are nullptr.", step.script->GetDebugInfo().c_str()); break; } @@ -737,13 +737,13 @@ void Map::ScriptsProcess() if (!uSource || !uSource->isType(TYPEMASK_UNIT)) { - sLog->outError("%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); + LOG_ERROR("server", "%s no source unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); break; } if (!uTarget || !uTarget->isType(TYPEMASK_UNIT)) { - sLog->outError("%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); + LOG_ERROR("server", "%s no target unit found for spell %u", step.script->GetDebugInfo().c_str(), step.script->CastSpell.SpellID); break; } @@ -803,7 +803,7 @@ void Map::ScriptsProcess() if (Unit* unit = _GetScriptUnit(source, true, step.script)) { if (!sWaypointMgr->GetPath(step.script->LoadPath.PathID)) - sLog->outError("%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID); + LOG_ERROR("server", "%s source object has an invalid path (%u), skipping.", step.script->GetDebugInfo().c_str(), step.script->LoadPath.PathID); else unit->GetMotionMaster()->MovePath(step.script->LoadPath.PathID, step.script->LoadPath.IsRepeatable); } @@ -813,12 +813,12 @@ void Map::ScriptsProcess() { if (!step.script->CallScript.CreatureEntry) { - sLog->outError("%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s creature entry is not specified, skipping.", step.script->GetDebugInfo().c_str()); break; } if (!step.script->CallScript.ScriptID) { - sLog->outError("%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "%s script id is not specified, skipping.", step.script->GetDebugInfo().c_str()); break; } @@ -843,7 +843,7 @@ void Map::ScriptsProcess() if (!cTarget) { - sLog->outError("%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry); + LOG_ERROR("server", "%s target was not found (entry: %u)", step.script->GetDebugInfo().c_str(), step.script->CallScript.CreatureEntry); break; } @@ -852,7 +852,7 @@ void Map::ScriptsProcess() //if no scriptmap present... if (!datamap) { - sLog->outError("%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType); + LOG_ERROR("server", "%s unknown scriptmap (%u) specified, skipping.", step.script->GetDebugInfo().c_str(), step.script->CallScript.ScriptType); break; } @@ -866,7 +866,7 @@ void Map::ScriptsProcess() if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { if (cSource->isDead()) - sLog->outError("%s creature is already dead (Entry: %u, GUID: %u)", + LOG_ERROR("server", "%s creature is already dead (Entry: %u, GUID: %u)", step.script->GetDebugInfo().c_str(), cSource->GetEntry(), cSource->GetGUIDLow()); else { @@ -942,7 +942,7 @@ void Map::ScriptsProcess() break; default: - sLog->outError("Unknown script command %s.", step.script->GetDebugInfo().c_str()); + LOG_ERROR("server", "Unknown script command %s.", step.script->GetDebugInfo().c_str()); break; } diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 2a691b7ffd..dbbab7b36d 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -90,7 +90,7 @@ ScriptMgr* ScriptMgr::instance() void ScriptMgr::Initialize() { AddScripts(); - sLog->outString("Loading C++ scripts"); + LOG_INFO("server", "Loading C++ scripts"); } void ScriptMgr::Unload() @@ -168,8 +168,8 @@ void ScriptMgr::LoadDatabase() CheckIfScriptsInDatabaseExist(); - sLog->outString(">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } struct TSpellSummary @@ -216,7 +216,7 @@ void ScriptMgr::CheckIfScriptsInDatabaseExist() !ScriptRegistry::GetScriptById(sid) && !ScriptRegistry::GetScriptById(sid) && !ScriptRegistry::GetScriptById(sid)) - sLog->outErrorDb("Script named '%s' is assigned in the database, but has no code!", (*itr).c_str()); + LOG_ERROR("sql.sql", "Script named '%s' is assigned in the database, but has no code!", (*itr).c_str()); } } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 9359026a3f..a1525b8025 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -312,7 +312,7 @@ public: _mapEntry = sMapStore.LookupEntry(_mapId); if (!_mapEntry) - sLog->outError("Invalid MapScript for %u; no such map ID.", _mapId); + LOG_ERROR("server", "Invalid MapScript for %u; no such map ID.", _mapId); } // Gets the MapEntry structure associated with this script. Can return nullptr. @@ -353,7 +353,7 @@ public: checkMap(); if (GetEntry() && !GetEntry()->IsWorldMap()) - sLog->outError("WorldMapScript for map %u is invalid.", GetEntry()->MapID); + LOG_ERROR("server", "WorldMapScript for map %u is invalid.", GetEntry()->MapID); } }; @@ -370,7 +370,7 @@ public: checkMap(); if (GetEntry() && !GetEntry()->IsDungeon()) - sLog->outError("InstanceMapScript for map %u is invalid.", GetEntry()->MapID); + LOG_ERROR("server", "InstanceMapScript for map %u is invalid.", GetEntry()->MapID); } // Gets an InstanceScript object for this instance. @@ -390,7 +390,7 @@ public: checkMap(); if (GetEntry() && !GetEntry()->IsBattleground()) - sLog->outError("BattlegroundMapScript for map %u is invalid.", GetEntry()->MapID); + LOG_ERROR("server", "BattlegroundMapScript for map %u is invalid.", GetEntry()->MapID); } }; @@ -1990,7 +1990,7 @@ public: else { // If the script is already assigned -> delete it! - sLog->outError("Script named '%s' is already assigned (two or more scripts have the same name), so the script can't work, aborting...", + LOG_ERROR("server", "Script named '%s' is already assigned (two or more scripts have the same name), so the script can't work, aborting...", script->GetName().c_str()); ABORT(); // Error that should be fixed ASAP. @@ -2000,7 +2000,7 @@ public: { // The script uses a script name from database, but isn't assigned to anything. if (script->GetName().find("Smart") == std::string::npos) - sLog->outErrorDb("Script named '%s' is not assigned in the database.", + LOG_ERROR("sql.sql", "Script named '%s' is not assigned in the database.", script->GetName().c_str()); } } @@ -2034,7 +2034,7 @@ private: { if (it->second == script) { - sLog->outError("Script '%s' has same memory pointer as '%s'.", + LOG_ERROR("server", "Script '%s' has same memory pointer as '%s'.", script->GetName().c_str(), it->second->GetName().c_str()); return false; diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index 598418fe4e..b031cf44bb 100644 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -31,15 +31,15 @@ void SystemMgr::LoadScriptWaypoints() if (result) uiCreatureCount = result->GetRowCount(); - sLog->outString("TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); + LOG_INFO("server", "TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount); // 0 1 2 3 4 5 result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); if (!result) { - sLog->outString(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); + LOG_INFO("server", " "); return; } @@ -62,16 +62,16 @@ void SystemMgr::LoadScriptWaypoints() if (!pCInfo) { - sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry); + LOG_ERROR("sql.sql", "TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", temp.uiCreatureEntry); continue; } if (!pCInfo->ScriptID) - sLog->outErrorDb("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry); + LOG_ERROR("sql.sql", "TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", temp.uiCreatureEntry); m_mPointMoveMap[uiEntry].push_back(temp); ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 470c9f343e..6c32c8e0c0 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -926,7 +926,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x38D*/ { "CMSG_MOVE_CHNG_TRANSPORT", STATUS_LOGGEDIN, PROCESS_THREADSAFE, &WorldSession::HandleMovementOpcodes }, /*0x38E*/ { "MSG_PARTY_ASSIGNMENT", STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandlePartyAssignmentOpcode }, /*0x38F*/ { "SMSG_OFFER_PETITION_ERROR", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x390*/ { "SMSG_TIME_SYNC_REQ", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, + /*0x390*/ { "SMSG_TIME_SYNC_REQ", STATUS_NEVER, PROCESS_THREADSAFE, &WorldSession::Handle_ServerSide }, /*0x391*/ { "CMSG_TIME_SYNC_RESP", STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleTimeSyncResp }, /*0x392*/ { "CMSG_SEND_LOCAL_EVENT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x393*/ { "CMSG_SEND_GENERAL_TRIGGER", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 8b80ccd0ed..1dd8817a01 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -110,14 +110,16 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 m_sessionDbcLocale(sWorld->GetDefaultDbcLocale()), m_sessionDbLocaleIndex(locale), m_latency(0), - m_clientTimeDelay(0), m_TutorialsChanged(false), recruiterId(recruiter), isRecruiter(isARecruiter), m_currentVendorEntry(0), m_currentBankerGUID(0), timeWhoCommandAllowed(0), - _calendarEventCreationCooldown(0) + _calendarEventCreationCooldown(0), + _timeSyncClockDeltaQueue(6), + _timeSyncClockDelta(0), + _pendingTimeSyncRequests() { memset(m_Tutorials, 0, sizeof(m_Tutorials)); @@ -126,6 +128,9 @@ WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 _kicked = false; _shouldSetOfflineInDB = true; + _timeSyncNextCounter = 0; + _timeSyncTimer = 0; + if (sock) { m_Address = sock->GetRemoteAddress(); @@ -223,9 +228,9 @@ void WorldSession::SendPacket(WorldPacket const* packet) uint64 minTime = uint64(cur_time - lastTime); uint64 fullTime = uint64(lastTime - firstTime); - sLog->outDetail("Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount) / fullTime, float(sendPacketBytes) / fullTime, uint32(fullTime)); + LOG_DEBUG("server", "Send all time packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f time: %u", sendPacketCount, sendPacketBytes, float(sendPacketCount) / fullTime, float(sendPacketBytes) / fullTime, uint32(fullTime)); - sLog->outDetail("Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount) / minTime, float(sendLastPacketBytes) / minTime); + LOG_DEBUG("server", "Send last min packets count: " UI64FMTD " bytes: " UI64FMTD " avr.count/sec: %f avr.bytes/sec: %f", sendLastPacketCount, sendLastPacketBytes, float(sendLastPacketCount) / minTime, float(sendLastPacketBytes) / minTime); lastTime = cur_time; sendLastPacketCount = 1; @@ -253,7 +258,7 @@ void WorldSession::QueuePacket(WorldPacket* new_packet) /// Update the WorldSession (triggered by World update) bool WorldSession::Update(uint32 diff, PacketFilter& updater) { - if (updater.ProcessLogout()) + if (updater.ProcessUnsafe()) { UpdateTimeOutTime(diff); @@ -263,7 +268,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) m_Socket->CloseSocket("Client didn't send anything for too long"); } - HandleTeleportTimeout(updater.ProcessLogout()); + HandleTeleportTimeout(updater.ProcessUnsafe()); uint32 _startMSTime = getMSTime(); WorldPacket* packet = nullptr; @@ -277,7 +282,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) { if (packet->GetOpcode() >= NUM_MSG_TYPES) { - sLog->outError("WorldSession Packet filter: received non-existent opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); + LOG_ERROR("server", "WorldSession Packet filter: received non-existent opcode %s (0x%.4X)", LookupOpcodeName(packet->GetOpcode()), packet->GetOpcode()); } else { @@ -359,10 +364,10 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) } catch (ByteBufferException const&) { - sLog->outError("WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId()); - if (sLog->IsOutDebug()) + LOG_ERROR("server", "WorldSession::Update ByteBufferException occured while parsing a packet (opcode: %u) from client %s, accountid=%i. Skipped packet.", packet->GetOpcode(), GetRemoteAddress().c_str(), GetAccountId()); + if (sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG)) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:"); + LOG_DEBUG("network", "Dumping error causing packet:"); packet->hexlike(); } } @@ -390,7 +395,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) if (m_Socket && !m_Socket->IsClosed()) ProcessQueryCallbacks(); - if (updater.ProcessLogout()) + if (updater.ProcessUnsafe()) { if (m_Socket && !m_Socket->IsClosed() && _warden) { @@ -415,6 +420,22 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater) } } + if (!updater.ProcessUnsafe()) // <=> updater is of type MapSessionFilter + { + // Send time sync packet every 10s. + if (_timeSyncTimer > 0) + { + if (diff >= _timeSyncTimer) + { + SendTimeSync(); + } + else + { + _timeSyncTimer -= diff; + } + } + } + return true; } @@ -594,7 +615,7 @@ void WorldSession::LogoutPlayer(bool save) //! Call script hook before deletion sScriptMgr->OnPlayerLogout(_player); - sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel()); + LOG_INFO("entities.player", "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName().c_str(), _player->GetGUIDLow(), _player->getLevel()); //! Remove the player from the world // the player may not be in the world when logging out @@ -614,7 +635,7 @@ void WorldSession::LogoutPlayer(bool save) WorldPacket data(SMSG_LOGOUT_COMPLETE, 0); SendPacket(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); + LOG_DEBUG("network", "SESSION: Sent SMSG_LOGOUT_COMPLETE Message"); #endif //! Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline @@ -680,22 +701,22 @@ char const* WorldSession::GetAcoreString(uint32 entry) const void WorldSession::Handle_NULL(WorldPacket& recvPacket) { - sLog->outError("SESSION: received unhandled opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); + LOG_ERROR("server", "SESSION: received unhandled opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket) { - sLog->outError("SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); + LOG_ERROR("server", "SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } void WorldSession::Handle_ServerSide(WorldPacket& recvPacket) { - sLog->outError("SESSION: received server-side opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); + LOG_ERROR("server", "SESSION: received server-side opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } void WorldSession::Handle_Deprecated(WorldPacket& recvPacket) { - sLog->outError("SESSION: received deprecated opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); + LOG_ERROR("server", "SESSION: received deprecated opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } void WorldSession::SendAuthWaitQue(uint32 position) @@ -738,13 +759,13 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask) uint32 type = fields[0].GetUInt8(); if (type >= NUM_ACCOUNT_DATA_TYPES) { - sLog->outError("Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); + LOG_ERROR("server", "Table `%s` have invalid account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } if ((mask & (1 << type)) == 0) { - sLog->outError("Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); + LOG_ERROR("server", "Table `%s` have non appropriate for table account data type (%u), ignore.", mask == GLOBAL_CACHE_MASK ? "account_data" : "character_account_data", type); continue; } @@ -877,7 +898,7 @@ void WorldSession::ReadMovementInfo(WorldPacket& data, MovementInfo* mi) { \ if (check) \ { \ - sLog->outDebug(LOG_FILTER_UNITS, "WorldSession::ReadMovementInfo: Violation of MovementFlags found (%s). " \ + LOG_DEBUG("entities.unit", "WorldSession::ReadMovementInfo: Violation of MovementFlags found (%s). " \ "MovementFlags: %u, MovementFlags2: %u for player GUID: %u. Mask %u will be removed.", \ STRINGIZE(check), mi->GetMovementFlags(), mi->GetExtraMovementFlags(), GetPlayer()->GetGUIDLow(), maskToRemove); \ mi->RemoveMovementFlag((maskToRemove)); \ @@ -1000,7 +1021,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data) if (size > 0xFFFFF) { - sLog->outError("WorldSession::ReadAddonsInfo addon info too big, size %u", size); + LOG_ERROR("server", "WorldSession::ReadAddonsInfo addon info too big, size %u", size); return; } @@ -1031,7 +1052,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data) addonInfo >> enabled >> crc >> unk1; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1); + LOG_DEBUG("server", "ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1); #endif AddonInfo addon(addonName, enabled, crc, 2, true); @@ -1046,9 +1067,9 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data) match = false; if (!match) - sLog->outDetail("ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC); + LOG_DEBUG("server", "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC); else - sLog->outDetail("ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC); + LOG_DEBUG("server", "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC); #endif } else @@ -1056,7 +1077,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data) AddonMgr::SaveAddon(addon); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC); + LOG_DEBUG("server", "ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC); #endif } @@ -1067,16 +1088,16 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data) uint32 currentTime; addonInfo >> currentTime; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ADDON: CurrentTime: %u", currentTime); + LOG_DEBUG("network", "ADDON: CurrentTime: %u", currentTime); #endif #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) if (addonInfo.rpos() != addonInfo.size()) - sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under-read!"); + LOG_DEBUG("network", "packet under-read!"); #endif } else - sLog->outError("Addon packet uncompress error!"); + LOG_ERROR("server", "Addon packet uncompress error!"); } void WorldSession::SendAddonsInfo() @@ -1116,7 +1137,7 @@ void WorldSession::SendAddonsInfo() if (usepk) // if CRC is wrong, add public key (client need it) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC); + LOG_DEBUG("server", "ADDON: CRC (0x%x) for addon %s is wrong (does not match expected 0x%x), sending pubkey", itr->CRC, itr->Name.c_str(), STANDARD_ADDON_CRC); #endif data.append(addonPublicKey, sizeof(addonPublicKey)); } @@ -1364,7 +1385,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co if (++packetCounter.amountCounter <= maxPacketCounterAllowed) return true; - sLog->outString("AntiDOS: Account %u, IP: %s, Ping: %u, Character %s, flooding packet (opc: %s (0x%X), count: %u)", + LOG_INFO("server", "AntiDOS: Account %u, IP: %s, Ping: %u, Character %s, flooding packet (opc: %s (0x%X), count: %u)", Session->GetAccountId(), Session->GetRemoteAddress().c_str(), Session->GetLatency(), Session->GetPlayerName().c_str(), opcodeTable[p.GetOpcode()].name, p.GetOpcode(), packetCounter.amountCounter); @@ -1374,7 +1395,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co return true; case POLICY_KICK: { - sLog->outString("AntiDOS: Player %s kicked!", Session->GetPlayerName().c_str()); + LOG_INFO("server", "AntiDOS: Player %s kicked!", Session->GetPlayerName().c_str()); Session->KickPlayer(); return false; } @@ -1395,7 +1416,7 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co break; } - sLog->outString("AntiDOS: Player automatically banned for %u seconds.", duration); + LOG_INFO("server", "AntiDOS: Player automatically banned for %u seconds.", duration); return false; } default: // invalid policy @@ -1648,3 +1669,22 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co return maxPacketCounterAllowed; } + +void WorldSession::ResetTimeSync() +{ + _timeSyncNextCounter = 0; + _pendingTimeSyncRequests.clear(); +} + +void WorldSession::SendTimeSync() +{ + WorldPacket data(SMSG_TIME_SYNC_REQ, 4); + data << uint32(_timeSyncNextCounter); + SendPacket(&data); + + _pendingTimeSyncRequests[_timeSyncNextCounter] = getMSTime(); + + // Schedule next sync in 10 sec (except for the 2 first packets, which are spaced by only 5s) + _timeSyncTimer = _timeSyncNextCounter == 0 ? 5000 : 10000; + _timeSyncNextCounter++; +} diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index a6655c4f3e..f4ffb2fc63 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -15,6 +15,7 @@ #include "AuthDefines.h" #include "AddonMgr.h" #include "BanManager.h" +#include "CircularBuffer.h" #include "Common.h" #include "DatabaseEnv.h" #include "GossipDef.h" @@ -23,6 +24,7 @@ #include "World.h" #include "WorldPacket.h" #include +#include class Creature; class GameObject; @@ -124,7 +126,7 @@ public: virtual ~PacketFilter() = default; virtual bool Process(WorldPacket* /*packet*/) { return true; } - [[nodiscard]] virtual bool ProcessLogout() const { return true; } + [[nodiscard]] virtual bool ProcessUnsafe() const { return true; } protected: WorldSession* const m_pSession; @@ -138,7 +140,7 @@ public: bool Process(WorldPacket* packet) override; //in Map::Update() we do not process player logout! - [[nodiscard]] bool ProcessLogout() const override { return false; } + [[nodiscard]] bool ProcessUnsafe() const override { return false; } }; //class used to filer only thread-unsafe packets from queue @@ -357,7 +359,6 @@ public: uint32 GetLatency() const { return m_latency; } void SetLatency(uint32 latency) { m_latency = latency; } - void ResetClientTimeDelay() { m_clientTimeDelay = 0; } std::atomic m_timeOutTime; void UpdateTimeOutTime(uint32 diff) @@ -387,6 +388,9 @@ public: time_t GetCalendarEventCreationCooldown() const { return _calendarEventCreationCooldown; } void SetCalendarEventCreationCooldown(time_t cooldown) { _calendarEventCreationCooldown = cooldown; } + // Time Synchronisation + void ResetTimeSync(); + void SendTimeSync(); public: // opcodes handlers void Handle_NULL(WorldPacket& recvPacket); // not used void Handle_EarlyProccess(WorldPacket& recvPacket); // just mark packets processed in WorldSocket::OnRead @@ -1028,14 +1032,13 @@ private: LocaleConstant m_sessionDbcLocale; LocaleConstant m_sessionDbLocaleIndex; uint32 m_latency; - uint32 m_clientTimeDelay; AccountData m_accountData[NUM_ACCOUNT_DATA_TYPES]; uint32 m_Tutorials[MAX_ACCOUNT_TUTORIAL_VALUES]; bool m_TutorialsChanged; AddonsList m_addonsList; uint32 recruiterId; bool isRecruiter; - ACE_Based::LockedQueue _recvQueue; + LockedQueue _recvQueue; uint32 m_currentVendorEntry; uint64 m_currentBankerGUID; time_t timeWhoCommandAllowed; @@ -1044,6 +1047,14 @@ private: bool _shouldSetOfflineInDB; // Packets cooldown time_t _calendarEventCreationCooldown; + + CircularBuffer> _timeSyncClockDeltaQueue; // first member: clockDelta. Second member: latency of the packet exchange that was used to compute that clockDelta. + int64 _timeSyncClockDelta; + void ComputeNewClockDelta(); + + std::map _pendingTimeSyncRequests; // key: counter. value: server time when packet with that counter was sent. + uint32 _timeSyncNextCounter; + uint32 _timeSyncTimer; }; #endif /// @} diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index a367a4f223..31b4539e0d 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -53,7 +53,7 @@ struct ServerPktHeader uint8 headerIndex = 0; if (isLargePacket()) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "initializing large server to client packet. Size: %u, cmd: %u", size, cmd); + LOG_DEBUG("network", "initializing large server to client packet. Size: %u, cmd: %u", size, cmd); header[headerIndex++] = 0x80 | (0xFF & (size >> 16)); } header[headerIndex++] = 0xFF & (size >> 8); @@ -123,10 +123,10 @@ bool WorldSocket::IsClosed(void) const void WorldSocket::CloseSocket(std::string const& reason) { if (!reason.empty()) - sLog->outDebug(LOG_FILTER_CLOSE_SOCKET, "Socket closed because of: %s", reason.c_str()); + LOG_DEBUG("network", "Socket closed because of: %s", reason.c_str()); { - ACE_GUARD (LockType, Guard, m_OutBufferLock); + std::lock_guard guard(m_OutBufferLock); if (closing_) return; @@ -136,7 +136,7 @@ void WorldSocket::CloseSocket(std::string const& reason) } { - ACE_GUARD (LockType, Guard, m_SessionLock); + std::lock_guard guard(m_SessionLock); m_Session = nullptr; } @@ -149,7 +149,7 @@ const std::string& WorldSocket::GetRemoteAddress(void) const int WorldSocket::SendPacket(WorldPacket const& pct) { - ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); + std::lock_guard guard(m_OutBufferLock); if (closing_) return -1; @@ -187,7 +187,7 @@ int WorldSocket::SendPacket(WorldPacket const& pct) if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { - sLog->outError("WorldSocket::SendPacket enqueue_tail failed"); + LOG_ERROR("server", "WorldSocket::SendPacket enqueue_tail failed"); mb->release(); return -1; } @@ -230,7 +230,7 @@ int WorldSocket::open(void* a) if (peer().get_remote_addr(remote_addr) == -1) { - sLog->outError("WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); + LOG_ERROR("server", "WorldSocket::open: peer().get_remote_addr errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -248,7 +248,7 @@ int WorldSocket::open(void* a) // Register with ACE Reactor if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) { - sLog->outError("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); + LOG_ERROR("server", "WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); return -1; } @@ -285,7 +285,7 @@ int WorldSocket::handle_input(ACE_HANDLE) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); + LOG_DEBUG("server", "WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); #endif errno = ECONNRESET; @@ -294,7 +294,7 @@ int WorldSocket::handle_input(ACE_HANDLE) case 0: { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WorldSocket::handle_input: Peer has closed connection"); + LOG_DEBUG("server", "WorldSocket::handle_input: Peer has closed connection"); #endif errno = ECONNRESET; @@ -306,20 +306,20 @@ int WorldSocket::handle_input(ACE_HANDLE) return Update(); // another interesting line ;) } - ACE_NOTREACHED(return -1); + return -1; } int WorldSocket::handle_output(ACE_HANDLE) { - ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); - if (closing_) return -1; + std::lock_guard guard(m_OutBufferLock); + size_t send_len = m_OutBuffer->length(); if (send_len == 0) - return handle_output_queue(Guard); + return handle_output_queue(); #ifdef MSG_NOSIGNAL ssize_t n = peer().send (m_OutBuffer->rd_ptr(), send_len, MSG_NOSIGNAL); @@ -332,7 +332,7 @@ int WorldSocket::handle_output(ACE_HANDLE) else if (n == -1) { if (errno == EWOULDBLOCK || errno == EAGAIN) - return schedule_wakeup_output (Guard); + return schedule_wakeup_output(); return -1; } @@ -343,28 +343,28 @@ int WorldSocket::handle_output(ACE_HANDLE) // move the data to the base of the buffer m_OutBuffer->crunch(); - return schedule_wakeup_output (Guard); + return schedule_wakeup_output(); } else //now n == send_len { m_OutBuffer->reset(); - return handle_output_queue (Guard); + return handle_output_queue(); } ACE_NOTREACHED (return 0); } -int WorldSocket::handle_output_queue(GuardType& g) +int WorldSocket::handle_output_queue() { if (msg_queue()->is_empty()) - return cancel_wakeup_output(g); + return cancel_wakeup_output(); ACE_Message_Block* mblk; if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { - sLog->outError("WorldSocket::handle_output_queue dequeue_head"); + LOG_ERROR("server", "WorldSocket::handle_output_queue dequeue_head"); return -1; } @@ -387,7 +387,7 @@ int WorldSocket::handle_output_queue(GuardType& g) if (errno == EWOULDBLOCK || errno == EAGAIN) { msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero); - return schedule_wakeup_output (g); + return schedule_wakeup_output(); } mblk->release(); @@ -399,28 +399,28 @@ int WorldSocket::handle_output_queue(GuardType& g) if (msg_queue()->enqueue_head(mblk, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1) { - sLog->outError("WorldSocket::handle_output_queue enqueue_head"); + LOG_ERROR("server", "WorldSocket::handle_output_queue enqueue_head"); mblk->release(); return -1; } - return schedule_wakeup_output (g); + return schedule_wakeup_output(); } else //now n == send_len { mblk->release(); - return msg_queue()->is_empty() ? cancel_wakeup_output(g) : ACE_Event_Handler::WRITE_MASK; + return msg_queue()->is_empty() ? cancel_wakeup_output() : ACE_Event_Handler::WRITE_MASK; } - ACE_NOTREACHED(return -1); + return -1; } int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask) { // Critical section { - ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); + std::lock_guard guard(m_OutBufferLock); closing_ = true; @@ -430,7 +430,7 @@ int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask) // Critical section { - ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); + std::lock_guard guard(m_SessionLock); m_Session = nullptr; } @@ -448,7 +448,8 @@ int WorldSocket::Update(void) return 0; { - ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, 0); + std::lock_guard guard(m_OutBufferLock); + if (m_OutBuffer->length() == 0 && msg_queue()->is_empty()) return 0; } @@ -477,7 +478,7 @@ int WorldSocket::handle_input_header(void) if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240)) { Player* _player = m_Session ? m_Session->GetPlayer() : nullptr; - sLog->outError("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName().c_str() : "", header.size, header.cmd); + LOG_ERROR("server", "WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d, cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName().c_str() : "", header.size, header.cmd); errno = EINVAL; return -1; @@ -579,7 +580,7 @@ int WorldSocket::handle_input_missing_data(void) // hope this is not hack, as proper m_RecvWPct is asserted around if (!m_RecvWPct) { - sLog->outError("Forcing close on input m_RecvWPct = nullptr"); + LOG_ERROR("server", "Forcing close on input m_RecvWPct = nullptr"); errno = EINVAL; return -1; } @@ -612,39 +613,35 @@ int WorldSocket::handle_input_missing_data(void) return size_t(n) == recv_size ? 1 : 2; } -int WorldSocket::cancel_wakeup_output(GuardType& g) +int WorldSocket::cancel_wakeup_output() { if (!m_OutActive) return 0; m_OutActive = false; - g.release(); - if (reactor()->cancel_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { // would be good to store errno from reactor with errno guard - sLog->outError("WorldSocket::cancel_wakeup_output"); + LOG_ERROR("server", "WorldSocket::cancel_wakeup_output"); return -1; } return 0; } -int WorldSocket::schedule_wakeup_output(GuardType& g) +int WorldSocket::schedule_wakeup_output() { if (m_OutActive) return 0; m_OutActive = true; - g.release(); - if (reactor()->schedule_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) { - sLog->outError("WorldSocket::schedule_wakeup_output"); + LOG_ERROR("server", "WorldSocket::schedule_wakeup_output"); return -1; } @@ -672,19 +669,17 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) switch (opcode) { case CMSG_PING: + try { - try - { - return HandlePing(*new_pct); - } - catch (ByteBufferPositionException const&) {} - sLog->outError("WorldSocket::ReadDataHandler(): client sent malformed CMSG_PING"); - return -1; + return HandlePing(*new_pct); } + catch (ByteBufferPositionException const&) { } + LOG_ERROR("server", "WorldSocket::ReadDataHandler(): client sent malformed CMSG_PING"); + return -1; case CMSG_AUTH_SESSION: if (m_Session) { - sLog->outError("WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again"); + LOG_ERROR("server", "WorldSocket::ProcessIncoming: Player send CMSG_AUTH_SESSION again"); return -1; } return HandleAuthSession (*new_pct); @@ -692,42 +687,44 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct) if (m_Session) m_Session->ResetTimeOutTime(true); return 0; + case CMSG_TIME_SYNC_RESP: + new_pct = new WorldPacket(std::move(*new_pct), std::chrono::steady_clock::now()); + break; default: - { - ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); - - if (m_Session != nullptr) - { - // Our Idle timer will reset on any non PING opcodes. - // Catches people idling on the login screen and any lingering ingame connections. - m_Session->ResetTimeOutTime(false); - - // OK, give the packet to WorldSession - aptr.release(); - m_Session->QueuePacket (new_pct); - return 0; - } - else - { - sLog->outError("WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); - return -1; - } - } + break; } } catch (ByteBufferException const&) { - sLog->outError("WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.", opcode, GetRemoteAddress().c_str(), m_Session ? m_Session->GetAccountId() : -1); - if (sLog->IsOutDebug()) + LOG_ERROR("server", "WorldSocket::ProcessIncoming ByteBufferException occured while parsing an instant handled packet (opcode: %u) from client %s, accountid=%i. Disconnected client.", opcode, GetRemoteAddress().c_str(), m_Session ? m_Session->GetAccountId() : -1); + if (sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG)) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Dumping error causing packet:"); + LOG_DEBUG("network", "Dumping error causing packet:"); new_pct->hexlike(); } return -1; } - ACE_NOTREACHED (return 0); + std::lock_guard guard(m_SessionLock); + + if (m_Session != nullptr) + { + // Our Idle timer will reset on any non PING or TIME_SYNC opcodes. + // Catches people idling on the login screen and any lingering ingame connections. + if (opcode != CMSG_PING && opcode != CMSG_TIME_SYNC_RESP) + { + m_Session->ResetTimeOutTime(false); + } + + // OK, give the packet to WorldSession + aptr.release(); + m_Session->QueuePacket(new_pct); + return 0; + } + + LOG_ERROR("server", "WorldSocket::ProcessIncoming: Client not authed opcode = %u", uint32(opcode)); + return -1; } int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) @@ -754,7 +751,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8(AUTH_REJECT); SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); + LOG_ERROR("server", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", GetRemoteAddress().c_str()); return -1; } @@ -771,7 +768,8 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) recvPacket.read(digest); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("WorldSocket::HandleAuthSession: client %u, loginServerID %u, account %s, loginServerType %u, clientseed %u", BuiltNumberClient, loginServerID, account.c_str(), loginServerType, clientSeed); + LOG_DEBUG("server", "WorldSocket::HandleAuthSession: client %u, loginServerID %u, account %s, loginServerType %u", + BuiltNumberClient, loginServerID, account.c_str(), loginServerType); #endif // Get the account information from the realmd database // 0 1 2 3 4 5 6 7 8 9 10 @@ -791,7 +789,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); + LOG_ERROR("server", "WorldSocket::HandleAuthSession: Sent Auth Response (unknown account)."); return -1; } @@ -826,7 +824,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8 (AUTH_FAILED); SendPacket(packet); - sLog->outBasic ("WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str()); + LOG_INFO("server", "WorldSocket::HandleAuthSession: Sent Auth Response (Account IP differs. Original IP: %s, new IP: %s).", fields[2].GetCString(), address.c_str()); // We could log on hook only instead of an additional db log, however action logger is config based. Better keep DB logging as well sScriptMgr->OnFailedAccountLogin(id); return -1; @@ -869,7 +867,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8(AUTH_REJECT); SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), os.c_str()); + LOG_ERROR("server", "WorldSocket::HandleAuthSession: Client %s attempted to log in using invalid client OS (%s).", address.c_str(), os.c_str()); return -1; } @@ -904,7 +902,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8 (AUTH_BANNED); SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); + LOG_ERROR("server", "WorldSocket::HandleAuthSession: Sent Auth Response (Account banned)."); sScriptMgr->OnFailedAccountLogin(id); return -1; } @@ -912,7 +910,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) // Check locked state for server AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security)); + LOG_DEBUG("network", "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security)); #endif if (AccountTypes(security) < allowedAccountType) { @@ -922,7 +920,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) SendPacket(packet); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); + LOG_DEBUG("server", "WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); #endif sScriptMgr->OnFailedAccountLogin(id); return -1; @@ -946,12 +944,12 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); + LOG_ERROR("server", "WorldSocket::HandleAuthSession: Authentication failed for account: %u ('%s') address: %s", id, account.c_str(), address.c_str()); return -1; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", + LOG_DEBUG("server", "WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", account.c_str(), address.c_str()); #endif @@ -988,7 +986,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8 (AUTH_REJECT); SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: World closed, denying client (%s).", address.c_str()); + LOG_ERROR("server", "WorldSocket::HandleAuthSession: World closed, denying client (%s).", address.c_str()); sScriptMgr->OnFailedAccountLogin(id); return -1; } @@ -999,7 +997,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket) packet << uint8 (REALM_LIST_REALM_NOT_FOUND); SendPacket(packet); - sLog->outError("WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.", + LOG_ERROR("server", "WorldSocket::HandleAuthSession: Client %s requested connecting with realm id %u but this realm has id %u set in config.", address.c_str(), realm, realmID); sScriptMgr->OnFailedAccountLogin(id); return -1; @@ -1050,12 +1048,12 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket) if (max_count && m_OverSpeedPings > max_count) { - ACE_GUARD_RETURN(LockType, Guard, m_SessionLock, -1); + std::lock_guard guard(m_SessionLock); if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity())) { Player* _player = m_Session->GetPlayer(); - sLog->outError("WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)", + LOG_ERROR("server", "WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)", m_Session->GetAccountId(), _player ? _player->GetGUIDLow() : 0, _player ? _player->GetName().c_str() : "", @@ -1071,16 +1069,15 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket) // critical section { - ACE_GUARD_RETURN(LockType, Guard, m_SessionLock, -1); + std::lock_guard guard(m_SessionLock); if (m_Session) { m_Session->SetLatency (latency); - m_Session->ResetClientTimeDelay(); } else { - sLog->outError("WorldSocket::HandlePing: peer sent CMSG_PING, " + LOG_ERROR("server", "WorldSocket::HandlePing: peer sent CMSG_PING, " "but is not authenticated or got recently kicked, " " address = %s", GetRemoteAddress().c_str()); diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h index ee38567a63..92f7a34f36 100644 --- a/src/server/game/Server/WorldSocket.h +++ b/src/server/game/Server/WorldSocket.h @@ -20,8 +20,8 @@ #include #include #include -#include #include +#include #if !defined (ACE_LACKS_PRAGMA_ONCE) #pragma once @@ -78,10 +78,6 @@ public: friend class WorldSocketMgr; - /// Mutex type used for various synchronizations. - typedef ACE_Thread_Mutex LockType; - typedef ACE_Guard GuardType; - /// Check if socket is closed. bool IsClosed (void) const; @@ -131,11 +127,11 @@ private: /// Help functions to mark/unmark the socket for output. /// @param g the guard is for m_OutBufferLock, the function will release it - int cancel_wakeup_output (GuardType& g); - int schedule_wakeup_output (GuardType& g); + int cancel_wakeup_output(); + int schedule_wakeup_output(); /// Drain the queue if its not empty. - int handle_output_queue (GuardType& g); + int handle_output_queue(); /// process one incoming packet. /// @param new_pct received packet, note that you need to delete it. @@ -161,7 +157,7 @@ private: AuthCrypt m_Crypt; /// Mutex lock to protect m_Session - LockType m_SessionLock; + std::mutex m_SessionLock; /// Session to which received packets are routed WorldSession* m_Session; @@ -178,7 +174,7 @@ private: ACE_Message_Block m_Header; /// Mutex for protecting output related data. - LockType m_OutBufferLock; + std::mutex m_OutBufferLock; /// Buffer used for writing output. ACE_Message_Block* m_OutBuffer; diff --git a/src/server/game/Server/WorldSocketAcceptor.h b/src/server/game/Server/WorldSocketAcceptor.h index d7096d57d9..e2ed70ff5f 100644 --- a/src/server/game/Server/WorldSocketAcceptor.h +++ b/src/server/game/Server/WorldSocketAcceptor.h @@ -30,7 +30,7 @@ public: 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); } @@ -40,7 +40,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)); } diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp index e5b5859e85..5c18eff698 100644 --- a/src/server/game/Server/WorldSocketMgr.cpp +++ b/src/server/game/Server/WorldSocketMgr.cpp @@ -92,7 +92,7 @@ public: int AddSocket (WorldSocket* sock) { - ACORE_GUARD(ACE_Thread_Mutex, m_NewSockets_Lock); + std::lock_guard guard(m_NewSockets_Lock); ++m_Connections; sock->AddReference(); @@ -112,7 +112,7 @@ public: protected: void AddNewSockets() { - ACORE_GUARD(ACE_Thread_Mutex, m_NewSockets_Lock); + std::lock_guard guard(m_NewSockets_Lock); if (m_NewSockets.empty()) return; @@ -138,7 +138,7 @@ protected: int svc() override { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("Network Thread Starting"); + LOG_DEBUG("server", "Network Thread Starting"); #endif ASSERT(m_Reactor); @@ -177,7 +177,7 @@ protected: } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug ("Network Thread exits"); + LOG_DEBUG("server", "Network Thread exits"); #endif return 0; @@ -194,7 +194,7 @@ private: SocketSet m_Sockets; SocketSet m_NewSockets; - ACE_Thread_Mutex m_NewSockets_Lock; + std::mutex m_NewSockets_Lock; }; WorldSocketMgr::WorldSocketMgr() : @@ -228,7 +228,7 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address) if (num_threads <= 0) { - sLog->outError("Network.Threads is wrong in your config file"); + LOG_ERROR("server", "Network.Threads is wrong in your config file"); return -1; } @@ -236,7 +236,7 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address) m_NetThreads = new ReactorRunnable[m_NetThreadsCount]; - sLog->outBasic ("Max allowed socket connections %d", ACE::max_handles()); + LOG_INFO("server", "Max allowed socket connections %d", ACE::max_handles()); // -1 means use default m_SockOutKBuff = sConfigMgr->GetOption ("Network.OutKBuff", -1); @@ -245,7 +245,7 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address) if (m_SockOutUBuff <= 0) { - sLog->outError("Network.OutUBuff is wrong in your config file"); + LOG_ERROR("server", "Network.OutUBuff is wrong in your config file"); return -1; } @@ -255,7 +255,7 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address) if (m_Acceptor->open(listen_addr, m_NetThreads[0].GetReactor(), ACE_NONBLOCK) == -1) { - sLog->outError("Failed to open acceptor, check if the port is free"); + LOG_ERROR("server", "Failed to open acceptor, check if the port is free"); return -1; } @@ -268,8 +268,8 @@ WorldSocketMgr::StartReactiveIO (uint16 port, const char* address) int WorldSocketMgr::StartNetwork (uint16 port, const char* address) { - if (!sLog->IsOutDebug()) - ACE_Log_Msg::instance()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS); + if (!sLog->ShouldLog("network", LogLevel::LOG_LEVEL_DEBUG)) + ACE_Log_Msg::instance()->priority_mask(LM_ERROR, ACE_Log_Msg::PROCESS); if (StartReactiveIO(port, address) == -1) return -1; @@ -319,7 +319,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock) (void*) & m_SockOutKBuff, sizeof (int)) == -1 && errno != ENOTSUP) { - sLog->outError("WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); + LOG_ERROR("server", "WorldSocketMgr::OnSocketOpen set_option SO_SNDBUF"); return -1; } } @@ -334,7 +334,7 @@ WorldSocketMgr::OnSocketOpen (WorldSocket* sock) (void*)&ndoption, sizeof (int)) == -1) { - sLog->outError("WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); + LOG_ERROR("server", "WorldSocketMgr::OnSocketOpen: peer().set_option TCP_NODELAY errno = %s", ACE_OS::strerror (errno)); return -1; } } diff --git a/src/server/game/Server/WorldSocketMgr.h b/src/server/game/Server/WorldSocketMgr.h index 316760c6eb..a46583d4bb 100644 --- a/src/server/game/Server/WorldSocketMgr.h +++ b/src/server/game/Server/WorldSocketMgr.h @@ -14,7 +14,6 @@ #define __WORLDSOCKETMGR_H #include "Common.h" -#include class WorldSocket; class ReactorRunnable; diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 030a248640..dc659d1c92 100644 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -43,8 +43,8 @@ void LoadSkillDiscoveryTable() if (!result) { - sLog->outErrorDb(">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 skill discovery definitions. DB table `skill_discovery_template` is empty."); + LOG_INFO("server", " "); return; } @@ -77,7 +77,7 @@ void LoadSkillDiscoveryTable() { if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end()) { - sLog->outErrorDb("Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell); + LOG_ERROR("sql.sql", "Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table", spellId, reqSkillOrSpell); reportedReqSpells.insert(absReqSkillOrSpell); } continue; @@ -90,7 +90,7 @@ void LoadSkillDiscoveryTable() { if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end()) { - sLog->outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc" + LOG_ERROR("sql.sql", "Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc" " and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table", absReqSkillOrSpell, spellId); reportedReqSpells.insert(absReqSkillOrSpell); @@ -106,7 +106,7 @@ void LoadSkillDiscoveryTable() if (bounds.first == bounds.second) { - sLog->outErrorDb("Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId); + LOG_ERROR("sql.sql", "Spell (ID: %u) not listed in `SkillLineAbility.dbc` but listed with `reqSpell`=0 in `skill_discovery_template` table", spellId); continue; } @@ -115,7 +115,7 @@ void LoadSkillDiscoveryTable() } else { - sLog->outErrorDb("Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId); + LOG_ERROR("sql.sql", "Spell (ID: %u) have negative value in `reqSpell` field in `skill_discovery_template` table", spellId); continue; } @@ -123,7 +123,7 @@ void LoadSkillDiscoveryTable() } while (result->NextRow()); if (!ssNonDiscoverableEntries.str().empty()) - sLog->outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str()); + LOG_ERROR("sql.sql", "Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str()); // report about empty data for explicit discovery spells for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id) @@ -137,11 +137,11 @@ void LoadSkillDiscoveryTable() continue; if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end()) - sLog->outErrorDb("Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id); + LOG_ERROR("sql.sql", "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id); } - sLog->outString(">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index c11b0f2dd4..9c074f0271 100644 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -48,8 +48,8 @@ void LoadSkillPerfectItemTable() if (!result) { - sLog->outErrorDb(">> Loaded 0 spell perfection definitions. DB table `skill_perfect_item_template` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 spell perfection definitions. DB table `skill_perfect_item_template` is empty."); + LOG_INFO("server", " "); return; } @@ -63,28 +63,28 @@ void LoadSkillPerfectItemTable() if (!sSpellMgr->GetSpellInfo(spellId)) { - sLog->outError("Skill perfection data for spell %u has non-existent spell id in `skill_perfect_item_template`!", spellId); + LOG_ERROR("server", "Skill perfection data for spell %u has non-existent spell id in `skill_perfect_item_template`!", spellId); continue; } uint32 requiredSpecialization = fields[1].GetUInt32(); if (!sSpellMgr->GetSpellInfo(requiredSpecialization)) { - sLog->outError("Skill perfection data for spell %u has non-existent required specialization spell id %u in `skill_perfect_item_template`!", spellId, requiredSpecialization); + LOG_ERROR("server", "Skill perfection data for spell %u has non-existent required specialization spell id %u in `skill_perfect_item_template`!", spellId, requiredSpecialization); continue; } float perfectCreateChance = fields[2].GetFloat(); if (perfectCreateChance <= 0.0f) { - sLog->outError("Skill perfection data for spell %u has impossibly low proc chance in `skill_perfect_item_template`!", spellId); + LOG_ERROR("server", "Skill perfection data for spell %u has impossibly low proc chance in `skill_perfect_item_template`!", spellId); continue; } uint32 perfectItemType = fields[3].GetUInt32(); if (!sObjectMgr->GetItemTemplate(perfectItemType)) { - sLog->outError("Skill perfection data for spell %u references non-existent perfect item id %u in `skill_perfect_item_template`!", spellId, perfectItemType); + LOG_ERROR("server", "Skill perfection data for spell %u references non-existent perfect item id %u in `skill_perfect_item_template`!", spellId, perfectItemType); continue; } @@ -97,8 +97,8 @@ void LoadSkillPerfectItemTable() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell perfection definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell perfection definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } struct SkillExtraItemEntry @@ -134,8 +134,8 @@ void LoadSkillExtraItemTable() if (!result) { - sLog->outErrorDb(">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 spell specialization definitions. DB table `skill_extra_item_template` is empty."); + LOG_INFO("server", " "); return; } @@ -149,28 +149,28 @@ void LoadSkillExtraItemTable() if (!sSpellMgr->GetSpellInfo(spellId)) { - sLog->outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId); + LOG_ERROR("server", "Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId); continue; } uint32 requiredSpecialization = fields[1].GetUInt32(); if (!sSpellMgr->GetSpellInfo(requiredSpecialization)) { - sLog->outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization); + LOG_ERROR("server", "Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization); continue; } float additionalCreateChance = fields[2].GetFloat(); if (additionalCreateChance <= 0.0f) { - sLog->outError("Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId); + LOG_ERROR("server", "Skill specialization %u has too low additional create chance in `skill_extra_item_template`!", spellId); continue; } int32 newMaxOrEntry = fields[3].GetInt32(); if (!newMaxOrEntry) { - sLog->outError("Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId); + LOG_ERROR("server", "Skill specialization %u has 0 max number of extra items in `skill_extra_item_template`!", spellId); continue; } @@ -183,8 +183,8 @@ void LoadSkillExtraItemTable() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } bool CanCreatePerfectItem(Player* player, uint32 spellId, float& perfectCreateChance, uint32& perfectItemType) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index b7b7ebc594..7d34ca8632 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -944,7 +944,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster) if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN) { m_isPeriodic = false; - sLog->outError("Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId()); + LOG_ERROR("server", "Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId()); } else { @@ -1880,7 +1880,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo case FORM_SPIRITOFREDEMPTION: // 0x20 break; default: - sLog->outError("Auras: Unknown Shapeshift Type: %u", GetMiscValue()); + LOG_ERROR("server", "Auras: Unknown Shapeshift Type: %u", GetMiscValue()); } modelid = target->GetModelForForm(form); @@ -2264,7 +2264,7 @@ void AuraEffect::HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, if (!ci) { target->SetDisplayId(16358); // pig pink ^_^ - sLog->outError("Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId()); + LOG_ERROR("server", "Auras: unknown creature id = %d (only need its modelid) From Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId()); } else { @@ -2462,7 +2462,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo if (aurApp->GetRemoveMode()) return; // blizz like 2.0.x - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); // blizz like 2.0.x target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x @@ -2479,7 +2479,7 @@ void AuraEffect::HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, boo target->SendMessageToSet(&data, true); */ // blizz like 2.0.x - target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); // blizz like 2.0.x target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); // blizz like 2.0.x @@ -2822,7 +2822,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry); if (!ci) { - sLog->outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue()); + LOG_ERROR("sql.sql", "AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue()); return; } @@ -3960,7 +3960,7 @@ void AuraEffect::HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bo if (GetMiscValue() < -2 || GetMiscValue() > 4) { - sLog->outError("WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue()); + LOG_ERROR("server", "WARNING: Spell %u effect %u has an unsupported misc value (%i) for SPELL_AURA_MOD_STAT ", GetId(), GetEffIndex(), GetMiscValue()); return; } @@ -3986,7 +3986,7 @@ void AuraEffect::HandleModPercentStat(AuraApplication const* aurApp, uint8 mode, if (GetMiscValue() < -1 || GetMiscValue() > 4) { - sLog->outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); + LOG_ERROR("server", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); return; } @@ -4084,7 +4084,7 @@ void AuraEffect::HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 if (GetMiscValue() < -1 || GetMiscValue() > 4) { - sLog->outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); + LOG_ERROR("server", "WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid"); return; } @@ -4147,7 +4147,7 @@ void AuraEffect::HandleAuraModResistenceOfStatPercent(AuraApplication const* aur { // support required adding replace UpdateArmor by loop by UpdateResistence at intellect update // and include in UpdateResistence same code as in UpdateArmor for aura mod apply. - sLog->outError("Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!"); + LOG_ERROR("server", "Aura SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT(182) does not work for non-armor type resistances!"); return; } @@ -5482,13 +5482,13 @@ void AuraEffect::HandleAuraModFaction(AuraApplication const* aurApp, uint8 mode, { target->setFaction(GetMiscValue()); if (target->GetTypeId() == TYPEID_PLAYER) - target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); } else { target->RestoreFaction(); if (target->GetTypeId() == TYPEID_PLAYER) - target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); } } @@ -6097,7 +6097,7 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) triggerCaster->CastSpell(targets, triggeredSpellInfo, nullptr, triggerFlags, nullptr, this); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); + LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); #endif } } @@ -6123,7 +6123,7 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* triggerCaster->CastSpell(targets, triggeredSpellInfo, &values, TRIGGERED_FULL_MASK, nullptr, this); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); + LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); #endif } } @@ -6135,7 +6135,7 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* sEluna->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature()); #endif #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); + LOG_DEBUG("spells.aura", "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex()); #endif } } @@ -6255,7 +6255,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const Unit::CalcAbsorbResist(caster, target, GetSpellInfo()->GetSchoolMask(), DOT, damage, &absorb, &resist, GetSpellInfo()); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", + LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); #endif Unit::DealDamageMods(target, damage, &absorb); @@ -6351,7 +6351,7 @@ void AuraEffect::HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) c damage = target->GetHealth(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", + LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) health leech of %u (TypeId: %u) for %u dmg inflicted by %u abs is %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId(), absorb); #endif if (caster) @@ -6395,7 +6395,7 @@ void AuraEffect::HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) caster->ModifyHealth(-(int32)damage); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "PeriodicTick: donator %u target %u damage %u.", caster->GetEntry(), target->GetEntry(), damage); + LOG_DEBUG("spells.aura", "PeriodicTick: donator %u target %u damage %u.", caster->GetEntry(), target->GetEntry(), damage); #endif float gainMultiplier = GetSpellInfo()->Effects[GetEffIndex()].CalcValueMultiplier(caster); @@ -6498,7 +6498,7 @@ void AuraEffect::HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const damage = Unit::SpellCriticalHealingBonus(caster, GetSpellInfo(), damage, target); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", + LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), damage, GetId()); #endif uint32 absorb = 0; @@ -6578,7 +6578,7 @@ void AuraEffect::HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) con } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", + LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) power leech of %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), drainAmount, GetId()); #endif // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) @@ -6645,7 +6645,7 @@ void AuraEffect::HandleObsModPowerAuraTick(Unit* target, Unit* caster) const // ignore negative values (can be result apply spellmods to aura damage uint32 amount = std::max(m_amount, 0) * target->GetMaxPower(PowerType) / 100; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", + LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId()); #endif SpellPeriodicAuraLogInfo pInfo(this, amount, 0, 0, 0, 0.0f, false); @@ -6684,7 +6684,7 @@ void AuraEffect::HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) cons target->SendPeriodicAuraLog(&pInfo); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", + LOG_DEBUG("server", "PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u", GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), target->GetGUIDLow(), target->GetTypeId(), amount, GetId()); #endif int32 gain = target->ModifyPower(PowerType, amount); @@ -6747,14 +6747,14 @@ void AuraEffect::HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEve if (SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(triggerSpellId)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId()); + LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Triggering spell %u from aura %u proc", triggeredSpellInfo->Id, GetId()); #endif triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, nullptr, this); } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); + LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); #endif } } @@ -6772,14 +6772,14 @@ void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp int32 basepoints0 = GetAmount(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId()); + LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId()); #endif triggerCaster->CastCustomSpell(triggerTarget, triggerSpellId, &basepoints0, nullptr, nullptr, true, nullptr, this); } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); + LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Could not trigger spell %u from aura %u proc, because the spell does not have an entry in Spell.dbc.", triggerSpellId, GetId()); #endif } } @@ -6795,7 +6795,7 @@ void AuraEffect::HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEv Unit::DealDamageMods(damageInfo.target, damageInfo.damage, &damageInfo.absorb); target->SendSpellNonMeleeDamageLog(&damageInfo); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering %u spell damage from aura %u proc", damage, GetId()); + LOG_DEBUG("spells.aura", "AuraEffect::HandleProcTriggerDamageAuraProc: Triggering %u spell damage from aura %u proc", damage, GetId()); #endif target->DealSpellDamage(&damageInfo, true); } @@ -6819,7 +6819,7 @@ void AuraEffect::HandleRaidProcFromChargeAuraProc(AuraApplication* aurApp, ProcE break; default: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: %u", GetId()); + LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: received not handled spell: %u", GetId()); #endif return; } @@ -6847,7 +6847,7 @@ void AuraEffect::HandleRaidProcFromChargeAuraProc(AuraApplication* aurApp, ProcE } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); + LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); #endif target->CastSpell(target, triggerSpellId, true, nullptr, this, GetCasterGUID()); } @@ -6860,7 +6860,7 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA if (!(GetSpellInfo()->SpellFamilyName == SPELLFAMILY_PRIEST && GetSpellInfo()->SpellFamilyFlags[1] & 0x20)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: %u", GetId()); + LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: received not handled spell: %u", GetId()); #endif return; } @@ -6891,7 +6891,7 @@ void AuraEffect::HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurA } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); + LOG_DEBUG("spells.aura", "AuraEffect::HandleRaidProcFromChargeWithValueAuraProc: Triggering spell %u from aura %u proc", triggerSpellId, GetId()); #endif target->CastCustomSpell(target, triggerSpellId, &value, nullptr, nullptr, true, nullptr, this, GetCasterGUID()); } diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 8e69cd27f1..bf119fcd97 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -66,13 +66,13 @@ AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 e GetTarget()->SetVisibleAura(slot, this); SetNeedClientUpdate(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura: %u Effect: %d put to unit visible auras slot: %u", GetBase()->GetId(), GetEffectMask(), slot); + LOG_DEBUG("spells.aura", "Aura: %u Effect: %d put to unit visible auras slot: %u", GetBase()->GetId(), GetEffectMask(), slot); #endif } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outError("Aura: %u Effect: %d could not find empty unit visible slot", GetBase()->GetId(), GetEffectMask()); + LOG_ERROR("server", "Aura: %u Effect: %d could not find empty unit visible slot", GetBase()->GetId(), GetEffectMask()); #endif } } @@ -153,7 +153,7 @@ void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) ASSERT(HasEffect(effIndex) == (!apply)); ASSERT((1 << effIndex) & _effectsToApply); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraApplication::_HandleEffect: %u, apply: %u: amount: %u", aurEff->GetAuraType(), apply, aurEff->GetAmount()); + LOG_DEBUG("spells.aura", "AuraApplication::_HandleEffect: %u, apply: %u: amount: %u", aurEff->GetAuraType(), apply, aurEff->GetAmount()); #endif if (apply) @@ -504,7 +504,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* auraAp // TODO: Figure out why this happens if (itr == m_applications.end()) { - sLog->outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!", + LOG_ERROR("server", "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!", target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id); ABORT(); } @@ -670,7 +670,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) if (!GetOwner()->IsSelfOrInSameMap(itr->first)) { //TODO: There is a crash caused by shadowfiend load addon - sLog->outCrash("Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id, + LOG_FATAL("server", "Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id, GetOwner()->GetName().c_str(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1), itr->first->GetName().c_str(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1)); ABORT(); @@ -1112,7 +1112,7 @@ void Aura::UnregisterSingleTarget() caster = ObjectAccessor::GetObjectInOrOutOfWorld(GetCasterGUID(), (Unit*)nullptr); if (!caster) { - sLog->outMisc("Aura::UnregisterSingleTarget (A1) - %u, %u, %u, %s", GetId(), GetOwner()->GetTypeId(), GetOwner()->GetEntry(), GetOwner()->GetName().c_str()); + LOG_INFO("misc", "Aura::UnregisterSingleTarget (A1) - %u, %u, %u, %s", GetId(), GetOwner()->GetTypeId(), GetOwner()->GetEntry(), GetOwner()->GetName().c_str()); //ASSERT(caster); } else @@ -1355,7 +1355,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b spellId = 57531; break; default: - sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId()); + LOG_ERROR("server", "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId()); } if (spellId) caster->CastSpell(caster, spellId, true); @@ -1480,7 +1480,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b spellId = 50508; break; default: - sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId()); + LOG_ERROR("server", "Aura::HandleAuraSpecificMods: Unknown rank of Crypt Fever/Ebon Plague (%d) found", aurEff->GetId()); } caster->CastSpell(target, spellId, true, 0, GetEffect(0)); } @@ -1596,7 +1596,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b spellId = 60946; break; default: - sLog->outError("Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId()); + LOG_ERROR("server", "Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId()); } if (spellId) caster->CastSpell(target, spellId, true); @@ -2232,7 +2232,7 @@ void Aura::LoadScripts() continue; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura::LoadScripts: Script `%s` for aura `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id); + LOG_DEBUG("spells.aura", "Aura::LoadScripts: Script `%s` for aura `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id); #endif (*itr)->Register(); ++itr; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 54141478d9..4562edee10 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -511,23 +511,23 @@ void SpellCastTargets::Update(Unit* caster) void SpellCastTargets::OutDebug() const { if (!m_targetMask) - sLog->outString("No targets"); + LOG_INFO("server", "No targets"); - sLog->outString("target mask: %u", m_targetMask); + LOG_INFO("server", "target mask: %u", m_targetMask); if (m_targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK | TARGET_FLAG_GAMEOBJECT_MASK)) - sLog->outString("Object target: " UI64FMTD, m_objectTargetGUID); + LOG_INFO("server", "Object target: " UI64FMTD, m_objectTargetGUID); if (m_targetMask & TARGET_FLAG_ITEM) - sLog->outString("Item target: " UI64FMTD, m_itemTargetGUID); + LOG_INFO("server", "Item target: " UI64FMTD, m_itemTargetGUID); if (m_targetMask & TARGET_FLAG_TRADE_ITEM) - sLog->outString("Trade item target: " UI64FMTD, m_itemTargetGUID); + LOG_INFO("server", "Trade item target: " UI64FMTD, m_itemTargetGUID); if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION) - sLog->outString("Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str()); + LOG_INFO("server", "Source location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_src._transportGUID, m_src._transportOffset.ToString().c_str(), m_src._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_DEST_LOCATION) - sLog->outString("Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str()); + LOG_INFO("server", "Destination location: transport guid:" UI64FMTD " trans offset: %s position: %s", m_dst._transportGUID, m_dst._transportOffset.ToString().c_str(), m_dst._position.ToString().c_str()); if (m_targetMask & TARGET_FLAG_STRING) - sLog->outString("String: %s", m_strTarget.c_str()); - sLog->outString("speed: %f", m_speed); - sLog->outString("elevation: %f", m_elevation); + LOG_INFO("server", "String: %s", m_strTarget.c_str()); + LOG_INFO("server", "speed: %f", m_speed); + LOG_INFO("server", "elevation: %f", m_elevation); } SpellValue::SpellValue(SpellInfo const* proto) @@ -676,7 +676,7 @@ Spell::~Spell() { // Clean the reference to avoid later crash. // If this error is repeating, we may have to add an ASSERT to better track down how we get into this case. - sLog->outError("SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id); + LOG_ERROR("server", "SPELL: deleting spell for spell ID %u. However, spell still referenced.", m_spellInfo->Id); *m_selfContainer = nullptr; } @@ -981,7 +981,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar break; case TARGET_SELECT_CATEGORY_NYI: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: target type %u, found in spellID %u, effect %u is not implemented yet!", m_spellInfo->Id, effIndex, targetType.GetTarget()); + LOG_DEBUG("spells.aura", "SPELL: target type %u, found in spellID %u, effect %u is not implemented yet!", m_spellInfo->Id, effIndex, targetType.GetTarget()); #endif break; default: @@ -1014,7 +1014,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + LOG_DEBUG("spells.aura", "SPELL: cannot find channel spell target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); #endif } break; @@ -1036,7 +1036,7 @@ void Spell::SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTa else //if (!m_targets.HasDst()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + LOG_DEBUG("spells.aura", "SPELL: cannot find channel spell destination for spell ID %u, effect %u", m_spellInfo->Id, effIndex); #endif } break; @@ -1085,7 +1085,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar if (targetType.GetCheckType() == TARGET_CHECK_ENTRY && (!condList || condList->empty())) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitNearbyTargets: no conditions entry for target with TARGET_CHECK_ENTRY of spell ID %u, effect %u - selecting default targets", m_spellInfo->Id, effIndex); + LOG_DEBUG("spells.aura", "Spell::SelectImplicitNearbyTargets: no conditions entry for target with TARGET_CHECK_ENTRY of spell ID %u, effect %u - selecting default targets", m_spellInfo->Id, effIndex); #endif switch (targetType.GetObjectType()) { @@ -1114,7 +1114,7 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar if (!target) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::SelectImplicitNearbyTargets: cannot find nearby target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); + LOG_DEBUG("spells.aura", "Spell::SelectImplicitNearbyTargets: cannot find nearby target for spell ID %u, effect %u", m_spellInfo->Id, effIndex); #endif return; } @@ -1319,7 +1319,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); + LOG_DEBUG("spells.aura", "SPELL: unknown target coordinates for spell ID %u", m_spellInfo->Id); #endif if (WorldObject* target = m_targets.GetObjectTarget()) dest = SpellDestination(*target); @@ -1630,7 +1630,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d); if (a > -0.0001f) a = 0; - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: a %f b %f", a, b);) + DEBUG_TRAJ(LOG_ERROR("server", "Spell::SelectTrajTargets: a %f b %f", a, b);) // Xinef: hack for distance, many trajectory spells have RangeEntry 1 (self) float bestDist = m_spellInfo->GetMaxRange(false) * 2; @@ -1649,11 +1649,11 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge const float objDist2d = fabs(m_targets.GetSrcPos()->GetExactDist2d(*itr) * cos(m_targets.GetSrcPos()->GetRelativeAngle(*itr))); const float dz = fabs((*itr)->GetPositionZ() - m_targets.GetSrcPos()->m_positionZ); - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) + DEBUG_TRAJ(LOG_ERROR("server", "Spell::SelectTrajTargets: check %u, dist between %f %f, height between %f %f.", (*itr)->GetEntry(), objDist2d - size, objDist2d + size, dz - size, dz + size);) float dist = objDist2d - size; float height = dist * (a * dist + b); - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);) + DEBUG_TRAJ(LOG_ERROR("server", "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);) if (dist < bestDist && height < dz + size && height > dz - size) { bestDist = dist > 0 ? dist : 0; @@ -1661,7 +1661,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge } #define CHECK_DIST {\ - DEBUG_TRAJ(sLog->outError("Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ + DEBUG_TRAJ(LOG_ERROR("server", "Spell::SelectTrajTargets: dist %f, height %f.", dist, height);)\ if (dist > bestDist)\ continue;\ if (dist < objDist2d + size && dist > objDist2d - size)\ @@ -1737,7 +1737,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge float distSq = (*itr)->GetExactDistSq(x, y, z); float sizeSq = (*itr)->GetObjectSize(); sizeSq *= sizeSq; - DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) + DEBUG_TRAJ(LOG_ERROR("server", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) if (distSq > sizeSq) { float factor = 1 - sqrt(sizeSq / distSq); @@ -1746,7 +1746,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTarge z += factor * ((*itr)->GetPositionZ() - z); distSq = (*itr)->GetExactDistSq(x, y, z); - DEBUG_TRAJ(sLog->outError("Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) + DEBUG_TRAJ(LOG_ERROR("server", "Initial %f %f %f %f %f", x, y, z, distSq, sizeSq);) } } @@ -2817,7 +2817,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA // Increase Diminishing on unit, current informations for actually casts will use values above if ((type == DRTYPE_PLAYER && ( - unit->GetCharmerOrOwnerPlayerOrPlayerItself() || flagsExtra & CREATURE_FLAG_EXTRA_ALL_DIMINISH || (m_diminishGroup == DIMINISHING_TAUNT && (flagsExtra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH)) + unit->GetCharmerOrOwnerPlayerOrPlayerItself() || flagsExtra & CREATURE_FLAG_EXTRA_ALL_DIMINISH || (m_diminishGroup == DIMINISHING_TAUNT && (flagsExtra & CREATURE_FLAG_EXTRA_OBEYS_TAUNT_DIMINISHING_RETURNS)) )) || type == DRTYPE_ALL) unit->IncrDiminishing(m_diminishGroup); } @@ -2983,7 +2983,7 @@ void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) { m_caster->CastSpell(unit, i->triggeredSpell, true); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id); + LOG_DEBUG("spells.aura", "Spell %d triggered spell %d by SPELL_AURA_ADD_TARGET_TRIGGER aura", m_spellInfo->Id, i->triggeredSpell->Id); #endif // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration @@ -3334,7 +3334,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const ReSetTimer(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::prepare: spell id %u source %u caster %d customCastFlags %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, _triggeredCastFlags, m_targets.GetTargetMask()); + LOG_DEBUG("spells.aura", "Spell::prepare: spell id %u source %u caster %d customCastFlags %u mask %u", m_spellInfo->Id, m_caster->GetEntry(), m_originalCaster ? m_originalCaster->GetEntry() : -1, _triggeredCastFlags, m_targets.GetTargetMask()); #endif //Containers for channeled spells have to be set @@ -3938,7 +3938,7 @@ void Spell::update(uint32 difftime) if (m_targets.GetUnitTargetGUID() && !m_targets.GetUnitTarget()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %u is cancelled due to removal of target.", m_spellInfo->Id); + LOG_DEBUG("spells.aura", "Spell %u is cancelled due to removal of target.", m_spellInfo->Id); #endif cancel(); return; @@ -3998,7 +3998,7 @@ void Spell::update(uint32 difftime) else if ((m_timer < 0 || m_timer > 300) && !UpdateChanneledTargetList()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Channeled spell %d is removed due to lack of targets", m_spellInfo->Id); + LOG_DEBUG("spells.aura", "Channeled spell %d is removed due to lack of targets", m_spellInfo->Id); #endif SendChannelUpdate(0); finish(); @@ -4064,7 +4064,7 @@ void Spell::finish(bool ok) if (spellInfo && spellInfo->SpellIconID == 2056) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id); + LOG_DEBUG("spells.aura", "Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id); #endif m_caster->setDeathState(JUST_DIED); return; @@ -4275,7 +4275,7 @@ void Spell::SendSpellStart() if (!IsNeedSendToClient(false)) return; - //sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Sending SMSG_SPELL_START id=%u", m_spellInfo->Id); + //LOG_DEBUG("spells.aura", "Sending SMSG_SPELL_START id=%u", m_spellInfo->Id); uint32 castFlags = CAST_FLAG_UNKNOWN_2; @@ -4330,7 +4330,7 @@ void Spell::SendSpellGo() if (!IsNeedSendToClient(true)) return; - //sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id); + //LOG_DEBUG("spells.aura", "Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id); uint32 castFlags = CAST_FLAG_UNKNOWN_9; @@ -4756,7 +4756,7 @@ void Spell::TakeCastItem() { // This code is to avoid a crash // I'm not sure, if this is really an error, but I guess every item needs a prototype - sLog->outError("Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow()); + LOG_ERROR("server", "Cast item has no item prototype highId=%d, lowId=%d", m_CastItem->GetGUIDHigh(), m_CastItem->GetGUIDLow()); return; } @@ -4852,7 +4852,7 @@ void Spell::TakePower() if (PowerType >= MAX_POWERS) { - sLog->outError("Spell::TakePower: Unknown power type '%d'", PowerType); + LOG_ERROR("server", "Spell::TakePower: Unknown power type '%d'", PowerType); return; } @@ -5112,7 +5112,7 @@ void Spell::HandleThreatSpells() target->AddThreat(m_caster, threatToAdd, m_spellInfo->GetSchoolMask(), m_spellInfo); } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %u, added an additional %f threat for %s %u target(s)", m_spellInfo->Id, threat, m_spellInfo->_IsPositiveSpell() ? "assisting" : "harming", uint32(m_UniqueTargetInfo.size())); + LOG_DEBUG("spells.aura", "Spell %u, added an additional %f threat for %s %u target(s)", m_spellInfo->Id, threat, m_spellInfo->_IsPositiveSpell() ? "assisting" : "harming", uint32(m_UniqueTargetInfo.size())); #endif } @@ -5127,7 +5127,7 @@ void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOT uint8 eff = m_spellInfo->Effects[i].Effect; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell: %u Effect : %u", m_spellInfo->Id, eff); + LOG_DEBUG("spells.aura", "Spell: %u Effect : %u", m_spellInfo->Id, eff); #endif // we do not need DamageMultiplier here. @@ -6516,7 +6516,7 @@ SpellCastResult Spell::CheckPower() // Check valid power type if (m_spellInfo->PowerType >= MAX_POWERS) { - sLog->outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType); + LOG_ERROR("server", "Spell::CheckPower: Unknown power type '%d'", m_spellInfo->PowerType); return SPELL_FAILED_UNKNOWN; } @@ -7154,7 +7154,7 @@ void Spell::Delayed() // only called in DealDamage() m_timer += delaytime; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); + LOG_DEBUG("server", "Spell %u partially interrupted for (%d) ms at damage", m_spellInfo->Id, delaytime); #endif WorldPacket data(SMSG_SPELL_DELAYED, 8 + 4); @@ -7194,7 +7194,7 @@ void Spell::DelayedChannel() m_timer -= delaytime; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); + LOG_DEBUG("spells.aura", "Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); #endif for (std::list::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) @@ -7452,7 +7452,7 @@ SpellEvent::~SpellEvent() } else { - sLog->outError("~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", + LOG_ERROR("server", "~SpellEvent: %s %u tried to delete non-deletable spell %u. Was not deleted, causes memory leak.", (m_Spell->GetCaster()->GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), m_Spell->GetCaster()->GetGUIDLow(), m_Spell->m_spellInfo->Id); ABORT(); } @@ -7852,7 +7852,7 @@ void Spell::LoadScripts() continue; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::LoadScripts: Script `%s` for spell `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id); + LOG_DEBUG("spells.aura", "Spell::LoadScripts: Script `%s` for spell `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id); #endif (*itr)->Register(); ++itr; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 7fbfda6d72..71b71a0001 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -234,7 +234,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS] = void Spell::EffectNULL(SpellEffIndex /*effIndex*/) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "WORLD: Spell Effect DUMMY"); + LOG_DEBUG("spells.aura", "WORLD: Spell Effect DUMMY"); #endif } @@ -778,7 +778,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) // normal DB scripted effect #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, effIndex); + LOG_DEBUG("spells.aura", "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, effIndex); #endif m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget); #ifdef ELUNA @@ -922,7 +922,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) if (!spellInfo) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTriggerSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); + LOG_DEBUG("spells.aura", "Spell::EffectTriggerSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); #endif return; } @@ -980,7 +980,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) if (!spellInfo) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTriggerMissileSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); + LOG_DEBUG("spells.aura", "Spell::EffectTriggerMissileSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); #endif return; } @@ -1037,7 +1037,7 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) if (!spellInfo) { - sLog->outError("Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); + LOG_ERROR("server", "Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); return; } @@ -1086,7 +1086,7 @@ void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex) if (!spellInfo) { - sLog->outError("EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); + LOG_ERROR("server", "EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); return; } @@ -1190,7 +1190,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) // If not exist data for dest location - return if (!m_targets.HasDst()) { - sLog->outError("Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id); + LOG_ERROR("server", "Spell::EffectTeleportUnits - does not have destination for spell ID %u\n", m_spellInfo->Id); return; } @@ -1203,7 +1203,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) if (!orientation && m_targets.GetUnitTarget()) orientation = m_targets.GetUnitTarget()->GetOrientation(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation); + LOG_DEBUG("spells.aura", "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation); #endif if (mapid == unitTarget->GetMapId()) @@ -1222,7 +1222,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0); else { - sLog->outError("Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id); + LOG_ERROR("server", "Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id); return; } @@ -1358,7 +1358,7 @@ void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex) player->removeSpell(spellToUnlearn, SPEC_MASK_ALL, false); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell: Player %u has unlearned spell %u from NpcGUID: %u", player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow()); + LOG_DEBUG("spells.aura", "Spell: Player %u has unlearned spell %u from NpcGUID: %u", player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow()); #endif } @@ -1432,7 +1432,7 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id); + LOG_DEBUG("spells.aura", "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id); #endif if (ZoneScript* zoneScript = m_caster->GetZoneScript()) @@ -1548,7 +1548,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/) if (!targetAura) { - sLog->outError("Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); + LOG_ERROR("server", "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); return; } @@ -1639,7 +1639,7 @@ void Spell::EffectHealthLeech(SpellEffIndex /*effIndex*/) damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage); + LOG_DEBUG("spells.aura", "HealthLeech :%i", damage); #endif // xinef: handled in spell.cpp @@ -2024,7 +2024,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) if (!gameObjTarget->isSpawned() && !player->IsGameMaster()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outError("Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!", player->GetName().c_str(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow()); + LOG_ERROR("server", "Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!", player->GetName().c_str(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow()); #endif return; } @@ -2087,7 +2087,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) if (m_caster->GetTypeId() != TYPEID_PLAYER) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "WORLD: Open Lock - No Player Caster!"); + LOG_DEBUG("spells.aura", "WORLD: Open Lock - No Player Caster!"); #endif return; } @@ -2147,7 +2147,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "WORLD: Open Lock - No GameObject/Item Target!"); + LOG_DEBUG("spells.aura", "WORLD: Open Lock - No GameObject/Item Target!"); #endif return; } @@ -2335,7 +2335,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB); if (!properties) { - sLog->outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB); + LOG_ERROR("server", "EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB); return; } @@ -2551,7 +2551,7 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex) player->learnSpell(spellToLearn); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow()); + LOG_DEBUG("spells.aura", "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow()); #endif } @@ -2796,7 +2796,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) { unitTarget->ToPlayer()->RewardHonor(nullptr, 1, damage / 10, false); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage / 10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUIDLow()); + LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage / 10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUIDLow()); #endif return; } @@ -2807,7 +2807,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) uint32 honor_reward = acore::Honor::hk_honor_at_level(unitTarget->getLevel(), float(damage)); unitTarget->ToPlayer()->RewardHonor(nullptr, 1, honor_reward, false); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow()); + LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow()); #endif } else @@ -2815,7 +2815,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/) //maybe we have correct honor_gain in damage already unitTarget->ToPlayer()->RewardHonor(nullptr, 1, damage, false); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow()); + LOG_DEBUG("spells.aura", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow()); #endif } } @@ -2919,7 +2919,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) } if (!add_socket) { - sLog->outError("Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.", + LOG_ERROR("server", "Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.", m_spellInfo->Id, SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC, ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET); return; } @@ -2993,14 +2993,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) spell_id = 36760; break; // 20% default: - sLog->outError("Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage); + LOG_ERROR("server", "Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage); return; } SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) { - sLog->outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); + LOG_ERROR("server", "Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); return; } @@ -3026,14 +3026,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) if (!enchant_id) { - sLog->outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex); + LOG_ERROR("server", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex); return; } SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) { - sLog->outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id); + LOG_ERROR("server", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id); return; } @@ -4131,7 +4131,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) spell_heal = 48085; break; default: - sLog->outError("Unknown Lightwell spell caster %u", m_caster->GetEntry()); + LOG_ERROR("server", "Unknown Lightwell spell caster %u", m_caster->GetEntry()); return; } @@ -4231,7 +4231,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) // normal DB scripted effect #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart spellid %u in EffectScriptEffect(%u)", m_spellInfo->Id, effIndex); + LOG_DEBUG("spells.aura", "Spell ScriptStart spellid %u in EffectScriptEffect(%u)", m_spellInfo->Id, effIndex); #endif m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget); } @@ -5439,7 +5439,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) if (!goinfo) { - sLog->outErrorDb("Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id); + LOG_ERROR("sql.sql", "Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id); return; } @@ -5542,7 +5542,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) ExecuteLogEffectSummonObject(effIndex, pGameObj); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("AddObject at SpellEfects.cpp EffectTransmitted"); + LOG_DEBUG("server", "AddObject at SpellEfects.cpp EffectTransmitted"); #endif //m_caster->AddGameObject(pGameObj); //m_ObjToDel.push_back(pGameObj); @@ -5628,7 +5628,7 @@ void Spell::EffectSkill(SpellEffIndex /*effIndex*/) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "WORLD: SkillEFFECT"); + LOG_DEBUG("spells.aura", "WORLD: SkillEFFECT"); #endif } @@ -5661,7 +5661,7 @@ void Spell::EffectSkinPlayerCorpse(SpellEffIndex /*effIndex*/) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Effect: SkinPlayerCorpse"); + LOG_DEBUG("spells.aura", "Effect: SkinPlayerCorpse"); #endif if ((m_caster->GetTypeId() != TYPEID_PLAYER) || (unitTarget->GetTypeId() != TYPEID_PLAYER) || (unitTarget->IsAlive())) return; @@ -5675,7 +5675,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex) return; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Effect: StealBeneficialBuff"); + LOG_DEBUG("spells.aura", "Effect: StealBeneficialBuff"); #endif if (!unitTarget || unitTarget == m_caster) // can't steal from self @@ -6153,7 +6153,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex) if (!sSoundEntriesStore.LookupEntry(soundid)) { - sLog->outError("EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id); + LOG_ERROR("server", "EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id); return; } @@ -6206,7 +6206,7 @@ void Spell::EffectPlaySound(SpellEffIndex effIndex) if (!sSoundEntriesStore.LookupEntry(soundId)) { - sLog->outError("EffectPlayerSound: Sound (Id: %u) not exist in spell %u.", soundId, m_spellInfo->Id); + LOG_ERROR("server", "EffectPlayerSound: Sound (Id: %u) not exist in spell %u.", soundId, m_spellInfo->Id); return; } @@ -6335,7 +6335,7 @@ void Spell::EffectBind(SpellEffIndex effIndex) player->SendDirectMessage(&data); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u", + LOG_DEBUG("spells.aura", "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u", homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetMapId(), areaId); #endif // zone update diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 513f73c355..0513b21154 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -1419,7 +1419,7 @@ SpellCastResult SpellInfo::CheckShapeshift(uint32 form) const shapeInfo = sSpellShapeshiftStore.LookupEntry(form); if (!shapeInfo) { - sLog->outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); + LOG_ERROR("server", "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form); return SPELL_CAST_OK; } actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells @@ -2349,7 +2349,7 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, S // Else drain all power if (PowerType < MAX_POWERS) return caster->GetPower(Powers(PowerType)); - sLog->outError("SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id); + LOG_ERROR("server", "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", PowerType, Id); return 0; } @@ -2376,11 +2376,11 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, S case POWER_RUNE: case POWER_RUNIC_POWER: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "CalculateManaCost: Not implemented yet!"); + LOG_DEBUG("spells.aura", "CalculateManaCost: Not implemented yet!"); #endif break; default: - sLog->outError("CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id); + LOG_ERROR("server", "CalculateManaCost: Unknown power type '%d' in spell %d", PowerType, Id); return 0; } } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index fff7ccd47d..0b3c790bc5 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -384,7 +384,7 @@ bool SpellMgr::ComputeIsSpellValid(SpellInfo const* spellInfo, bool msg) if (!spellInfo->IsLootCrafting()) { if (msg) - sLog->outErrorDb("Craft spell %u not have create item entry.", spellInfo->Id); + LOG_ERROR("sql.sql", "Craft spell %u not have create item entry.", spellInfo->Id); return false; } } @@ -392,7 +392,7 @@ bool SpellMgr::ComputeIsSpellValid(SpellInfo const* spellInfo, bool msg) else if (!sObjectMgr->GetItemTemplate(spellInfo->Effects[i].ItemType)) { if (msg) - sLog->outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType); + LOG_ERROR("sql.sql", "Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType); return false; } @@ -405,7 +405,7 @@ bool SpellMgr::ComputeIsSpellValid(SpellInfo const* spellInfo, bool msg) if (!ComputeIsSpellValid(spellInfo2, msg)) { if (msg) - sLog->outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell); + LOG_ERROR("sql.sql", "Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell); return false; } break; @@ -420,7 +420,7 @@ bool SpellMgr::ComputeIsSpellValid(SpellInfo const* spellInfo, bool msg) if (spellInfo->Reagent[j] > 0 && !sObjectMgr->GetItemTemplate(spellInfo->Reagent[j])) { if (msg) - sLog->outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]); + LOG_ERROR("sql.sql", "Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]); return false; } } @@ -452,14 +452,14 @@ bool SpellMgr::CheckSpellValid(SpellInfo const* spellInfo, uint32 spellId, bool if (!spellInfo) { DeleteSpellFromAllPlayers(spellId); - sLog->outError("Player::%s: Non-existed in SpellStore spell #%u request.", (isTalent ? "AddTalent" : "addSpell"), spellId); + LOG_ERROR("server", "Player::%s: Non-existed in SpellStore spell #%u request.", (isTalent ? "AddTalent" : "addSpell"), spellId); return false; } if (!IsSpellValid(spellInfo)) { DeleteSpellFromAllPlayers(spellId); - sLog->outError("Player::%s: Broken spell #%u learning not allowed.", (isTalent ? "AddTalent" : "addSpell"), spellId); + LOG_ERROR("server", "Player::%s: Broken spell #%u learning not allowed.", (isTalent ? "AddTalent" : "addSpell"), spellId); return false; } @@ -488,7 +488,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con uint32 mode = uint32(caster->GetMap()->GetSpawnMode()); if (mode >= MAX_DIFFICULTY) { - sLog->outError("SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId); + LOG_ERROR("server", "SpellMgr::GetSpellIdForDifficulty: Incorrect Difficulty for spell %u.", spellId); return spellId; //return source spell } @@ -500,7 +500,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con if (!difficultyEntry) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: SpellDifficultyEntry not found for spell %u. This should never happen.", spellId); + LOG_DEBUG("spells.aura", "SpellMgr::GetSpellIdForDifficulty: SpellDifficultyEntry not found for spell %u. This should never happen.", spellId); #endif return spellId; //return source spell } @@ -508,19 +508,19 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con if (difficultyEntry->SpellID[mode] <= 0 && mode > DUNGEON_DIFFICULTY_HEROIC) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is nullptr, using mode %u", spellId, mode, mode - 2); + LOG_DEBUG("spells.aura", "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is nullptr, using mode %u", spellId, mode, mode - 2); #endif mode -= 2; } if (difficultyEntry->SpellID[mode] <= 0) { - sLog->outErrorDb("SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode); + LOG_ERROR("sql.sql", "SpellMgr::GetSpellIdForDifficulty: spell %u mode %u spell is 0. Check spelldifficulty_dbc!", spellId, mode); return spellId; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: spellid for spell %u in mode %u is %d", spellId, mode, difficultyEntry->SpellID[mode]); + LOG_DEBUG("spells.aura", "SpellMgr::GetSpellIdForDifficulty: spellid for spell %u in mode %u is %d", spellId, mode, difficultyEntry->SpellID[mode]); #endif return uint32(difficultyEntry->SpellID[mode]); } @@ -532,13 +532,13 @@ SpellInfo const* SpellMgr::GetSpellForDifficultyFromSpell(SpellInfo const* spell if (!newSpell) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: spell %u not found. Check spelldifficulty_dbc!", newSpellId); + LOG_DEBUG("spells.aura", "SpellMgr::GetSpellForDifficultyFromSpell: spell %u not found. Check spelldifficulty_dbc!", newSpellId); #endif return spell; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellForDifficultyFromSpell: Spell id for instance mode is %u (original %u)", newSpell->Id, spell->Id); + LOG_DEBUG("spells.aura", "SpellMgr::GetSpellForDifficultyFromSpell: Spell id for instance mode is %u (original %u)", newSpell->Id, spell->Id); #endif return newSpell; } @@ -1220,7 +1220,7 @@ void SpellMgr::LoadSpellTalentRanks() SpellInfo const* firstSpell = GetSpellInfo(talentInfo->RankID[0]); if (!firstSpell) { - sLog->outErrorDb("SpellMgr::LoadSpellTalentRanks: First Rank Spell %u for TalentEntry %u does not exist.", talentInfo->RankID[0], i); + LOG_ERROR("sql.sql", "SpellMgr::LoadSpellTalentRanks: First Rank Spell %u for TalentEntry %u does not exist.", talentInfo->RankID[0], i); continue; } @@ -1234,7 +1234,7 @@ void SpellMgr::LoadSpellTalentRanks() SpellInfo const* currentSpell = GetSpellInfo(spellId); if (!currentSpell) { - sLog->outErrorDb("SpellMgr::LoadSpellTalentRanks: Spell %u (Rank: %u) for TalentEntry %u does not exist.", spellId, rank + 1, i); + LOG_ERROR("sql.sql", "SpellMgr::LoadSpellTalentRanks: Spell %u (Rank: %u) for TalentEntry %u does not exist.", spellId, rank + 1, i); break; } @@ -1266,8 +1266,8 @@ void SpellMgr::LoadSpellRanks() if (!result) { - sLog->outString(">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); + LOG_INFO("server", " "); return; } @@ -1306,13 +1306,13 @@ void SpellMgr::LoadSpellRanks() SpellInfo const* first = GetSpellInfo(lastSpell); if (!first) { - sLog->outErrorDb("Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell); + LOG_ERROR("sql.sql", "Spell rank identifier(first_spell_id) %u listed in `spell_ranks` does not exist!", lastSpell); continue; } // check if chain is long enough if (rankChain.size() < 2) { - sLog->outErrorDb("There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell); + LOG_ERROR("sql.sql", "There is only 1 spell rank for identifier(first_spell_id) %u in `spell_ranks`, entry is not needed!", lastSpell); continue; } int32 curRank = 0; @@ -1323,14 +1323,14 @@ void SpellMgr::LoadSpellRanks() SpellInfo const* spell = GetSpellInfo(itr->first); if (!spell) { - sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell); + LOG_ERROR("sql.sql", "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not exist!", itr->first, itr->second, lastSpell); valid = false; break; } ++curRank; if (itr->second != curRank) { - sLog->outErrorDb("Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank); + LOG_ERROR("sql.sql", "Spell %u (rank %u) listed in `spell_ranks` for chain %u does not have proper rank value(should be %u)!", itr->first, itr->second, lastSpell, curRank); valid = false; break; } @@ -1361,8 +1361,8 @@ void SpellMgr::LoadSpellRanks() } while (true); } while (!finished); - sLog->outString(">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellRequired() @@ -1377,8 +1377,8 @@ void SpellMgr::LoadSpellRequired() if (!result) { - sLog->outString(">> Loaded 0 spell required records. DB table `spell_required` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell required records. DB table `spell_required` is empty."); + LOG_INFO("server", " "); return; } @@ -1394,26 +1394,26 @@ void SpellMgr::LoadSpellRequired() SpellInfo const* spellInfo = GetSpellInfo(spellId); if (!spellInfo) { - sLog->outErrorDb("spell_id %u in `spell_required` table is not found in dbcs, skipped", spellId); + LOG_ERROR("sql.sql", "spell_id %u in `spell_required` table is not found in dbcs, skipped", spellId); continue; } SpellInfo const* reqSpellInfo = GetSpellInfo(spellReq); if (!reqSpellInfo) { - sLog->outErrorDb("req_spell %u in `spell_required` table is not found in dbcs, skipped", spellReq); + LOG_ERROR("sql.sql", "req_spell %u in `spell_required` table is not found in dbcs, skipped", spellReq); continue; } if (GetFirstSpellInChain(spellId) == GetFirstSpellInChain(spellReq)) { - sLog->outErrorDb("req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spellReq, spellId); + LOG_ERROR("sql.sql", "req_spell %u and spell_id %u in `spell_required` table are ranks of the same spell, entry not needed, skipped", spellReq, spellId); continue; } if (IsSpellRequiringSpell(spellId, spellReq)) { - sLog->outErrorDb("duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spellReq, spellId); + LOG_ERROR("sql.sql", "duplicated entry of req_spell %u and spell_id %u in `spell_required`, skipped", spellReq, spellId); continue; } @@ -1426,8 +1426,8 @@ void SpellMgr::LoadSpellRequired() mTalentSpellAdditionalSet.insert(spellId); } while (result->NextRow()); - sLog->outString(">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellLearnSkills() @@ -1464,8 +1464,8 @@ void SpellMgr::LoadSpellLearnSkills() } } - sLog->outString(">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellTargetPositions() @@ -1479,8 +1479,8 @@ void SpellMgr::LoadSpellTargetPositions() if (!result) { - sLog->outString(">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); + LOG_INFO("server", " "); return; } @@ -1504,20 +1504,20 @@ void SpellMgr::LoadSpellTargetPositions() MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId); if (!mapEntry) { - sLog->outErrorDb("Spell (Id: %u, effIndex: %u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, effIndex, st.target_mapId); + LOG_ERROR("sql.sql", "Spell (Id: %u, effIndex: %u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, effIndex, st.target_mapId); continue; } if (st.target_X == 0 && st.target_Y == 0 && st.target_Z == 0) { - sLog->outErrorDb("Spell (Id: %u, effIndex: %u) target coordinates not provided.", Spell_ID, effIndex); + LOG_ERROR("sql.sql", "Spell (Id: %u, effIndex: %u) target coordinates not provided.", Spell_ID, effIndex); continue; } SpellInfo const* spellInfo = GetSpellInfo(Spell_ID); if (!spellInfo) { - sLog->outErrorDb("Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID); + LOG_ERROR("sql.sql", "Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID); continue; } @@ -1529,7 +1529,7 @@ void SpellMgr::LoadSpellTargetPositions() } else { - sLog->outErrorDb("Spell (Id: %u, effIndex: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID, effIndex); + LOG_ERROR("sql.sql", "Spell (Id: %u, effIndex: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID, effIndex); continue; } } while (result->NextRow()); @@ -1566,13 +1566,13 @@ void SpellMgr::LoadSpellTargetPositions() { if (!sSpellMgr->GetSpellTargetPosition(i)) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell (ID: %u) does not have record in `spell_target_position`", i); + LOG_DEBUG("spells.aura", "Spell (ID: %u) does not have record in `spell_target_position`", i); #endif } }*/ - sLog->outString(">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellGroups() @@ -1585,8 +1585,8 @@ void SpellMgr::LoadSpellGroups() QueryResult result = WorldDatabase.Query("SELECT id, spell_id, special_flag FROM spell_group"); if (!result) { - sLog->outString(">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell group definitions. DB table `spell_group` is empty."); + LOG_INFO("server", " "); return; } @@ -1602,24 +1602,24 @@ void SpellMgr::LoadSpellGroups() if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_group` does not exist", spell_id); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_group` does not exist", spell_id); continue; } else if (spellInfo->GetRank() > 1) { - sLog->outErrorDb("Spell %u listed in `spell_group` is not first rank of spell", spell_id); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_group` is not first rank of spell", spell_id); continue; } if (mSpellGroupMap.find(spell_id) != mSpellGroupMap.end()) { - sLog->outErrorDb("Spell %u listed in `spell_group` has more than one group", spell_id); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_group` has more than one group", spell_id); continue; } if (specialFlag >= SPELL_GROUP_SPECIAL_FLAG_MAX) { - sLog->outErrorDb("Spell %u listed in `spell_group` has invalid special flag!", spell_id); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_group` has invalid special flag!", spell_id); continue; } @@ -1631,8 +1631,8 @@ void SpellMgr::LoadSpellGroups() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellGroupStackRules() @@ -1645,8 +1645,8 @@ void SpellMgr::LoadSpellGroupStackRules() QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules"); if (!result) { - sLog->outString(">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty."); + LOG_INFO("server", " "); return; } @@ -1659,7 +1659,7 @@ void SpellMgr::LoadSpellGroupStackRules() uint8 stack_rule = fields[1].GetInt8(); if (stack_rule >= SPELL_GROUP_STACK_FLAG_MAX) { - sLog->outErrorDb("SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule); + LOG_ERROR("sql.sql", "SpellGroupStackRule %u listed in `spell_group_stack_rules` does not exist", stack_rule); continue; } @@ -1673,7 +1673,7 @@ void SpellMgr::LoadSpellGroupStackRules() if (!present) { - sLog->outErrorDb("SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id); + LOG_ERROR("sql.sql", "SpellGroup id %u listed in `spell_group_stack_rules` does not exist", group_id); continue; } @@ -1682,8 +1682,8 @@ void SpellMgr::LoadSpellGroupStackRules() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellProcEvents() @@ -1696,7 +1696,7 @@ void SpellMgr::LoadSpellProcEvents() QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event"); if (!result) { - sLog->outString(">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); + LOG_INFO("server", ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty."); return; } @@ -1718,18 +1718,18 @@ void SpellMgr::LoadSpellProcEvents() SpellInfo const* spellInfo = GetSpellInfo(spellId); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", spellId); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` does not exist", spellId); continue; } if (allRanks) { if (!spellInfo->IsRanked()) - sLog->outErrorDb("Spell %u listed in `spell_proc_event` with all ranks, but spell has no ranks.", spellId); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` with all ranks, but spell has no ranks.", spellId); if (spellInfo->GetFirstRankSpell()->Id != uint32(spellId)) { - sLog->outErrorDb("Spell %u listed in `spell_proc_event` is not first rank of spell.", spellId); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` is not first rank of spell.", spellId); continue; } } @@ -1751,12 +1751,12 @@ void SpellMgr::LoadSpellProcEvents() { if (mSpellProcEventMap.find(spellInfo->Id) != mSpellProcEventMap.end()) { - sLog->outErrorDb("Spell %u listed in `spell_proc_event` already has its first rank in table.", spellInfo->Id); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` already has its first rank in table.", spellInfo->Id); break; } if (!spellInfo->ProcFlags && !spellProcEvent.procFlags) - sLog->outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell", spellInfo->Id); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc_event` probally not triggered spell", spellInfo->Id); mSpellProcEventMap[spellInfo->Id] = spellProcEvent; @@ -1769,8 +1769,8 @@ void SpellMgr::LoadSpellProcEvents() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellProcs() @@ -1783,8 +1783,8 @@ void SpellMgr::LoadSpellProcs() QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc"); if (!result) { - sLog->outString(">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty."); + LOG_INFO("server", " "); return; } @@ -1805,7 +1805,7 @@ void SpellMgr::LoadSpellProcs() SpellInfo const* spellInfo = GetSpellInfo(spellId); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_proc` does not exist", spellId); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc` does not exist", spellId); continue; } @@ -1813,7 +1813,7 @@ void SpellMgr::LoadSpellProcs() { if (spellInfo->GetFirstRankSpell()->Id != uint32(spellId)) { - sLog->outErrorDb("Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32()); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc` is not first rank of spell.", fields[0].GetInt32()); continue; } } @@ -1840,7 +1840,7 @@ void SpellMgr::LoadSpellProcs() { if (mSpellProcMap.find(spellInfo->Id) != mSpellProcMap.end()) { - sLog->outErrorDb("Spell %u listed in `spell_proc` has duplicate entry in the table", spellId); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_proc` has duplicate entry in the table", spellId); break; } SpellProcEntry procEntry = SpellProcEntry(baseProcEntry); @@ -1855,47 +1855,47 @@ void SpellMgr::LoadSpellProcs() // validate data if (procEntry.schoolMask & ~SPELL_SCHOOL_MASK_ALL) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `schoolMask` set: %u", spellId, procEntry.schoolMask); if (procEntry.spellFamilyName && (procEntry.spellFamilyName < 3 || procEntry.spellFamilyName > 17 || procEntry.spellFamilyName == 14 || procEntry.spellFamilyName == 16)) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `spellFamilyName` set: %u", spellId, procEntry.spellFamilyName); if (procEntry.chance < 0) { - sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has negative value in `chance` field", spellId); procEntry.chance = 0; } if (procEntry.ratePerMinute < 0) { - sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has negative value in `ratePerMinute` field", spellId); procEntry.ratePerMinute = 0; } if (cooldown < 0) { - sLog->outErrorDb("`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has negative value in `cooldown` field", spellId); procEntry.cooldown = 0; } if (procEntry.chance == 0 && procEntry.ratePerMinute == 0) - sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u doesn't have `chance` and `ratePerMinute` values defined, proc will not be triggered", spellId); if (procEntry.charges > 99) { - sLog->outErrorDb("`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has too big value in `charges` field", spellId); procEntry.charges = 99; } if (!procEntry.typeMask) - sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u doesn't have `typeMask` value defined, proc will not be triggered", spellId); if (procEntry.spellTypeMask & ~PROC_SPELL_TYPE_MASK_ALL) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `spellTypeMask` set: %u", spellId, procEntry.spellTypeMask); if (procEntry.spellTypeMask && !(procEntry.typeMask & (SPELL_PROC_FLAG_MASK | PERIODIC_PROC_FLAG_MASK))) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has `spellTypeMask` value defined, but it won't be used for defined `typeMask` value", spellId); if (!procEntry.spellPhaseMask && procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK) - sLog->outErrorDb("`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u doesn't have `spellPhaseMask` value defined, but it's required for defined `typeMask` value, proc will not be triggered", spellId); if (procEntry.spellPhaseMask & ~PROC_SPELL_PHASE_MASK_ALL) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `spellPhaseMask` set: %u", spellId, procEntry.spellPhaseMask); if (procEntry.spellPhaseMask && !(procEntry.typeMask & REQ_SPELL_PHASE_PROC_FLAG_MASK)) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has `spellPhaseMask` value defined, but it won't be used for defined `typeMask` value", spellId); if (procEntry.hitMask & ~PROC_HIT_MASK_ALL) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has wrong `hitMask` set: %u", spellId, procEntry.hitMask); if (procEntry.hitMask && !(procEntry.typeMask & TAKEN_HIT_PROC_FLAG_MASK || (procEntry.typeMask & DONE_HIT_PROC_FLAG_MASK && (!procEntry.spellPhaseMask || procEntry.spellPhaseMask & (PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH))))) - sLog->outErrorDb("`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId); + LOG_ERROR("sql.sql", "`spell_proc` table entry for spellId %u has `hitMask` value defined, but it won't be used for defined `typeMask` and `spellPhaseMask` values", spellId); mSpellProcMap[spellInfo->Id] = procEntry; @@ -1907,8 +1907,8 @@ void SpellMgr::LoadSpellProcs() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellBonusess() @@ -1921,8 +1921,8 @@ void SpellMgr::LoadSpellBonusess() QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data"); if (!result) { - sLog->outString(">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty."); + LOG_INFO("server", " "); return; } @@ -1935,7 +1935,7 @@ void SpellMgr::LoadSpellBonusess() SpellInfo const* spell = GetSpellInfo(entry); if (!spell) { - sLog->outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_bonus_data` does not exist", entry); continue; } @@ -1948,8 +1948,8 @@ void SpellMgr::LoadSpellBonusess() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellThreats() @@ -1962,8 +1962,8 @@ void SpellMgr::LoadSpellThreats() QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat"); if (!result) { - sLog->outString(">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty."); + LOG_INFO("server", " "); return; } @@ -1976,7 +1976,7 @@ void SpellMgr::LoadSpellThreats() if (!GetSpellInfo(entry)) { - sLog->outErrorDb("Spell %u listed in `spell_threat` does not exist", entry); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_threat` does not exist", entry); continue; } @@ -1989,8 +1989,8 @@ void SpellMgr::LoadSpellThreats() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellMixology() @@ -2003,8 +2003,8 @@ void SpellMgr::LoadSpellMixology() QueryResult result = WorldDatabase.Query("SELECT entry, pctMod FROM spell_mixology"); if (!result) { - sLog->outString(">> Loaded 0 mixology bonuses. DB table `spell_mixology` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 mixology bonuses. DB table `spell_mixology` is empty."); + LOG_INFO("server", " "); return; } @@ -2017,7 +2017,7 @@ void SpellMgr::LoadSpellMixology() if (!GetSpellInfo(entry)) { - sLog->outErrorDb("Spell %u listed in `spell_mixology` does not exist", entry); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_mixology` does not exist", entry); continue; } @@ -2025,8 +2025,8 @@ void SpellMgr::LoadSpellMixology() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u Mixology bonuses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u Mixology bonuses in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSkillLineAbilityMap() @@ -2047,8 +2047,8 @@ void SpellMgr::LoadSkillLineAbilityMap() ++count; } - sLog->outString(">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellPetAuras() @@ -2061,8 +2061,8 @@ void SpellMgr::LoadSpellPetAuras() QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); if (!result) { - sLog->outString(">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty."); + LOG_INFO("server", " "); return; } @@ -2084,21 +2084,21 @@ void SpellMgr::LoadSpellPetAuras() SpellInfo const* spellInfo = GetSpellInfo(spell); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_pet_auras` does not exist", spell); continue; } if (spellInfo->Effects[eff].Effect != SPELL_EFFECT_DUMMY && (spellInfo->Effects[eff].Effect != SPELL_EFFECT_APPLY_AURA || spellInfo->Effects[eff].ApplyAuraName != SPELL_AURA_DUMMY)) { - sLog->outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell); + LOG_ERROR("server", "Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell); continue; } SpellInfo const* spellInfo2 = GetSpellInfo(aura); if (!spellInfo2) { - sLog->outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura); + LOG_ERROR("sql.sql", "Aura %u listed in `spell_pet_auras` does not exist", aura); continue; } @@ -2109,8 +2109,8 @@ void SpellMgr::LoadSpellPetAuras() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } // Fill custom data about enchancments @@ -2151,8 +2151,8 @@ void SpellMgr::LoadEnchantCustomAttr() } } - sLog->outString(">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellEnchantProcData() @@ -2165,8 +2165,8 @@ void SpellMgr::LoadSpellEnchantProcData() QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data"); if (!result) { - sLog->outString(">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); + LOG_INFO("server", " "); return; } @@ -2180,7 +2180,7 @@ void SpellMgr::LoadSpellEnchantProcData() SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchantId); if (!ench) { - sLog->outErrorDb("Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId); + LOG_ERROR("sql.sql", "Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId); continue; } @@ -2195,8 +2195,8 @@ void SpellMgr::LoadSpellEnchantProcData() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellLinked() @@ -2209,8 +2209,8 @@ void SpellMgr::LoadSpellLinked() QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell"); if (!result) { - sLog->outString(">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty."); + LOG_INFO("server", " "); return; } @@ -2226,13 +2226,13 @@ void SpellMgr::LoadSpellLinked() SpellInfo const* spellInfo = GetSpellInfo(abs(trigger)); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(trigger)); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_linked_spell` does not exist", abs(trigger)); continue; } spellInfo = GetSpellInfo(abs(effect)); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(effect)); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_linked_spell` does not exist", abs(effect)); continue; } @@ -2248,8 +2248,8 @@ void SpellMgr::LoadSpellLinked() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadPetLevelupSpellMap() @@ -2305,8 +2305,8 @@ void SpellMgr::LoadPetLevelupSpellMap() } } - sLog->outString(">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells) @@ -2389,10 +2389,10 @@ void SpellMgr::LoadPetDefaultSpells() } } - sLog->outString(">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); - sLog->outString("Loading summonable creature templates..."); + LOG_INFO("server", "Loading summonable creature templates..."); oldMSTime = getMSTime(); // different summon spells @@ -2433,8 +2433,8 @@ void SpellMgr::LoadPetDefaultSpells() } } - sLog->outString(">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellAreas() @@ -2451,8 +2451,8 @@ void SpellMgr::LoadSpellAreas() if (!result) { - sLog->outString(">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 spell area requirements. DB table `spell_area` is empty."); + LOG_INFO("server", " "); return; } @@ -2481,7 +2481,7 @@ void SpellMgr::LoadSpellAreas() } else { - sLog->outErrorDb("Spell %u listed in `spell_area` does not exist", spell); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` does not exist", spell); continue; } @@ -2510,20 +2510,20 @@ void SpellMgr::LoadSpellAreas() if (!ok) { - sLog->outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` already listed with similar requirements.", spell); continue; } } if (spellArea.areaId && !sAreaTableStore.LookupEntry(spellArea.areaId)) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong area (%u) requirement", spell, spellArea.areaId); continue; } if (spellArea.questStart && !sObjectMgr->GetQuestTemplate(spellArea.questStart)) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell, spellArea.questStart); continue; } @@ -2531,7 +2531,7 @@ void SpellMgr::LoadSpellAreas() { if (!sObjectMgr->GetQuestTemplate(spellArea.questEnd)) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell, spellArea.questEnd); continue; } } @@ -2541,13 +2541,13 @@ void SpellMgr::LoadSpellAreas() SpellInfo const* spellInfo = GetSpellInfo(abs(spellArea.auraSpell)); if (!spellInfo) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell)); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell, abs(spellArea.auraSpell)); continue; } if (uint32(abs(spellArea.auraSpell)) == spellArea.spellId) { - sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell)); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell)); continue; } @@ -2567,7 +2567,7 @@ void SpellMgr::LoadSpellAreas() if (chain) { - sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); continue; } @@ -2583,7 +2583,7 @@ void SpellMgr::LoadSpellAreas() if (chain) { - sLog->outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell, spellArea.auraSpell); continue; } } @@ -2591,13 +2591,13 @@ void SpellMgr::LoadSpellAreas() if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE) == 0) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell, spellArea.raceMask); continue; } if (spellArea.gender != GENDER_NONE && spellArea.gender != GENDER_FEMALE && spellArea.gender != GENDER_MALE) { - sLog->outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender); + LOG_ERROR("sql.sql", "Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell, spellArea.gender); continue; } @@ -2624,28 +2624,28 @@ void SpellMgr::LoadSpellAreas() if (sWorld->getIntConfig(CONFIG_ICC_BUFF_HORDE) > 0) { - sLog->outString(">> Using ICC buff Horde: %u", sWorld->getIntConfig(CONFIG_ICC_BUFF_HORDE)); + LOG_INFO("server", ">> Using ICC buff Horde: %u", sWorld->getIntConfig(CONFIG_ICC_BUFF_HORDE)); SpellArea spellAreaICCBuffHorde = { sWorld->getIntConfig(CONFIG_ICC_BUFF_HORDE), ICC_AREA, 0, 0, 0, ICC_RACEMASK_HORDE, Gender(2), 64, 11, 1 }; SpellArea const* saICCBuffHorde = &mSpellAreaMap.insert(SpellAreaMap::value_type(sWorld->getIntConfig(CONFIG_ICC_BUFF_HORDE), spellAreaICCBuffHorde))->second; mSpellAreaForAreaMap.insert(SpellAreaForAreaMap::value_type(ICC_AREA, saICCBuffHorde)); ++count; } else - sLog->outString(">> ICC buff Horde: disabled"); + LOG_INFO("server", ">> ICC buff Horde: disabled"); if (sWorld->getIntConfig(CONFIG_ICC_BUFF_ALLIANCE) > 0) { - sLog->outString(">> Using ICC buff Alliance: %u", sWorld->getIntConfig(CONFIG_ICC_BUFF_ALLIANCE)); + LOG_INFO("server", ">> Using ICC buff Alliance: %u", sWorld->getIntConfig(CONFIG_ICC_BUFF_ALLIANCE)); SpellArea spellAreaICCBuffAlliance = { sWorld->getIntConfig(CONFIG_ICC_BUFF_ALLIANCE), ICC_AREA, 0, 0, 0, ICC_RACEMASK_ALLIANCE, Gender(2), 64, 11, 1 }; SpellArea const* saICCBuffAlliance = &mSpellAreaMap.insert(SpellAreaMap::value_type(sWorld->getIntConfig(CONFIG_ICC_BUFF_ALLIANCE), spellAreaICCBuffAlliance))->second; mSpellAreaForAreaMap.insert(SpellAreaForAreaMap::value_type(ICC_AREA, saICCBuffAlliance)); ++count; } else - sLog->outString(">> ICC buff Alliance: disabled"); + LOG_INFO("server", ">> ICC buff Alliance: disabled"); - sLog->outString(">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellInfoStore() @@ -2661,8 +2661,8 @@ void SpellMgr::LoadSpellInfoStore() mSpellInfoMap[i] = new SpellInfo(spellEntry); } - sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::UnloadSpellInfoStore() @@ -2698,8 +2698,8 @@ void SpellMgr::LoadSpellSpecificAndAuraState() spellInfo->_auraState = spellInfo->LoadAuraState(); } - sLog->outString(">> Loaded spell specific and aura state in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded spell specific and aura state in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SpellMgr::LoadSpellCustomAttr() @@ -2711,7 +2711,7 @@ void SpellMgr::LoadSpellCustomAttr() QueryResult result = WorldDatabase.Query("SELECT spell_id, attributes FROM spell_custom_attr"); if (!result) - sLog->outString(">> Loaded 0 spell custom attributes from DB. DB table `spell_custom_attr` is empty."); + LOG_INFO("server", ">> Loaded 0 spell custom attributes from DB. DB table `spell_custom_attr` is empty."); else { for (count = 0; result->NextRow(); ++count) @@ -2724,7 +2724,7 @@ void SpellMgr::LoadSpellCustomAttr() SpellInfo* spellInfo = _GetSpellInfo(spellId); if (!spellInfo) { - sLog->outString("Table `spell_custom_attr` has wrong spell (spell_id: %u), ignored.", spellId); + LOG_INFO("server", "Table `spell_custom_attr` has wrong spell (spell_id: %u), ignored.", spellId); continue; } @@ -2737,7 +2737,7 @@ void SpellMgr::LoadSpellCustomAttr() if ((attributes & (SPELL_ATTR0_CU_NEGATIVE_EFF0 << i)) != 0) { - sLog->outErrorDb("Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_NEGATIVE_EFF%u for spell %u with no EFFECT_%u", uint32(i), spellId, uint32(i)); + LOG_ERROR("sql.sql", "Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_NEGATIVE_EFF%u for spell %u with no EFFECT_%u", uint32(i), spellId, uint32(i)); continue; } } @@ -2752,7 +2752,7 @@ void SpellMgr::LoadSpellCustomAttr() if ((attributes & (SPELL_ATTR0_CU_POSITIVE_EFF0 << i)) != 0) { - sLog->outErrorDb("Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_POSITIVE_EFF%u for spell %u with no EFFECT_%u", uint32(i), spellId, uint32(i)); + LOG_ERROR("sql.sql", "Table `spell_custom_attr` has attribute SPELL_ATTR0_CU_POSITIVE_EFF%u for spell %u with no EFFECT_%u", uint32(i), spellId, uint32(i)); continue; } } @@ -2760,7 +2760,7 @@ void SpellMgr::LoadSpellCustomAttr() spellInfo->AttributesCu |= attributes; } - sLog->outString(">> Loaded %u spell custom attributes from DB in %u ms", count, GetMSTimeDiffToNow(customAttrTime)); + LOG_INFO("server", ">> Loaded %u spell custom attributes from DB in %u ms", count, GetMSTimeDiffToNow(customAttrTime)); } // xinef: create talent spells set @@ -3295,8 +3295,8 @@ void SpellMgr::LoadSpellCustomAttr() CreatureAI::FillAISpellInfo(); - sLog->outString(">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } inline void ApplySpellFix(std::initializer_list spellIds, void(*fix)(SpellEntry*)) @@ -3306,7 +3306,7 @@ inline void ApplySpellFix(std::initializer_list spellIds, void(*fix)(Spe SpellEntry const* spellInfo = (SpellEntry*)sSpellStore.LookupEntry(spellId); if (!spellInfo) { - sLog->outErrorDb("Spell info correction specified for non-existing spell %u", spellId); + LOG_ERROR("sql.sql", "Spell info correction specified for non-existing spell %u", spellId); continue; } @@ -7453,6 +7453,6 @@ void SpellMgr::LoadDbcDataCorrections() LockEntry* key = const_cast(sLockStore.LookupEntry(36)); // 3366 Opening, allows to open without proper key key->Type[2] = LOCK_KEY_NONE; - sLog->outString(">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index c117ad599c..abd1b3e949 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -14,7 +14,7 @@ bool _SpellScript::_Validate(SpellInfo const* entry) { if (!Validate(entry)) { - sLog->outError("_SpellScript::_Validate: Spell `%u` did not pass Validate() function of script `%s` - script will not be added to the spell", entry->Id, m_scriptName->c_str()); + LOG_ERROR("server", "_SpellScript::_Validate: Spell `%u` did not pass Validate() function of script `%s` - script will not be added to the spell", entry->Id, m_scriptName->c_str()); return false; } return true; @@ -27,7 +27,7 @@ bool _SpellScript::_ValidateSpellInfo(uint32 const* begin, uint32 const* end) { if (!sSpellMgr->GetSpellInfo(*begin)) { - sLog->outError("_SpellScript::_ValidateSpellInfo: Spell %u does not exist.", *begin); + LOG_ERROR("server", "_SpellScript::_ValidateSpellInfo: Spell %u does not exist.", *begin); allValid = false; } @@ -301,31 +301,31 @@ bool SpellScript::_Validate(SpellInfo const* entry) { for (std::list::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnObjectTargetSelect.begin(); itr != OnObjectTargetSelect.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnDestinationTargetSelect.begin(); itr != OnDestinationTargetSelect.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnDestinationTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnDestinationTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); return _SpellScript::_Validate(entry); } @@ -433,7 +433,7 @@ Unit* SpellScript::GetHitUnit() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitUnit was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return nullptr; } return m_spell->unitTarget; @@ -443,7 +443,7 @@ Creature* SpellScript::GetHitCreature() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitCreature was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return nullptr; } if (m_spell->unitTarget) @@ -456,7 +456,7 @@ Player* SpellScript::GetHitPlayer() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitPlayer was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return nullptr; } if (m_spell->unitTarget) @@ -469,7 +469,7 @@ Item* SpellScript::GetHitItem() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitItem was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return nullptr; } return m_spell->itemTarget; @@ -479,7 +479,7 @@ GameObject* SpellScript::GetHitGObj() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitGObj was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return nullptr; } return m_spell->gameObjTarget; @@ -489,7 +489,7 @@ WorldLocation* SpellScript::GetHitDest() { if (!IsInEffectHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitDest was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitDest was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return nullptr; } return m_spell->destTarget; @@ -499,7 +499,7 @@ int32 SpellScript::GetHitDamage() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return 0; } return m_spell->m_damage; @@ -509,7 +509,7 @@ void SpellScript::SetHitDamage(int32 damage) { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitDamage was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_spell->m_damage = damage; @@ -519,7 +519,7 @@ int32 SpellScript::GetHitHeal() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return 0; } return m_spell->m_healing; @@ -529,7 +529,7 @@ void SpellScript::SetHitHeal(int32 heal) { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetHitHeal was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_spell->m_healing = heal; @@ -539,7 +539,7 @@ Aura* SpellScript::GetHitAura() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::GetHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return nullptr; } if (!m_spell->m_spellAura) @@ -553,7 +553,7 @@ void SpellScript::PreventHitAura() { if (!IsInTargetHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitAura was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } if (m_spell->m_spellAura) @@ -564,7 +564,7 @@ void SpellScript::PreventHitEffect(SpellEffIndex effIndex) { if (!IsInHitPhase() && !IsInEffectHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_hitPreventEffectMask |= 1 << effIndex; @@ -575,7 +575,7 @@ void SpellScript::PreventHitDefaultEffect(SpellEffIndex effIndex) { if (!IsInHitPhase() && !IsInEffectHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::PreventHitDefaultEffect was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_hitPreventDefaultEffectMask |= 1 << effIndex; @@ -585,7 +585,7 @@ int32 SpellScript::GetEffectValue() const { if (!IsInEffectHook()) { - sLog->outError("Script: `%s` Spell: `%u`: function SpellScript::GetEffectValue was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "Script: `%s` Spell: `%u`: function SpellScript::GetEffectValue was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return 0; } return m_spell->damage; @@ -595,7 +595,7 @@ void SpellScript::SetEffectValue(int32 value) { if (!IsInEffectHook()) { - sLog->outError("Script: `%s` Spell: `%u`: function SpellScript::SetEffectValue was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "Script: `%s` Spell: `%u`: function SpellScript::SetEffectValue was called, but function has no effect in current hook!", m_scriptName->c_str(), m_scriptSpellId); return; } m_spell->damage = value; @@ -631,7 +631,7 @@ void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result) { if (!IsInCheckCastHook()) { - sLog->outError("TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u`: function SpellScript::SetCustomCastResultMessage was called while spell not in check cast phase!", m_scriptName->c_str(), m_scriptSpellId); return; } @@ -647,95 +647,95 @@ bool AuraScript::_Validate(SpellInfo const* entry) { for (std::list::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr) if (!entry->HasAreaAuraEffect() && !entry->HasEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA)) - sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = OnDispel.begin(); itr != OnDispel.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - sLog->outError("TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = AfterDispel.begin(); itr != AfterDispel.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - sLog->outError("TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectRemove.begin(); itr != OnEffectRemove.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = AfterEffectApply.begin(); itr != AfterEffectApply.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = AfterEffectRemove.begin(); itr != AfterEffectRemove.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectPeriodic.begin(); itr != OnEffectPeriodic.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectUpdatePeriodic.begin(); itr != OnEffectUpdatePeriodic.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = DoEffectCalcAmount.begin(); itr != DoEffectCalcAmount.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = DoEffectCalcPeriodic.begin(); itr != DoEffectCalcPeriodic.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = DoEffectCalcSpellMod.begin(); itr != DoEffectCalcSpellMod.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectAbsorb.begin(); itr != OnEffectAbsorb.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = AfterEffectAbsorb.begin(); itr != AfterEffectAbsorb.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectManaShield.begin(); itr != OnEffectManaShield.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = AfterEffectManaShield.begin(); itr != AfterEffectManaShield.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "TSCR: Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = OnEffectSplit.begin(); itr != OnEffectSplit.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectSplit` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectSplit` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = DoCheckProc.begin(); itr != DoCheckProc.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - sLog->outError("Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoCheckProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + LOG_ERROR("server", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoCheckProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = DoPrepareProc.begin(); itr != DoPrepareProc.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - sLog->outError("Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoPrepareProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + LOG_ERROR("server", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoPrepareProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = OnProc.begin(); itr != OnProc.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - sLog->outError("Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + LOG_ERROR("server", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = AfterProc.begin(); itr != AfterProc.end(); ++itr) if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect()) - sLog->outError("Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); + LOG_ERROR("server", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); for (std::list::iterator itr = OnEffectProc.begin(); itr != OnEffectProc.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); for (std::list::iterator itr = AfterEffectProc.begin(); itr != AfterEffectProc.end(); ++itr) if (!(*itr).GetAffectedEffectsMask(entry)) - sLog->outError("Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); + LOG_ERROR("server", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); return _SpellScript::_Validate(entry); } @@ -967,7 +967,7 @@ void AuraScript::PreventDefaultAction() m_defaultActionPrevented = true; break; default: - sLog->outError("TSCR: Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u` AuraScript::PreventDefaultAction called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); break; } } @@ -1154,7 +1154,7 @@ Unit* AuraScript::GetTarget() const case AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC: return m_auraApplication->GetTarget(); default: - sLog->outError("TSCR: Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); + LOG_ERROR("server", "TSCR: Script: `%s` Spell: `%u` AuraScript::GetTarget called in a hook in which the call won't have effect!", m_scriptName->c_str(), m_scriptSpellId); } return nullptr; diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index c26f1166ec..a1ff9906df 100644 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -81,8 +81,8 @@ void CreatureTextMgr::LoadCreatureTexts() if (!result) { - sLog->outString(">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 ceature texts. DB table `creature_texts` is empty."); + LOG_INFO("server", " "); return; } @@ -110,25 +110,25 @@ void CreatureTextMgr::LoadCreatureTexts() { if (!sSoundEntriesStore.LookupEntry(temp.sound)) { - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound); + LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Sound %u but sound does not exist.", temp.entry, temp.group, temp.sound); temp.sound = 0; } } if (!GetLanguageDescByID(temp.lang)) { - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang)); + LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` using Language %u but Language does not exist.", temp.entry, temp.group, uint32(temp.lang)); temp.lang = LANG_UNIVERSAL; } if (temp.type >= MAX_CHAT_MSG_TYPE) { - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type)); + LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Type %u but this Chat Type does not exist.", temp.entry, temp.group, uint32(temp.type)); temp.type = CHAT_MSG_SAY; } if (temp.emote) { if (!sEmotesStore.LookupEntry(temp.emote)) { - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote)); + LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u in table `creature_texts` has Emote %u but emote does not exist.", temp.entry, temp.group, uint32(temp.emote)); temp.emote = EMOTE_ONESHOT_NONE; } } @@ -136,13 +136,13 @@ void CreatureTextMgr::LoadCreatureTexts() { if (!sObjectMgr->GetBroadcastText(temp.BroadcastTextId)) { - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has non-existing or incompatible BroadcastTextId %u.", temp.entry, temp.group, temp.id, temp.BroadcastTextId); + LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has non-existing or incompatible BroadcastTextId %u.", temp.entry, temp.group, temp.id, temp.BroadcastTextId); temp.BroadcastTextId = 0; } } if (temp.TextRange > TEXT_RANGE_WORLD) { - sLog->outErrorDb("CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.entry, temp.group, temp.id, temp.TextRange); + LOG_ERROR("sql.sql", "CreatureTextMgr: Entry %u, Group %u, Id %u in table `creature_text` has incorrect TextRange %u.", temp.entry, temp.group, temp.id, temp.TextRange); temp.TextRange = TEXT_RANGE_NORMAL; } @@ -152,8 +152,8 @@ void CreatureTextMgr::LoadCreatureTexts() ++textCount; } while (result->NextRow()); - sLog->outString(">> Loaded %u creature texts for %lu creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u creature texts for %lu creatures in %u ms", textCount, mTextMap.size(), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void CreatureTextMgr::LoadCreatureTextLocales() @@ -185,8 +185,8 @@ void CreatureTextMgr::LoadCreatureTextLocales() ObjectMgr::AddLocaleString(Text, locale, data.Text); } while (result->NextRow()); - sLog->outString(">> Loaded %u Creature Text Locale in %u ms", uint32(mLocaleTextMap.size()), GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u Creature Text Locale in %u ms", uint32(mLocaleTextMap.size()), GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject const* whisperTarget /*= nullptr*/, ChatMsg msgType /*= CHAT_MSG_ADDON*/, Language language /*= LANG_ADDON*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, uint32 sound /*= 0*/, TeamId teamId /*= TEAM_NEUTRAL*/, bool gmOnly /*= false*/, Player* srcPlr /*= nullptr*/) @@ -197,7 +197,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject CreatureTextMap::const_iterator sList = mTextMap.find(source->GetEntry()); if (sList == mTextMap.end()) { - sLog->outErrorDb("CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName().c_str(), source->GetEntry()); + LOG_ERROR("sql.sql", "CreatureTextMgr: Could not find Text for Creature(%s) Entry %u in 'creature_text' table. Ignoring.", source->GetName().c_str(), source->GetEntry()); return 0; } @@ -205,7 +205,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject CreatureTextHolder::const_iterator itr = textHolder.find(textGroup); if (itr == textHolder.end()) { - sLog->outErrorDb("CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry()); + LOG_ERROR("sql.sql", "CreatureTextMgr: Could not find TextGroup %u for Creature(%s) GuidLow %u Entry %u. Ignoring.", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry()); return 0; } @@ -413,7 +413,7 @@ void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id) if (std::find(repeats.begin(), repeats.end(), id) == repeats.end()) repeats.push_back(id); else - sLog->outErrorDb("CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry(), uint32(id)); + LOG_ERROR("sql.sql", "CreatureTextMgr: TextGroup %u for Creature(%s) GuidLow %u Entry %u, id %u already added", uint32(textGroup), source->GetName().c_str(), source->GetGUIDLow(), source->GetEntry(), uint32(id)); } CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup) @@ -440,7 +440,7 @@ bool CreatureTextMgr::TextExist(uint32 sourceEntry, uint8 textGroup) if (sList == mTextMap.end()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "CreatureTextMgr::TextExist: Could not find Text for Creature (entry %u) in 'creature_text' table.", sourceEntry); + LOG_DEBUG("entities.unit", "CreatureTextMgr::TextExist: Could not find Text for Creature (entry %u) in 'creature_text' table.", sourceEntry); #endif return false; } @@ -450,7 +450,7 @@ bool CreatureTextMgr::TextExist(uint32 sourceEntry, uint8 textGroup) if (itr == textHolder.end()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_UNITS, "CreatureTextMgr::TextExist: Could not find TextGroup %u for Creature (entry %u).", uint32(textGroup), sourceEntry); + LOG_DEBUG("entities.unit", "CreatureTextMgr::TextExist: Could not find TextGroup %u for Creature (entry %u).", uint32(textGroup), sourceEntry); #endif return false; } diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 9fdba26f98..d74300cfdd 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -291,7 +291,7 @@ void TicketMgr::LoadTickets() PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { - sLog->outString(">> Loaded 0 GM tickets. DB table `gm_ticket` is empty!"); + LOG_INFO("server", ">> Loaded 0 GM tickets. DB table `gm_ticket` is empty!"); return; } @@ -318,8 +318,8 @@ void TicketMgr::LoadTickets() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void TicketMgr::LoadSurveys() @@ -331,8 +331,8 @@ void TicketMgr::LoadSurveys() if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_survey")) _lastSurveyId = (*result)[0].GetUInt32(); - sLog->outString(">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void TicketMgr::AddTicket(GmTicket* ticket) diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index 3d2c8eb4c2..641ccc5244 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -17,7 +17,7 @@ void CharacterDatabaseCleaner::CleanDatabase() if (!sWorld->getBoolConfig(CONFIG_CLEAN_CHARACTER_DB)) return; - sLog->outString("Cleaning character database..."); + LOG_INFO("server", "Cleaning character database..."); uint32 oldMSTime = getMSTime(); @@ -51,8 +51,8 @@ void CharacterDatabaseCleaner::CleanDatabase() sWorld->SetCleaningFlags(flags); - sLog->outString(">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table, bool (*check)(uint32)) @@ -60,7 +60,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table QueryResult result = CharacterDatabase.PQuery("SELECT DISTINCT %s FROM %s", column, table); if (!result) { - sLog->outString("Table %s is empty.", table); + LOG_INFO("server", "Table %s is empty.", table); return; } diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 0e82ef3466..af37b6fba5 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -328,7 +328,7 @@ bool PlayerDumpWriter::DumpTable(std::string& dump, uint32 guid, char const* tab case DTT_CHARACTER: { if (result->GetFieldCount() <= 74) // avoid crashes on next check - sLog->outCrash("PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table."); + LOG_FATAL("server", "PlayerDumpWriter::DumpTable - Trying to access non-existing or wrong positioned field (`deleteInfos_Account`) in `characters` table."); if (result->Fetch()[74].GetUInt32()) // characters.deleteInfos_Account - if filled error return false; @@ -503,7 +503,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s std::string tn = gettablename(line); if (tn.empty()) { - sLog->outError("LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str()); + LOG_ERROR("server", "LoadPlayerDump: Can't extract table name from line: '%s'!", line.c_str()); ROLLBACK(DUMP_FILE_BROKEN); } @@ -520,7 +520,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s if (i == DUMP_TABLE_COUNT) { - sLog->outError("LoadPlayerDump: Unknown table: '%s'!", tn.c_str()); + LOG_ERROR("server", "LoadPlayerDump: Unknown table: '%s'!", tn.c_str()); ROLLBACK(DUMP_FILE_BROKEN); } @@ -670,7 +670,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s break; } default: - sLog->outError("Unknown dump table type: %u", type); + LOG_ERROR("server", "Unknown dump table type: %u", type); break; } diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index ffa1272c76..92232fd5c4 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -39,7 +39,7 @@ Warden::~Warden() void Warden::SendModuleToClient() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Send module to client"); + LOG_DEBUG("warden", "Send module to client"); #endif // Create packet structure @@ -67,7 +67,7 @@ void Warden::SendModuleToClient() void Warden::RequestModule() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Request module"); + LOG_DEBUG("warden", "Request module"); #endif // Create packet structure @@ -140,14 +140,14 @@ bool Warden::IsValidCheckSum(uint32 checksum, const uint8* data, const uint16 le if (checksum != newChecksum) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "CHECKSUM IS NOT VALID"); + LOG_DEBUG("warden", "CHECKSUM IS NOT VALID"); #endif return false; } else { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "CHECKSUM IS VALID"); + LOG_DEBUG("warden", "CHECKSUM IS VALID"); #endif return true; } @@ -274,7 +274,7 @@ void Warden::ApplyPenalty(uint16 checkId, std::string const& reason) } reportMsg = "Warden: " + reportMsg; - sLog->outString(reportMsg.c_str()); + LOG_INFO("warden", "> Warden: %s", reportMsg.c_str()); } bool Warden::ProcessLuaCheckResponse(std::string const& msg) @@ -322,7 +322,7 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) uint8 opcode; recvData >> opcode; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size())); + LOG_DEBUG("warden", "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size())); #endif recvData.hexlike(); @@ -339,7 +339,7 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) break; case WARDEN_CMSG_MEM_CHECKS_RESULT: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "NYI WARDEN_CMSG_MEM_CHECKS_RESULT received!"); + LOG_DEBUG("warden", "NYI WARDEN_CMSG_MEM_CHECKS_RESULT received!"); #endif break; case WARDEN_CMSG_HASH_RESULT: @@ -348,12 +348,12 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) break; case WARDEN_CMSG_MODULE_FAILED: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "NYI WARDEN_CMSG_MODULE_FAILED received!"); + LOG_DEBUG("warden", "NYI WARDEN_CMSG_MODULE_FAILED received!"); #endif break; default: #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Got unknown warden opcode %02X of size %u.", opcode, uint32(recvData.size() - 1)); + LOG_DEBUG("warden", "Got unknown warden opcode %02X of size %u.", opcode, uint32(recvData.size() - 1)); #endif break; } diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index dfa5800851..0f1321a263 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -32,8 +32,8 @@ void WardenCheckMgr::LoadWardenChecks() // Check if Warden is enabled by config before loading anything if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { - sLog->outString(">> Warden disabled, loading checks skipped."); - sLog->outString(); + LOG_INFO("server", ">> Warden disabled, loading checks skipped."); + LOG_INFO("server", " "); return; } @@ -41,8 +41,8 @@ void WardenCheckMgr::LoadWardenChecks() if (!result) { - sLog->outString(">> Loaded 0 Warden checks. DB table `warden_checks` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 Warden checks. DB table `warden_checks` is empty!"); + LOG_INFO("server", " "); return; } @@ -65,7 +65,7 @@ void WardenCheckMgr::LoadWardenChecks() if (checkType == LUA_EVAL_CHECK && id > 9999) { - sLog->outError("sql.sql: Warden Lua check with id %u found in `warden_checks`. Lua checks may have four-digit IDs at most. Skipped.", id); + LOG_ERROR("server", "sql.sql: Warden Lua check with id %u found in `warden_checks`. Lua checks may have four-digit IDs at most. Skipped.", id); continue; } @@ -124,7 +124,7 @@ void WardenCheckMgr::LoadWardenChecks() { if (wardenCheck.Length > WARDEN_MAX_LUA_CHECK_LENGTH) { - sLog->outError("sql.sql: Found over-long Lua check for Warden check with id %u in `warden_checks`. Max length is %u. Skipped.", id, WARDEN_MAX_LUA_CHECK_LENGTH); + LOG_ERROR("server", "sql.sql: Found over-long Lua check for Warden check with id %u in `warden_checks`. Max length is %u. Skipped.", id, WARDEN_MAX_LUA_CHECK_LENGTH); continue; } @@ -148,8 +148,8 @@ void WardenCheckMgr::LoadWardenChecks() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u warden checks.", count); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u warden checks.", count); + LOG_INFO("server", " "); } void WardenCheckMgr::LoadWardenOverrides() @@ -157,8 +157,8 @@ void WardenCheckMgr::LoadWardenOverrides() // Check if Warden is enabled by config before loading anything if (!sWorld->getBoolConfig(CONFIG_WARDEN_ENABLED)) { - sLog->outString(">> Warden disabled, loading check overrides skipped."); - sLog->outString(); + LOG_INFO("server", ">> Warden disabled, loading check overrides skipped."); + LOG_INFO("server", " "); return; } @@ -167,8 +167,8 @@ void WardenCheckMgr::LoadWardenOverrides() if (!result) { - sLog->outString(">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 Warden action overrides. DB table `warden_action` is empty!"); + LOG_INFO("server", " "); return; } @@ -183,10 +183,10 @@ void WardenCheckMgr::LoadWardenOverrides() // Check if action value is in range (0-2, see WardenActions enum) if (action > WARDEN_ACTION_BAN) - sLog->outError("Warden check override action out of range (ID: %u, action: %u)", checkId, action); + LOG_ERROR("server", "Warden check override action out of range (ID: %u, action: %u)", checkId, action); // Check if check actually exists before accessing the CheckStore vector else if (checkId > CheckStore.size()) - sLog->outError("Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action); + LOG_ERROR("server", "Warden check action override for non-existing check (ID: %u, action: %u), skipped", checkId, action); else { CheckStore.at(checkId).Action = WardenActions(action); @@ -194,8 +194,8 @@ void WardenCheckMgr::LoadWardenOverrides() } } while (result->NextRow()); - sLog->outString(">> Loaded %u warden action overrides.", count); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u warden action overrides.", count); + LOG_INFO("server", " "); } WardenCheck const* WardenCheckMgr::GetWardenDataById(uint16 Id) diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index 6599bf1ecc..97c24f90b5 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -46,19 +46,20 @@ void WardenMac::Init(WorldSession* pClient, SessionKey const& K) _inputCrypto.Init(_inputKey); _outputCrypto.Init(_outputKey); + #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Server side warden for client %u initializing...", pClient->GetAccountId()); - sLog->outDebug(LOG_FILTER_WARDEN, "C->S Key: %s", acore::Impl::ByteArrayToHexStr(_inputKey, false).c_str()); - sLog->outDebug(LOG_FILTER_WARDEN, "S->C Key: %s", acore::Impl::ByteArrayToHexStr(_outputKey, false ).c_str()); - sLog->outDebug(LOG_FILTER_WARDEN, " Seed: %s", acore::Impl::ByteArrayToHexStr(_seed, false).c_str()); - sLog->outDebug(LOG_FILTER_WARDEN, "Loading Module..."); + LOG_DEBUG("warden", "Server side warden for client %u initializing...", pClient->GetAccountId()); + LOG_DEBUG("warden", "C->S Key: %s", acore::Impl::ByteArrayToHexStr(_inputKey, 16).c_str()); + LOG_DEBUG("warden", "S->C Key: %s", acore::Impl::ByteArrayToHexStr(_outputKey, 16 ).c_str()); + LOG_DEBUG("warden", " Seed: %s", acore::Impl::ByteArrayToHexStr(_seed, 16).c_str()); + LOG_DEBUG("warden", "Loading Module..."); #endif _module = GetModuleForClient(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Module Key: %s", acore::Impl::ByteArrayToHexStr(_module->Key, false).c_str()); - sLog->outDebug(LOG_FILTER_WARDEN, "Module ID: %s", acore::Impl::ByteArrayToHexStr(_module->Id, false).c_str()); + LOG_DEBUG("warden", "Module Key: %s", acore::Impl::ByteArrayToHexStr(_module->Key, 16).c_str()); + LOG_DEBUG("warden", "Module ID: %s", acore::Impl::ByteArrayToHexStr(_module->Id, 16).c_str()); #endif RequestModule(); } @@ -87,14 +88,14 @@ ClientWardenModule* WardenMac::GetModuleForClient() void WardenMac::InitializeModule() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Initialize module"); + LOG_DEBUG("warden", "Initialize module"); #endif } void WardenMac::RequestHash() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Request hash"); + LOG_DEBUG("warden", "Request hash"); #endif // Create packet structure @@ -164,14 +165,14 @@ void WardenMac::HandleHashResult(ByteBuffer& buff) if (memcmp(buff.contents() + 1, sha1.GetDigest().data(), 20) != 0) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed"); + LOG_DEBUG("warden", "Request hash reply: failed"); #endif ApplyPenalty(0, "Request hash reply: failed"); return; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: succeed"); + LOG_DEBUG("warden", "Request hash reply: succeed"); #endif // client 7F96EEFDA5B63D20A4DF8E00CBF48304 @@ -193,7 +194,7 @@ void WardenMac::HandleHashResult(ByteBuffer& buff) void WardenMac::RequestChecks() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Request data"); + LOG_DEBUG("warden", "Request data"); #endif ByteBuffer buff; @@ -219,7 +220,7 @@ void WardenMac::RequestChecks() void WardenMac::HandleData(ByteBuffer& buff) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Handle data"); + LOG_DEBUG("warden", "Handle data"); #endif _dataSent = false; @@ -254,7 +255,7 @@ void WardenMac::HandleData(ByteBuffer& buff) if (sha1Hash != sha1.GetDigest()) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Handle data failed: SHA1 hash is wrong!"); + LOG_DEBUG("warden", "Handle data failed: SHA1 hash is wrong!"); #endif //found = true; } @@ -271,7 +272,7 @@ void WardenMac::HandleData(ByteBuffer& buff) if (memcmp(ourMD5Hash, theirsMD5Hash, 16)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Handle data failed: MD5 hash is wrong!"); + LOG_DEBUG("warden", "Handle data failed: MD5 hash is wrong!"); #endif //found = true; } diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index 8befc10a9d..d6f3a6c69c 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -104,18 +104,18 @@ void WardenWin::Init(WorldSession* session, SessionKey const& k) _inputCrypto.Init(_inputKey); _outputCrypto.Init(_outputKey); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Server side warden for client %u initializing...", session->GetAccountId()); - sLog->outDebug(LOG_FILTER_WARDEN, "C->S Key: %s", acore::Impl::ByteArrayToHexStr(_inputKey, false).c_str()); - sLog->outDebug(LOG_FILTER_WARDEN, "S->C Key: %s", acore::Impl::ByteArrayToHexStr(_outputKey,false).c_str()); - sLog->outDebug(LOG_FILTER_WARDEN, " Seed: %s", acore::Impl::ByteArrayToHexStr(_seed, false).c_str()); - sLog->outDebug(LOG_FILTER_WARDEN, "Loading Module..."); + LOG_DEBUG("warden", "Server side warden for client %u initializing...", session->GetAccountId()); + LOG_DEBUG("warden", "C->S Key: %s", acore::Impl::ByteArrayToHexStr(_inputKey, 16).c_str()); + LOG_DEBUG("warden", "S->C Key: %s", acore::Impl::ByteArrayToHexStr(_outputKey,16).c_str()); + LOG_DEBUG("warden", " Seed: %s", acore::Impl::ByteArrayToHexStr(_seed, 16).c_str()); + LOG_DEBUG("warden", "Loading Module..."); #endif _module = GetModuleForClient(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Module Key: %s", acore::Impl::ByteArrayToHexStr(_module->Key, false).c_str()); - sLog->outDebug(LOG_FILTER_WARDEN, "Module ID: %s", acore::Impl::ByteArrayToHexStr(_module->Id, false).c_str()); + LOG_DEBUG("warden", "Module Key: %s", acore::Impl::ByteArrayToHexStr(_module->Key, 16).c_str()); + LOG_DEBUG("warden", "Module ID: %s", acore::Impl::ByteArrayToHexStr(_module->Id, 16).c_str()); #endif RequestModule(); } @@ -144,7 +144,7 @@ ClientWardenModule* WardenWin::GetModuleForClient() void WardenWin::InitializeModule() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Initialize module"); + LOG_DEBUG("warden", "Initialize module"); #endif // Create packet structure @@ -203,7 +203,7 @@ void WardenWin::InitializeModule() void WardenWin::RequestHash() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Request hash"); + LOG_DEBUG("warden", "Request hash"); #endif // Create packet structure @@ -227,14 +227,14 @@ void WardenWin::HandleHashResult(ByteBuffer& buff) if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES) != 0) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: failed"); + LOG_DEBUG("warden", "Request hash reply: failed"); #endif ApplyPenalty(0, "Request hash reply: failed"); return; } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Request hash reply: succeed"); + LOG_DEBUG("warden", "Request hash reply: succeed"); #endif // Change keys here @@ -250,7 +250,7 @@ void WardenWin::HandleHashResult(ByteBuffer& buff) void WardenWin::RequestChecks() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Request data"); + LOG_DEBUG("warden", "Request data"); #endif // If all checks were done, fill the todo list again @@ -454,14 +454,14 @@ void WardenWin::RequestChecks() stream << checkId << " "; } - sLog->outDebug(LOG_FILTER_WARDEN, "%s", stream.str().c_str()); + LOG_DEBUG("warden", "%s", stream.str().c_str()); #endif } void WardenWin::HandleData(ByteBuffer& buff) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "Handle data"); + LOG_DEBUG("warden", "Handle data"); #endif _dataSent = false; @@ -483,7 +483,7 @@ void WardenWin::HandleData(ByteBuffer& buff) { buff.rpos(buff.wpos()); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "CHECKSUM FAIL"); + LOG_DEBUG("warden", "CHECKSUM FAIL"); #endif ApplyPenalty(0, "Failed checksum in HandleData"); return; @@ -497,7 +497,7 @@ void WardenWin::HandleData(ByteBuffer& buff) if (result == 0x00) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "TIMING CHECK FAIL result 0x00"); + LOG_DEBUG("warden", "TIMING CHECK FAIL result 0x00"); #endif ApplyPenalty(0, "TIMING CHECK FAIL result"); return; @@ -510,10 +510,10 @@ void WardenWin::HandleData(ByteBuffer& buff) uint32 ticksNow = World::GetGameTimeMS(); uint32 ourTicks = newClientTicks + (ticksNow - _serverTicks); - sLog->outDebug(LOG_FILTER_WARDEN, "ServerTicks %u", ticksNow); // Now - sLog->outDebug(LOG_FILTER_WARDEN, "RequestTicks %u", _serverTicks); // At request - sLog->outDebug(LOG_FILTER_WARDEN, "Ticks %u", newClientTicks); // At response - sLog->outDebug(LOG_FILTER_WARDEN, "Ticks diff %u", ourTicks - newClientTicks); + LOG_DEBUG("warden", "ServerTicks %u", ticksNow); // Now + LOG_DEBUG("warden", "RequestTicks %u", _serverTicks); // At request + LOG_DEBUG("warden", "Ticks %u", newClientTicks); // At response + LOG_DEBUG("warden", "Ticks diff %u", ourTicks - newClientTicks); #endif } @@ -533,7 +533,7 @@ void WardenWin::HandleData(ByteBuffer& buff) if (Mem_Result != 0) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", checkId, _session->GetAccountId()); #endif checkFailed = checkId; continue; @@ -545,7 +545,7 @@ void WardenWin::HandleData(ByteBuffer& buff) if (memcmp(buff.contents() + buff.rpos(), result.data(), rd->Length) != 0) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK fail CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT MEM_CHECK fail CheckId %u account Id %u", checkId, _session->GetAccountId()); #endif checkFailed = checkId; buff.rpos(buff.rpos() + rd->Length); @@ -554,7 +554,7 @@ void WardenWin::HandleData(ByteBuffer& buff) buff.rpos(buff.rpos() + rd->Length); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT MEM_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId()); #endif break; } @@ -568,13 +568,13 @@ void WardenWin::HandleData(ByteBuffer& buff) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT PAGE_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId()); if (type == MODULE_CHECK) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT MODULE_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId()); if (type == DRIVER_CHECK) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT DRIVER_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId()); #endif checkFailed = checkId; buff.rpos(buff.rpos() + 1); @@ -585,11 +585,11 @@ void WardenWin::HandleData(ByteBuffer& buff) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT PAGE_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId()); else if (type == MODULE_CHECK) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT MODULE_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId()); else if (type == DRIVER_CHECK) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT DRIVER_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId()); #endif break; } @@ -602,7 +602,7 @@ void WardenWin::HandleData(ByteBuffer& buff) } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "LUA_EVAL_CHECK CheckId %u account Id %u got in-warden dummy response", checkId, _session->GetAccountId()/* , result */); + LOG_DEBUG("warden", "LUA_EVAL_CHECK CheckId %u account Id %u got in-warden dummy response", checkId, _session->GetAccountId()/* , result */); #endif break; } @@ -614,7 +614,7 @@ void WardenWin::HandleData(ByteBuffer& buff) if (Mpq_Result != 0) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId()); #endif checkFailed = checkId; continue; @@ -624,7 +624,7 @@ void WardenWin::HandleData(ByteBuffer& buff) if (memcmp(buff.contents() + buff.rpos(), rs->Result.ToByteArray<20>(false).data(), acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES) != 0) // SHA1 { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT MPQ_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId()); #endif checkFailed = checkId; buff.rpos(buff.rpos() + acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES); // 20 bytes SHA1 @@ -633,7 +633,7 @@ void WardenWin::HandleData(ByteBuffer& buff) buff.rpos(buff.rpos() + acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES); // 20 bytes SHA1 #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK passed, CheckId %u account Id %u", checkId, _session->GetAccountId()); + LOG_DEBUG("warden", "RESULT MPQ_CHECK passed, CheckId %u account Id %u", checkId, _session->GetAccountId()); #endif break; } diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp index ce19cea204..4402ab9d9a 100644 --- a/src/server/game/Weather/Weather.cpp +++ b/src/server/game/Weather/Weather.cpp @@ -27,7 +27,7 @@ Weather::Weather(uint32 zone, WeatherData const* weatherChances) m_grade = 0; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE * IN_MILLISECONDS))); + LOG_DEBUG("server", "WORLD: Starting weather system for zone %u (change every %u minutes).", m_zone, (uint32)(m_timer.GetInterval() / (MINUTE * IN_MILLISECONDS))); #endif } @@ -89,7 +89,7 @@ bool Weather::ReGenerate() #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) static char const* seasonName[WEATHER_SEASONS] = { "spring", "summer", "fall", "winter" }; - sLog->outDetail("Generating a change in %s weather for zone %u.", seasonName[season], m_zone); + LOG_DEBUG("server", "Generating a change in %s weather for zone %u.", seasonName[season], m_zone); #endif if ((u < 60) && (m_grade < 0.33333334f)) // Get fair @@ -257,7 +257,7 @@ bool Weather::UpdateWeather() break; } - sLog->outDetail("Change the weather of zone %u to %s.", m_zone, wthstr); + LOG_DEBUG("server", "Change the weather of zone %u to %s.", m_zone, wthstr); #endif sScriptMgr->OnWeatherChange(this, state, m_grade); return true; diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 24c6f40350..361072d6e7 100644 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -84,8 +84,8 @@ namespace WeatherMgr if (!result) { - sLog->outErrorDb(">> Loaded 0 weather definitions. DB table `game_weather` is empty."); - sLog->outString(); + LOG_ERROR("sql.sql", ">> Loaded 0 weather definitions. DB table `game_weather` is empty."); + LOG_INFO("server", " "); return; } @@ -106,19 +106,19 @@ namespace WeatherMgr if (wzc.data[season].rainChance > 100) { wzc.data[season].rainChance = 25; - sLog->outErrorDb("Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season); + LOG_ERROR("sql.sql", "Weather for zone %u season %u has wrong rain chance > 100%%", zone_id, season); } if (wzc.data[season].snowChance > 100) { wzc.data[season].snowChance = 25; - sLog->outErrorDb("Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season); + LOG_ERROR("sql.sql", "Weather for zone %u season %u has wrong snow chance > 100%%", zone_id, season); } if (wzc.data[season].stormChance > 100) { wzc.data[season].stormChance = 25; - sLog->outErrorDb("Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season); + LOG_ERROR("sql.sql", "Weather for zone %u season %u has wrong storm chance > 100%%", zone_id, season); } } @@ -127,8 +127,8 @@ namespace WeatherMgr ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void SendFineWeatherUpdateToPlayer(Player* player) diff --git a/src/server/game/World/IWorld.h b/src/server/game/World/IWorld.h index 8ea9437db2..a578291839 100644 --- a/src/server/game/World/IWorld.h +++ b/src/server/game/World/IWorld.h @@ -15,6 +15,7 @@ #include #include +class WorldPacket; class WorldSession; class Player; @@ -125,15 +126,6 @@ enum WorldBoolConfigs CONFIG_SHOW_KICK_IN_WORLD, CONFIG_SHOW_MUTE_IN_WORLD, CONFIG_SHOW_BAN_IN_WORLD, - CONFIG_CHATLOG_CHANNEL, - CONFIG_CHATLOG_WHISPER, - CONFIG_CHATLOG_SYSCHAN, - CONFIG_CHATLOG_PARTY, - CONFIG_CHATLOG_RAID, - CONFIG_CHATLOG_GUILD, - CONFIG_CHATLOG_PUBLIC, - CONFIG_CHATLOG_ADDON, - CONFIG_CHATLOG_BGROUND, CONFIG_AUTOBROADCAST, CONFIG_ALLOW_TICKETS, CONFIG_DELETE_CHARACTER_TICKET_TRACE, diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 90ddc1dce7..05d5d9dbd2 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -418,27 +418,24 @@ void World::LoadConfigSettings(bool reload) { if (!sConfigMgr->Reload()) { - sLog->outError("World settings reload fail: can't read settings."); + LOG_ERROR("server", "World settings reload fail: can't read settings."); return; } + + sLog->LoadFromConfig(); } #ifdef ELUNA ///- Initialize Lua Engine if (!reload) { - sLog->outString("Initialize Eluna Lua Engine..."); + LOG_INFO("server", "Initialize Eluna Lua Engine..."); Eluna::Initialize(); } #endif sScriptMgr->OnBeforeConfigLoad(reload); - // Reload log levels and filters - // doing it again to allow sScriptMgr - // to change log confs at start - sLog->ReloadConfig(); - ///- Read the player limit and the Message of the day from the config file if (!reload) { @@ -461,27 +458,27 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_HEALTH] = sConfigMgr->GetOption("Rate.Health", 1); if (rate_values[RATE_HEALTH] < 0) { - sLog->outError("Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); + LOG_ERROR("server", "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]); rate_values[RATE_HEALTH] = 1; } rate_values[RATE_POWER_MANA] = sConfigMgr->GetOption("Rate.Mana", 1); if (rate_values[RATE_POWER_MANA] < 0) { - sLog->outError("Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); + LOG_ERROR("server", "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]); rate_values[RATE_POWER_MANA] = 1; } rate_values[RATE_POWER_RAGE_INCOME] = sConfigMgr->GetOption("Rate.Rage.Income", 1); rate_values[RATE_POWER_RAGE_LOSS] = sConfigMgr->GetOption("Rate.Rage.Loss", 1); if (rate_values[RATE_POWER_RAGE_LOSS] < 0) { - sLog->outError("Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); + LOG_ERROR("server", "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]); rate_values[RATE_POWER_RAGE_LOSS] = 1; } rate_values[RATE_POWER_RUNICPOWER_INCOME] = sConfigMgr->GetOption("Rate.RunicPower.Income", 1); rate_values[RATE_POWER_RUNICPOWER_LOSS] = sConfigMgr->GetOption("Rate.RunicPower.Loss", 1); if (rate_values[RATE_POWER_RUNICPOWER_LOSS] < 0) { - sLog->outError("Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); + LOG_ERROR("server", "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]); rate_values[RATE_POWER_RUNICPOWER_LOSS] = 1; } rate_values[RATE_POWER_FOCUS] = sConfigMgr->GetOption("Rate.Focus", 1.0f); @@ -528,7 +525,7 @@ void World::LoadConfigSettings(bool reload) if (rate_values[RATE_REPAIRCOST] < 0.0f) { - sLog->outError("Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); + LOG_ERROR("server", "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]); rate_values[RATE_REPAIRCOST] = 0.0f; } rate_values[RATE_REPUTATION_GAIN] = sConfigMgr->GetOption("Rate.Reputation.Gain", 1.0f); @@ -564,13 +561,13 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TALENT] = sConfigMgr->GetOption("Rate.Talent", 1.0f); if (rate_values[RATE_TALENT] < 0.0f) { - sLog->outError("Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); + LOG_ERROR("server", "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]); rate_values[RATE_TALENT] = 1.0f; } rate_values[RATE_MOVESPEED] = sConfigMgr->GetOption("Rate.MoveSpeed", 1.0f); if (rate_values[RATE_MOVESPEED] < 0) { - sLog->outError("Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); + LOG_ERROR("server", "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]); rate_values[RATE_MOVESPEED] = 1.0f; } for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED]; @@ -579,12 +576,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = sConfigMgr->GetOption("TargetPosRecalculateRange", 1.5f); if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE) { - sLog->outError("TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); + LOG_ERROR("server", "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE; } else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE) { - sLog->outError("TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", + LOG_ERROR("server", "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE); rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE; } @@ -592,12 +589,12 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = sConfigMgr->GetOption("DurabilityLoss.OnDeath", 10.0f); if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f) { - sLog->outError("DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + LOG_ERROR("server", "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f) { - sLog->outError("DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); + LOG_ERROR("server", "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]); rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f; @@ -605,25 +602,25 @@ void World::LoadConfigSettings(bool reload) rate_values[RATE_DURABILITY_LOSS_DAMAGE] = sConfigMgr->GetOption("DurabilityLossChance.Damage", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f) { - sLog->outError("DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); + LOG_ERROR("server", "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]); rate_values[RATE_DURABILITY_LOSS_DAMAGE] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_ABSORB] = sConfigMgr->GetOption("DurabilityLossChance.Absorb", 0.5f); if (rate_values[RATE_DURABILITY_LOSS_ABSORB] < 0.0f) { - sLog->outError("DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); + LOG_ERROR("server", "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]); rate_values[RATE_DURABILITY_LOSS_ABSORB] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_PARRY] = sConfigMgr->GetOption("DurabilityLossChance.Parry", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_PARRY] < 0.0f) { - sLog->outError("DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); + LOG_ERROR("server", "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]); rate_values[RATE_DURABILITY_LOSS_PARRY] = 0.0f; } rate_values[RATE_DURABILITY_LOSS_BLOCK] = sConfigMgr->GetOption("DurabilityLossChance.Block", 0.05f); if (rate_values[RATE_DURABILITY_LOSS_BLOCK] < 0.0f) { - sLog->outError("DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); + LOG_ERROR("server", "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f; } @@ -634,7 +631,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_COMPRESSION] = sConfigMgr->GetOption("Compression", 1); if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9) { - sLog->outError("Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); + LOG_ERROR("server", "Compression level (%u) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]); m_int_configs[CONFIG_COMPRESSION] = 1; } m_bool_configs[CONFIG_ADDON_CHANNEL] = sConfigMgr->GetOption("AddonChannel", true); @@ -658,14 +655,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = sConfigMgr->GetOption("PlayerSave.Stats.MinLevel", 0); if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL) { - sLog->outError("PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); + LOG_ERROR("server", "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]); m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0; } m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = sConfigMgr->GetOption("MapUpdateInterval", 100); if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY) { - sLog->outError("MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); + LOG_ERROR("server", "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY); m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY; } if (reload) @@ -677,7 +674,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetOption("WorldServerPort", 8085); if (val != m_int_configs[CONFIG_PORT_WORLD]) - sLog->outError("WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); + LOG_ERROR("server", "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]); } else m_int_configs[CONFIG_PORT_WORLD] = sConfigMgr->GetOption("WorldServerPort", 8085); @@ -697,7 +694,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetOption("GameType", 0); if (val != m_int_configs[CONFIG_GAME_TYPE]) - sLog->outError("GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); + LOG_ERROR("server", "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]); } else m_int_configs[CONFIG_GAME_TYPE] = sConfigMgr->GetOption("GameType", 0); @@ -706,7 +703,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetOption("RealmZone", REALM_ZONE_DEVELOPMENT); if (val != m_int_configs[CONFIG_REALM_ZONE]) - sLog->outError("RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); + LOG_ERROR("server", "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]); } else m_int_configs[CONFIG_REALM_ZONE] = sConfigMgr->GetOption("RealmZone", REALM_ZONE_DEVELOPMENT); @@ -732,21 +729,21 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PLAYER_NAME] = sConfigMgr->GetOption ("MinPlayerName", 2); if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME) { - sLog->outError("MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); + LOG_ERROR("server", "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME); m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2; } m_int_configs[CONFIG_MIN_CHARTER_NAME] = sConfigMgr->GetOption ("MinCharterName", 2); if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME) { - sLog->outError("MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); + LOG_ERROR("server", "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME); m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2; } m_int_configs[CONFIG_MIN_PET_NAME] = sConfigMgr->GetOption ("MinPetName", 2); if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME) { - sLog->outError("MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); + LOG_ERROR("server", "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME); m_int_configs[CONFIG_MIN_PET_NAME] = 2; } @@ -765,7 +762,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_REALM] = sConfigMgr->GetOption("CharactersPerRealm", 10); if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10) { - sLog->outError("CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + LOG_ERROR("server", "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_REALM] = 10; } @@ -773,14 +770,14 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = sConfigMgr->GetOption("CharactersPerAccount", 50); if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM]) { - sLog->outError("CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); + LOG_ERROR("server", "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM]; } m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = sConfigMgr->GetOption("HeroicCharactersPerRealm", 1); if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10) { - sLog->outError("HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); + LOG_ERROR("server", "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]); m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1; } @@ -789,7 +786,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_SKIP_CINEMATICS] = sConfigMgr->GetOption("SkipCinematics", 0); if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2) { - sLog->outError("SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); + LOG_ERROR("server", "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]); m_int_configs[CONFIG_SKIP_CINEMATICS] = 0; } @@ -797,14 +794,14 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetOption("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) - sLog->outError("MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + LOG_ERROR("server", "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); } else m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = sConfigMgr->GetOption("MaxPlayerLevel", DEFAULT_MAX_LEVEL); if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL) { - sLog->outError("MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); + LOG_ERROR("server", "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL; } @@ -813,25 +810,25 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_LEVEL] = sConfigMgr->GetOption("StartPlayerLevel", 1); if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1) { - sLog->outError("StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + LOG_ERROR("server", "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1; } else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError("StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); + LOG_ERROR("server", "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = sConfigMgr->GetOption("StartHeroicPlayerLevel", 55); if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1) { - sLog->outError("StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", + LOG_ERROR("server", "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55; } else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError("StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", + LOG_ERROR("server", "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]); m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL]; } @@ -839,12 +836,12 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_PLAYER_MONEY] = sConfigMgr->GetOption("StartPlayerMoney", 0); if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0) { - sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); + LOG_ERROR("server", "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0); m_int_configs[CONFIG_START_PLAYER_MONEY] = 0; } else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT) { - sLog->outError("StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", + LOG_ERROR("server", "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT); m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT; } @@ -852,20 +849,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_HONOR_POINTS] = sConfigMgr->GetOption("MaxHonorPoints", 75000); if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0) { - sLog->outError("MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); + LOG_ERROR("server", "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0; } m_int_configs[CONFIG_START_HONOR_POINTS] = sConfigMgr->GetOption("StartHonorPoints", 0); if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0) { - sLog->outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + LOG_ERROR("server", "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0); m_int_configs[CONFIG_START_HONOR_POINTS] = 0; } else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS]) { - sLog->outError("StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", + LOG_ERROR("server", "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.", m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]); m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS]; } @@ -873,20 +870,20 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_ARENA_POINTS] = sConfigMgr->GetOption("MaxArenaPoints", 10000); if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0) { - sLog->outError("MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); + LOG_ERROR("server", "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0; } m_int_configs[CONFIG_START_ARENA_POINTS] = sConfigMgr->GetOption("StartArenaPoints", 0); if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0) { - sLog->outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + LOG_ERROR("server", "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0); m_int_configs[CONFIG_START_ARENA_POINTS] = 0; } else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS]) { - sLog->outError("StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", + LOG_ERROR("server", "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.", m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]); m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS]; } @@ -894,7 +891,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = sConfigMgr->GetOption("RecruitAFriend.MaxLevel", 60); if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL]) { - sLog->outError("RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", + LOG_ERROR("server", "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.", m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 60); m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = 60; } @@ -916,7 +913,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MIN_PETITION_SIGNS] = sConfigMgr->GetOption("MinPetitionSigns", 9); if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 9) { - sLog->outError("MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); + LOG_ERROR("server", "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]); m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 9; } @@ -931,13 +928,13 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_START_GM_LEVEL] = sConfigMgr->GetOption("GM.StartLevel", 1); if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL]) { - sLog->outError("GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", + LOG_ERROR("server", "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]); m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL]; } else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL) { - sLog->outError("GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); + LOG_ERROR("server", "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL); m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL; } m_bool_configs[CONFIG_ALLOW_GM_GROUP] = sConfigMgr->GetOption("GM.AllowInvite", false); @@ -952,7 +949,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_UPTIME_UPDATE] = sConfigMgr->GetOption("UpdateUptimeInterval", 10); if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0) { - sLog->outError("UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); + LOG_ERROR("server", "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]); m_int_configs[CONFIG_UPTIME_UPDATE] = 1; } @@ -966,7 +963,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = sConfigMgr->GetOption("LogDB.Opt.ClearInterval", 10); if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0) { - sLog->outError("LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); + LOG_ERROR("server", "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10; } if (reload) @@ -975,7 +972,7 @@ void World::LoadConfigSettings(bool reload) m_timers[WUPDATE_CLEANDB].Reset(); } m_int_configs[CONFIG_LOGDB_CLEARTIME] = sConfigMgr->GetOption("LogDB.Opt.ClearTime", 1209600); // 14 days default - sLog->outString("Will clear `logs` table of entries older than %i seconds every %u minutes.", + LOG_INFO("server", "Will clear `logs` table of entries older than %i seconds every %u minutes.", m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]); m_int_configs[CONFIG_TELEPORT_TIMEOUT_NEAR] = sConfigMgr->GetOption("TeleportTimeoutNear", 25); // pussywizard @@ -1006,7 +1003,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = sConfigMgr->GetOption("MaxOverspeedPings", 2); if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2) { - sLog->outError("MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); + LOG_ERROR("server", "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]); m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2; } @@ -1021,7 +1018,7 @@ void World::LoadConfigSettings(bool reload) { uint32 val = sConfigMgr->GetOption("Expansion", 2); if (val != m_int_configs[CONFIG_EXPANSION]) - sLog->outError("Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); + LOG_ERROR("server", "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]); } else m_int_configs[CONFIG_EXPANSION] = sConfigMgr->GetOption("Expansion", 2); @@ -1057,21 +1054,21 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = sConfigMgr->GetOption("Battleground.Random.ResetHour", 6); if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23) { - sLog->outError("Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); + LOG_ERROR("server", "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]); m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6; } m_int_configs[CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR] = sConfigMgr->GetOption("Calendar.DeleteOldEventsHour", 6); if (m_int_configs[CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR] > 23) { - sLog->outError("Calendar.DeleteOldEventsHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR]); + LOG_ERROR("server", "Calendar.DeleteOldEventsHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR]); m_int_configs[CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR] = 6; } m_int_configs[CONFIG_GUILD_RESET_HOUR] = sConfigMgr->GetOption("Guild.ResetHour", 6); if (m_int_configs[CONFIG_GUILD_RESET_HOUR] > 23) { - sLog->outError("Guild.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_GUILD_RESET_HOUR]); + LOG_ERROR("server", "Guild.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_GUILD_RESET_HOUR]); m_int_configs[CONFIG_GUILD_RESET_HOUR] = 6; } @@ -1132,24 +1129,24 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK] = sConfigMgr->GetOption("Battleground.ReportAFK", 3); if (m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK] < 1) { - sLog->outError("Battleground.ReportAFK (%d) must be >0. Using 3 instead.", m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK]); + LOG_ERROR("server", "Battleground.ReportAFK (%d) must be >0. Using 3 instead.", m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK]); m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK] = 3; } else if (m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK] > 9) { - sLog->outError("Battleground.ReportAFK (%d) must be <10. Using 3 instead.", m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK]); + LOG_ERROR("server", "Battleground.ReportAFK (%d) must be <10. Using 3 instead.", m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK]); m_int_configs[CONFIG_BATTLEGROUND_REPORT_AFK] = 3; } m_int_configs[CONFIG_BATTLEGROUND_PLAYER_RESPAWN] = sConfigMgr->GetOption("Battleground.PlayerRespawn", 30); if (m_int_configs[CONFIG_BATTLEGROUND_PLAYER_RESPAWN] < 3) { - sLog->outError("Battleground.PlayerRespawn (%i) must be >2. Using 30 instead.", m_int_configs[CONFIG_BATTLEGROUND_PLAYER_RESPAWN]); + LOG_ERROR("server", "Battleground.PlayerRespawn (%i) must be >2. Using 30 instead.", m_int_configs[CONFIG_BATTLEGROUND_PLAYER_RESPAWN]); m_int_configs[CONFIG_BATTLEGROUND_PLAYER_RESPAWN] = 30; } m_int_configs[CONFIG_BATTLEGROUND_BUFF_RESPAWN] = sConfigMgr->GetOption("Battleground.BuffRespawn", 180); if (m_int_configs[CONFIG_BATTLEGROUND_BUFF_RESPAWN] < 1) { - sLog->outError("Battleground.BuffRespawn (%i) must be >0. Using 180 instead.", m_int_configs[CONFIG_BATTLEGROUND_BUFF_RESPAWN]); + LOG_ERROR("server", "Battleground.BuffRespawn (%i) must be >0. Using 180 instead.", m_int_configs[CONFIG_BATTLEGROUND_BUFF_RESPAWN]); m_int_configs[CONFIG_BATTLEGROUND_BUFF_RESPAWN] = 180; } @@ -1177,10 +1174,10 @@ void World::LoadConfigSettings(bool reload) if (clientCacheId > 0) { m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId; - sLog->outString("Client cache version set to: %u", clientCacheId); + LOG_INFO("server", "Client cache version set to: %u", clientCacheId); } else - sLog->outError("ClientCacheVersion can't be negative %d, ignored.", clientCacheId); + LOG_ERROR("server", "ClientCacheVersion can't be negative %d, ignored.", clientCacheId); } m_int_configs[CONFIG_INSTANT_LOGOUT] = sConfigMgr->GetOption("InstantLogout", SEC_MODERATOR); @@ -1196,12 +1193,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceOnContinents = sConfigMgr->GetOption("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE); if (m_MaxVisibleDistanceOnContinents < 45 * sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError("Visibility.Distance.Continents can't be less max aggro radius %f", 45 * sWorld->getRate(RATE_CREATURE_AGGRO)); + LOG_ERROR("server", "Visibility.Distance.Continents can't be less max aggro radius %f", 45 * sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceOnContinents = 45 * sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE) { - sLog->outError("Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); + LOG_ERROR("server", "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE; } @@ -1209,12 +1206,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInInstances = sConfigMgr->GetOption("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE); if (m_MaxVisibleDistanceInInstances < 45 * sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError("Visibility.Distance.Instances can't be less max aggro radius %f", 45 * sWorld->getRate(RATE_CREATURE_AGGRO)); + LOG_ERROR("server", "Visibility.Distance.Instances can't be less max aggro radius %f", 45 * sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInInstances = 45 * sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE) { - sLog->outError("Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); + LOG_ERROR("server", "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE; } @@ -1222,12 +1219,12 @@ void World::LoadConfigSettings(bool reload) m_MaxVisibleDistanceInBGArenas = sConfigMgr->GetOption("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS); if (m_MaxVisibleDistanceInBGArenas < 45 * sWorld->getRate(RATE_CREATURE_AGGRO)) { - sLog->outError("Visibility.Distance.BGArenas can't be less max aggro radius %f", 45 * sWorld->getRate(RATE_CREATURE_AGGRO)); + LOG_ERROR("server", "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45 * sWorld->getRate(RATE_CREATURE_AGGRO)); m_MaxVisibleDistanceInBGArenas = 45 * sWorld->getRate(RATE_CREATURE_AGGRO); } else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE) { - sLog->outError("Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); + LOG_ERROR("server", "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE); m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE; } @@ -1261,12 +1258,12 @@ void World::LoadConfigSettings(bool reload) if (reload) { if (dataPath != m_dataPath) - sLog->outError("DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); + LOG_ERROR("server", "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str()); } else { m_dataPath = dataPath; - sLog->outString("Using DataDir %s", m_dataPath.c_str()); + LOG_INFO("server", "Using DataDir %s", m_dataPath.c_str()); } m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = sConfigMgr->GetOption("vmap.enableIndoorCheck", 0); @@ -1276,11 +1273,11 @@ void World::LoadConfigSettings(bool reload) bool enablePetLOS = sConfigMgr->GetOption("vmap.petLOS", true); if (!enableHeight) - sLog->outError("VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); + LOG_ERROR("server", "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support."); VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS); VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight); - sLog->outString("WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS); + LOG_INFO("server", "WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS); m_bool_configs[CONFIG_PET_LOS] = sConfigMgr->GetOption("vmap.petLOS", true); m_bool_configs[CONFIG_START_ALL_SPELLS] = sConfigMgr->GetOption("PlayerStart.CustomSpells", false); @@ -1305,17 +1302,6 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_NUMTHREADS] = sConfigMgr->GetOption("MapUpdate.Threads", 1); m_int_configs[CONFIG_MAX_RESULTS_LOOKUP_COMMANDS] = sConfigMgr->GetOption("Command.LookupMaxResults", 0); - // chat logging - m_bool_configs[CONFIG_CHATLOG_CHANNEL] = sConfigMgr->GetOption("ChatLogs.Channel", false); - m_bool_configs[CONFIG_CHATLOG_WHISPER] = sConfigMgr->GetOption("ChatLogs.Whisper", false); - m_bool_configs[CONFIG_CHATLOG_SYSCHAN] = sConfigMgr->GetOption("ChatLogs.SysChan", false); - m_bool_configs[CONFIG_CHATLOG_PARTY] = sConfigMgr->GetOption("ChatLogs.Party", false); - m_bool_configs[CONFIG_CHATLOG_RAID] = sConfigMgr->GetOption("ChatLogs.Raid", false); - m_bool_configs[CONFIG_CHATLOG_GUILD] = sConfigMgr->GetOption("ChatLogs.Guild", false); - m_bool_configs[CONFIG_CHATLOG_PUBLIC] = sConfigMgr->GetOption("ChatLogs.Public", false); - m_bool_configs[CONFIG_CHATLOG_ADDON] = sConfigMgr->GetOption("ChatLogs.Addon", false); - m_bool_configs[CONFIG_CHATLOG_BGROUND] = sConfigMgr->GetOption("ChatLogs.BattleGround", false); - // Warden m_bool_configs[CONFIG_WARDEN_ENABLED] = sConfigMgr->GetOption("Warden.Enabled", true); m_int_configs[CONFIG_WARDEN_NUM_MEM_CHECKS] = sConfigMgr->GetOption("Warden.NumMemChecks", 3); @@ -1441,7 +1427,7 @@ void World::SetInitialWorldSettings() ///- Initialize detour memory management dtAllocSetCustom(dtCustomAlloc, dtCustomFree); - sLog->outString("Initializing Scripts..."); + LOG_INFO("server", "Initializing Scripts..."); sScriptMgr->Initialize(); ///- Initialize VMapManager function pointers (to untangle game/collision circular deps) @@ -1483,8 +1469,8 @@ void World::SetInitialWorldSettings() sGameEventMgr->Initialize(); ///- Loading strings. Getting no records means core load has to be canceled because no error message can be output. - sLog->outString(); - sLog->outString("Loading acore strings..."); + LOG_INFO("server", " "); + LOG_INFO("server", "Loading acore strings..."); if (!sObjectMgr->LoadAcoreStrings()) exit(1); // Error message displayed in function already @@ -1511,53 +1497,53 @@ void World::SetInitialWorldSettings() sScriptMgr->OnLoadCustomDatabaseTable(); ///- Load the DBC files - sLog->outString("Initialize data stores..."); + LOG_INFO("server", "Initialize data stores..."); LoadDBCStores(m_dataPath); DetectDBCLang(); - sLog->outString("Loading Game Graveyard..."); + LOG_INFO("server", "Loading Game Graveyard..."); sGraveyard->LoadGraveyardFromDB(); - sLog->outString("Loading spell dbc data corrections..."); + LOG_INFO("server", "Loading spell dbc data corrections..."); sSpellMgr->LoadDbcDataCorrections(); - sLog->outString("Loading SpellInfo store..."); + LOG_INFO("server", "Loading SpellInfo store..."); sSpellMgr->LoadSpellInfoStore(); - sLog->outString("Loading Spell Rank Data..."); + LOG_INFO("server", "Loading Spell Rank Data..."); sSpellMgr->LoadSpellRanks(); - sLog->outString("Loading Spell Specific And Aura State..."); + LOG_INFO("server", "Loading Spell Specific And Aura State..."); sSpellMgr->LoadSpellSpecificAndAuraState(); - sLog->outString("Loading SkillLineAbilityMultiMap Data..."); + LOG_INFO("server", "Loading SkillLineAbilityMultiMap Data..."); sSpellMgr->LoadSkillLineAbilityMap(); - sLog->outString("Loading spell custom attributes..."); + LOG_INFO("server", "Loading spell custom attributes..."); sSpellMgr->LoadSpellCustomAttr(); - sLog->outString("Loading GameObject models..."); + LOG_INFO("server", "Loading GameObject models..."); LoadGameObjectModelList(); - sLog->outString("Loading Script Names..."); + LOG_INFO("server", "Loading Script Names..."); sObjectMgr->LoadScriptNames(); - sLog->outString("Loading Instance Template..."); + LOG_INFO("server", "Loading Instance Template..."); sObjectMgr->LoadInstanceTemplate(); // xinef: Global Storage, should be loaded asap - sLog->outString("Load Global Player Data..."); + LOG_INFO("server", "Load Global Player Data..."); sWorld->LoadGlobalPlayerDataStore(); // Must be called before `creature_respawn`/`gameobject_respawn` tables - sLog->outString("Loading instances..."); + LOG_INFO("server", "Loading instances..."); sInstanceSaveMgr->LoadInstances(); - sLog->outString("Loading Broadcast texts..."); + LOG_INFO("server", "Loading Broadcast texts..."); sObjectMgr->LoadBroadcastTexts(); sObjectMgr->LoadBroadcastTextLocales(); - sLog->outString("Loading Localization strings..."); + LOG_INFO("server", "Loading Localization strings..."); uint32 oldMSTime = getMSTime(); sObjectMgr->LoadCreatureLocales(); sObjectMgr->LoadGameObjectLocales(); @@ -1572,344 +1558,344 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadPointOfInterestLocales(); sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts) - sLog->outString(">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); - sLog->outString("Loading Page Texts..."); + LOG_INFO("server", "Loading Page Texts..."); sObjectMgr->LoadPageTexts(); - sLog->outString("Loading Game Object Templates..."); // must be after LoadPageTexts + LOG_INFO("server", "Loading Game Object Templates..."); // must be after LoadPageTexts sObjectMgr->LoadGameObjectTemplate(); - sLog->outString("Loading Game Object template addons..."); + LOG_INFO("server", "Loading Game Object template addons..."); sObjectMgr->LoadGameObjectTemplateAddons(); - sLog->outString("Loading Transport templates..."); + LOG_INFO("server", "Loading Transport templates..."); sTransportMgr->LoadTransportTemplates(); - sLog->outString("Loading Spell Required Data..."); + LOG_INFO("server", "Loading Spell Required Data..."); sSpellMgr->LoadSpellRequired(); - sLog->outString("Loading Spell Group types..."); + LOG_INFO("server", "Loading Spell Group types..."); sSpellMgr->LoadSpellGroups(); - sLog->outString("Loading Spell Learn Skills..."); + LOG_INFO("server", "Loading Spell Learn Skills..."); sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks - sLog->outString("Loading Spell Proc Event conditions..."); + LOG_INFO("server", "Loading Spell Proc Event conditions..."); sSpellMgr->LoadSpellProcEvents(); - sLog->outString("Loading Spell Proc conditions and data..."); + LOG_INFO("server", "Loading Spell Proc conditions and data..."); sSpellMgr->LoadSpellProcs(); - sLog->outString("Loading Spell Bonus Data..."); + LOG_INFO("server", "Loading Spell Bonus Data..."); sSpellMgr->LoadSpellBonusess(); - sLog->outString("Loading Aggro Spells Definitions..."); + LOG_INFO("server", "Loading Aggro Spells Definitions..."); sSpellMgr->LoadSpellThreats(); - sLog->outString("Loading Mixology bonuses..."); + LOG_INFO("server", "Loading Mixology bonuses..."); sSpellMgr->LoadSpellMixology(); - sLog->outString("Loading Spell Group Stack Rules..."); + LOG_INFO("server", "Loading Spell Group Stack Rules..."); sSpellMgr->LoadSpellGroupStackRules(); - sLog->outString("Loading NPC Texts..."); + LOG_INFO("server", "Loading NPC Texts..."); sObjectMgr->LoadGossipText(); - sLog->outString("Loading Enchant Spells Proc datas..."); + LOG_INFO("server", "Loading Enchant Spells Proc datas..."); sSpellMgr->LoadSpellEnchantProcData(); - sLog->outString("Loading Item Random Enchantments Table..."); + LOG_INFO("server", "Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); - sLog->outString("Loading Disables"); + LOG_INFO("server", "Loading Disables"); DisableMgr::LoadDisables(); // must be before loading quests and items - sLog->outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts + LOG_INFO("server", "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts sObjectMgr->LoadItemTemplates(); - sLog->outString("Loading Item set names..."); // must be after LoadItemPrototypes + LOG_INFO("server", "Loading Item set names..."); // must be after LoadItemPrototypes sObjectMgr->LoadItemSetNames(); - sLog->outString("Loading Creature Model Based Info Data..."); + LOG_INFO("server", "Loading Creature Model Based Info Data..."); sObjectMgr->LoadCreatureModelInfo(); - sLog->outString("Loading Creature templates..."); + LOG_INFO("server", "Loading Creature templates..."); sObjectMgr->LoadCreatureTemplates(); - sLog->outString("Loading Equipment templates..."); // must be after LoadCreatureTemplates + LOG_INFO("server", "Loading Equipment templates..."); // must be after LoadCreatureTemplates sObjectMgr->LoadEquipmentTemplates(); - sLog->outString("Loading Creature template addons..."); + LOG_INFO("server", "Loading Creature template addons..."); sObjectMgr->LoadCreatureTemplateAddons(); - sLog->outString("Loading Reputation Reward Rates..."); + LOG_INFO("server", "Loading Reputation Reward Rates..."); sObjectMgr->LoadReputationRewardRate(); - sLog->outString("Loading Creature Reputation OnKill Data..."); + LOG_INFO("server", "Loading Creature Reputation OnKill Data..."); sObjectMgr->LoadReputationOnKill(); - sLog->outString("Loading Reputation Spillover Data..." ); + LOG_INFO("server", "Loading Reputation Spillover Data..." ); sObjectMgr->LoadReputationSpilloverTemplate(); - sLog->outString("Loading Points Of Interest Data..."); + LOG_INFO("server", "Loading Points Of Interest Data..."); sObjectMgr->LoadPointsOfInterest(); - sLog->outString("Loading Creature Base Stats..."); + LOG_INFO("server", "Loading Creature Base Stats..."); sObjectMgr->LoadCreatureClassLevelStats(); - sLog->outString("Loading Creature Data..."); + LOG_INFO("server", "Loading Creature Data..."); sObjectMgr->LoadCreatures(); - sLog->outString("Loading Temporary Summon Data..."); + LOG_INFO("server", "Loading Temporary Summon Data..."); sObjectMgr->LoadTempSummons(); // must be after LoadCreatureTemplates() and LoadGameObjectTemplates() - sLog->outString("Loading pet levelup spells..."); + LOG_INFO("server", "Loading pet levelup spells..."); sSpellMgr->LoadPetLevelupSpellMap(); - sLog->outString("Loading pet default spells additional to levelup spells..."); + LOG_INFO("server", "Loading pet default spells additional to levelup spells..."); sSpellMgr->LoadPetDefaultSpells(); - sLog->outString("Loading Creature Addon Data..."); + LOG_INFO("server", "Loading Creature Addon Data..."); sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures() - sLog->outString("Loading Gameobject Data..."); + LOG_INFO("server", "Loading Gameobject Data..."); sObjectMgr->LoadGameobjects(); - sLog->outString("Loading GameObject Addon Data..."); + LOG_INFO("server", "Loading GameObject Addon Data..."); sObjectMgr->LoadGameObjectAddons(); // must be after LoadGameObjectTemplate() and LoadGameobjects() - sLog->outString("Loading GameObject Quest Items..."); + LOG_INFO("server", "Loading GameObject Quest Items..."); sObjectMgr->LoadGameObjectQuestItems(); - sLog->outString("Loading Creature Quest Items..."); + LOG_INFO("server", "Loading Creature Quest Items..."); sObjectMgr->LoadCreatureQuestItems(); - sLog->outString("Loading Creature Linked Respawn..."); + LOG_INFO("server", "Loading Creature Linked Respawn..."); sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects() - sLog->outString("Loading Weather Data..."); + LOG_INFO("server", "Loading Weather Data..."); WeatherMgr::LoadWeatherData(); - sLog->outString("Loading Quests..."); + LOG_INFO("server", "Loading Quests..."); sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables - sLog->outString("Checking Quest Disables"); + LOG_INFO("server", "Checking Quest Disables"); DisableMgr::CheckQuestDisables(); // must be after loading quests - sLog->outString("Loading Quest POI"); + LOG_INFO("server", "Loading Quest POI"); sObjectMgr->LoadQuestPOI(); - sLog->outString("Loading Quests Starters and Enders..."); + LOG_INFO("server", "Loading Quests Starters and Enders..."); sObjectMgr->LoadQuestStartersAndEnders(); // must be after quest load - sLog->outString("Loading Objects Pooling Data..."); + LOG_INFO("server", "Loading Objects Pooling Data..."); sPoolMgr->LoadFromDB(); - sLog->outString("Loading Game Event Data..."); // must be after loading pools fully + LOG_INFO("server", "Loading Game Event Data..."); // must be after loading pools fully sGameEventMgr->LoadHolidayDates(); // Must be after loading DBC sGameEventMgr->LoadFromDB(); // Must be after loading holiday dates - sLog->outString("Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests + LOG_INFO("server", "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests sObjectMgr->LoadNPCSpellClickSpells(); - sLog->outString("Loading Vehicle Template Accessories..."); + LOG_INFO("server", "Loading Vehicle Template Accessories..."); sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - sLog->outString("Loading Vehicle Accessories..."); + LOG_INFO("server", "Loading Vehicle Accessories..."); sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells() - sLog->outString("Loading SpellArea Data..."); // must be after quest load + LOG_INFO("server", "Loading SpellArea Data..."); // must be after quest load sSpellMgr->LoadSpellAreas(); - sLog->outString("Loading Area Trigger definitions"); + LOG_INFO("server", "Loading Area Trigger definitions"); sObjectMgr->LoadAreaTriggers(); - sLog->outString("Loading Area Trigger Teleport definitions..."); + LOG_INFO("server", "Loading Area Trigger Teleport definitions..."); sObjectMgr->LoadAreaTriggerTeleports(); - sLog->outString("Loading Access Requirements..."); + LOG_INFO("server", "Loading Access Requirements..."); sObjectMgr->LoadAccessRequirements(); // must be after item template load - sLog->outString("Loading Quest Area Triggers..."); + LOG_INFO("server", "Loading Quest Area Triggers..."); sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests - sLog->outString("Loading Tavern Area Triggers..."); + LOG_INFO("server", "Loading Tavern Area Triggers..."); sObjectMgr->LoadTavernAreaTriggers(); - sLog->outString("Loading AreaTrigger script names..."); + LOG_INFO("server", "Loading AreaTrigger script names..."); sObjectMgr->LoadAreaTriggerScripts(); - sLog->outString("Loading LFG entrance positions..."); // Must be after areatriggers + LOG_INFO("server", "Loading LFG entrance positions..."); // Must be after areatriggers sLFGMgr->LoadLFGDungeons(); - sLog->outString("Loading Dungeon boss data..."); + LOG_INFO("server", "Loading Dungeon boss data..."); sObjectMgr->LoadInstanceEncounters(); - sLog->outString("Loading LFG rewards..."); + LOG_INFO("server", "Loading LFG rewards..."); sLFGMgr->LoadRewards(); - sLog->outString("Loading Graveyard-zone links..."); + LOG_INFO("server", "Loading Graveyard-zone links..."); sGraveyard->LoadGraveyardZones(); - sLog->outString("Loading spell pet auras..."); + LOG_INFO("server", "Loading spell pet auras..."); sSpellMgr->LoadSpellPetAuras(); - sLog->outString("Loading Spell target coordinates..."); + LOG_INFO("server", "Loading Spell target coordinates..."); sSpellMgr->LoadSpellTargetPositions(); - sLog->outString("Loading enchant custom attributes..."); + LOG_INFO("server", "Loading enchant custom attributes..."); sSpellMgr->LoadEnchantCustomAttr(); - sLog->outString("Loading linked spells..."); + LOG_INFO("server", "Loading linked spells..."); sSpellMgr->LoadSpellLinked(); - sLog->outString("Loading Player Create Data..."); + LOG_INFO("server", "Loading Player Create Data..."); sObjectMgr->LoadPlayerInfo(); - sLog->outString("Loading Exploration BaseXP Data..."); + LOG_INFO("server", "Loading Exploration BaseXP Data..."); sObjectMgr->LoadExplorationBaseXP(); - sLog->outString("Loading Pet Name Parts..."); + LOG_INFO("server", "Loading Pet Name Parts..."); sObjectMgr->LoadPetNames(); CharacterDatabaseCleaner::CleanDatabase(); - sLog->outString("Loading the max pet number..."); + LOG_INFO("server", "Loading the max pet number..."); sObjectMgr->LoadPetNumber(); - sLog->outString("Loading pet level stats..."); + LOG_INFO("server", "Loading pet level stats..."); sObjectMgr->LoadPetLevelInfo(); - sLog->outString("Loading Player Corpses..."); + LOG_INFO("server", "Loading Player Corpses..."); sObjectMgr->LoadCorpses(); - sLog->outString("Loading Player level dependent mail rewards..."); + LOG_INFO("server", "Loading Player level dependent mail rewards..."); sObjectMgr->LoadMailLevelRewards(); // Loot tables LoadLootTables(); - sLog->outString("Loading Skill Discovery Table..."); + LOG_INFO("server", "Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); - sLog->outString("Loading Skill Extra Item Table..."); + LOG_INFO("server", "Loading Skill Extra Item Table..."); LoadSkillExtraItemTable(); - sLog->outString("Loading Skill Perfection Data Table..."); + LOG_INFO("server", "Loading Skill Perfection Data Table..."); LoadSkillPerfectItemTable(); - sLog->outString("Loading Skill Fishing base level requirements..."); + LOG_INFO("server", "Loading Skill Fishing base level requirements..."); sObjectMgr->LoadFishingBaseSkillLevel(); - sLog->outString("Loading Achievements..."); + LOG_INFO("server", "Loading Achievements..."); sAchievementMgr->LoadAchievementReferenceList(); - sLog->outString("Loading Achievement Criteria Lists..."); + LOG_INFO("server", "Loading Achievement Criteria Lists..."); sAchievementMgr->LoadAchievementCriteriaList(); - sLog->outString("Loading Achievement Criteria Data..."); + LOG_INFO("server", "Loading Achievement Criteria Data..."); sAchievementMgr->LoadAchievementCriteriaData(); - sLog->outString("Loading Achievement Rewards..."); + LOG_INFO("server", "Loading Achievement Rewards..."); sAchievementMgr->LoadRewards(); - sLog->outString("Loading Achievement Reward Locales..."); + LOG_INFO("server", "Loading Achievement Reward Locales..."); sAchievementMgr->LoadRewardLocales(); - sLog->outString("Loading Completed Achievements..."); + LOG_INFO("server", "Loading Completed Achievements..."); sAchievementMgr->LoadCompletedAchievements(); ///- Load dynamic data tables from the database - sLog->outString("Loading Item Auctions..."); + LOG_INFO("server", "Loading Item Auctions..."); sAuctionMgr->LoadAuctionItems(); - sLog->outString("Loading Auctions..."); + LOG_INFO("server", "Loading Auctions..."); sAuctionMgr->LoadAuctions(); sGuildMgr->LoadGuilds(); - sLog->outString("Loading ArenaTeams..."); + LOG_INFO("server", "Loading ArenaTeams..."); sArenaTeamMgr->LoadArenaTeams(); - sLog->outString("Loading Groups..."); + LOG_INFO("server", "Loading Groups..."); sGroupMgr->LoadGroups(); - sLog->outString("Loading ReservedNames..."); + LOG_INFO("server", "Loading ReservedNames..."); sObjectMgr->LoadReservedPlayersNames(); - sLog->outString("Loading GameObjects for quests..."); + LOG_INFO("server", "Loading GameObjects for quests..."); sObjectMgr->LoadGameObjectForQuests(); - sLog->outString("Loading BattleMasters..."); + LOG_INFO("server", "Loading BattleMasters..."); sBattlegroundMgr->LoadBattleMastersEntry(); - sLog->outString("Loading GameTeleports..."); + LOG_INFO("server", "Loading GameTeleports..."); sObjectMgr->LoadGameTele(); - sLog->outString("Loading Gossip menu..."); + LOG_INFO("server", "Loading Gossip menu..."); sObjectMgr->LoadGossipMenu(); - sLog->outString("Loading Gossip menu options..."); + LOG_INFO("server", "Loading Gossip menu options..."); sObjectMgr->LoadGossipMenuItems(); - sLog->outString("Loading Vendors..."); + LOG_INFO("server", "Loading Vendors..."); sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate - sLog->outString("Loading Trainers..."); + LOG_INFO("server", "Loading Trainers..."); sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate - sLog->outString("Loading Waypoints..."); + LOG_INFO("server", "Loading Waypoints..."); sWaypointMgr->Load(); - sLog->outString("Loading SmartAI Waypoints..."); + LOG_INFO("server", "Loading SmartAI Waypoints..."); sSmartWaypointMgr->LoadFromDB(); - sLog->outString("Loading Creature Formations..."); + LOG_INFO("server", "Loading Creature Formations..."); sFormationMgr->LoadCreatureFormations(); - sLog->outString("Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions + LOG_INFO("server", "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions LoadWorldStates(); - sLog->outString("Loading Conditions..."); + LOG_INFO("server", "Loading Conditions..."); sConditionMgr->LoadConditions(); - sLog->outString("Loading faction change achievement pairs..."); + LOG_INFO("server", "Loading faction change achievement pairs..."); sObjectMgr->LoadFactionChangeAchievements(); - sLog->outString("Loading faction change spell pairs..."); + LOG_INFO("server", "Loading faction change spell pairs..."); sObjectMgr->LoadFactionChangeSpells(); - sLog->outString("Loading faction change item pairs..."); + LOG_INFO("server", "Loading faction change item pairs..."); sObjectMgr->LoadFactionChangeItems(); - sLog->outString("Loading faction change reputation pairs..."); + LOG_INFO("server", "Loading faction change reputation pairs..."); sObjectMgr->LoadFactionChangeReputations(); - sLog->outString("Loading faction change title pairs..."); + LOG_INFO("server", "Loading faction change title pairs..."); sObjectMgr->LoadFactionChangeTitles(); - sLog->outString("Loading faction change quest pairs..."); + LOG_INFO("server", "Loading faction change quest pairs..."); sObjectMgr->LoadFactionChangeQuests(); - sLog->outString("Loading GM tickets..."); + LOG_INFO("server", "Loading GM tickets..."); sTicketMgr->LoadTickets(); - sLog->outString("Loading GM surveys..."); + LOG_INFO("server", "Loading GM surveys..."); sTicketMgr->LoadSurveys(); - sLog->outString("Loading client addons..."); + LOG_INFO("server", "Loading client addons..."); AddonMgr::LoadFromDB(); // pussywizard: - sLog->outString("Deleting invalid mail items..."); - sLog->outString(); + LOG_INFO("server", "Deleting invalid mail items..."); + LOG_INFO("server", " "); CharacterDatabase.Query("DELETE mi FROM mail_items mi LEFT JOIN item_instance ii ON mi.item_guid = ii.guid WHERE ii.guid IS NULL"); CharacterDatabase.Query("DELETE mi FROM mail_items mi LEFT JOIN mail m ON mi.mail_id = m.id WHERE m.id IS NULL"); CharacterDatabase.Query("UPDATE mail m LEFT JOIN mail_items mi ON m.id = mi.mail_id SET m.has_items=0 WHERE m.has_items<>0 AND mi.mail_id IS NULL"); ///- Handle outdated emails (delete/return) - sLog->outString("Returning old mails..."); - sLog->outString(); + LOG_INFO("server", "Returning old mails..."); + LOG_INFO("server", " "); sObjectMgr->ReturnOrDeleteOldMails(false); ///- Load AutoBroadCast - sLog->outString("Loading Autobroadcasts..."); + LOG_INFO("server", "Loading Autobroadcasts..."); LoadAutobroadcasts(); ///- Load and initialize scripts @@ -1917,34 +1903,34 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) sObjectMgr->LoadWaypointScripts(); - sLog->outString("Loading spell script names..."); + LOG_INFO("server", "Loading spell script names..."); sObjectMgr->LoadSpellScriptNames(); - sLog->outString("Loading Creature Texts..."); + LOG_INFO("server", "Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); - sLog->outString("Loading Creature Text Locales..."); + LOG_INFO("server", "Loading Creature Text Locales..."); sCreatureTextMgr->LoadCreatureTextLocales(); - sLog->outString("Loading Scripts..."); + LOG_INFO("server", "Loading Scripts..."); sScriptMgr->LoadDatabase(); - sLog->outString("Validating spell scripts..."); + LOG_INFO("server", "Validating spell scripts..."); sObjectMgr->ValidateSpellScripts(); - sLog->outString("Loading SmartAI scripts..."); + LOG_INFO("server", "Loading SmartAI scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); - sLog->outString("Loading Calendar data..."); + LOG_INFO("server", "Loading Calendar data..."); sCalendarMgr->LoadFromDB(); - sLog->outString("Initializing SpellInfo precomputed data..."); // must be called after loading items, professions, spells and pretty much anything - sLog->outString(); + LOG_INFO("server", "Initializing SpellInfo precomputed data..."); // must be called after loading items, professions, spells and pretty much anything + LOG_INFO("server", " "); sObjectMgr->InitializeSpellInfoPrecomputedData(); ///- Initialize game time and timers - sLog->outString("Initialize game time and timers"); - sLog->outString(); + LOG_INFO("server", "Initialize game time and timers"); + LOG_INFO("server", " "); m_gameTime = time(nullptr); m_startTime = m_gameTime; @@ -1974,12 +1960,12 @@ void World::SetInitialWorldSettings() AIRegistry::Initialize(); ///- Initialize MapManager - sLog->outString("Starting Map System"); - sLog->outString(); + LOG_INFO("server", "Starting Map System"); + LOG_INFO("server", " "); sMapMgr->Initialize(); - sLog->outString("Starting Game Event system..."); - sLog->outString(); + LOG_INFO("server", "Starting Game Event system..."); + LOG_INFO("server", " "); uint32 nextGameEvent = sGameEventMgr->StartSystem(); m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event @@ -1989,70 +1975,70 @@ void World::SetInitialWorldSettings() // Delete all custom channels which haven't been used for PreserveCustomChannelDuration days. Channel::CleanOldChannelsInDB(); - sLog->outString("Starting Arena Season..."); - sLog->outString(); + LOG_INFO("server", "Starting Arena Season..."); + LOG_INFO("server", " "); sGameEventMgr->StartArenaSeason(); sTicketMgr->Initialize(); ///- Initialize Battlegrounds - sLog->outString("Starting Battleground System"); + LOG_INFO("server", "Starting Battleground System"); sBattlegroundMgr->CreateInitialBattlegrounds(); sBattlegroundMgr->InitAutomaticArenaPointDistribution(); ///- Initialize outdoor pvp - sLog->outString("Starting Outdoor PvP System"); + LOG_INFO("server", "Starting Outdoor PvP System"); sOutdoorPvPMgr->InitOutdoorPvP(); ///- Initialize Battlefield - sLog->outString("Starting Battlefield System"); + LOG_INFO("server", "Starting Battlefield System"); sBattlefieldMgr->InitBattlefield(); - sLog->outString("Loading Transports..."); + LOG_INFO("server", "Loading Transports..."); sTransportMgr->SpawnContinentTransports(); ///- Initialize Warden - sLog->outString("Loading Warden Checks..." ); + LOG_INFO("server", "Loading Warden Checks..." ); sWardenCheckMgr->LoadWardenChecks(); - sLog->outString("Loading Warden Action Overrides..." ); + LOG_INFO("server", "Loading Warden Action Overrides..." ); sWardenCheckMgr->LoadWardenOverrides(); - sLog->outString("Deleting expired bans..."); + LOG_INFO("server", "Deleting expired bans..."); LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query - sLog->outString("Calculate next daily quest reset time..."); + LOG_INFO("server", "Calculate next daily quest reset time..."); InitDailyQuestResetTime(); - sLog->outString("Calculate next weekly quest reset time..." ); + LOG_INFO("server", "Calculate next weekly quest reset time..." ); InitWeeklyQuestResetTime(); - sLog->outString("Calculate next monthly quest reset time..."); + LOG_INFO("server", "Calculate next monthly quest reset time..."); InitMonthlyQuestResetTime(); - sLog->outString("Calculate random battleground reset time..." ); + LOG_INFO("server", "Calculate random battleground reset time..." ); InitRandomBGResetTime(); - sLog->outString("Calculate deletion of old calendar events time..."); + LOG_INFO("server", "Calculate deletion of old calendar events time..."); InitCalendarOldEventsDeletionTime(); - sLog->outString("Calculate Guild cap reset time..."); - sLog->outString(); + LOG_INFO("server", "Calculate Guild cap reset time..."); + LOG_INFO("server", " "); InitGuildResetTime(); - sLog->outString("Load Petitions..."); + LOG_INFO("server", "Load Petitions..."); sPetitionMgr->LoadPetitions(); - sLog->outString("Load Petition Signs..."); + LOG_INFO("server", "Load Petition Signs..."); sPetitionMgr->LoadSignatures(); - sLog->outString("Load Stored Loot Items..."); + LOG_INFO("server", "Load Stored Loot Items..."); sLootItemStorage->LoadStorageFromDB(); - sLog->outString("Load Channel Rights..."); + LOG_INFO("server", "Load Channel Rights..."); ChannelMgr::LoadChannelRights(); - sLog->outString("Load Channels..."); + LOG_INFO("server", "Load Channels..."); ChannelMgr* mgr = ChannelMgr::forTeam(TEAM_ALLIANCE); mgr->LoadChannels(); mgr = ChannelMgr::forTeam(TEAM_HORDE); @@ -2067,7 +2053,7 @@ void World::SetInitialWorldSettings() if (sWorld->getBoolConfig(CONFIG_PRELOAD_ALL_NON_INSTANCED_MAP_GRIDS)) { - sLog->outString("Loading all grids for all non-instanced maps..."); + LOG_INFO("server", "Loading all grids for all non-instanced maps..."); for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i) { @@ -2079,7 +2065,7 @@ void World::SetInitialWorldSettings() if (map) { - sLog->outString(">> Loading all grids for map %u", map->GetId()); + LOG_INFO("server", ">> Loading all grids for map %u", map->GetId()); map->LoadAllCells(); } } @@ -2087,20 +2073,22 @@ void World::SetInitialWorldSettings() } uint32 startupDuration = GetMSTimeDiffToNow(startupBegin); - sLog->outString(); - sLog->outError("WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); // outError for red color in console - sLog->outString(); + LOG_INFO("server", " "); + LOG_INFO("server", "WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000)); // outError for red color in console + LOG_INFO("server", " "); // possibly enable db logging; avoid massive startup spam by doing it here. if (sConfigMgr->GetOption("EnableLogDB", false)) { - sLog->outString("Enabling database logging..."); - sLog->SetLogDB(true); + LOG_INFO("server", "Enabling database logging..."); + + if (uint32 realmId = sConfigMgr->GetOption("RealmID", 0)) // 0 reserved for auth + sLog->SetRealmId(realmId); } if (sConfigMgr->isDryRun()) { - sLog->outString("AzerothCore dry run completed, terminating."); + LOG_INFO("server", "AzerothCore dry run completed, terminating."); exit(0); } } @@ -2111,7 +2099,7 @@ void World::DetectDBCLang() if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES) { - sLog->outError("Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); + LOG_ERROR("server", "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES); m_lang_confid = LOCALE_enUS; } @@ -2138,14 +2126,14 @@ void World::DetectDBCLang() if (default_locale >= TOTAL_LOCALES) { - sLog->outError("Unable to determine your DBC Locale! (corrupt DBC?)"); + LOG_ERROR("server", "Unable to determine your DBC Locale! (corrupt DBC?)"); exit(1); } m_defaultDbcLocale = LocaleConstant(default_locale); - sLog->outString("Using %s DBC Locale as default. All available DBC locales: %s", localeNames[GetDefaultDbcLocale()], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); - sLog->outString(); + LOG_INFO("server", "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[GetDefaultDbcLocale()], availableLocalsStr.empty() ? "" : availableLocalsStr.c_str()); + LOG_INFO("server", " "); } void World::LoadAutobroadcasts() @@ -2162,7 +2150,7 @@ void World::LoadAutobroadcasts() if (!result) { - sLog->outString(">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for this realm!"); + LOG_INFO("server", ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for this realm!"); return; } @@ -2179,8 +2167,8 @@ void World::LoadAutobroadcasts() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u autobroadcast definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u autobroadcast definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } /// Update the World ! @@ -2193,7 +2181,7 @@ void World::Update(uint32 diff) m_updateTimeSum += diff; if (m_updateTimeSum > m_int_configs[CONFIG_INTERVAL_LOG_UPDATE]) { - sLog->outBasic("Average update time diff: %u. Players online: %u.", avgDiffTracker.getAverage(), (uint32)GetActiveSessionCount()); + LOG_INFO("server", "Average update time diff: %u. Players online: %u.", avgDiffTracker.getAverage(), (uint32)GetActiveSessionCount()); m_updateTimeSum = 0; } } @@ -2251,7 +2239,7 @@ void World::Update(uint32 diff) // so we don't have to do it in every packet that modifies auctions AsyncAuctionListingMgr::SetAuctionListingAllowed(false); { - ACORE_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetLock()); + std::lock_guard guard(AsyncAuctionListingMgr::GetLock()); // pussywizard: handle auctions when the timer has passed if (m_timers[WUPDATE_AUCTIONS].Passed()) @@ -2361,7 +2349,7 @@ void World::Update(uint32 diff) { m_timers[WUPDATE_PINGDB].Reset(); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Ping MySQL to keep connection alive"); + LOG_DEBUG("server", "Ping MySQL to keep connection alive"); #endif CharacterDatabase.KeepAlive(); LoginDatabase.KeepAlive(); @@ -2658,7 +2646,7 @@ void World::ShutdownMsg(bool show, Player* player) SendServerMessage(msgid, str.c_str(), player); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str()); + LOG_DEBUG("server", "Server is %s in %s", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"), str.c_str()); #endif } } @@ -2678,7 +2666,7 @@ void World::ShutdownCancel() SendServerMessage(msgid); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown")); + LOG_DEBUG("server", "Server %s cancelled.", (m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown")); #endif sScriptMgr->OnShutdownCancel(); @@ -2774,7 +2762,7 @@ void World::ProcessCliCommands() while (cliCmdQueue.next(command)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("CLI command under processing..."); + LOG_DEBUG("server", "CLI command under processing..."); #endif zprint = command->m_print; callbackArg = command->m_callbackArg; @@ -2844,7 +2832,7 @@ void World::SendAutoBroadcast() } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("AutoBroadcast: '%s'", msg.c_str()); + LOG_DEBUG("server", "AutoBroadcast: '%s'", msg.c_str()); #endif } @@ -3037,7 +3025,7 @@ void World::ResetWeeklyQuests() void World::ResetMonthlyQuests() { - sLog->outString("Monthly quests reset for all characters."); + LOG_INFO("server", "Monthly quests reset for all characters."); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_STATUS_MONTHLY); CharacterDatabase.Execute(stmt); @@ -3064,7 +3052,7 @@ void World::ResetEventSeasonalQuests(uint16 event_id) void World::ResetRandomBG() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail("Random BG status reset for all characters."); + LOG_DEBUG("server", "Random BG status reset for all characters."); #endif PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_BATTLEGROUND_RANDOM); @@ -3080,7 +3068,7 @@ void World::ResetRandomBG() void World::CalendarDeleteOldEvents() { - sLog->outString("Calendar deletion of old events."); + LOG_INFO("server", "Calendar deletion of old events."); m_NextCalendarOldEventsDeletionTime = time_t(m_NextCalendarOldEventsDeletionTime + DAY); sWorld->setWorldState(WS_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME, uint64(m_NextCalendarOldEventsDeletionTime)); @@ -3089,7 +3077,7 @@ void World::CalendarDeleteOldEvents() void World::ResetGuildCap() { - sLog->outString("Guild Daily Cap reset."); + LOG_INFO("server", "Guild Daily Cap reset."); m_NextGuildReset = GetNextTimeWithDayAndHour(-1, 6); sWorld->setWorldState(WS_GUILD_DAILY_RESET_TIME, uint64(m_NextGuildReset)); @@ -3139,8 +3127,8 @@ void World::LoadWorldStates() if (!result) { - sLog->outString(">> Loaded 0 world states. DB table `worldstates` is empty!"); - sLog->outString(); + LOG_INFO("server", ">> Loaded 0 world states. DB table `worldstates` is empty!"); + LOG_INFO("server", " "); return; } @@ -3153,8 +3141,8 @@ void World::LoadWorldStates() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } // Setting a worldstate will save it to DB @@ -3216,7 +3204,7 @@ void World::LoadGlobalPlayerDataStore() QueryResult result = CharacterDatabase.Query("SELECT guid, account, name, gender, race, class, level FROM characters WHERE deleteDate IS NULL"); if (!result) { - sLog->outString(">> Loaded 0 Players data."); + LOG_INFO("server", ">> Loaded 0 Players data."); return; } @@ -3259,8 +3247,8 @@ void World::LoadGlobalPlayerDataStore() ++count; } while (result->NextRow()); - sLog->outString(">> Loaded %d Players data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - sLog->outString(); + LOG_INFO("server", ">> Loaded %d Players data in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + LOG_INFO("server", " "); } void World::AddGlobalPlayerData(uint32 guid, uint32 accountId, std::string const& name, uint8 gender, uint8 race, uint8 playerClass, uint8 level, uint16 mailCount, uint32 guildId) @@ -3387,7 +3375,7 @@ GlobalPlayerData const* World::GetGlobalPlayerData(uint32 guid) const std::string name = fields[2].GetString(); - sLog->outString("Player %s [GUID: %u] was not found in the global storage, but it was found in the database.", name.c_str(), guid); + LOG_INFO("server", "Player %s [GUID: %u] was not found in the global storage, but it was found in the database.", name.c_str(), guid); sWorld->AddGlobalPlayerData( fields[0].GetUInt32(), /*guid*/ @@ -3404,7 +3392,7 @@ GlobalPlayerData const* World::GetGlobalPlayerData(uint32 guid) const itr = _globalPlayerDataStore.find(guid); if (itr != _globalPlayerDataStore.end()) { - sLog->outString("Player %s [GUID: %u] added to the global storage.", name.c_str(), guid); + LOG_INFO("server", "Player %s [GUID: %u] added to the global storage.", name.c_str(), guid); return &itr->second; } } @@ -3435,7 +3423,7 @@ uint32 World::GetGlobalPlayerGUID(std::string const& name) const uint32 guidLow = fields[0].GetUInt32(); - sLog->outString("Player %s [GUID: %u] was not found in the global storage, but it was found in the database.", name.c_str(), guidLow); + LOG_INFO("server", "Player %s [GUID: %u] was not found in the global storage, but it was found in the database.", name.c_str(), guidLow); sWorld->AddGlobalPlayerData( guidLow, /*guid*/ @@ -3452,7 +3440,7 @@ uint32 World::GetGlobalPlayerGUID(std::string const& name) const itr = _globalPlayerNameStore.find(name); if (itr != _globalPlayerNameStore.end()) { - sLog->outString("Player %s [GUID: %u] added to the global storage.", name.c_str(), guidLow); + LOG_INFO("server", "Player %s [GUID: %u] added to the global storage.", name.c_str(), guidLow); return guidLow; } diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 8684176fac..793edaa873 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -440,7 +440,7 @@ private: std::string m_newCharString; float rate_values[MAX_RATES]; - uint64 m_int_configs[INT_CONFIG_VALUE_COUNT]; + uint32 m_int_configs[INT_CONFIG_VALUE_COUNT]; bool m_bool_configs[BOOL_CONFIG_VALUE_COUNT]; float m_float_configs[FLOAT_CONFIG_VALUE_COUNT]; typedef std::map WorldStatesMap; @@ -465,7 +465,7 @@ private: std::string _realmName; // CLI command holder to be thread safe - ACE_Based::LockedQueue cliCmdQueue; + LockedQueue cliCmdQueue; // next daily quests and random bg reset time time_t m_NextDailyQuestReset; @@ -480,7 +480,7 @@ private: // sessions that are added async void AddSession_(WorldSession* s); - ACE_Based::LockedQueue addSessQueue; + LockedQueue addSessQueue; // used versions std::string m_DBVersion; diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 33ae13e32c..09f12133c4 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -104,7 +104,7 @@ public: handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName); if (handler->GetSession()) { - sLog->outDebug(LOG_FILTER_WARDEN, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", + LOG_DEBUG("warden", "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.", handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(), handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow()); } @@ -272,7 +272,7 @@ public: else { handler->PSendSysMessage("[IP2NATION] Table empty"); - ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "[IP2NATION] Table empty"); + ;//LOG_DEBUG("network", "[IP2NATION] Table empty"); } } else if (param == "off") diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index d3bd83f598..28a5bd20c6 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -417,7 +417,7 @@ public: } else { - sLog->outError("Sending opcode that has unknown type '%s'", type.c_str()); + LOG_ERROR("server", "Sending opcode that has unknown type '%s'", type.c_str()); break; } } @@ -1372,7 +1372,7 @@ public: { Player* player = handler->GetSession()->GetPlayer(); - sLog->outSQLDev("(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); + LOG_INFO("sql.dev", "(@PATH, XX, %.3f, %.3f, %.5f, 0,0, 0,100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); handler->PSendSysMessage("Waypoint SQL written to SQL Developer log"); return true; diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index d04076d40a..a4ab38d7d6 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -109,7 +109,8 @@ public: bool first = true; bool footer = false; - ACORE_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + std::shared_lock lock(*HashMapHolder::GetLock()); + HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 01f176e86f..95408cadba 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -123,7 +123,7 @@ public: if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) { // report to DB errors log as in loading case - sLog->outErrorDb("Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId); + LOG_ERROR("sql.sql", "Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->type, objectInfo->displayId); handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, objectId); handler->SetSentErrorMessage(true); return false; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 944ba22c90..0e976cf784 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1462,7 +1462,7 @@ public: playerTarget = player; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail(handler->GetAcoreString(LANG_ADDITEM), itemId, count); + LOG_DEBUG("server", handler->GetAcoreString(LANG_ADDITEM), itemId, count); #endif ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId); @@ -1566,7 +1566,7 @@ public: playerTarget = player; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail(handler->GetAcoreString(LANG_ADDITEMSET), itemSetId); + LOG_DEBUG("server", handler->GetAcoreString(LANG_ADDITEMSET), itemSetId); #endif bool found = false; @@ -2254,7 +2254,7 @@ public: else { // pussywizard: notify all online GMs - ACORE_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + std::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& m = sObjectAccessor->GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) if (itr->second->GetSession()->GetSecurity()) @@ -2873,7 +2873,7 @@ public: if (!pet->InitStatsForLevel(creatureTarget->getLevel())) { - sLog->outError("InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); + LOG_ERROR("server", "InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); handler->PSendSysMessage("Error 2"); delete pet; return false; diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index ebf1b753c2..ac104fc85d 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -197,7 +197,7 @@ public: target->SetPower(POWER_ENERGY, energy); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDetail(handler->GetAcoreString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY)); + LOG_DEBUG("server", handler->GetAcoreString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY)); #endif return true; @@ -1015,7 +1015,7 @@ public: int32 newmoney = int32(targetMoney) + moneyToAdd; #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, handler->GetAcoreString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney); + LOG_DEBUG("chat.system", handler->GetAcoreString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney); #endif if (newmoney <= 0) { @@ -1052,7 +1052,7 @@ public: } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_CHATSYS, handler->GetAcoreString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney()); + LOG_DEBUG("chat.system", handler->GetAcoreString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney()); #endif return true; diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 299bd9a63e..5c5d17fdf3 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -976,7 +976,7 @@ public: if (dontdel_str) { - //sLog->outError("DEBUG: All 3 params are set"); + //LOG_ERROR("server", "DEBUG: All 3 params are set"); // All 3 params are set // GUID @@ -984,7 +984,7 @@ public: // doNotDEL if (stricmp(dontdel_str, "NODEL") == 0) { - //sLog->outError("DEBUG: doNotDelete = true;"); + //LOG_ERROR("server", "DEBUG: doNotDelete = true;"); doNotDelete = true; } } @@ -993,10 +993,10 @@ public: // Only 2 params - but maybe NODEL is set if (type_str) { - sLog->outError("DEBUG: Only 2 params "); + LOG_ERROR("server", "DEBUG: Only 2 params "); if (stricmp(type_str, "NODEL") == 0) { - //sLog->outError("DEBUG: type_str, NODEL "); + //LOG_ERROR("server", "DEBUG: type_str, NODEL "); doNotDelete = true; type_str = nullptr; } diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 2db52034dc..57a64d1ef8 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -194,7 +194,7 @@ public: static bool HandleReloadBattlegroundTemplate(ChatHandler* handler, char const* /*args*/) { - sLog->outString("Re-Loading Battleground Templates..."); + LOG_INFO("server", "Re-Loading Battleground Templates..."); sBattlegroundMgr->CreateInitialBattlegrounds(); handler->SendGlobalGMSysMessage("DB table `battleground_template` reloaded."); return true; @@ -218,7 +218,7 @@ public: static bool HandleReloadAllLootCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables..."); + LOG_INFO("server", "Re-Loading Loot Tables..."); LoadLootTables(); handler->SendGlobalGMSysMessage("DB tables `*_loot_template` reloaded."); sConditionMgr->LoadConditions(true); @@ -241,7 +241,7 @@ public: HandleReloadQuestPOICommand(handler, "a"); HandleReloadQuestTemplateCommand(handler, "a"); - sLog->outString("Re-Loading Quests Relations..."); + LOG_INFO("server", "Re-Loading Quests Relations..."); sObjectMgr->LoadQuestStartersAndEnders(); handler->SendGlobalGMSysMessage("DB tables `*_queststarter` and `*_questender` reloaded."); return true; @@ -256,7 +256,7 @@ public: return false; } - sLog->outString("Re-Loading Scripts..."); + LOG_INFO("server", "Re-Loading Scripts..."); HandleReloadEventScriptsCommand(handler, "a"); HandleReloadSpellScriptsCommand(handler, "a"); handler->SendGlobalGMSysMessage("DB tables `*_scripts` reloaded."); @@ -318,7 +318,7 @@ public: static bool HandleReloadConfigCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading config settings..."); + LOG_INFO("server", "Re-Loading config settings..."); sWorld->LoadConfigSettings(true); sMapMgr->InitializeVisibilityDistanceInfo(); handler->SendGlobalGMSysMessage("World config settings reloaded."); @@ -327,7 +327,7 @@ public: static bool HandleReloadDungeonAccessCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Dungeon Access Requirement definitions..."); + LOG_INFO("server", "Re-Loading Dungeon Access Requirement definitions..."); sObjectMgr->LoadAccessRequirements(); handler->SendGlobalGMSysMessage("DB tables `dungeon_access_template` AND `dungeon_access_requirements` reloaded."); return true; @@ -335,7 +335,7 @@ public: static bool HandleReloadAchievementCriteriaDataCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Additional Achievement Criteria Data..."); + LOG_INFO("server", "Re-Loading Additional Achievement Criteria Data..."); sAchievementMgr->LoadAchievementCriteriaData(); handler->SendGlobalGMSysMessage("DB table `achievement_criteria_data` reloaded."); return true; @@ -343,7 +343,7 @@ public: static bool HandleReloadAchievementRewardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Achievement Reward Data..."); + LOG_INFO("server", "Re-Loading Achievement Reward Data..."); sAchievementMgr->LoadRewards(); handler->SendGlobalGMSysMessage("DB table `achievement_reward` reloaded."); return true; @@ -351,7 +351,7 @@ public: static bool HandleReloadAreaTriggerTavernCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Tavern Area Triggers..."); + LOG_INFO("server", "Re-Loading Tavern Area Triggers..."); sObjectMgr->LoadTavernAreaTriggers(); handler->SendGlobalGMSysMessage("DB table `areatrigger_tavern` reloaded."); return true; @@ -359,7 +359,7 @@ public: static bool HandleReloadAreaTriggerCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Area Trigger definitions..."); + LOG_INFO("server", "Re-Loading Area Trigger definitions..."); sObjectMgr->LoadAreaTriggers(); handler->SendGlobalGMSysMessage("DB table `areatrigger` reloaded."); return true; @@ -367,7 +367,7 @@ public: static bool HandleReloadAreaTriggerTeleportCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Area Trigger teleport definitions..."); + LOG_INFO("server", "Re-Loading Area Trigger teleport definitions..."); sObjectMgr->LoadAreaTriggerTeleports(); handler->SendGlobalGMSysMessage("DB table `areatrigger_teleport` reloaded."); return true; @@ -375,7 +375,7 @@ public: static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Autobroadcasts..."); + LOG_INFO("server", "Re-Loading Autobroadcasts..."); sWorld->LoadAutobroadcasts(); handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded."); return true; @@ -383,7 +383,7 @@ public: static bool HandleReloadBroadcastTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Broadcast texts..."); + LOG_INFO("server", "Re-Loading Broadcast texts..."); sObjectMgr->LoadBroadcastTexts(); sObjectMgr->LoadBroadcastTextLocales(); handler->SendGlobalGMSysMessage("DB table `broadcast_text` reloaded."); @@ -399,7 +399,7 @@ public: static bool HandleReloadOnKillReputationCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading creature award reputation definitions..."); + LOG_INFO("server", "Re-Loading creature award reputation definitions..."); sObjectMgr->LoadReputationOnKill(); handler->SendGlobalGMSysMessage("DB table `creature_onkill_reputation` reloaded."); return true; @@ -433,7 +433,7 @@ public: continue; } - sLog->outString("Reloading creature template entry %u", entry); + LOG_INFO("server", "Reloading creature template entry %u", entry); Field* fields = result->Fetch(); @@ -447,7 +447,7 @@ public: static bool HandleReloadCreatureQuestStarterCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Quests Relations... (`creature_queststarter`)"); + LOG_INFO("server", "Loading Quests Relations... (`creature_queststarter`)"); sObjectMgr->LoadCreatureQuestStarters(); handler->SendGlobalGMSysMessage("DB table `creature_queststarter` reloaded."); return true; @@ -455,7 +455,7 @@ public: static bool HandleReloadLinkedRespawnCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Linked Respawns... (`creature_linked_respawn`)"); + LOG_INFO("server", "Loading Linked Respawns... (`creature_linked_respawn`)"); sObjectMgr->LoadLinkedRespawn(); handler->SendGlobalGMSysMessage("DB table `creature_linked_respawn` (creature linked respawns) reloaded."); return true; @@ -463,7 +463,7 @@ public: static bool HandleReloadCreatureQuestEnderCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Quests Relations... (`creature_questender`)"); + LOG_INFO("server", "Loading Quests Relations... (`creature_questender`)"); sObjectMgr->LoadCreatureQuestEnders(); handler->SendGlobalGMSysMessage("DB table `creature_questender` reloaded."); return true; @@ -471,7 +471,7 @@ public: static bool HandleReloadGossipMenuCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `gossip_menu` Table!"); + LOG_INFO("server", "Re-Loading `gossip_menu` Table!"); sObjectMgr->LoadGossipMenu(); handler->SendGlobalGMSysMessage("DB table `gossip_menu` reloaded."); sConditionMgr->LoadConditions(true); @@ -480,7 +480,7 @@ public: static bool HandleReloadGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `gossip_menu_option` Table!"); + LOG_INFO("server", "Re-Loading `gossip_menu_option` Table!"); sObjectMgr->LoadGossipMenuItems(); handler->SendGlobalGMSysMessage("DB table `gossip_menu_option` reloaded."); sConditionMgr->LoadConditions(true); @@ -489,7 +489,7 @@ public: static bool HandleReloadGOQuestStarterCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Quests Relations... (`gameobject_queststarter`)"); + LOG_INFO("server", "Loading Quests Relations... (`gameobject_queststarter`)"); sObjectMgr->LoadGameobjectQuestStarters(); handler->SendGlobalGMSysMessage("DB table `gameobject_queststarter` reloaded."); return true; @@ -497,7 +497,7 @@ public: static bool HandleReloadGOQuestEnderCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading Quests Relations... (`gameobject_questender`)"); + LOG_INFO("server", "Loading Quests Relations... (`gameobject_questender`)"); sObjectMgr->LoadGameobjectQuestEnders(); handler->SendGlobalGMSysMessage("DB table `gameobject_questender` reloaded."); return true; @@ -505,7 +505,7 @@ public: static bool HandleReloadQuestAreaTriggersCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Quest Area Triggers..."); + LOG_INFO("server", "Re-Loading Quest Area Triggers..."); sObjectMgr->LoadQuestAreaTriggers(); handler->SendGlobalGMSysMessage("DB table `areatrigger_involvedrelation` (quest area triggers) reloaded."); return true; @@ -513,12 +513,12 @@ public: static bool HandleReloadQuestTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Quest Templates..."); + LOG_INFO("server", "Re-Loading Quest Templates..."); sObjectMgr->LoadQuests(); handler->SendGlobalGMSysMessage("DB table `quest_template` (quest definitions) reloaded."); /// dependent also from `gameobject` but this table not reloaded anyway - sLog->outString("Re-Loading GameObjects for quests..."); + LOG_INFO("server", "Re-Loading GameObjects for quests..."); sObjectMgr->LoadGameObjectForQuests(); handler->SendGlobalGMSysMessage("Data GameObjects for quests reloaded."); return true; @@ -526,7 +526,7 @@ public: static bool HandleReloadLootTemplatesCreatureCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`creature_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`creature_loot_template`)"); LoadLootTemplates_Creature(); LootTemplates_Creature.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `creature_loot_template` reloaded."); @@ -536,7 +536,7 @@ public: static bool HandleReloadLootTemplatesDisenchantCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`disenchant_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`disenchant_loot_template`)"); LoadLootTemplates_Disenchant(); LootTemplates_Disenchant.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `disenchant_loot_template` reloaded."); @@ -546,7 +546,7 @@ public: static bool HandleReloadLootTemplatesFishingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`fishing_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`fishing_loot_template`)"); LoadLootTemplates_Fishing(); LootTemplates_Fishing.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `fishing_loot_template` reloaded."); @@ -556,7 +556,7 @@ public: static bool HandleReloadLootTemplatesGameobjectCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`gameobject_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`gameobject_loot_template`)"); LoadLootTemplates_Gameobject(); LootTemplates_Gameobject.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `gameobject_loot_template` reloaded."); @@ -566,7 +566,7 @@ public: static bool HandleReloadLootTemplatesItemCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`item_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`item_loot_template`)"); LoadLootTemplates_Item(); LootTemplates_Item.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `item_loot_template` reloaded."); @@ -576,7 +576,7 @@ public: static bool HandleReloadLootTemplatesMillingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`milling_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`milling_loot_template`)"); LoadLootTemplates_Milling(); LootTemplates_Milling.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `milling_loot_template` reloaded."); @@ -586,7 +586,7 @@ public: static bool HandleReloadLootTemplatesPickpocketingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`pickpocketing_loot_template`)"); LoadLootTemplates_Pickpocketing(); LootTemplates_Pickpocketing.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `pickpocketing_loot_template` reloaded."); @@ -596,7 +596,7 @@ public: static bool HandleReloadLootTemplatesProspectingCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`prospecting_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`prospecting_loot_template`)"); LoadLootTemplates_Prospecting(); LootTemplates_Prospecting.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `prospecting_loot_template` reloaded."); @@ -606,7 +606,7 @@ public: static bool HandleReloadLootTemplatesMailCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`mail_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`mail_loot_template`)"); LoadLootTemplates_Mail(); LootTemplates_Mail.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `mail_loot_template` reloaded."); @@ -616,7 +616,7 @@ public: static bool HandleReloadLootTemplatesReferenceCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`reference_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`reference_loot_template`)"); LoadLootTemplates_Reference(); handler->SendGlobalGMSysMessage("DB table `reference_loot_template` reloaded."); sConditionMgr->LoadConditions(true); @@ -625,7 +625,7 @@ public: static bool HandleReloadLootTemplatesSkinningCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`skinning_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`skinning_loot_template`)"); LoadLootTemplates_Skinning(); LootTemplates_Skinning.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `skinning_loot_template` reloaded."); @@ -635,7 +635,7 @@ public: static bool HandleReloadLootTemplatesSpellCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Loot Tables... (`spell_loot_template`)"); + LOG_INFO("server", "Re-Loading Loot Tables... (`spell_loot_template`)"); LoadLootTemplates_Spell(); LootTemplates_Spell.CheckLootRefs(); handler->SendGlobalGMSysMessage("DB table `spell_loot_template` reloaded."); @@ -645,7 +645,7 @@ public: static bool HandleReloadAcoreStringCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading acore_string Table!"); + LOG_INFO("server", "Re-Loading acore_string Table!"); sObjectMgr->LoadAcoreStrings(); handler->SendGlobalGMSysMessage("DB table `acore_string` reloaded."); return true; @@ -660,7 +660,7 @@ public: return false; } - sLog->outString("Re-Loading warden_action Table!"); + LOG_INFO("server", "Re-Loading warden_action Table!"); sWardenCheckMgr->LoadWardenOverrides(); handler->SendGlobalGMSysMessage("DB table `warden_action` reloaded."); return true; @@ -668,7 +668,7 @@ public: static bool HandleReloadNpcTrainerCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `npc_trainer` Table!"); + LOG_INFO("server", "Re-Loading `npc_trainer` Table!"); sObjectMgr->LoadTrainerSpell(); handler->SendGlobalGMSysMessage("DB table `npc_trainer` reloaded."); return true; @@ -676,7 +676,7 @@ public: static bool HandleReloadNpcVendorCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `npc_vendor` Table!"); + LOG_INFO("server", "Re-Loading `npc_vendor` Table!"); sObjectMgr->LoadVendors(); handler->SendGlobalGMSysMessage("DB table `npc_vendor` reloaded."); return true; @@ -684,7 +684,7 @@ public: static bool HandleReloadPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `points_of_interest` Table!"); + LOG_INFO("server", "Re-Loading `points_of_interest` Table!"); sObjectMgr->LoadPointsOfInterest(); handler->SendGlobalGMSysMessage("DB table `points_of_interest` reloaded."); return true; @@ -692,7 +692,7 @@ public: static bool HandleReloadQuestPOICommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString( "Re-Loading Quest POI ..." ); + LOG_INFO("server", "Re-Loading Quest POI ..." ); sObjectMgr->LoadQuestPOI(); handler->SendGlobalGMSysMessage("DB Table `quest_poi` and `quest_poi_points` reloaded."); return true; @@ -700,7 +700,7 @@ public: static bool HandleReloadSpellClickSpellsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading `npc_spellclick_spells` Table!"); + LOG_INFO("server", "Re-Loading `npc_spellclick_spells` Table!"); sObjectMgr->LoadNPCSpellClickSpells(); handler->SendGlobalGMSysMessage("DB table `npc_spellclick_spells` reloaded."); return true; @@ -708,7 +708,7 @@ public: static bool HandleReloadReservedNameCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Loading ReservedNames... (`reserved_name`)"); + LOG_INFO("server", "Loading ReservedNames... (`reserved_name`)"); sObjectMgr->LoadReservedPlayersNames(); handler->SendGlobalGMSysMessage("DB table `reserved_name` (player reserved names) reloaded."); return true; @@ -716,7 +716,7 @@ public: static bool HandleReloadReputationRewardRateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString( "Re-Loading `reputation_reward_rate` Table!" ); + LOG_INFO("server", "Re-Loading `reputation_reward_rate` Table!" ); sObjectMgr->LoadReputationRewardRate(); handler->SendGlobalSysMessage("DB table `reputation_reward_rate` reloaded."); return true; @@ -724,7 +724,7 @@ public: static bool HandleReloadReputationSpilloverTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString( "Re-Loading `reputation_spillover_template` Table!" ); + LOG_INFO("server", "Re-Loading `reputation_spillover_template` Table!" ); sObjectMgr->LoadReputationSpilloverTemplate(); handler->SendGlobalSysMessage("DB table `reputation_spillover_template` reloaded."); return true; @@ -732,7 +732,7 @@ public: static bool HandleReloadSkillDiscoveryTemplateCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Skill Discovery Table..."); + LOG_INFO("server", "Re-Loading Skill Discovery Table..."); LoadSkillDiscoveryTable(); handler->SendGlobalGMSysMessage("DB table `skill_discovery_template` (recipes discovered at crafting) reloaded."); return true; @@ -741,7 +741,7 @@ public: static bool HandleReloadSkillPerfectItemTemplateCommand(ChatHandler* handler, const char* /*args*/) { // latched onto HandleReloadSkillExtraItemTemplateCommand as it's part of that table group (and i don't want to chance all the command IDs) - sLog->outString("Re-Loading Skill Perfection Data Table..."); + LOG_INFO("server", "Re-Loading Skill Perfection Data Table..."); LoadSkillPerfectItemTable(); handler->SendGlobalGMSysMessage("DB table `skill_perfect_item_template` (perfect item procs when crafting) reloaded."); return true; @@ -749,7 +749,7 @@ public: static bool HandleReloadSkillExtraItemTemplateCommand(ChatHandler* handler, const char* args) { - sLog->outString("Re-Loading Skill Extra Item Table..."); + LOG_INFO("server", "Re-Loading Skill Extra Item Table..."); LoadSkillExtraItemTable(); handler->SendGlobalGMSysMessage("DB table `skill_extra_item_template` (extra item creation when crafting) reloaded."); return HandleReloadSkillPerfectItemTemplateCommand(handler, args); @@ -757,7 +757,7 @@ public: static bool HandleReloadSkillFishingBaseLevelCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Skill Fishing base level requirements..."); + LOG_INFO("server", "Re-Loading Skill Fishing base level requirements..."); sObjectMgr->LoadFishingBaseSkillLevel(); handler->SendGlobalGMSysMessage("DB table `skill_fishing_base_level` (fishing base level for zone/subzone) reloaded."); return true; @@ -765,7 +765,7 @@ public: static bool HandleReloadSpellAreaCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading SpellArea Data..."); + LOG_INFO("server", "Re-Loading SpellArea Data..."); sSpellMgr->LoadSpellAreas(); handler->SendGlobalGMSysMessage("DB table `spell_area` (spell dependences from area/quest/auras state) reloaded."); return true; @@ -773,7 +773,7 @@ public: static bool HandleReloadSpellRequiredCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Required Data... "); + LOG_INFO("server", "Re-Loading Spell Required Data... "); sSpellMgr->LoadSpellRequired(); handler->SendGlobalGMSysMessage("DB table `spell_required` reloaded."); return true; @@ -781,7 +781,7 @@ public: static bool HandleReloadSpellGroupsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Groups..."); + LOG_INFO("server", "Re-Loading Spell Groups..."); sSpellMgr->LoadSpellGroups(); handler->SendGlobalGMSysMessage("DB table `spell_group` (spell groups) reloaded."); return true; @@ -789,7 +789,7 @@ public: static bool HandleReloadSpellLinkedSpellCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Linked Spells..."); + LOG_INFO("server", "Re-Loading Spell Linked Spells..."); sSpellMgr->LoadSpellLinked(); handler->SendGlobalGMSysMessage("DB table `spell_linked_spell` reloaded."); return true; @@ -797,7 +797,7 @@ public: static bool HandleReloadSpellProcEventCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Proc Event conditions..."); + LOG_INFO("server", "Re-Loading Spell Proc Event conditions..."); sSpellMgr->LoadSpellProcEvents(); handler->SendGlobalGMSysMessage("DB table `spell_proc_event` (spell proc trigger requirements) reloaded."); return true; @@ -805,7 +805,7 @@ public: static bool HandleReloadSpellProcsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Proc conditions and data..."); + LOG_INFO("server", "Re-Loading Spell Proc conditions and data..."); sSpellMgr->LoadSpellProcs(); handler->SendGlobalGMSysMessage("DB table `spell_proc` (spell proc conditions and data) reloaded."); return true; @@ -813,7 +813,7 @@ public: static bool HandleReloadSpellBonusesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Bonus Data..."); + LOG_INFO("server", "Re-Loading Spell Bonus Data..."); sSpellMgr->LoadSpellBonusess(); handler->SendGlobalGMSysMessage("DB table `spell_bonus_data` (spell damage/healing coefficients) reloaded."); return true; @@ -821,7 +821,7 @@ public: static bool HandleReloadSpellTargetPositionCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell target coordinates..."); + LOG_INFO("server", "Re-Loading Spell target coordinates..."); sSpellMgr->LoadSpellTargetPositions(); handler->SendGlobalGMSysMessage("DB table `spell_target_position` (destination coordinates for spell targets) reloaded."); return true; @@ -829,7 +829,7 @@ public: static bool HandleReloadSpellThreatsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Aggro Spells Definitions..."); + LOG_INFO("server", "Re-Loading Aggro Spells Definitions..."); sSpellMgr->LoadSpellThreats(); handler->SendGlobalGMSysMessage("DB table `spell_threat` (spell aggro definitions) reloaded."); return true; @@ -837,7 +837,7 @@ public: static bool HandleReloadSpellGroupStackRulesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell Group Stack Rules..."); + LOG_INFO("server", "Re-Loading Spell Group Stack Rules..."); sSpellMgr->LoadSpellGroupStackRules(); handler->SendGlobalGMSysMessage("DB table `spell_group_stack_rules` (spell stacking definitions) reloaded."); return true; @@ -845,7 +845,7 @@ public: static bool HandleReloadSpellPetAurasCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Spell pet auras..."); + LOG_INFO("server", "Re-Loading Spell pet auras..."); sSpellMgr->LoadSpellPetAuras(); handler->SendGlobalGMSysMessage("DB table `spell_pet_auras` reloaded."); return true; @@ -853,7 +853,7 @@ public: static bool HandleReloadPageTextsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Page Texts..."); + LOG_INFO("server", "Re-Loading Page Texts..."); sObjectMgr->LoadPageTexts(); handler->SendGlobalGMSysMessage("DB table `page_texts` reloaded."); handler->GetSession()->SendNotification("You need to delete your client cache or change the cache number in config in order for your players see the changes."); @@ -862,7 +862,7 @@ public: static bool HandleReloadItemEnchantementsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Item Random Enchantments Table..."); + LOG_INFO("server", "Re-Loading Item Random Enchantments Table..."); LoadRandomEnchantmentsTable(); handler->SendGlobalGMSysMessage("DB table `item_enchantment_template` reloaded."); return true; @@ -870,7 +870,7 @@ public: static bool HandleReloadItemSetNamesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Item set names..."); + LOG_INFO("server", "Re-Loading Item set names..."); sObjectMgr->LoadItemSetNames(); handler->SendGlobalGMSysMessage("DB table `item_set_names` reloaded."); return true; @@ -886,7 +886,7 @@ public: } if (*args != 'a') - sLog->outString("Re-Loading Scripts from `event_scripts`..."); + LOG_INFO("server", "Re-Loading Scripts from `event_scripts`..."); sObjectMgr->LoadEventScripts(); @@ -906,7 +906,7 @@ public: } if (*args != 'a') - sLog->outString("Re-Loading Scripts from `waypoint_scripts`..."); + LOG_INFO("server", "Re-Loading Scripts from `waypoint_scripts`..."); sObjectMgr->LoadWaypointScripts(); @@ -919,7 +919,7 @@ public: static bool HandleReloadWpCommand(ChatHandler* handler, const char* args) { if (*args != 'a') - sLog->outString("Re-Loading Waypoints data from 'waypoints_data'"); + LOG_INFO("server", "Re-Loading Waypoints data from 'waypoints_data'"); sWaypointMgr->Load(); @@ -939,7 +939,7 @@ public: } if (*args != 'a') - sLog->outString("Re-Loading Scripts from `spell_scripts`..."); + LOG_INFO("server", "Re-Loading Scripts from `spell_scripts`..."); sObjectMgr->LoadSpellScripts(); @@ -951,7 +951,7 @@ public: static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Graveyard-zone links..."); + LOG_INFO("server", "Re-Loading Graveyard-zone links..."); sGraveyard->LoadGraveyardZones(); @@ -962,7 +962,7 @@ public: static bool HandleReloadGameTeleCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Game Tele coordinates..."); + LOG_INFO("server", "Re-Loading Game Tele coordinates..."); sObjectMgr->LoadGameTele(); @@ -973,9 +973,9 @@ public: static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading disables table..."); + LOG_INFO("server", "Re-Loading disables table..."); DisableMgr::LoadDisables(); - sLog->outString("Checking quest disables..."); + LOG_INFO("server", "Checking quest disables..."); DisableMgr::CheckQuestDisables(); handler->SendGlobalGMSysMessage("DB table `disables` reloaded."); return true; @@ -983,7 +983,7 @@ public: static bool HandleReloadLocalesAchievementRewardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Achievement Reward Data Locale..."); + LOG_INFO("server", "Re-Loading Achievement Reward Data Locale..."); sAchievementMgr->LoadRewardLocales(); handler->SendGlobalGMSysMessage("DB table `achievement_reward_locale` reloaded."); return true; @@ -991,7 +991,7 @@ public: static bool HandleReloadLfgRewardsCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading lfg dungeon rewards..."); + LOG_INFO("server", "Re-Loading lfg dungeon rewards..."); sLFGMgr->LoadRewards(); handler->SendGlobalGMSysMessage("DB table `lfg_dungeon_rewards` reloaded."); return true; @@ -999,7 +999,7 @@ public: static bool HandleReloadLocalesCreatureCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Creature Template Locale..."); + LOG_INFO("server", "Re-Loading Creature Template Locale..."); sObjectMgr->LoadCreatureLocales(); handler->SendGlobalGMSysMessage("DB table `creature_template_locale` reloaded."); return true; @@ -1007,7 +1007,7 @@ public: static bool HandleReloadLocalesCreatureTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Creature Texts Locale..."); + LOG_INFO("server", "Re-Loading Creature Texts Locale..."); sCreatureTextMgr->LoadCreatureTextLocales(); handler->SendGlobalGMSysMessage("DB table `creature_text_locale` reloaded."); return true; @@ -1015,7 +1015,7 @@ public: static bool HandleReloadLocalesGameobjectCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Gameobject Template Locale ... "); + LOG_INFO("server", "Re-Loading Gameobject Template Locale ... "); sObjectMgr->LoadGameObjectLocales(); handler->SendGlobalGMSysMessage("DB table `gameobject_template_locale` reloaded."); return true; @@ -1023,7 +1023,7 @@ public: static bool HandleReloadLocalesGossipMenuOptionCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString( "Re-Loading Gossip Menu Option Locale ... "); + LOG_INFO("server", "Re-Loading Gossip Menu Option Locale ... "); sObjectMgr->LoadGossipMenuItemsLocales(); handler->SendGlobalGMSysMessage("DB table `gossip_menu_option_locale` reloaded."); return true; @@ -1031,7 +1031,7 @@ public: static bool HandleReloadLocalesItemCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Item Template Locale ... "); + LOG_INFO("server", "Re-Loading Item Template Locale ... "); sObjectMgr->LoadItemLocales(); handler->SendGlobalGMSysMessage("DB table `item_template_locale` reloaded."); return true; @@ -1039,7 +1039,7 @@ public: static bool HandleReloadLocalesItemSetNameCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Item set name Locale... "); + LOG_INFO("server", "Re-Loading Item set name Locale... "); sObjectMgr->LoadItemSetNameLocales(); handler->SendGlobalGMSysMessage("DB table `item_set_name_locale` reloaded."); return true; @@ -1047,7 +1047,7 @@ public: static bool HandleReloadLocalesNpcTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading NPC Text Locale ... "); + LOG_INFO("server", "Re-Loading NPC Text Locale ... "); sObjectMgr->LoadNpcTextLocales(); handler->SendGlobalGMSysMessage("DB table `npc_text_locale` reloaded."); return true; @@ -1055,7 +1055,7 @@ public: static bool HandleReloadLocalesPageTextCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Page Text Locale ... "); + LOG_INFO("server", "Re-Loading Page Text Locale ... "); sObjectMgr->LoadPageTextLocales(); handler->SendGlobalGMSysMessage("DB table `page_text_locale` reloaded."); handler->GetSession()->SendNotification("You need to delete your client cache or change the cache number in config in order for your players see the changes."); @@ -1064,7 +1064,7 @@ public: static bool HandleReloadLocalesPointsOfInterestCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Points Of Interest Locale ... "); + LOG_INFO("server", "Re-Loading Points Of Interest Locale ... "); sObjectMgr->LoadPointOfInterestLocales(); handler->SendGlobalGMSysMessage("DB table `points_of_interest_locale` reloaded."); return true; @@ -1072,7 +1072,7 @@ public: static bool HandleReloadLocalesQuestCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Locales Quest ... "); + LOG_INFO("server", "Re-Loading Locales Quest ... "); sObjectMgr->LoadQuestLocales(); handler->SendGlobalGMSysMessage("DB table `quest_template_locale` reloaded."); return true; @@ -1080,7 +1080,7 @@ public: static bool HandleReloadLocalesQuestOfferRewardCommand(ChatHandler* handler, char const* /*args*/) { - sLog->outString("Re-Loading Quest Offer Reward Locale... "); + LOG_INFO("server", "Re-Loading Quest Offer Reward Locale... "); sObjectMgr->LoadQuestOfferRewardLocale(); handler->SendGlobalGMSysMessage("DB table `quest_offer_reward_locale` reloaded."); return true; @@ -1088,7 +1088,7 @@ public: static bool HandleReloadLocalesQuestRequestItemsCommand(ChatHandler* handler, char const* /*args*/) { - sLog->outString("Re-Loading Quest Request Item Locale... "); + LOG_INFO("server", "Re-Loading Quest Request Item Locale... "); sObjectMgr->LoadQuestRequestItemsLocale(); handler->SendGlobalGMSysMessage("DB table `quest_request_item_locale` reloaded."); return true; @@ -1096,7 +1096,7 @@ public: static bool HandleReloadMailLevelRewardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Player level dependent mail rewards..."); + LOG_INFO("server", "Re-Loading Player level dependent mail rewards..."); sObjectMgr->LoadMailLevelRewards(); handler->SendGlobalGMSysMessage("DB table `mail_level_reward` reloaded."); return true; @@ -1105,7 +1105,7 @@ public: static bool HandleReloadAuctionsCommand(ChatHandler* handler, const char* /*args*/) { ///- Reload dynamic data tables from the database - sLog->outString("Re-Loading Auctions..."); + LOG_INFO("server", "Re-Loading Auctions..."); sAuctionMgr->LoadAuctionItems(); sAuctionMgr->LoadAuctions(); handler->SendGlobalGMSysMessage("Auctions reloaded."); @@ -1114,7 +1114,7 @@ public: static bool HandleReloadConditions(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Conditions..."); + LOG_INFO("server", "Re-Loading Conditions..."); sConditionMgr->LoadConditions(true); handler->SendGlobalGMSysMessage("Conditions reloaded."); return true; @@ -1122,7 +1122,7 @@ public: static bool HandleReloadCreatureText(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Creature Texts..."); + LOG_INFO("server", "Re-Loading Creature Texts..."); sCreatureTextMgr->LoadCreatureTexts(); handler->SendGlobalGMSysMessage("Creature Texts reloaded."); return true; @@ -1130,7 +1130,7 @@ public: static bool HandleReloadSmartScripts(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Smart Scripts..."); + LOG_INFO("server", "Re-Loading Smart Scripts..."); sSmartScriptMgr->LoadSmartAIFromDB(); handler->SendGlobalGMSysMessage("Smart Scripts reloaded."); return true; @@ -1138,7 +1138,7 @@ public: static bool HandleReloadVehicleAccessoryCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Reloading vehicle_accessory table..."); + LOG_INFO("server", "Reloading vehicle_accessory table..."); sObjectMgr->LoadVehicleAccessories(); handler->SendGlobalGMSysMessage("Vehicle accessories reloaded."); return true; @@ -1146,7 +1146,7 @@ public: static bool HandleReloadVehicleTemplateAccessoryCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Reloading vehicle_template_accessory table..."); + LOG_INFO("server", "Reloading vehicle_template_accessory table..."); sObjectMgr->LoadVehicleTemplateAccessories(); handler->SendGlobalGMSysMessage("Vehicle template accessories reloaded."); return true; @@ -1154,7 +1154,7 @@ public: static bool HandleReloadGameGraveyardCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Reloading game_graveyard table..."); + LOG_INFO("server", "Reloading game_graveyard table..."); sGraveyard->LoadGraveyardFromDB(); handler->SendGlobalGMSysMessage("DB table `game_graveyard` reloaded."); return true; diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index 48a1aca497..3d793b1e18 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -79,7 +79,7 @@ public: ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->getClass()); if (!classEntry) { - sLog->outError("Class %u not found in DBC (Wrong DBC files?)", player->getClass()); + LOG_ERROR("server", "Class %u not found in DBC (Wrong DBC files?)", player->getClass()); return false; } @@ -99,7 +99,7 @@ public: player->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP); - player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + player->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); //-1 is default value player->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, uint32(-1)); @@ -284,7 +284,7 @@ public: stmt->setUInt16(0, uint16(atLogin)); CharacterDatabase.Execute(stmt); - ACORE_READ_GUARD(HashMapHolder::LockType, *HashMapHolder::GetLock()); + std::shared_lock lock(*HashMapHolder::GetLock()); HashMapHolder::MapType const& plist = sObjectAccessor->GetPlayers(); for (HashMapHolder::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr) itr->second->SetAtLoginFlag(atLogin); diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index bcaefb059a..d5339421ed 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -20,6 +20,7 @@ EndScriptData */ #include "Player.h" #include "ScriptMgr.h" #include "ServerMotd.h" +#include "StringConvert.h" class server_commandscript : public CommandScript { @@ -56,7 +57,6 @@ public: { { "difftime", SEC_CONSOLE, true, &HandleServerSetDiffTimeCommand, "" }, { "loglevel", SEC_CONSOLE, true, &HandleServerSetLogLevelCommand, "" }, - { "logfilelevel", SEC_CONSOLE, true, &HandleServerSetLogFileLevelCommand, "" }, { "motd", SEC_ADMINISTRATOR, true, &HandleServerSetMotdCommand, "" }, { "closed", SEC_CONSOLE, true, &HandleServerSetClosedCommand, "" } }; @@ -71,14 +71,14 @@ public: { "motd", SEC_PLAYER, true, &HandleServerMotdCommand, "" }, { "restart", SEC_ADMINISTRATOR, true, nullptr, "", serverRestartCommandTable }, { "shutdown", SEC_ADMINISTRATOR, true, nullptr, "", serverShutdownCommandTable }, - { "set", SEC_ADMINISTRATOR, true, nullptr, "", serverSetCommandTable }, - { "togglequerylog", SEC_CONSOLE, true, &HandleServerToggleQueryLogging, "" } + { "set", SEC_ADMINISTRATOR, true, nullptr, "", serverSetCommandTable } }; static std::vector commandTable = { { "server", SEC_PLAYER, true, nullptr, "", serverCommandTable } }; + return commandTable; } @@ -313,31 +313,20 @@ public: return false; } - // Set the level of logging - static bool HandleServerSetLogFileLevelCommand(ChatHandler* /*handler*/, char const* args) - { - if (!*args) - return false; - - char* newLevel = strtok((char*)args, " "); - if (!newLevel) - return false; - - sLog->SetLogFileLevel(newLevel); - return true; - } - // Set the level of logging static bool HandleServerSetLogLevelCommand(ChatHandler* /*handler*/, char const* args) { - if (!*args) + if (!*args) return false; - char* newLevel = strtok((char*)args, " "); - if (!newLevel) + char* type = strtok((char*)args, " "); + char* name = strtok(nullptr, " "); + char* level = strtok(nullptr, " "); + + if (!type || !name || !level || *name == '\0' || *level == '\0' || (*type != 'a' && *type != 'l')) return false; - sLog->SetLogLevel(newLevel); + sLog->SetLogLevel(name, *acore::StringTo(level), *type == 'l'); return true; } @@ -360,18 +349,6 @@ public: return true; } - - // toggle sql driver query logging - static bool HandleServerToggleQueryLogging(ChatHandler* handler, char const* /*args*/) - { - sLog->SetSQLDriverQueryLogging(!sLog->GetSQLDriverQueryLogging()); - - if (sLog->GetSQLDriverQueryLogging()) - handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_ENABLED); - else - handler->PSendSysMessage(LANG_SQLDRIVER_QUERY_LOGGING_DISABLED); - return true; - } }; void AddSC_server_commandscript() diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index a9e50d33fd..4b0d17e7e9 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -267,7 +267,7 @@ public: void SetData64(uint32 type, uint64 data) override { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data); + LOG_DEBUG("scripts.ai", "TSCR: Instance Blackrock Depths: SetData64 update (Type: %u Data " UI64FMTD ")", type, data); #endif switch (type) @@ -285,7 +285,7 @@ public: void SetData(uint32 type, uint32 data) override { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); + LOG_DEBUG("scripts.ai", "TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data); #endif switch (type) diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp index d5b61ac4c8..90a4f28143 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_magmadar.cpp @@ -128,7 +128,7 @@ public: void removeFeignDeath() { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); @@ -147,7 +147,7 @@ public: killer = attacker; events.ScheduleEvent(EVENT_IGNITE, 10000); me->SetHealth(1); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); @@ -204,7 +204,7 @@ public: { Talk(EMOTE_IGNITE); me->SetFullHealth(); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index ea06c63259..010f5c52e4 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -229,7 +229,7 @@ public: void PrepareEncounter() { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); + LOG_DEBUG("scripts.ai", "TSCR: Barnes Opera Event - Introduction complete - preparing encounter %d", m_uiEventId); #endif uint8 index = 0; uint8 count = 0; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 4fb418049c..d0275d6918 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -803,7 +803,7 @@ public: else { me->GetMotionMaster()->MovePoint(1, anchorX, anchorY, me->GetPositionZ()); - //sLog->outDebug(LOG_FILTER_TSCR, "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); + //LOG_DEBUG("scripts.ai", "npc_unworthy_initiateAI: move to %f %f %f", anchorX, anchorY, me->GetPositionZ()); phase = PHASE_EQUIPING; wait_timer = 0; } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index ee71281a6e..a287a4f4f6 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -240,7 +240,7 @@ public: 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 diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index 516ecf9b23..df8c72e45e 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -420,7 +420,7 @@ public: gateId = GO_GATE_ILLUCIA; break; case SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT: - summonPos = ROOM_BAROV_FAMILY_VAULT * 4; + summonPos = ROOM_BAROV_FAMILY_VAULT * 3; gateId = GO_GATE_BAROV; break; case SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN: diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index 9744a3d9b4..bf919ad93a 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -229,18 +229,18 @@ public: return; std::istringstream ss(load); - //sLog->outError("Zul'aman loaded, %s.", ss.str().c_str()); + //LOG_ERROR("server", "Zul'aman loaded, %s.", ss.str().c_str()); char dataHead; // S uint16 data1, data2, data3; ss >> dataHead >> data1 >> data2 >> data3; - //sLog->outError("Zul'aman loaded, %d %d %d.", data1, data2, data3); + //LOG_ERROR("server", "Zul'aman loaded, %d %d %d.", data1, data2, data3); if (dataHead == 'S') { BossKilled = data1; ChestLooted = data2; QuestMinute = data3; } - else sLog->outError("Zul'aman: corrupted save data."); + else LOG_ERROR("server", "Zul'aman: corrupted save data."); } void SetData(uint32 type, uint32 data) override diff --git a/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp index cb385994bf..379a85426a 100644 --- a/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_eastern_plaguelands.cpp @@ -164,7 +164,7 @@ public: float z = 159.65f; creature->SetWalk(true); creature->GetMotionMaster()->MovePoint(0, x, y, z); - creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); } } diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index aa379934ad..130a7cf0d3 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -79,7 +79,7 @@ public: channeling = false; eventProgress = 0; spawnerCount = 0; - me->SetFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); me->SetReactState(REACT_AGGRESSIVE); } } @@ -108,7 +108,7 @@ public: { eventInProgress = true; Talk(SAY_QUEST_ACCEPTED); - me->RemoveFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); me->setFaction(FACTION_ESCORT); me->GetMotionMaster()->MovePath(PATH_ESCORT, false); } diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index 9097862016..2972badfc4 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -94,7 +94,7 @@ public: { if (Spell->SpellFamilyFlags[2] & 0x080000000) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); me->SetStandState(UNIT_STAND_STATE_STAND); DoCast(me, SPELL_STUNNED, true); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp index beba9b03bc..7355dd762f 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp @@ -364,7 +364,7 @@ public: void Reset() override { _events.Reset(); - me->RemoveFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); // Xinef: after soft reset npc is no longer present if (me->GetInstanceScript()->GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) @@ -426,7 +426,7 @@ public: Talk(SAY_XERESTRASZA_EVENT_6); break; case EVENT_XERESTRASZA_EVENT_7: - me->SetFlag(UNIT_NPC_FLAGS, GOSSIP_OPTION_QUESTGIVER); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); Talk(SAY_XERESTRASZA_EVENT_7); me->setActive(false); break; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp index fa33a61a82..9080ca3443 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_black_knight.cpp @@ -141,7 +141,7 @@ public: summons.clear(); me->CastSpell(me, SPELL_BK_FEIGN_DEATH, true); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->AddUnitState(UNIT_STATE_DIED); @@ -183,7 +183,7 @@ public: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); me->SetControlled(false, UNIT_STATE_STUNNED); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->ClearUnitState(UNIT_STATE_DIED); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index c612f47204..7abd6a1b2f 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -405,7 +405,7 @@ public: c->CastSpell(c, 69753, false); me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->AddUnitState(UNIT_STATE_DIED); diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp index e98458a8a8..ea096176bc 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.cpp @@ -1095,7 +1095,7 @@ public: { npc_pos_freed_slaveAI(Creature* creature) : SmartAI(creature) { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); // immune to falling icicles me->ApplySpellImmune(0, IMMUNITY_ID, 69425, true); me->ApplySpellImmune(0, IMMUNITY_ID, 70827, true); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index ce8764abd9..5aea844336 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -354,7 +354,7 @@ public: { case ACTION_STAND_UP: summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->SetReactState(REACT_AGGRESSIVE); @@ -623,7 +623,7 @@ public: { case ACTION_STAND_UP: summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->SetReactState(REACT_AGGRESSIVE); @@ -916,7 +916,7 @@ public: { case ACTION_STAND_UP: summons.DespawnEntry(WORLD_TRIGGER); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->SetReactState(REACT_AGGRESSIVE); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 46c20d59d1..ad7ed6eb08 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -734,7 +734,7 @@ public: me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->UpdateEntry(NPC_REANIMATED_FANATIC); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); DoZoneInCombat(me); me->CastSpell(me, SPELL_FANATIC_S_DETERMINATION); @@ -748,7 +748,7 @@ public: me->CastSpell(me, SPELL_FULL_HEAL, true); me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE); Reset(); events.ScheduleEvent(EVENT_CULTIST_DARK_MARTYRDOM_REVIVE, 6000); break; @@ -855,7 +855,7 @@ public: me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->UpdateEntry(NPC_REANIMATED_ADHERENT); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); DoZoneInCombat(me); me->CastSpell(me, SPELL_ADHERENT_S_DETERMINATION); @@ -869,7 +869,7 @@ public: me->CastSpell(me, SPELL_FULL_HEAL, true); me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_UNK_29 | UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED | UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT | UNIT_FLAG_NOT_SELECTABLE); Reset(); events.ScheduleEvent(EVENT_CULTIST_DARK_MARTYRDOM_REVIVE, 6000); break; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 191f16a670..12b45d4e44 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1127,7 +1127,7 @@ public: { Talk(EMOTE_SVALNA_IMPALE, target); summon->CastCustomSpell(VEHICLE_SPELL_RIDE_HARDCODED, SPELLVALUE_BASE_POINT0, 1, target, false); - summon->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_UNK1 | UNIT_FLAG2_ALLOW_ENEMY_INTERACT); + summon->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_HIDE_BODY | UNIT_FLAG2_ALLOW_ENEMY_INTERACT); } break; default: diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 46e6127bbd..15cccd34ea 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -929,7 +929,7 @@ public: if (drake) { - drake->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); + drake->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_POSSESSED); drake->RemoveAurasDueToSpell(GetId()); drake->RemoveAurasDueToSpell(SPELL_SOAR_TRIGGER); drake->RemoveAurasDueToSpell(SPELL_RUBY_EVASIVE_AURA); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index f894a14520..0f56bca30c 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -391,7 +391,7 @@ public: case ACTION_START_INTRO: { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_INSTANTLY_APPEAR_MODEL); + me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DO_NOT_FADE_IN); me->SetDisableGravity(true); me->CastSpell(me, SPELL_ARRIVAL, true); me->CastSpell(me, SPELL_RIDE_THE_LIGHTNING, true); diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index fe8626e5d0..62ac9079f3 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -194,14 +194,14 @@ public: if (apply) { me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); } else { me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 7cba0e3297..d4967c611f 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -269,7 +269,7 @@ public: me->GetMotionMaster()->MoveIdle(); me->StopMoving(); me->SetStandState(UNIT_STAND_STATE_DEAD); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); me->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); events.RescheduleEvent(EVENT_RESURRECT, 12000); @@ -311,7 +311,7 @@ public: events.DelayEvents(3500); DoCast(me, SPELL_SCOURGE_RESURRECTION, true); me->SetStandState(UNIT_STAND_STATE_STAND); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_29); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT); me->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); events.RescheduleEvent(EVENT_RESURRECT_2, 3000); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index c0d551d1c8..ad21cb4497 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -74,7 +74,7 @@ void OutdoorPvPSI::HandlePlayerLeaveZone(Player* player, uint32 zone) bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 trigger) { - ACORE_GUARD(ACE_Thread_Mutex, sOutdoorPvPMgr->_lock); + std::lock_guard guard(sOutdoorPvPMgr->_lock); switch (trigger) { diff --git a/src/server/scripts/Outland/zone_netherstorm.cpp b/src/server/scripts/Outland/zone_netherstorm.cpp index dbcb3ecd81..3e0faad7c3 100644 --- a/src/server/scripts/Outland/zone_netherstorm.cpp +++ b/src/server/scripts/Outland/zone_netherstorm.cpp @@ -1446,7 +1446,7 @@ public: } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: npc_commander_dawnforge event already in progress, need to wait."); + LOG_DEBUG("scripts.ai", "TSCR: npc_commander_dawnforge event already in progress, need to wait."); #endif return false; } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 490bf880b5..735d403404 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -5111,13 +5111,11 @@ public: pCaster->SendAttackSwingCancelAttack(); } - if (!caster->GetInstanceScript() || !caster->GetInstanceScript()->IsEncounterInProgress()) //Don't leave combat if you are in combat with a boss + if (instant_exit) { - if (!instant_exit) { - caster->getHostileRefManager().deleteReferences(); // exit combat after 6 seconds - } - else caster->CombatStop(); // isn't necessary to call AttackStop because is just called in CombatStop + caster->getHostileRefManager().deleteReferences(); } + caster->CombatStop(); } void Register() override diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 9e045db9ae..433def97e3 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -282,7 +282,7 @@ public: SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]); if (!spellInfo) { - sLog->outError("Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]); + LOG_ERROR("server", "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]); continue; } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index fc8501a80b..1f516f841e 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -708,7 +708,7 @@ public: rank = 2; break; default: - sLog->outError("Unknown rank of Improved Healthstone id: %d", aurEff->GetId()); + LOG_ERROR("server", "Unknown rank of Improved Healthstone id: %d", aurEff->GetId()); break; } } diff --git a/src/server/scripts/World/chat_log.cpp b/src/server/scripts/World/chat_log.cpp index 199a08986f..920e8732ae 100644 --- a/src/server/scripts/World/chat_log.cpp +++ b/src/server/scripts/World/chat_log.cpp @@ -9,6 +9,12 @@ #include "Guild.h" #include "ScriptMgr.h" +#define LOG_CHAT(TYPE, ...) \ + if (lang != LANG_ADDON) \ + LOG_DEBUG("chat.log." TYPE, __VA_ARGS__); \ + else \ + LOG_DEBUG("chat.log.addon." TYPE, __VA_ARGS__); + class ChatLogScript : public PlayerScript { public: @@ -18,40 +24,27 @@ public: { switch (type) { - case CHAT_MSG_ADDON: - if (sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s sends: %s", - player->GetName().c_str(), msg.c_str()); - break; - case CHAT_MSG_SAY: - if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - sLog->outChat("[SAY] Player %s says (language %u): %s", - player->GetName().c_str(), lang, msg.c_str()); + LOG_CHAT("say", "Player %s says (language %u): %s", + player->GetName().c_str(), lang, msg.c_str()); break; case CHAT_MSG_EMOTE: - if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - sLog->outChat("[TEXTEMOTE] Player %s emotes: %s", - player->GetName().c_str(), msg.c_str()); + LOG_CHAT("emote", "Player %s emotes: %s", + player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_YELL: - if (sWorld->getBoolConfig(CONFIG_CHATLOG_PUBLIC)) - sLog->outChat("[YELL] Player %s yells (language %u): %s", - player->GetName().c_str(), lang, msg.c_str()); + LOG_CHAT("yell", "Player %s yells (language %u): %s", + player->GetName().c_str(), lang, msg.c_str()); break; } } void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) override { - if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_WHISPER)) - sLog->outChat("[WHISPER] Player %s tells %s: %s", - player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "", msg.c_str()); - else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s tells %s: %s", - player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "", msg.c_str()); + LOG_CHAT("whisper", "Player %s tells %s: %s", + player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "", msg.c_str()); } void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override @@ -61,54 +54,38 @@ public: switch (type) { case CHAT_MSG_PARTY: - if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) - sLog->outChat("[PARTY] Player %s tells group with leader %s: %s", - player->GetName().c_str(), group ? group->GetLeaderName() : "", msg.c_str()); - else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s tells group with leader %s: %s", - player->GetName().c_str(), group ? group->GetLeaderName() : "", msg.c_str()); + LOG_CHAT("party", "Player %s tells group with leader %s: %s", + player->GetName().c_str(), group ? group->GetLeaderName() : "", msg.c_str()); break; case CHAT_MSG_PARTY_LEADER: - if (sWorld->getBoolConfig(CONFIG_CHATLOG_PARTY)) - sLog->outChat("[PARTY] Leader %s tells group: %s", - player->GetName().c_str(), msg.c_str()); + LOG_CHAT("party", "Leader %s tells group: %s", + player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_RAID: - if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - sLog->outChat("[RAID] Player %s tells raid with leader %s: %s", - player->GetName().c_str(), group ? group->GetLeaderName() : "", msg.c_str()); - else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s tells raid with leader %s: %s", - player->GetName().c_str(), group ? group->GetLeaderName() : "", msg.c_str()); + LOG_CHAT("raid", "Player %s tells raid with leader %s: %s", + player->GetName().c_str(), group ? group->GetLeaderName() : "", msg.c_str()); break; case CHAT_MSG_RAID_LEADER: - if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - sLog->outChat("[RAID] Leader player %s tells raid: %s", - player->GetName().c_str(), msg.c_str()); + LOG_CHAT("raid", "Leader player %s tells raid: %s", + player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_RAID_WARNING: - if (sWorld->getBoolConfig(CONFIG_CHATLOG_RAID)) - sLog->outChat("[RAID] Leader player %s warns raid with: %s", - player->GetName().c_str(), msg.c_str()); + LOG_CHAT("raid", "Leader player %s warns raid with: %s", + player->GetName().c_str(), msg.c_str()); break; case CHAT_MSG_BATTLEGROUND: - if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) - sLog->outChat("[BATTLEGROUND] Player %s tells battleground with leader %s: %s", - player->GetName().c_str(), group ? group->GetLeaderName() : "", msg.c_str()); - else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s tells battleground with leader %s: %s", - player->GetName().c_str(), group ? group->GetLeaderName() : "", msg.c_str()); + LOG_CHAT("bg", "Player %s tells battleground with leader %s: %s", + player->GetName().c_str(), group ? group->GetLeaderName() : "", msg.c_str()); break; case CHAT_MSG_BATTLEGROUND_LEADER: - if (sWorld->getBoolConfig(CONFIG_CHATLOG_BGROUND)) - sLog->outChat("[BATTLEGROUND] Leader player %s tells battleground: %s", - player->GetName().c_str(), msg.c_str()); + LOG_CHAT("bg", "Leader player %s tells battleground: %s", + player->GetName().c_str(), msg.c_str()); break; } } @@ -118,23 +95,18 @@ public: switch (type) { case CHAT_MSG_GUILD: - if (lang != LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) - sLog->outChat("[GUILD] Player %s tells guild %s: %s", - player->GetName().c_str(), guild ? guild->GetName().c_str() : "", msg.c_str()); - else if (lang == LANG_ADDON && sWorld->getBoolConfig(CONFIG_CHATLOG_ADDON)) - sLog->outChat("[ADDON] Player %s sends to guild %s: %s", - player->GetName().c_str(), guild ? guild->GetName().c_str() : "", msg.c_str()); + LOG_CHAT("guild", "Player %s tells guild %s: %s", + player->GetName().c_str(), guild ? guild->GetName().c_str() : "", msg.c_str()); break; case CHAT_MSG_OFFICER: - if (sWorld->getBoolConfig(CONFIG_CHATLOG_GUILD)) - sLog->outChat("[OFFICER] Player %s tells guild %s officers: %s", - player->GetName().c_str(), guild ? guild->GetName().c_str() : "", msg.c_str()); + LOG_CHAT("guild.officer", "Player %s tells guild %s officers: %s", + player->GetName().c_str(), guild ? guild->GetName().c_str() : "", msg.c_str()); break; } } - void OnChat(Player* player, uint32 /*type*/, uint32 /*lang*/, std::string& msg, Channel* channel) override + void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Channel* channel) override { bool isSystem = channel && (channel->HasFlag(CHANNEL_FLAG_TRADE) || @@ -142,12 +114,17 @@ public: channel->HasFlag(CHANNEL_FLAG_CITY) || channel->HasFlag(CHANNEL_FLAG_LFG)); - if (sWorld->getBoolConfig(CONFIG_CHATLOG_SYSCHAN) && isSystem) - sLog->outChat("[SYSCHAN] Player %s tells channel %s: %s", - player->GetName().c_str(), channel->GetName().c_str(), msg.c_str()); - else if (sWorld->getBoolConfig(CONFIG_CHATLOG_CHANNEL)) - sLog->outChat("[CHANNEL] Player %s tells channel %s: %s", - player->GetName().c_str(), channel ? channel->GetName().c_str() : "", msg.c_str()); + if (isSystem) + { + LOG_CHAT("system", "Player %s tells channel %s: %s", + player->GetName().c_str(), channel->GetName().c_str(), msg.c_str()); + } + else + { + std::string channelName = channel ? channel->GetName() : ""; + LOG_CHAT("channel." + channelName, "Player %s tells channel %s: %s", + player->GetName().c_str(), channelName.c_str(), msg.c_str()); + } } }; diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 92f2ac9a2c..53a82486c4 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -274,7 +274,7 @@ bool EquippedOk(Player* player, uint32 spellId) { //player has item equipped that require specialty. Not allow to unlearn, player has to unequip first #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_TSCR, "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry()); + LOG_DEBUG("scripts.ai", "TSCR: player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry()); #endif return false; } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index b3e96aef22..59d348e214 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -503,14 +503,14 @@ public: } if (!SpawnAssoc) - sLog->outErrorDb("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry()); + LOG_ERROR("sql.sql", "TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry()); else { CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(SpawnAssoc->spawnedCreatureEntry); if (!spawnedTemplate) { - sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); + LOG_ERROR("sql.sql", "TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); SpawnAssoc = nullptr; return; } @@ -530,7 +530,7 @@ public: SpawnedGUID = summoned->GetGUID(); else { - sLog->outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); + LOG_ERROR("sql.sql", "TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); SpawnAssoc = nullptr; } @@ -1169,7 +1169,7 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff) patientEntry = HordeSoldierId[rand() % 3]; break; default: - sLog->outError("TSCR: Invalid entry for Triage doctor. Please check your database"); + LOG_ERROR("server", "TSCR: Invalid entry for Triage doctor. Please check your database"); return; } @@ -1178,7 +1178,7 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff) if (Creature* Patient = me->SummonCreature(patientEntry, point->x, point->y, point->z, point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) { //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND) - Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED); Patients.push_back(Patient->GetGUID()); CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->DoctorGUID = me->GetGUID(); diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt index 33742f3435..df64c337a3 100644 --- a/src/server/shared/CMakeLists.txt +++ b/src/server/shared/CMakeLists.txt @@ -24,7 +24,7 @@ target_include_directories(shared target_link_libraries(shared PUBLIC - common) + database) set_target_properties(shared PROPERTIES diff --git a/src/server/shared/Network/RealmSocket.cpp b/src/server/shared/Network/RealmSocket.cpp index abc435cdec..d94e83616b 100644 --- a/src/server/shared/Network/RealmSocket.cpp +++ b/src/server/shared/Network/RealmSocket.cpp @@ -43,7 +43,7 @@ int RealmSocket::open(void* arg) if (peer().get_remote_addr(addr) == -1) { - sLog->outError("Error %s while opening realm socket!", ACE_OS::strerror(errno)); + LOG_ERROR("server", "Error %s while opening realm socket!", ACE_OS::strerror(errno)); return -1; } diff --git a/src/server/shared/Realms/RealmList.cpp b/src/server/shared/Realms/RealmList.cpp index 93d663af61..3e550d44ad 100644 --- a/src/server/shared/Realms/RealmList.cpp +++ b/src/server/shared/Realms/RealmList.cpp @@ -62,7 +62,7 @@ void RealmList::UpdateIfNeed() void RealmList::UpdateRealms(bool init) { - sLog->outString("Updating Realm List..."); + LOG_INFO("server", "Updating Realm List..."); PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); PreparedQueryResult result = LoginDatabase.Query(stmt); @@ -93,7 +93,7 @@ void RealmList::UpdateRealms(bool init) UpdateRealm(realmId, name, externalAddr, localAddr, submask, icon, flag, timezone, (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), pop, build); if (init) - sLog->outString("Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.get_host_addr(), port); + LOG_INFO("server", "Added realm \"%s\" at %s:%u.", name.c_str(), m_realms[name].ExternalAddress.get_host_addr(), port); } while (result->NextRow()); } } diff --git a/src/server/worldserver/ACSoap/ACSoap.cpp b/src/server/worldserver/ACSoap/ACSoap.cpp index 229cdd7c99..dc6ece0f9b 100644 --- a/src/server/worldserver/ACSoap/ACSoap.cpp +++ b/src/server/worldserver/ACSoap/ACSoap.cpp @@ -23,11 +23,11 @@ void ACSoapRunnable::run() soap.send_timeout = 5; if (!soap_valid_socket(soap_bind(&soap, _host.c_str(), _port, 100))) { - sLog->outError("ACSoap: couldn't bind to %s:%d", _host.c_str(), _port); + LOG_ERROR("server", "ACSoap: couldn't bind to %s:%d", _host.c_str(), _port); exit(-1); } - sLog->outString("ACSoap: bound to http://%s:%d", _host.c_str(), _port); + LOG_INFO("server", "ACSoap: bound to http://%s:%d", _host.c_str(), _port); while (!World::IsStopped()) { @@ -35,7 +35,7 @@ void ACSoapRunnable::run() continue; // ran into an accept timeout #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip >> 24) & 0xFF, (int)(soap.ip >> 16) & 0xFF, (int)(soap.ip >> 8) & 0xFF, (int)soap.ip & 0xFF); + LOG_DEBUG("network", "ACSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip >> 24) & 0xFF, (int)(soap.ip >> 16) & 0xFF, (int)(soap.ip >> 8) & 0xFF, (int)soap.ip & 0xFF); #endif struct soap* thread_soap = soap_copy(&soap);// make a safe copy @@ -72,7 +72,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) if (!soap->userid || !soap->passwd) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: Client didn't provide login information"); + LOG_DEBUG("network", "ACSoap: Client didn't provide login information"); #endif return 401; } @@ -81,7 +81,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) if (!accountId) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: Client used invalid username '%s'", soap->userid); + LOG_DEBUG("network", "ACSoap: Client used invalid username '%s'", soap->userid); #endif return 401; } @@ -89,7 +89,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) if (!AccountMgr::CheckPassword(accountId, soap->passwd)) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: invalid password for account '%s'", soap->userid); + LOG_DEBUG("network", "ACSoap: invalid password for account '%s'", soap->userid); #endif return 401; } @@ -97,7 +97,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) if (AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR) { #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: %s's gmlevel is too low", soap->userid); + LOG_DEBUG("network", "ACSoap: %s's gmlevel is too low", soap->userid); #endif return 403; } @@ -106,7 +106,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) return soap_sender_fault(soap, "Command can not be empty", "The supplied command was an empty string"); #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outDebug(LOG_FILTER_NETWORKIO, "ACSoap: got command '%s'", command); + LOG_DEBUG("network", "ACSoap: got command '%s'", command); #endif SOAPCommand connection; @@ -122,7 +122,7 @@ int ns1__executeCommand(soap* soap, char* command, char** result) int acc = connection.pendingCommands.acquire(); if (acc) { - sLog->outError("ACSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno); + LOG_ERROR("server", "ACSoap: Error while acquiring lock, acc = %i, errno = %u", acc, errno); } // alright, command finished diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 6d13f48eff..f29598a8cb 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -8,6 +8,8 @@ /// @{ /// \file +#include "AppenderDB.h" +#include "Banner.h" #include "Common.h" #include "Configuration/Config.h" #include "Database/DatabaseEnv.h" @@ -35,10 +37,6 @@ char serviceDescription[] = "AzerothCore World of Warcraft emulator world servic int m_ServiceStatus = -1; #endif -WorldDatabaseWorkerPool WorldDatabase; ///< Accessor to the world database -CharacterDatabaseWorkerPool CharacterDatabase; ///< Accessor to the character database -LoginDatabaseWorkerPool LoginDatabase; ///< Accessor to the realm/login database - uint32 realmID; ///< Id of the realm /// Print out the usage string for this program on the console. @@ -122,9 +120,21 @@ extern int main(int argc, char** argv) if (!sConfigMgr->LoadAppConfigs()) return 1; - sLog->outString("Using configuration file %s.", configFile.c_str()); - sLog->outString("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); - sLog->outString("Using ACE version: %s", ACE_VERSION); + sLog->RegisterAppender(); + sLog->Initialize(); + + acore::Banner::Show("worldserver-daemon", + [](char const* text) + { + LOG_INFO("server.worldserver", "%s", text); + }, + []() + { + LOG_INFO("server.worldserver", "> Using configuration file %s.", sConfigMgr->GetFilename().c_str()); + LOG_INFO("server.worldserver", "> Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); + LOG_INFO("server.worldserver", "> Using ACE version: %s", ACE_VERSION); + } + ); ///- and run the 'Master' /// @todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd? diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 792f3033db..5156d38925 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -48,22 +48,18 @@ void HandleSignal(int sigNum) { switch (sigNum) { - case SIGINT: - World::StopNow(RESTART_EXIT_CODE); - break; - case SIGTERM: + case SIGINT: + World::StopNow(RESTART_EXIT_CODE); + break; + case SIGTERM: #if AC_PLATFORM == AC_PLATFORM_WINDOWS - case SIGBREAK: - if (m_ServiceStatus != 1) + case SIGBREAK: + if (m_ServiceStatus != 1) #endif - World::StopNow(SHUTDOWN_EXIT_CODE); - break; - /*case SIGSEGV: - sLog->outString("ZOMG! SIGSEGV handled!"); - World::StopNow(SHUTDOWN_EXIT_CODE); - break;*/ - default: - break; + World::StopNow(SHUTDOWN_EXIT_CODE); + break; + default: + break; } } @@ -82,7 +78,7 @@ public: if (!_delayTime) return; - sLog->outString("Starting up anti-freeze thread (%u seconds max stuck time)...", _delayTime / 1000); + LOG_INFO("server", "Starting up anti-freeze thread (%u seconds max stuck time)...", _delayTime / 1000); while (!World::IsStopped()) { uint32 curtime = getMSTime(); @@ -93,13 +89,13 @@ public: } else if (getMSTimeDiff(_lastChange, curtime) > _delayTime) { - sLog->outString("World Thread hangs, kicking out server!"); + LOG_INFO("server", "World Thread hangs, kicking out server!"); ABORT(); } acore::Thread::Sleep(1000); } - sLog->outString("Anti-freeze thread exiting without problems."); + LOG_INFO("server", "Anti-freeze thread exiting without problems."); } }; @@ -116,33 +112,15 @@ int Master::Run() BigNumber seed1; seed1.SetRand(16 * 8); - sLog->outString("%s (worldserver-daemon)", GitRevision::GetFullVersion()); - sLog->outString(" to stop.\n"); - - 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"); - /// worldserver PID file creation std::string pidFile = sConfigMgr->GetOption("PidFile", ""); if (!pidFile.empty()) { if (uint32 pid = CreatePIDFile(pidFile)) - sLog->outError("Daemon PID: %u\n", pid); // outError for red color in console + LOG_ERROR("server", "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", "Cannot create PID file %s (possible error: permission)\n", pidFile.c_str()); return 1; } } @@ -214,20 +192,20 @@ int Master::Run() ULONG_PTR currentAffinity = affinity & appAff; // remove non accessible processors if (!currentAffinity) - sLog->outError("Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff); + LOG_ERROR("server", "Processors marked in UseProcessors bitmask (hex) %x are not accessible for the worldserver. Accessible processors bitmask (hex): %x", affinity, appAff); else if (SetProcessAffinityMask(hProcess, currentAffinity)) - sLog->outString("Using processors (bitmask, hex): %x", currentAffinity); + LOG_INFO("server", "Using processors (bitmask, hex): %x", currentAffinity); else - sLog->outError("Can't set used processors (hex): %x", currentAffinity); + LOG_ERROR("server", "Can't set used processors (hex): %x", currentAffinity); } } if (highPriority) { if (SetPriorityClass(hProcess, HIGH_PRIORITY_CLASS)) - sLog->outString("worldserver process priority class set to HIGH"); + LOG_INFO("server", "worldserver process priority class set to HIGH"); else - sLog->outError("Can't set worldserver process priority class."); + LOG_ERROR("server", "Can't set worldserver process priority class."); } #else // Linux @@ -242,21 +220,21 @@ int Master::Run() 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", "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", "Using processors (bitmask, hex): %lx", *(__cpu_mask*)(&mask)); } } if (highPriority) { if (setpriority(PRIO_PROCESS, 0, PROCESS_HIGH_PRIORITY)) - sLog->outError("Can't set worldserver process priority class, error: %s", strerror(errno)); + LOG_ERROR("server", "Can't set worldserver process priority class, error: %s", strerror(errno)); else - sLog->outString("worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); + LOG_INFO("server", "worldserver process priority class set to %i", getpriority(PRIO_PROCESS, 0)); } #endif @@ -285,7 +263,7 @@ int Master::Run() std::string bindIp = sConfigMgr->GetOption("BindIP", "0.0.0.0"); if (sWorldSocketMgr->StartNetwork(worldPort, bindIp.c_str()) == -1) { - sLog->outError("Failed to start network"); + LOG_ERROR("server", "Failed to start network"); World::StopNow(ERROR_EXIT_CODE); // go down and shutdown the server } @@ -293,7 +271,7 @@ int Master::Run() // set server online (allow connecting now) LoginDatabase.DirectPExecute("UPDATE realmlist SET flag = flag & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID); - sLog->outString("%s (worldserver-daemon) ready...", GitRevision::GetFullVersion()); + LOG_INFO("server", "%s (worldserver-daemon) ready...", GitRevision::GetFullVersion()); // when the main thread closes the singletons get unloaded // since worldrunnable uses them, it will crash if unloaded after master @@ -322,7 +300,7 @@ int Master::Run() _StopDB(); - sLog->outString("Halting process..."); + LOG_INFO("server", "Halting process..."); if (cliThread) { @@ -388,8 +366,6 @@ bool Master::_StartDB() { MySQL::Library_Init(); - sLog->SetLogDB(false); - // Load databases DatabaseLoader loader; loader @@ -404,7 +380,7 @@ bool Master::_StartDB() realmID = sConfigMgr->GetOption("RealmID", 0); if (!realmID) { - sLog->outError("Realm ID not defined in configuration file"); + LOG_ERROR("server", "Realm ID not defined in configuration file"); return false; } else if (realmID > 255) @@ -414,13 +390,11 @@ bool Master::_StartDB() * with a size of uint8 we can "only" store up to 255 realms * anything further the client will behave anormaly */ - sLog->outError("Realm ID must range from 1 to 255"); + LOG_ERROR("server", "Realm ID must range from 1 to 255"); return false; } - sLog->outString("Realm running as realm ID %d", realmID); - ///- Initialize the DB logging system - sLog->SetRealmID(realmID); + LOG_INFO("server", "Realm running as realm ID %d", realmID); ///- Clean the database before starting ClearOnlineAccounts(); @@ -430,7 +404,7 @@ bool Master::_StartDB() sWorld->LoadDBVersion(); - sLog->outString("Using World DB: %s", sWorld->GetDBVersion()); + LOG_INFO("server", "Using World DB: %s", sWorld->GetDBVersion()); return true; } diff --git a/src/server/worldserver/RemoteAccess/RARunnable.cpp b/src/server/worldserver/RemoteAccess/RARunnable.cpp index c9dec3d7d7..3a6ac6921e 100644 --- a/src/server/worldserver/RemoteAccess/RARunnable.cpp +++ b/src/server/worldserver/RemoteAccess/RARunnable.cpp @@ -54,11 +54,11 @@ void RARunnable::run() if (acceptor.open(listenAddress, m_Reactor) == -1) { - sLog->outError("Trinity RA can not bind to port %d on %s (possible error: port already in use)", raPort, stringIp.c_str()); + LOG_ERROR("server", "Trinity RA can not bind to port %d on %s (possible error: port already in use)", raPort, stringIp.c_str()); return; } - sLog->outString("Starting Trinity RA on port %d on %s", raPort, stringIp.c_str()); + LOG_INFO("server", "Starting Trinity RA on port %d on %s", raPort, stringIp.c_str()); while (!World::IsStopped()) { @@ -68,6 +68,6 @@ void RARunnable::run() } #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) - sLog->outStaticDebug("Trinity RA thread exiting"); + LOG_DEBUG("server", "Trinity RA thread exiting"); #endif } diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index d9a5292bbf..3f73801e7f 100644 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -33,18 +33,18 @@ int RASocket::open(void*) if (peer().get_remote_addr(remoteAddress) == -1) { - sLog->outError("RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno)); + LOG_ERROR("server", "RASocket::open: peer().get_remote_addr error is %s", ACE_OS::strerror(errno)); return -1; } - sLog->outRemote("Incoming connection from %s", remoteAddress.get_host_addr()); + LOG_INFO("network", "Incoming connection from %s", remoteAddress.get_host_addr()); return activate(); } int RASocket::handle_close(ACE_HANDLE /*handle*/, ACE_Reactor_Mask /*mask*/) { - sLog->outRemote("Closing connection"); + LOG_INFO("network", "Closing connection"); peer().close_reader(); wait(); // While the above wait() will wait for the ::svc() to finish, it will not wait for the async event @@ -120,7 +120,7 @@ int RASocket::recv_line(std::string& out_line) if (recv_line(message_block) == -1) { - sLog->outRemote("Recv error %s", ACE_OS::strerror(errno)); + LOG_INFO("network", "Recv error %s", ACE_OS::strerror(errno)); return -1; } @@ -134,7 +134,7 @@ int RASocket::process_command(const std::string& command) if (command.length() == 0) return 0; - sLog->outRemote("Got command: %s", command.c_str()); + LOG_INFO("network", "Got command: %s", command.c_str()); // handle quit, exit and logout commands to terminate connection if (command == "quit" || command == "exit" || command == "logout") @@ -184,7 +184,7 @@ int RASocket::check_access_level(const std::string& user) if (!result) { - sLog->outRemote("User %s does not exist in database", user.c_str()); + LOG_INFO("network", "User %s does not exist in database", user.c_str()); return -1; } @@ -192,12 +192,12 @@ int RASocket::check_access_level(const std::string& user) if (fields[1].GetUInt8() < _minLevel) { - sLog->outRemote("User %s has no privilege to login", user.c_str()); + LOG_INFO("network", "User %s has no privilege to login", user.c_str()); return -1; } else if (fields[2].GetInt32() != -1) { - sLog->outRemote("User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); + LOG_INFO("network", "User %s has to be assigned on all realms (with RealmID = '-1')", user.c_str()); return -1; } @@ -225,7 +225,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass) return 0; } - sLog->outRemote("Wrong password for user: %s", user.c_str()); + LOG_INFO("commands.ra", "Wrong password for user: %s", user.c_str()); return -1; } @@ -245,7 +245,7 @@ int RASocket::authenticate() if (recv_line(pass) == -1) return -1; - sLog->outRemote("Login attempt for user: %s", user.c_str()); + LOG_INFO("network", "Login attempt for user: %s", user.c_str()); if (check_access_level(user) == -1) return -1; @@ -253,7 +253,7 @@ int RASocket::authenticate() if (check_password(user, pass) == -1) return -1; - sLog->outRemote("User login: %s", user.c_str()); + LOG_INFO("network", "User login: %s", user.c_str()); return 0; } @@ -286,7 +286,7 @@ int RASocket::subnegotiate() if (n >= 1024) { - sLog->outRemote("RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); + LOG_INFO("network", "RASocket::subnegotiate: allocated buffer 1024 bytes was too small for negotiation packet, size: %u", uint32(n)); return -1; } @@ -320,7 +320,7 @@ int RASocket::subnegotiate() uint8 param = buf[++i]; ss << uint32(param); - sLog->outRemote(ss.str().c_str()); + LOG_INFO("network", ss.str().c_str()); } ++i; } @@ -386,7 +386,7 @@ void RASocket::zprint(void* callbackArg, const char* szText) ACE_Time_Value tv = ACE_Time_Value::zero; if (socket->putq(mb, &tv) == -1) { - sLog->outRemote("Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno)); + LOG_INFO("network", "Failed to enqueue message, queue is full or closed. Error is %s", ACE_OS::strerror(errno)); mb->release(); } } @@ -407,7 +407,7 @@ void RASocket::commandFinished(void* callbackArg, bool /*success*/) if (socket->putq(mb->duplicate()) == -1) { // getting here is bad, command can't be marked as complete - //sLog->outDebug(LOG_FILTER_REMOTECOMMAND, "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno)); + //LOG_DEBUG("misc", "Failed to enqueue command end message. Error is %s", ACE_OS::strerror(errno)); } mb->release(); diff --git a/src/server/worldserver/WorldThread/WorldRunnable.cpp b/src/server/worldserver/WorldThread/WorldRunnable.cpp index 0168d7e17e..8f4fa92738 100644 --- a/src/server/worldserver/WorldThread/WorldRunnable.cpp +++ b/src/server/worldserver/WorldThread/WorldRunnable.cpp @@ -64,8 +64,6 @@ void WorldRunnable::run() #endif } - sLog->SetLogDB(false); - sScriptMgr->OnShutdown(); sWorld->KickAll(); // save and kick all players @@ -87,7 +85,7 @@ void WorldRunnable::run() void AuctionListingRunnable::run() { - sLog->outString("Starting up Auction House Listing thread..."); + LOG_INFO("server", "Starting up Auction House Listing thread..."); while (!World::IsStopped()) { if (AsyncAuctionListingMgr::IsAuctionListingAllowed()) @@ -97,10 +95,10 @@ void AuctionListingRunnable::run() if (AsyncAuctionListingMgr::GetTempList().size() || AsyncAuctionListingMgr::GetList().size()) { - ACORE_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetLock()); + std::lock_guard guard(AsyncAuctionListingMgr::GetLock()); { - ACORE_GUARD(ACE_Thread_Mutex, AsyncAuctionListingMgr::GetTempLock()); + std::lock_guard guard(AsyncAuctionListingMgr::GetTempLock()); for (std::list::iterator itr = AsyncAuctionListingMgr::GetTempList().begin(); itr != AsyncAuctionListingMgr::GetTempList().end(); ++itr) AsyncAuctionListingMgr::GetList().push_back( (*itr) ); AsyncAuctionListingMgr::GetTempList().clear(); @@ -125,5 +123,5 @@ void AuctionListingRunnable::run() } acore::Thread::Sleep(1); } - sLog->outString("Auction House Listing thread exiting without problems."); + LOG_INFO("server", "Auction House Listing thread exiting without problems."); } diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index b7f0542131..bf74feac16 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -61,7 +61,7 @@ RealmID = 1 # DataDir # Description: Data directory setting. # Important: DataDir needs to be quoted, as the string might contain space characters. -# Example: "/home/youruser/azeroth-server/data" +# Example: "/home/youruser/azerothcore/data" # Default: "." DataDir = "." @@ -71,7 +71,7 @@ DataDir = "." # Description: Logs directory setting. # Important: LogsDir needs to be quoted, as the string might contain space characters. # Logs directory must exists, or log file creation will be disabled. -# Example: "/home/youruser/azeroth-server/logs" +# Example: "/home/youruser/azerothcore/logs" # Default: "" - (Log files will be stored in the current path) LogsDir = "" @@ -449,246 +449,6 @@ SetAllCreaturesWithWaypointMovementActive = 0 PidFile = "" -# -# LogLevel -# Description: Server console level of logging -# Default: 1 - (Basic) -# 0 - (Minimum) -# 2 - (Detail) -# 3 - (Full/Debug) - -LogLevel = 1 - -# -# LogFile -# Description: Log file for main server log. -# Default: "Server.log" - (Enabled) -# "" - (Disabled) - -LogFile = "Server.log" - -# -# 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 - -# -# Debug Log Mask -# Description: Bitmask that determines which debug log output (level 3) -# will be logged. -# Possible flags: -# 1 - Anything related to units that doesn't fit in other -# categories. -# 2 - Anything related to pets. -# 4 - Anything related to vehicles. -# 8 - Anything related to C++ AI, instance scripts, etc. -# 16 - Anything related to DB AI, such as SAI, EAI, CreatureAI -# 32 - Anything related to DB map scripts -# 64 - Anything related to network input/output, -# such as packet handlers and netcode logs -# 128 - Anything related to the spellsystem and aurasystem -# 256 - Anything related to the achievement system -# 512 - Anything related to the condition system -# 1024 - Anything related to the pool system -# 2048 - Anything related to the auction house -# 4096 - Anything related to arena's and battlegrounds -# 8192 - Anything related to outdoor PVP -# 16384 - Anything related to the chat system -# 32768 - Anything related to the LFG system -# 65536 - Anything related to maps, instances (not scripts), -# grids, cells, visibility, etc. -# 131072 - Anything related to player loading from DB -# (Player::_LoadXXX functions) -# 262144 - Anything related to items -# 524288 - Anything related to player skills -# (do not confuse with spells) -# 1048576 - Anything related to loot -# 2097152 - Anything related to guilds -# 4194304 - Anything related to transports -# 8388608 - Anything related to Warden anti cheat -# 67108864 - Whenever KickPlayer() or CloseSocket() are called -# -# Simply add the values together to create a bitmask. -# For more info see enum DebugLogFilters in Log.h -# -# Default: 0 (nothing) - -DebugLogMask = 0 - -# -# PacketLogFile -# Description: Binary packet logging file for the world server. -# Filename extension must be .bin to be parsable with WowPacketParser. -# Example: "World.bin" - (Enabled) -# Default: "" - (Disabled) - -PacketLogFile = "" - -# -# DBErrorLogFile -# Description: Log file for database errors. -# Default: "DBErrors.log" - (Enabled) -# "" - (Disabled) - -DBErrorLogFile = "DBErrors.log" - -# -# CharLogFile -# Description: Log file for character operations -# Default: "Char.log" - (Enabled) -# "" - (Disabled) - -CharLogFile = "Char.log" - -# -# CharLogTimestamp -# Description: Append timestamp to the character log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# Default: 0 - (Disabled) -# 1 - (Enabled) - -CharLogTimestamp = 0 - -# -# CharLogDump -# Description: Write a character dump in the CharLogFile before deleting it. -# For restoration, copy character data from log file starting from -# line == START DUMP == to line == END DUMP == (exclusive) -# and load it using the "pdump load" command. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -CharLogDump = 0 - -# -# CharLogDump.Separate -# Description: Write character dump to separate files files rather than adding it to the -# CharLogFile. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -CharLogDump.Separate = 0 - -# -# CharLogDump.SeparateDir -# Description: Write dump files into the sub folder within the log folder. -# Example: "chardumps" - (Enabled) -# Default: "" - (Disabled) - -CharLogDump.SeparateDir = "" - -# -# GmLogFile -# Description: Log file for gamemaster commands. -# Default: "GM.log" - (Enabled) -# "" - (Disabled) - -GmLogFile = "GM.log" - -# -# GmLogTimestamp -# Description: Append timestamp to the gamemaster log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# Default: 0 - (Disabled) -# 1 - (Enabled) - -GmLogTimestamp = 0 - -# -# GmLogPerAccount -# Description: Create a log file per gamemaster account. -# Important: Logs not created if GmLogFile is not set. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -GmLogPerAccount = 0 - -# -# RaLogFile -# Description: Log file for Remote Access commands. -# Default: "RA.log" - (Enabled) -# "" - (Disabled) - -RaLogFile = "RA.log" - -# -# ArenaLogFile -# Description: Log file for arena fights and arena team creations. -# Example: "Arena.log" - (Enabled) -# Default: "" - (Disabled) - -ArenaLogFile = "" - -# -# ArenaLog.ExtendedInfo -# Description: Include extended info to ArenaLogFile for each player after rated arena -# matches (guid, name, team, IP, healing/damage done, killing blows). -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ArenaLog.ExtendedInfo = 0 - -# -# SQLDeveloperLogFile -# Description: Log file for core-generated SQL queries/dumps -# Example: "SQLDev.log" - (Enabled) -# Default: "" - (Disabled) - -SQLDeveloperLogFile = "" - -# -# SQLDriverLogFile -# Description: Log file for SQL driver events. -# Example: "WorldSQLDriver.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 - -# -# 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). @@ -696,146 +456,6 @@ LogColors = "" # 1 - (Enabled) EnableLogDB = 0 - -# -# DBLogLevel -# Description: Log level of databases logging. -# Default: 2 - (Detail) -# 0 - (Minimum) -# 1 - (Basic) -# 3 - (Full/Debug) - -DBLogLevel = 2 - -# -# LogDB.Char -# Description: Log character operations to database. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogDB.Char = 0 - -# -# LogDB.GM -# Description: Log gamemaster commands to database. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogDB.GM = 0 - -# -# LogDB.RA -# Description: Log remote access events to database. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogDB.RA = 0 - -# -# LogDB.World -# Description: Log world server packets to database. -# Default: 0 - (Disabled) -# 1 - (Enabled, May have performance impact) - -LogDB.World = 0 - -# -# LogDB.Chat -# Description: Log chat messages to database. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -LogDB.Chat = 0 - -# ChatLogFile -# Description: Log file for chat logs. -# Default: "Chat.log" - (Enabled) -# "" - (Disabled) - -ChatLogFile = "Chat.log" - -# ChatLogTimestamp -# Description: Append timestamp to the chat log file name. -# Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogTimestamp = 0 - -# -# ChatLogs.Channel -# Description: Log custom channel chat. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogs.Channel = 0 - -# -# ChatLogs.Whisper -# Description: Log whispers between players. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogs.Whisper = 0 - -# -# ChatLogs.SysChan -# Description: Log system channel messages. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogs.SysChan = 0 - -# -# ChatLogs.Party -# Description: Log party chat. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogs.Party = 0 - -# -# ChatLogs.Raid -# Description: Log raid chat. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogs.Raid = 0 - -# -# ChatLogs.Guild -# Description: Log guild chat. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogs.Guild = 0 - -# -# ChatLogs.Public -# Description: Log public chat (say/yell/emote). -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogs.Public = 0 - -# -# WARNING: enabling this might cause issues to your addon channel -# ChatLogs.Addon -# Description: Log addon messages. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogs.Addon = 0 - -# -# ChatLogs.BattleGround -# Description: Log battleground chat. -# Default: 0 - (Disabled) -# 1 - (Enabled) - -ChatLogs.BattleGround = 0 - -# ################################################################################################### ################################################################################################### @@ -1618,15 +1238,6 @@ Warden.NumLuaChecks = 1 Warden.NumOtherChecks = 7 -# -# Warden.LogFile -# Description: Client check fails will be logged here. -# Default: "" - (Disabled) -# "Warden.log" - (Enabled) -# - -Warden.LogFile = "" - # # Warden.ClientResponseDelay # Description: Time (in seconds) before client is getting disconnecting for not responding. @@ -3706,6 +3317,168 @@ FFAPvPTimer = 30 # ################################################################################################### +################################################################################################### +# 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,4,0,"1 9 3 6 5 8" +Appender.Server=2,5,0,Server.log,w +Appender.GM=2,5,15,gm_%s.log +Appender.DBErrors=2,5,0,DBErrors.log + +# 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=2,Console Server +Logger.server=4,Console Server +Logger.commands.gm=4,Console GM +Logger.scripts.hotswap=4,Console Server +Logger.sql.sql=2,Console DBErrors +Logger.sql.updates=4,Console Server +Logger.mmaps=4,Server + +#Logger.achievement=4,Console Server +#Logger.addon=4,Console Server +#Logger.ahbot=4,Console Server +#Logger.auctionHouse=4,Console Server +#Logger.bg.arena=4,Console Server +#Logger.bg.battlefield=4,Console Server +#Logger.bg.battleground=4,Console Server +#Logger.bg.reportpvpafk=4,Console Server +#Logger.chat.log=4,Console Server +#Logger.calendar=4,Console Server +#Logger.chat.system=4,Console Server +#Logger.cheat=4,Console Server +#Logger.commands.ra=4,Console Server +#Logger.condition=4,Console Server +#Logger.entities.faction=4,Console Server +#Logger.entities.gameobject=4,Console Server +#Logger.entities.pet=4,Console Server +#Logger.entities.player=4,Console Server +#Logger.entities.player.character=4,Console Server +#Logger.entities.player.dump=4,Console Server +#Logger.entities.player.items=4,Console Server +#Logger.entities.player.loading=4,Console Server +#Logger.entities.player.skills=4,Console Server +#Logger.entities.transport=4,Console Server +#Logger.entities.unit=4,Console Server +#Logger.entities.unit.ai=4,Console Server +#Logger.entities.vehicle=4,Console Server +#Logger.gameevent=4,Console Server +#Logger.guild=4,Console Server +#Logger.lfg=4,Console Server +#Logger.loot=4,Console Server +#Logger.maps.script=4,Console Server +#Logger.maps=4,Console Server +#Logger.misc=4,Console Server +#Logger.mmaps.tiles=4,Console Server +#Logger.movement.flightpath=4,Console Server +#Logger.movement.motionmaster=4,Console Server +#Logger.movement.splinechain=4,Console Server +#Logger.network=4,Console Server +#Logger.network.kick=4,Console Server +#Logger.network.opcode=4,Console Server +#Logger.network.soap=4,Console Server +#Logger.outdoorpvp=4,Console Server +#Logger.pool=4,Console Server +#Logger.rbac=4,Console Server +#Logger.scripts=4,Console Server +#Logger.scripts.ai=4,Console Server +#Logger.scripts.ai.escortai=4,Console Server +#Logger.scripts.ai.followerai=4,Console Server +#Logger.scripts.ai.petai=4,Console Server +#Logger.scripts.ai.sai=4,Console Server +#Logger.scripts.cos=4,Console Server +#Logger.server.authserver=4,Console Server +#Logger.spells=4,Console Server +#Logger.spells.aura.effect=4,Console Server +#Logger.spells.aura.effect.nospell=4,Console Server +#Logger.spells.effect=4,Console Server +#Logger.spells.effect.nospell=4,Console Server +#Logger.sql.dev=4,Console Server +#Logger.sql.driver=4,Console Server +#Logger.warden=4,Console Server +#Logger.vehicles=4,Console Server +################################################################################################### + ################################################################################################### # PACKET SPOOF PROTECTION SETTINGS # diff --git a/src/test/mocks/LogMock.h b/src/test/mocks/LogMock.h deleted file mode 100644 index 53851e1bd0..0000000000 --- a/src/test/mocks/LogMock.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2016+ AzerothCore , released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3 - */ - -#ifndef AZEROTHCORE_LOGMOCK_H -#define AZEROTHCORE_LOGMOCK_H - -#include "gmock/gmock.h" -#include "ILog.h" - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-parameter" - -LoginDatabaseWorkerPool LoginDatabase; - -class LogMock: public ILog { -public: - ~LogMock() override {} - MOCK_METHOD(void, Initialize, ()); - MOCK_METHOD(void, ReloadConfig, ()); - MOCK_METHOD(void, InitColors, (const std::string& init_str)); - void SetColor(bool stdout_stream, ColorTypes color) override {} - MOCK_METHOD(void, ResetColor, (bool stdout_stream)); - MOCK_METHOD(void, outDB, (LogTypes type, const char* str)); - void outString(const char* str, ...) override {} - MOCK_METHOD(void, outString, ()); - void outStringInLine(const char* str, ...) override {} - MOCK_METHOD(void, outErrorMock, ()); // because outError has variadic type and cannot be directly mocked - void outError(const char* err, ...) override { outErrorMock(); } - void outCrash(const char* err, ...) override {} - void outBasic(const char* str, ...) override {} - void outDetail(const char* str, ...) override {} - void outSQLDev(const char* str, ...) override {} - void outDebug(DebugLogFilters f, const char* str, ...) override {} - void outStaticDebug(const char* str, ...) override {} - void outErrorDb(const char* str, ...) override {} - void outChar(const char* str, ...) override {} - void outCommand(uint32 account, const char* str, ...) override {} - void outChat(const char* str, ...) override {} - void outRemote(const char* str, ...) override {} - void outSQLDriver(const char* str, ...) override {} - void outMisc(const char* str, ...) override {} - void outCharDump(const char* str, uint32 account_id, uint32 guid, const char* name) override {} - MOCK_METHOD(void, SetLogLevel, (char* Level)); - MOCK_METHOD(void, SetLogFileLevel, (char* Level)); - MOCK_METHOD(void, SetSQLDriverQueryLogging, (bool newStatus)); - MOCK_METHOD(void, SetRealmID, (uint32 id)); - MOCK_METHOD(bool, IsOutDebug, (), (const)); - MOCK_METHOD(bool, IsOutCharDump, (), (const)); - MOCK_METHOD(bool, GetLogDB, (), (const)); - MOCK_METHOD(void, SetLogDB, (bool enable)); - MOCK_METHOD(bool, GetSQLDriverQueryLogging, (), (const)); -}; -#pragma GCC diagnostic pop - -#endif //AZEROTHCORE_LOGMOCK_H diff --git a/src/test/mocks/WorldMock.h b/src/test/mocks/WorldMock.h index e328cfa9fd..4759f10736 100644 --- a/src/test/mocks/WorldMock.h +++ b/src/test/mocks/WorldMock.h @@ -12,8 +12,6 @@ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" -CharacterDatabaseWorkerPool CharacterDatabase; -WorldDatabaseWorkerPool WorldDatabase; uint32 realmID; void AddScripts() {} bool ArenaSpectator::HandleSpectatorSpectateCommand(ChatHandler* handler, char const* args) { return false; } diff --git a/src/test/server/game/Miscellaneous/FormulasTest.cpp b/src/test/server/game/Miscellaneous/FormulasTest.cpp index d9c70fdbac..42bf181af3 100644 --- a/src/test/server/game/Miscellaneous/FormulasTest.cpp +++ b/src/test/server/game/Miscellaneous/FormulasTest.cpp @@ -4,7 +4,6 @@ #include "Formulas.h" #include "gtest/gtest.h" -#include "LogMock.h" #include "WorldMock.h" using namespace acore::Honor; @@ -77,9 +76,6 @@ TEST(FormulasTest, GetZeroDifference) TEST(FormulasTest, BaseGain) { - auto logMock = new LogMock(); - sLog.reset(logMock); - EXPECT_EQ(BaseGain(60, 40, CONTENT_1_60), 0); EXPECT_EQ(BaseGain(60, 60, CONTENT_1_60), 345); EXPECT_EQ(BaseGain(50, 60, CONTENT_1_60), 354); @@ -87,7 +83,6 @@ TEST(FormulasTest, BaseGain) EXPECT_EQ(BaseGain(79, 78, CONTENT_71_80), 917); // check outError() has been called after passing an invalid ContentLevels content - EXPECT_CALL(*logMock, outErrorMock()).Times(1); EXPECT_EQ(BaseGain(79, 1, ContentLevels(999)), 0); } diff --git a/src/tools/map_extractor/wdt.cpp b/src/tools/map_extractor/wdt.cpp index 62cede17c3..5656d73ecc 100644 --- a/src/tools/map_extractor/wdt.cpp +++ b/src/tools/map_extractor/wdt.cpp @@ -66,7 +66,7 @@ bool WDT_file::prepareLoadedData() if (!main->prepareLoadedData()) return false; wmo = (wdt_MWMO*)((uint8*)main + main->size + 8); - if (!wmo->prepareLoadedData()) - return false; + // if (!wmo->prepareLoadedData()) + // return false; return true; } diff --git a/src/tools/mmaps_generator/PathCommon.h b/src/tools/mmaps_generator/PathCommon.h index 36e4974215..7aae074488 100644 --- a/src/tools/mmaps_generator/PathCommon.h +++ b/src/tools/mmaps_generator/PathCommon.h @@ -20,8 +20,6 @@ #include #endif -#include "Database/DatabaseEnv.h" - enum NavTerrain { NAV_EMPTY = 0x00, diff --git a/src/tools/mmaps_generator/VMapExtensions.cpp b/src/tools/mmaps_generator/VMapExtensions.cpp index 9afcb58996..29970ae15c 100644 --- a/src/tools/mmaps_generator/VMapExtensions.cpp +++ b/src/tools/mmaps_generator/VMapExtensions.cpp @@ -10,10 +10,6 @@ #include "WorldModel.h" #include "ModelInstance.h" -#include "Database/DatabaseEnv.h" -LoginDatabaseWorkerPool LoginDatabase; -WorldDatabaseWorkerPool WorldDatabase; - namespace VMAP { // Need direct access to encapsulated VMAP data, so we add functions for MMAP generator