From 47019a73e82e4b84c57b6c5cad3445f3bf497ba1 Mon Sep 17 00:00:00 2001 From: bash Date: Mon, 29 Jul 2024 18:17:04 +0000 Subject: [PATCH] testing --- 2_source-update.sh | 4 + 5_server-configure.sh | 202 +++++++++--------- 6_server-start.sh | 142 ++++++------ helper/clear-ah.sh | 11 - helper/clear_auctionhouse.sh | 7 + helper/clear_playerbots.sh | 7 + helper/find-character.sh | 10 - helper/find_characters.sh | 16 ++ helper/git-alias.sh | 5 + {lib => helper}/merge_core.sh | 56 ++--- helper/update_ahbot_config.sh | 24 +++ helper/update_realm_ip.sh | 17 ++ helper/update_realm_name.sh | 17 ++ lib/general-settings.sh | 13 -- sql/clear_auctionhouse.sql | 2 + .../clear_playerbots.sql | 60 +++--- sql/find_character.sql | 5 + sql/update_ahbot_config.sql | 6 +- sql/update_realm_ip.sql | 6 +- sql/update_realm_name.sql | 6 +- variables.sh | 6 - 21 files changed, 343 insertions(+), 279 deletions(-) delete mode 100755 helper/clear-ah.sh create mode 100755 helper/clear_auctionhouse.sh create mode 100755 helper/clear_playerbots.sh delete mode 100755 helper/find-character.sh create mode 100755 helper/find_characters.sh create mode 100755 helper/git-alias.sh rename {lib => helper}/merge_core.sh (97%) create mode 100755 helper/update_ahbot_config.sh create mode 100755 helper/update_realm_ip.sh create mode 100755 helper/update_realm_name.sh delete mode 100755 lib/general-settings.sh create mode 100755 sql/clear_auctionhouse.sql rename lib/clear-bots.sql => sql/clear_playerbots.sql (99%) mode change 100644 => 100755 create mode 100755 sql/find_character.sql mode change 100644 => 100755 sql/update_ahbot_config.sql mode change 100644 => 100755 sql/update_realm_ip.sql mode change 100644 => 100755 sql/update_realm_name.sql diff --git a/2_source-update.sh b/2_source-update.sh index 51aae2a..9e5264e 100755 --- a/2_source-update.sh +++ b/2_source-update.sh @@ -8,6 +8,10 @@ echo " "; if [[ $REPLY =~ ^[Yy]$ ]]; then + sudo chmod +x ${ROOT_DIR}/*.sh + sudo chmod +x ${ROOT_DIR}/helper/*.sh + + ########################################################################################## # General dependencies ########################################################################################## diff --git a/5_server-configure.sh b/5_server-configure.sh index ade046c..ee34de2 100755 --- a/5_server-configure.sh +++ b/5_server-configure.sh @@ -1,101 +1,101 @@ -#!/bin/bash -ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" -source ${ROOT_DIR}/variables.sh - - -read -p "This will configur the server, are you sure? (Y)es/(N)o: " -n 1 -r -echo " "; -if [[ $REPLY =~ ^[Yy]$ ]]; -then - - ########################################################################################## - # Enable mysql server - ########################################################################################## - sudo service mysql start - - - ########################################################################################## - # Create acore account - ########################################################################################## - sudo mysql -u root -e "CREATE DATABASE IF NOT EXISTS acore_auth;" - sudo mysql -u root -e "CREATE USER IF NOT EXISTS 'acore'@'%' IDENTIFIED BY 'acore';" - sudo mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'acore'@'%';" - sudo mysql -u root -e "FLUSH PRIVILEGES;" - - - ########################################################################################## - # Recompile default conf files - ########################################################################################## - sudo ${ROOT_DIR}/_server/azerothcore/acore.sh compiler configure - - - ########################################################################################## - # Ensure all folder and files are accesible for the current user - ########################################################################################## - sudo find ${ROOT_DIR}/_server/ -user root -exec sudo chown $USER: {} + - - - ########################################################################################## - # Server config merge - ########################################################################################## - sudo cat ${ROOT_DIR}/config/authserver.conf \ - ${ROOT_DIR}/_server/azerothcore/env/dist/etc/authserver.conf.dist > \ - ${ROOT_DIR}/_server/azerothcore/env/dist/etc/authserver.conf | exit 1 - - sudo cat ${ROOT_DIR}/config/worldserver.conf \ - ${ROOT_DIR}/_server/azerothcore/env/dist/etc/worldserver.conf.dist > \ - ${ROOT_DIR}/_server/azerothcore/env/dist/etc/worldserver.conf | exit 1 - - - ########################################################################################### - ## Modules config merge - ########################################################################################### - sudo cat ${ROOT_DIR}/config/modules/playerbots.conf \ - ${ROOT_DIR}/_server/azerothcore/env/dist/etc/modules/playerbots.conf.dist > \ - ${ROOT_DIR}/_server/azerothcore/env/dist/etc/modules/playerbots.conf | exit 1 - - sudo cat ${ROOT_DIR}/config/modules/mod_ahbot.conf \ - ${ROOT_DIR}/_server/azerothcore/env/dist/etc/modules/mod_ahbot.conf.dist > \ - ${ROOT_DIR}/_server/azerothcore/env/dist/etc/modules/mod_ahbot.conf | exit 1 - - - ########################################################################################## - # Set alias to start, stop and open wow or auth tmux sessions - ########################################################################################## - - if grep -R "bash_wow" ~/.bashrc - then - echo "bash_wow exists"; - else - echo " " >> ~/.bashrc - echo "if [ -f ~/.bash_wow ]; then" >> ~/.bashrc - echo " . ~/.bash_wow" >> ~/.bashrc - echo "fi" >> ~/.bashrc - fi - - echo "ROOT_DIR=${ROOT_DIR}" > ~/.bash_wow - echo "DATAPATH=${DATAPATH}" >> ~/.bash_wow - echo "alias update='${ROOT_DIR}/2_update.sh'" >> ~/.bash_wow - echo "alias build='${ROOT_DIR}/3_build.sh'" >> ~/.bash_wow - echo "alias compile='${ROOT_DIR}/4_compile.sh'" >> ~/.bash_wow - echo "alias config='${ROOT_DIR}/5_config.sh'" >> ~/.bash_wow - echo "alias start='${ROOT_DIR}/6_start.sh'" >> ~/.bash_wow - echo "alias stop='tmux kill-server'" >> ~/.bash_wow - echo "alias wow='cd ${ROOT_DIR}/_server/azerothcore;tmux attach -t ${WORLDSERVER_SESSION}'" >> ~/.bash_wow - echo "alias auth='cd ${ROOT_DIR}/_server/azerothcore;tmux attach -t ${AUTHSERVER_SESSION}'" >> ~/.bash_wow - source ~/.bashrc - echo " " - echo "###########################################################################################" - echo "## After the first install or changes either reboot or TYPE! 'source ~/.bashrc'" - echo "###########################################################################################" - echo "## After the above you can use the following commands:" - echo "### start - starts auth and world in tmux sessions server" - echo "### stop - starts all servers" - echo "### wow - logon world-server tmux session" - echo "### auth - logon auth-server tmux session" - echo "### update - updates the current downloaded source-code, after rerun: build, compile and config." - echo "### build - (re)builds the server based on the downloaded/updated source-codes" - echo "### compile - (re)compiles the server based on the build server" - echo "### config - applies configuration settings defined in the 'config' folder" - echo "###########################################################################################" -fi +#!/bin/bash +ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" +source ${ROOT_DIR}/variables.sh + + +read -p "This will configur the server, are you sure? (Y)es/(N)o: " -n 1 -r +echo " "; +if [[ $REPLY =~ ^[Yy]$ ]]; +then + + ########################################################################################## + # Enable mysql server + ########################################################################################## + sudo service mysql start + + + ########################################################################################## + # Create acore account + ########################################################################################## + sudo mysql -u root -e "CREATE DATABASE IF NOT EXISTS acore_auth;" + sudo mysql -u root -e "CREATE USER IF NOT EXISTS 'acore'@'%' IDENTIFIED BY 'acore';" + sudo mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'acore'@'%';" + sudo mysql -u root -e "FLUSH PRIVILEGES;" + + + ########################################################################################## + # Recompile default conf files + ########################################################################################## + sudo ${ROOT_DIR}/_server/azerothcore/acore.sh compiler configure + + + ########################################################################################## + # Ensure all folder and files are accesible for the current user + ########################################################################################## + sudo find ${ROOT_DIR}/_server/ -user root -exec sudo chown $USER: {} + + + + ########################################################################################## + # Server config merge + ########################################################################################## + sudo cat ${ROOT_DIR}/config/authserver.conf \ + ${ROOT_DIR}/_server/azerothcore/env/dist/etc/authserver.conf.dist > \ + ${ROOT_DIR}/_server/azerothcore/env/dist/etc/authserver.conf | exit 1 + + sudo cat ${ROOT_DIR}/config/worldserver.conf \ + ${ROOT_DIR}/_server/azerothcore/env/dist/etc/worldserver.conf.dist > \ + ${ROOT_DIR}/_server/azerothcore/env/dist/etc/worldserver.conf | exit 1 + + + ########################################################################################### + ## Modules config merge + ########################################################################################### + sudo cat ${ROOT_DIR}/config/modules/playerbots.conf \ + ${ROOT_DIR}/_server/azerothcore/env/dist/etc/modules/playerbots.conf.dist > \ + ${ROOT_DIR}/_server/azerothcore/env/dist/etc/modules/playerbots.conf | exit 1 + + sudo cat ${ROOT_DIR}/config/modules/mod_ahbot.conf \ + ${ROOT_DIR}/_server/azerothcore/env/dist/etc/modules/mod_ahbot.conf.dist > \ + ${ROOT_DIR}/_server/azerothcore/env/dist/etc/modules/mod_ahbot.conf | exit 1 + + + ########################################################################################## + # Set alias to start, stop and open wow or auth tmux sessions + ########################################################################################## + + if grep -R "bash_wow" ~/.bashrc + then + echo "bash_wow exists"; + else + echo " " >> ~/.bashrc + echo "if [ -f ~/.bash_wow ]; then" >> ~/.bashrc + echo " . ~/.bash_wow" >> ~/.bashrc + echo "fi" >> ~/.bashrc + fi + + echo "ROOT_DIR=${ROOT_DIR}" > ~/.bash_wow + echo "DATAPATH=${DATAPATH}" >> ~/.bash_wow + echo "alias update='${ROOT_DIR}/2_update.sh'" >> ~/.bash_wow + echo "alias build='${ROOT_DIR}/3_build.sh'" >> ~/.bash_wow + echo "alias compile='${ROOT_DIR}/4_compile.sh'" >> ~/.bash_wow + echo "alias config='${ROOT_DIR}/5_config.sh'" >> ~/.bash_wow + echo "alias start='${ROOT_DIR}/6_start.sh'" >> ~/.bash_wow + echo "alias stop='tmux kill-server'" >> ~/.bash_wow + echo "alias wow='cd ${ROOT_DIR}/_server/azerothcore;tmux attach -t ${WORLDSERVER_SESSION}'" >> ~/.bash_wow + echo "alias auth='cd ${ROOT_DIR}/_server/azerothcore;tmux attach -t ${AUTHSERVER_SESSION}'" >> ~/.bash_wow + source ~/.bashrc + echo " " + echo "###########################################################################################" + echo "## After the first install or changes either reboot or TYPE! 'source ~/.bashrc'" + echo "###########################################################################################" + echo "## After the above you can use the following commands:" + echo "### update - Updates source-code to latest version" + echo "### build - Builds the server based on source-code" + echo "### compile - Compiles the code based on the build server" + echo "### config - Applies the server configration" + echo "### start - starts auth and world in tmux sessions server" + echo "### stop - stops all sessions" + echo "### wow - logon world-server (tmux) session" + echo "### auth - logon auth-server (tmux) session" + echo "###########################################################################################" +fi diff --git a/6_server-start.sh b/6_server-start.sh index acbf17f..6859cf4 100755 --- a/6_server-start.sh +++ b/6_server-start.sh @@ -1,71 +1,71 @@ -#!/bin/bash -ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" -source ${ROOT_DIR}/variables.sh - - -########################################################################################## -# Apply realm settings -########################################################################################## -sudo mysql -u root --database="acore_auth" -e "UPDATE realmlist SET address = '${REALM_IP}' WHERE id = 1;" -sudo mysql -u root --database="acore_auth" -e "UPDATE realmlist SET name = '${REALM_NAME}' WHERE id = 1;" -echo "Realm settings updated..." -echo " " - - -########################################################################################## -# Apply ah-modbot settings -########################################################################################## -sudo mysql -u root --database="acore_world" -e "UPDATE mod_auctionhousebot SET minitems = ${AH_BOT_MIN_ITEMS}, maxitems = ${AH_BOT_MAX_ITEMS};" -echo "Module ah-modbot updated..." -echo " " - - -########################################################################################## -# reset playerbots data (enforces performance and bot levels balance) -########################################################################################## -sudo mysql -u root --database="acore_characters" < ${ROOT_DIR}/lib/clear-bots.sql -echo "Module playerbots updated..." -echo " " - - -########################################################################################## -# handle the tmux sessions -########################################################################################## -if tmux new-session -d -s $AUTHSERVER_SESSION; then - echo "Created authserver session: $AUTHSERVER_SESSION" -else - echo "Error when trying to create authserver session: $AUTHSERVER_SESSION" -fi -echo " " - -if tmux new-session -d -s $WORLDSERVER_SESSION; then - echo "Created worldserver session: $WORLDSERVER_SESSION" -else - echo "Error when trying to create worldserver session: $WORLDSERVER_SESSION" -fi -echo " " - -if tmux send-keys -t $AUTHSERVER_SESSION "$AUTHSERVER" C-m; then - echo "Executed \"$AUTHSERVER\" inside $AUTHSERVER_SESSION" - #echo "You can attach to $AUTHSERVER_SESSION and check the result using \"tmux attach -t $AUTHSERVER_SESSION\"" -else - echo "Error when executing \"$AUTHSERVER\" inside $AUTHSERVER_SESSION" -fi -echo " " - -if tmux send-keys -t $WORLDSERVER_SESSION "$WORLDSERVER" C-m; then - echo "Executed \"$WORLDSERVER\" inside $WORLDSERVER_SESSION" - #echo "You can attach to $WORLDSERVER_SESSION and check the result using \"tmux attach -t $WORLDSERVER_SESSION\"" -else - echo "Error when executing \"$WORLDSERVER\" inside $WORLDSERVER_SESSION" -fi -echo " " - -echo "###########################################################################################" -echo "# type in terminal: " -echo "# - 'wow' : for the worlds-server session" -echo "# - 'auth' : for the auth-server session" -echo "# - 'ctrl+b then d' : detach from session (if not working use ctrl-z)" -echo "# - 'stop' : the kill the world and auth -server sessions" -echo "# - 'update' : -echo "###########################################################################################" +#!/bin/bash +ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" +source ${ROOT_DIR}/variables.sh + + +########################################################################################## +# Apply server realm configuration +########################################################################################## +source ${ROOT_DIR}/helper/update_realm_ip.sh ${REALM_IP} +source ${ROOT_DIR}/helper/update_realm_ip.sh ${REALM_NAME} +echo " " + + +########################################################################################## +# Apply ah-bot custom configuration +########################################################################################## +source ${ROOT_DIR}/helper/update_ahbot_config.sh ${AH_BOT_MIN_ITEMS} ${AH_BOT_MAX_ITEMS} +echo " " + + +########################################################################################## +# Clear playerbots account and characters (enforces performance and bot levels balance) +########################################################################################## +source ${ROOT_DIR}/helper/clear_playerbots.sh +echo " " + + +########################################################################################## +# handle the tmux sessions +########################################################################################## +if tmux new-session -d -s $AUTHSERVER_SESSION; then + echo "Created authserver session: $AUTHSERVER_SESSION" +else + echo "Error when trying to create authserver session: $AUTHSERVER_SESSION" +fi +echo " " + +if tmux new-session -d -s $WORLDSERVER_SESSION; then + echo "Created worldserver session: $WORLDSERVER_SESSION" +else + echo "Error when trying to create worldserver session: $WORLDSERVER_SESSION" +fi +echo " " + +if tmux send-keys -t $AUTHSERVER_SESSION "$AUTHSERVER" C-m; then + echo "Executed \"$AUTHSERVER\" inside $AUTHSERVER_SESSION" + #echo "You can attach to $AUTHSERVER_SESSION and check the result using \"tmux attach -t $AUTHSERVER_SESSION\"" +else + echo "Error when executing \"$AUTHSERVER\" inside $AUTHSERVER_SESSION" +fi +echo " " + +if tmux send-keys -t $WORLDSERVER_SESSION "$WORLDSERVER" C-m; then + echo "Executed \"$WORLDSERVER\" inside $WORLDSERVER_SESSION" + #echo "You can attach to $WORLDSERVER_SESSION and check the result using \"tmux attach -t $WORLDSERVER_SESSION\"" +else + echo "Error when executing \"$WORLDSERVER\" inside $WORLDSERVER_SESSION" +fi + +echo " " +echo "###########################################################################################" +echo "## After the above you can use the following commands:" +echo "### update - Updates source-code to latest version" +echo "### build - Builds the server based on source-code" +echo "### compile - Compiles the code based on the build server" +echo "### config - Applies the server configration" +echo "### start - starts auth and world in tmux sessions server" +echo "### stop - stops all sessions" +echo "### wow - logon world-server (tmux) session" +echo "### auth - logon auth-server (tmux) session" +echo "###########################################################################################" diff --git a/helper/clear-ah.sh b/helper/clear-ah.sh deleted file mode 100755 index 76094a0..0000000 --- a/helper/clear-ah.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -read -p "This will delete all items of the auction house, are you sure? (Y)es/(N)o: " -n 1 -r -echo " "; -if [[ $REPLY =~ ^[Yy]$ ]]; -then - - sudo mysql -u root --database="acore_characters" -e "DELETE FROM auctionhouse;" - -fi - diff --git a/helper/clear_auctionhouse.sh b/helper/clear_auctionhouse.sh new file mode 100755 index 0000000..155fd58 --- /dev/null +++ b/helper/clear_auctionhouse.sh @@ -0,0 +1,7 @@ +#!/bin/bash +ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/.. +source ${ROOT_DIR}/variables.sh + +sudo mysql -u root --database="acore_characters" < ${ROOT_DIR}/sql/clear_auctionhouse.sql + +echo "Auction house items deleted..." diff --git a/helper/clear_playerbots.sh b/helper/clear_playerbots.sh new file mode 100755 index 0000000..071aa11 --- /dev/null +++ b/helper/clear_playerbots.sh @@ -0,0 +1,7 @@ +#!/bin/bash +ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/.. +source ${ROOT_DIR}/variables.sh + +sudo mysql -u root --database="acore_characters" < ${ROOT_DIR}/sql/clear_playerbots.sql + +echo "Playerbots accounts and characters deleted..." diff --git a/helper/find-character.sh b/helper/find-character.sh deleted file mode 100755 index 641d5ae..0000000 --- a/helper/find-character.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -if [ -z "$1" ] -then - echo "Parameter is null, first paramter 'character name' should not be empty"; - exit 1; -fi - -# find character and account id by name, mainly used for configuring the ah-bot mod. -sudo mysql -u root --database="acore_auth" -e "select acc.id as accountId, ch.guid as characterId from acore_auth.account as acc inner join acore_characters.characters as ch where acc.id = ch.account and acc.username = '${1}';" diff --git a/helper/find_characters.sh b/helper/find_characters.sh new file mode 100755 index 0000000..853e1c6 --- /dev/null +++ b/helper/find_characters.sh @@ -0,0 +1,16 @@ +#!/bin/bash +ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/.. +source ${ROOT_DIR}/variables.sh + +ACCOUNT_NAME=$1; +if [ -z "$ACCOUNT_NAME" ] +then + echo "First parameter 'ACCOUNT_NAME' is required"; + exit 1; +fi + +sed -e "s/{{ACCOUNT_NAME}}/$ACCOUNT_NAME/g" \ + "${ROOT_DIR}/sql/find_character.sql" > "/tmp/find_character.sql" +sudo mysql -u root --database="acore_characters" < /tmp/find_character.sql + +echo "Find character executed..." diff --git a/helper/git-alias.sh b/helper/git-alias.sh new file mode 100755 index 0000000..4a378a0 --- /dev/null +++ b/helper/git-alias.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +# Alias GIT (git lg for git commits, git ls for commits with changed files) +git config --global alias.lg 'log --graph --abbrev-commit --decorate --date=relative --all' +git config --global alias.ls 'log --stat --pretty=short --graph' diff --git a/lib/merge_core.sh b/helper/merge_core.sh similarity index 97% rename from lib/merge_core.sh rename to helper/merge_core.sh index 6311f17..403ba40 100755 --- a/lib/merge_core.sh +++ b/helper/merge_core.sh @@ -1,28 +1,28 @@ -#!/bin/bash -ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" - - -########################################################################################## -# General dependencies -########################################################################################## -sudo apt update && sudo apt install -y git - -read -p "Merge the orginal azerothcore code into the playerbot azerothcore, are you sure? (Y)es/(N)o: " -n 1 -r -echo " "; -if [[ $REPLY =~ ^[Yy]$ ]]; -then - ########################################################################################## - # Try to merge from the orginal azerothcore into the playerbot azerothcore fork branch - ########################################################################################## - cd ${ROOT_DIR}/../_download/azerothcore - git reset --hard origin/Playerbot - git fetch upstream - git merge upstream/master - echo " " - - echo "###########################################################################################" - echo "## If (conflict) error just run update (2_update.sh) again to restore to the latest" - echo "## version of the playerbot branch" - echo "###########################################################################################" - -fi +#!/bin/bash +ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" + + +########################################################################################## +# General dependencies +########################################################################################## +sudo apt update && sudo apt install -y git + +read -p "Merge the orginal azerothcore code into the playerbot azerothcore, are you sure? (Y)es/(N)o: " -n 1 -r +echo " "; +if [[ $REPLY =~ ^[Yy]$ ]]; +then + ########################################################################################## + # Try to merge from the orginal azerothcore into the playerbot azerothcore fork branch + ########################################################################################## + cd ${ROOT_DIR}/../_download/azerothcore + git reset --hard origin/Playerbot + git fetch upstream + git merge upstream/master + echo " " + + echo "###########################################################################################" + echo "## If (conflict) error just run update (2_update.sh) again to restore to the latest" + echo "## version of the playerbot branch" + echo "###########################################################################################" + +fi diff --git a/helper/update_ahbot_config.sh b/helper/update_ahbot_config.sh new file mode 100755 index 0000000..409bb03 --- /dev/null +++ b/helper/update_ahbot_config.sh @@ -0,0 +1,24 @@ +#!/bin/bash +ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/.. +source ${ROOT_DIR}/variables.sh + +AH_BOT_MIN_ITEMS=$1; +if [ -z "$AH_BOT_MIN_ITEMS" ] +then + echo "First parameter 'AH_BOT_MIN_ITEMS' is required"; + exit 1; +fi +AH_BOT_MAX_ITEMS=$2 +if [ -z "$AH_BOT_MAX_ITEMS" ] +then + echo "Second parameter 'AH_BOT_MAX_ITEMS' is required"; + exit 1; +fi + + +sed -e "s/{{AH_BOT_MIN_ITEMS}}/$AH_BOT_MIN_ITEMS/g" \ + -e "s/{{AH_BOT_MAX_ITEMS}}/$AH_BOT_MAX_ITEMS/g" \ + > "${ROOT_DIR}/sql/update_ahbot_config.sql" > "/tmp/update_ahbot_config.sql" +sudo mysql -u root --database="acore_characters" < /tmp/update_ahbot_config.sql + +echo "AH-bot config updated..." \ No newline at end of file diff --git a/helper/update_realm_ip.sh b/helper/update_realm_ip.sh new file mode 100755 index 0000000..9eb3aea --- /dev/null +++ b/helper/update_realm_ip.sh @@ -0,0 +1,17 @@ +#!/bin/bash +ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/.. +source ${ROOT_DIR}/variables.sh + +REALM_IP=$1; +if [ -z "$REALM_IP" ] +then + echo "First parameter 'REALM_IP' is required"; + exit 1; +fi + + +sed -e "s/{{REALM_IP}}/$REALM_IP/g" \ + "${ROOT_DIR}/sql/update_realm_ip.sql" > "/tmp/update_realm_ip.sql" +sudo mysql -u root --database="acore_characters" < /tmp/update_realm_ip.sql + +echo "Server realm IP updated..." \ No newline at end of file diff --git a/helper/update_realm_name.sh b/helper/update_realm_name.sh new file mode 100755 index 0000000..98e0e99 --- /dev/null +++ b/helper/update_realm_name.sh @@ -0,0 +1,17 @@ +#!/bin/bash +ROOT_DIR="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/.. +source ${ROOT_DIR}/variables.sh + +REALM_NAME=$1; +if [ -z "$REALM_NAME" ] +then + echo "First parameter 'REALM_NAME' is required"; + exit 1; +fi + + +sed -e "s/{{REALM_NAME}}/$REALM_NAME/g" \ + "${ROOT_DIR}/sql/update_realm_name.sql" > "/tmp/update_realm_name.sql" +sudo mysql -u root --database="acore_characters" < /tmp/update_realm_name.sql + +echo "Server realm name updated..." \ No newline at end of file diff --git a/lib/general-settings.sh b/lib/general-settings.sh deleted file mode 100755 index d18bc56..0000000 --- a/lib/general-settings.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -########################################################################################## -# General settings -########################################################################################## -# Setting execute rights for the scripts -sudo chmod +x ${ROOT_DIR}/*.sh -sudo chmod +x ${ROOT_DIR}/lib/*.sh -sudo chmod +x ${ROOT_DIR}/helper/*.sh - -# Alias GIT (git lg for git commits, git ls for commits with changed files) -git config --global alias.lg 'log --graph --abbrev-commit --decorate --date=relative --all' -git config --global alias.ls 'log --stat --pretty=short --graph' diff --git a/sql/clear_auctionhouse.sql b/sql/clear_auctionhouse.sql new file mode 100755 index 0000000..83f11f8 --- /dev/null +++ b/sql/clear_auctionhouse.sql @@ -0,0 +1,2 @@ +USE acore_characters; +DELETE FROM auctionhouse; diff --git a/lib/clear-bots.sql b/sql/clear_playerbots.sql old mode 100644 new mode 100755 similarity index 99% rename from lib/clear-bots.sql rename to sql/clear_playerbots.sql index 390c57f..ee457b4 --- a/lib/clear-bots.sql +++ b/sql/clear_playerbots.sql @@ -1,30 +1,30 @@ -DELETE FROM `acore_playerbots`.`playerbots_random_bots`; -UPDATE `acore_characters`.`playerbots_names` SET `in_use`=0; -DELETE FROM `acore_characters`.`characters` WHERE `account` IN (SELECT `id` FROM `acore_auth`.`account` WHERE `username` LIKE 'RNDBOT%') OR `account` NOT IN (SELECT `id` FROM `acore_auth`.`account`); -DELETE FROM `acore_characters`.`character_account_data` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_achievement` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_achievement_progress` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_action` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_aura` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_glyphs` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_homebind` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`item_instance` WHERE `owner_guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_inventory` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`pet_aura` WHERE `guid` IN (SELECT `id` FROM `acore_characters`.`character_pet` WHERE `owner` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`)); -DELETE FROM `acore_characters`.`pet_spell` WHERE `guid` IN (SELECT `id` FROM `acore_characters`.`character_pet` WHERE `owner` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`)); -DELETE FROM `acore_characters`.`pet_spell_cooldown` WHERE `guid` IN (SELECT `id` FROM `acore_characters`.`character_pet` WHERE `owner` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`)); -DELETE FROM `acore_characters`.`character_pet` WHERE `owner` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_queststatus` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_queststatus_rewarded` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_reputation` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_skills` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_social` WHERE `friend` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_spell` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_spell_cooldown` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`character_talent` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`corpse` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`groups` WHERE `leaderGuid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`group_member` WHERE `memberGuid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`mail` WHERE `receiver` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_characters`.`mail_items` WHERE `receiver` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); -DELETE FROM `acore_auth`.`account` WHERE `username` LIKE 'RNDBOT%'; +DELETE FROM `acore_playerbots`.`playerbots_random_bots`; +UPDATE `acore_characters`.`playerbots_names` SET `in_use`=0; +DELETE FROM `acore_characters`.`characters` WHERE `account` IN (SELECT `id` FROM `acore_auth`.`account` WHERE `username` LIKE 'RNDBOT%') OR `account` NOT IN (SELECT `id` FROM `acore_auth`.`account`); +DELETE FROM `acore_characters`.`character_account_data` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_achievement` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_achievement_progress` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_action` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_aura` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_glyphs` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_homebind` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`item_instance` WHERE `owner_guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_inventory` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`pet_aura` WHERE `guid` IN (SELECT `id` FROM `acore_characters`.`character_pet` WHERE `owner` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`)); +DELETE FROM `acore_characters`.`pet_spell` WHERE `guid` IN (SELECT `id` FROM `acore_characters`.`character_pet` WHERE `owner` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`)); +DELETE FROM `acore_characters`.`pet_spell_cooldown` WHERE `guid` IN (SELECT `id` FROM `acore_characters`.`character_pet` WHERE `owner` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`)); +DELETE FROM `acore_characters`.`character_pet` WHERE `owner` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_queststatus` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_queststatus_rewarded` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_reputation` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_skills` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_social` WHERE `friend` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_spell` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_spell_cooldown` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`character_talent` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`corpse` WHERE `guid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`groups` WHERE `leaderGuid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`group_member` WHERE `memberGuid` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`mail` WHERE `receiver` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_characters`.`mail_items` WHERE `receiver` NOT IN (SELECT `guid` FROM `acore_characters`.`characters`); +DELETE FROM `acore_auth`.`account` WHERE `username` LIKE 'RNDBOT%'; diff --git a/sql/find_character.sql b/sql/find_character.sql new file mode 100755 index 0000000..ec3f421 --- /dev/null +++ b/sql/find_character.sql @@ -0,0 +1,5 @@ +USE acore_auth; +SELECT acc.id AS accountId, ch.name as characterName, ch.guid AS characterId, +FROM acore_auth.account AS acc +INNER JOIN acore_characters.characters AS ch +WHERE acc.id = ch.account and acc.username = '{{ACCOUNT_NAME}}'; diff --git a/sql/update_ahbot_config.sql b/sql/update_ahbot_config.sql old mode 100644 new mode 100755 index d0f45c9..6a041e7 --- a/sql/update_ahbot_config.sql +++ b/sql/update_ahbot_config.sql @@ -1,3 +1,3 @@ -USE acore_world; -UPDATE mod_auctionhousebot -SET minitems = 30000, maxitems = 40000; +USE acore_world; +UPDATE mod_auctionhousebot +SET minitems = '{{AH_BOT_MIN_ITEMS}}', maxitems = '{{AH_BOT_MAX_ITEMS}}'; diff --git a/sql/update_realm_ip.sql b/sql/update_realm_ip.sql old mode 100644 new mode 100755 index 403b041..bb391b4 --- a/sql/update_realm_ip.sql +++ b/sql/update_realm_ip.sql @@ -1,3 +1,3 @@ -USE acore_auth; -SELECT * FROM realmlist; -UPDATE realmlist SET address='192.168.178.185'; +USE acore_auth; +SELECT * FROM realmlist; +UPDATE realmlist SET address='{{REALM_IP}}'; diff --git a/sql/update_realm_name.sql b/sql/update_realm_name.sql old mode 100644 new mode 100755 index f4923e3..40ac0d1 --- a/sql/update_realm_name.sql +++ b/sql/update_realm_name.sql @@ -1,3 +1,3 @@ -USE acore_auth; -SELECT * FROM realmlist; -UPDATE realmlist SET name='azerothcore.org'; +USE acore_auth; +SELECT * FROM realmlist; +UPDATE realmlist SET name='{{REALM_NAME}}'; diff --git a/variables.sh b/variables.sh index 1d1d12a..e128355 100755 --- a/variables.sh +++ b/variables.sh @@ -34,9 +34,3 @@ REALM_NAME="azerothcore.org" AH_BOT_MIN_ITEMS=25000 AH_BOT_MAX_ITEMS=30000 - - -########################################################################################## -# General settings -########################################################################################## -source ${ROOT_DIR}/lib/general-settings.sh