Skip to content

Add support for AHBots & PlayerBots #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,14 @@ RUN mkdir -p "${HOME_DIR}/build" \
&& cd "${HOME_DIR}/build" \
&& cmake ../mangos/ \
-D CMAKE_INSTALL_PREFIX=../run \
-D PCH=1 \
-D DEBUG=0 \
-D PCH=1 \
-D BUILD_AHBOT=ON \
-D BUILD_EXTRACTORS=ON \
-D BUILD_METRICS=ON \
-D BUILD_PLAYERBOTS=ON \
-D BUILD_SCRIPTDEV=ON \
\
&& make -j "${THREADS}" \
&& make install \
\
Expand Down
4 changes: 2 additions & 2 deletions builder/InstallFullDB.config
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ DEV_UPDATES="NO"

## Define if AHBot SQL updates need to be applied (by default, assume the core is built without AHBot)
## Set the variable to "YES" to import AHBot sql.
AHBOT="NO"
AHBOT="YES"

## Define if the 'src/modules/PlayerBots/sql' directory for processing development SQL files needs to be used
## Set the variable to "YES" to use the playerbots directory
PLAYERBOTS_DB="NO"
PLAYERBOTS_DB="YES"

# Enjoy using the tool
6 changes: 4 additions & 2 deletions builder/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ readonly BASE_DIR="$(realpath "$(dirname "${0}")/..")"
source "${BASE_DIR}/.env"

readonly NAME="cmangos-builder"
readonly IMAGE="ghcr.io/byloth/cmangos/${WOW_VERSION}/builder"
readonly VERSION="latest"
# readonly IMAGE="ghcr.io/byloth/cmangos/${WOW_VERSION}/builder"
# readonly VERSION="latest"
readonly IMAGE="byloth/cmangos-${WOW_VERSION}/builder"
readonly VERSION="develop"

readonly DATA_VOLUME="cmangos_mangosd_data"
readonly NETWORK="cmangos_default"
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ services:
- ./database:/etc/mysql/conf.d:ro

mangosd:
image: "ghcr.io/byloth/cmangos/${WOW_VERSION}:latest"
# image: "ghcr.io/byloth/cmangos/${WOW_VERSION}:latest"
image: byloth/cmangos-tbc:develop
depends_on:
- mariadb

Expand All @@ -37,7 +38,8 @@ services:
- ./runner/config:/opt/mangos/conf:ro

realmd:
image: "ghcr.io/byloth/cmangos/${WOW_VERSION}:latest"
# image: "ghcr.io/byloth/cmangos/${WOW_VERSION}:latest"
image: byloth/cmangos-tbc:develop
depends_on:
- mariadb

Expand Down
8 changes: 8 additions & 0 deletions runner/config/ahbot.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
####################################################
# CMaNGOS Auction House Bot - Configuration file #
####################################################

AhBot.Enabled = 1

AuctionHouseBot.Seller.Enabled = 0
AuctionHouseBot.Buyer.Enabled = 0
5 changes: 5 additions & 0 deletions runner/config/aiplayerbot.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
###############################################
# CMaNGOS AI Playerbot - Configuration file #
###############################################

AiPlayerbot.Enabled = 1
12 changes: 12 additions & 0 deletions runner/config/anticheat.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
############################################
# CMaNGOS AntiCheat - Configuration file #
############################################

Enable = 0

Movement.SpeedHack.Enable = 0
Movement.BadFallReset.Enable = 0

Antispam.Enable = 0

Warden.Enable = 0
3 changes: 3 additions & 0 deletions runner/config/mangosd.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
##################################
# CMaNGOS - Configuration file #
##################################

###################################################################################################################
#
Expand Down
90 changes: 76 additions & 14 deletions runner/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,47 @@ set -e

# Utils:
#
function _replace_conf()
function echoerr()
{
echo ${@} >&2
}

function success()
{
echo -e "\e[32m${1}\e[0m"
}
function info()
{
echo -e "\e[36m${1}\e[0m"
}
function warning()
{
if [[ "${2}" == "--underline" ]]
then
echo -e "\e[4;33m${1}\e[0m"
else
echo -e "\e[33m${1}\e[0m"
fi
}
function error()
{
if [[ "${2}" == "--underline" ]]
then
echo -e "\e[4;31m${1}\e[0m"
else
echo -e "\e[31m${1}\e[0m"
fi
}

function replace_conf()
{
local SEARCH_FOR="${1}"
local REPLACE_WITH="${2}"
local FILENAME="${3}"

sed -i "/^${SEARCH_FOR}/c\\${SEARCH_FOR} = ${REPLACE_WITH}" "${FILENAME}"
}
function _merge_confs()
function merge_confs()
{
local FILENAME="${1}"
local CONFIG_FILE="${2}"
Expand All @@ -27,43 +59,69 @@ function _merge_confs()
local SEARCH_FOR="$(echo "${PROPERTY}" | cut -d '=' -f 1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
local REPLACE_WITH="$(echo "${PROPERTY}" | cut -d '=' -f 2- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"

_replace_conf "${SEARCH_FOR}" "${REPLACE_WITH}" "${FILENAME}"
replace_conf "${SEARCH_FOR}" "${REPLACE_WITH}" "${FILENAME}"
fi

done < "${CONFIG_FILE}"
}

# Sub-functions:
#
function compose_mangosd_conf()
function compose_generic_conf_file()
{
local FILENAME="${1}"

if [[ ! -f "/opt/mangos/conf/${FILENAME}" ]]
then
return
fi

cd "${MANGOS_DIR}/etc"

if [[ ! -f "${FILENAME}.dist" ]]
then
echoerr ""
echoerr -e " $(error "ERROR!" --underline)"
echoerr -e " $(error "└") The file \"$(info "${FILENAME}.dist")\" you're trying to"
echoerr -e " compose the configuration from doesn't exist."

exit 2
fi

cp "${FILENAME}.dist" "${FILENAME}"

merge_confs "${FILENAME}" "/opt/mangos/conf/${FILENAME}"
}

function compose_mangosd_conf_file()
{
local MANGOS_DBCONN="${MANGOS_DBHOST};${MANGOS_DBPORT};${MANGOS_DBUSER};${MANGOS_DBPASS}"

cd "${MANGOS_DIR}/etc"
cp mangosd.conf.dist mangosd.conf

_replace_conf "LoginDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_REALMD_DBNAME}\"" mangosd.conf
_replace_conf "WorldDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_WORLD_DBNAME}\"" mangosd.conf
_replace_conf "CharacterDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_CHARACTERS_DBNAME}\"" mangosd.conf
_replace_conf "LogsDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_LOGS_DBNAME}\"" mangosd.conf
replace_conf "LoginDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_REALMD_DBNAME}\"" mangosd.conf
replace_conf "WorldDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_WORLD_DBNAME}\"" mangosd.conf
replace_conf "CharacterDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_CHARACTERS_DBNAME}\"" mangosd.conf
replace_conf "LogsDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_LOGS_DBNAME}\"" mangosd.conf

if [[ -f "/opt/mangos/conf/mangosd.conf" ]]
then
_merge_confs mangosd.conf "/opt/mangos/conf/mangosd.conf"
merge_confs mangosd.conf "/opt/mangos/conf/mangosd.conf"
fi
}
function compose_realmd_conf()
function compose_realmd_conf_file()
{
local MANGOS_DBCONN="${MANGOS_DBHOST};${MANGOS_DBPORT};${MANGOS_DBUSER};${MANGOS_DBPASS}"

cd "${MANGOS_DIR}/etc"
cp realmd.conf.dist realmd.conf

_replace_conf "LoginDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_REALMD_DBNAME}\"" realmd.conf
replace_conf "LoginDatabaseInfo" "\"${MANGOS_DBCONN};${MANGOS_REALMD_DBNAME}\"" realmd.conf

if [[ -f "/opt/mangos/conf/realmd.conf" ]]
then
_merge_confs realmd.conf "/opt/mangos/conf/realmd.conf"
merge_confs realmd.conf "/opt/mangos/conf/realmd.conf"
fi
}

Expand All @@ -86,8 +144,12 @@ function init_runner()
{
set_timezone

compose_mangosd_conf
compose_realmd_conf
compose_mangosd_conf_file
compose_realmd_conf_file

compose_generic_conf_file "ahbot.conf"
compose_generic_conf_file "aiplayerbot.conf"
compose_generic_conf_file "anticheat.conf"
}

function run_mangosd()
Expand Down
6 changes: 4 additions & 2 deletions runner/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ readonly BASE_DIR="$(realpath "$(dirname "${0}")/..")"
source "${BASE_DIR}/.env"

readonly NAME="cmangos-runner"
readonly IMAGE="ghcr.io/byloth/cmangos/${WOW_VERSION}"
readonly VERSION="latest"
# readonly IMAGE="ghcr.io/byloth/cmangos/${WOW_VERSION}"
# readonly VERSION="latest"
readonly IMAGE="byloth/cmangos-${WOW_VERSION}"
readonly VERSION="develop"

readonly DATA_VOLUME="cmangos_mangosd_data"
readonly NETWORK="cmangos_default"
Expand Down