MangOs搭建魔兽世界私服
话不多说,开整!考虑再三,我选择了CentOs来做游戏的服务端操作系统。
通过Git获得Mangos的源码之后自行编译搭建服务器。
这么做处于几方面的考虑。
[*]我看不起Windows操作系统。
[*]我更看不起那些Win系列一键安装包。
[*]考虑的可持续运行的服务器,Centos肯定是不二之选。
[*]不自己编译安装,怎么能进步呢?
[*]万一后期自己想修改游戏,设计任务,添加物品呢?
[*]没错,我就喜欢开手动挡。自动挡,那是给残疾人开的。
首先在本地安装虚拟机,虚拟一台纯净的Centos7操作系统。
把该打的补丁都给打了(yum update)
完了之后,咱们安装一些基础的组件和环境。
Yum install git cmake gcc patch autoconf mariadb-server mariadb-devel libtool zfstream gcc-c++ subversion boost-devel
如果有些组件提示没找到,无所谓。继续往下。
我编译安装的第一个版本是cmangos。
这个版本支持机器人,地图提取工具。在编译的时候可以添加参数。
cmake -DCMAKE_INSTALL_PREFIX= -DBUILD_EXTRACTORS=ON -DPCH=1 -DDEBUG=0 -DBUILD_PLAYERBOT=ON
编译参数中:
DCMAKE_INSTALL_PREFIX是指你的服务端安装目录,可以自定义。
DBUILD_EXTRACTORS是指是否安装地图提取工具
DBUILD_PLAYERBOT是指是否打开机器人
这里我做科普2:
首先是科普1我们提到过,MangOs是一个大型多人在线角色扮演的游戏服务器程序框架。理论上他是可以模拟所有的络游戏的。
既然,现在我们用它来模拟魔兽世界。那么肯定要对魔兽世界进行独立的一些补充(数据补充)。这就是上边地图提取工具那个参数的作用。我们需要上传一个魔兽客户端(你想要搭建的版本)的地图文件。然后我们使用地图提取工具,对客户端进行分析和提取。配上专用的数据库来模拟暴雪的游戏服务端。
至于那个机器人吗?那是个笑话,请自行忽略。
我们继续,我把整理好的搭建步骤列一个明细:
[*]首先使用git选择一个自己喜欢的版本git到本地服务器。
[*]然后设置编译参数开始编译。
[*]提取地图放到服务端(下载别人编译好的可以不用自己提取)。
[*]下载安装导入数据库(感谢Mangos使用了mysql数据库)
[*]对服务器进行配置。
[*]启动服务器。
[*]配置客户端的服务器链接地址。
[*]开始游戏。
这中间,我把一些别人不会告诉你的关键步骤做科普3:
[*]在编译的时候需要用到gcc、cmake3、ace等几个核心支持。
[*]某些特殊的服务器版本,不支持地图提取工具的参数。只能曲线救国去找,下载别人提取好的地图文件(我这里去找了个别人制作的win一键安装包,借用了他们的地图文件)。
[*]数据库汉化是个细致的活儿。没有编程数据库基础的,建议曲线救国。
[*]有些魔兽客户端版本,并没有太好的大脚插件支持。(反正我玩怀旧感觉大脚怀旧服专用版就做得很好,可惜不兼容我的1.12.1)
放几个链接仅做Mark:
Cmake3 安装
https://blog.csdn.net/weixin_38883338/article/details/86408749
Gcc 6
https://blog.csdn.net/Al_xin/article/details/92438055
ACE6.3.3
https://blog.csdn.net/u010587274/article/details/50965369
Git源码和数据库编译安装服务器
git clone git://github.com/cmangos/mangos-classic.git mangos
git clone git://github.com/cmangos/classic-db.git
ACE的编译安装和地图提取,确实有点耗费性能和时间,不过地图和数据库后期你熟悉了可以越过,而上述三个环境的安装是铁定要做的。
我们来说一下服务器的配置。
在编译好服务端,上传提取好的地图后。我们要设置两个文件来启动服务器。分别是etc目录下的:
[*]mangosd.conf(服务器参数配置)
[*]realmd.conf(账户认证服务配置)
有几个关键点,我整理如下:
[*]首先是地图目录的配置,你可以写绝对路径,或者相对路径。只要写不正确,服务器启动不起来。会提示xxx.map exits之类的。意思就是找不到地图文件。
[*]你要配置数据库的链接地址这里可以连接远程,本地都ok。只要连接地址、数据库用户名、密码、数据库名字正确就ok。
[*]我们一般会配置一下进入游戏的欢迎语,人物出生的携带金钱和出生等级,还有打怪升级的经验倍数这些参数。
[*]如果你需要做一些有特色的的东西。可能就涉及到修改数据库了。比如说人物出生送T3套装。这个就需要去数据库中进行配置。
[*]如果你是为了让朋友一起来玩。就吧那个BindIP给注释掉。否则可能引起一些无法连上服务器的奇怪现象。
参数名称:
地图目录
DataDir = “../data”
日志目录
LogsDir = “../logs”
游戏欢迎语
Motd= “游戏欢迎语”
出生等级
StartPlayerLevel = 1
出生携带金钱1000G
StartPlayerMoney = 10000000
杀怪经验5倍
Rate.XP.Kill = 5
任务经验15倍
Rate.XP.Quest = 15
探索地图10倍
Rate.XP.Explore = 10
数据库连接(应该有3-4条之多,按下面格式修改即可)
LoginDatabase.Info = “地址;端口;用户名;密码;数据库”
配置结束,就是启动。
因为,我们搭建的服务器属于广域网,可以让朋友一起来玩的。那么肯定要对防火墙这些进行配置。否则防火墙会阻断服务端提供服务。
我们需要开启如下端口:
8085,9600,3724
把他们添加到你防火墙的白名单即可。
(当然,考虑安全呢你可以修改一下端口号。这我就不多费口舌了)
一些收尾工作:
[*]主要是对服务器进行安全加固,例如修改ssh登录端口,禁止root登录。开启防火墙等等。
[*]对游戏数据进行定时备份。毕竟是自己家的服务器,有时候可能会来做一些测试。数据备份显得就非常重要了。我反正是1小时已备份。这个用shell脚本去备份mysql数据库即可(注意清理)。
[*]可以要制作一个网页,开放给新用户去注册、修改密码、下载客户端等等。这个就是另一项技术了。有机会我们再聊。
yum install git
git clone https://github.com/mangostwo/server.git
git clone https://github.com/mangostwo/database.git
<div><span class="hl hl-1">wget</span> https://cmake.org/files/v3.0/cmake-3.0.0.tar.gz</div><div>tar xvf cmake-3.0.0.tar.gz && cd cmake-3.0.0/</div><div>./<span class="hl hl-1">bootstrap</span></div><div>gmake</div><div>gmake install</div><div>/usr/local/bin/cmake --version</div><div>yum remove cmake -y</div><div>ln -s /usr/local/bin/cmake /usr/bin/</div><div>cmake --version</div>
yum -y install centos-release-scl
yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils
scl enable devtoolset-7 bash
echo "source /opt/rh/devtoolset-7/enable" >>/etc/profile
# 查看安装的包
scl -l
yum -y install rh-python35
scl enable rh-python35 bash
echo "source /opt/rh/rh-python35/enable" >>/etc/profile
wget -c https://download.dre.vanderbilt.edu/previous_versions/ACE-6.3.3.tar.gz
tar -xvf ACE-6.3.3.tar.gz
vi /etc/profile
#在文本尾部添加:
export ACE_ROOT=/root/ACE_wrappers
export LD_LIBRARY_PATH=$ACE_ROOT/lib:$LD_LIBRARY_PATH
vi /root/ACE_wrappers/ace/config.h
#写入如下内容:
<code>#include "ace/config-linux.h"
</code>
vi /root/ACE_wrappers/include/makeinclude/platform_macros.GNU
写入如下内容:
<code>include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU</code>
<code>INSTALL_PREFIX = /usr/local</code>
chmod 775 -R /root/ACE_wrappers
cd /root/ACE_wrappers/
make
make install
wget -c https://raw.githubusercontent.com/mangostwo/server/master/linux/getmangos.sh && bash getmangos.sh
#!/bin/bash
###############################################################################
# MaNGOS Build Automation Script #
# Written By: Ryan Ashley #
# Updated By: Cedric Servais #
# Copyright (C) 2014-2022 MaNGOS https://getmangos.eu/ #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
# Global variables
DLGAPP="whiptail"
VERSION="2"
ROOTPATH="$HOME"
SRCPATH="$HOME/mangos/src"
INSTPATH="$HOME/mangos"
DB_PREFIX="two"
USER="mangos"
P_SOAP="0"
P_DEBUG="0"
P_STD_MALLOC="1"
P_ACE_EXTERNAL="1"
P_PGRESQL="0"
P_TOOLS="0"
P_SD3="1"
P_ELUNA="1"
P_BOTS="0"
CMAKE_CMD="cmake"
function UseCmake3()
{
# set the command to cmake3 if its there
which cmake3
if [ $? -eq 0 ]; then
CMAKE_CMD="cmake3"
fi
}
# Function to test for dialog
function UseDialog()
{
# Search for dialog
which dialog
# See if dialog was found
if [ $? -eq 0 ]; then
DLGAPP="dialog"
fi
}
# Function to test if the user is root or not
function CheckRoot()
{
if [ "$(id -u)" != "0" ]; then
Log "This script can only be used as root!" 1
exit 1
else
Log "User is root, check passed" 0
fi
}
# Function to detect the repos
function DetectLocalRepo()
{
local CUR_DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )"
# First see if the Windows stuff is in place
if [ ! -d ../win ]; then
Log "Windows files directory does not exist, assuming repo has not been cloned." 0
return 0
fi
# See if the sources dircetory exists
if [ ! -d ../src ]; then
Log "Source files directory does not exist, assuming repo has not been cloned." 0
return 0
fi
# Check for the CMake directory
if [ ! -d ../cmake ]; then
Log "CMake directory does not exist, assuming repo has not been cloned." 0
return 0
fi
# Set the default paths based on the current location
SRCPATH=$( dirname $CUR_DIR )
SRCPATH=$( dirname $SRCPATH )
# Log the detected path
Log "Detected cloned repository in $SRCPATH" 0
}
# Function to log results
function Log()
{
local TIMESTAMP=$( date +%Y-%m-%d:%H:%M:%S )
# Check the number of parameters
if [ $# -ne 2 ]; then
echo "Logging usage: Log <message> <echo flag>"
return 1
fi
# Echo to the console if requested
if [ $2 -eq 1 ]; then
echo "$1"
fi
# Append the string to the log
echo "$TIMESTAMP $1" >> ~/getmangos.log
}
# Function to install prerequisite libraries
function GetPrerequisites()
{
# First, we need to check the installer.
installer=0
which apt-get
if [ $? -ne 0 ]; then
Log "apt-get isn't the installer by default" 1
else
installer=1
# On a fresh OS boot (EC2) libace was not found without first updating
apt-get update -y && apt-get -y install git lsb-release curl
fi
which yum
if [ $? -ne 0 ]; then
Log "yum isn't the installer by default" 1
else
installer=1
yum -y install git redhat-lsb curl
fi
which aptitude
if [ $? -ne 0 ]; then
Log "aptitude isn't the installer by default" 1
else
installer=1
aptitude -y install git lsb-release curl
fi
# Then, let's check that we have the necessary tools to define the OS version.
which lsb_release
if [ $? -ne 0 ]; then
Log "Cannot define your OS distribution and version." 1
return 0
fi
local OS=$(lsb_release -si)
local VER=$(lsb_release -sc)
local OS_VER=1
# Ask the user to continue
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install Required Dependencies" \
--yesno "Would you like to install the required build and development packages?" 8 60
# Check the user's response
if [ $? -ne 0 ]; then
Log "User declined to install required tools and development libraries." 1
return 0
fi
# Inform the user of the need for root access
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install Required Dependencies" \
--yesno "Installing packages requires root access, which you will be prompted for.\nDo you want to proceed?" 8 60
# Check the user's response
if [ $? -ne 0 ]; then
Log "User declined to proved root access for package installation." 1
return 0
fi
# Handle OS
case ${OS} in
"LinuxMint")
case ${VER} in
"sarah")
# Linux Mint 18 - Ubuntu Xenial based
su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
;;
"rosa")
# Linux Mint 17.3 - Ubuntu Trusty based
su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
;;
"rafaela")
# Linux Mint 17.2 - Ubuntu Trusty based
su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
;;
"rebecca")
# Linux Mint 17.1 - Ubuntu Trusty based
su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
;;
"qiana")
# Linux Mint 17 - Ubuntu Trusty based
su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
;;
"maya")
# Linux Mint 13 - Ubuntu Precise based
su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
;;
"betsy")
# LMDE 2 - Debian Jessie based
su -c "aptitude -y install build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev libace-6.2.8 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
;;
*)
OS_VER=0
;;
esac
;;
"Ubuntu")
case ${VER} in
"precise")
# Ubuntu 12.04 LTS
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
;;
"trusty")
# Ubuntu 14.04 LTS
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
;;
"xenial")
# Ubuntu 16.04 LTS
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
;;
"yakkety")
# Ubuntu 16.10
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
;;
"zesty")
# Ubuntu 17.04
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
;;
"artful")
# Ubuntu 17.10
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
;;
"bionic")
# Ubuntu 18.04 LTS
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
;;
"disco")
# Ubuntu 19.04
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
;;
"focal")
# Ubuntu 20.04
su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
;;
*)
OS_VER=0
;;
esac
;;
"Debian")
case ${VER} in
"jessie")
# Debian 8.0 "current"
su -c "aptitude -y install curl build-essential autoconf automake cmake libbz2-dev libace-dev libssl-dev default-libmysqlclient-dev libtool" root
;;
"stretch")
# Debian Next
su -c "aptitude -y install curl build-essential autoconf automake cmake libbz2-dev libace-dev libssl-dev default-libmysqlclient-dev libtool" root
;;
*)
OS_VER=0
;;
esac
;;
"RedHatEntrepriseServer")
case ${VER} in
"santiago")
# Red Hat 6.x
su -c "yum -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev ace-6.3.3 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
;;
"maipo")
# Red Hat 7.x
su -c "yum -y install curl build-essential linux-headers-$(uname -r) autoconf automake cmake libbz2-dev libace-dev ace-6.3.3 libssl-dev libmysqlclient-dev libtool zliblg-dev" root
;;
*)
OS_VER=0
;;
esac
;;
"CentOS")
case ${VER} in
"Core")
# Default CentOS - Adding necessary RPM third-party.
rpm -Uv ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/devel:/libraries:/ACE:/micro/CentOS_7/x86_64/ace-6.3.3-55.1.x86_64.rpm
rpm -Uv ftp://rpmfind.net/linux/centos/7/os/x86_64/Packages/perl-Net-Telnet-3.03-19.el7.noarch.rpm
rpm -Uv ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/devel:/libraries:/ACE:/micro:/versioned/CentOS_7/x86_64/mpc-6.3.3-42.1.x86_64.rpm
rpm -Uv ftp://rpmfind.net/linux/centos/7/os/x86_64/Packages/libtool-2.4.2-22.el7_3.x86_64.rpm
rpm -Uv ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/devel:/libraries:/ACE:/micro/CentOS_7/x86_64/ace-devel-6.3.3-55.1.x86_64.rpm
su -c "yum -y install epel-release"
su -c "yum -y install curl autoconf automake cmake3 ace-devel ace-6.3.3 openssl-devel mysql-devel libtool gcc-c++ bzip2-devel" root
;;
*)
OS_VER=0
;;
esac
;;
"Fedora")
case ${VER} in
"TwentyFive")
# Fedora 25 - Adding necessary RPM third-party.
su -c "yum -y install autoconf automake libtool gcc-c++" root
# Getting and building ACE. Not provided in RPM for Fedora...
rm -rf ACE-6.3.3.tar.bz2
rm -rf ACE_wrappers
wget ftp://download.dre.vanderbilt.edu/previous_versions/ACE-6.3.3.tar.bz2
tar xjvf ACE-6.3.3.tar.bz2
export ACE_ROOT=/root/ACE_wrappers
echo '#include "ace/config-linux.h"' >> $ACE_ROOT/ace/config.h
echo 'include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU' >> $ACE_ROOT/include/makeinclude/platform_macros.GNU
echo 'INSTALL_PREFIX=/usr/local' >> $ACE_ROOT/include/makeinclude/platform_macros.GNU
export LD_LIBRARY_PATH=$ACE_ROOT/lib:$LD_LIBRARY_PATH
CD $ACE_ROOT
make
make install
cd ~
# Installing remaining dependencies..
su -c "yum -y install cmake openssl-devel mariadb-devel" root
;;
*)
OS_VER=0
;;
esac
;;
*)
OS_VER=0
;;
esac
# See if a supported OS was detected
if [ ${OS_VER} -ne 0 ]; then
# Log success
Log "The development tools and libraries have been installed!" 1
else
# Note the error
Log "Could not identify the current OS. Nothing was installed." 1
fi
}
# Function to get the WoW version
function GetRelease()
{
VERSION=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Choose WoW Release" \
--menu "Select a version of WoW" 0 0 5 \
0 "Original Release (Vanilla)" \
1 "The Burning Crusade" \
2 "Wrath of The Lich King" \
3 "Cataclysm" \
4 "Mists of Pandaria" \
5 "Warlords of Draenor" \
3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "Version selection cancelled by user. No changes have been made to your system." 1
exit 0
fi
# Set some defaults based on the release
case "$VERSION" in
0)
SRCPATH="$ROOTPATH/zero/src"
INSTPATH="$ROOTPATH/zero"
DB_PREFIX="zero"
;;
1)
SRCPATH="$ROOTPATH/one/src"
INSTPATH="$ROOTPATH/one"
DB_PREFIX="one"
;;
2)
SRCPATH="$ROOTPATH/two/src"
INSTPATH="$ROOTPATH/two"
DB_PREFIX="two"
;;
3)
SRCPATH="$ROOTPATH/three/src"
INSTPATH="$ROOTPATH/three"
DB_PREFIX="three"
;;
4)
SRCPATH="$ROOTPATH/four/src"
INSTPATH="$ROOTPATH/four"
DB_PREFIX="four"
;;
5)
SRCPATH="$ROOTPATH/five/src"
INSTPATH="$ROOTPATH/five"
DB_PREFIX="five"
;;
*)
Log "Error: Unknown version selected!" 1
exit 1
;;
esac
# Now set the correct source path if the repo has been cloned already
DetectLocalRepo
}
# Function to setup the technical user
function GetUser()
{
local TMPUSER="$USER"
# Set the user
TMPUSER=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User to run Mangos" \
--inputbox "Default: $USER" 8 60 3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "User selection was cancelled. No changes have been made to your system." 1
exit 0
fi
# Change the user only if it was modified
if [ ! -z "$TMPUSER" ]; then
USER="$TMPUSER"
fi
# Validate user
id $USER > /dev/null 2>&1
if [ $? -ne 0 ]; then
Log "Creating user: $USER" 1
useradd -m -d /home/$USER $USER > /dev/null 2>&1
if [ $? -ne 0 ]; then
Log "Error: Failed to create the specified user!" 1
exit 1
fi
usermod -L $USER > /dev/null 2>&1
else
# User already exist, asking to keep the user
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User already exist" \
--yesno "Would you like to keep the user \"$USER\"?" 8 60
if [ $? -ne 0 ]; then
Log "Removing user: $USER" 1
userdel -r $USER > /dev/null 2>&1
Log "Creating user: $USER" 1
useradd -m -d /home/$USER $USER > /dev/null 2>&1
if [ $? -ne 0 ]; then
Log "Error: Failed to create the specified user!" 1
exit 1
fi
usermod -L $USER > /dev/null 2>&1
fi
fi
ROOTPATH="/home/"$USER
Log "User: $USER" 0
}
# Function to get the source and installation paths
function GetPaths()
{
local TMPPATH="$HOME"
# Set the source path
TMPPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Source-Code Path" \
--inputbox "Default: $SRCPATH" 8 60 3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "Source path selection was cancelled. No changes have been made to your system." 1
exit 0
fi
# Change the path only if it was modified
if [ ! -z "$TMPPATH" ]; then
SRCPATH="$TMPPATH"
fi
# Validate source path
if [ ! -d "$SRCPATH" ]; then
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path does not exist" \
--yesno "Would you like to create the directory \"$SRCPATH\"?" 8 60
if [ $? -eq 0 ]; then
Log "Creating source path: $SRCPATH" 1
mkdir -p "$SRCPATH" > /dev/null 2>&1
# Check to see if the directory was created
if [ $? -ne 0 ]; then
Log "Error: Failed to create the specified source-code directory!" 1
exit 1
fi
else
Log "Source path creation cancelled. No modifications have been made to your system." 1
exit 0
fi
else
# Check for old sources
if [ -d "$SRCPATH/server" ] || [ -d "$SRCPATH/database" ]; then
# Ask to remove the old sources
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path already exists" \
--yesno "Would you like to remove the old sources? (Answer yes if you are cloning MaNGOS)" 9 60
# Remove the old sources if requested
if [ $? -eq 0 ]; then
Log "Removing old sources from: $SRCPATH/*" 1
rm -rf $SRCPATH/*
# Check for removal failure
if [ $? -ne 0 ]; then
Log "Error: Failed to remove old sources!" 1
exit 1
fi
fi
fi
fi
# Set the installation path
TMPPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Installation Path" \
--inputbox "Default: $INSTPATH" 8 60 3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "Install path selection cancelled. Only the source path has been created." 1
exit 0
fi
# Change the path only if it was modified
if [ ! -z "$TMPPATH" ]; then
INSTPATH="$TMPPATH"
fi
# Validate install path
if [ ! -d "$INSTPATH" ]; then
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path does not exist" \
--yesno "Would you like to create the directory \"$INSTPATH\"?" 8 60
if [ $? -eq 0 ];then
Log "Creating install path: $INSTPATH" 1
mkdir -p "$INSTPATH" > /dev/null 2>&1
# Check to see if the directory was created
if [ $? -ne 0 ]; then
Log "Error: Failed to create the specified installation directory!" 1
exit 1
fi
else
Log "Install path creation cancelled. Only the source path has been created."
exit 0
fi
else
# Check for an old installation
if [ -d "$INSTPATH/bin" ] || [ -d "$INSTPATH/lib" ] || [ -d "$INSTPATH/include" ]; then
# Ask to remove the old installation
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path already exists" \
--yesno "Would you like to uninstall the current version of MaNGOS first?" 0 0
# Check the user's response
if [ $? -eq 0 ]; then
Log "Removing old MaNGOS installation..." 1
# Clean up the binaries
if [ -d "$INSTPATH/bin" ]; then
rm -rf $INSTPATH/bin
fi
# Clean up the old includes
if [ -d "$INSTPATH/include" ]; then
rm -rf $INSTPATH/include
fi
# Clean up the library files
if [ -d "$INSTPATH/lib" ]; then
rm -rf $INSTPATH/lib
fi
# Clean up the old logs
if [ -d "$INSTPATH/logs" ]; then
rm -rf $INSTPATH/logs/*
fi
fi
fi
fi
# Log the settings
Log "Install path: $INSTPATH" 0
Log "Source path: $SRCPATH" 0
}
# Function to clone or update sources
function GetMangos()
{
local CLONE="0"
local BRANCH=""
CLONE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Clone or update MaNGOS" \
--menu "Would you like to clone, update, or continue?" 0 0 3 \
0 "Clone a fresh copy of MaNGOS" \
1 "Update your existing copy of MaNGOS" \
2 "Use existing copy" \
3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "Source cloning cancelled. Only the install and source paths have been created." 1
exit 0
fi
# Clone from scratch if selected
if [[ $CLONE = *0* ]]; then
# Pull a different branch?
case "$VERSION" in
0)
releases=$(curl -s 'https://api.github.com/repos/mangoszero/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ')
;;
1)
releases=$(curl -s 'https://api.github.com/repos/mangosone/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ')
;;
2)
releases=$(curl -s 'https://api.github.com/repos/mangostwo/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ')
;;
3)
releases=$(curl -s 'https://api.github.com/repos/mangosthree/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ')
;;
4)
releases=$(curl -s 'https://api.github.com/repos/mangosfour/server/branches' | grep "name" | awk 'BEGIN{FS="\""}{print $4}' | tr '\n' ' ')
;;
*)
Log "Error: Unknown version to select branch" 1
;;
esac
COUNTER=1
RADIOLIST=""# variable where we will keep the list entries for radiolist dialog
for i in $releases; do
if [ $COUNTER -eq 1 ]; then
RADIOLIST="$RADIOLIST $COUNTER $i on "
BRANCH=$i
else
RADIOLIST="$RADIOLIST $COUNTER $i off "
fi
let COUNTER=COUNTER+1
done
TMPBRANCH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Branch" \
--radiolist "Default: $BRANCH" 0 0 $COUNTER \
$RADIOLIST \
3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "Branch selection cancelled. Only the install and source paths have been created." 1
exit 0
fi
BRANCH=$(echo $releases | awk '{print $'$TMPBRANCH'}')
# Set the branch
if [ -z "$BRANCH" ]; then
BRANCH="$releases | awk '{print $1}'"
fi
# Clone the selected version
case "$VERSION" in
0)
Log "Cloning Zero branch: $BRANCH" 1
git clone http://github.com/mangoszero/server.git "$SRCPATH/server" -b $BRANCH --recursive
git clone http://github.com/mangoszero/database.git "$SRCPATH/database" -b $BRANCH --recursive
;;
1)
Log "Cloning One branch: $BRANCH" 1
git clone http://github.com/mangosone/server.git "$SRCPATH/server" -b $BRANCH --recursive
git clone http://github.com/mangosone/database.git "$SRCPATH/database" -b $BRANCH --recursive
;;
2)
Log "Cloning Two branch: $BRANCH" 1
git clone http://github.com/mangostwo/server.git "$SRCPATH/server" -b $BRANCH --recursive
git clone http://github.com/mangostwo/database.git "$SRCPATH/database" -b $BRANCH --recursive
;;
3)
Log "Cloning Three branch: $BRANCH" 1
git clone http://github.com/mangosthree/server.git "$SRCPATH/server" -b $BRANCH --recursive
git clone http://github.com/mangosthree/database.git "$SRCPATH/database" -b $BRANCH --recursive
;;
4)
Log "Cloning Four branch: $BRANCH" 1
git clone http://github.com/mangosfour/server.git "$SRCPATH/server" -b $BRANCH --recursive
git clone http://github.com/mangosfour/database.git "$SRCPATH/database" -b $BRANCH --recursive
;;
*)
Log "Error: Unknown release selected for cloning!" 1
exit 1
;;
esac
# Log success
Log "Cloned the selected repository!" 1
fi
# Update the local repositories if selected
if [[ $CLONE = *1* ]]; then
Log "Updating your local repository..." 1
# Update the core sources
cd "$SRCPATH/server"
git pull
# Now update the database sources
cd "$SRCPATH/database"
git pull
# Log success
Log "Updated the local respository!" 1
fi
# use existing repository
if [[ $CLONE = *2* ]]; then
Log "Using existing local repository" 1
fi
}
# Function to set the build options
function GetBuildOptions()
{
# Select build options
OPTIONS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" \
--title "Build Options" \
--checklist "Please select your build options" 0 56 7 \
1 "Enable Debug" Off \
2 "Use Standard Malloc" On \
3 "Use External ACE Libraries" On \
4 "Use PostgreSQL Instead Of MySQL/MariaDB" Off \
5 "Build Client Tools" On \
6 "Use SD3" On \
7 "Use Eluna" On \
8 "Use SOAP" Off \
9 "Use Player Bots AI" Off \
3>&2 2>&1 1>&3)
if [ $? -ne 0 ]; then
Log "Build option selection cancelled. MaNGOS sources have been cloned." 1
return 0
fi
# See if debug was selected
if [[ $OPTIONS == *1* ]]; then
P_DEBUG="1"
else
P_DEBUG="0"
fi
# See if standard malloc was selected
if [[ $OPTIONS == *2* ]]; then
P_STD_MALLOC="1"
else
P_STD_MALLOC="0"
fi
# See if external ACE was selected
if [[ $OPTIONS == *3* ]]; then
P_ACE_EXTERNAL="1"
else
P_ACE_EXTERNAL="0"
fi
# See if PostgreSQL was selected
if [[ $OPTIONS == *4* ]]; then
P_PGRESQL="1"
else
P_PGRESQL="0"
fi
# See if the client tools were selected
if [[ $OPTIONS == *5* ]]; then
P_TOOLS="1"
else
P_TOOLS="0"
fi
# See if SD3 will be used
if [[ $OPTIONS == *6* ]]; then
P_SD3="1"
else
P_SD3="0"
fi
# See if Eluna will be used
if [[ $OPTIONS == *7* ]]; then
P_ELUNA="1"
else
P_ELUNA="0"
fi
# See if SOAP will be used
if [[ $OPTIONS == *8* ]]; then
P_SOAP="1"
else
P_SOAP="0"
fi
if [[ $OPTIONS == *9* ]]; then
P_BOTS="1"
else
P_BOTS="0"
fi
# Verify that at least one scripting library is enabled
if [ $P_SD3 -eq 0 ] && [ $P_ELUNA -eq 0 ]; then
Log "Error: You must enable either SD3, Eluna, or both to build MaNGOS!" 1
exit 1
fi
}
# Function to build MaNGOS
function BuildMaNGOS()
{
# Last chance to cancel building
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Proceed to build MaNGOS" \
--yesno "Are you sure you want to build MaNGOS?" 8 60
# Check the user's answer
if [ $? -ne 0 ]; then
Log "Cancelled by user. MaNGOS has been cloned but not built." 1
exit 0
fi
# See if the build directory exists and clean up if possible
if [ -d "$SRCPATH/server/linux" ]; then
# See if a makefile exists and clean up
if [ -f $SRCPATH/server/linux/Makefile ]; then
Log "Cleaning the old build..." 1
cd "$SRCPATH/server/linux"
make clean
fi
fi
# Attempt to create the build directory if it doesn't exist
if [ ! -d "$SRCPATH/server/linux" ]; then
mkdir "$SRCPATH/server/linux"
# See if creation was successful
if [ $? -ne 0 ]; then
Log "Error: Failed to create the build directory!" 1
exit 1
fi
fi
# Attempt to configure and build MaNGOS
Log "Building MaNGOS..." 0
cd "$SRCPATH/server/linux"
# make sure we are using the cmake3
UseCmake3
$CMAKE_CMD .. -DDEBUG=$P_DEBUG -DUSE_STD_MALLOC=$P_STD_MALLOC -DACE_USE_EXTERNAL=$P_ACE_EXTERNAL -DPOSTGRESQL=$P_PGRESQL -DBUILD_TOOLS=$P_TOOLS -DSCRIPT_LIB_ELUNA=$P_ELUNA -DSCRIPT_LIB_SD3=$P_SD3 -DSOAP=$P_SOAP -DPLAYERBOTS=$P_BOTS -DCMAKE_INSTALL_PREFIX="$INSTPATH"
make
# Check for an error
if [ $? -ne 0 ]; then
Log "There was an error building MaNGOS!" 1
exit 1
fi
# Log success
Log "MaNGOS has been built!" 0
}
# Function to install MaNGOS
function InstallMaNGOS()
{
# Ask to install now
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install MaNGOS" \
--yesno "Do you want to install MaNGOS now?" 8 0
# Return if no
if [ $? -ne 0 ]; then
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install MaNGOS" \
--msgbox "You may install MaNGOS later by changing to:\n$SRCPATH/server/linux\nAnd running: make install" 24 60
Log "MaNGOS has not been installed after being built." 1
exit 0
fi
# Install MaNGOS
cd "$SRCPATH/server/linux"
make install
# Make sure the install succeeded
if [ $? -ne 0 ]; then
Log "There was an error installing MaNGOS!" 1
exit 1
fi
}
# Function to apply database updates
function UpdateDatabases()
{
local DB_HOST="$1"
local DB_TYPE="$2"
local DB_COMMAND="$3"
local DB_USER="$4"
local DB_UPW="$5"
local DB_REALM="$6"
local DB_WORLD="$7"
local DB_TOONS="$8"
# Loop through the character files
for pFile in $(ls $SRCPATH/database/Character/Updates/$(ls -a $SRCPATH/database/Character/Updates/ | tail -1)/*.sql 2>>/dev/null); do
if [ ! -f "$pFile" ]; then
continue
fi
# Attempt to apply the update
$DB_COMMAND $DB_TOONS < "$pFile" > /dev/null 2>&1
# Notify the user of which updates were and were not applied
if [ $? -ne 0 ]; then
Log "Database update \"$pFile\" was not applied!" 0
Log "Database update \"$pFile\" was not applied!" 1
else
Log "Database update \"$pFile\" was successfully applied!" 0
Log "Database update \"$pFile\" was successfully applied!" 1
fi
done
# Loop through the realm files
for pFile in $(ls $SRCPATH/database/Realm/Updates/$(ls -a $SRCPATH/database/Realm/Updates/ | tail -1)/*.sql 2>>/dev/null); do
if [ ! -f "$pFile" ]; then
continue
fi
# Attempt to apply the update
$DB_COMMAND $DB_REALM < "$pFile" > /dev/null 2>&1
# Notify the user of which updates were and were not applied
if [ $? -ne 0 ]; then
Log "Database update \"$pFile\" was not applied!" 0
Log "Database update \"$pFile\" was not applied!" 1
else
Log "Database update \"$pFile\" was successfully applied!" 0
Log "Database update \"$pFile\" was successfully applied!" 1
fi
done
# Loop through the world files
for pFile in $(ls $SRCPATH/database/World/Updates/$(ls -a $SRCPATH/database/World/Updates/ | tail -1)/*.sql 2>>/dev/null); do
if [ ! -f "$pFile" ]; then
continue
fi
# Attempt to apply the update
$DB_COMMAND $DB_WORLD < "$pFile" > /dev/null 2>&1
# Notify the user of which updates were and were not applied
if [ $? -ne 0 ]; then
Log "Database update \"$pFile\" was not applied!" 0
Log "Database update \"$pFile\" was not applied!" 1
else
Log "Database update \"$pFile\" was successfully applied!" 0
Log "Database update \"$pFile\" was successfully applied!" 1
fi
done
}
# Function to install or reinstall the databases
function InstallDatabases()
{
local DB_HOST="$1"
local DB_TYPE="$2"
local DB_COMMAND="$3"
local DB_USER="$4"
local DB_UPW="$5"
local DB_REALM="$6"
local DB_WORLD="$7"
local DB_TOONS="$8"
# First create the realm database structure
$DB_COMMAND $DB_REALM < $SRCPATH/database/Realm/Setup/realmdLoadDB.sql
# Check for success
if [ $? -ne 0 ]; then
Log "There was an error creating the realm database!" 1
return 1
else
Log "The realm database has been created!" 1
fi
# Now create the characters database structure
$DB_COMMAND $DB_TOONS < $SRCPATH/database/Character/Setup/characterLoadDB.sql
# Check for success
if [ $? -ne 0 ]; then
Log "There was an error creating the characters database!" 1
return 1
else
Log "The characters database has been created!" 1
fi
# Next create the world database structure
$DB_COMMAND $DB_WORLD < $SRCPATH/database/World/Setup/mangosdLoadDB.sql
# Check for success
if [ $? -ne 0 ]; then
Log "There was an error creating the world database!" 1
return 1
else
Log "The world database has been created!" 1
fi
# Finally, loop through and build the world database database
for fFile in $SRCPATH/database/World/Setup/FullDB/*.sql; do
# Attempt to execute the SQL file
$DB_COMMAND $DB_WORLD < $fFile
# Check for success
if [ $? -ne 0 ]; then
Log "There was an error processing \"$fFile\" during database creation!" 1
return 1
else
Log "The file \"$fFile\" was processed properly" 1
fi
done
# Now apply any updates
UpdateDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
}
# Function to install or update the MySQL/MariaDB databases
function HandleDatabases()
{
local DBMODE="0"
local DB_TYPE="0"
local DB_COMMAND=""
local DB_TMP="0"
local DB_USER="mangos"
local DB_UPW="mangos"
local DB_HOST="localhost"
local DB_PORT="3306"
local DBSEL="3"
local DB_REALM="_realm"
local DB_WORLD="_world"
local DB_TOONS="_characters"
# Ask the user what to do here
DBMODE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Operations" \
--menu "What would you like to do?" 0 0 3 \
0 "Install clean databases" \
1 "Update existing databases" \
2 "Skip database work" \
3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "Database operations cancelled. No modifications have been made to your databases." 1
return 0
fi
# Exit if skipping
if [ "$DBMODE" = "2" ]; then
Log "Skipping database work. Nothing has been modified." 1
return 0
fi
# Ask the user the DB type
DB_TYPE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Type" \
--menu "Which database are you using?" 0 0 3 \
0 "MariaDB" \
1 "MySQL" \
2 "PostgreSQL" \
3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "Database type selection cancelled. No modifications have been made to your databases." 1
return 0
fi
# Get the database hostname or IP address
DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Hostname Or IP Address" \
--inputbox "Default: localhost" 0 0 3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "DB host entry cancelled. No modifications have been made to your databases." 1
return 0
fi
# Set the hostname or IP address if one was specified
if [ ! -z "$DB_TMP" ]; then
DB_HOST="$DB_TMP"
fi
# Get the database port
DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database port" \
--inputbox "Default: 3306" 0 0 3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "DB port entry cancelled. No modifications have been made to your databases." 1
return 0
fi
# Set the port number if one was specified
if [ ! -z "$DB_TMP" ]; then
DB_PORT="$DB_TMP"
fi
# Get the database user username
DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Username" \
--inputbox "Default: $DB_USER" 8 60 3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "DB user name entry cancelled. No modifications have been made to your databases." 1
return 0
fi
# Set the user username if one was specified
if [ ! -z "$DB_TMP" ]; then
DB_USER="$DB_TMP"
fi
# Get the database user password
DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Password" \
--passwordbox "Default: $DB_UPW" 8 60 3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "DB user PW entry cancelled. No modifications have been made to your databases." 1
return 0
fi
# Set the user password if one was specified
if [ ! -z "$DB_TMP" ]; then
DB_UPW="$DB_TMP"
fi
case "${DB_TYPE}" in
"0")
DB_COMMAND="mysql -u ${DB_USER} -p${DB_UPW} "
;;
"1")
printf "Confirm your MySQL password\t, "
mysql_config_editor set --login-path=local --host=$DB_HOST --port=$DB_PORT --user=$DB_USER --password --skip-warn
DB_COMMAND="mysql --login-path=local -q -s "
;;
"2")
Log "Currently not supported." 1
return 0
;;
esac
# Setup database names based on release
DB_REALM="$DB_PREFIX$DB_REALM"
DB_WORLD="$DB_PREFIX$DB_WORLD"
DB_TOONS="$DB_PREFIX$DB_TOONS"
# Install fresh databases if requested
if [ "$DBMODE" = "0" ]; then
# Ask which databases to install/reinstall
DBSEL=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Databases" \
--checklist "Select which databases should be (re)installed" 0 60 4 \
0 "(Re)Install Realm Database" On \
1 "(Re)Install World Database" On \
2 "(Re)Install Characters Database" On \
3 "Update the realmlist" On \
3>&2 2>&1 1>&3)
# Exit if cancelled
if [ $? -ne 0 ]; then
Log "DB selection cancelled. No modifications have been made to your databases." 1
return 0
fi
# Remove and create the realm DB if selected
if [[ $DBSEL == *0* ]]; then
$DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_REALM;"
$DB_COMMAND -e "CREATE DATABASE $DB_REALM;"
fi
# Remove and create the world DB if selected
if [[ $DBSEL == *1* ]]; then
$DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_WORLD;"
$DB_COMMAND -e "CREATE DATABASE $DB_WORLD;"
fi
# Remove and create the character DB if selected
if [[ $DBSEL == *2* ]]; then
$DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_TOONS;"
$DB_COMMAND -e "CREATE DATABASE $DB_TOONS;"
fi
# Validate success
if [ $? -ne 0 ]; then
Log "There was an error creating the databases!" 1
return 1
fi
# Finally, populate the databases
InstallDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
# Updating the realmlist
if [[ $DBSEL == *3* ]]; then
$DB_COMMAND $DB_REALM < $SRCPATH/database/Tools/updateRealm.sql
fi
fi
# Update the databases if requested
if [ "$DBMODE" = "1" ]; then
UpdateDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
fi
}
# Function helper to extract resources (mmaps, vmaps, dbc, ...) from the game
function ExtractResources
{
INSTGAMEPATH=$(dirname $(find /home -name "WoW.exe"| head -1 2>>/dev/null))
GAMEPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "WoW Game Path" \
--inputbox "Please, provide the path to your game directory. Default: $INSTGAMEPATH" 8 60 3>&2 2>&1 1>&3)
if [ -z "$GAMEPATH" ]; then
GAMEPATH="$INSTGAMEPATH"
fi
if [ ! -d "$GAMEPATH" ]; then
Log "There is no game at this location" 1
exit 1
fi
ACTIONS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \
--checklist "Please select the extractions to perform" 0 70 3 \
1 "DBC and Maps" On \
2 "Vmaps" On \
3 "Mmaps" On \
3>&2 2>&1 1>&3)
if [ ! -d "$INSTPATH/bin/tools" ]; then
Log "The client tools have not been built, cannot extract data" 1
exit 1
fi
#TODO What if DBC are not yet generated ??
if [[ $ACTIONS == *1* ]]; then
if [ -d "$GAMEPATH/dbc" ]; then
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "DBC and Maps were already generated" \
--yesno "Do you want to generate them again?" 8 60
# Check the user's answer
if [ $? -eq 0 ]; then
Log "Deleting DBC and Maps previously generated." 1
rm -rf "$GAMEPATH/dbc"
rm -rf "$GAMEPATH/maps"
Log "Copying DBC and Maps extractor" 0
rm -f "$GAMEPATH/map-extractor"
cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH"
Log "Extracting DBC and Maps" 0
cd "$GAMEPATH"
./map-extractor
if [ $? -eq 0 ]; then
Log "DBC and Maps are extracted" 0
Log "Copying DBC and Maps files to installation directory" 0
cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
rm -rf "$GAMEPATH/map-extractor"
Log "Changing ownership of the extracted directories"
chown -R $USER:$USER "$INSTPATH"
else
Log "There was an issue while extracting DBC and Maps!" 1
rm -rf "$GAMEPATH/map-extractor"
rm -rf "$GAMEPATH/dbc"
rm -rf "$GAMEPATH/maps"
exit 1
fi
else
Log "Copying DBC and Maps files to installation directory" 0
cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
fi
else
rm -rf "$GAMEPATH/map-extractor"
cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH"
Log "Extracting DBC and Maps" 0
cd "$GAMEPATH"
./map-extractor
if [ $? -eq 0 ]; then
Log "DBC and Maps are extracted" 0
Log "Copying DBC and Maps files to installation directory" 0
cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
rm -rf "$GAMEPATH/map-extractor"
Log "Changing ownership of the extracted directories"
chown -R $USER:$USER "$INSTPATH"
else
Log "There was an issue while extracting DBC and Maps!" 1
rm -rf "$GAMEPATH/map-extractor"
rm -rf "$GAMEPATH/dbc"
rm -rf "$GAMEPATH/maps"
exit 1
fi
fi
fi
if [[ $ACTIONS == *2* ]]; then
if [ -d "$GAMEPATH/vmaps" ]; then
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "VMaps were already generated" \
--yesno "Do you want to generate them again?" 8 60
# Check the user's answer
if [ $? -eq 0 ]; then
Log "Deleting VMaps previously generated." 1
rm -rf $GAMEPATH/vmaps
Log "Copying VMaps extractor" 0
rm -f "$GAMEPATH/vmap-extractor"
cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH"
Log "Extracting VMaps" 0
cd $GAMEPATH
# Make sure there is no previous vmaps generation that cause issue.
rm -rf Buildings
./vmap-extractor
if [ $? -eq 0 ]; then
Log "VMaps are extracted" 0
Log "Copying VMaps files to installation directory" 0
cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
rm -rf "$GAMEPATH/vmap-extractor"
Log "Changing ownership of the extracted directories"
chown -R $USER:$USER "$INSTPATH"
else
Log "There was an issue while extracting VMaps!" 1
rm -rf "$GAMEPATH/vmap-extractor"
rm -rf "$GAMEPATH/vmaps"
exit 1
fi
else
Log "Copying VMaps files to installation directory" 0
cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
fi
else
Log "Copying VMaps extractor" 0
rm -f "$GAMEPATH/vmap-extractor"
cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH"
Log "Extracting VMaps" 0
cd $GAMEPATH
# Make sure there is no previous vmaps generation that cause issue.
rm -rf Buildings
./vmap-extractor
if [ $? -eq 0 ]; then
Log "VMaps are extracted" 0
Log "Copying VMaps files to installation directory" 0
cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
rm -rf "$GAMEPATH/vmap-extractor"
Log "Changing ownership of the extracted directories"
chown -R $USER:$USER "$INSTPATH"
else
Log "There was an issue while extracting VMaps!" 1
rm -rf "$GAMEPATH/vmap-extractor"
rm -rf "$GAMEPATH/vmaps"
exit 1
fi
fi
fi
if [[ $ACTIONS == *3* ]]; then
if [ ! -d "$GAMEPATH/maps" ]; then
Log "Error: maps files must be created to be able to generate MMaps!" 1
exit 1
fi
if [ -d "$GAMEPATH/mmaps" ]; then
$DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "MMaps were already generated" \
--yesno "Do you want to generate them again?" 8 60
# Check the user's answer
if [ $? -eq 0 ]; then
Log "Deleting MMaps previously generated." 1
rm -rf $GAMEPATH/mmaps
Log "Copying MMaps extractor" 0
rm -f "$GAMEPATH/MoveMapGen.sh"
cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH"
cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH"
cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH"
cp "$INSTPATH/bin/tools/mmap-extractor" "$GAMEPATH"
CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \
--inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3)
# User cancelled his choice, set default to 1.
if [ $? -ne 0 ]; then
Log "User selection was cancelled. Max CPU set to 1." 1
CPU=1
fi
if [ -z "$CPU" ]; then
Log "User didn't gave any value. Max CPU set to 1." 1
CPU=1
fi
if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then
Log "User entered invalid value. Max CPU set to 1." 1
CPU=1
fi
Log "Extracting MMaps" 0
cd $GAMEPATH
# Making sure we can execute the script
chmod 700 MoveMapGen.sh
./MoveMapGen.sh $CPU
if [ $? -eq 0 ]; then
Log "MMaps are extracted" 0
Log "Copying MMaps files to installation directory" 0
cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"
rm -rf "$GAMEPATH/MoveMapGen.sh"
rm -rf "$GAMEPATH/offmesh.txt"
rm -rf "$GAMEPATH/mmap_excluded.txt"
rm -rf "$GAMEPATH/mmap-extractor"
Log "Changing ownership of the extracted directories"
chown -R $USER:$USER "$INSTPATH"
else
Log "There was an issue while extracting MMaps!" 1
rm -rf "$GAMEPATH/MoveMapGen.sh"
rm -rf "$GAMEPATH/mmaps"
rm -rf "$GAMEPATH/offmesh.txt"
rm -rf "$GAMEPATH/mmap_excluded.txt"
rm -rf "$GAMEPATH/mmap-extractor"
exit 1
fi
else
Log "Copying MMaps files to installation directory" 0
cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"
fi
else
Log "Copying MMaps extractor" 0
rm -f "$GAMEPATH/MoveMapGen.sh"
cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH"
cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH"
cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH"
cp "$INSTPATH/bin/tools/mmap-extractor" "$GAMEPATH"
CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \
--inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3)
# User cancelled his choice, set default to 1.
if [ $? -ne 0 ]; then
Log "User selection was cancelled. Max CPU set to 1." 1
CPU=1
fi
if [ -z "$CPU" ]; then
Log "User didn't gave any value. Max CPU set to 1." 1
CPU=1
fi
if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then
Log "User entered invalid value. Max CPU set to 1." 1
CPU=1
fi
Log "Extracting MMaps" 0
cd $GAMEPATH
# Making sure we can execute the script
chmod 700 MoveMapGen.sh
./MoveMapGen.sh $CPU
if [ $? -eq 0 ]; then
Log "MMaps are extracted" 0
Log "Copying MMaps files to installation directory" 0
cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"
rm -rf "$GAMEPATH/MoveMapGen.sh"
rm -rf "$GAMEPATH/offmesh.txt"
rm -rf "$GAMEPATH/mmap_excluded.txt"
rm -rf "$GAMEPATH/mmap-extractor"
Log "Changing ownership of the extracted directories"
chown -R $USER:$USER "$INSTPATH"
else
Log "There was an issue while extracting MMaps!" 1
rm -rf "$GAMEPATH/MoveMapGen.sh"
rm -rf "$GAMEPATH/mmaps"
rm -rf "$GAMEPATH/offmesh.txt"
rm -rf "$GAMEPATH/mmap_excluded.txt"
rm -rf "$GAMEPATH/mmap-extractor"
exit 1
fi
fi
fi
}
# Function to create a Code::Blocks project
function CreateCBProject
{
# Create the dircetory if it does not exist
if [ ! -d $SRCPATH/server/linux ]; then
mkdir $SRCPATH/server/linux
fi
# Now create the C::B project
cd $SRCPATH/server/linux
# make sure we are using the cmake3
UseCmake3
$CMAKE_CMD .. -G "CodeBlocks - Unix Makefiles"
}
# Prepare the log
Log "+------------------------------------------------------------------------------+" 0
Log "| MaNGOS Configuration Script |" 0
Log "| Written By: Ryan Ashley |" 0
Log "| Updated By: Cedric Servais |" 0
Log "+------------------------------------------------------------------------------+" 0
# Check if user who is running this is root
CheckRoot
# Select which dialog to use
UseDialog
# Select which activities to do
TASKS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \
--checklist "Please select the tasks to perform" 0 70 8 \
1 "Install Prerequisites" On \
2 "Set Download And Install Paths" On \
3 "Clone Source Repositories" On \
4 "Build MaNGOS" On \
5 "Install MaNGOS" On \
6 "Install Databases" On \
7 "Extract Resources" On \
8 "Create Code::Blocks Project File" Off \
3>&2 2>&1 1>&3)
# Verify that the options were selected
if [ $? -ne 0 ]; then
Log "All operations cancelled. Exiting." 1
exit 0
fi
# Install prerequisites?
if [[ $TASKS == *1* ]]; then
GetPrerequisites
fi
# Select release and set paths?
if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then
GetUser
GetRelease
fi
if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *6* ]] || [[ $TASKS == *7* ]]; then
GetPaths
fi
# Clone repos?
if [[ $TASKS == *3* ]]; then
GetMangos
fi
# Build MaNGOS?
if [[ $TASKS == *4* ]]; then
GetBuildOptions
BuildMaNGOS
fi
# Install MaNGOS?
if [[ $TASKS == *5* ]]; then
InstallMaNGOS
fi
# Install databases?
if [[ $TASKS == *6* ]]; then
HandleDatabases
fi
# Extract resources from the game?
if [[ $TASKS == *7* ]]; then
ExtractResources
fi
# Create C::B project?
if [[ $TASKS == *8* ]]; then
CreateCBProject
fi
# If one of these actions has been performed, then we know the user.
if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then
Log "Changing ownership of the extracted directories" 1
chown -R $USER:$USER "$INSTPATH"
fi
# Display the end message
echo
echo "================================================================================"
echo "The selected tasks have been completed. If you built or installed Mangos, please"
echo "edit your configuration files to use the database you configured for your MaNGOS"
echo "server. If you have not configured your databases yet, please do so before"
echo "starting your server for the first time."
echo "================================================================================"
exit 0wget -c https://raw.githubusercontent.com/mangostwo/database/master/InstallDatabases.sh && bash InstallDatabases.sh#!/bin/sh
##############################################################################
# This utility assist you in setting up your mangos database. #
# This is a port of InstallDatabases.bat written by Antz for Windows #
# #
##############################################################################
OLDRELEASE="Rel21"
RELEASE="Rel22"
DUMP="NO"
dbname=""
dbcommand=""
createcharDB="YES"
createworldDB="YES"
createrealmDB="YES"
loadcharDB="YES"
loadworldDB="YES"
loadrealmDB="YES"
dbType="POPULATED"
updatecharDB="YES"
updateworldDB="YES"
updaterealmDB="YES"
addRealmList="YES"
svr_def="localhost"
user_def="mangos"
pass_def="mangos"
port_def="3306"
wdb_def="mangos2"
cdb_def="character2"
rdb_def="realmd"
printHelp()
{
printf "Usage: $0 [-s] [-u] [-d] [-h]\n"
printf "\t-s: Run this script in silent mode, only prompt for the database information\n"
printf "\t-u: Run only the updates of the database\n"
printf "\t-d: Dump the database configuration into the home directory of the user\n"
printf "\t-h: Display this help\n"
}
printBanner()
{
clear
printf " # # # # #### ### ####\n"
printf " ## ## # # ### # # # # \n"
printf " # # # # # ## # # # ### # #### \n"
printf " ########## ### # # # # #\n"
printf " # ## # # #### ####### \n"
printf "\n"
printf " Database Setup and World Loader v0.03 \n"
printf " ---------------------------------------------- \n"
printf "Website / Forum / Wiki : https://getmangos.eu \n"
printf " ---------------------------------------------- \n"
printf "\n"
printf "\n"
}
printActivities()
{
printf "\tCharacter Database : \tV - Toggle Create DB (${createcharDB}) \n"
printf "\t\t\t\tC - Toggle Create Structure (${loadcharDB}) \n"
printf "\t\t\t\tB - Apply Character DB updates (${updatecharDB})\n"
printf "\n"
printf "\t World Database : \tE - Toggle Create DB (${createworldDB}) \n"
printf "\t\t\t\tW - Toggle Create Structure (${loadworldDB}) \n"
if [ "${loadworldDB}" = "YES" ]; then
printf "\t\t\t\tD - Toggle World Type (${dbType})\n"
fi
printf "\t\t\t\tU - Apply World DB updates (${updateworldDB})\n"
printf "\n"
printf "\t Realm Database : \tT - Toggle Create DB (${createrealmDB})\n"
printf "\t\t\t\tR - Toggle Create Structure (${loadrealmDB})\n"
printf "\t\t\t\tY - Apply Realm DB updates (${updaterealmDB})\n"
printf "\t\t\t\tL - Toggle Add RealmList Entry (${addRealmList})\n"
printf "\n"
printf "\t\t\t\tN - Next Step\n"
printf "\t\t\t\tX - Exit\n"
}
determineDBName()
{
if [ $(which mariadb) ]; then
printf "MariaDB found.\n"
dbname="MariaDB"
elif [ $(which mysql) ]; then
printf "MySQL found.\n"
dbname="MySQL"
else
printf "Did not find mariadb or mysql.\n"
fi
}
mysqlconfigeditor()
{
dbconfig="mysql_config_editor set --login-path=local --host=${svr} --port=${port} --user=${user} --password --skip-warn"
}
determineDBCommand()
{
if [ $dbname = "MariaDB" ]; then
dbcommand="mariadb -h ${svr} -u ${user} -p${pass} -q -s"
elif [ $dbname = "MySQL" ]; then
dbcommand="mysql --login-path=local -q -s"
else
printf "Did not find mariadb or mysql.\n"
fi
}
createCharDB()
{
printf "Creating Character database ${cdb}\n"
$(${dbcommand} -e "Create database ${cdb}")
if [ "${loadcharDB}" = "YES" ]; then
loadCharDB
fi
}
loadCharDB()
{
printf "Loading data into character database ${cdb}\n"
$(${dbcommand} ${cdb} < Character/Setup/characterLoadDB.sql)
if [ "${updatecharDB}" = "YES" ]; then
updateCharDB
fi
}
updateCharDB()
{
printf "Updating data into the character database ${cdb}\n"
for file in $(ls Character/Updates/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
do
file=$(echo ${file} | tr '|' ' ')
printf "Applying update ${file}\n"
${dbcommand} "${cdb}" < "${file}"
printf "File ${file} imported\n"
done
for file in $(ls Character/Updates/${RELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
do
file=$(echo ${file} | tr '|' ' ')
printf "Applying update ${file}\n"
${dbcommand} "${cdb}" < "${file}"
printf "File ${file} imported\n"
done
}
createWorldDB()
{
printf "Creating World database ${wdb}\n"
$(${dbcommand} -e "Create database ${wdb}")
if [ "${loadworldDB}" = "YES" ]; then
loadWorldDB
fi
}
loadWorldDB()
{
printf "Loading data into world database ${wdb}\n"
$(${dbcommand} ${wdb} < World/Setup/mangosdLoadDB.sql)
if [ "${dbType}" = "POPULATED" ]; then
populateWorldDB
fi
}
populateWorldDB()
{
printf "Importing World database ${wdb}\n"
for file in $(ls World/Setup/FullDB/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
do
file=$(echo ${file} | tr '|' ' ')
printf "Importing file ${file}\n"
$(${dbcommand} ${wdb} < ${file})
printf "File ${file} imported\n"
done
for file in $(ls World/Setup/FullDB/*.sql | tr ' ' '|' | tr '\n' ' ')
do
file=$(echo ${file} | tr '|' ' ')
printf "Importing file ${file}\n"
$(${dbcommand} ${wdb} < ${file})
printf "File ${file} imported\n"
done
}
updateWorldDB()
{
printf "Updating data into the World database ${wdb}\n"
for file in World/Updates/${OLDRELEASE}/*.sql
do
printf "Applying update ${file}\n"
${dbcommand} "${wdb}" < "${file}"
printf "File ${file} imported\n"
done
for file in World/Updates/${RELEASE}/*.sql
do
printf "Applying update ${file}\n"
${dbcommand} "${wdb}" < "${file}"
printf "File ${file} imported\n"
done
}
createRealmDB()
{
printf "Creating realm database ${rdb}\n"
$(${dbcommand} -e "Create database ${rdb}")
if [ "${loadrealmDB}" = "YES" ]; then
loadRealmDB
fi
}
loadRealmDB()
{
printf "Loading data into realm database ${rdb}\n"
$(${dbcommand} ${rdb} < Realm/Setup/realmdLoadDB.sql)
}
updateRealmDB()
{
printf "Updating data into the Realm database ${rdb}\n"
for file in $(ls Realm/Updates/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
do
file=$(echo ${file} | tr '|' ' ')
printf "Applying update ${file}\n"
$(${dbcommand} ${rdb} < ${file})
printf "File ${file} imported\n"
done
for file in $(ls Realm/Updates/${RELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
do
file=$(echo ${file} | tr '|' ' ')
printf "Applying update ${file}\n"
$(${dbcommand} ${rdb} < ${file})
printf "File ${file} imported\n"
done
}
addRealmList()
{
printf "Adding realm list entries\n"
$(${dbcommand} ${rdb} < Tools/updateRealm.sql)
}
activity=""
while getopts "suh" o; do
case "${o}" in
s)
activity="N"
printf "You selected silent mode\n"
;;
u)
createcharDB="NO"
createworldDB="NO"
createrealmDB="NO"
loadcharDB="NO"
loadworldDB="NO"
loadrealmDB="NO"
dbType="EMPTY"
printf "You selected update only\n"
;;
d)
DUMP="YES"
;;
h)
printHelp
exit 0
;;
esac
done
while [ -z "${activity}" ] || [ "${activity}" != "N" ]
do
printBanner
printActivities
printf "Please select an activity : "
read activity
activity=$(echo ${activity} | tr '[:lower:]' '[:upper:]' )
case ${activity} in
"V")
if [ "${createcharDB}" = "YES" ]; then
createcharDB="NO"
else
createcharDB="YES"
fi
;;
"C")
if [ "${loadcharDB}" = "YES" ]; then
loadcharDB="NO"
else
loadcharDB="YES"
fi
;;
"B")
if [ "${updatecharDB}" = "YES" ]; then
updatecharDB="NO"
else
updatecharDB="YES"
fi
;;
"E")
if [ "${createworldDB}" = "YES" ]; then
createworldDB="NO"
else
createworldDB="YES"
fi
;;
"W")
if [ "${loadworldDB}" = "YES" ]; then
loadworldDB="NO"
else
loadworldDB="YES"
fi
;;
"D")
if [ "${dbType}" = "POPULATED" ]; then
dbType="EMPTY"
else
dbType="POPULATED"
fi
;;
"U")
if [ "${updateworldDB}" = "YES" ]; then
updateworldDB="NO"
else
updateworldDB="YES"
fi
;;
"T")
if [ "${createrealmDB}" = "YES" ]; then
createrealmDB="NO"
else
createrealmDB="YES"
fi
;;
"R")
if [ "${loadrealmDB}" = "YES" ]; then
loadrealmDB="NO"
else
loadrealmDB="YES"
fi
;;
"Y")
if [ "${updaterealmDB}" = "YES" ]; then
updaterealmDB="NO"
else
updaterealmDB="YES"
fi
;;
"L")
if [ "${addRealmList}" = "YES" ]; then
addRealmList="NO"
else
addRealmList="YES"
fi
;;
"X")
exit 0;;
*)
printf "Invalid selection";;
esac
done
printBanner
determineDBName
printf "What is your ${dbname} host name ?\t[${svr_def}]: "
read svr
svr=${svr:-${svr_def}}
printf "What is your ${dbname} user name ?\t[${user_def}]: "
read user
user=${user:-${user_def}}
printf "What is your ${dbname} port ?\t[${port_def}]: "
read port
port=${port:-${port_def}}
if [ $dbname = "MariaDB" ]; then
printf "What is your ${dbname} password ?\t []: "
read pass
pass=${pass:-${pass_def}}
elif [ $dbname = "MySQL" ]; then
mysqlconfigeditor
$dbconfig
fi
determineDBCommand
if [ "${DUMP}" = "YES" ]; then
printf "Enter it again \t[]: "
read pass
fi
if [ "${createcharDB}" = "YES" ] || [ "${loadcharDB}" = "YES" ] || [ "${updatecharDB}" = "YES" ]; then
printf "What is your Character database name ?\t[${cdb_def}]: "
read cdb
cdb=${cdb:-${cdb_def}}
fi
if [ "${createworldDB}" = "YES" ] || [ "${loadworldDB}" = "YES" ] || [ "${updateworldDB}" = "YES" ]; then
printf "What is your World database name ?\t[${wdb_def}]: "
read wdb
wdb=${wdb:-${wdb_def}}
fi
if [ "${createrealmDB}" = "YES" ] || [ "${loadrealmDB}" = "YES" ] || [ "${updaterealmDB}" = "YES" ] || [ "${addRealmList}" = "YES" ]; then
printf "What is your Realm database name ?\t[${rdb_def}]: "
read rdb
rdb=${rdb:-${rdb_def}}
fi
if [ "${createcharDB}" = "YES" ]; then
createCharDB
fi
if [ "${createworldDB}" = "YES" ]; then
createWorldDB
fi
if [ "${createrealmDB}" = "YES" ]; then
createRealmDB
fi
if [ "${updateworldDB}" = "YES" ]; then
updateWorldDB
fi
if [ "${updaterealmDB}" = "YES" ]; then
updateRealmDB
fi
if [ "${addRealmList}" = "YES" ]; then
addRealmList
fi
if [ "${DUMP}" = "YES" ]; then
printf "Dumping database information...\n"
echo "${svr};${port};${user};${pass};${rdb}" > ~/db.conf
echo "${svr};${port};${user};${pass};${wdb}" >> ~/db.conf
echo "${svr};${port};${user};${pass};${cdb}" >> ~/db.conf
fi
printBanner
printf "Database creation and load complete :-)\n"
printf "\n"
Playerbot AI 命令
使用 Playerbot 密钥的指南:
标识符说明
机器人名称 机器人的名称
朋友 命名机器人或玩家角色
目标 选择目标玩家、尸体或NPC(非玩家角色)
| 逻辑或
& 逻辑与
.. 多个实例
/命令 MARCO 命令
/s 聊天:说
/p 聊天派对
/t 机器人名称 聊天:TELL BOTNAME
/w 机器人名称 聊天:告诉 BOTNAME
<名称链接> 名字=
(捷径) 为命令或子命令分配快捷方式
可用 PlayerBot AI 命令的完整列表 SAY 命令:语法说明
.bot 添加 BOTBNAME 为世界添加角色
.bot 删除 BOTNAME 从世界中删除角色
当前仅与以下 playerbot 代码一起使用:portalzero 和 portalclassic(所有其他代码使用新修订的“命令战斗”命令来设置机器人角色)
.bot < co | 战斗命令 > BOTNAME 分配机器人角色
宏命令:
句法 描述
/邀请机器人名称 机器人将自动接受聚会邀请
/uninvite BOTNAME 机器人将自动接受派对不邀请
TELL/PARTY 命令:(某些命令可能不适用于某些内核)
句法 描述
协助目标 机器人协助列出的角色,在他们攻击时进行攻击。
攻击目标 命令机器人攻击选定的目标,类似于宠物可以攻击的方式
拍卖 命令机器人寻找附近的拍卖师并显示机器人的活动 1< Auction LINK >..
拍卖 (a)add 1< ItemLINK >.. 命令机器人寻找附近的拍卖师并添加 1< ItemLINK >..
拍卖 (r)emove 1< 拍卖链接 >.. 命令机器人寻找附近的拍卖师并删除 1< Auction LINK >..
银行 命令机器人寻找附近的银行家并列出机器人的银行余额
银行 (d)eposit 1< ItemLINK >.. 命令机器人寻找附近的银行家并将 1< ItemLINK >.. 存入银行
银行 (w)withdraw 1< 项目链接 >.. 命令机器人寻找附近的银行家并从银行提取 1< ItemLINK >..
(b)uy 1< 项目链接 >.. 命令机器人寻找附近的供应商并购买 1< ItemLINK >..
©ast SPELL 拼写 = >
搜集 显示收集对象选项和当前收集状态
收集对象 设置收集状态,OBJECT = <所有非战斗战利品对象职业任务>
工艺1<配方链接>.. 如果机器人知道,则创建所有列出的食谱
工艺1<配方链接>全部 如果机器人知道,则创建一个配方的多个实例
工艺(a)炼金术 显示所有炼金术配方 1< 配方链接 >,如果由机器人学习
工艺(b)锻造 显示所有锻造配方 1< 配方链接 >,如果由机器人学习
工艺(c)烹饪 显示所有烹饪食谱 1< 食谱链接 >,如果由机器人学习
工艺(电子)工程 显示所有工程配方 1< 配方链接 >,如果通过机器人学习
工艺(f)irstaid 显示所有急救食谱 1< 食谱链接 >,如果由机器人学习
工艺(i)题字 显示所有铭文配方 1< 配方链接 >,如果通过机器人学习
工艺 (j)ewelcrafting 显示所有珠宝制作配方 1< 配方链接 >,如果由机器人学习
手工艺 (l) 皮革加工 显示所有制革配方 1< 配方链接 >,如果由机器人学习
工艺(m)魔法 显示所有可制作的附魔(例如魔杖等)recipes1<recipe LINK>,如果由机器人学习
工艺熔化 显示所有矿石冶炼配方 1< 配方链接 >,如果由机器人学习
工艺(t)裁缝 显示所有裁缝配方 1< 配方链接 >,如果由机器人学习
掉落 1< 物品链接 >.. 命令机器人掉落并销毁指定物品 1<Item LINK>..
全部放弃 当机器人库存变满时,丢弃所有低级物品。
附魔 列出机器人学习的所有结界 1< Spell LINK >
附魔1<法术链接>.. 附魔选择可交易 1< 物品链接 > 装备或包中
(e)quip 1< 物品链接 >.. 从它的库存中为机器人配备容器、武器、盔甲和小饰品
(e)quip auto on 打开自动装备,也立即检查
(e) 装备自动关闭 关闭自动装备。
(e)quip auto 一次 运行一次自动装备,然后将其关闭。
(e)quip 信息 显示装备自动切换状态(开/关)。
(f)ind 1< 游戏对象链接 > 命令机器人定位 1< Gameobject LINK > 然后等待。对任务目标有用
跟随 命令机器人跟随玩家;如果死了也会复活机器人,如果很远也会传送机器人
跟随汽车 切换自动跟随距离(开/关)
关注信息 显示机器人当前的自动跟随距离,切换状态(开/关)
跟着远 机器人跟随,远离主人。
跟随附近 机器人跟随,更接近主人
跟随重置 机器人跟随距离重置为原始默认值
(g)et 1< GameobjectLINK >.. 获取选中的 1< Gameobject LINK >.. 然后返回给玩家
订单 显示机器人的战斗命令
订单延迟<0-10> 在机器人开始战斗之前激活延迟。
命令战斗 ASSIST FRIEND 协助链接的友方目标,集中我们的杀伤力。
命令战斗治疗 命令机器人治愈。最好用于萨满、牧师、德鲁伊或圣骑士。
命令战斗保护朋友 保护列出的友方目标,试图让仇恨远离目标。
命令战斗坦克 命令机器人坦克。最适用于圣骑士、战士、德鲁伊或死亡骑士。
命令战斗RESET 重置机器人战斗命令,就好像他们根本没有下达过一样。
订单恢复 将战斗命令恢复到注销前的状态。
邮件收件箱 1< MailboxLINK > 列出来自选定 1<Mailbox LINK> 的所有机器人邮件。邮件按 1< 邮件 ID > 索引。
mail getcash 1<邮件ID>.. 从所有选定的 1< 邮件 ID > 中获取资金..
邮件getitem 1<邮件ID>.. 从所有选定的 1<Mail ID> 中获取项目..
邮件删除1<邮件ID>.. 删除所有选定的 1< Mail ID >..
宠物遗弃 放弃活跃的猎人宠物。
宠物驯服目标 驯服选定的生物,如果机器人在法术书中有“驯服野兽”法术
宠物法术 显示 bot 的宠物已知的法术。自动施法法术将显示为绿色
宠物施放法术 拼写 = >
宠物切换法术 SPELL = >为给定的法术切换自动施法
宠物状态 显示机器人宠物的当前反应模式
宠物反应模式 模式 = <(a) 激进 | (d)防御性| (p)被动>
过程 (d)isenchant1< 物品链接 >.. 分解绿色 1< 物品链接 > 或更好的
处理 (m)ill 1< ItemLINK >.. 研磨 5 种药草 1< 物品链接 > 以产生色素
过程(p)前景1<项目链接>.. 搜索 5 个金属矿石 1< 物品链接 > 寻找珍贵的宝石
拉目标 以协调的队伍/袭击方式拉动目标。
拉力测试 机器人会告诉您它们是否可以拉动(可以在任何地方使用)。
准备就绪 机器人会告诉您它们是否准备好立即拉动(在具有有效目标的位置上使用)。
寻求 列出机器人当前的任务
quest (a)dd 1< QuestLINK >.. 命令机器人寻找附近的 questgiver 并添加 1< Quest LINK >..
quest (d)rop 1< QuestLINK > 命令机器人放弃 1< 任务链接 >
追求 (e)nd 命令机器人寻找附近的任务提供者并上交所有相关的已完成任务
寻求(r)报告 报告机器人完成任务所需的所有物品、生物或游戏对象
任务(l)列表 命令机器人寻找任务提供者并显示新的可用 1< 任务链接 >..
quest (c)完成 1< Quest LINK > 自动完成(GM 批准)任务,可在数据库中找到
修复1<项目链接>.. 命令 bot 寻找附近的 armourer 并修复选定的 1<Item LINK>..
全部修复 命令机器人寻找附近的装甲师并修理所有损坏的装备或包中的物品
重置 重置状态、命令和战利品清单
(s)ell 1<项目链接>.. 命令机器人寻找附近的供应商并出售 1< ItemLINK >..
(s)卖掉所有 所有低级白色物品的一次性销售(命令不会持续)。
技能 列出 bot(s) 1< Profession LINK >.. 主要职业和武器技能
技能 (l) 获得 命令机器人寻找附近的培训师并列出可用的 1< 培训链接 >..
技能 (l) 获得 1< 训练链接 >.. 命令 bot 寻找附近的教练并学习 1< TrainingLINK >..
技能 (u)nlearn 1< 职业链接 > 命令机器人在附近寻找训练师并忘记 1< 职业链接 > 和相关法术
咒语 显示机器人已知的所有法术
统计数据 显示机器人可用资金、可用库存空间和估计的项目维修成本
停留 命令机器人站立而不跟随玩家
召唤 玩家附近的传送机器人
民意调查 在机器人周围的局部范围内显示所有可用的 1< Gameobject LINK >..
使用 1< 项目链接 >.. 使用物品(例如食物、饮料等)
使用 1< 项目链接 >TARGET 在目标上使用物品(例如任务物品)
句法 描述
天赋 列出机器人 1< Talent LINK >.. & 1< Glyph LINK >..,未使用的天赋点数和重置所有天赋的费用
人才学习1<人才链接>.. 为 bot 选项卡或 1< TalentLINK >..â†'talent> 学习选定的天赋
天赋重置 命令机器人寻找附近的班级教练并重置所有天赋2
人才规格 列出机器人可以使用的所有天赋规格(编号为 #)。
天赋规格# 机器人将遵循此天赋规范。
1 要选择 , 。
2 每个机器人的税收增加,每次重置天赋。
Installing ACE on CentOS 7
Building MaNGOS on Linux requires ACE libraries. I could not find information on installing those here, so I will make a short HOWTO (copied from ACE documentation)1. Make a folder for ACE in your preferred location ( I use /opt)
mkdir /opt/ace && cd /opt/ace
2. Download and unpack ACE
wget http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.7.tar.gz
tar -xvf ACE-6.4.7.tar.gz
3. Add needed environment variables
cat >> /etc/profile <<EOF
export ACE_ROOT=/opt/ace/ACE_wrappers
EOF
source /etc/profile
4. Add the desired headers
cat > /opt/ace/ACE_wrappers/ace/config.h <<EOF
#include "ace/config-linux.h"
EOF
cat > /opt/ace/ACE_wrappers/include/makeinclude/platform_macros.GNU <<EOF
INSTALL_PREFIX = /usr/local
include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU
EOF
5. Build ACE
cd /opt/ace/ACE_wrappers
make
make install
6. Add the library to the public path
cat > /etc/ld.so.conf.d/ace.conf <<EOF
/opt/ace/ACE_wrappers/lib
EOF
ldconfig -v
/home/mangos/two/src/server/src/game https://www.xspio.com/%E9%AD%94%E5%85%BD%E4%B8%96%E7%95%8C%E5%AE%98%E6%96%B9%E5%AE%A2%E6%88%B7%E7%AB%AF%E4%B8%8B%E8%BD%BD/ Download WoW Wotlk 3.3.5 Client
Torrent Download
These are clients that can get downloaded through a Torrent. We always recommend using a VPN, when you download the World of Warcraft – Wrath of the Lich King Game Client of 3.3.5. The reason is to avoid copyright infrightments from your ISP
Torrent – Client from Dalaran WoW (Recommended)
Torrent– Client from Sunwell (Recommended – Fast torrent download, due to a lot of seeds)
Magnet – Client from TrueWoW
Direct Download
Below, you will find direct client download links. Instead of downloading through a torrent, it will download through a media upload service. If you can’t download through a Torrent, we recommend the ones below.
Direct – English Windows client
3.3.5 Wotlk MacOS Client
The Mac users should of course also be able to play on a 3.3.5 Wotlk Mac Client. Therefore, you will be able to download below.
Direct 3.3.5 MacOS Download – Client from Sunwell
Direct – Client from Paragon-Servers (French)(Mac)
Modified Clients, LegionRemaster:
3.3.5 LegionRemaster Torrent – From Sunwell and Finsternis
LegionRemaster Patch (modified)
LegionRemaster ReadMe (Custom)
https://zremax.com/blog/wotlk-3-3-5-client-download-wrath-of-the-lich-king-client/ 开源的魔兽世界 Mangos
在sourceforge上开发的 (Ma ssive N etwork G ame O bject S erver) 项目是基于GPL协议的。据说是和魔兽世界独立无关的网络游戏服务器引擎程序。游戏的内容部分(数据库内容)又是由独立的小组开发的,这样也许避免了很多 法律上的问题。但是大多数魔兽世界的盈利的私服都是基于这个开源的项目的,为此开发小组表示这样盈利性质的服务器和对他们项目的使用是违背协议和非法的。
本文 章 是对mangos作了一个粗略的介绍,并且使用了魔兽世界的客户端对mangos作了一些测试。
正文如下:
开源社区常常有很多出人意表的项目,让人往往击节叹赏。例如当年在普通PC电脑上虚拟运行苹果机系统的 。把微软游戏机xbox改装成家庭影音中心的 ,以及在ipod上安装linux的 等项目。在电脑游戏方面当然也有很多出色的开源项目。
暴雪公司的游戏历来都是精品。网络游戏大热以后,它推出的基于10年游戏历史的网游:《魔兽世界》也更是名声在外(当然有好有坏,坏名声在于它太吸引 人以致 于很多人沉湎其中)。网络游戏的盈利模式和传统电脑游戏不同,月费和其他的周边产品使得其赢利空间远远大于传统电脑游戏。对于网游运营商来说很大的一个问 题是私服的问题。很多私服的软件是从网游开发公司或者运营公司内部非法的流出来的,比如说网游《仙境传说》的私服。
而现在大多数魔兽世界 的“私服”实际上是服务端软件的模拟器。是在对客户端游戏软件和与服务端的进行通信的数据进行分析解密以后,开发出来的模拟原游戏服务器功能的软件,这样 的模拟器软件大都也是开源软件。比如像现在大部分魔兽私服使用的Mangos服务端软件,mangos项目是一个开源的自由软件(如同linux或者 firefox),并且遵守其中最为严格的GPL协议。
MaNGOS 是(Ma ssive N etwork G ame O bject S erver) 的缩写。由于暴雪公司对类似的开发小组采取过一些法律行动。为了避免麻烦,如同它的名字,mangos强调自己并非一个魔兽服务器模拟器,而是一个开源的 多人在线游戏服务器的软件。说到底是个网游的游戏引擎。Mangos开发小组强调其软件是用c++和C#编程语言,实现 的一个支持大型多人在线角色扮演游戏服务器的程序框架,在这个框架下,它理论上应该支持任何客户端的网络游戏,由于现在很多人使用魔兽世界来对它进行测 试,所以针对魔兽世界的脚本和数据库文件比较完善,很多人就利用这个开源项目来实现魔兽私服。而游戏的内容,例如故事情节,任务场景的脚本等都是由别的小 组独立开发的。
开发小组一再强调,这是个研究,教育性质的对怎样开发大型网游的服务器端有好处的项目,是一个技术细节毫无保留向公众开放的软件,是一件很有 意义的事情,如果你使用它作为盈利目的,那你本身就违反了软件的协议。所以任何利用mangos项目进行私服活动的组织和个人都违反了mangos的宗 旨,mangos项目也不会对它们负责。
mangos的技术细节上是这样的,核心部分是个和特定游戏没有关系的核心框架程序,主要是进行进程调度,创造世界,建立心跳机制,处理网络接入 等。数据库可以使用的开源数据库软件MySQL。至于游戏内容数据库,游戏人物,时间,世界脚本,都是由这个核心程序所支持的扩展 脚本来实现,所以有一些独立出来的项目专门模拟魔兽世界来开发支持mangos的核心程序。现在mangos的核心程序已经放到著名的协同开发网站 sourceforge上开发了,使用的开发工具是subversion。大家都可以从sourceforge的subversion数据库中下载最新的 源代码程序。
为了测试这个Mangos我自己安装了一个测试了以下,自己对魔兽世界的游戏本身没有太多的了解,请了几个玩过魔兽世界的朋友测试了一下,都说各方面 已经很 完美了。最新的Mangos项目已经支持了魔兽世界的扩展版“燃烧的远征”,简称TBC,对应的魔兽客户端版本到了2.0以上。以下的安装测试步骤适用于 魔兽世界客户端1.12.x的版本。
一、安装需求:
[*]操作系统Windows Xp,解压软件推荐 。(mangos论坛上有人在linux,macosx上安装,为了提取地图方便这里使用windows XP)
[*]魔兽世界的客户端软件,升级到1.12.1版本以上。
[*]编译好的Mangos二进制文件。(你也可以自己编译,我这里提供的是Mangos Rev 3462,3462是开发数据库的版本号),下载地址:
[*]地图提取工具ad.exe(这个地图提取工具是专门针对1.12.x版本的客户端的,TBC需要比较新的ad.exe,TBC的地图提取工具不适用老版本的地图),下载地址:
[*]mpq文件包提取工具MPQE_1.2.rar,暴雪公司的游戏都采用一种叫mpq的文件格式,是M ike O'Pack 的缩写,这个Mike就是暴雪公司的首席游戏程序开发人员,和创始者。我们需要使用mpqe.exe从客户端里提取相关文件。下载地址:
Brien
[*]开源数据库软件MySql
官网:MySQL
或者用我下载的版本:
[*]MySQL的客户端软件SQLyog,编译管理操作数据库
官网:
我下载的版本5.30:
[*]游戏内容数据库,配合Mangos Rev 3462的版本。
文件名:CompleteSDB156-Mangos3462.rar
下载地址:
二、安装MySQL数据库,以及SQLyog客户端
[*]点击安装文件选择典型安装(Typical)
[*]配置数据库服务器"Configure the MySQL Server Now",选择标准配置"Standard Configuration"。
[*]确认安装成windows的服务程序和自动启动服务"Install as Windows Service"、"Launch the MySQL Server Automatically"。
[*]输入你的root用户的密码。可以打开的使用root远程管理数据库的选项,便于远程管理,和链接。
[*]应用你的设置。
[*]点击安装SQLyog的安装文件,安装到缺省路径,运行SQLyog。
[*]当SQLyog运行后,需要输入以下信息:
[*]MySQL主机地址:可以输入你的本机IP地址或者"localhost"。
[*]用户名(UserName):root
[*]密码(Password):在第4步里面你配置的密码。
[*]数据库(database(s))输入:"realmd;mangos"
点击连接,这样客户端就连接到你的MySQL数据库服务器上了。在左边一栏右键点击“root@localhost”,选择建立数据库"Create Database"。当提示输入数据库名称的时候输入:"mangos"。重复第9,10步建立数据库"realmd"。 三、安装Mangos服务器,配置路径
[*]建立一个目录,例如:"C:\MaNGOS"
[*]把你下载的mangos的二进制文件解压到这个目录里面。
[*]检查你的两个重要的服务器配置文件:“ mangosd .conf”和“realmd.conf”。其中“mangosd .conf”里面可以配置物品,金钱的掉落率,经验值的增长率等等。
四、解压安装地图文件
[*]把ad.exe放在魔兽世界的安装目录下,例如("C:\World of Warcraft")
[*]建立一个子目录叫maps,结构为:("C:\World of Warcraft\maps")
[*]运行ad.exe文件。耐心等待ad.exe把魔兽世界的地图信息提取到maps目录下。
[*]将maps子目录拷贝到"C:\MaNGOS"目录下,结构为:"C:\MaNGOS\maps",里面的地图文件大概有2400多个。
[*]可以安全的删除"C:\World of Warcraft"下的maps子目录了。
五、解压安装提取的*.dbc文件
[*]在你的mangos的安装目录下建立dbc子目录,结构为:("C:\MaNGOS\dbc")
[*]为了将暴雪公司的mpq文件的内容解压出来,将提取工具mpqe.exe拷贝在魔兽世界安装目录的data目录下,结构为:("C:\World of Warcraft\data")
[*]打开dos窗口,进入魔兽世界的data目录(cd "C:\World of Warcraft\data")。
[*]执行以下命令:
mpqe /p dbc.MPQ DBFilesClient\*.dbc
[*]mpqe工具将魔兽的游戏信息提取到了\MPQOUT\DBFilesClient目录下,整个结构为:("C:\World of Warcraft\data\MPQOUT\DBFilesClient")
[*]当mpqe运行结束后,可以将所有的*.dbc拷贝到你的mangos的dbc目录下:("C:\MaNGOS\dbc"),你大概有158个*.dbc文件。
[*]你可以安全删除魔兽世界下的dbc文件目录:("C:\World of Warcraft\data\MPQOUT")了。
七、下载安装数据库内容,前文说过,mangos只是游戏引擎,游戏的内容,建立的数据库由独立小组开发,我们这里使用著名的Silver's Database Site的库。版本号为SDB156.
[*]将下载的CompleteSDB156-Mangos3462.rar文件解压,里面有几个数据库文件。找到其中“realm-database-full.sql”和“mangos-full-for-rev3462.sql”文件。
[*]使用SQLyog连接到你的数据库。
[*]在左栏找到realmd ,点击右键选择"Restore from SQL Dump",找到“realm-database-full.sql”,导入数据库文件。
[*]同样找到mangos, 点击右键选择"Restore from SQL Dump",找到“mangos-full-for-rev3462.sql”,导入数据库文件。
八、配置数据库,配置文件,运行开源魔兽服务器!本文只为测试游戏,在局域网中玩。
[*]使用SQLyog连接到你的数据库。
[*]找到realmd,展开找到"realmlist"选项。
[*]在右下找到"Table Data"。
[*]在name一项填入你的服务器名字,例如叫faif
[*]在地址address一项可以使用"localhost" 或者你的IP地址。
[*]在realmd数据库下找到account表,点击"Table Data",建立你的游戏帐号,里面已经由几个内置的帐号,你可以参照gm,普通玩家的 帐号建立 你的用户名,密码。
[*]在mangos目录下打开realmd.conf 文件,找到
"LoginDatabaseInfo ="
改为:"LoginDatabaseInfo = "127.0.0.1;3306;root;;realmd"
这里的IP地址可以是你的IP,是你的密码。存盘。
[*]在mangos目录下打开mangosd .conf 文件,找到如下的内容,并设置如下:
[*]DataDir = "."
[*]WorldDatabaseInfo = "127.0.0.1;3306;root;;mangos"
[*]LoginDatabaseInfo = "127.0.0.1;3306;root;;realmd"
同样,这里的IP地址可以是你的IP,是你的密码。存盘。到这里基本就大功告成了。先运行realmd.exe文件,稍等,运行mangosd .exe,魔兽服务器就已经运行了。连接到你的魔兽服务器,修改你的魔兽世界客户端的realmlist.wtf 的文件,将127.0.0.1 ,或者你的IP地址填在里面,例如:"set realmlist 127.0.0.1" 到此为止,开源的魔兽服务器就架设成功了,我给朋友建立了几个gm帐号,他们测试了一下,觉得这个版本的做的很不错了,开源的宗旨是知识的分享,开源 社区黑客们的探索精神页不得不让人佩服。
5.安装数据库
使用mysql建立 mangos 数据库
a1)使用官方最小数据库,mysql用户名及数据权限等请自行设置
mysql -u root -p mangos< /usr/local/mangos/share/mangos/sql/mangos.sql 导入数据
a2)使用sdb数据库,mysql用户名及数据权限等请自行设置
假设sdb数据库文件为 /home/wow/SDB/trunk/SDB_r1178.sql
mysql -u root -p mangos< /home/wow/SDB/trunk/SDB_r1178.sql 导入数据
b)编辑 mangos 数据库的 realmlist 表,修改 address 为你运行mangos服务器的IP地址,这里设为192.168.1.1
6.编辑配置文件
编辑 /usr/local/mangos/etc/mangosd.conf
a)找到 DatabaseInfo = \"127.0.0.1;mangos;mangos;mangos\"
为你自己的配置,格式为 DatabaseInfo = \"mysql服务器ip:mysql用户名:密码:mangos数据库名\"
b)找到 Host = localhost
为你自己的配置 Host = 你的IP或域名,这里设为192.168.1.1
您好,在本教程中,我将逐步说明在 CentOS 7 Linux 系统上配置、安装和运行Mangos的方法。要完全执行安装,您需要一份要运行的游戏客户端版本的原始副本。
本指南已在安装最少的空 CentOS 7 系统上进行了全面测试。
我们走吧..
设置数据库:
CentOS 默认支持 MariaDB 而不是 MySQL。本指南的这一部分将帮助您设置 MariaDB 实例。
启动一个终端,如果还没有,您需要成为“root”用户:
须藤苏 - 根
然后,安装 MariaDB:
yum -y 安装 mariadb-server
安装 MariaDB 后,启动它:
systemctl 启动 mariadb
我建议您在启动时添加 mariadb 服务以自动执行它:
systemctl 启用 mariadb
让我们保护您的 mariadb 安装,执行以下命令:
mysql_secure_installation
我建议您设置以下参数:
设置 Root 密码
删除匿名访问
禁用 root 用户的远程访问
删除测试数据库
重新加载权限
验证您的数据库配置是否正常工作,您需要提供刚刚定义的 root 密码:
mysqladmin -u root -p 版本
如果一切正常,您应该有如下输出:
服务器版本 5.5.52-MariaDB
协议版本 10
通过 UNIX 套接字连接本地主机
UNIX 套接字 /var/lib/mysql/mysql.sock
正常运行时间 x 秒
现在数据库的设置已经完成,我们需要添加芒果数据库配置的先决条件。我们需要首先为mangos创建一个用户,使用以下命令登录数据库:
mysql -u 根目录 -p
创建您想要的用户,给出的示例是创建一个用户“ mangos ”,该用户可以从“localhost”连接并在末尾输入密码“password”(不要忘记“;”):
创建用户“芒果” @ “本地主机”由“密码”识别;
然后,我们需要向该用户授予权限,以便我们以后可以使用它来设置Mangos模式(同样,不要忘记“;”符号):
将*.* 上的所有特权授予“芒果” @ “本地主机” ;
退出终端:
退出
恭喜,您已经在 CentOS 上设置了数据库的先决条件!
安装芒果:
我们现在处于有趣的部分,我们如何在 CentOS 上安装Mangos ?好吧,假设您以“root”身份登录,请转到主目录:
光盘~
让我们先安装所需的依赖项,wget 是一个小实用程序,可让您下载安装程序脚本:
yum -y 安装 wget
现在,我们可以下载我们的安装程序:
wget https://raw.githubusercontent.com/mangoszero/server/master/linux/getmangos.sh
设置允许执行它的权限:
chmod 700 getmangos.sh
并执行它:
./getmangos.sh
在我们进一步讨论之前,对可用活动进行一些解释:
安装先决条件将为您安装所有必要的依赖项以构建和运行mangos。默认切换。
设置下载和安装路径将允许您指定必须下载源的位置以及必须安装二进制文件的位置。默认切换。
克隆源存储库将帮助您克隆Mangos源。默认切换。
Build MaNGOS将协助您完成MaNGOS的构建过程。默认切换。
安装MaNGOS将帮助您安装MaNGOS。默认切换。
安装数据库将帮助您创建数据库模式。默认切换。
提取资源将帮助您从游戏客户端中提取 DBC、地图、mmap 和 vmap。默认切换。
创建 Code::Blocks 项目文件将为 Code::Blocks 编辑器创建一个项目。如果您不打算编辑MaNGOS源,请不要切换此选项。
现在您已经了解了所有内容,请选择默认选项并通过 Tab 键选择“确定”。该脚本现在正在您的 CentOS 上安装必要的依赖项。系统将提示您同意安装构建依赖项。选择“是”两次。
用户选择:
Mangos为您提供了在“root”用户以外的其他用户下运行它的机会。这是一种很好的做法,可以隔离软件并在漏洞被利用的情况下限制安全影响。默认建议的运行用户是“ mangos ”,但您可以根据需要进行更改。选择“确定”继续。
如果您已经执行了此步骤,安装程序将询问您是否要保留该用户。我建议您回答“是”,除非您知道自己在做什么。
选择魔兽版本:
下一个屏幕要求您选择您愿意安装的 WoW 版本。选择符合您愿望的那个,然后选择“确定”。
源代码路径:
下一个屏幕要求您提供源路径。默认情况下,建议的格式是 /home/<run user>/<wow version>/src。例如,对于运行用户“ mangos ”和 wow 版本“Vanilla”,建议的路径将是:
/home/芒果/zero/src
如果目录不存在,请回复“是”以创建目录。如果它确实存在并且包含源,安装程序将询问您是否要删除该内容。
安装路径:
下一个屏幕要求您提供安装路径。这是您将执行Mangos流程的位置。默认情况下,建议的格式是 /home/<run user>/<wow version>。例如,对于运行用户“ mangos ”和 wow 版本“Vanilla”,建议的路径将是:
/home/芒果/零
如果它确实存在并且包含已编译的源,安装程序将询问您是否要删除该内容。
克隆或更新MaNGOS:
脚本的下一步是询问您是否要克隆、更新或使用MaNGOS源的现有副本。对于全新安装,请选择选项“0 克隆MaNGOS的全新副本”。安装程序现在将连接到 Github 并检查可用的开发分支,目前,最后一个稳定版本是 Rel21,并托管在“主”分支中。
安装程序现在正在克隆服务器和数据库存储库。
构建选项:
您现在处于构建步骤。此屏幕上的一些解释:
Enable Debug 将在Mangos 上设置调试标志和更多跟踪。仅当您被要求修复错误时才使用此构建选项。在调试模式下构建软件会显着降低其性能。
使用标准 Malloc,切换此选项以使用标准内存分配。仅当您知道自己在做什么时才取消切换此选项。
使用外部 ACE 库。允许您使用来自系统的 ACE 库。此选项在极少数情况下有效,并且将来会被删除,所以不要切换它(无论如何, MaNGOS有一个“内部”ACE)。
使用 PostgreSQL 代替 MySQL/MariaDB。允许您使用默认数据库提供程序以外的其他数据库提供程序。此选项尚未经过测试,如果您到目前为止已经按照教程进行操作,那么您应该已经设置了 MariaDB
页:
[1]
2