diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 15221f1aa..a7cc6c681 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -49,5 +49,5 @@ // "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" + "remoteUser": "root" } diff --git a/.editorconfig b/.editorconfig index 4a0e9e614..66e87791e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,7 +7,7 @@ insert_final_newline = true trim_trailing_whitespace = true max_line_length = 80 -[*.{json,ts,js}] +[*.{json,ts,js,yml}] charset = utf-8 indent_style = space indent_size = 2 diff --git a/.github/workflows/build_dbimport.yml b/.github/workflows/build_dbimport.yml index c4016339e..45d988ff8 100644 --- a/.github/workflows/build_dbimport.yml +++ b/.github/workflows/build_dbimport.yml @@ -21,6 +21,7 @@ jobs: name: ${{ matrix.compiler }} env: COMPILER: ${{ matrix.compiler }} + if: github.repository == 'azerothcore/azerothcore-wotlk' && !github.event.pull_request.draft steps: - uses: actions/checkout@v2 - name: Cache diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index 7c43a1bb7..53135ab89 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -21,7 +21,7 @@ jobs: name: ${{ matrix.os }}-${{ matrix.compiler }} env: COMPILER: ${{ matrix.compiler }} - if: github.repository == 'azerothcore/azerothcore-wotlk' + if: github.repository == 'azerothcore/azerothcore-wotlk' && !github.event.pull_request.draft steps: - uses: actions/checkout@v2 - name: Cache diff --git a/.github/workflows/core_matrix_build.yml b/.github/workflows/core_matrix_build.yml index a0f4d47f9..e0f6e40ac 100644 --- a/.github/workflows/core_matrix_build.yml +++ b/.github/workflows/core_matrix_build.yml @@ -29,7 +29,16 @@ jobs: name: ${{ matrix.os }}-${{ matrix.compiler }} env: COMPILER: ${{ matrix.compiler }} - if: github.repository == 'azerothcore/azerothcore-wotlk' && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'file-cpp') || github.event.label.name == 'file-cpp' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') + if: | + github.repository == 'azerothcore/azerothcore-wotlk' + && !github.event.pull_request.draft + && ( + github.ref == 'refs/heads/master' + || contains(github.event.pull_request.labels.*.name, 'file-cpp' + || github.event.label.name == 'file-cpp' + || contains(github.event.pull_request.labels.*.name, 'run-build') + || github.event.label.name == 'run-build') + ) steps: - uses: actions/checkout@v2 - name: Cache diff --git a/.github/workflows/core_modules_build.yml b/.github/workflows/core_modules_build.yml index 7003d96f9..6f50e7306 100644 --- a/.github/workflows/core_modules_build.yml +++ b/.github/workflows/core_modules_build.yml @@ -23,7 +23,16 @@ jobs: name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.modules }}-modules env: COMPILER: ${{ matrix.compiler }} - if: github.repository == 'azerothcore/azerothcore-wotlk' && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'file-cpp') || github.event.label.name == 'file-cpp' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') + if: | + github.repository == 'azerothcore/azerothcore-wotlk' + && !github.event.pull_request.draft + && ( + github.ref == 'refs/heads/master' + || contains(github.event.pull_request.labels.*.name, 'file-cpp' + || github.event.label.name == 'file-cpp' + || contains(github.event.pull_request.labels.*.name, 'run-build') + || github.event.label.name == 'run-build') + ) steps: - uses: actions/checkout@v2 - name: Checkout modules diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 1c91ef860..c11c067da 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -11,13 +11,16 @@ concurrency: cancel-in-progress: true jobs: - docker-build-n-deploy: + docker-build-n-deploy-dev: strategy: fail-fast: true matrix: os: [ubuntu-20.04] runs-on: ${{ matrix.os }} - if: github.repository == 'azerothcore/azerothcore-wotlk' && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') + if: | + github.repository == 'azerothcore/azerothcore-wotlk' + && !github.event.pull_request.draft + && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') env: COMPOSE_DOCKER_CLI_BUILD: 1 DOCKER_BUILDKIT: 1 @@ -40,13 +43,8 @@ jobs: docker --version docker compose --version - # TODO: make it work - # - uses: whoan/docker-build-with-cache-action@v5 - # with: - # image_tag: master - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_TOKEN }} - # compose_file: docker-compose.yml + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - name: Login to Docker Hub if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master' @@ -55,20 +53,21 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - # before cache - # needed to avoid ccache injected into these images - name: Build Dev if: github.repository == 'azerothcore/azerothcore-wotlk' env: #DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }} - DOCKER_EXTENDS_BIND: abstract-no-bind DOCKER_CLIENT_TIMEOUT: 400 COMPOSE_HTTP_TIMEOUT: 400 run: | + export CACHEBUST=$EPOCHSECONDS export DOCKER_USER_ID=$(id -u) export DOCKER_GROUP_ID=$(id -u) + # pull the images first to load the docker cache layers + ./acore.sh docker pull ./acore.sh docker build + output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "} + DOCKER_IMAGE_TAG=$version docker compose --profile dev --profile local build - name: Deploy Dev #env: @@ -76,6 +75,50 @@ jobs: if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master' run: | docker compose --profile dev --profile local push + output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "} + DOCKER_IMAGE_TAG=$version docker compose --profile dev --profile local push + + docker-build-n-deploy-prod: + strategy: + fail-fast: true + matrix: + os: [ubuntu-20.04] + runs-on: ${{ matrix.os }} + if: | + github.repository == 'azerothcore/azerothcore-wotlk' + && !github.event.pull_request.draft + && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') + env: + COMPOSE_DOCKER_CLI_BUILD: 1 + DOCKER_BUILDKIT: 1 + BUILDKIT_INLINE_CACHE: 1 + + steps: + - 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: | + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + docker --version + docker compose --version + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Docker Hub + if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Cache uses: actions/cache@v2 @@ -90,16 +133,19 @@ jobs: if: github.repository == 'azerothcore/azerothcore-wotlk' env: #DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }} - DOCKER_EXTENDS_BIND: abstract-no-bind - DOCKER_AC_BUILD_TARGET: build DOCKER_CLIENT_TIMEOUT: 220 COMPOSE_HTTP_TIMEOUT: 220 run: | export DOCKER_USER_ID=$(id -u) export DOCKER_GROUP_ID=$(id -u) + # pull the images first to load the docker cache layers + ./acore.sh docker prod:pull ./acore.sh docker prod:build - docker compose run --no-deps --name build ac-build echo "image created" - docker cp build:/azerothcore/var/ccache var/docker/ + output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "} + DOCKER_IMAGE_TAG=$version ./acore.sh docker prod:build + # create the container to allow the copy right after + docker compose create ac-build-prod + docker compose cp ac-build-prod:/azerothcore/var/ccache var/docker/ echo "ccache exported" - name: Deploy Production images @@ -108,3 +154,24 @@ jobs: if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master' run: | docker compose --profile prod push + output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "} + DOCKER_IMAGE_TAG=$version docker compose --profile prod push + + + dispatch-acore-docker: + needs: [ docker-build-n-deploy-prod , docker-build-n-deploy-dev] + runs-on: ubuntu-latest + steps: + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + - name: Repository Dispatch + if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master' + uses: peter-evans/repository-dispatch@v2 + with: + token: ${{ secrets.ACORE_DOCKER_REPO_ACCESS_TOKEN }} + repository: azerothcore/acore-docker + event-type: azerothcore-new-images + client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' diff --git a/.github/workflows/import_pending.yml b/.github/workflows/import_pending.yml index 60f211da7..c9a7ffaaf 100644 --- a/.github/workflows/import_pending.yml +++ b/.github/workflows/import_pending.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false runs-on: ubuntu-20.04 - if: github.repository == 'azerothcore/azerothcore-wotlk' + if: github.repository == 'azerothcore/azerothcore-wotlk' && !github.event.pull_request.draft steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/issue-labeler.yml b/.github/workflows/issue-labeler.yml index e91fda799..cc032a770 100644 --- a/.github/workflows/issue-labeler.yml +++ b/.github/workflows/issue-labeler.yml @@ -5,7 +5,7 @@ on: jobs: issue_labeler: - if: github.repository == 'azerothcore/azerothcore-wotlk' + if: github.repository == 'azerothcore/azerothcore-wotlk' && !github.event.pull_request.draft runs-on: ubuntu-latest name: Issue Labeler steps: diff --git a/.github/workflows/macos_build.yml b/.github/workflows/macos_build.yml index 5d58a15e6..984fe9132 100644 --- a/.github/workflows/macos_build.yml +++ b/.github/workflows/macos_build.yml @@ -20,7 +20,10 @@ jobs: - macos-12 runs-on: ${{ matrix.os }} name: ${{ matrix.os }} - if: github.repository == 'azerothcore/azerothcore-wotlk' && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') + if: | + github.repository == 'azerothcore/azerothcore-wotlk' + && !github.event.pull_request.draft + && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') steps: - uses: actions/checkout@v2 - name: Cache diff --git a/.github/workflows/tools_build.yml b/.github/workflows/tools_build.yml index 73aecd18b..242dea748 100644 --- a/.github/workflows/tools_build.yml +++ b/.github/workflows/tools_build.yml @@ -21,7 +21,7 @@ jobs: name: ${{ matrix.os }}-${{ matrix.compiler }} env: COMPILER: ${{ matrix.compiler }} - if: github.repository == 'azerothcore/azerothcore-wotlk' + if: github.repository == 'azerothcore/azerothcore-wotlk' && !github.event.pull_request.draft steps: - uses: actions/checkout@v2 - name: Cache diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index 527abc33e..04f42a702 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -20,7 +20,10 @@ jobs: name: ${{ matrix.os }} env: BOOST_ROOT: C:\local\boost_1_79_0 - if: github.repository == 'azerothcore/azerothcore-wotlk' && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') + if: | + github.repository == 'azerothcore/azerothcore-wotlk' + && !github.event.pull_request.draft + && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') steps: - uses: actions/checkout@v2 - name: Configure OS diff --git a/apps/bash_shared/common.sh b/apps/bash_shared/common.sh index c8d8880cf..027a49bed 100644 --- a/apps/bash_shared/common.sh +++ b/apps/bash_shared/common.sh @@ -9,7 +9,7 @@ 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 <$USER_CONF_PATH> has not been found, you should create and configure it." + echo "NOTICE: file <$USER_CONF_PATH> not found, we use default configuration only." fi # diff --git a/apps/ci/ci-conf-core.sh b/apps/ci/ci-conf-core.sh index 4fd3fa4c2..591ad7078 100644 --- a/apps/ci/ci-conf-core.sh +++ b/apps/ci/ci-conf-core.sh @@ -14,9 +14,6 @@ CBUILD_TESTING=ON CSCRIPTPCH=OFF CCOREPCH=OFF CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"' -DB_CHARACTERS_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" -DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" -DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" CONFIG_SH case $COMPILER in diff --git a/apps/ci/ci-conf-db.sh b/apps/ci/ci-conf-db.sh index e0fc17bce..2bcfb9deb 100644 --- a/apps/ci/ci-conf-db.sh +++ b/apps/ci/ci-conf-db.sh @@ -12,9 +12,6 @@ CTOOLS_BUILD=db-only CSCRIPTPCH=OFF CCOREPCH=OFF CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"' -DB_CHARACTERS_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" -DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" -DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" CONFIG_SH case $COMPILER in diff --git a/apps/ci/ci-install.sh b/apps/ci/ci-install.sh index c333d9685..ce0372cb8 100644 --- a/apps/ci/ci-install.sh +++ b/apps/ci/ci-install.sh @@ -14,9 +14,6 @@ CTOOLS=ON CSCRIPTPCH=OFF CCOREPCH=OFF CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"' -DB_CHARACTERS_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" -DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" -DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" CONFIG_SH time sudo apt-get update -y diff --git a/apps/compiler/compiler.sh b/apps/compiler/compiler.sh index 140d5fa97..dcb94a6b6 100755 --- a/apps/compiler/compiler.sh +++ b/apps/compiler/compiler.sh @@ -29,6 +29,7 @@ comp_options=( "compile: Compile only" "all: clean, configure and compile" "ccacheClean: Clean ccache files, normally not needed" + "ccacheShowStats: show ccache statistics" "quit: Close this menu") comp_functions=( "comp_build" @@ -37,6 +38,7 @@ comp_functions=( "comp_compile" "comp_all" "comp_ccacheClean" + "comp_ccacheShowStats" "comp_quit") PS3='[ Please enter your choice ]: ' diff --git a/apps/compiler/includes/functions.sh b/apps/compiler/includes/functions.sh index 842f65b85..25cc507bc 100644 --- a/apps/compiler/includes/functions.sh +++ b/apps/compiler/includes/functions.sh @@ -17,6 +17,8 @@ function comp_ccacheEnable() { export CCACHE_CPP2=${CCACHE_CPP2:-true} # optimization for clang export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1} export CCACHE_COMPRESSLEVEL=${CCACHE_COMPRESSLEVEL:-9} + export CCACHE_COMPILERCHECK=${CCACHE_COMPILERCHECK:-content} + export CCACHE_LOGFILE=${CCACHE_LOGFILE:-"$CCACHE_DIR/cache.debug"} #export CCACHE_NODIRECT=true export CCUSTOMOPTIONS="$CCUSTOMOPTIONS -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" @@ -106,6 +108,8 @@ function comp_compile() { cd $BUILDPATH + comp_ccacheEnable + comp_ccacheResetStats time cmake --build . --config $CTYPE -j $MTHREADS diff --git a/apps/docker/Dockerfile b/apps/docker/Dockerfile index c70a2b118..a425f174c 100644 --- a/apps/docker/Dockerfile +++ b/apps/docker/Dockerfile @@ -45,7 +45,11 @@ RUN addgroup --gid $GROUP_ID acore && \ # must be created to set the correct permissions on them RUN mkdir -p /azerothcore/env/dist/bin -RUN mkdir -p /azerothcore/env/dist/data +RUN mkdir -p /azerothcore/env/dist/data/Cameras +RUN mkdir -p /azerothcore/env/dist/data/dbc +RUN mkdir -p /azerothcore/env/dist/data/maps +RUN mkdir -p /azerothcore/env/dist/data/mmaps +RUN mkdir -p /azerothcore/env/dist/data/vmaps RUN mkdir -p /azerothcore/env/dist/logs RUN mkdir -p /azerothcore/env/dist/temp RUN mkdir -p /azerothcore/env/dist/etc @@ -59,10 +63,14 @@ RUN chown -R $DOCKER_USER:$DOCKER_USER /azerothcore USER $DOCKER_USER -# copy everything so we can work directly within the container -# using tools such as vscode dev-container -# NOTE: this folder is different by the /azerothcore (which is binded instead) -COPY --chown=$DOCKER_USER:$DOCKER_USER . /azerothcore +# copy only necessary files for the acore dashboard +COPY --chown=$DOCKER_USER:$DOCKER_USER apps /azerothcore/apps +COPY --chown=$DOCKER_USER:$DOCKER_USER bin /azerothcore/bin +COPY --chown=$DOCKER_USER:$DOCKER_USER conf /azerothcore/conf +COPY --chown=$DOCKER_USER:$DOCKER_USER data /azerothcore/data +COPY --chown=$DOCKER_USER:$DOCKER_USER deps /azerothcore/deps +COPY --chown=$DOCKER_USER:$DOCKER_USER acore.json /azerothcore/acore.json +COPY --chown=$DOCKER_USER:$DOCKER_USER acore.sh /azerothcore/acore.sh # Download deno and make sure the dashboard works RUN bash /azerothcore/acore.sh quit @@ -79,6 +87,13 @@ FROM base as dev LABEL description="AC dev image for dev containers" +USER $DOCKER_USER + +# copy everything so we can work directly within the container +# using tools such as vscode dev-container +# NOTE: this folder is different by the /azerothcore (which is binded instead) +COPY --chown=$DOCKER_USER:$DOCKER_USER . /azerothcore + #================================================================ # # SERVICE BASE: prepare the OS for the production-ready services @@ -115,26 +130,21 @@ RUN apt-get update && apt-get install -y dos2unix gdb gdbserver google-perftools # change timezone in container RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata -# copy the sources from the host machine -COPY --chown=$DOCKER_USER:$DOCKER_USER apps /azerothcore/apps -COPY --chown=$DOCKER_USER:$DOCKER_USER bin /azerothcore/bin -COPY --chown=$DOCKER_USER:$DOCKER_USER conf /azerothcore/conf -COPY --chown=$DOCKER_USER:$DOCKER_USER data /azerothcore/data -COPY --chown=$DOCKER_USER:$DOCKER_USER deps /azerothcore/deps -COPY --chown=$DOCKER_USER:$DOCKER_USER acore.json /azerothcore/acore.json -COPY --chown=$DOCKER_USER:$DOCKER_USER acore.sh /azerothcore/acore.sh - # Correct permissions for non-root operations RUN chown -R $DOCKER_USER:$DOCKER_USER /home/acore RUN chown -R $DOCKER_USER:$DOCKER_USER /run RUN chown -R $DOCKER_USER:$DOCKER_USER /opt -RUN chown $DOCKER_USER:$DOCKER_USER /azerothcore +COPY --chown=$DOCKER_USER:$DOCKER_USER --from=base /azerothcore /azerothcore USER $DOCKER_USER # must be created to avoid permissions errors -RUN mkdir -p /azerothcore/env/dist/data +RUN mkdir -p /azerothcore/env/dist/data/Cameras +RUN mkdir -p /azerothcore/env/dist/data/dbc +RUN mkdir -p /azerothcore/env/dist/data/maps +RUN mkdir -p /azerothcore/env/dist/data/mmaps +RUN mkdir -p /azerothcore/env/dist/data/vmaps RUN mkdir -p /azerothcore/env/dist/logs RUN mkdir -p /azerothcore/env/dist/etc RUN mkdir -p /azerothcore/env/dist/bin @@ -157,12 +167,16 @@ LABEL description="AC authserver image for local environment" CMD ./acore.sh run-authserver +USER $DOCKER_USER + FROM servicebase as worldserver-local LABEL description="AC worldserver image for local environment" CMD ./acore.sh run-worldserver +USER $DOCKER_USER + #================================================================ # # BUILD: compile sources @@ -171,12 +185,20 @@ CMD ./acore.sh run-worldserver FROM base as build ARG DOCKER_USER=acore +USER $DOCKER_USER LABEL description="AC Image used by the build stage to generate production images" RUN mkdir -p /azerothcore/env/etc/ +# .git is needed by the compiler +COPY --chown=$DOCKER_USER:$DOCKER_USER ./.git /azerothcore/.git +COPY --chown=$DOCKER_USER:$DOCKER_USER ./CMakeLists.txt /azerothcore/CMakeLists.txt +COPY --chown=$DOCKER_USER:$DOCKER_USER ./deps /azerothcore/deps +COPY --chown=$DOCKER_USER:$DOCKER_USER ./src /azerothcore/src +COPY --chown=$DOCKER_USER:$DOCKER_USER ./modules /azerothcore/modules # check if we have ccache files available outside +RUN rm -rf /azerothcore/var/ccache/* COPY --chown=$DOCKER_USER:$DOCKER_USER var/docker/ccache /azerothcore/var/ccache COPY --chown=$DOCKER_USER:$DOCKER_USER env/docker/etc/authserver.conf.dockerdist /azerothcore/env/dist/etc/authserver.conf.dockerdist COPY --chown=$DOCKER_USER:$DOCKER_USER env/docker/etc/worldserver.conf.dockerdist /azerothcore/env/dist/etc/worldserver.conf.dockerdist @@ -207,6 +229,7 @@ FROM authserver-local as authserver LABEL description="AC Production: authserver" ARG DOCKER_USER=acore +USER $DOCKER_USER COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/etc /azerothcore/env/dist/etc COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/authserver /azerothcore/env/dist/bin/authserver @@ -222,6 +245,7 @@ FROM worldserver-local as worldserver LABEL description="AC Production: worldserver" ARG DOCKER_USER=acore +USER $DOCKER_USER RUN mkdir -p /azerothcore/env/dist/bin/lua_scripts COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/etc /azerothcore/env/dist/etc @@ -255,13 +279,15 @@ RUN addgroup --gid $GROUP_ID acore && \ passwd -d acore && \ echo 'acore ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers +# ENV DATAPATH=/azerothcore/env/dist/data-temp ENV DATAPATH=/azerothcore/env/dist/data ENV DATAPATH_ZIP=/tmp/data.zip +RUN mkdir -p "$DATAPATH" +ARG CACHEBUST=1 +# RUN --mount=type=bind,target=/azerothcore-temp,readwrite --mount=type=cache,target=/azerothcore/env/dist/data-temp /azerothcore-temp/acore.sh client-data && cp -rT /azerothcore/env/dist/data-temp/ /azerothcore/env/dist/data && chown -R $DOCKER_USER:$DOCKER_USER /azerothcore RUN --mount=type=bind,target=/azerothcore-temp,readwrite /azerothcore-temp/acore.sh client-data && chown -R $DOCKER_USER:$DOCKER_USER /azerothcore -RUN apt-get remove --purge -y tzdata curl unzip && apt-get autoremove -y - USER $DOCKER_USER #================================================================ @@ -302,14 +328,14 @@ USER $DOCKER_USER WORKDIR /azerothcore/env/client/ +RUN mkdir -p /azerothcore/env/client/Cameras RUN mkdir -p /azerothcore/env/client/dbc RUN mkdir -p /azerothcore/env/client/maps RUN mkdir -p /azerothcore/env/client/mmaps RUN mkdir -p /azerothcore/env/client/vmaps -# Need fix -# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mapextractor /azerothcore/env/client/mapextractor -# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/client/mmaps_generator -# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4assembler /azerothcore/env/client/vmap4assembler -# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4extractor /azerothcore/env/client/vmap4extractor +COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/map_extractor /azerothcore/env/client/map_extractor +COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/client/mmaps_generator +COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4_assembler /azerothcore/env/client/vmap4_assembler +COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4_extractor /azerothcore/env/client/vmap4_extractor diff --git a/apps/docker/config-docker.sh b/apps/docker/config-docker.sh index 8c3ac4206..7f5482480 100644 --- a/apps/docker/config-docker.sh +++ b/apps/docker/config-docker.sh @@ -1,5 +1,7 @@ CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +CTOOLS_BUILD=all + # allow the user to override configs if [ -f "$AC_PATH_CONF/config.sh" ]; then source "$AC_PATH_CONF/config.sh" # should overwrite previous diff --git a/apps/docker/docker-cmd.ts b/apps/docker/docker-cmd.ts index ce03f34ce..43884f956 100644 --- a/apps/docker/docker-cmd.ts +++ b/apps/docker/docker-cmd.ts @@ -39,9 +39,19 @@ shellCommandFactory( "build", "Build the authserver and worldserver", [ - "docker compose --profile local build --parallel", + "docker compose --profile local --profile dev --profile dev-build build --parallel", + "docker image prune -f", + "docker compose run --rm --no-deps ac-dev-build bash apps/docker/docker-build-dev.sh", + ], + env +); + +shellCommandFactory( + "pull", + "Pull build and local images", + [ + "docker compose --profile local --profile dev --profile dev-build pull --parallel", "docker image prune -f", - "docker compose run --rm ac-build bash apps/docker/docker-build-dev.sh", ], env ); @@ -50,20 +60,9 @@ shellCommandFactory( "build:nocache", "Build the authserver and worldserver without docker cache", [ - "docker compose --profile local build --no-cache --parallel", + "docker compose --profile local --profile dev --profile dev-build build --no-cache --parallel", "docker image prune -f", - "docker compose run --rm ac-build bash apps/docker/docker-build-dev.sh", - ], - env -); - -shellCommandFactory( - "build:compile", - "Run the compilation process only, without rebuilding all docker images", - [ - "docker compose build --parallel ac-build", - "docker image prune -f", - "docker compose run --rm ac-build bash apps/docker/docker-build-dev.sh", + "docker compose run --rm --no-deps ac-dev-build bash apps/docker/docker-build-dev.sh", ], env ); @@ -73,7 +72,8 @@ shellCommandFactory( "Clean build files", [ "docker image prune -f", - `docker compose run --rm ac-build bash acore.sh compiler clean`, + `docker compose run --rm --no-deps ac-dev-server bash acore.sh compiler clean`, + `docker compose run --rm --no-deps ac-dev-server bash acore.sh compiler ccacheClean`, ], env ); @@ -81,7 +81,7 @@ shellCommandFactory( shellCommandFactory( "client-data", "Download client data inside the ac-data volume", - ["docker compose run --rm ac-build bash acore.sh client-data"], + ["docker compose run --rm --no-deps ac-dev-server bash acore.sh client-data"], env ); @@ -94,7 +94,7 @@ shellCommandFactory( shellCommandFactory( "dev:build", - "Build using the dev server, it uses volumes to compile which can be faster on linux & WSL", + "Build using the dev server", ["docker compose run --rm ac-dev-server bash acore.sh compiler build"], env ); @@ -118,28 +118,28 @@ shellCommandFactory( shellCommandFactory( "prod:build", - "Build producion services", + "[TEST ONLY] Build producion services", ["docker compose --profile prod build --parallel", "docker image prune -f"], env ); shellCommandFactory( "prod:pull", - "Pull production services from the remote registry", + "[TEST ONLY] Pull production services from the remote registry", ["docker compose --profile prod pull"], env ); shellCommandFactory( "prod:up", - "Start production services (foreground)", + "[TEST ONLY] Start production services (foreground)", ["docker compose --profile prod-app up"], env ); shellCommandFactory( "prod:up:d", - "Start production services (background)", + "[TEST ONLY] Start production services (background)", ["docker compose --profile prod-app up -d"], env ); @@ -176,7 +176,7 @@ program } services.pop(); - services = services.slice(2); + services = services.slice(1); res.close(); // Don't forget to close it @@ -304,8 +304,6 @@ async function checkDockerVersion() { } async function main() { - // Handle it however you like - // e.g. display usage while (true) { const version = await checkDockerVersion(); if (version !== true) { diff --git a/apps/installer/main.sh b/apps/installer/main.sh index 7475c8f2f..91d6cb1dc 100644 --- a/apps/installer/main.sh +++ b/apps/installer/main.sh @@ -67,7 +67,11 @@ function _switch() { DOCKER=1 denoRunFile "$AC_PATH_APPS/docker/docker-cmd.ts" "${@:2}" exit ;; - ""|"quit"|"14") + ""|"v"|"version"|"14") + denoRunFile "$AC_PATH_APPS/installer/main.ts" "version" + exit + ;; + ""|"quit"|"15") echo "Goodbye!" exit ;; diff --git a/apps/installer/main.ts b/apps/installer/main.ts new file mode 100644 index 000000000..135ccc645 --- /dev/null +++ b/apps/installer/main.ts @@ -0,0 +1,43 @@ +import { Command } from "https://cdn.deno.land/cmd/versions/v1.2.0/raw/mod.ts"; +import { getAcoreReleaseVersion } from "./utils.ts"; +import { Input } from "https://deno.land/x/cliffy@v0.25.2/prompt/mod.ts"; + +const program = new Command(); + +program + .name("acore.sh") + .description("Shell scripts for docker") + .version("1.0.0"); + +// program +// .command("quit") +// .description("Close docker command") +// .action(() => { +// process.exit(0); +// }); + +program + .command("version") + .description("Get the version of the current AzerothCore revision") + .action(async () => { + console.log(await getAcoreReleaseVersion()); + }); + +async function main() { + let exit = false; + do { + if (Deno.args.length === 0) { + program.outputHelp(); + const command = await Input.prompt({ + message: "Enter the command:", + }); + console.log(command); + await program.parseAsync(command.split(" ")); + } else { + exit = true; + await program.parseAsync(Deno.args); + process.exit(0); + } + } while (!exit); +} +main(); diff --git a/apps/installer/utils.ts b/apps/installer/utils.ts new file mode 100644 index 000000000..90d70ec6a --- /dev/null +++ b/apps/installer/utils.ts @@ -0,0 +1,17 @@ +import * as path from "https://deno.land/std/path/mod.ts"; +import makeloc from "https://deno.land/x/dirname@1.1.2/mod.ts"; + +const { __dirname } = makeloc(import.meta); + +// specify the needed paths here +const ACORE_JSON = path.resolve(__dirname + "/../../acore.json"); + +export async function getAcoreReleaseVersion() { + // read the acore.json file to work with the versioning + const decoder = new TextDecoder("utf-8"); + //console.debug(`Open ${ACORE_JSON}`) + const data = await Deno.readFile(ACORE_JSON); + const acoreInfo = JSON.parse(decoder.decode(data)); + + return `AzerothCore Rev. ${acoreInfo.version}`; +} diff --git a/conf/dist/env.ac b/conf/dist/env.ac index ed6169223..3f17c4d82 100644 --- a/conf/dist/env.ac +++ b/conf/dist/env.ac @@ -13,18 +13,6 @@ CTYPE=RelWithDebInfo CSCRIPTS=static AC_CCACHE=true -# -# 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 # diff --git a/conf/dist/env.docker b/conf/dist/env.docker index 61f8fd965..030f20d9f 100644 --- a/conf/dist/env.docker +++ b/conf/dist/env.docker @@ -5,10 +5,15 @@ DOCKER_AC_ENV_FILE= -DOCKER_VOL_DATA= +DOCKER_VOL_ROOT= +DOCKER_VOL_CONF= DOCKER_VOL_ETC= DOCKER_VOL_LOGS= -DOCKER_VOL_CONF= +DOCKER_VOL_DATA_CAMERAS= +DOCKER_VOL_DATA_DBC= +DOCKER_VOL_DATA_MAPS= +DOCKER_VOL_DATA_VMAPS= +DOCKER_VOL_DATA_MMAPS= DOCKER_WORLD_EXTERNAL_PORT= DOCKER_SOAP_EXTERNAL_PORT= @@ -20,8 +25,3 @@ DOCKER_USER= DOCKER_USER_ID= DOCKER_GROUP_ID= -# 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= diff --git a/data/sql/updates/db_world/2022_11_04_00.sql b/data/sql/updates/db_world/2022_11_04_00.sql new file mode 100644 index 000000000..93580c9da --- /dev/null +++ b/data/sql/updates/db_world/2022_11_04_00.sql @@ -0,0 +1,4 @@ +-- DB update 2022_11_03_08 -> 2022_11_04_00 +-- +SET @FACTION_BOTH := 6; +UPDATE `areatrigger_tavern` SET `faction` = @FACTION_BOTH WHERE `id` = 862; diff --git a/data/sql/updates/db_world/2022_11_04_01.sql b/data/sql/updates/db_world/2022_11_04_01.sql new file mode 100644 index 000000000..7755ee260 --- /dev/null +++ b/data/sql/updates/db_world/2022_11_04_01.sql @@ -0,0 +1,3 @@ +-- DB update 2022_11_04_00 -> 2022_11_04_01 +-- +UPDATE `quest_template_addon` SET `SpecialFlags` = `SpecialFlags`|1 WHERE `id` IN (8789, 8790); diff --git a/data/sql/updates/db_world/2022_11_04_02.sql b/data/sql/updates/db_world/2022_11_04_02.sql new file mode 100644 index 000000000..11145c80c --- /dev/null +++ b/data/sql/updates/db_world/2022_11_04_02.sql @@ -0,0 +1,4 @@ +-- DB update 2022_11_04_01 -> 2022_11_04_02 +-- +UPDATE `creature` SET `spawntimesecs`=120 WHERE `guid`=84701 AND `id1`=18583; + diff --git a/data/sql/updates/db_world/2022_11_05_00.sql b/data/sql/updates/db_world/2022_11_05_00.sql new file mode 100644 index 000000000..4986fe7b1 --- /dev/null +++ b/data/sql/updates/db_world/2022_11_05_00.sql @@ -0,0 +1,3 @@ +-- DB update 2022_11_04_02 -> 2022_11_05_00 +-- +UPDATE `creature_template` SET `mechanic_immune_mask` = `mechanic_immune_mask` & 0xFFFFFF7F; diff --git a/data/sql/updates/db_world/2022_11_05_01.sql b/data/sql/updates/db_world/2022_11_05_01.sql new file mode 100644 index 000000000..026d45d59 --- /dev/null +++ b/data/sql/updates/db_world/2022_11_05_01.sql @@ -0,0 +1,44 @@ +-- DB update 2022_11_05_00 -> 2022_11_05_01 + +-- Set CALLKILLEDMONSTER non repeteable +UPDATE `smart_scripts` SET `event_flags` = `event_flags`|1 WHERE `entryorguid` IN (21859, 21846) AND `source_type`=0 AND `id`=0 AND `link`=1; + +-- Add spawns imported from TC +DELETE FROM `creature` WHERE `id1` IN (21846, 21859) AND `id2` IN (21846, 21859) AND `guid` BETWEEN @GUID+0 AND @GUID+35; +INSERT INTO `creature` (`guid`, `id1`, `id2`, `map`, `zoneId`, `areaId`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `MovementType`) VALUES +(@GUID+0 , 21846, 21859, 530, 3519, 0, 1, 1, -3780.56, 5215.07, -23.1934, 0.0349066, 7, 0), +(@GUID+1 , 21846, 21859, 530, 3519, 0, 1, 1, -3777.38, 5184.86, -24.4552, 3.9968, 7, 0), +(@GUID+2 , 21846, 21859, 530, 3519, 0, 1, 1, -3772.17, 5211.63, -22.8059, 5.49779, 7, 0), +(@GUID+3 , 21846, 21859, 530, 3519, 0, 1, 1, -3770.83, 5121.01, -21.4213, 0.959931, 7, 0), +(@GUID+4 , 21846, 21859, 530, 3519, 0, 1, 1, -3766.29, 5062.47, -18.9817, 3.57792, 7, 0), +(@GUID+5 , 21846, 21859, 530, 3519, 0, 1, 1, -3764.99, 5095.88, -19.0595, 0.122173, 7, 0), +(@GUID+6 , 21846, 21859, 530, 3519, 0, 1, 1, -3762.46, 5171.85, -22.9264, 1.0821, 7, 0), +(@GUID+7 , 21846, 21859, 530, 3519, 0, 1, 1, -3759.02, 5140.41, -22.8351, 4.81711, 7, 0), +(@GUID+8 , 21846, 21859, 530, 3519, 0, 1, 1, -3758.07, 5261.12, -15.3995, 2.77507, 7, 0), +(@GUID+9 , 21846, 21859, 530, 3519, 0, 1, 1, -3753.9, 5294.92, -16.9184, 1.43117, 7, 0), +(@GUID+10, 21846, 21859, 530, 3519, 0, 1, 1, -3753.17, 5078.65, -18.2274, 0.872665, 7, 0), +(@GUID+11, 21846, 21859, 530, 3519, 0, 1, 1, -3750.03, 5125.17, -21.9827, 5.35816, 7, 0), +(@GUID+12, 21846, 21859, 530, 3519, 0, 1, 1, -3749.58, 5195.27, -22.6601, 3.68264, 7, 0), +(@GUID+13, 21846, 21859, 530, 3519, 0, 1, 1, -3741.7, 5160.73, -22.2081, 4.50295, 7, 0), +(@GUID+14, 21846, 21859, 530, 3519, 0, 1, 1, -3741.05, 5171.27, -21.8304, 2.14675, 7, 0), +(@GUID+15, 21846, 21859, 530, 3519, 0, 1, 1, -3739.48, 5271.71, -16.0977, 0.523599, 7, 0), +(@GUID+16, 21846, 21859, 530, 3519, 0, 1, 1, -3734.78, 5327.33, -13.0874, 3.9619, 7, 0), +(@GUID+17, 21846, 21859, 530, 3519, 0, 1, 1, -3733.21, 5061.52, -17.6918, 0.628319, 7, 0), +(@GUID+18, 21846, 21859, 530, 3519, 0, 1, 1, -3731.54, 5160.66, -22.2169, 3.4383, 7, 0), +(@GUID+19, 21846, 21859, 530, 3519, 0, 1, 1, -3726.95, 5263.67, -17.9404, 3.66519, 7, 0), +(@GUID+20, 21846, 21859, 530, 3519, 0, 1, 1, -3721.04, 5275.86, -18.5205, 1.25664, 7, 0), +(@GUID+21, 21846, 21859, 530, 3519, 0, 1, 1, -3720.57, 5205.87, -20.2053, 2.53073, 7, 0), +(@GUID+22, 21846, 21859, 530, 3519, 0, 1, 1, -3718.09, 5217.56, -21.3539, 2.75762, 7, 0), +(@GUID+23, 21846, 21859, 530, 3519, 0, 1, 1, -3713.32, 5257.14, -20.3728, 3.82227, 7, 0), +(@GUID+24, 21846, 21859, 530, 3519, 0, 1, 1, -3711.44, 5290.39, -18.9303, 0.0698132, 7, 0), +(@GUID+25, 21846, 21859, 530, 3519, 0, 1, 1, -3691.57, 5220.81, -21.1431, 2.54818, 7, 0), +(@GUID+26, 21846, 21859, 530, 3519, 0, 1, 1, -3689.51, 5295.31, -20.0296, 3.33358, 7, 0), +(@GUID+27, 21846, 21859, 530, 3519, 0, 1, 1, -3688.32, 5336.11, -15.1771, 3.735, 7, 0), +(@GUID+28, 21846, 21859, 530, 3519, 0, 1, 1, -3687.49, 5351.75, -13.172, 3.1765, 7, 0), +(@GUID+29, 21846, 21859, 530, 3519, 0, 1, 1, -3679.08, 5287.66, -20.6681, 0.0698132, 7, 0), +(@GUID+30, 21846, 21859, 530, 3519, 0, 1, 1, -3678.04, 5293.5, -20.3924, 1.78024, 7, 0), +(@GUID+31, 21846, 21859, 530, 3519, 0, 1, 1, -3676.77, 5334.48, -16.1081, 0.575959, 7, 0), +(@GUID+32, 21846, 21859, 530, 3519, 0, 1, 1, -3643.76, 5323.48, -18.2017, 4.08407, 7, 0), +(@GUID+33, 21846, 21859, 530, 3519, 0, 1, 1, -3640.03, 5318.27, -19.0845, 3.38594, 7, 0), +(@GUID+34, 21846, 21859, 530, 3519, 0, 1, 1, -3634.82, 5283.14, -21.9279, 4.5204, 7, 0), +(@GUID+35, 21846, 21859, 530, 3519, 0, 1, 1, -3783.05, 5215.14, -23.515, 1.76278, 7, 0); diff --git a/data/sql/updates/db_world/2022_11_05_02.sql b/data/sql/updates/db_world/2022_11_05_02.sql new file mode 100644 index 000000000..18464a425 --- /dev/null +++ b/data/sql/updates/db_world/2022_11_05_02.sql @@ -0,0 +1,9 @@ +-- DB update 2022_11_05_01 -> 2022_11_05_02 +-- Quest: A Pilgrim's Plight +UPDATE `gameobject` SET `spawntimesecs`=1 WHERE `guid`=25340 AND `id`=184478; +-- Quest: The Dread Relic +UPDATE `gameobject` SET `spawntimesecs`=0 WHERE `guid`=26109 AND `id`=185220; +-- Quest: The Shadow Tomb +UPDATE `gameobject` SET `spawntimesecs`=0 WHERE `id` IN (185224, 185225, 185226) AND `guid` IN (26110, 26111, 47565); +-- Quest: A Damp Dark Place +UPDATE `gameobject` SET `spawntimesecs`=0 WHERE `guid`=22527 AND `id`=182122; diff --git a/data/sql/updates/db_world/2022_11_05_03.sql b/data/sql/updates/db_world/2022_11_05_03.sql new file mode 100644 index 000000000..9969d30ab --- /dev/null +++ b/data/sql/updates/db_world/2022_11_05_03.sql @@ -0,0 +1,5 @@ +-- DB update 2022_11_05_02 -> 2022_11_05_03 +-- +DELETE FROM `smart_scripts` WHERE (`entryorguid` = 15246) AND (`source_type` = 0) AND (`id` IN (1)); +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 +(15246, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 11, 26049, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Qiraji Mindslayer - On Just Died - Cast \'Mana Burn\''); diff --git a/data/sql/updates/db_world/2022_11_06_00.sql b/data/sql/updates/db_world/2022_11_06_00.sql new file mode 100644 index 000000000..4c501800f --- /dev/null +++ b/data/sql/updates/db_world/2022_11_06_00.sql @@ -0,0 +1,6 @@ +-- DB update 2022_11_05_03 -> 2022_11_06_00 +-- lots of Reputation changes +DELETE FROM `creature_onkill_reputation` WHERE `creature_id`=26081; +INSERT INTO `creature_onkill_reputation` (`creature_id`, `RewOnKillRepFaction1`, `RewOnKillRepFaction2`, `MaxStanding1`, `IsTeamAward1`, `RewOnKillRepValue1`, `MaxStanding2`, `IsTeamAward2`, `RewOnKillRepValue2`, `TeamDependent`) VALUES (26081, 87, 21, 5, 0, 5, 7, 1, -25, 0); +-- Spawn to 8 hours +UPDATE `creature` SET `spawntimesecs`=28800 WHERE `guid`=1975960 AND `id1`=26081; diff --git a/docker-compose.yml b/docker-compose.yml index 6217ed7be..a69a289f8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,14 @@ x-networks: &networks networks: - ac-network -x-cache-from: &cache-from +x-build-params: &build-params + context: . + dockerfile: ./apps/docker/Dockerfile + args: + USER_ID: ${DOCKER_USER_ID:-1000} + GROUP_ID: ${DOCKER_GROUP_ID:-1000} + DOCKER_USER: ${DOCKER_USER:-acore} + BUILDKIT_INLINE_CACHE: 1 cache_from: - acore/ac-wotlk-authserver:${DOCKER_IMAGE_TAG:-master} - acore/ac-wotlk-authserver-local:${DOCKER_IMAGE_TAG:-master} @@ -20,36 +27,17 @@ x-ac-shared-conf: &ac-shared-conf working_dir: /azerothcore environment: AC_DISABLE_INTERACTIVE: "1" - depends_on: - ac-database: - condition: service_healthy + +x-ac-service-conf: &ac-service-conf + <<: *ac-shared-conf + # List can't be merged. See: https://forums.docker.com/t/how-to-merge-a-list-of-volumes-from-an-extension-field-into-the-service-definition/77454 + # volumes: + # - ${DOCKER_VOL_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc + # # [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544 + # - ${DOCKER_VOL_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated + services: -#============================ -# -# Abstract services to extend -# -#============================ - - abstract-bind: - image: local/azerothcore/abstract-bind - volumes: - - .:/azerothcore - # expose some dist folder outside allowing the host to use them - - ${DOCKER_VOL_CONF:-./conf}:/azerothcore/conf - - ${DOCKER_VOL_BIN:-ac-bin}:/azerothcore/env/dist/bin - - ${DOCKER_VOL_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc - # [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544 - - ${DOCKER_VOL_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated - - ${DOCKER_VOL_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 - #======================= # # DATABASE @@ -77,6 +65,106 @@ services: timeout: 10s retries: 40 +#====================== +# +# Dev services +# +#====================== + + # + # Used for the build process to avoid the host binding of the /azerothcore + # and speedup the compilation by avoiding the host-container filesystem conversion issue + # on non-ext filesystems. Reference https://stackoverflow.com/a/63437557/1964544 + # + ac-dev-build: + <<: [ *ac-shared-conf ] # merge with + image: acore/ac-wotlk-dev-server:${DOCKER_IMAGE_TAG:-master} + user: ${DOCKER_USER:-root} + cap_add: + - SYS_NICE # CAP_SYS_NICE + build: + target: dev + <<: *build-params + security_opt: + - seccomp:unconfined + env_file: + ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} + volumes: + # expose some dist folder outside allowing the host to use them + - ${DOCKER_VOL_CONF:-./conf}:/azerothcore/conf + - ${DOCKER_VOL_BIN:-ac-bin-dev}:/azerothcore/env/dist/bin + - ${DOCKER_VOL_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc + - ac-build-dev:/azerothcore/var/build + - ac-ccache-dev:/azerothcore/var/ccache + profiles: [dev-build] + + # + # Dev server with the ./azerothcore folder binded from the host + # Please use Linux, WSL2 or any ext-compatible filesystem + # to avoid performance issues + # + ac-dev-server: + <<: [ *ac-shared-conf ] # merge with + tty: true + image: acore/ac-wotlk-dev-server:${DOCKER_IMAGE_TAG:-master} + user: ${DOCKER_USER:-root} + cap_add: + - SYS_NICE # CAP_SYS_NICE + build: + target: dev + <<: *build-params + security_opt: + - seccomp:unconfined + env_file: + ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} + ports: + - ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724 + - ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085 + - ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878 + volumes: + - ${DOCKER_VOL_ROOT:-.}:/azerothcore:cached + # expose some dist folder outside allowing the host to use them + - ${DOCKER_VOL_CONF:-./conf}:/azerothcore/conf + - ${DOCKER_VOL_BIN:-ac-bin-dev}:/azerothcore/env/dist/bin + - ${DOCKER_VOL_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc + # [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544 + - ${DOCKER_VOL_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated + - ac-build-dev:/azerothcore/var/build + - ac-ccache-dev:/azerothcore/var/ccache + # client data + - ${DOCKER_VOL_DATA_CAMERAS:-./env/docker/data/Cameras}:/azerothcore/env/dist/data/Cameras + - ${DOCKER_VOL_DATA_DBC:-./env/docker/data/dbc}:/azerothcore/env/dist/data/dbc + - ${DOCKER_VOL_DATA_MAPS:-./env/docker/data/maps}:/azerothcore/env/dist/data/maps + - ${DOCKER_VOL_DATA_VMAPS:-./env/docker/data/vmaps}:/azerothcore/env/dist/data/vmaps + - ${DOCKER_VOL_DATA_MMAPS:-./env/docker/data/mmaps}:/azerothcore/env/dist/data/mmaps + # remount again for the extractors + - ${DOCKER_VOL_DATA_CAMERAS:-./env/docker/data/Cameras}:/azerothcore/env/dist/bin/Cameras + - ${DOCKER_VOL_DATA_DBC:-./env/docker/data/dbc}:/azerothcore/env/dist/bin/dbc + - ${DOCKER_VOL_DATA_MAPS:-./env/docker/data/maps}:/azerothcore/env/dist/bin/maps + - ${DOCKER_VOL_DATA_VMAPS:-./env/docker/data/vmaps}:/azerothcore/env/dist/bin/vmaps + - ${DOCKER_VOL_DATA_MMAPS:-./env/docker/data/mmaps}:/azerothcore/env/dist/bin/mmaps + # this is not the directory of the extracted data! It's the client folder used by the extractors + - ${DOCKER_AC_CLIENT_FOLDER:-./var/client}:/azerothcore/env/dist/bin/Data + profiles: [dev] + depends_on: + ac-database: + condition: service_healthy + + ac-db-import: + <<: *ac-shared-conf + image: acore/ac-wotlk-worldserver-local:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally + command: ./env/dist/bin/dbimport + volumes: + # read-only binaries compiled by ac-dev-server + - ${DOCKER_VOL_BIN:-ac-bin-dev}:/azerothcore/env/dist/bin:ro + - ${DOCKER_VOL_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc + # [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544 + - ${DOCKER_VOL_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated + profiles: [local, app, db-import-local] + depends_on: + ac-database: + condition: service_healthy + #======================= # # APP Services @@ -84,236 +172,223 @@ services: #======================= ac-worldserver: - <<: *ac-shared-conf - extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} + <<: *ac-service-conf # merge with ac-service-conf stdin_open: true tty: true + cap_add: + - SYS_NICE # CAP_SYS_NICE command: ./acore.sh run-worldserver image: acore/ac-wotlk-worldserver-local:${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} - user: ${DOCKER_USER:-acore} + user: ${DOCKER_USER:-root} privileged: true build: - context: . target: worldserver-local - dockerfile: ./apps/docker/Dockerfile - args: - USER_ID: ${DOCKER_USER_ID:-1000} - GROUP_ID: ${DOCKER_GROUP_ID:-1000} - DOCKER_USER: ${DOCKER_USER:-acore} - <<: *cache-from + <<: *build-params ports: - ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085 - ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878 + volumes: + # read-only binaries compiled by ac-dev-server + - ${DOCKER_VOL_BIN:-ac-bin-dev}:/azerothcore/env/dist/bin:ro + - ${DOCKER_VOL_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc + # [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544 + - ${DOCKER_VOL_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated + # client data + - ${DOCKER_VOL_DATA_CAMERAS:-./env/docker/data/Cameras}:/azerothcore/env/dist/data/Cameras + - ${DOCKER_VOL_DATA_DBC:-./env/docker/data/dbc}:/azerothcore/env/dist/data/dbc + - ${DOCKER_VOL_DATA_MAPS:-./env/docker/data/maps}:/azerothcore/env/dist/data/maps + - ${DOCKER_VOL_DATA_VMAPS:-./env/docker/data/vmaps}:/azerothcore/env/dist/data/vmaps + - ${DOCKER_VOL_DATA_MMAPS:-./env/docker/data/mmaps}:/azerothcore/env/dist/data/mmaps profiles: [local, app, worldserver] + depends_on: + ac-database: + condition: service_healthy + ac-db-import: + condition: service_completed_successfully ac-authserver: - <<: *ac-shared-conf - extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} + <<: *ac-service-conf # merge with ac-service-conf tty: true command: ./acore.sh run-authserver image: acore/ac-wotlk-authserver-local:${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} - user: ${DOCKER_USER:-acore} + user: ${DOCKER_USER:-root} build: - context: . target: authserver-local - dockerfile: ./apps/docker/Dockerfile - args: - USER_ID: ${DOCKER_USER_ID:-1000} - GROUP_ID: ${DOCKER_GROUP_ID:-1000} - DOCKER_USER: ${DOCKER_USER:-acore} - <<: *cache-from + <<: *build-params + volumes: + # read-only binaries compiled by ac-dev-server + - ${DOCKER_VOL_BIN:-ac-bin-dev}:/azerothcore/env/dist/bin:ro + - ${DOCKER_VOL_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc + # [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544 + - ${DOCKER_VOL_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated ports: - ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724 profiles: [local, app, authserver] - -#====================== -# -# Dev services -# -#====================== - ac-build: - <<: *ac-shared-conf - extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} - image: acore/ac-wotlk-dev-server:${DOCKER_IMAGE_TAG:-master} - build: - context: . - target: ${DOCKER_AC_BUILD_TARGET:-dev} - dockerfile: ./apps/docker/Dockerfile - args: - USER_ID: ${DOCKER_USER_ID:-1000} - GROUP_ID: ${DOCKER_GROUP_ID:-1000} - DOCKER_USER: ${DOCKER_USER:-acore} - <<: *cache-from - env_file: - ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} - working_dir: /azerothcore/ - volumes: - - ${DOCKER_VOL_BUILD:-ac-build}:/azerothcore/var/build - # with this conf you can use an external path for it (useful for CI) - - ${DOCKER_VOL_CCACHE:-ac-ccache}:/azerothcore/var/ccache - # use internal copied files instead of volumes - - /azerothcore/src - - /azerothcore/data - - /azerothcore/modules - profiles: [local, build] - - ac-dev-server: - <<: *ac-shared-conf - extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} - tty: true - image: acore/ac-wotlk-dev-server:${DOCKER_IMAGE_TAG:-master} - build: - context: . - target: dev - dockerfile: ./apps/docker/Dockerfile - args: - USER_ID: ${DOCKER_USER_ID:-1000} - GROUP_ID: ${DOCKER_GROUP_ID:-1000} - DOCKER_USER: ${DOCKER_USER:-acore} - <<: *cache-from - security_opt: - - seccomp:unconfined - env_file: - ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} - user: ${DOCKER_USER:-acore} - 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: - - ac-build-dev:/azerothcore/var/build - - ac-ccache-dev:/azerothcore/var/ccache - # this is not the directory of the extracted data! It's the client folder used by the extractors - - ${DOCKER_CLIENT_DATA_FOLDER:-./var/client}:/azerothcore/env/dist/bin/Data - profiles: [dev] + depends_on: + ac-database: + condition: service_healthy + ac-db-import: + condition: service_completed_successfully #====================== # # Production services # +# The following services are used to test the production images +# Do not use them unless you know what you're doing! +# We do not offer support for them +# +# For a production-ready docker-compose, please check the official repo: https://github.com/azerothcore/acore-docker +# #====================== + ac-database-prod: + <<: *networks + image: mysql:8.0 + restart: unless-stopped + cap_add: + - SYS_NICE # CAP_SYS_NICE + ports: + - ${DOCKER_DB_EXTERNAL_PORT:-3306}:3306 + environment: + - MYSQL_ROOT_PASSWORD=${DOCKER_DB_ROOT_PASSWORD:-password} + volumes: + - type: volume + source: ac-database-prod + target: /var/lib/mysql + healthcheck: + test: "/usr/bin/mysql --user=root --password=$$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\"" + interval: 5s + timeout: 10s + retries: 40 + profiles: [prod] + ac-worldserver-prod: - <<: *ac-shared-conf + <<: *ac-service-conf # merge with ac-service-conf stdin_open: true tty: true + cap_add: + - SYS_NICE # CAP_SYS_NICE command: ./acore.sh run-worldserver image: acore/ac-wotlk-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} - user: ${DOCKER_USER:-acore} + user: ${DOCKER_USER:-root} privileged: true build: - context: . target: worldserver - dockerfile: ./apps/docker/Dockerfile - args: - USER_ID: ${DOCKER_USER_ID:-1000} - GROUP_ID: ${DOCKER_GROUP_ID:-1000} - DOCKER_USER: ${DOCKER_USER:-acore} - <<: *cache-from + <<: *build-params ports: - ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085 - ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878 volumes: - ${DOCKER_VOL_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated - volumes_from: - - ac-client-data-server:ro - depends_on: - - ac-client-data-server + - ${DOCKER_VOL_CLIENT_DATA_PROD:-ac-client-data-prod}:/azerothcore/env/dist/data:ro profiles: [prod, prod-app, prod-worldserver] + depends_on: + ac-database-prod: + condition: service_healthy + ac-db-import-prod: + condition: service_completed_successfully + ac-client-data-init: + condition: service_started ac-authserver-prod: - <<: *ac-shared-conf + <<: *ac-service-conf # merge with ac-service-conf tty: true command: ./acore.sh run-authserver image: acore/ac-wotlk-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} - user: ${DOCKER_USER:-acore} + user: ${DOCKER_USER:-root} build: - context: . target: authserver - dockerfile: ./apps/docker/Dockerfile - args: - USER_ID: ${DOCKER_USER_ID:-1000} - GROUP_ID: ${DOCKER_GROUP_ID:-1000} - DOCKER_USER: ${DOCKER_USER:-acore} - <<: *cache-from + <<: *build-params volumes: - ${DOCKER_VOL_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated ports: - ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724 profiles: [prod, prod-app, prod-authserver] + depends_on: + ac-database-prod: + condition: service_healthy + ac-db-import-prod: + condition: service_completed_successfully - ac-client-data-server: + + ac-client-data-init: image: acore/ac-wotlk-client-data:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally - user: ${DOCKER_USER:-acore} + user: ${DOCKER_USER:-root} build: - context: . target: client-data - dockerfile: ./apps/docker/Dockerfile + <<: *build-params args: USER_ID: ${DOCKER_USER_ID:-1000} GROUP_ID: ${DOCKER_GROUP_ID:-1000} DOCKER_USER: ${DOCKER_USER:-acore} - <<: *cache-from + BUILDKIT_INLINE_CACHE: 1 volumes: - - /azerothcore/env/dist/data + - ${DOCKER_VOL_CLIENT_DATA_PROD:-ac-client-data-prod}:/azerothcore/env/dist/data:ro profiles: [prod, prod-app, clientdata] ac-tools: image: acore/ac-wotlk-tools:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally - user: ${DOCKER_USER:-acore} + user: ${DOCKER_USER:-root} build: - context: . target: tools - dockerfile: ./apps/docker/Dockerfile - args: - USER_ID: ${DOCKER_USER_ID:-1000} - GROUP_ID: ${DOCKER_GROUP_ID:-1000} - DOCKER_USER: ${DOCKER_USER:-acore} - <<: *cache-from + <<: *build-params working_dir: /azerothcore/env/client/ volumes: - - ${DOCKER_CLIENT_DATA_FOLDER:-./var/client}:/azerothcore/env/client/Data - - ${DOCKER_VOL_TOOLS_DBC:-./var/extractors/dbc}:/azerothcore/env/client/dbc - - ${DOCKER_VOL_TOOLS_MAPS:-./var/extractors/maps}:/azerothcore/env/client/maps - - ${DOCKER_VOL_TOOLS_VMAPS:-./var/extractors/vmaps}:/azerothcore/env/client/vmaps - - ${DOCKER_VOL_TOOLS_MMAPS:-./var/extractors/mmaps}:/azerothcore/env/client/mmaps + # this is not the directory of the extracted data! It's the client folder used by the extractors + - ${DOCKER_AC_CLIENT_FOLDER:-./var/client}:/azerothcore/env/dist/bin/Data profiles: [prod, tools] - ac-db-import: + ac-db-import-prod: <<: *ac-shared-conf image: acore/ac-wotlk-worldserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally command: ./env/dist/bin/dbimport - profiles: [db-import] + profiles: [prod, prod-app, db-import-prod] + + # + # Only for internal tests + # + ac-build-prod: + <<: *ac-shared-conf + build: + target: build + <<: *build-params + env_file: + ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} + working_dir: /azerothcore/ + profiles: [prod-build] volumes: ac-database: - ac-bin: + ac-database-prod: + ac-bin-dev: ac-build-dev: - ac-build: ac-ccache-dev: - ac-ccache: ac-proj: + ac-client-data-prod: # not used, but you can use them by setting # the DOCKER_VOL_* env variabiles + ac-root: ac-conf: ac-etc: ac-logs: - ac-client-data: - ac-client-data-prod: + ac-client-data-cameras: + ac-client-data-dbc: + ac-client-data-maps: + ac-client-data-vmaps: + ac-client-data-mmaps: networks: ac-network: diff --git a/env/docker/data/Cameras/.gitkeep b/env/docker/data/Cameras/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/env/docker/data/dbc/.gitkeep b/env/docker/data/dbc/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/env/docker/data/maps/.gitkeep b/env/docker/data/maps/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/env/docker/data/mmaps/.gitkeep b/env/docker/data/mmaps/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/env/docker/data/vmaps/.gitkeep b/env/docker/data/vmaps/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/env/docker/etc/authserver.conf.dockerdist b/env/docker/etc/authserver.conf.dockerdist index 1a470661e..15eb0e107 100644 --- a/env/docker/etc/authserver.conf.dockerdist +++ b/env/docker/etc/authserver.conf.dockerdist @@ -16,7 +16,7 @@ TempDir = "/azerothcore/env/dist/temp" LoginDatabaseInfo = "ac-database;3306;root;password;acore_auth" # Add more configuration overwrites by copying settings from from authserver.conf.dist -LogLevel = 3 + SQLDriverLogFile = "SQLDriver.log" SQLDriverQueryLogging = 1 diff --git a/env/docker/etc/dbimport.conf.dockerdist b/env/docker/etc/dbimport.conf.dockerdist index 183cf873e..e9f97375a 100644 --- a/env/docker/etc/dbimport.conf.dockerdist +++ b/env/docker/etc/dbimport.conf.dockerdist @@ -13,7 +13,6 @@ WorldDatabaseInfo = "ac-database;3306;root;password;acore_world" CharacterDatabaseInfo = "ac-database;3306;root;password;acore_characters" # Add more configuration overwrites by copying settings from worldserver.conf.dist -LogLevel = 2 # Disable idle connections automatic kick since it doesn't work well on macOS + Docker CloseIdleConnections = 0 diff --git a/env/docker/etc/worldserver.conf.dockerdist b/env/docker/etc/worldserver.conf.dockerdist index c5dc18fe5..a51ef16d5 100644 --- a/env/docker/etc/worldserver.conf.dockerdist +++ b/env/docker/etc/worldserver.conf.dockerdist @@ -18,7 +18,6 @@ WorldDatabaseInfo = "ac-database;3306;root;password;acore_world" CharacterDatabaseInfo = "ac-database;3306;root;password;acore_characters" # Add more configuration overwrites by copying settings from worldserver.conf.dist -LogLevel = 2 # Disable idle connections automatic kick since it doesn't work well on macOS + Docker CloseIdleConnections = 0 diff --git a/src/server/game/Entities/Player/PlayerStorage.cpp b/src/server/game/Entities/Player/PlayerStorage.cpp index bfd19ceff..56f11af58 100644 --- a/src/server/game/Entities/Player/PlayerStorage.cpp +++ b/src/server/game/Entities/Player/PlayerStorage.cpp @@ -2594,7 +2594,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update CharacterDatabase.Execute(stmt); } - sScriptMgr->OnLootItem(this, pItem, count, ObjectGuid::Empty); + sScriptMgr->OnStoreNewItem(this, pItem, count); } return pItem; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d621dd4c9..6591a8e5a 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -469,7 +469,11 @@ void Unit::Update(uint32 p_time) extraAttacksTargets.erase(itr); if (Unit* victim = ObjectAccessor::GetUnit(*this, targetGuid)) { - HandleProcExtraAttackFor(victim, count); + if (_lastExtraAttackSpell == SPELL_SWORD_SPECIALIZATION || _lastExtraAttackSpell == SPELL_HACK_AND_SLASH + || victim->IsWithinMeleeRange(this)) + { + HandleProcExtraAttackFor(victim, count); + } } } _lastExtraAttackSpell = 0; @@ -1302,7 +1306,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama uint32 crTypeMask = victim->GetCreatureTypeMask(); // Script Hook For CalculateSpellDamageTaken -- Allow scripts to change the Damage post class mitigation calculations - sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage); + sScriptMgr->ModifySpellDamageTaken(damageInfo->target, damageInfo->attacker, damage, spellInfo); int32 cleanDamage = 0; if (Unit::IsDamageReducedByArmor(damageSchoolMask, spellInfo)) @@ -9373,7 +9377,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg // Patch 2.2.0 Sword Specialization (Warrior, Rogue) extra attack can no longer proc additional extra attacks // 3.3.5 Sword Specialization (Warrior), Hack and Slash (Rogue) - if (lastExtraAttackSpell == 16459 || lastExtraAttackSpell == 66923) + if (lastExtraAttackSpell == SPELL_SWORD_SPECIALIZATION || lastExtraAttackSpell == SPELL_HACK_AND_SLASH) { return false; } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 639f6727f..6dbc3b914 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -717,6 +717,12 @@ enum MeleeHitOutcome MELEE_HIT_GLANCING, MELEE_HIT_CRIT, MELEE_HIT_CRUSHING, MELEE_HIT_NORMAL }; +enum ExtraAttackSpells +{ + SPELL_SWORD_SPECIALIZATION = 16459, + SPELL_HACK_AND_SLASH = 66923 +}; + class DispelInfo { public: diff --git a/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp b/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp index 49b3e97f8..00ac9e3bf 100644 --- a/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp @@ -590,6 +590,14 @@ void ScriptMgr::OnLootItem(Player* player, Item* item, uint32 count, ObjectGuid }); } +void ScriptMgr::OnStoreNewItem(Player* player, Item* item, uint32 count) +{ + ExecuteScript([&](PlayerScript* script) + { + script->OnStoreNewItem(player, item, count); + }); +} + void ScriptMgr::OnCreateItem(Player* player, Item* item, uint32 count) { ExecuteScript([&](PlayerScript* script) diff --git a/src/server/game/Scripting/ScriptDefines/UnitScript.cpp b/src/server/game/Scripting/ScriptDefines/UnitScript.cpp index 8076640d3..dd5f20709 100644 --- a/src/server/game/Scripting/ScriptDefines/UnitScript.cpp +++ b/src/server/game/Scripting/ScriptDefines/UnitScript.cpp @@ -69,11 +69,11 @@ void ScriptMgr::ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage) }); } -void ScriptMgr::ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage) +void ScriptMgr::ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage, SpellInfo const* spellInfo) { ExecuteScript([&](UnitScript* script) { - script->ModifySpellDamageTaken(target, attacker, damage); + script->ModifySpellDamageTaken(target, attacker, damage, spellInfo); }); } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 1b29ee3aa..5a10e9722 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -429,7 +429,7 @@ public: virtual void ModifyMeleeDamage(Unit* /*target*/, Unit* /*attacker*/, uint32& /*damage*/) { } // Called when Spell Damage is being Dealt - virtual void ModifySpellDamageTaken(Unit* /*target*/, Unit* /*attacker*/, int32& /*damage*/) { } + virtual void ModifySpellDamageTaken(Unit* /*target*/, Unit* /*attacker*/, int32& /*damage*/, SpellInfo const* /*spellInfo*/) { } // Called when Heal is Recieved virtual void ModifyHealReceived(Unit* /*target*/, Unit* /*healer*/, uint32& /*heal*/, SpellInfo const* /*spellInfo*/) { } @@ -1182,6 +1182,9 @@ public: //After looting item virtual void OnLootItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/, ObjectGuid /*lootguid*/) { } + //After looting item (includes master loot). + virtual void OnStoreNewItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/) { } + //After creating item (eg profession item creation) virtual void OnCreateItem(Player* /*player*/, Item* /*item*/, uint32 /*count*/) { } @@ -2316,6 +2319,7 @@ public: /* PlayerScript */ void GetCustomArenaPersonalRating(Player const* player, uint8 slot, uint32& rating) const; void OnGetMaxPersonalArenaRatingRequirement(Player const* player, uint32 minSlot, uint32& maxArenaRating) const; void OnLootItem(Player* player, Item* item, uint32 count, ObjectGuid lootguid); + void OnStoreNewItem(Player* player, Item* item, uint32 count); void OnCreateItem(Player* player, Item* item, uint32 count); void OnQuestRewardItem(Player* player, Item* item, uint32 count); void OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll); @@ -2473,7 +2477,7 @@ public: /* UnitScript */ void OnDamage(Unit* attacker, Unit* victim, uint32& damage); void ModifyPeriodicDamageAurasTick(Unit* target, Unit* attacker, uint32& damage); void ModifyMeleeDamage(Unit* target, Unit* attacker, uint32& damage); - void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage); + void ModifySpellDamageTaken(Unit* target, Unit* attacker, int32& damage, SpellInfo const* spellInfo); void ModifyHealReceived(Unit* target, Unit* healer, uint32& addHealth, SpellInfo const* spellInfo); uint32 DealDamage(Unit* AttackerUnit, Unit* pVictim, uint32 damage, DamageEffectType damagetype); void OnBeforeRollMeleeOutcomeAgainst(Unit const* attacker, Unit const* victim, WeaponAttackType attType, int32& attackerMaxSkillValueForLevel, int32& victimMaxSkillValueForLevel, int32& attackerWeaponSkill, int32& victimDefenseSkill, int32& crit_chance, int32& miss_chance, int32& dodge_chance, int32& parry_chance, int32& block_chance); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index bf0a762ab..16354a9b9 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -79,15 +79,29 @@ public: void EnterCombatWithTrio(Unit* who) { + BossAI::EnterCombat(who); + if (Creature* vem = instance->GetCreature(DATA_VEM)) + { if (vem->GetGUID() != me->GetGUID()) + { vem->GetAI()->AttackStart(who); + } + } if (Creature* kri = instance->GetCreature(DATA_KRI)) + { if (kri->GetGUID() != me->GetGUID()) + { kri->GetAI()->AttackStart(who); + } + } if (Creature* yauj = instance->GetCreature(DATA_YAUJ)) + { if (yauj->GetGUID() != me->GetGUID()) + { yauj->GetAI()->AttackStart(who); + } + } } void EvadeAllBosses(EvadeReason why) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index e5e6fab05..b1d1fc203 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -602,11 +602,14 @@ struct npc_eye_tentacle : public ScriptedAI portal->SetReactState(REACT_PASSIVE); _portalGUID = portal->GetGUID(); - if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit()) + if (me->ToTempSummon()) { - if (Creature* creature = summoner->ToCreature()) + if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit()) { - creature->AI()->JustSummoned(portal); + if (Creature* creature = summoner->ToCreature()) + { + creature->AI()->JustSummoned(portal); + } } } } @@ -673,11 +676,14 @@ struct npc_claw_tentacle : public ScriptedAI portal->SetReactState(REACT_PASSIVE); _portalGUID = portal->GetGUID(); - if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit()) + if (me->ToTempSummon()) { - if (Creature* creature = summoner->ToCreature()) + if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit()) { - creature->AI()->JustSummoned(portal); + if (Creature* creature = summoner->ToCreature()) + { + creature->AI()->JustSummoned(portal); + } } } } @@ -740,11 +746,14 @@ struct npc_giant_claw_tentacle : public ScriptedAI portal->SetReactState(REACT_PASSIVE); _portalGUID = portal->GetGUID(); - if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit()) + if (me->ToTempSummon()) { - if (Creature* creature = summoner->ToCreature()) + if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit()) { - creature->AI()->JustSummoned(portal); + if (Creature* creature = summoner->ToCreature()) + { + creature->AI()->JustSummoned(portal); + } } } } @@ -771,24 +780,10 @@ struct npc_giant_claw_tentacle : public ScriptedAI void EnterCombat(Unit* /*who*/) override { DoZoneInCombat(); - - _scheduler.Schedule(2s, [this](TaskContext context) - { - DoCastVictim(SPELL_HAMSTRING); - context.Repeat(10s); - }).Schedule(5s, [this](TaskContext context) - { - DoCastSelf(SPELL_THRASH); - context.Repeat(10s); - }).Schedule(3s, [this](TaskContext /*context*/) - { - _canAttack = true; - }); - - ScheduleMeleeCheck(); + ScheduleTasks(); } - void ScheduleMeleeCheck() + void ScheduleTasks() { // Check if a target is in melee range _scheduler.Schedule(10s, [this](TaskContext task) @@ -810,6 +805,17 @@ struct npc_giant_claw_tentacle : public ScriptedAI } task.Repeat(); + }).Schedule(2s, [this](TaskContext context) + { + DoCastVictim(SPELL_HAMSTRING); + context.Repeat(10s); + }).Schedule(5s, [this](TaskContext context) + { + DoCastSelf(SPELL_THRASH); + context.Repeat(10s); + }).Schedule(3s, [this](TaskContext /*context*/) + { + _canAttack = true; }); } @@ -856,13 +862,8 @@ struct npc_giant_claw_tentacle : public ScriptedAI DoCastAOE(SPELL_MASSIVE_GROUND_RUPTURE, true); me->RemoveUnitFlag(UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - ScheduleMeleeCheck(); + ScheduleTasks(); } - - _scheduler.Schedule(3s, [this](TaskContext /*context*/) - { - _canAttack = true; - }); } void UpdateAI(uint32 diff) override @@ -896,11 +897,14 @@ struct npc_giant_eye_tentacle : public ScriptedAI portal->SetReactState(REACT_PASSIVE); _portalGUID = portal->GetGUID(); - if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit()) + if (me->ToTempSummon()) { - if (Creature* creature = summoner->ToCreature()) + if (Unit* summoner = me->ToTempSummon()->GetSummonerUnit()) { - creature->AI()->JustSummoned(portal); + if (Creature* creature = summoner->ToCreature()) + { + creature->AI()->JustSummoned(portal); + } } } } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp index 18dbf9327..e48ec6356 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp @@ -61,8 +61,9 @@ struct boss_huhuran : public BossAI _hardEnrage = false; } - void EnterCombat(Unit* /*who*/) override + void EnterCombat(Unit* who) override { + BossAI::EnterCombat(who); events.ScheduleEvent(EVENT_FRENZY, 12s, 21s); events.ScheduleEvent(EVENT_WYVERN_STING, 25s, 43s); events.ScheduleEvent(EVENT_ACID_SPIT, 1s, 20s); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp index 6b8d086ac..85b20099a 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp @@ -292,9 +292,7 @@ struct boss_ouro : public BossAI void UpdateAI(uint32 diff) override { - //Return since we have no target - if (!UpdateVictim()) - return; + UpdateVictim(); _scheduler.Update(diff, [this] { diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp index 75f1126b8..190c8eb93 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp @@ -105,7 +105,7 @@ struct boss_sartura : public BossAI void UpdateAI(uint32 diff) override { - if (!UpdateVictimWithGaze()) + if (!UpdateVictim()) return; events.Update(diff); @@ -117,7 +117,8 @@ struct boss_sartura : public BossAI case EVENT_SARTURA_WHIRLWIND: if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true)) { - SetGazeOn(target); + me->GetThreatMgr().ResetAllThreat(); + me->AddThreat(target, 1000.0f); } DoCastSelf(SPELL_WHIRLWIND); events.ScheduleEvent(EVENT_SARTURA_WHIRLWIND_RANDOM, 2s, 7s); @@ -126,11 +127,13 @@ struct boss_sartura : public BossAI case EVENT_SARTURA_WHIRLWIND_RANDOM: if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true)) { - SetGazeOn(target); + me->GetThreatMgr().ResetAllThreat(); + me->AddThreat(target, 1000.0f); } events.Repeat(2s, 7s); break; case EVENT_SARTURA_WHIRLWIND_END: + me->GetThreatMgr().ResetAllThreat(); me->SetReactState(REACT_AGGRESSIVE); events.CancelEvent(EVENT_SARTURA_WHIRLWIND_RANDOM); events.ScheduleEvent(EVENT_SARTURA_WHIRLWIND, 5s, 11s); @@ -186,7 +189,7 @@ struct npc_sartura_royal_guard : public ScriptedAI void UpdateAI(uint32 diff) override { - if (!UpdateVictimWithGaze()) + if (!UpdateVictim()) return; events.Update(diff); @@ -198,7 +201,8 @@ struct npc_sartura_royal_guard : public ScriptedAI case EVENT_GUARD_WHIRLWIND: if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true)) { - SetGazeOn(target); + me->GetThreatMgr().ResetAllThreat(); + me->AddThreat(target, 1000.0f); } DoCastSelf(SPELL_GUARD_WHIRLWIND); events.ScheduleEvent(EVENT_GUARD_WHIRLWIND_RANDOM, 2s, 7s); @@ -207,11 +211,13 @@ struct npc_sartura_royal_guard : public ScriptedAI case EVENT_GUARD_WHIRLWIND_RANDOM: if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true)) { - SetGazeOn(target); + me->GetThreatMgr().ResetAllThreat(); + me->AddThreat(target, 1000.0f); } events.Repeat(2s, 7s); break; case EVENT_GUARD_WHIRLWIND_END: + me->GetThreatMgr().ResetAllThreat(); me->SetReactState(REACT_AGGRESSIVE); events.CancelEvent(EVENT_GUARD_WHIRLWIND_RANDOM); events.ScheduleEvent(EVENT_GUARD_WHIRLWIND, 500ms, 9s); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.cpp index b30d52c6a..532c1c5f9 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.cpp @@ -243,14 +243,14 @@ struct npc_obsidian_eradicator : public ScriptedAI { _scheduler.CancelAll(); me->SetPower(POWER_MANA, 0); - _targets.clear(); + _targetGUIDs.clear(); } void EnterCombat(Unit* /*who*/) override { _scheduler.Schedule(3500ms, [this](TaskContext context) { - if (_targets.empty()) + if (_targetGUIDs.empty()) { Map::PlayerList const& players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) @@ -259,17 +259,20 @@ struct npc_obsidian_eradicator : public ScriptedAI { if (player->IsAlive() && !player->IsGameMaster() && !player->IsSpectator() && player->GetPower(POWER_MANA) > 0) { - _targets.push_back(player); + _targetGUIDs.push_back(player->GetGUID()); } } } - Acore::Containers::RandomResize(_targets, 10); + Acore::Containers::RandomResize(_targetGUIDs, 10); } - for (Unit* target : _targets) + for (ObjectGuid guid : _targetGUIDs) { - DoCast(target, SPELL_DRAIN_MANA_ERADICATOR, true); + if (Unit* target = ObjectAccessor::GetUnit(*me, guid)) + { + DoCast(target, SPELL_DRAIN_MANA_ERADICATOR, true); + } } if (me->GetPowerPct(POWER_MANA) >= 100.f) @@ -294,7 +297,7 @@ struct npc_obsidian_eradicator : public ScriptedAI private: TaskScheduler _scheduler; - std::list _targets; + GuidList _targetGUIDs; }; struct npc_anubisath_warder : public ScriptedAI @@ -376,14 +379,14 @@ struct npc_obsidian_nullifier : public ScriptedAI { _scheduler.CancelAll(); me->SetPower(POWER_MANA, 0); - _targets.clear(); + _targetGUIDs.clear(); } void EnterCombat(Unit* /*who*/) override { _scheduler.Schedule(6s, [this](TaskContext context) { - if (_targets.empty()) + if (_targetGUIDs.empty()) { Map::PlayerList const& players = me->GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) @@ -392,18 +395,20 @@ struct npc_obsidian_nullifier : public ScriptedAI { if (player->IsAlive() && !player->IsGameMaster() && !player->IsSpectator() && player->GetPower(POWER_MANA) > 0) { - _targets.push_back(player); + _targetGUIDs.push_back(player->GetGUID()); } } } - Acore::Containers::RandomResize(_targets, 11); + Acore::Containers::RandomResize(_targetGUIDs, 11); } - for (Unit* target : _targets) + for (ObjectGuid guid : _targetGUIDs) { - if (target) + if (Unit* target = ObjectAccessor::GetUnit(*me, guid)) + { DoCast(target, SPELL_DRAIN_MANA_NULLIFIER, true); + } } if (me->GetPowerPct(POWER_MANA) >= 100.f) @@ -433,7 +438,7 @@ struct npc_obsidian_nullifier : public ScriptedAI private: TaskScheduler _scheduler; - std::list _targets; + GuidList _targetGUIDs; }; struct npc_ahnqiraji_critter : public ScriptedAI diff --git a/var/extractors/Cameras/.gitkeep b/var/extractors/Cameras/.gitkeep new file mode 100644 index 000000000..e69de29bb