找回密码
 立即注册
搜索
查看: 925|回复: 12

MangOs搭建魔兽世界私服

[复制链接]

986

主题

92

回帖

5万

积分

管理员

积分
55255
发表于 2022-7-29 09:16:01 | 显示全部楼层 |阅读模式
话不多说,开整!* ^+ }7 N/ Z5 \+ M" P
考虑再三,我选择了CentOs来做游戏的服务端操作系统。
1 A  l- l9 \* M2 ?1 @3 ^通过Git获得Mangos的源码之后自行编译搭建服务器。) B4 j; v6 x6 e
这么做处于几方面的考虑。( ?$ t  Q  e1 z: W( j
  • 我看不起Windows操作系统。
  • 我更看不起那些Win系列一键安装包。
  • 考虑的可持续运行的服务器,Centos肯定是不二之选。
  • 不自己编译安装,怎么能进步呢?
  • 万一后期自己想修改游戏,设计任务,添加物品呢?
  • 没错,我就喜欢开手动挡。自动挡,那是给残疾人开的。
    7 y4 O) i' V# j
首先在本地安装虚拟机,虚拟一台纯净的Centos7操作系统。
! M7 }7 {* r" P% V( k把该打的补丁都给打了(yum update)
: K2 m3 I; y0 l8 r) j完了之后,咱们安装一些基础的组件和环境。, q: `  r' V4 D( V
Yum install git cmake gcc patch autoconf mariadb-server mariadb-devel libtool zfstream gcc-c++ subversion boost-devel
! v, g( o9 O  r; l如果有些组件提示没找到,无所谓。继续往下。
( }/ _7 X3 C3 Z8 k- h, R我编译安装的第一个版本是cmangos。+ p& N  |8 m+ k; a$ b! i
这个版本支持机器人,地图提取工具。在编译的时候可以添加参数。% h# w1 U4 Y6 X- `
cmake -DCMAKE_INSTALL_PREFIX= -DBUILD_EXTRACTORS=ON -DPCH=1 -DDEBUG=0 -DBUILD_PLAYERBOT=ON
) Y! F6 ?9 r7 ~3 i编译参数中:# j  v3 m, y5 x5 S
DCMAKE_INSTALL_PREFIX是指你的服务端安装目录,可以自定义。+ J2 [3 ^# Z' f# u1 S
DBUILD_EXTRACTORS是指是否安装地图提取工具
0 n) p. z5 d0 F+ s6 G8 @DBUILD_PLAYERBOT是指是否打开机器人
% z$ i. e8 u0 G这里我做科普2:/ }# x: U1 G; [! T* L: |
首先是科普1我们提到过,MangOs是一个大型多人在线角色扮演的游戏服务器程序框架。理论上他是可以模拟所有的络游戏的。
/ h1 f' h9 f/ d, c7 e& Q既然,现在我们用它来模拟魔兽世界。那么肯定要对魔兽世界进行独立的一些补充(数据补充)。这就是上边地图提取工具那个参数的作用。我们需要上传一个魔兽客户端(你想要搭建的版本)的地图文件。然后我们使用地图提取工具,对客户端进行分析和提取。配上专用的数据库来模拟暴雪的游戏服务端。8 f1 V- Y. [/ C! i- _2 u$ t) \
至于那个机器人吗?那是个笑话,请自行忽略。
, W6 T$ a: p  u  Q: L& I* w我们继续,我把整理好的搭建步骤列一个明细:  j' Y9 o. Y& e' K/ \
  • 首先使用git选择一个自己喜欢的版本git到本地服务器。
  • 然后设置编译参数开始编译。
  • 提取地图放到服务端(下载别人编译好的可以不用自己提取)。
  • 下载安装导入数据库(感谢Mangos使用了mysql数据库)
  • 对服务器进行配置。
  • 启动服务器。
  • 配置客户端的服务器链接地址。
  • 开始游戏。1 D# ?- o; t, X+ R; w! Z
这中间,我把一些别人不会告诉你的关键步骤做科普3:/ j$ [, v  }8 O5 b' M
  • 在编译的时候需要用到gcc、cmake3、ace等几个核心支持。
  • 某些特殊的服务器版本,不支持地图提取工具的参数。只能曲线救国去找,下载别人提取好的地图文件(我这里去找了个别人制作的win一键安装包,借用了他们的地图文件)。
  • 数据库汉化是个细致的活儿。没有编程数据库基础的,建议曲线救国。
  • 有些魔兽客户端版本,并没有太好的大脚插件支持。(反正我玩怀旧感觉大脚怀旧服专用版就做得很好,可惜不兼容我的1.12.1)
    9 e8 \0 J' _  |9 r. F! M
放几个链接仅做Mark:
* I$ r0 X2 C- xCmake3 安装- H+ }- L' {- Y  h+ e  k
https://blog.csdn.net/weixin_38883338/article/details/86408749) Y$ w5 d0 T  H
Gcc 67 [9 c2 J/ |4 @1 r0 u8 P
https://blog.csdn.net/Al_xin/article/details/92438055+ e; F( `# M: T8 _7 c
ACE6.3.3
6 J/ J4 {5 [; k! H! Ahttps://blog.csdn.net/u010587274/article/details/50965369
7 U) r) y4 f: ^Git源码和数据库编译安装服务器5 U! J! R/ |6 z+ S4 _
git clone git://github.com/cmangos/mangos-classic.git mangos! n, r3 q$ o  u
git clone git://github.com/cmangos/classic-db.git; I- X, @( m6 H$ O7 ?- I
ACE的编译安装和地图提取,确实有点耗费性能和时间,不过地图和数据库后期你熟悉了可以越过,而上述三个环境的安装是铁定要做的。6 {- L$ W) B7 I2 M. y
我们来说一下服务器的配置。
8 z3 h7 G  K4 {/ }, Q3 o8 n在编译好服务端,上传提取好的地图后。我们要设置两个文件来启动服务器。分别是etc目录下的:
" h, Q. ?; s' E/ q1 u' m8 l
  • mangosd.conf(服务器参数配置)
  • realmd.conf(账户认证服务配置)
    " }' Q" V! n: a7 n, f# B
有几个关键点,我整理如下:2 G! O7 k0 {9 o
  • 首先是地图目录的配置,你可以写绝对路径,或者相对路径。只要写不正确,服务器启动不起来。会提示xxx.map exits之类的。意思就是找不到地图文件。
  • 你要配置数据库的链接地址这里可以连接远程,本地都ok。只要连接地址、数据库用户名、密码、数据库名字正确就ok。
  • 我们一般会配置一下进入游戏的欢迎语,人物出生的携带金钱和出生等级,还有打怪升级的经验倍数这些参数。
  • 如果你需要做一些有特色的的东西。可能就涉及到修改数据库了。比如说人物出生送T3套装。这个就需要去数据库中进行配置。
  • 如果你是为了让朋友一起来玩。就吧那个BindIP给注释掉。否则可能引起一些无法连上服务器的奇怪现象。0 {! N1 ~) H' r1 S
参数名称:
$ L- B- A! E0 F8 H9 ~$ b地图目录
6 C3 a2 d0 ^9 A' Q  R1 lDataDir = “../data”
: {9 j& L. n5 n日志目录3 r9 ?1 G( j5 F" |
LogsDir = “../logs”
% L: \6 s. _% {# I2 J游戏欢迎语
- ~7 }$ n% i/ O/ Y$ a8 W4 NMotd= “游戏欢迎语”
4 [: P/ y7 b! q: f) R出生等级
8 l" L! w. Z/ H" S. fStartPlayerLevel = 1' h) r. V! x- p6 K
出生携带金钱1000G
4 x8 o* H0 G/ \9 |2 R1 V% \StartPlayerMoney = 10000000# T- X  P0 {4 h
杀怪经验5倍0 Y( _4 l4 Q. `) P8 w, a
Rate.XP.Kill    = 5
, M+ b% h' u, B. P7 i' m, j; u* I任务经验15倍* s! N4 N. w9 c9 o
Rate.XP.Quest   = 15
- K3 A" `9 i/ U$ j: D' @0 F1 h探索地图10倍" c3 K/ M% |  E! ]& F
Rate.XP.Explore = 10
6 }4 S7 C) B( o( z3 X, G数据库连接(应该有3-4条之多,按下面格式修改即可)# ^. R( d9 ?, Q0 b. l
LoginDatabase.Info              = “地址;端口;用户名;密码;数据库”& K1 R) n5 Y1 J" n- x
配置结束,就是启动。
. v5 \2 x3 A  E( _4 o  y因为,我们搭建的服务器属于广域网,可以让朋友一起来玩的。那么肯定要对防火墙这些进行配置。否则防火墙会阻断服务端提供服务。
* v" d) W; o$ P. @) C, J我们需要开启如下端口:1 G$ K7 Y  N: D
8085,9600,37247 v* T+ x! r. R! f
把他们添加到你防火墙的白名单即可。7 }" e# X9 @$ v: t3 j  b
(当然,考虑安全呢你可以修改一下端口号。这我就不多费口舌了)
  M( K: M. ^* G/ q7 b( n一些收尾工作:
# X/ o0 A( ?/ B9 U
  • 主要是对服务器进行安全加固,例如修改ssh登录端口,禁止root登录。开启防火墙等等。
  • 对游戏数据进行定时备份。毕竟是自己家的服务器,有时候可能会来做一些测试。数据备份显得就非常重要了。我反正是1小时已备份。这个用shell脚本去备份mysql数据库即可(注意清理)。
  • 可以要制作一个网页,开放给新用户去注册、修改密码、下载客户端等等。这个就是另一项技术了。有机会我们再聊。9 k8 M8 d- j0 M7 B( Y7 t

游戏登录界面

游戏登录界面

成功进入游戏

成功进入游戏

server.zip

148 Bytes, 下载次数: 7, 下载积分: 金钱 -5

database.zip

10.65 MB, 下载次数: 7, 下载积分: 金钱 -5

ACE-6.4.7.tar.gz

12 MB, 下载次数: 7, 下载积分: 金钱 -5

ACE-6.3.3.tar.gz

11.87 MB, 下载次数: 6, 下载积分: 金钱 -5

cmake-3.0.0.tar.gz

5.24 MB, 下载次数: 8, 下载积分: 金钱 -5

rarlinux-x64-5.0.0.tar.gz

1.08 MB, 下载次数: 8, 下载积分: 金钱 -5

986

主题

92

回帖

5万

积分

管理员

积分
55255
 楼主| 发表于 2022-7-29 16:13:58 | 显示全部楼层
yum install git* J5 h" `: }# q7 h- v/ u
git clone https://github.com/mangostwo/server.git
7 U# f  o6 z/ f4 }2 ?: k( Mgit clone https://github.com/mangostwo/database.git0 y6 h, l/ `8 a1 Q; \% [

% u' r1 }$ L& N" ]6 I7 @3 K0 b  e
  1. <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>
复制代码
  1. yum -y install centos-release-scl
    9 D1 N% o- o) J5 b: B( y- r3 T* c7 K: }
  2. yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils
    5 i; f, W( z8 S
  3. scl enable devtoolset-7 bash: S0 [+ Z+ W8 n1 ]. x& o* V) n
  4. echo "source /opt/rh/devtoolset-7/enable" >>/etc/profile3 I2 A1 X" m0 a% l2 a
  5. # 查看安装的包
    ' Y0 L% x5 w  k6 i% s
  6. scl -l
    + S& L" R, D0 o+ |: [
  7. yum -y install rh-python35( Z' K8 @. T$ Z( H/ U
  8. scl enable rh-python35 bash# r9 t* X: v! X/ W; J1 o( f" T$ F
  9. echo "source /opt/rh/rh-python35/enable" >>/etc/profile
    " o/ W9 Y0 x1 v! m% `  A

  10. + b* s+ \! L- T- ~! G1 q* B5 _2 Y
复制代码
  1. wget -c https://download.dre.vanderbilt.edu/previous_versions/ACE-6.3.3.tar.gz
    ' L! A2 v( X) Q3 H; p
  2. tar -xvf ACE-6.3.3.tar.gz
    / c4 ]- m, u  O9 T2 p  R/ @# P1 l  Z
  3. vi /etc/profile
    . ?) ]" Y/ b8 K: g+ k0 j% B
  4. #在文本尾部添加:  ]' Q& q9 U/ s7 {) ?4 t. G
  5. export ACE_ROOT=/root/ACE_wrappers
    $ r# @. g" m5 T6 s* r
  6. export LD_LIBRARY_PATH=$ACE_ROOT/lib:$LD_LIBRARY_PATH  c8 v! }& s2 Y2 G4 R& ~2 C! z
  7. vi /root/ACE_wrappers/ace/config.h3 f/ X  a0 E2 e) \1 W
  8. #写入如下内容:
    ) X, Y+ w+ R2 x  w9 [4 }( s8 x
  9. <code>#include "ace/config-linux.h"% m1 k% {; g, v" z6 E( W9 T
  10. </code>' r0 e) R* T5 H7 \
  11. vi /root/ACE_wrappers/include/makeinclude/platform_macros.GNU, E- R6 X( k$ O4 B# x! X, U, C
  12. 写入如下内容:, D9 R; }( E5 Z
  13. <code>include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU</code>3 B' x) X! l0 {
  14. <code>INSTALL_PREFIX = /usr/local</code>' E3 r6 u1 j1 F2 _5 h
  15. - b5 ?( C" f6 p9 [0 P
  16. chmod 775 -R /root/ACE_wrappers# J4 v% T, B" ^: ?) e- [
  17. cd /root/ACE_wrappers/
    6 P" s- ^! G  m$ J
  18. make* g, t# |" ]- t4 j
  19. make install4 r9 k4 n# B$ s  h" H2 D
复制代码
回复

使用道具 举报

986

主题

92

回帖

5万

积分

管理员

积分
55255
 楼主| 发表于 2022-7-29 17:20:43 | 显示全部楼层
  1. wget -c https://raw.githubusercontent.com/mangostwo/server/master/linux/getmangos.sh && bash getmangos.sh
复制代码
  1. #!/bin/bash( H! w8 f) N' a& C
  2. ###############################################################################1 W" n7 ^$ E3 c0 N/ }: \9 U8 t
  3. # MaNGOS Build Automation Script                                              #, [9 E/ S+ a( x# P2 @2 ?) q
  4. # Written By: Ryan Ashley                                                     #
    " y+ P# t1 k9 m0 f
  5. # Updated By: Cedric Servais                                                  #
    1 e4 a1 |1 h7 m8 F2 G
  6. # Copyright (C) 2014-2022 MaNGOS https://getmangos.eu/                        #% _; n+ ?, Q. l+ N
  7. #                                                                             #6 p6 @! ?" w$ `6 O( y2 s8 F3 P
  8. # This program is free software; you can redistribute it and/or modify        #
    - P# u9 {3 T% y& J/ `: Y1 f& n6 f
  9. # it under the terms of the GNU General Public License as published by        #5 K3 G# i) M  x1 M; n5 L# @/ F
  10. # the Free Software Foundation; either version 2 of the License, or           #
    6 a) G3 i+ u9 d
  11. # (at your option) any later version.                                         #
    * \+ n7 a+ S5 T5 |
  12. #                                                                             #3 J! U0 I/ B, w5 s! }  E$ W
  13. # This program is distributed in the hope that it will be useful,             #
    ; c* m! }  W  J* X
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
    ) m# E7 U$ m% s6 M0 V
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                #9 w# j5 n  v" Q  P8 r. r
  16. # GNU General Public License for more details.                                ## U4 a" y  C, D
  17. #                                                                             #3 B" F5 ]& U$ E: p+ O3 b- C4 C. X
  18. # You should have received a copy of the GNU General Public License           #
    - T$ P; j, ]( S3 R" p
  19. # along with this program; if not, write to the Free Software                 #
    , |- a: V3 ]/ g, Q8 {5 c- v
  20. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA     #
    . w0 Q( ~9 b6 A
  21. ###############################################################################
    7 n1 r: P0 g" ?$ W  O. ~- F! C

  22. # E2 O) f* H" T$ d+ j$ J
  23. # Global variables
    % q: n4 z# L( k) `, o6 E/ I. K
  24. DLGAPP="whiptail"
    6 l3 D" S. j' a( G& P0 ^$ j
  25. VERSION="2"+ [, m" p! d6 Q4 f
  26. ROOTPATH="$HOME"
    & \! {8 W# y3 A% h) R
  27. SRCPATH="$HOME/mangos/src"
    8 V, a' \" ^. b) Z
  28. INSTPATH="$HOME/mangos"
    * t% H" u4 j  b  N: L1 i
  29. DB_PREFIX="two"
    ( Y; N' A! n5 p" y; H. }
  30. USER="mangos"3 d/ l" ^9 a; z0 V
  31. P_SOAP="0"" y8 ?5 _# ^4 }  M
  32. P_DEBUG="0"
    6 O) _: d( ?5 M
  33. P_STD_MALLOC="1"; d' p& X; m  I+ J
  34. P_ACE_EXTERNAL="1"
    ' z2 o  W6 p, n5 X: x/ H
  35. P_PGRESQL="0"
    $ f9 x2 c! s7 T3 |1 ^- Z9 R; J2 z. R
  36. P_TOOLS="0"
    9 p" [  U: _( {+ l6 `
  37. P_SD3="1"
    5 o9 p4 Q! X; B
  38. P_ELUNA="1"
    ' j# m- M0 h! t- U( P( M
  39. P_BOTS="0"1 |& n3 c7 w7 S7 v- W
  40. CMAKE_CMD="cmake"
      Y( c) I% u( N: ]% i( E. v

  41. 1 x2 j  i9 K: s

  42. , z' W1 K/ K4 s  k8 ?" ~
  43. function UseCmake3()
    . A) [! s1 l' \* T# U1 |
  44. {; b- V7 D$ t( A+ N! O; E8 K9 j& @
  45.     # set the command to cmake3 if its there0 P. K$ v2 ~1 {3 {3 p
  46.     which cmake37 F! @4 m' x" r8 I, L
  47.     if [ $? -eq 0 ]; then9 o. |( A; L, f( ~* z4 S6 b
  48.         CMAKE_CMD="cmake3"
    & u7 l( s2 N% J
  49.     fi, E% `3 j1 y3 l, n0 W3 r' T
  50. }4 x' u4 G1 }+ J9 q, D

  51. 7 H9 Q! o% Q% g! w
  52. # Function to test for dialog/ O8 k. I" A2 ]/ F' W/ M
  53. function UseDialog()+ Z9 b3 w! S3 W8 s* y+ a- q
  54. {
    * {* Z  A) s) a; i+ u
  55.   # Search for dialog' y4 A, Z* @4 W# S* q$ L: u; z
  56.   which dialog
    * T3 H3 p' ~% G. V+ t/ l0 {0 b
  57. # `" v0 P7 w  P) @  o
  58.   # See if dialog was found
    0 x) o, C! a; k5 I5 q
  59.   if [ $? -eq 0 ]; then" O2 _) [& g& x, M' w
  60.     DLGAPP="dialog"
    , O! q. I. X  c8 k
  61.   fi
    0 W; n1 c" c' S
  62. }+ `! z: ^. V$ |& E0 v9 O/ y% \

  63. & f7 t3 X1 O1 g, d3 ?
  64. # Function to test if the user is root or not% X* P# q3 ?- P* ~* V
  65. function CheckRoot()4 l% m5 Y9 h& ^$ b) _9 T, z
  66. {
    0 L: |7 F3 p0 I3 P9 }( F
  67.   if [ "$(id -u)" != "0" ]; then3 q' c2 \5 h8 H
  68.       Log "This script can only be used as root!" 15 g: K- K2 ^) k; ~! w; M, `
  69.       exit 1
    ! Z# c  D3 M# R0 `% C
  70.   else: P( `& }  x% f# i4 P  h
  71.       Log "User is root, check passed" 00 G1 n, p1 u+ q
  72.   fi, K9 s4 X6 S0 b0 N" Z5 X
  73. }: T/ ^7 x5 Y3 c/ E$ {& {- ^
  74. 4 {- [) V; l4 k! q
  75. # Function to detect the repos  z9 r- W7 O4 X4 p4 Y) m
  76. function DetectLocalRepo()) d8 {  {0 ~: d( |6 U/ P! @% G
  77. {' k5 n$ a2 i2 |: L, f
  78.   local CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"% K7 F0 s- ^* _0 q" _: l: p0 @
  79. 4 |. ~6 B) j' R* |* `7 x) o. Q. W
  80.   # First see if the Windows stuff is in place
    8 O. \* W# j8 Q. p: m
  81.   if [ ! -d ../win ]; then
    ( Z) |3 X4 Q+ |0 \# f  d
  82.     Log "Windows files directory does not exist, assuming repo has not been cloned." 05 A" w( r' Y' `3 R. R
  83.     return 01 l' @  `4 f, ?- B8 ]8 X
  84.   fi
    % d' e- P% i" p3 h! _
  85. , A/ o7 T: e' }* \9 }. r  N
  86.   # See if the sources dircetory exists0 }9 T$ G& g. s7 @0 F; k
  87.   if [ ! -d ../src ]; then# _! h4 W. g% N. E. m
  88.     Log "Source files directory does not exist, assuming repo has not been cloned." 0
    1 T( r' d; e4 W  s7 {; G5 X. [
  89.     return 03 j' v( Y8 U! v' `
  90.   fi
    ! W7 D% {8 x2 E5 d; W4 R/ l

  91. * H) B: t+ P4 o4 {' [8 f
  92.   # Check for the CMake directory
    - F( P! r- g! c( Q- O' J8 k
  93.   if [ ! -d ../cmake ]; then
    / C) W5 ?( S+ i+ G" n6 f  M
  94.     Log "CMake directory does not exist, assuming repo has not been cloned." 0& j3 R' Q" W, ~. @) b
  95.     return 0
    6 D: l2 i- S* `% K$ X; I
  96.   fi
    ' h4 ]. W8 K: D
  97. ) z" A9 F% K) S
  98.   # Set the default paths based on the current location
    8 A; `  C- u1 s1 y* y
  99.   SRCPATH=$( dirname $CUR_DIR )
    . h! S# A" [/ I3 ]
  100.   SRCPATH=$( dirname $SRCPATH )
    ! j/ U& c# P3 l+ P+ S
  101. 0 _! _6 \4 v/ b/ r
  102.   # Log the detected path; a  A( H, A5 }( E" O9 `
  103.   Log "Detected cloned repository in $SRCPATH" 01 \0 [& F7 A" C7 i1 d
  104. }0 @9 B7 d: b1 t- y: o& o
  105. ' d1 \* x8 M8 J! n7 ]& f5 p
  106. % u: j+ k1 _. h- H' P5 \" R' F( I

  107. 8 C$ Q- g) ]$ t& f4 g) y  w; V+ l
  108. # Function to log results: j. i" g. H8 ]6 \- ?2 M
  109. function Log()
    0 M: r& N9 |- \& y* F4 P' O8 s1 @
  110. {
    $ w- ^# n. ^5 i  g7 e) R% C
  111.   local TIMESTAMP=$( date +%Y-%m-%d:%H:%M:%S )- y! W5 S; H/ a! I) r& r( a" m
  112. 3 J% I' D+ i. ]8 f& A3 z! b
  113.   # Check the number of parameters, t  Y7 E& [& K! ?7 d
  114.   if [ $# -ne 2 ]; then2 @  b% [$ `2 i  v& y
  115.     echo "Logging usage: Log <message> <echo flag>"5 l6 b5 [# B% T& W1 a8 o9 e9 j" E
  116.     return 1
    9 U$ A8 y2 x$ C, I8 `9 W% |2 o
  117.   fi9 k& T4 [$ E# M$ b9 o
  118. # f: g( i. o4 u
  119.   # Echo to the console if requested' H' |  I8 o9 J$ x
  120.   if [ $2 -eq 1 ]; then# ]( x! ~: U; |$ W6 T
  121.     echo "$1"
      N, x# [2 Q- c# W* S& V& v
  122.   fi& W$ f# i7 U9 H

  123. 0 T9 G2 d& o3 G6 u8 k2 I
  124.   # Append the string to the log. r: y) w/ h# E0 H- v# s! ~
  125.   echo "$TIMESTAMP $1" >> ~/getmangos.log
    ( i1 n" |! F2 y
  126. }' G; X# H" U* f- k: @  Z

  127. 7 g- b" C1 a' e# E# ?( S6 r

  128. ) R) J  Q2 @; {+ ]

  129. , P7 L4 i+ p: `* [5 ]2 q( K/ k
  130. # Function to install prerequisite libraries
    9 }2 V8 u6 r/ z, c1 H6 }
  131. function GetPrerequisites(), ~" z( b, E/ E  C7 ?
  132. {
    9 ~9 d2 p+ G; ?5 F( U+ B
  133.   # First, we need to check the installer.7 B5 X, f) v- @0 [; Z. e# T  S
  134.   installer=0
    # w4 z3 [, a' V, f7 P/ r
  135. 1 W' R. `4 M$ e. H( z& \
  136.   which apt-get
    * |; ]4 _& b! ~5 e9 p" k8 i

  137. 0 F+ R( @1 A. c- p# V2 a* S
  138.   if [ $? -ne 0 ]; then
    * n7 c* l0 W8 v! o
  139.     Log "apt-get isn't the installer by default" 1
    - G- R' g* x/ i8 S: G
  140.   else5 G4 ]6 d. }+ E, i2 V
  141.     installer=1# Z- g0 W9 V; o! ?; x
  142.   # On a fresh OS boot (EC2) libace was not found without first updating 9 u( Q. F5 e/ U
  143.     apt-get update -y && apt-get -y install git lsb-release curl
    9 y% R9 S5 b& W8 M$ u& Y
  144.   fi- B1 c6 M; H7 ]* j

  145. # u9 a" S; l5 |# _' p/ y4 z
  146.   which yum
    - K  F! e$ U* V
  147. * d: X1 {) b# u
  148.   if [ $? -ne 0 ]; then) W# B! C  U8 X% A0 M5 C6 V
  149.     Log "yum isn't the installer by default" 1
    1 z" b9 n4 p7 u" S
  150.   else1 y4 L: D% W/ j! Z$ e( |
  151.     installer=1' q0 }* i/ e& f* H
  152.     yum -y install git redhat-lsb curl9 T1 V7 m9 ~6 X5 n# ]2 Q7 D" X& t
  153.   fi
    ) x! ~9 O( G/ I2 u. Y! G

  154. & D8 |3 A6 N9 f/ \
  155.   which aptitude
    $ |7 x5 G* l/ q, m
  156.   if [ $? -ne 0 ]; then: k* G3 b% M" f5 X  I
  157.     Log "aptitude isn't the installer by default" 10 T# {! ?) Z: ?8 ~
  158.   else
    : }" \  c2 m! k4 q8 b! t
  159.     installer=1% G: ^# h) V/ Y, W3 h  J
  160.     aptitude -y install git lsb-release curl
    7 a% @, Q  X! c& n8 z
  161.   fi# _( y& x& m" [9 |# v
  162. # \8 \+ C, ~  R7 n  P/ f/ H
  163.   # Then, let's check that we have the necessary tools to define the OS version.
    $ B* d% ?0 O2 G
  164.   which lsb_release
    " P, d% H: {, m  A: f6 A$ D: A& C/ ~

  165. 2 @! K* j: d! H1 _& Q+ o9 B$ s
  166.   if [ $? -ne 0 ]; then5 F9 F+ Y4 I. J( h$ k% h
  167.     Log "Cannot define your OS distribution and version." 1
    " ~" \( {) T0 _' M; C" V( u
  168.     return 0
    3 c; S& _" n+ O
  169.   fi! l( A$ E* P5 b3 n

  170. ( Z7 X$ n: n8 k' n) z& ~; m
  171.   local OS=$(lsb_release -si)
    % N+ ~1 U/ v  f+ L" S
  172.   local VER=$(lsb_release -sc)
    ! @# @$ f" z1 Y3 {+ ^4 O' z4 {
  173.   local OS_VER=1) J2 p6 g0 r* k. m( o# Y; W$ T
  174. 9 q* r" m* N; p% l1 t
  175.   # Ask the user to continue
    * I' S; R" q. d& t: B3 K
  176.   $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install Required Dependencies" \0 `3 l/ U" T+ B/ i! y
  177.     --yesno "Would you like to install the required build and development packages?" 8 60
    1 i& l& w& m' ]7 I' O
  178. 0 |- B5 Y/ W2 y. m
  179.   # Check the user's response, N; K6 [) l2 |' v& d4 Z2 \
  180.   if [ $? -ne 0 ]; then
    ; D) g6 w' e' j6 ^
  181.     Log "User declined to install required tools and development libraries." 1
    9 W( t5 r& F  s/ ^/ ^% f5 ?, ?
  182.     return 0
    ; S. v% W7 F6 ~' l
  183.   fi0 v2 _' b: }$ _

  184. ' C  @; C. W, j1 j5 n5 g" S( {
  185.   # Inform the user of the need for root access
    6 h9 }0 h: N$ r1 H( I. d4 L, e" k
  186.   $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install Required Dependencies" \5 F% k% u) E: A8 k/ c
  187.     --yesno "Installing packages requires root access, which you will be prompted for.\nDo you want to proceed?" 8 60& }0 z& @2 ^. G; o

  188. " N" _6 V3 @  R7 p: ]
  189.   # Check the user's response) i5 R/ ?1 l0 T
  190.   if [ $? -ne 0 ]; then6 S5 L1 ]1 i/ Y6 {3 O1 C: L* v8 E$ w/ g
  191.     Log "User declined to proved root access for package installation." 1
    8 @: B! r8 r' i4 @% L7 L! C& [
  192.     return 09 _+ f# N9 J3 p2 F, V6 E
  193.   fi1 |  u7 K; Y/ U1 X. d7 Y2 J
  194. & u. `0 n* K, r4 l5 g, N' Q" U( q, }
  195.   # Handle OS
    + P6 s8 E1 Y0 H! d9 z; z) m1 Z$ E
  196.   case ${OS} in
    ! K$ N5 a' {% h( M" m0 I
  197.     "LinuxMint")
    # D, }* [! o: p# y2 x- E; \' {
  198.       case ${VER} in
    1 N: q, k; N' o3 O% H5 ~+ h
  199.         "sarah")3 n9 h" i7 k! b3 J9 B/ i
  200.           # Linux Mint 18 - Ubuntu Xenial based
    9 d0 C2 g* F0 i& ]
  201.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
    . P& M: D/ J% t8 g/ m( N6 q& f
  202.           ;;1 ^( a% }+ W; I* |8 z$ S
  203.         "rosa")- l/ P* D: F8 K
  204.           # Linux Mint 17.3 - Ubuntu Trusty based9 f  }+ h) d! v4 z7 }  ]! J
  205.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root9 r. \6 s1 i2 b/ Z# m7 q
  206.           ;;* r9 V, ]6 k3 ^, j3 ?9 D
  207.         "rafaela")  `: C& Z% T( W( L2 e
  208.           # Linux Mint 17.2 - Ubuntu Trusty based
    * z# J2 O1 O4 C/ O' a
  209.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root' T; m' K3 n5 L2 d  ?( |9 p
  210.           ;;+ v  d& G/ q, T! N
  211.         "rebecca")# a/ `+ F" I: K9 h) v! r  W
  212.           # Linux Mint 17.1 - Ubuntu Trusty based  C# m# k7 E6 q
  213.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
    % H0 `. V8 S, ^5 |4 _* s
  214.           ;;
    % o2 v( D+ u1 W
  215.         "qiana")
    5 i  I, y2 R: Y* M
  216.           # Linux Mint 17 - Ubuntu Trusty based
    % i/ A$ [7 v7 U6 \8 I2 y
  217.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root# M5 {4 [. k% A  Q  T, q
  218.           ;;
    ( d1 O' U5 F3 Q/ I5 S( L
  219.         "maya")- I! _7 ?" Q8 n. [5 X! v
  220.           # Linux Mint 13 - Ubuntu Precise based
    + G3 b- M! }( K0 J, f: R+ j
  221.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root8 n8 w2 A1 [, i1 T# x) I5 b4 Z7 ]
  222.           ;;
    3 x. ~: c9 l" m
  223.         "betsy")
    , ^7 X. Q6 k2 F3 O8 N$ B! \
  224.           # LMDE 2 - Debian Jessie based* G" k8 Q5 |4 ~" a1 g" d
  225.           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
    / d" a! _# O/ W" H
  226.           ;;
    + m2 w# T2 Q9 m- J* ^3 ]
  227.         *)
    & A3 [/ t" l, d- k2 x
  228.           OS_VER=07 h, I! r6 Z4 O, z, M0 e- |
  229.           ;;5 a; {' h" w1 y1 c) s
  230.       esac) x( t" d& ]+ Q* A& j$ G
  231.       ;;- A7 f0 N7 b8 y( ?" A/ N! A
  232.     "Ubuntu")
    ( C9 K5 c* L* o7 g  P5 K* q9 Z- V
  233.       case ${VER} in
    ; x0 U/ f- |; i* i' q
  234.         "precise")4 h1 t: [- C. e2 P1 V+ L
  235.           # Ubuntu 12.04 LTS9 I6 u  h, q0 g; V! a
  236.           su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root) g" i+ Q5 P) Q4 m2 _) q; H4 g
  237.           ;;5 N- I/ e0 l' E) x+ J4 l& q" o
  238.         "trusty")! A' o1 a1 a  M/ y7 A: u
  239.           # Ubuntu 14.04 LTS
    % M! ~6 _( f3 Z
  240.           su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root6 H0 U7 \" Z! }0 I
  241.           ;;
    * r3 W4 m. f0 \8 d) M$ M& x
  242.         "xenial")$ ?$ ?$ Z" s2 ~. j
  243.           # Ubuntu 16.04 LTS. n5 K- z! Q+ s- `1 Z4 b
  244.           su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root4 H) c. E$ \0 \1 {# f: d* A
  245.           ;;
    4 {- a% U! m2 b: @8 a; A; W
  246.         "yakkety")1 _, b6 L: {$ E8 E% k. ~+ K, W
  247.           # Ubuntu 16.10) G- c; x. d: W) J3 q
  248.           su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root+ s$ Q* R0 F% z: h. [
  249.           ;;" b  ?+ h' t- ~  ?/ R* V% ?
  250.     "zesty")8 q( Q! J( y% W' ^, m
  251.       # Ubuntu 17.048 A& ^, c( \9 r- {0 q/ l7 y- [3 m
  252.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
    ; T$ t( h" C2 v1 }% R
  253.       ;;  [% p! e/ E: x$ V1 ~7 S# d2 S
  254.     "artful")! _- {4 V9 V9 s
  255.       # Ubuntu 17.106 ^# B# Z( R! b2 {1 f
  256.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root# N, p9 Y; b$ A( R- i, D9 z
  257.       ;;
      P0 M& v7 J+ ?
  258.     "bionic")
    , s6 t; x5 T8 Y! H1 B# ]5 B
  259.       # Ubuntu 18.04 LTS
    9 y  j. e3 @% _/ d+ }
  260.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root9 J3 h6 t5 i7 B
  261.       ;;
    - ?- o  m) a7 g, V
  262.     "disco")
    $ R/ t0 U1 \1 s' P0 u. C, \0 d! q
  263.       # Ubuntu 19.04
    0 W; ^, D% h: R7 w2 n
  264.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root& \% ?3 t0 y, G4 ^9 i: g% ~
  265.       ;;1 |# U# u! F' W  ^: {, V5 Y8 q
  266.     "focal")! a( m( U) {* n7 n' u! Q
  267.       # Ubuntu 20.04; a1 R2 g0 @. s  }9 H0 t# v
  268.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
    % n" Q5 }/ G3 d7 H' p
  269.       ;;
    ' _. {. m2 e! u# P# V+ v3 A  z
  270.         *)+ w$ H  [* C$ a8 E8 h- w+ q
  271.           OS_VER=0
    ( t4 Z: U4 ~4 N7 u$ L9 N% {
  272.           ;;/ Q: T) w0 Q+ M6 M0 j
  273.       esac
    / [& _& B, a  L  x
  274.       ;;, I. Q) I  P% R
  275.     "Debian")
    . l8 g0 Q% n0 A0 }  Z: J  Z& s
  276.       case ${VER} in; o  [& }. L1 k& S5 n3 q/ i
  277.         "jessie"). e  B# `* ^$ f, X8 Z
  278.           # Debian 8.0 "current"
    ( R/ {' m/ i, L1 P9 F; R
  279.           su -c "aptitude -y install curl build-essential autoconf automake cmake libbz2-dev libace-dev libssl-dev default-libmysqlclient-dev libtool" root6 J! k  I! f" N( m( x% w7 t
  280.           ;;
    ! b- P* ~  K3 V8 v
  281.         "stretch")
    8 F2 O7 o  |- f
  282.           # Debian Next
    8 M5 K/ I/ E7 m9 U, D4 \/ `- |
  283.           su -c "aptitude -y install curl build-essential autoconf automake cmake libbz2-dev libace-dev libssl-dev default-libmysqlclient-dev libtool" root' G' u: n6 \0 D8 X; R
  284.           ;;
    ! d' p) ^4 D! d5 Q: e
  285.         *)
    ! r7 m1 H  _5 d8 h% ]" v4 b& [1 F
  286.           OS_VER=06 B+ l: o1 E6 f; V* |8 L3 R
  287.           ;;5 ?: o" J9 [/ F8 V9 t' n/ n
  288.       esac
    # M9 c( b% ^5 R1 ^
  289.       ;;# ?# w# F. Z' m
  290.     "RedHatEntrepriseServer")
    " Q* h; o! @& d4 I
  291.       case ${VER} in
    7 `4 B; j7 B! K" ]( h5 V
  292.         "santiago"), t! Y/ Q; f8 ]9 c; {+ s! O/ A1 M$ P
  293.           # Red Hat 6.x7 t2 L5 N2 }; k3 N
  294.           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" root8 W) s& W: j# }! Q5 |
  295.           ;;
    + `9 M  f9 v+ h" G) F* |' S% w
  296.         "maipo"); Y6 d% ^$ a0 Y0 S* W0 M' `# E
  297.           # Red Hat 7.x2 m* C* |+ p$ d9 V4 k$ f
  298.           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" root1 @; E0 _: p$ p( i  _
  299.           ;;
    % B. E& Y! a7 k+ S  C
  300.         *)9 n3 l. v4 S9 x7 x" t: z7 y
  301.           OS_VER=02 ]3 Z$ i& i9 c& D* j% J2 j
  302.           ;;* y& u  @5 R7 r+ j4 m1 G
  303.       esac, O% _+ D- I6 {6 M
  304.       ;;
    , E5 z& W( P5 E# m2 r+ G) E
  305.     "CentOS")! i- I+ Z) b8 G+ `  E) D
  306.       case ${VER} in
    ( Q& R9 _- k% y7 h
  307.         "Core")
    8 L) r" A+ c1 E( b+ d; R6 ~, J6 V
  308.           # Default CentOS - Adding necessary RPM third-party.
    2 f/ A( a. l: o
  309.           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" {+ S# ^+ o* q3 S% s( N# h
  310.           rpm -Uv ftp://rpmfind.net/linux/centos/7/os/x86_64/Packages/perl-Net-Telnet-3.03-19.el7.noarch.rpm1 ]3 U& m8 Q- |; r1 Y
  311.           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+ O  @7 G0 d$ d3 M2 k6 I
  312.           rpm -Uv ftp://rpmfind.net/linux/centos/7/os/x86_64/Packages/libtool-2.4.2-22.el7_3.x86_64.rpm
    0 B5 G6 p. e: O. ^+ D
  313.           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
    ! ?8 K9 M+ g4 h! U& W. [9 W
  314.           su -c "yum -y install epel-release"- k0 z' }) C8 Z$ f
  315.           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
    0 [9 O8 t3 ~. }+ F& q* b  b; e7 }
  316.           ;;) C/ O4 p" o- @# \
  317.         *)
    $ j2 Q1 Q) G- v/ x3 ?
  318.           OS_VER=0
    8 O, C- Y2 Q* ?% ^
  319.           ;;
    , I$ C% I: Z6 n* B, [- ^
  320.       esac
    / N# ]2 |) i' R$ b$ z# K
  321.       ;;2 K8 u' P* ?$ i
  322.     "Fedora")) D- _- n( H5 F4 u
  323.       case ${VER} in
    ! S8 N% ?0 C6 ?/ _" G' x( w
  324.         "TwentyFive")5 I* l* {+ o/ K- q
  325.           # Fedora 25 - Adding necessary RPM third-party.
    ; i% ~6 l, d3 p; k  F% V+ {
  326.           su -c "yum -y install autoconf automake libtool gcc-c++" root. E  @' w6 P& K. e, w4 }
  327.           # Getting and building ACE. Not provided in RPM for Fedora...! ~7 p) T2 v* P& I3 c4 W
  328.           rm -rf ACE-6.3.3.tar.bz2
    ; e2 J& X, p/ P" ]0 q: E
  329.           rm -rf ACE_wrappers
      j; t% p1 R4 `* o
  330.           wget ftp://download.dre.vanderbilt.edu/previous_versions/ACE-6.3.3.tar.bz2. _( ~, P  l. H/ v
  331.           tar xjvf ACE-6.3.3.tar.bz29 {1 W( X* P; f% w& T
  332.           export ACE_ROOT=/root/ACE_wrappers
    ) H. O+ ]! {) h; l
  333.           echo '#include "ace/config-linux.h"' >> $ACE_ROOT/ace/config.h  C; i( r) h& j& ]$ U
  334.           echo 'include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU' >> $ACE_ROOT/include/makeinclude/platform_macros.GNU: l/ _( V) y3 Z2 L  H1 ]) g* I
  335.           echo 'INSTALL_PREFIX=/usr/local' >> $ACE_ROOT/include/makeinclude/platform_macros.GNU
    9 z2 H+ X9 X. J, [  m
  336.           export LD_LIBRARY_PATH=$ACE_ROOT/lib:$LD_LIBRARY_PATH3 u) x4 X( m4 k4 M0 c* }+ w
  337.           CD $ACE_ROOT
    3 @! F# X9 s' c+ j; L! d" ^
  338.           make
    3 G" }1 l# D  h4 N+ V& ~
  339.           make install
    ! }2 ^3 O9 c$ E" ~
  340.           cd ~6 w( |! J- _5 ?) \- w% s! \
  341.           # Installing remaining dependencies..
    + X3 p/ K( o4 y3 B4 H8 |3 N
  342.           su -c "yum -y install cmake openssl-devel mariadb-devel" root
    8 m% M  x6 V) ^( n! h, i
  343.           ;;
    5 L$ R  z$ [- v- b
  344.         *)2 {8 v, F5 z# h  y/ V6 }6 f  {
  345.           OS_VER=0* H! a9 m& L# B2 O, ^
  346.           ;;
    / u  C8 g; q) G: ?! R: e
  347.       esac' M/ Y, S3 O' D- a1 f+ ?$ [
  348.       ;;
    ( I5 O* {& j# I" M! a2 \: d! G( v
  349.     *)
    6 A7 K; O# n* S  Y' q
  350.       OS_VER=0
    2 G: ]# w; R$ G+ H# `
  351.       ;;! O4 E8 C5 S0 T& R
  352.   esac
    3 [" \, w5 C7 r  K, `+ ^
  353. ; m" }2 k, X" E5 @2 W3 z& {& O
  354.   # See if a supported OS was detected
    / U- @& D8 e; b
  355.   if [ ${OS_VER} -ne 0 ]; then5 C& j1 R) U! J
  356.     # Log success
    , u. c) U& }) v& V
  357.     Log "The development tools and libraries have been installed!" 1
    ! i3 ]- J: G9 u4 f- w& `" p$ d
  358.   else' h) d7 @5 G# @/ O/ f, u( z
  359.     # Note the error
    2 B+ ]2 _1 c8 I) R8 E8 d
  360.     Log "Could not identify the current OS. Nothing was installed." 1: [- [  h7 H3 K! y" e) y
  361.   fi
    5 ]" c2 D5 }" l# Z1 C: n2 o
  362. }
    & k: f+ Z/ [: h

  363. * L% b( _  n( w5 E7 T5 K) d
  364. ! n& @. ?! a! I2 t  W6 j1 L

  365. * M: z1 n2 A/ m! {: Y+ T
  366. # Function to get the WoW version8 ~% F+ l5 l2 N, G: q
  367. function GetRelease()* p' N( J  L- ^% k$ p2 B2 D
  368. {
    ( u5 f# n5 v% F" _9 L2 Z: `
  369.   VERSION=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Choose WoW Release" \, Y) ?9 [. q$ Z, l
  370.     --menu "Select a version of WoW" 0 0 5 \. r: {; _8 }0 r  `/ S
  371.     0 "Original Release (Vanilla)" \
    6 I* d+ z( t+ T3 b
  372.     1 "The Burning Crusade" \% l: r" g1 G' |) y% y* H
  373.     2 "Wrath of The Lich King" \% u9 U# c+ |( j/ [8 \3 X
  374.     3 "Cataclysm" \
    . G8 ?5 C" `8 ^4 r2 H
  375.     4 "Mists of Pandaria" \3 [( v$ e* z1 h4 _; |+ S) a3 a" D
  376.     5 "Warlords of Draenor" \
    , C& E3 U7 E- J2 J
  377.     3>&2 2>&1 1>&3)" k! ~0 y3 ^8 l- S0 K3 t6 G2 ]
  378.   r! j" l6 G2 W" o
  379.   # Exit if cancelled9 X2 l' F2 g6 \( O* O2 w
  380.   if [ $? -ne 0 ]; then
    8 n& X" n9 C- z) B+ `' o; D& G
  381.     Log "Version selection cancelled by user. No changes have been made to your system." 1
    : D1 o% M" ]8 R2 H) W( T( p
  382.     exit 07 t. t, z, F7 F0 @0 ?
  383.   fi, [( x* z  y% ]- T; k+ Y

  384. : ^' B7 ~1 ^5 {. W- ]% t
  385.   # Set some defaults based on the release, v% y* C: t3 A/ ]3 T; V' e; S8 q' K( u
  386.   case "$VERSION" in1 M8 L  Y5 b. r4 ]( W" Z1 Z
  387.     0)3 O9 Y- P, q9 @5 m/ u' O) c# A
  388.       SRCPATH="$ROOTPATH/zero/src"
    % n, a: m! U6 E; T" R9 l* C5 o
  389.       INSTPATH="$ROOTPATH/zero"
    3 m  n+ ]2 A* T( V% [
  390.       DB_PREFIX="zero"
    ( U+ {2 d4 r6 e& K
  391.       ;;
    5 ~9 h- k& k6 Q! s! M* E

  392. - F; f9 L& q7 e* ~( Y2 M9 \- C  N
  393.     1), M. H* H" B% s2 p
  394.       SRCPATH="$ROOTPATH/one/src", c$ B' o3 r* n" s8 ~# H/ s4 j- X9 B
  395.       INSTPATH="$ROOTPATH/one"
    6 t! H! j+ ^4 E+ L- N. Y
  396.       DB_PREFIX="one"- e$ r- \/ g* m3 Z$ r
  397.       ;;+ M9 I& d* j0 P  P# R, \

  398. $ ?- S5 ?; Q# X& d6 |" l
  399.     2)& B# R0 ?* Z# t3 w* j
  400.       SRCPATH="$ROOTPATH/two/src"2 \/ g' g7 \/ O! ~* Z1 o: T( v; `
  401.       INSTPATH="$ROOTPATH/two"0 ^3 _$ {: W, e/ U) C, d/ D. v' i* x3 k
  402.       DB_PREFIX="two"
    8 B( p' D. P. ~2 M; j) V) C8 x
  403.       ;;
      o  Z6 B5 Y$ z6 `2 ^7 ~. G& y

  404. ) o! |( ^7 Q& m1 D
  405.     3)8 {- P, l3 ^8 Q  B/ b
  406.       SRCPATH="$ROOTPATH/three/src"8 S5 n* k1 S* [: m" n, N9 Q  Z
  407.       INSTPATH="$ROOTPATH/three": j. v4 b& S% y/ b, E+ [
  408.       DB_PREFIX="three") f& |) c( ~* C" W& r
  409.       ;;
    ' ~' z5 l, V+ C
  410. + [* ^4 j+ r" M4 K+ L
  411.     4)& ~# h! S5 v4 s# }
  412.       SRCPATH="$ROOTPATH/four/src"& c0 Q# D/ g3 M% a) y
  413.       INSTPATH="$ROOTPATH/four"0 \1 }$ l4 h% ^) b
  414.       DB_PREFIX="four"
    ( C7 U" F4 i. @, V3 c/ y2 z
  415.       ;;/ Y( e5 t  ]/ F; W
  416.     5)) v! R( b9 D0 x0 s# c
  417.       SRCPATH="$ROOTPATH/five/src"8 ^% S3 K, L$ e0 l( r
  418.       INSTPATH="$ROOTPATH/five"3 z  ^  Z  l* c/ q1 P% I* [9 Q
  419.       DB_PREFIX="five"
    $ W2 ]( [6 z2 {# T, }( W  `
  420.       ;;
    ' P: a" p; z+ ^, v" E% ]3 V" y+ I) I
  421.     *)
    # u1 j8 X' U' o
  422.       Log "Error: Unknown version selected!" 1, q* X6 i- W( c8 c
  423.       exit 1& X: M. t% E9 D. ^
  424.       ;;
    5 V/ c: ]/ Y, m: c/ C  z, W$ L
  425.   esac" j$ z! _4 h- I- ?; A% f% @

  426. 5 }, |& o$ {& [, J1 w: I
  427.   # Now set the correct source path if the repo has been cloned already1 q- e) q- e. l- a
  428.   DetectLocalRepo# V5 ?  u4 Q- Z0 t6 A, q& ]
  429. }$ Y3 F+ {6 U3 T% ~% f0 O, [

  430. ( m0 b) }/ R5 u- M# d: F) o
  431. # Function to setup the technical user5 h# S0 X$ C4 u* n
  432. function GetUser(): _8 v, @8 r9 [7 d% f& H
  433. {
    % X+ Y, L8 U  \- T. @. y
  434.   local TMPUSER="$USER"/ p+ N4 s* z$ Y- P" J  Q
  435. & B6 h) c* |% G5 \/ m1 ^
  436.   # Set the user
    ' `! j1 |( j# ~4 A$ L1 G9 F# @# Y& E
  437.   TMPUSER=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User to run Mangos" \
    9 ~( z5 q" K. z! j
  438.      --inputbox "Default: $USER" 8 60 3>&2 2>&1 1>&3): \' S9 L1 y  V" h( |; Z

  439. * @( L7 m5 m2 i  Y
  440.   # Exit if cancelled
    " K& n6 b# h( a1 V# i4 E. F' C: Q
  441.   if [ $? -ne 0 ]; then
    4 l, z  z" [" _6 x, t8 O9 k; K) `
  442.     Log "User selection was cancelled. No changes have been made to your system." 1
    % f( ]$ ?; I6 k
  443.     exit 0
    9 }) M, j6 N9 ~: E
  444.   fi
    , X8 s: T" v* M3 y5 U

  445. / B. z4 r; G' y0 D  ^
  446.   # Change the user only if it was modified7 S9 v: t5 ?: v! a
  447.   if [ ! -z "$TMPUSER" ]; then
    2 `& x8 V1 }7 Y, r0 o
  448.     USER="$TMPUSER"2 h0 o* c( E4 v/ d, A' E; ]
  449.   fi
    6 g! W# u( P8 E8 ?

  450. 4 n% {' v! `# S+ @. r
  451.   # Validate user$ u8 S. l$ [4 H' e* e0 d
  452.   id $USER > /dev/null 2>&1' {8 q3 I5 B- R
  453.   if [ $? -ne 0 ]; then# z2 I5 L' s9 n) `0 \3 R/ V  E
  454.     Log "Creating user: $USER" 1- m$ P( k; X& W) [7 d0 c
  455.     useradd -m -d /home/$USER $USER > /dev/null 2>&1
    9 j* x: a# S6 M6 j0 r3 F/ e9 ]& n
  456. 6 k+ S; _9 i  D! t5 E
  457.     if [ $? -ne 0 ]; then
    $ g* x* ~5 y' Q
  458.       Log "Error: Failed to create the specified user!" 18 I& F( `) H* ~, S* Z; r5 _' s
  459.       exit 1$ K* }; W% W% b
  460.     fi& o' W2 A1 P0 C2 r( H+ e2 t& K4 ?

  461. : Y3 J* n% |' Z) x' J9 p
  462.         usermod -L $USER > /dev/null 2>&1
    ( e3 \& A) [6 x7 G6 D
  463.   else( ^) _; Y2 V% g1 ]
  464.     # User already exist, asking to keep the user. w/ w4 L7 A4 ]# U
  465.     $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User already exist" \, B; Y' |6 G/ C: e- ?( r$ A
  466.       --yesno "Would you like to keep the user "$USER"?" 8 60
    # o- [( O! d, K; ]: |8 \. P
  467. 4 S* t8 |% u. T+ H4 K
  468.     if [ $? -ne 0 ]; then2 m. I! g' J# [" i
  469.       Log "Removing user: $USER" 14 J6 u* _0 H" ^3 X* E+ D( a
  470.       userdel -r $USER > /dev/null 2>&1
    1 k; @2 l) h8 L9 q) R# l

  471. 4 D# e) Z5 d, }3 h8 B( I
  472.       Log "Creating user: $USER" 1
    : [0 N' }" P- o) R
  473.       useradd -m -d /home/$USER $USER > /dev/null 2>&1
    ' O2 r/ N- Q8 k6 Q8 E

  474. # g, W* l& }1 i" V( d, J* m
  475.       if [ $? -ne 0 ]; then7 g8 m( A# X9 \4 E- N; p4 q
  476.         Log "Error: Failed to create the specified user!" 1+ c9 e% m0 @* Q. f$ A# v+ q! G
  477.         exit 1
    - M, s2 C+ a3 E/ `/ {$ p8 ~  I
  478.       fi
    + w, F+ y9 l# |2 A7 y

  479. 1 X' p4 C: L" n6 O+ @, c6 w6 c
  480.           usermod -L $USER > /dev/null 2>&1
    " M) y! ]( K7 O  ^/ K* G! i
  481.     fi
    ( R; w8 \/ t: {. H
  482.   fi
    0 D0 e# @( H6 b) _: I$ e, C

  483. 7 e3 N5 e1 Y: h' ~" N- w
  484.   ROOTPATH="/home/"$USER
    , l6 Y0 U9 n7 E, O; q7 w
  485.   Log "User: $USER" 0
    + h. a8 H: @6 `
  486. }; I: ~- _6 d# R# f: c+ k
  487. 4 ~0 y+ |& Z3 c4 ~. C
  488. # Function to get the source and installation paths
    % P0 u' }' [' N' ~- K
  489. function GetPaths()& @' z/ y( `4 o/ V! I! A0 o/ _
  490. {
    8 D0 e. M/ a2 k
  491.   local TMPPATH="$HOME"/ ~1 Z: |* `6 h' P4 |4 W
  492. # c( H! r( F$ d  ]
  493.   # Set the source path* `- s8 b4 g% @3 n
  494.   TMPPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Source-Code Path" \
    - D" o' F% O" l; ]. m3 ^* L
  495.     --inputbox "Default: $SRCPATH" 8 60 3>&2 2>&1 1>&3)- ^+ m' u: {) Y9 P1 j1 q

  496. * h: M$ I, I8 z9 q5 `+ {
  497.   # Exit if cancelled/ Q" R% T" Q  ~! R3 `3 U8 Y
  498.   if [ $? -ne 0 ]; then
    7 Y' H7 _5 Q/ t: N: v( N2 |
  499.     Log "Source path selection was cancelled. No changes have been made to your system." 1: o4 I0 m2 j8 @/ g& W" ~
  500.     exit 0
    0 J; {6 Q# ~' V: X" J% @. Y5 X
  501.   fi
    ! v4 A! s% Q3 x! h% r0 }& b$ ]
  502. 7 E2 J$ f6 L. E9 n, j. y
  503.   # Change the path only if it was modified
    $ L* I0 o6 T5 [5 R8 n
  504.   if [ ! -z "$TMPPATH" ]; then) U# `$ N; D# P  ~% t- R+ K1 Q
  505.     SRCPATH="$TMPPATH"
    " X# N" S9 e8 C- x* a
  506.   fi- ?5 a3 n6 [! t1 Y* G# N9 b
  507. , e) _6 ~- `0 V2 |9 y) p
  508.   # Validate source path
    4 I. g/ h" W" E- S0 l. a/ y
  509.   if [ ! -d "$SRCPATH" ]; then, P, b, U1 D, S. d
  510.     $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path does not exist" \9 P9 }6 I: h# l; ~
  511.       --yesno "Would you like to create the directory "$SRCPATH"?" 8 60# x/ J- T7 [  ?
  512. 0 A% @) v3 u: N0 ~$ K! W2 j# E
  513.     if [ $? -eq 0 ]; then' n8 P+ W4 F) x( X; E
  514.       Log "Creating source path: $SRCPATH" 1
    9 v# l% T% W# V; A) Z3 E* N, `
  515.       mkdir -p "$SRCPATH" > /dev/null 2>&1$ g  ~! A$ U# L- V5 \5 G7 J
  516. , F/ K/ L  g# P; O
  517.       # Check to see if the directory was created; E9 i2 b' M4 M3 X( ~) D
  518.       if [ $? -ne 0 ]; then& H$ E0 U) o% I' m  e- J
  519.         Log "Error: Failed to create the specified source-code directory!" 1
    ) @, A; g% @$ P; X+ m
  520.         exit 1
    5 s6 U+ s; K/ E* y
  521.       fi
    2 A2 K0 W: y0 E2 L3 k9 e
  522.     else* J+ M& b4 k8 n) X# D
  523.       Log "Source path creation cancelled. No modifications have been made to your system." 18 z" w. s. X- ~
  524.       exit 0$ f$ Y) P) \) w4 r: y5 m. I
  525.     fi3 w% O! C8 B: s; W1 ?& }' M
  526.   else* f& c" h5 Q/ `; M4 J: U
  527.     # Check for old sources
    7 K2 c3 }# o; K! [: v$ {. N
  528.     if [ -d "$SRCPATH/server" ] || [ -d "$SRCPATH/database" ]; then/ T1 l( g" @4 ~* \
  529.       # Ask to remove the old sources- V5 }7 }1 D3 {2 \" k1 U, u
  530.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path already exists" \
    / P2 D1 @. P% I" n: o4 X
  531.         --yesno "Would you like to remove the old sources? (Answer yes if you are cloning MaNGOS)" 9 60
    ' f" L8 x2 n3 @4 t6 {0 G5 ^

  532. 7 T3 v: K5 [9 G9 V: r, z
  533.       # Remove the old sources if requested
    2 H3 G5 U% ?! @
  534.       if [ $? -eq 0 ]; then
    5 O8 B! m1 E7 C
  535.         Log "Removing old sources from: $SRCPATH/*" 1
    ) Q1 a/ `5 m" x6 w
  536.         rm -rf $SRCPATH/*# |- A1 }6 i- O9 E/ x

  537. + b! E+ H4 Y. ]" L3 u+ n# h
  538.         # Check for removal failure
    ; M$ f* p! }8 E. g9 ?
  539.         if [ $? -ne 0 ]; then
    7 `8 v3 q* ^" S2 E+ N- @/ N- ^0 }  t
  540.           Log "Error: Failed to remove old sources!" 1
    : J/ c0 s# a+ v/ f+ R4 K' \
  541.           exit 1- b0 s9 t7 q4 o* w. T( p8 }; w' m) P
  542.         fi
    ' b% \4 l* ?' F# u0 H9 X+ v
  543.       fi
    6 ~  \+ T. v4 K, y
  544.     fi5 n  y# y2 B" n' X$ ?4 a
  545.   fi  y3 B  m. b; ]
  546. / ]2 \; A9 O2 ^/ W- ?4 `  B
  547.   # Set the installation path: Q5 F0 w: a* z7 Q9 j8 u! i
  548.   TMPPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Installation Path" \+ B* Y# \$ W5 ?2 }
  549.     --inputbox "Default: $INSTPATH" 8 60 3>&2 2>&1 1>&3)
    0 K4 z2 {9 h; e) G4 c( F, o
  550. 2 n  f8 P" j0 ?1 e' K# C6 ^
  551.   # Exit if cancelled
    ; G- a) u9 |# J# ~6 D/ d  y7 x
  552.   if [ $? -ne 0 ]; then
    ( L. G# ~8 I; N  p
  553.     Log "Install path selection cancelled. Only the source path has been created." 1$ o" t0 z* E# ~7 ^' @; Y. m3 d1 D: s
  554.     exit 0
    6 e6 @7 V4 t( v2 l$ o
  555.   fi
    % o2 ?8 ^2 a" V+ x' @4 G

  556. - F# H: N( ~+ A! @
  557.   # Change the path only if it was modified0 p3 h4 ?" u$ C6 m8 T1 ?
  558.   if [ ! -z "$TMPPATH" ]; then; D) X( ?" t$ X/ N2 U' c+ w. ~( g! m
  559.     INSTPATH="$TMPPATH": ~5 S+ i2 {4 k
  560.   fi
    ; h( H) y6 d  [, y) \
  561. ' l2 h6 Y, e7 ]! k
  562.   # Validate install path
    + @- Q( V; |% M/ v3 n5 s
  563.   if [ ! -d "$INSTPATH" ]; then
    $ a9 O8 x( C" U% }; l
  564.     $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path does not exist" \2 E. [; Q$ a+ o* q. g
  565.       --yesno "Would you like to create the directory "$INSTPATH"?" 8 60
    9 w, L5 D: z  ?- }) a

  566. , _. R/ P) O' M) e/ W
  567.     if [ $? -eq 0 ];then' ?6 a  v$ d( K  ]- D. [
  568.       Log "Creating install path: $INSTPATH" 1
    3 Q9 d( d6 x. }. w  ?. E, o
  569.       mkdir -p "$INSTPATH" > /dev/null 2>&1
    ' n. h- ]5 H  b% [0 w+ w3 ]: l

  570. 8 U5 C! b6 T, K) h) N
  571.       # Check to see if the directory was created
    6 S% P# t0 H( F, g
  572.       if [ $? -ne 0 ]; then
    ; o- I3 F3 A. ]+ H8 e
  573.         Log "Error: Failed to create the specified installation directory!" 1
    ' d; @# D5 U- q6 y+ `! o: u0 }* x
  574.         exit 1; {6 p/ W$ `7 r2 p4 _
  575.       fi. Z' Y" k% k) T9 E: {
  576.     else
    7 y/ \( A8 ]  _  y
  577.       Log "Install path creation cancelled. Only the source path has been created."
    ' E" W  _0 H& P" x3 p$ C0 g: H  ]
  578.       exit 0
    0 {$ g; i( V! E1 I
  579.     fi
    3 ^9 |4 q) T+ A0 A
  580.   else
    : P! C0 ?0 ?. [6 ^& O5 X2 `
  581.     # Check for an old installation) U' w# R/ S, C  a% S) s; |' g/ j
  582.     if [ -d "$INSTPATH/bin" ] || [ -d "$INSTPATH/lib" ] || [ -d "$INSTPATH/include" ]; then3 Q; q. a1 C* S8 j9 b

  583. ( |2 `2 d8 v4 s! E
  584.       # Ask to remove the old installation( T) Z- y" s9 J4 D" X1 j) K
  585.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path already exists" \
    6 e6 c9 A' v4 l$ y9 t
  586.         --yesno "Would you like to uninstall the current version of MaNGOS first?" 0 09 l( R5 F) O7 y) p7 q
  587. 2 z$ x  ~9 y( ?7 U
  588.       # Check the user's response
    4 z% a4 \; H1 g, a
  589.       if [ $? -eq 0 ]; then
    2 |$ f+ y3 a. p
  590.         Log "Removing old MaNGOS installation..." 1
    ! M6 M; h, @3 a" k' H

  591. + ~# Q4 O( h9 {, ]' s: ^
  592.         # Clean up the binaries
    ( y  Z' z2 p" H$ z* V* R
  593.         if [ -d "$INSTPATH/bin" ]; then
    % z0 j0 q) f" K" Y" J: r8 _- F4 _7 V
  594.           rm -rf $INSTPATH/bin6 l' R5 J- h( V9 E- D
  595.         fi
    3 V- ^7 }3 S9 p3 Y' _4 D! ~6 ?

  596. ; z+ ^( @# n0 i/ u  P! d. C
  597.         # Clean up the old includes
    0 @! P; r" ~% a6 i1 x3 G; ^$ _
  598.         if [ -d "$INSTPATH/include" ]; then8 b2 c1 n% @8 ~# M8 n
  599.           rm -rf $INSTPATH/include9 x, l( \" y( v0 V9 F
  600.         fi# ~) i: B- S( y4 b

  601. ' s. i/ n* ^* @& ?0 c6 @# N
  602.         # Clean up the library files
    ! Z' P$ y' G, O  J* P
  603.         if [ -d "$INSTPATH/lib" ]; then' e3 M' M! K9 y, G% w' H6 u
  604.           rm -rf $INSTPATH/lib
      j2 W( m2 ?' t* V
  605.         fi
    ; q  N+ i, s1 ]1 P1 _
  606.   S5 V" }' \( p/ d7 v
  607.         # Clean up the old logs
    8 h. v9 u) D1 A6 L
  608.         if [ -d "$INSTPATH/logs" ]; then; T& o, |/ b; P( v
  609.           rm -rf $INSTPATH/logs/*
    , Z* D7 }  t$ H
  610.         fi
    . n2 R9 a9 ~) ~& v1 n- {+ t
  611.       fi
    0 a4 ?- M' O& U8 y( ~
  612.     fi
    # [6 F% x; ~2 b
  613.   fi/ p% O+ ~& F7 s. k2 K
  614. . c/ a' A5 v; d8 _) o, }  i2 E; v
  615.   # Log the settings8 L% g( r0 T3 ?. ?" Q0 p
  616.   Log "Install path: $INSTPATH" 0
    0 A9 x$ }9 \( g% g& E
  617.   Log "Source path: $SRCPATH" 0
    ( }. b# M: s* N: n( ?6 t3 D
  618. }
    & r& |- a7 {' G7 V" b# B
  619. 2 t% {4 p5 W2 w+ h7 q: T1 H' E

  620. : x! ~( ]; m" e% z! d! {
  621. # \/ J3 l/ A( l6 C- S1 I' i) a
  622. # Function to clone or update sources
    " N. H+ `0 y3 U& q
  623. function GetMangos()  w1 w# r2 I& }; Y% b+ Q
  624. {
    4 U) S; w9 T( i/ \. a
  625.   local CLONE="0"$ I  D: Q/ J' [
  626.   local BRANCH=""; m8 ?# _2 u8 [2 N; |
  627. " W* a$ D. A6 l' s5 E
  628.   CLONE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Clone or update MaNGOS" \' H, Z* J6 G& R" V0 _/ P
  629.     --menu "Would you like to clone, update, or continue?" 0 0 3 \
    1 f9 `- U. |) E& J3 l, F5 }# u
  630.     0 "Clone a fresh copy of MaNGOS" \: ^4 d4 D  q/ C
  631.     1 "Update your existing copy of MaNGOS" \
    . \2 {0 V2 T. ]4 E: U& t
  632.     2 "Use existing copy" \5 G. @- h- U8 o  c
  633.     3>&2 2>&1 1>&3)* P' M2 Z7 ]* F  C* {

  634. 2 [' f& Z8 r1 S: f' w
  635.   # Exit if cancelled
    % ?- v7 c' j% `# q6 [
  636.   if [ $? -ne 0 ]; then
    8 x6 P* O& f, g
  637.     Log "Source cloning cancelled. Only the install and source paths have been created." 1
    ) b; u4 a0 q( c; z* r3 v
  638.     exit 0  X$ D0 i+ `' t* I
  639.   fi  E- y* u$ O: e! `2 _

  640. 4 z, z# ?. c6 |0 i
  641.   # Clone from scratch if selected1 U, b% ~  M. m; Q/ l- t) [  t
  642.   if [[ $CLONE = *0* ]]; then. c0 D/ }) g; q; m; I
  643.     # Pull a different branch?
    / {  i3 W3 I2 n& J/ I% L
  644.     case "$VERSION" in
    / s" T6 F6 M5 P
  645.       0)
    ' ?, w1 h, y, F0 \
  646.         releases=$(curl -s 'https://api.github.com/repos/mangoszero/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')
    5 t6 \6 }9 X# v% v- c& X" S& B
  647.         ;;
    9 U# R1 D  n* p! d
  648.       1)
    2 i% q: r8 J8 _3 X0 E4 M
  649.         releases=$(curl -s 'https://api.github.com/repos/mangosone/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')& ]6 H" Z; N  B4 b, M' L# M
  650.         ;;8 k+ T6 d( Y$ D1 v
  651.       2)
    ' o/ Z+ F9 B! C# A  m8 l. ]6 w4 G
  652.         releases=$(curl -s 'https://api.github.com/repos/mangostwo/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')& v7 U2 z/ ^1 @6 L) L' v1 b8 K
  653.         ;;
    ) _- F0 k3 l# M6 ~0 p
  654.       3)
    1 H/ @# u$ Y2 ], Z2 ?
  655.         releases=$(curl -s 'https://api.github.com/repos/mangosthree/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')) a8 S( g3 `! k
  656.         ;;- _' w% B4 T- J4 Y
  657.       4)
    2 p# d6 `" \! Y2 _  ^' K, _& S
  658.         releases=$(curl -s 'https://api.github.com/repos/mangosfour/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')
    * o$ B& J6 d/ }
  659.         ;;
    ! Q4 V3 z3 L8 W: A* f2 R
  660.       *)
    0 b0 R1 N. ]# m- F; Q8 \
  661.         Log "Error: Unknown version to select branch" 1, ?. O' L+ b) [" t$ r9 K
  662.         ;;1 _/ V# @: G1 F0 x2 X2 G
  663.     esac
    $ K7 K! T6 k6 {  U

  664. $ [3 X' V" t5 n! N4 S
  665.     COUNTER=1
    . t0 e* H5 d' y2 `, \: ]
  666.     RADIOLIST=""  # variable where we will keep the list entries for radiolist dialog
    3 g' h+ \3 G' _$ R
  667.     for i in $releases; do3 [1 q, s  \9 {& o3 _2 v3 Y
  668.       if [ $COUNTER -eq 1 ]; then$ }# y# f* f3 c2 D
  669.         RADIOLIST="$RADIOLIST $COUNTER $i on "
    ( E) ?" l' [  U# ?+ E; l' Z
  670.         BRANCH=$i9 g! |0 Y5 M3 a8 L3 _) J  V5 Y
  671.       else
    + E1 @  q* ^2 R* k
  672.         RADIOLIST="$RADIOLIST $COUNTER $i off "/ R* f1 x" u7 ]4 ~) i  T
  673.       fi
    ' \1 V, L" O& V8 t, _( C
  674.       let COUNTER=COUNTER+1$ C& k$ o2 Y6 T! @+ ^
  675.     done
    1 E4 T$ e1 p5 v- E* v$ p

  676. + ]2 v2 E6 |8 m* H& F4 t
  677.     TMPBRANCH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Branch" \
    ! z- M; V1 S) {( g( N
  678.       --radiolist "Default: $BRANCH" 0 0 $COUNTER \
    & V& M4 t4 @5 ?
  679.       $RADIOLIST \$ z+ }7 N! P: _
  680.       3>&2 2>&1 1>&3)
    ! B, j# p& W; ~# D
  681. # T9 r5 S2 {$ d1 I4 ~
  682.     # Exit if cancelled" m1 t# ]0 U4 c
  683.     if [ $? -ne 0 ]; then$ S5 y+ O4 q) V- c
  684.       Log "Branch selection cancelled. Only the install and source paths have been created." 1( `: M( Q% O% K3 j
  685.       exit 0
    6 D6 g. V- ?! G( J- y6 o) i
  686.     fi
    6 l+ t; H0 E- i0 _/ Y  ^6 s
  687. 3 p. o* w( H0 @8 ~( k
  688.     BRANCH=$(echo $releases | awk '{print $'$TMPBRANCH'}')3 g# B- [, @2 W* |7 N+ `6 L( h
  689. 6 A4 P+ h% j- [. E+ E5 ]+ p
  690.     # Set the branch5 \, C$ _: Z" `$ I+ ^# H! {- W
  691.     if [ -z "$BRANCH" ]; then& m0 G4 R9 Z4 Q, Q( c9 S1 h" X
  692.       BRANCH="$releases | awk '{print $1}'"
    0 p( ]; D; `# ?) t. T  g
  693.     fi
    : K( K( M) u  M5 ~( N

  694. # Z5 T6 \+ e! g% Y! A4 j0 R# x
  695.     # Clone the selected version3 {! y& L* p8 j' S
  696.     case "$VERSION" in6 v8 P3 ^  [; b/ K  q3 ~& k9 ^/ _
  697.       0)& [3 X9 _6 }7 i8 L1 X7 l" f  p9 g
  698.         Log "Cloning Zero branch: $BRANCH" 19 j/ X2 c& V4 n% G9 J% D
  699.         git clone http://github.com/mangoszero/server.git "$SRCPATH/server" -b $BRANCH --recursive
    , G3 Y2 f/ @" ^) N
  700.         git clone http://github.com/mangoszero/database.git "$SRCPATH/database" -b $BRANCH --recursive
    , |7 ?: c& p& W5 l; c  C$ i- l
  701.         ;;' q+ p( k6 j# l8 e  S

  702. ! e4 H+ ]4 c+ m3 h' B0 j
  703.       1)
    2 l: L- Y5 j7 Z. V* g# I, p# S
  704.         Log "Cloning One branch: $BRANCH" 1
    5 V/ y2 H/ _1 ~4 ~5 z
  705.         git clone http://github.com/mangosone/server.git "$SRCPATH/server" -b $BRANCH --recursive: \6 a3 ~* Y2 j9 E9 z4 y' f
  706.         git clone http://github.com/mangosone/database.git "$SRCPATH/database" -b $BRANCH --recursive3 x0 W6 |* Y' x: s* L, D
  707.         ;;
    2 V% f6 {, Y* z7 Y& Z$ m

  708. 2 x! I, q' u, P* T/ @' ?3 P
  709.       2)' J1 c( _% }1 g* B+ P. L: N
  710.         Log "Cloning Two branch: $BRANCH" 1/ s( g4 n; ~3 D9 d
  711.         git clone http://github.com/mangostwo/server.git "$SRCPATH/server" -b $BRANCH --recursive- b3 @6 F+ }8 x- N! x6 l
  712.         git clone http://github.com/mangostwo/database.git "$SRCPATH/database" -b $BRANCH --recursive4 `4 g3 e4 [. a5 z4 C8 Y
  713.         ;;5 a, L$ C$ c8 K" g+ Z
  714. 7 E" z7 y3 i$ C9 I
  715.       3)
    : E7 |. N4 U5 ]  D# c: W
  716.         Log "Cloning Three branch: $BRANCH" 1% ], h  r; g- |+ B/ F. M% U
  717.         git clone http://github.com/mangosthree/server.git "$SRCPATH/server" -b $BRANCH --recursive
    : {+ w, `8 P9 X8 a3 \- \! n9 y
  718.         git clone http://github.com/mangosthree/database.git "$SRCPATH/database" -b $BRANCH --recursive
      k+ d& P% u$ h' P' Y3 x( p
  719.         ;;4 T; p* X. B0 C! L& C
  720. : E, c6 A6 P1 V+ C: r2 Z2 H2 _
  721.       4)( ~' `" [6 n' U5 n- N! w8 l9 N
  722.         Log "Cloning Four branch: $BRANCH" 14 h& C. N, K6 j0 p2 ?
  723.         git clone http://github.com/mangosfour/server.git "$SRCPATH/server" -b $BRANCH --recursive
    1 R) E. G+ s/ B0 Y; }8 e
  724.         git clone http://github.com/mangosfour/database.git "$SRCPATH/database" -b $BRANCH --recursive
    . w2 j" i6 r2 p$ n& [+ T
  725.         ;;  p2 u2 {$ w4 r: c* j
  726. ; j8 B9 k+ p9 B$ k& F
  727.       *)
    + f5 j% p- b# g3 R8 X0 Y5 ]8 Y7 h4 j
  728.         Log "Error: Unknown release selected for cloning!" 1) c9 X) a3 Q6 U5 D$ N2 m  b
  729.         exit 1/ ?, t( r1 n$ Z* `2 z8 d  A) L6 l
  730.         ;;% v% i% r. Y( E- y+ k
  731.     esac
    - w( x" T; `$ z2 E0 z4 V5 E

  732. 3 l! I# {+ Q6 O* X$ D8 @
  733.     # Log success/ L/ }4 u: j; G# B8 z) m
  734.     Log "Cloned the selected repository!" 1
    9 m0 U6 ~2 A( |3 |- R# x4 R
  735.   fi
    . |( A0 ^  y# c2 F( Z1 e! m

  736. 2 h! B; u* N7 H3 a
  737.   # Update the local repositories if selected4 D) G/ X" x8 }3 F% s2 k
  738.   if [[ $CLONE = *1* ]]; then) ^; o$ x8 q$ i! X
  739.     Log "Updating your local repository..." 1
    : e& c2 A. s" q

  740. 7 b( N' ~4 R% x4 \4 H) R
  741.     # Update the core sources
    - h; N! ?: S2 ]# X
  742.     cd "$SRCPATH/server"
    ( ~$ K) P" G1 i" N; H; E5 @
  743.     git pull. u2 s0 n  e( k: T: {+ T
  744. 1 ^" P( g- A" X4 m# o& |3 f
  745.     # Now update the database sources
    & S9 E' `0 R9 [
  746.     cd "$SRCPATH/database"/ g* @5 [% a( e
  747.     git pull
    : `" E) v% j' j# M$ V# a% _- [

  748. 9 p$ Z4 [- |8 T
  749.     # Log success, U9 Y+ T# Q1 |5 _& H( [: `
  750.     Log "Updated the local respository!" 12 u$ Z  N6 B/ {9 u3 q% O5 |0 \. v
  751.   fi8 K+ M, U% y6 p
  752. ! {' c& r0 p2 l& s7 ~/ E0 N
  753.   # use existing repository* M4 I2 H  T3 O" C+ p+ |
  754.   if [[ $CLONE = *2* ]]; then
    3 T4 l$ d& f0 |' P; w
  755.     Log "Using existing local repository" 1) B% F' x2 \% U
  756.   fi
    7 {4 t& Q) n7 T. S% W
  757. }; g' v3 p% y' |; k
  758. , R8 L1 O! y& ^7 F5 i2 P+ h
  759. & J3 q$ X) K- [2 q* k+ c8 }

  760. 6 R) [3 j' F0 l0 p" v/ }1 e! L
  761. # Function to set the build options
    7 a4 D1 W# X  p+ Q
  762. function GetBuildOptions()6 E( y0 Q) F5 Y1 h2 P6 @# @0 F/ _
  763. {
    . ^" D4 {- f. T2 Y$ g
  764.   # Select build options4 g$ s- p7 k8 L# l
  765.   OPTIONS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" \! o. H2 p0 a- [1 |% R$ B
  766.     --title "Build Options" \
      o; @" ]8 `3 o$ i8 m4 h
  767.     --checklist "Please select your build options" 0 56 7 \
    ) C4 }! W% P! m: I) l4 b: b* [
  768.     1 "Enable Debug" Off \
    % F, |! W" ]# E9 ~
  769.     2 "Use Standard Malloc" On \
    ) C- `' D5 x8 H, B* W' |  y' c" z0 }
  770.     3 "Use External ACE Libraries" On \1 t# I' G  I$ g$ n9 a* W% W8 I
  771.     4 "Use PostgreSQL Instead Of MySQL/MariaDB" Off \  @* L. H3 ]" |: u; u2 U  f& ?9 W
  772.     5 "Build Client Tools" On \
    4 x3 g+ s1 M- |, i. U* s4 i1 c; v: P/ c
  773.     6 "Use SD3" On \% Z. }/ K$ M8 O% I( r/ l0 T
  774.     7 "Use Eluna" On \3 H/ F- V. n5 i- b
  775.     8 "Use SOAP" Off \+ Z& M+ E2 B* U" }3 R2 F0 B9 K
  776.     9 "Use Player Bots AI" Off \$ S% d3 b: J: W0 y; \7 `
  777.     3>&2 2>&1 1>&3)5 j* E9 \$ S5 a

  778. % O3 Q! f% Q4 |( y; @$ f. B; ~
  779.   if [ $? -ne 0 ]; then
    $ |2 J) w' L# h+ o- ~$ o2 Z
  780.     Log "Build option selection cancelled. MaNGOS sources have been cloned." 1
    - k! R& U' s" d5 F: I
  781.     return 0
    $ p- T5 U) E5 H
  782.   fi
    $ s# S3 H* F+ Q

  783. - E# H1 c- a7 k9 ~& _; y9 V
  784.   # See if debug was selected
    + u9 j5 R" |" l  k! q( N
  785.   if [[ $OPTIONS == *1* ]]; then+ R6 n& L, E0 M* M
  786.     P_DEBUG="1"
    ; ~. E  w" h1 c. h4 b% E6 Y& W3 b$ }4 h
  787.   else
    / U# W, `- d( u0 ]
  788.     P_DEBUG="0"
    # O, q1 N3 d" `$ y. ?- q
  789.   fi
    0 W) f. R2 x( N
  790. " g; F5 w. t1 ~9 d6 v/ B
  791.   # See if standard malloc was selected
    % Y! t7 T6 }2 P( a2 u" j
  792.   if [[ $OPTIONS == *2* ]]; then
    / m+ e5 z/ \8 y4 x: p2 |9 o2 z% U$ F
  793.     P_STD_MALLOC="1"
    " Y0 r3 `2 }& u; {
  794.   else8 W+ _8 h% ^! {/ Z" Y* W3 R( b& U
  795.     P_STD_MALLOC="0"
    2 p" h* Y7 Q6 y7 D6 I4 l& [$ k
  796.   fi2 O3 i- _" n# q% c

  797. 8 w: K9 g! y, N3 J0 G) ~" J
  798.   # See if external ACE was selected
    ! X8 b$ x3 M( e/ L; Z3 J' R9 R
  799.   if [[ $OPTIONS == *3* ]]; then
    : J! P: D4 o1 V
  800.     P_ACE_EXTERNAL="1"7 d+ Y5 W8 {2 {  h8 H+ s/ M
  801.   else
    % y7 `/ B5 Z* j) [+ X7 g) g5 l+ |  O
  802.     P_ACE_EXTERNAL="0"
    6 [1 q# N# p- ~" \+ I
  803.   fi
    " j( O# z6 F% I7 M5 ~* I
  804. 1 a$ h& {  L: ^* X4 b
  805.   # See if PostgreSQL was selected
    5 m$ S- H* V& ]9 h5 m5 k2 y' f
  806.   if [[ $OPTIONS == *4* ]]; then/ U4 K  t3 T  v
  807.     P_PGRESQL="1"
    : x! s& ~9 O3 \9 e1 ?6 ]+ e3 I  s; `1 ^
  808.   else
    & [" x. r) U3 c" D' a9 A/ i  G$ z
  809.     P_PGRESQL="0"" i4 e+ @: b. k, R2 l
  810.   fi
    9 R+ G4 `$ z! L2 H! p$ T

  811. ) L0 r0 j/ [2 |6 _! M: _5 ]
  812.   # See if the client tools were selected
    0 a- i# F- E5 ^
  813.   if [[ $OPTIONS == *5* ]]; then# P2 g8 O2 }! O' V. g6 G
  814.     P_TOOLS="1"
    , d; @) g5 U2 w3 Z' u+ a* N2 d
  815.   else
    . s# Y+ y# B7 R+ S) P0 B
  816.     P_TOOLS="0"
    ' k, m* f: j/ ?! f
  817.   fi9 O. Z0 l8 e2 W/ {+ c/ H

  818. * g' U- V! T( l8 @1 x  A* |
  819.   # See if SD3 will be used
      c) r. C9 K- ^# R/ b
  820.   if [[ $OPTIONS == *6* ]]; then+ ]) y  g8 w, R4 q
  821.     P_SD3="1"
    ) f! w, E1 v8 o, j6 Z6 v
  822.   else, [' r- @/ }: Q! I! ^
  823.     P_SD3="0", F3 m; o; d$ n! |- y
  824.   fi; p7 B( e/ R( U. i2 Q

  825. ' \3 O: m  \' u" K; a
  826.   # See if Eluna will be used
    & r% p4 ~' p% J. Z3 Q
  827.   if [[ $OPTIONS == *7* ]]; then$ N- h! w, g( _7 H) E
  828.     P_ELUNA="1", c1 D9 E* o2 V& \
  829.   else+ M7 s* _$ J- R4 D( h/ ?
  830.     P_ELUNA="0"
    6 f: D+ ^  K, t! {
  831.   fi
    % V7 G9 d5 d. ^1 [% v
  832. 1 c! G/ m" \' @) j9 [
  833.   # See if SOAP will be used& |% k! i# H- R& q$ M2 ?/ i
  834.   if [[ $OPTIONS == *8* ]]; then; j' {9 C1 q5 ?  l( q
  835.     P_SOAP="1") [9 A; J4 A' V$ b4 J
  836.   else
    8 Q3 h! F) V9 U: w3 g# ]7 H, C4 u
  837.     P_SOAP="0"( v: W3 X- `: ~; k
  838.   fi5 g7 n0 \! T* ~6 [# ^1 w

  839. + v8 I6 l/ y* o, Q: }8 u* C
  840.   if [[ $OPTIONS == *9* ]]; then
    4 h$ |9 b7 x" Q6 g1 P0 A0 O7 T
  841.     P_BOTS="1"5 W- N8 r( N2 }) O' {
  842.   else' S& k6 W3 V% b
  843.     P_BOTS="0"3 W; l3 [+ P# ^9 Y# [
  844.   fi2 e% H6 E3 i) e, m3 E. ^& Z

  845. 3 @; ^2 y2 `; p# B7 H0 l* ^1 o6 k
  846.   # Verify that at least one scripting library is enabled
    - _* Q' x* m: z
  847.   if [ $P_SD3 -eq 0 ] && [ $P_ELUNA -eq 0 ]; then. g6 [4 k% N6 m# u9 L
  848.     Log "Error: You must enable either SD3, Eluna, or both to build MaNGOS!" 1
    6 [- O/ P  z0 W; y
  849.     exit 1
    ) u# H5 w, @% _; T9 U, h
  850.   fi/ u8 L% {9 Q+ c% `
  851. }
    , L+ X5 l; a  l9 c$ W% O0 n
  852. 8 K% J- k1 y) S  }

  853. 8 f$ K6 z, P3 }7 v" l5 _
  854. 9 t3 d1 h3 \$ n# W. u% a) F' y
  855. # Function to build MaNGOS
    ' r! y6 Y7 b1 c
  856. function BuildMaNGOS()
    $ Y" T; Q" Q, U, P/ s$ P
  857. {- M" _. l! d- x+ m) a
  858.   # Last chance to cancel building
    6 o' P! ^+ v" Z6 e
  859.   $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Proceed to build MaNGOS" \
    ! j- U1 m. b# I2 Q; O7 Y" ?& r
  860.     --yesno "Are you sure you want to build MaNGOS?" 8 60  A2 C/ H* T! ^8 }
  861. ! v% o) }5 Y/ A  V
  862.   # Check the user's answer  ], |- `1 J# q9 i7 @2 \
  863.   if [ $? -ne 0 ]; then' A. W8 i) |+ P
  864.     Log "Cancelled by user. MaNGOS has been cloned but not built." 1" r) m$ d! w6 w4 a% x  H
  865.     exit 0
    3 F4 b$ z0 y5 \+ c
  866.   fi
    . O. X: C: p0 y
  867. : `- F: D$ E" g& ^1 |7 e9 y9 `+ l
  868.   # See if the build directory exists and clean up if possible' V, D% [6 z" K: m5 f: P% _
  869.   if [ -d "$SRCPATH/server/linux" ]; then
    9 K/ @2 N4 r0 f. G
  870.     # See if a makefile exists and clean up1 P+ Y/ v) j, Z) k
  871.     if [ -f $SRCPATH/server/linux/Makefile ]; then
    8 b7 q' n8 ]# ^* a1 ]
  872.       Log "Cleaning the old build..." 1
    8 D# w5 }: s, w
  873.       cd "$SRCPATH/server/linux"
    % U0 n5 i+ O! e( U9 ~
  874.       make clean
    : z+ y) d: H! P1 N! n4 ~7 o
  875.     fi
    ; ^% J2 V, M: A  i
  876.   fi$ D: R0 M! s( Y% I% M$ E

  877. 3 ^9 Q7 C; m" t3 r, v
  878.   # Attempt to create the build directory if it doesn't exist
    % r8 b5 B* a; `1 k  {3 ^. N1 a- ^' f
  879.   if [ ! -d "$SRCPATH/server/linux" ]; then
    8 t( w& i- e) ]$ L, y: O
  880.     mkdir "$SRCPATH/server/linux"$ J( \& s% H" n0 M. l! s$ @

  881. 1 v$ p# O  a% d  E5 u
  882.     # See if creation was successful/ P; P* g% I% ?* \8 Z- Y
  883.     if [ $? -ne 0 ]; then
    * o( g4 a5 ^" A) z' w0 D
  884.       Log "Error: Failed to create the build directory!" 1" {6 a. T& K8 Y/ Q
  885.       exit 1" H9 F; a0 u* s; I7 d' |. C  |
  886.     fi, u( N( I# j% T1 v% ^
  887.   fi) M$ M* B6 \0 v

  888. , g, W/ W( R: n
  889.   # Attempt to configure and build MaNGOS
    - o$ V' {5 v6 i8 Q6 j
  890.   Log "Building MaNGOS..." 04 k! s4 d1 H8 @% h! t: @- f+ @
  891.   cd "$SRCPATH/server/linux"
    9 F9 T* C# `/ c- Z. G9 d5 \( j" ~
  892.   # make sure we are using the cmake3
    ' d" |8 j# f! o* z: J2 p1 Z
  893.   UseCmake3
    5 w: n7 V5 r( O3 r- @/ ^
  894.   $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"
    ! U# \; m/ N2 a3 [: p$ L4 R3 e* G' n
  895.   make  [1 X' I9 j5 P2 k5 v

  896. 0 w  J8 _7 Q- {9 w# C: [
  897.   # Check for an error
    . S" u& B+ o2 Z* h) K9 [# p
  898.   if [ $? -ne 0 ]; then
    % c" x7 J& W6 L# M" `% A
  899.     Log "There was an error building MaNGOS!" 15 J3 }( p4 j8 l" u  p! h5 [: B* m
  900.     exit 13 g" E5 z. q5 x: H
  901.   fi1 y3 o" c3 Y% ?; V
  902. " n* L. X/ w  K: ]8 X
  903.   # Log success
    - V* X3 w, k& |
  904.   Log "MaNGOS has been built!" 0: K7 h0 i7 V4 S) q2 Z
  905. }
    ! {- z* R1 C  M! ~7 A( Q

  906. 5 z% \9 O% W! G  `$ P

  907. 9 o' `+ E; J$ Z4 q% t* }1 Z7 A# S

  908. + q( X+ ^% d" v: C, [; e( x5 L
  909. # Function to install MaNGOS2 g0 A* r3 {5 [1 ]
  910. function InstallMaNGOS(): u) b+ q  {: ^6 \, J
  911. {* E) O- ~* p+ x+ g4 s
  912.   # Ask to install now
    & Z. N  ^1 x: W; S
  913.   $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install MaNGOS" \- I1 r# W" E4 Y
  914.     --yesno "Do you want to install MaNGOS now?" 8 0* e  _) B, k  Z. S

  915. 5 X# d3 g5 K% g$ v/ s# e
  916.   # Return if no- K& J2 f8 @9 b$ S5 [& Q% V
  917.   if [ $? -ne 0 ]; then# n0 }0 ?. n, _3 l" X; q
  918.     $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install MaNGOS" \! y5 R9 e' \3 a& P
  919.       --msgbox "You may install MaNGOS later by changing to:\n$SRCPATH/server/linux\nAnd running: make install" 24 60  i5 z* H& U5 Q$ {+ j
  920. " x9 H1 j3 k% T  j- l3 ~  g
  921.     Log "MaNGOS has not been installed after being built." 1, y  A+ D3 J! n; |8 Q
  922.     exit 0, \& j5 j! ^: Z" a* T/ t
  923.   fi4 M$ U! a" |" N- V
  924. * A. O' f9 i& a  O6 |
  925.   # Install MaNGOS2 n4 V7 d3 \/ m' v% O; ]" U
  926.   cd "$SRCPATH/server/linux"
    & m# f# F% G5 j
  927.   make install8 |0 C9 i$ k. X  B5 `: h

  928. " ~' H2 q  n" G
  929.   # Make sure the install succeeded0 S- v; [4 T. v8 a$ o, u3 I7 @' w
  930.   if [ $? -ne 0 ]; then
    # h- o9 M0 \! D
  931.     Log "There was an error installing MaNGOS!" 1( V* V! s  x9 M( C* i4 ?% b
  932.     exit 1
    2 n% v/ a  w5 c: X# E
  933.   fi
    6 Y# O# s. I, a; F
  934. }5 _9 g" _, A: v7 l7 `8 Y

  935. 0 P. i, x+ Y5 X" g
  936. # Function to apply database updates
    % v7 S. w' p; Y& o1 J9 x
  937. function UpdateDatabases()
    . c; |- F4 a; s
  938. {3 ?$ I$ |! T- f0 c
  939.   local DB_HOST="$1"
    1 G, G: P, l% P" E) X
  940.   local DB_TYPE="$2"9 k5 F4 [1 G- G: O/ Y$ w2 D0 z* H
  941.   local DB_COMMAND="$3"9 ~. y; B2 w+ O4 p! a+ K1 P
  942.   local DB_USER="$4"1 [2 Y3 J; i% f5 y" e
  943.   local DB_UPW="$5"4 C: K! B  Z3 D) W4 S5 A8 m
  944.   local DB_REALM="$6"
    ! d5 f9 k1 S( ?9 O' u* a
  945.   local DB_WORLD="$7"
    8 Y+ e* F8 L0 o! h
  946.   local DB_TOONS="$8"
    - F* S4 j/ B$ v1 M2 [
  947. ) w& r. j( Q6 b/ _' w) \  O
  948.   # Loop through the character files
    1 ]" `' K5 d2 Y7 c/ d2 _
  949.   for pFile in $(ls $SRCPATH/database/Character/Updates/$(ls -a $SRCPATH/database/Character/Updates/ | tail -1)/*.sql 2>>/dev/null); do' N' ?! N0 R) ?+ {
  950.     if [ ! -f "$pFile" ]; then
    . e2 y% g* o" \/ M% z5 h
  951.       continue
    ) F6 \9 A) `4 w9 H) L  D9 }
  952.     fi+ M. Z/ Q: _" _
  953.     # Attempt to apply the update. j, M. ^) n" s: @/ Z
  954.     $DB_COMMAND $DB_TOONS < "$pFile" > /dev/null 2>&1
    4 t3 m* k& T7 g* v6 [4 t
  955. ) V$ c  B8 z3 j# R% P( D
  956.     # Notify the user of which updates were and were not applied1 b8 C. V# S8 X: y6 a
  957.     if [ $? -ne 0 ]; then
    8 S  }. F* s% }9 a! H8 {/ `
  958.        Log "Database update "$pFile" was not applied!" 0
    % `  {$ |) j( h: Y
  959.        Log "Database update "$pFile" was not applied!" 10 F5 m3 n3 z, `
  960.     else
    2 R( p9 o/ U2 d" h" {& W4 I2 R
  961.        Log "Database update "$pFile" was successfully applied!" 0, H( o' J8 d6 }1 i: J( c# P7 R
  962.        Log "Database update "$pFile" was successfully applied!" 1
    % M' w8 D7 J6 @4 T
  963.     fi
    ; V8 X( r" Y  O2 n' i
  964.   done
    " W0 ^, b: a8 r) [

  965. ) I% a+ ~! |+ M5 J
  966.   # Loop through the realm files
    5 K! B) ]2 E$ D1 @7 k/ H8 X
  967.   for pFile in $(ls $SRCPATH/database/Realm/Updates/$(ls -a $SRCPATH/database/Realm/Updates/ | tail -1)/*.sql 2>>/dev/null); do  z" m6 j2 t5 ?, |8 _
  968.     if [ ! -f "$pFile" ]; then
    " U+ f% p% s" U  l; G# M
  969.       continue8 `& G7 }, G4 N! I6 e3 }9 O/ O5 H7 D2 m
  970.     fi
    . |4 s/ m( S7 \3 H
  971.     # Attempt to apply the update
    ; G: L/ S* i; b: I1 _
  972.     $DB_COMMAND $DB_REALM < "$pFile" > /dev/null 2>&1
    # ?9 S; k0 r/ I0 D3 E7 p
  973. 8 V. {; s) A1 ^+ h
  974.     # Notify the user of which updates were and were not applied* z/ y! P- h0 U7 F' p* F+ p2 R2 W
  975.     if [ $? -ne 0 ]; then
    8 [6 P- [. O3 m
  976.       Log "Database update "$pFile" was not applied!" 06 s3 b, g3 n$ F" I0 ]
  977.       Log "Database update "$pFile" was not applied!" 1
    * c. S8 B6 d' M+ E8 h* ?
  978.     else" T0 }8 C# D4 q' w" c" B: k
  979.       Log "Database update "$pFile" was successfully applied!" 0* x& l1 B. @1 d
  980.       Log "Database update "$pFile" was successfully applied!" 1" t3 w6 r: f6 [
  981.     fi
    # ?3 |( U) p' e  B  K- W7 t: d. ~
  982.   done
    4 G7 K4 w0 A( j" C0 Y9 k; k

  983. 4 x* N+ b, ?+ S: E7 }8 Q
  984.   # Loop through the world files/ L4 J; F3 m1 ~4 R9 `( P  Y
  985.   for pFile in $(ls $SRCPATH/database/World/Updates/$(ls -a $SRCPATH/database/World/Updates/ | tail -1)/*.sql 2>>/dev/null); do
    9 n. C- ~5 Q3 |6 O7 @% W$ v
  986.     if [ ! -f "$pFile" ]; then
    9 Z3 y1 d7 ]: k# V9 Y
  987.       continue
    2 w% @7 R6 F  d) H% Y# `( `7 K5 V4 j
  988.     fi& ]; j3 ?; U) T$ y
  989.     # Attempt to apply the update$ V( s+ {) B9 v& T3 Z
  990.     $DB_COMMAND $DB_WORLD < "$pFile" > /dev/null 2>&14 U7 m5 t3 g6 z- v
  991. ) L* F3 V6 p/ S% I) i
  992.     # Notify the user of which updates were and were not applied3 v- H) g. e0 e/ p
  993.     if [ $? -ne 0 ]; then
    6 v1 R/ o. m9 b5 p4 b! L9 }
  994.       Log "Database update "$pFile" was not applied!" 0' D, I$ Y$ `2 w" u3 y6 H# |9 k7 H
  995.       Log "Database update "$pFile" was not applied!" 1
    6 Z/ `6 L4 K$ o! W& w' ?
  996.     else3 J- x8 }4 J. p$ C
  997.       Log "Database update "$pFile" was successfully applied!" 0
    8 t% D4 O! z1 T" ]0 b  v
  998.       Log "Database update "$pFile" was successfully applied!" 1! O  z% i4 a0 }6 A
  999.     fi. ?; z1 [1 M, E& O( u; D8 k9 {- A0 [
  1000.   done
    $ g. E/ r0 t( h9 f
  1001. }
    ! L) ^! T- [0 t$ ~# G  v  p
  1002. - _6 {; _( y! z' j
  1003. # Function to install or reinstall the databases8 N# O! a7 `" K; B
  1004. function InstallDatabases()
    1 a3 `8 L# q% B" z2 _' g: H. y" r5 }
  1005. {
    5 `5 `- n, x; q
  1006.   local DB_HOST="$1"" i3 e  ]% F) Y& d
  1007.   local DB_TYPE="$2"
    ( R- l3 j" d' y. @4 w; a
  1008.   local DB_COMMAND="$3"& E8 D0 u0 r( m, O; d
  1009.   local DB_USER="$4"
    3 t! ~( y) H" c6 M/ @# C
  1010.   local DB_UPW="$5"  g& P0 Q* i( K7 s
  1011.   local DB_REALM="$6"# k" S" F( T3 P
  1012.   local DB_WORLD="$7"
    . u/ Z1 E4 F, ^$ A+ E7 z* `
  1013.   local DB_TOONS="$8"7 _1 \/ @+ M2 D( g, [. d* z

  1014. / s( a, o) b% ~5 p& Q$ g
  1015.   # First create the realm database structure, B2 @- K: T! L! W' Z
  1016.   $DB_COMMAND $DB_REALM < $SRCPATH/database/Realm/Setup/realmdLoadDB.sql- i$ ^8 J1 a. I( l5 U
  1017. & o" i2 B- B* V
  1018.   # Check for success
    ( t2 t2 ^5 x5 Z1 @" R6 _
  1019.   if [ $? -ne 0 ]; then; t9 p/ E4 v8 C- x- G' _0 ^! r: H3 U
  1020.     Log "There was an error creating the realm database!" 1
    5 U& c: B% N9 W
  1021.     return 1
    * f' L  C! U% a8 I
  1022.   else1 U3 ?9 P, |0 G; w
  1023.     Log "The realm database has been created!" 1
    7 P  I- A, r) O" ~. y
  1024.   fi, a3 n" n) p: L3 N( h

  1025. ! z. p8 R* C, ^" J( b
  1026.   # Now create the characters database structure
    ( A+ f9 B0 w' G
  1027.   $DB_COMMAND $DB_TOONS < $SRCPATH/database/Character/Setup/characterLoadDB.sql
    , B4 y0 q5 Y6 _2 H' C
  1028. - K$ ^2 S" }( ^2 c8 [' j- {) [  v
  1029.   # Check for success
    3 G' Z: W& O0 m4 G+ m( x. v
  1030.   if [ $? -ne 0 ]; then
    6 f- r6 y! V2 v* X- [2 q4 g( ^
  1031.     Log "There was an error creating the characters database!" 1/ a7 b& U' ?, Q. e* Q5 |
  1032.     return 1
    + y) E5 Q: j4 |& t) d# S
  1033.   else
    ! ?, z; x2 n. y; w$ [/ u/ I% t
  1034.     Log "The characters database has been created!" 1
    + u+ m( |: @% L8 X' q8 n' a9 ^
  1035.   fi
    ' E, [7 Y6 T! s9 W3 Z; e

  1036. $ l) r* ~1 M5 s; c% {0 t" s
  1037.   # Next create the world database structure" `- g% v: A4 M7 V3 u0 Y
  1038.   $DB_COMMAND $DB_WORLD < $SRCPATH/database/World/Setup/mangosdLoadDB.sql
      t2 B1 [* d( \& ~: ^0 z) s; ^5 ]

  1039. ( q; Q. l  C8 W! k% [
  1040.   # Check for success
    # z" U  G7 \$ Q* x* `) c
  1041.   if [ $? -ne 0 ]; then' [) N0 c( z4 j3 u' P% u7 M! {
  1042.     Log "There was an error creating the world database!" 1$ G* R% _0 k- `: L' v  p
  1043.     return 19 s* |; i8 O$ E# T
  1044.   else
    8 s4 K$ r7 ]: F& q/ x# y: G5 t0 d& F
  1045.     Log "The world database has been created!" 1
    $ d' H) i! n3 B; l+ ]* }6 }: k8 j
  1046.   fi% Y5 f* ]6 n. V) z, r
  1047. 9 ^( w% L& t; T
  1048.   # Finally, loop through and build the world database database
    + M! ~  k) C, v  c; v
  1049.   for fFile in $SRCPATH/database/World/Setup/FullDB/*.sql; do8 v9 {8 t- J4 \4 I' U
  1050.     # Attempt to execute the SQL file5 o4 C- ^9 K2 Z3 O% x: ^8 v
  1051.     $DB_COMMAND $DB_WORLD < $fFile' W4 [4 k: [- z) P( b
  1052. 3 f. b' l9 w. s) h. E2 Y. ]
  1053.     # Check for success
    " R5 i. E  N3 I8 _
  1054.     if [ $? -ne 0 ]; then
    * Q$ P* I  q0 ^6 `
  1055.       Log "There was an error processing "$fFile" during database creation!" 1
    % N8 M# T% z: M3 n! h4 s) Z
  1056.       return 1
    " o! P. m- T8 m/ t9 q0 L; @; m7 U) o9 m
  1057.     else
    ' f6 K$ t: c  ^* M" o% ~* M
  1058.       Log "The file "$fFile" was processed properly" 1
    4 D; c- F4 x. j$ T& l/ ~
  1059.     fi
    " U* p5 F9 ~! w6 h2 Z
  1060.   done6 C" K) }: V# L- j4 B
  1061. " K  s1 n/ u  G2 i' j
  1062.   # Now apply any updates
    ' w% J$ ^+ Y0 w7 c! O
  1063.   UpdateDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
    : b8 f) ^9 \/ U6 [/ |
  1064. }
    0 o. S8 g( E4 V5 _
  1065. * o- f- [- x! |
  1066. # Function to install or update the MySQL/MariaDB databases  `/ W) U7 g) ^# x% c
  1067. function HandleDatabases()
    3 X# x9 ?- |& t, w: a& f
  1068. {
    1 X; P5 p/ o' w8 |# J
  1069.   local DBMODE="0"6 J! X* E2 q# |; L# C+ |" _1 l' U
  1070.   local DB_TYPE="0"
    ( X3 T$ ]+ f( A5 R3 {5 f
  1071.   local DB_COMMAND=""; @$ i5 H3 q. N$ ~
  1072.   local DB_TMP="0"/ [$ C( F2 `1 v5 _1 F
  1073.   local DB_USER="mangos"* z% g8 O' [7 e. |2 _4 k( I
  1074.   local DB_UPW="mangos"
    # U- `. }4 I9 Z5 Z/ H' s9 o4 T
  1075.   local DB_HOST="localhost"
    ( A; J* V1 `3 [" ?3 m! S) ?
  1076.   local DB_PORT="3306"# j, |- Y' x/ P9 O1 x
  1077.   local DBSEL="3"( \; a$ X( F/ ~5 J8 U' o6 h2 a
  1078.   local DB_REALM="_realm"
    , j  C# g1 O7 I  `
  1079.   local DB_WORLD="_world"
    ' @% C* ^0 a% Q9 Y2 y3 ]& r
  1080.   local DB_TOONS="_characters"5 O) [4 p% }3 k5 k# W- v- {* P8 g

  1081. ) {4 E, L  O0 N3 B' S, X! i# N: B
  1082.   # Ask the user what to do here
    , B0 [: K. P9 r2 \& ^
  1083.   DBMODE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Operations" \
    + n& Z% `5 v+ q" o8 O
  1084.     --menu "What would you like to do?" 0 0 3 \
    - q) e" o: k( u& L: J* Y; U
  1085.     0 "Install clean databases" \
    % R5 D# C, G& c& r7 x% C
  1086.     1 "Update existing databases" \9 M' H: h5 }+ y( E4 O
  1087.     2 "Skip database work" \
    0 v/ ~. t. s3 q+ y
  1088.     3>&2 2>&1 1>&3)
    5 }9 H9 \) m. K* L" [/ `
  1089. ) y; f8 ]# y/ b& @; S( q9 Z% Q6 V
  1090.   # Exit if cancelled% a$ c2 v* k3 q* a7 c- q
  1091.   if [ $? -ne 0 ]; then7 B- T) @* M% m2 N7 f% u
  1092.     Log "Database operations cancelled. No modifications have been made to your databases." 1
    ( D( ?" I5 q$ A7 u
  1093.     return 0
    9 r4 @% \4 m/ n, c0 s4 P
  1094.   fi; ]! S* [# n6 \; A; Q( @3 A

  1095. 4 J" a7 }& ]* R& j3 g1 j* D
  1096.   # Exit if skipping
    , R: ~$ d" J" p' k- k+ ^
  1097.   if [ "$DBMODE" = "2" ]; then
    2 d" t$ m3 l0 A, S! O
  1098.     Log "Skipping database work. Nothing has been modified." 1
    0 d# Y7 X9 M3 ~, i
  1099.     return 0, A7 h( K) i6 K9 ?
  1100.   fi
    7 d9 U! G0 M0 Q/ C- ]% l

  1101. ; ?; V8 w, x, B( O
  1102.   # Ask the user the DB type
    ( L* d( z' m! B& ~5 S. @9 ^- y
  1103.   DB_TYPE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Type" \
    ; Y( e6 `/ q9 s9 F% ?( O9 Q9 @
  1104.     --menu "Which database are you using?" 0 0 3 \
    4 E) m6 f0 c7 l; f$ d# r8 x1 V4 Y7 H
  1105.     0 "MariaDB" \  r9 N- R$ W) z( p* _0 ^0 C
  1106.     1 "MySQL" \
      c( z& p$ `9 Q
  1107.     2 "PostgreSQL" \
    % u; J. x- B1 r: e
  1108.     3>&2 2>&1 1>&3)
    0 y$ e" Y- s, d4 ]5 c

  1109. % a  ~7 l! K8 b4 T3 ^. H
  1110.   # Exit if cancelled" c3 u/ Q+ F7 ]% j
  1111.   if [ $? -ne 0 ]; then
      I5 G$ m& k3 M
  1112.     Log "Database type selection cancelled. No modifications have been made to your databases." 1: P: X0 R3 X5 Q2 V0 j
  1113.     return 0
    : ~7 f6 s+ Q4 _
  1114.   fi
      Y: c0 @7 Q4 N( n

  1115. : |( ~* @3 E- R1 K" ?. X
  1116.   # Get the database hostname or IP address5 b* i1 @1 ?. S  ~
  1117.   DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Hostname Or IP Address" \
    " X. ~- n' H9 g* @; I
  1118.     --inputbox "Default: localhost" 0 0 3>&2 2>&1 1>&3)
    0 t: l$ c2 f( e4 H
  1119. & m" Y4 G4 M  X2 r7 |8 \
  1120.   # Exit if cancelled
    ' e+ Y) O9 u! ~  e/ V6 ~; a) d
  1121.   if [ $? -ne 0 ]; then9 U& h) e+ ~( f. N
  1122.     Log "DB host entry cancelled. No modifications have been made to your databases." 1. V7 Z0 C( _3 t- k; A, K
  1123.     return 0( q' g" p5 A) I9 }6 A
  1124.   fi
    & Q9 x9 K+ @$ G0 q$ G
  1125. . h' J; M4 t5 r" j  Z* n( ]
  1126.   # Set the hostname or IP address if one was specified
    3 _/ n$ N0 n8 _7 P, M$ z7 e
  1127.   if [ ! -z "$DB_TMP" ]; then  l$ R( S/ s1 e  Y' O  o* I
  1128.     DB_HOST="$DB_TMP"
    8 z& V9 C3 `0 E) V# p, Z$ [
  1129.   fi
    # O& r9 ^7 n7 o  ~

  1130. & z& D3 e$ Q. h9 _# E+ ?# i' L
  1131.   # Get the database port
    / p6 l9 z4 j2 Q7 i
  1132.   DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database port" \4 D" r5 Y5 j! H) m# T  G
  1133.     --inputbox "Default: 3306" 0 0 3>&2 2>&1 1>&3)0 F0 X. D) U3 x& H0 ^
  1134. 5 I1 P# }; a- O; f6 b+ Y' x
  1135.   # Exit if cancelled' q7 [+ q4 c7 t/ G4 {2 O+ ^5 E) f. A
  1136.   if [ $? -ne 0 ]; then% I7 w% U7 \9 w' Q" |
  1137.     Log "DB port entry cancelled. No modifications have been made to your databases." 1& A; V- }: w% _: W) ?
  1138.     return 0
    * ?: v( k5 t  R7 ^/ P
  1139.   fi
    6 u# _$ X& [6 l) e2 [

  1140. 2 k- H% [/ c' u: Z( w9 I
  1141.   # Set the port number if one was specified* [$ e6 W( O4 T) R, I
  1142.   if [ ! -z "$DB_TMP" ]; then3 E, D& z8 n5 F5 s; M" m& p
  1143.     DB_PORT="$DB_TMP", P& o+ H9 A# Q" m, w7 l- s
  1144.   fi
    7 \% X- a/ U9 A! }' B7 ?6 S

  1145. ; C7 t7 G9 E. @0 [, D# s
  1146.   # Get the database user username
    2 t% C. I$ Z, q* u9 A  q
  1147.   DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Username" \* {( l- S1 D$ g$ I
  1148.     --inputbox "Default: $DB_USER" 8 60 3>&2 2>&1 1>&3)
    4 w2 z5 g* k/ A4 w2 T+ w6 a
  1149. / B5 F5 v$ k1 c( t( @& r! w8 S3 I
  1150.   # Exit if cancelled
    " i/ [7 A" B* n
  1151.   if [ $? -ne 0 ]; then
    5 E# h, ^8 ?' o# B( j7 {
  1152.     Log "DB user name entry cancelled. No modifications have been made to your databases." 1" W. _2 }8 ^  K6 M+ S
  1153.     return 0
    ! m2 L) q" |% E$ v/ }, \& X$ a7 z
  1154.   fi
    7 u* @; o( J: c0 p$ g+ Y7 f
  1155. 8 C' e. f6 `- O9 x1 N3 T0 [% z
  1156.   # Set the user username if one was specified
    ) F; s1 C  D0 @+ B( I! j
  1157.   if [ ! -z "$DB_TMP" ]; then( T. |0 x  D7 K: I% r
  1158.     DB_USER="$DB_TMP"2 Y! {7 v6 }. y7 P+ m8 Y
  1159.   fi- V4 l8 y, t. L7 K: |

  1160.   k) [' Q) e. f4 X( {, a. n
  1161.   # Get the database user password
    0 p5 {3 z) V& h  ?5 z
  1162.   DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Password" \4 ~) H% S. I. s- h2 [/ h, O  J
  1163.     --passwordbox "Default: $DB_UPW" 8 60 3>&2 2>&1 1>&3)
    ) d: C) R& e% F$ S! d6 ?
  1164. % r7 a0 r! g9 l8 V) Z( p
  1165.   # Exit if cancelled, e5 l6 k4 x" y3 p7 A
  1166.   if [ $? -ne 0 ]; then  h: L! j( \  b4 A" P9 M
  1167.     Log "DB user PW entry cancelled. No modifications have been made to your databases." 1
    ( ^% z! M' C, s! _6 C; }
  1168.     return 0
    5 B- T% p3 b; d3 P" N9 x+ e4 \
  1169.   fi* Y1 q9 r& l0 _1 O( M" G
  1170. : z4 G4 U% I- H8 c3 z
  1171.   # Set the user password if one was specified! n- ?. @( X* f+ l' j/ v# c
  1172.   if [ ! -z "$DB_TMP" ]; then8 _1 B7 ^! F. q, A7 H
  1173.     DB_UPW="$DB_TMP"8 h& i3 r1 m* r+ [
  1174.   fi1 o4 y: ~, o7 D( d. d
  1175. * k" h* z  [6 [
  1176.   case "${DB_TYPE}" in) w7 u. v1 i6 d: k! a5 H, q# U
  1177.     "0")& M  d9 u  A" N; N& X
  1178.         DB_COMMAND="mysql -u ${DB_USER} -p${DB_UPW} "% `& k6 S5 D+ _" E) p' ?- ~5 N
  1179.         ;;
    - y! ~/ T$ }* D3 ^1 G+ H
  1180.     "1")% e$ c" d! y# Z" R/ |: ]. C
  1181.         printf "Confirm your MySQL password\t, "* S: _: ]1 b3 x: W* x/ ]
  1182.         mysql_config_editor set --login-path=local --host=$DB_HOST --port=$DB_PORT --user=$DB_USER --password --skip-warn/ Y2 t& Z+ v% {
  1183.         DB_COMMAND="mysql --login-path=local -q -s "0 v; i6 n' h( f: I8 i* O
  1184.         ;;) V5 O5 X8 d0 ?+ T9 [. n, s: Z
  1185.     "2")7 n/ L2 p5 N: N" H) ]" p, Y% m6 f
  1186.         Log "Currently not supported." 1
    " z( }) m+ v8 h5 [. [% J, y
  1187.         return 0
    + P9 w) b6 P% M# Q
  1188.         ;;
    & K/ M# C- ?; Z9 `& o. j8 y
  1189.   esac
    " t+ ^* A) `. h8 e& U. D

  1190. $ H* _: L! C2 I; g- z- ~# P- G
  1191.   # Setup database names based on release
    3 z. A+ i  B& Q& `0 {5 `+ y
  1192.   DB_REALM="$DB_PREFIX$DB_REALM"
    ) k2 l/ e* x' ]+ u) \- Z5 v
  1193.   DB_WORLD="$DB_PREFIX$DB_WORLD"- ^0 z4 b; u) O* F
  1194.   DB_TOONS="$DB_PREFIX$DB_TOONS"
    * E) ^6 C3 ]5 y  F& N
  1195. ) |* Z/ K9 X, n) L: t
  1196.   # Install fresh databases if requested  v! Z0 `0 H6 K$ @. w/ l4 f' |
  1197.   if [ "$DBMODE" = "0" ]; then
    9 f" `+ Z$ w4 Q& }' L( t  P' X- _
  1198.     # Ask which databases to install/reinstall4 m# S, A" _5 E+ H
  1199.     DBSEL=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Databases" \
    ! S* W$ n* k" B  F2 z: Y( [/ f
  1200.       --checklist "Select which databases should be (re)installed" 0 60 4 \6 w5 |) A+ B; r; \7 r
  1201.       0 "(Re)Install Realm Database" On \
    , T( C2 H! c% w/ k& O
  1202.       1 "(Re)Install World Database" On \
    ' }, }1 _) C" P+ R
  1203.       2 "(Re)Install Characters Database" On \9 x9 X9 e  a: T& b
  1204.       3 "Update the realmlist" On \' ?/ l% t. z1 C' z
  1205.       3>&2 2>&1 1>&3)
    ! O0 z- N+ F; D! ~2 X/ g+ k) Z4 ~! ~, Z" I
  1206. . f0 M- y* I3 A7 r$ Q9 z
  1207.     # Exit if cancelled
    ! _7 x, r0 W, h
  1208.     if [ $? -ne 0 ]; then. }9 |" D0 G" [0 B- h3 Y1 Z. e
  1209.       Log "DB selection cancelled. No modifications have been made to your databases." 1
    $ g; A$ p6 }) y) U% Y6 o
  1210.       return 0
    . y, l0 X9 N# P1 |. [( B3 {
  1211.     fi
    7 \. T# W9 L, R1 C

  1212. & Z8 [$ j' q6 y1 w2 g* u
  1213.     # Remove and create the realm DB if selected- C/ ?/ T1 J# N" ~5 Z
  1214.     if [[ $DBSEL == *0* ]]; then
    ; _. }* \8 }2 ^. C1 L( X
  1215.       $DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_REALM;"
    , ]: m( z# W, {" ~3 t
  1216.       $DB_COMMAND -e "CREATE DATABASE $DB_REALM;"
    * e; }6 A+ D" @
  1217.     fi
    # F" E" `) y8 r; h- V5 [, X# o
  1218. ( c' F4 d# M/ Q8 t1 A- s
  1219.     # Remove and create the world DB if selected
    * [, x# s" u# Y
  1220.     if [[ $DBSEL == *1* ]]; then
    % W4 M7 o0 |! ~  s# @7 S
  1221.       $DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_WORLD;"
    " s- z* J7 e; d8 Q! B& u* q! ~! ?
  1222.       $DB_COMMAND -e "CREATE DATABASE $DB_WORLD;"
    6 @: A8 x+ P6 J3 w; ]. s; @' {
  1223.     fi1 f1 W. W& d  h! u5 p) }

  1224. 0 Z5 V: r! i1 F* f+ r2 a1 b& R, ?
  1225.     # Remove and create the character DB if selected
    ' o/ ?! L+ h5 `( Y  V
  1226.     if [[ $DBSEL == *2* ]]; then: ]/ u% V0 @1 A' [  w# D
  1227.       $DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_TOONS;"
    * \) E) U7 j6 }2 G2 e8 t
  1228.       $DB_COMMAND -e "CREATE DATABASE $DB_TOONS;"
    ( ~1 X4 O/ c8 m: n0 C1 E
  1229.     fi
    9 l/ z* c, `: D. D: e  O2 g. l$ x
  1230. , u' x4 e  O" ?2 ?
  1231.     # Validate success
    0 ^' J0 W* D6 R. `
  1232.     if [ $? -ne 0 ]; then
    4 s' X( y! e$ U* X/ U
  1233.       Log "There was an error creating the databases!" 1- e4 Y$ m" z8 y  q
  1234.       return 1+ o9 G; }: k: L0 l
  1235.     fi
    6 u5 T, d2 {" X* ?) T

  1236. ( f% ?* s6 M% U4 p- M8 ~* i$ Q+ G5 L( C: |
  1237.     # Finally, populate the databases
    + I0 c, z9 W( v5 J$ V
  1238.     InstallDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS% \( m0 K# u( g
  1239. . c9 G( c1 e* V+ N) a
  1240.     # Updating the realmlist
    5 w# h; S6 M2 ?. I
  1241.     if [[ $DBSEL == *3* ]]; then) h( W+ J4 c+ b. n. n7 W
  1242.       $DB_COMMAND $DB_REALM < $SRCPATH/database/Tools/updateRealm.sql
    2 f" [' K/ H+ E* W
  1243.     fi6 z9 G0 \) U' O$ `9 u; l+ g' F
  1244.   fi
    # n% k+ f, b8 L6 [& Z; f; e

  1245. & f9 q7 V+ C3 u7 ^1 A& l0 _
  1246.   # Update the databases if requested
    $ A! P! c4 q6 N1 r& W5 s& V7 v, f
  1247.   if [ "$DBMODE" = "1" ]; then
    + e" b8 e4 ~! J7 O5 W3 s
  1248.     UpdateDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS: ]/ G* L- |( Z" }& L2 m5 `
  1249.   fi/ F8 K. g& y! l& e& \, K2 S) U# `8 i
  1250. }
    : V4 v+ ~" r" u/ v$ L5 i/ h

  1251. % x, t, {% k' {% j% k
  1252. # Function helper to extract resources (mmaps, vmaps, dbc, ...) from the game" j( A, n0 u. U/ W  k
  1253. function ExtractResources
    # o# p6 P; M6 {* Q2 p% j+ F
  1254. {
    6 _9 M& |3 Y+ }7 ?. ^3 b% ]2 j; Q
  1255.   INSTGAMEPATH=$(dirname $(find /home -name "WoW.exe"| head -1 2>>/dev/null))
    - W; e8 f; ?  z8 J1 r$ U: d$ _
  1256. ; `. S; F4 D6 F& F* Z  g3 u
  1257.   GAMEPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "WoW Game Path" \
    , G" U( G* \. U9 L, L
  1258.     --inputbox "Please, provide the path to your game directory. Default: $INSTGAMEPATH" 8 60 3>&2 2>&1 1>&3)+ @) W2 \3 {% k) Z2 a. h
  1259. # a( T& f; M" b/ l. H
  1260.   if [ -z "$GAMEPATH" ]; then* h& }* C! U; X. @* ?. r- u
  1261.     GAMEPATH="$INSTGAMEPATH"5 k; k+ m5 V. E/ t9 V
  1262.   fi
    $ w  Y: |8 ?+ F! ]( K! T
  1263. 8 |9 [# f$ A0 F  {  A" l( u
  1264.   if [ ! -d "$GAMEPATH" ]; then
    5 N$ q+ N8 m/ O, e4 A5 y
  1265.     Log "There is no game at this location" 1; R) Q5 p$ g5 \3 ]: ?2 E; ~1 G5 T! l) b
  1266.     exit 1: F" \" {1 @! |. y. Y* Z. g0 E, n+ ?; N
  1267.   fi
    ( ]' K& B, |$ ]) ^) z4 [

  1268.   f4 h! \' X* T% M7 |4 ^1 v
  1269.   ACTIONS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \
    8 N4 c, P* ~4 ?% B$ f
  1270.     --checklist "Please select the extractions to perform" 0 70 3 \& Z! Q7 c( O2 s2 U, i1 w
  1271.     1 "DBC and Maps" On \
    0 E; Z1 O* R" x! A
  1272.     2 "Vmaps" On \! O& C" G% \7 G! d
  1273.     3 "Mmaps" On \8 l* ]6 x9 ^2 O- K# F
  1274.     3>&2 2>&1 1>&3)& M$ E2 e3 U! r9 p- i! T7 a
  1275. 3 M' r# q& i5 r2 z
  1276.   if [ ! -d "$INSTPATH/bin/tools" ]; then# @. t- Y# n4 B# V# R$ I2 ^
  1277.     Log "The client tools have not been built, cannot extract data" 1
    * c6 y+ S, b! O9 _+ R
  1278.     exit 1
    * g. A  j$ Z8 C7 b/ t8 K% D3 B* S, k
  1279.   fi3 ?/ r7 z4 Q8 W( p, D1 v

  1280.   q6 Z) F) H) _, H
  1281. #TODO What if DBC are not yet generated ??
    " d# n" b3 J: [5 i0 ^9 t7 Q% c
  1282.   if [[ $ACTIONS == *1* ]]; then
    . j- a7 X  V  L, {" h4 {; U
  1283.     if [ -d "$GAMEPATH/dbc" ]; then1 k2 \; T$ m$ |: k: O
  1284.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "DBC and Maps were already generated" \6 G* P& E& q; Y$ S9 l: o) G4 k
  1285.         --yesno "Do you want to generate them again?" 8 60
    , ~, N1 k# T9 L6 E

  1286. % s8 L% ~/ Z# C- |- J4 Y/ h
  1287.       # Check the user's answer$ r: p: ~( ]; x7 o, b8 P# D
  1288.       if [ $? -eq 0 ]; then
    8 G/ r. K9 V0 e- N% O
  1289.         Log "Deleting DBC and Maps previously generated." 1
    . Q  E4 e$ m1 a7 A* d
  1290.         rm -rf "$GAMEPATH/dbc"5 R" h: g( b/ a" k# ~$ Q
  1291.         rm -rf "$GAMEPATH/maps"& x& {; w! T/ b% m% a( S. W( ~. a
  1292. $ c! f; H6 Q! t, D$ d1 J
  1293.         Log "Copying DBC and Maps extractor" 0' Z9 C3 R# e# g8 @/ ]0 C
  1294.         rm -f "$GAMEPATH/map-extractor"% O8 I7 T; `" }. c7 t, n
  1295.         cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH"
    2 i+ _4 {/ b, t# U+ I) u

  1296. 7 f' z8 E. z3 m
  1297.         Log "Extracting DBC and Maps" 0
    & H5 G% B8 f% P( T# q
  1298.         cd "$GAMEPATH"$ \0 F9 q+ c. l; b: t5 v0 L
  1299.         ./map-extractor
    5 g! ]: G* z3 _4 A0 A* i& N

  1300. * D, Y9 q8 P+ j) B* V+ W- ^
  1301.         if [ $? -eq 0 ]; then, M: ?( A8 M+ T/ u# _' S
  1302.           Log "DBC and Maps are extracted" 0
    3 f+ H6 j  Q% ^9 Q# U
  1303.           Log "Copying DBC and Maps files to installation directory" 0% @0 |. T! B( T) _5 x2 X4 K0 E: y
  1304.           cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"/ w, @/ C" b8 K! X! Q* ]+ J
  1305.           cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
    - r0 p, r* c* B& C! k8 v6 d
  1306.           rm -rf "$GAMEPATH/map-extractor"1 ?& h7 L1 H. t4 B3 Y
  1307.           Log "Changing ownership of the extracted directories"
    8 d/ v0 k6 `! _9 [5 N& a
  1308.           chown -R $USER:$USER "$INSTPATH"3 X: C% R5 c3 H  j
  1309.         else3 l; l1 M* e) B' ?0 |
  1310.           Log "There was an issue while extracting DBC and Maps!" 1# V/ ?! g  G8 [
  1311.           rm -rf "$GAMEPATH/map-extractor". G6 K6 {/ }7 n$ R2 r: l) b: a  C9 r
  1312.           rm -rf "$GAMEPATH/dbc"$ Z% o1 A2 e% f. P9 i& d
  1313.           rm -rf "$GAMEPATH/maps"
    2 N' w: i6 Q! O  H# g
  1314.           exit 1. b# Q. V$ n9 g1 d& a! i
  1315.         fi7 T& a; x9 N1 K+ B3 w, {- Y1 h
  1316.       else( u% A- l/ E6 P. M6 k8 u
  1317.         Log "Copying DBC and Maps files to installation directory" 0
    4 l- _6 Z, Q/ P, Q! C! B
  1318.         cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
    " x; z  ]$ C* @$ @
  1319.         cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
    8 X; _4 a% A6 C+ A- Q  d
  1320.       fi
    3 ^  q! j0 }, Z
  1321.     else6 J4 E+ M4 y3 T7 C! S6 w
  1322.     rm -rf "$GAMEPATH/map-extractor"- c1 d' U8 M0 J
  1323.     cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH"( ?( P  @3 y, d" l
  1324. 6 z# w; {- p3 F, Y
  1325.     Log "Extracting DBC and Maps" 0# E/ ^% e5 I. l3 e
  1326.     cd "$GAMEPATH"
    ; v" Y  j5 a4 P2 k  O
  1327.     ./map-extractor: h0 g4 j0 v) ]- d& }

  1328. ' ~( F! l7 v. y2 O- C) b
  1329.     if [ $? -eq 0 ]; then
    # y: U* q! P5 Y$ I7 M7 Y
  1330.       Log "DBC and Maps are extracted" 04 K; F1 c$ y; i* b6 J1 `" q
  1331.       Log "Copying DBC and Maps files to installation directory" 0
    - f4 Q0 Z/ Y% d: Z9 t5 `! |, l
  1332.       cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
    * L( O1 y/ {+ k8 q& J  z6 t
  1333.           cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
    $ |$ F3 t5 ?2 z, p: J6 H0 x  c
  1334.           rm -rf "$GAMEPATH/map-extractor"5 U0 r  _9 }0 }. d! h: B7 Q
  1335.           Log "Changing ownership of the extracted directories"2 A+ F, {( n( k3 f: L  x4 s9 ]
  1336.           chown -R $USER:$USER "$INSTPATH", ^+ n( Y$ U7 d2 n% \6 q# k: k& y
  1337.         else
    , L* o+ J- V! [9 U
  1338.           Log "There was an issue while extracting DBC and Maps!" 1
    * g+ b7 Q3 k6 ]+ b% q" n) N
  1339.           rm -rf "$GAMEPATH/map-extractor"- l+ ^2 e+ ^8 [$ h
  1340.           rm -rf "$GAMEPATH/dbc"$ {! ?0 G6 y7 M  }# N0 b0 p
  1341.           rm -rf "$GAMEPATH/maps"! g. N  \9 v* j! w" c% s' Q
  1342.           exit 11 ]# c: {% x! ]
  1343.         fi
    , ~& Y2 s" ?, g/ M+ E4 x
  1344.     fi8 Y7 T) G4 g7 w  n
  1345.   fi
    ( y3 ^, s3 E: k8 \$ o7 M' T

  1346. ; T8 h8 U, w0 z# h
  1347.   if [[ $ACTIONS == *2* ]]; then
    ( K+ a, n; \" s% x
  1348.     if [ -d "$GAMEPATH/vmaps" ]; then
    1 c; t& [7 P. A
  1349.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "VMaps were already generated" \8 `4 B1 J2 l2 Z% H3 l
  1350.         --yesno "Do you want to generate them again?" 8 60
      A* |! p" \& i9 k
  1351. ! A9 u. T* S; \6 j: w0 S
  1352.       # Check the user's answer! l( U& C; Q7 W
  1353.       if [ $? -eq 0 ]; then
    5 ~3 s1 y! p* D' C
  1354.         Log "Deleting VMaps previously generated." 1) c+ U  L) K  F2 a6 C3 V9 P
  1355.         rm -rf $GAMEPATH/vmaps4 \( j1 w% N( p& u. ~/ t( Z
  1356.         Log "Copying VMaps extractor" 04 y1 a! h* @: H5 T4 I* a- V
  1357.         rm -f "$GAMEPATH/vmap-extractor"8 Y# R  E) s$ ^! Y5 f
  1358.         cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH"
    4 N7 B0 ^1 Y) f! ^& B

  1359. / d4 y9 T4 z1 g7 T3 y
  1360.         Log "Extracting VMaps" 0
    - ?% B# i9 e2 o! q! U: `
  1361.         cd $GAMEPATH
    & K1 C: S1 P7 a! Q: a( g
  1362.         # Make sure there is no previous vmaps generation that cause issue.
    9 D- r7 v% J8 J# P+ t
  1363.         rm -rf Buildings: o' j# v; @( n$ A6 A# e4 ~4 u" U
  1364.         ./vmap-extractor& l  }( [# e4 Y0 B8 I
  1365. 1 W3 a6 g( A6 N: L% |9 {
  1366.         if [ $? -eq 0 ]; then; M# J, p' I) p
  1367.           Log "VMaps are extracted" 0
    / [* N/ c' T4 _6 v0 @/ x& Y# g
  1368.           Log "Copying VMaps files to installation directory" 0
    : O1 W- P! x# ]( \; D0 f
  1369.           cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
    ' ?, e2 [, O2 x6 Y8 Y0 a4 C7 C) Y% k3 C
  1370.           rm -rf "$GAMEPATH/vmap-extractor"
    6 h4 i3 I4 E3 N& b- N% _' P
  1371.           Log "Changing ownership of the extracted directories"* U7 Y2 y& |- I" ^3 y2 u
  1372.           chown -R $USER:$USER "$INSTPATH"4 f8 J( \$ g+ y+ x
  1373.         else& h, N! _. p2 f- u, B" H
  1374.           Log "There was an issue while extracting VMaps!" 1% N; `6 h+ o8 g* C' a$ O4 s; h
  1375.           rm -rf "$GAMEPATH/vmap-extractor"% Z) R* v. k4 N' @
  1376.           rm -rf "$GAMEPATH/vmaps"& \0 }8 ?4 O$ A' c6 p! u6 j9 T
  1377.           exit 1, e  `' U4 }5 V; g5 Y$ @- [* r. o5 ?
  1378.         fi
    4 b* |! l$ X4 h7 n$ P; J$ B6 u1 }
  1379.       else6 g% v. E2 k( Q0 M+ k( y
  1380.         Log "Copying VMaps files to installation directory" 0; L$ X# d1 n9 P' n) d8 r. }4 R# e8 ?
  1381.         cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
    4 J% b. ^7 p# X9 I0 F
  1382.       fi
    . t8 R( o8 w, U2 x" g
  1383.     else, W% s9 z* ]* o# n6 J0 W  B$ g5 M
  1384.      Log "Copying VMaps extractor" 0
    ) }/ s& H6 I) B, H' f
  1385.      rm -f "$GAMEPATH/vmap-extractor"
    & p+ A( @# M- ], B5 _7 I  X
  1386.      cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH"
    # s( G; H! U& J3 ?
  1387. 8 X# Q# t6 S$ I  o0 k' z) e
  1388.      Log "Extracting VMaps" 0
    * P$ |% w: \( c0 b1 H
  1389.      cd $GAMEPATH
    * M& y. @: o+ T* L, ]3 d
  1390.      # Make sure there is no previous vmaps generation that cause issue.
    ; I! m6 x. o" o( V' e$ V2 c( G) R0 }
  1391.      rm -rf Buildings
    + }' c7 q+ I8 m9 V
  1392.      ./vmap-extractor) t3 |9 G0 Y) W4 ]  v) U+ H7 S5 W
  1393. " D/ s! |& [2 J5 c% m
  1394.      if [ $? -eq 0 ]; then
    9 P; w1 p) |  \- \8 ^3 m
  1395.        Log "VMaps are extracted" 0
    ( ?) @8 r. J/ t8 A6 [
  1396.        Log "Copying VMaps files to installation directory" 0
    " O# W5 c% H0 Q8 W$ }$ k- |. _
  1397.        cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
    ( f! O. z) t+ T! G
  1398.        rm -rf "$GAMEPATH/vmap-extractor"" K+ N* i' U4 b- E: a; j" y
  1399.        Log "Changing ownership of the extracted directories"' K# T/ Q; O- z5 o$ V% [2 o" t2 l
  1400.        chown -R $USER:$USER "$INSTPATH"  c2 X8 m0 I) I3 n
  1401.      else
    $ [  {% z" G) ~8 u5 b
  1402.        Log "There was an issue while extracting VMaps!" 1# g( f! r- g. ], e
  1403.        rm -rf "$GAMEPATH/vmap-extractor"3 `8 j1 i* w2 Q6 T/ v5 w
  1404.        rm -rf "$GAMEPATH/vmaps"
    8 u& y! L4 e# c7 D$ R. X3 w
  1405.        exit 1
    1 g& m5 f2 Q8 X! v
  1406.      fi
    % F6 p" w8 z  T# J
  1407.     fi' Q" t/ E- i/ m8 b! n% J
  1408.   fi6 I) P: z9 c1 W3 k* K1 H
  1409. ' h% a, }6 z4 t  N, ~9 b2 F; v/ \
  1410.   if [[ $ACTIONS == *3* ]]; then
    ! ?1 U4 f! t# G8 @: X, H# D( [: ?$ A
  1411.     if [ ! -d "$GAMEPATH/maps" ]; then' ?3 v# t: t  J' R
  1412.       Log "Error: maps files must be created to be able to generate MMaps!" 1
    2 t$ k6 k9 `" f2 L4 ?
  1413.       exit 1
    % b# ^! H1 v/ I' D) w& @2 h6 B
  1414.     fi! S# X8 C9 F! A/ E6 ^  J
  1415. 5 L( j# v5 Y! B5 _' X% S7 `0 b
  1416.     if [ -d "$GAMEPATH/mmaps" ]; then
    ' v# A6 ~6 H- y+ D2 n- D! s8 b
  1417.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "MMaps were already generated" \1 ?/ ^8 V4 z3 O' ?
  1418.         --yesno "Do you want to generate them again?" 8 605 l  b( J8 v% s4 y

  1419. + K3 D9 G2 G( @+ A
  1420.       # Check the user's answer
    . t: {- l( \: Y- @: }3 g, \5 S
  1421.       if [ $? -eq 0 ]; then) S" s1 }# j/ ]+ D3 J$ N
  1422.         Log "Deleting MMaps previously generated." 1& B; ^& s$ t3 ?# C7 T
  1423.         rm -rf $GAMEPATH/mmaps8 f2 g" u" N0 f
  1424. ( c! V! \. }# L: D
  1425.         Log "Copying MMaps extractor" 08 R* w; K. d$ I2 f
  1426.         rm -f "$GAMEPATH/MoveMapGen.sh"
    + h& Y% p4 _# V* b3 {, j% Q
  1427.         cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH"5 n7 J/ z3 h) ^. Q6 l  f
  1428.         cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH"  {+ D! E, g; d+ R3 R
  1429.         cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH"( j) Z0 f9 B' O! Y: K" j! P
  1430.         cp "$INSTPATH/bin/tools/mmap-extractor" "$GAMEPATH"( @" m; v, X( Q
  1431. * Z6 q  N! B7 D8 p% o
  1432.         CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \
    + @% i7 a. N) g6 e
  1433.          --inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3)
    . S- |: u+ M# b2 u

  1434. % I" P! B5 Z1 g- B! Y- p' B; C
  1435.         # User cancelled his choice, set default to 1.# f' Z0 l7 W5 _1 y( d4 q
  1436.         if [ $? -ne 0 ]; then/ x+ Q* m. q4 v+ H5 X
  1437.           Log "User selection was cancelled. Max CPU set to 1." 1
    % S3 V3 X( P1 g3 N  C3 m- ?. R
  1438.           CPU=1; ~5 S( _8 Z/ ^( j
  1439.         fi
    ; ~9 Q! V6 G! f, {' Q9 J; N
  1440. 8 P0 n7 M# p( h# M! Z
  1441.         if [ -z "$CPU" ]; then% @- y& R* x7 J0 d& _
  1442.           Log "User didn't gave any value. Max CPU set to 1." 1
    % L' ?8 Y; g9 X1 t! e7 m
  1443.           CPU=1( `$ {3 m, B' h# h$ X: [" ~3 c
  1444.         fi
    8 q- e2 }. o' e9 q& u

  1445. : y: h0 D+ U; y' k
  1446.         if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then
      n1 @  c: Z8 s" k: j2 X
  1447.           Log "User entered invalid value. Max CPU set to 1." 1/ b6 Z( e1 R2 l$ Y  J5 l8 g9 b
  1448.           CPU=15 v. u( \- p# X9 X, o( U# h
  1449.         fi
    4 x' R7 W% W8 a5 W
  1450. * V3 `. B: {/ w; D
  1451.         Log "Extracting MMaps" 0
    0 M5 D: V$ r5 w* t- p4 b
  1452.         cd $GAMEPATH
    " K7 P1 M4 i2 J& Y& c
  1453.         # Making sure we can execute the script' W2 m9 Z/ `" |! J; F
  1454.         chmod 700 MoveMapGen.sh9 ~  l& ]! F6 f( H: v: w
  1455.         ./MoveMapGen.sh $CPU$ b7 y0 ^6 y5 a0 R3 l( `8 Y6 j

  1456. 9 e. R) |- n! |( ]0 V+ s
  1457.         if [ $? -eq 0 ]; then1 p/ L& \% t4 q0 o' i# m
  1458.           Log "MMaps are extracted" 0* g6 X* M* n8 Y6 ?, R3 X
  1459.           Log "Copying MMaps files to installation directory" 0; `; _# E2 G( T2 s- a4 Y: K
  1460.           cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"- h7 ?, z4 m6 W/ K
  1461.           rm -rf "$GAMEPATH/MoveMapGen.sh"
    # E- Z7 G, f, _/ a6 B+ E
  1462.           rm -rf "$GAMEPATH/offmesh.txt"
    3 s& q' A1 u9 O  P) S) `" a* P, W/ H
  1463.           rm -rf "$GAMEPATH/mmap_excluded.txt"# r4 |* ^- N$ p+ j+ c! k8 B
  1464.           rm -rf "$GAMEPATH/mmap-extractor"
    # k, N9 c( O6 K
  1465.           Log "Changing ownership of the extracted directories"
    % o) M2 I$ y+ x. O
  1466.           chown -R $USER:$USER "$INSTPATH"/ V1 z9 h0 }( I! k* G
  1467.         else
    - G6 j7 A8 C, n
  1468.           Log "There was an issue while extracting MMaps!" 1
    ) D3 V: Q+ y9 \& i3 c
  1469.           rm -rf "$GAMEPATH/MoveMapGen.sh"
    7 {, I) B! _* ~* O
  1470.           rm -rf "$GAMEPATH/mmaps"
    2 O6 |/ z6 _6 |5 a; z
  1471.           rm -rf "$GAMEPATH/offmesh.txt"2 @$ t. p0 m  {4 r/ q# V/ _6 ~
  1472.           rm -rf "$GAMEPATH/mmap_excluded.txt", L( W- U% M1 K( z4 y
  1473.           rm -rf "$GAMEPATH/mmap-extractor"6 s" C" O  [$ R' o
  1474.           exit 1# @- G" j3 V6 _/ n
  1475.         fi/ d5 q8 [4 t) C( N& Z9 A
  1476.       else! p# n* {9 b! d' S+ j- T! c
  1477.         Log "Copying MMaps files to installation directory" 0
    8 X$ t4 U+ P- z) @/ u
  1478.         cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"" n/ a. F4 V: o* B- {8 p
  1479.       fi
    ( V3 Q1 k2 S! w+ _: s
  1480.     else' f3 X) T, |) O: h
  1481.     Log "Copying MMaps extractor" 0) v! X: P# _3 o# o. z
  1482.         rm -f "$GAMEPATH/MoveMapGen.sh"" @, J9 G/ w  d0 r
  1483.         cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH"
    5 j* p% X8 Y! m# X# S
  1484.         cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH"5 Y' ^7 d: i6 X$ _  i$ |* s
  1485.         cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH"
    5 @, ]' o. }$ C( _1 y
  1486.         cp "$INSTPATH/bin/tools/mmap-extractor" "$GAMEPATH"
    ; D" i3 T# L" u6 ^& O; D; k
  1487.     CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \+ M; o5 o9 ^8 e  U
  1488.          --inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3)
    " ?9 {* X- C( }7 o2 }

  1489. 5 N" }% f+ @5 b3 j) E
  1490.         # User cancelled his choice, set default to 1.
    5 U3 \  }  p( a3 B1 ^& J
  1491.         if [ $? -ne 0 ]; then
    % y3 o" G4 W0 t5 P6 ]3 \9 [2 F
  1492.           Log "User selection was cancelled. Max CPU set to 1." 1
    + {4 I. R6 U: Y" _, U
  1493.           CPU=1) Z* c5 Z8 G# J- `& L, U6 b: t# ~
  1494.         fi
    & x% j$ g4 x( }" {4 Q/ Q

  1495. 6 n9 D* I* @) N) [# h* g
  1496.         if [ -z "$CPU" ]; then# O7 ^2 A% ]2 X9 g. F1 P% b/ Q' A
  1497.           Log "User didn't gave any value. Max CPU set to 1." 1
    % E* e5 a  r6 H: ^5 n/ C
  1498.           CPU=1
    2 X0 m8 g2 R( b( n
  1499.         fi
    6 S7 u& n5 s  U# W1 R7 N# |

  1500. 2 _2 p0 T$ c  e
  1501.         if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then
    - t# N* c2 M: l& Q, y. y. Z& M
  1502.           Log "User entered invalid value. Max CPU set to 1." 1
    & a. ^6 K6 \7 O3 t
  1503.           CPU=1
    6 R2 @7 m& f2 Q8 n% ?
  1504.         fi9 _# m: r" Y0 K
  1505. 1 `! D7 B# B  w" t1 l' N5 P! B
  1506.         Log "Extracting MMaps" 0
    0 C( @4 N4 f( ^: ~( \
  1507.         cd $GAMEPATH1 y" T- G4 z( A$ S: c1 z0 i! }
  1508.         # Making sure we can execute the script* q4 I- s! s3 X7 M
  1509.         chmod 700 MoveMapGen.sh
    4 B3 g- _( `* e: L6 o* a
  1510.         ./MoveMapGen.sh $CPU
    2 r8 U; q! t# ]! r) a1 Y
  1511. 9 {6 J( q. P/ ]5 o+ }* O
  1512.         if [ $? -eq 0 ]; then
    ( A; x) o4 X8 j" k# }  j5 s
  1513.           Log "MMaps are extracted" 0
    9 s5 D- }1 ~) ^3 \/ Z  C
  1514.           Log "Copying MMaps files to installation directory" 0
    3 p' p  @" N  p1 X& j0 H
  1515.           cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"
    ! E* M3 q# \: X, o6 J1 S, V
  1516.           rm -rf "$GAMEPATH/MoveMapGen.sh"
    2 ?, ~7 B! R8 k! ]- Y
  1517.           rm -rf "$GAMEPATH/offmesh.txt"0 N* P! c: I7 h/ g4 S
  1518.           rm -rf "$GAMEPATH/mmap_excluded.txt"
    ) o  w. e* n7 E7 f! p
  1519.           rm -rf "$GAMEPATH/mmap-extractor"
    / i/ y% I9 k/ F- R) }! Y6 w$ b
  1520.           Log "Changing ownership of the extracted directories"
    - k! `, z" o9 b  p6 K4 Y
  1521.           chown -R $USER:$USER "$INSTPATH"' [: H) B  X# x! ]
  1522.         else' N- \6 A( _7 Q4 S2 K$ m- g# b
  1523.       Log "There was an issue while extracting MMaps!" 1/ M  f: i0 q& L% |: I& e. A
  1524.           rm -rf "$GAMEPATH/MoveMapGen.sh"
    8 k; ?$ N* E4 `$ s. Q/ S
  1525.           rm -rf "$GAMEPATH/mmaps". E: P  [) C3 _0 t
  1526.           rm -rf "$GAMEPATH/offmesh.txt"
    0 P& y# x; V9 y. e
  1527.           rm -rf "$GAMEPATH/mmap_excluded.txt"
    - x2 J7 D: a8 q
  1528.           rm -rf "$GAMEPATH/mmap-extractor"2 c; ^6 X5 U4 X% u" {) I: p5 Z
  1529.           exit 1' D* P6 o6 ^: v4 G
  1530.         fi
    4 |; u  R: c" _/ R* n& `; p5 R8 e
  1531.     fi2 `" _$ a- ?1 b% d' V
  1532.   fi1 n+ h, ^% b% _; K* x9 F) i
  1533. }
    $ M  a: g7 q3 o+ Q& Q

  1534. ( Z! j# Q( U' C4 V
  1535. # Function to create a Code::Blocks project* K- w0 A$ T. a5 l; B
  1536. function CreateCBProject
    : E, X- S1 t' c
  1537. {
    6 ^- S5 G" w5 R( |  |
  1538.   # Create the dircetory if it does not exist
    2 m$ V) p1 s1 x8 Y9 @
  1539.   if [ ! -d $SRCPATH/server/linux ]; then
    0 E0 S1 J0 h9 ]7 G
  1540.     mkdir $SRCPATH/server/linux/ O' ~2 X; h% g9 o/ e4 ~
  1541.   fi. h9 @# H: A8 D) f! H

  1542. 8 B7 A" h% d; R! A  i! g
  1543.   # Now create the C::B project
    2 S" T8 i4 k: s" u: G1 f
  1544.   cd $SRCPATH/server/linux& W5 }0 w: B( q. W/ M/ b7 |
  1545.   # make sure we are using the cmake32 a1 O2 \$ ~! e6 H/ i
  1546.   UseCmake3. K) I% z1 k: I. v( f* f: W" k
  1547.   $CMAKE_CMD .. -G "CodeBlocks - Unix Makefiles": i& H1 ~9 \6 e# L; c
  1548. }
    " q6 P8 B/ d4 ~, R2 w; s$ M

  1549. 7 A" K+ B* |1 y  K4 d3 L
  1550. & i8 y2 b" l- y/ r9 R2 q( I. X( Y

  1551. / f! k6 V/ Z( m, p0 }
  1552. # Prepare the log" ~% d4 Y( w; ]* r; e* R  G% k& h2 Q
  1553. Log "+------------------------------------------------------------------------------+" 0% k' `6 @) W' {, H1 c& F/ J
  1554. Log "| MaNGOS Configuration Script                                                  |" 00 w' A0 s& Y, b8 F2 e
  1555. Log "| Written By: Ryan Ashley                                                      |" 0& T( T/ s6 Y0 E
  1556. Log "| Updated By: Cedric Servais                                                   |" 0+ l! |2 r! F( X# |8 U: j$ u  A: i
  1557. Log "+------------------------------------------------------------------------------+" 0
    & }- J0 x, U7 z) D% X

  1558. : M* }. d' @5 _9 M3 b: l0 M
  1559. # Check if user who is running this is root
    ( H, I  z! B9 L1 y/ J% Y
  1560. CheckRoot
    6 z. S8 i9 @1 s: i9 k
  1561. % g- o( t9 o4 Q
  1562. # Select which dialog to use  ]2 f) P/ d% a
  1563. UseDialog) e, b4 ^1 U3 a# S! J& c  P+ V/ D
  1564. 1 c- m) I4 Z" }
  1565. # Select which activities to do
    # q& V- }6 f& {8 X
  1566. TASKS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \  L6 A# g3 J: j6 M% z' `* L
  1567.   --checklist "Please select the tasks to perform" 0 70 8 \' p9 I5 ^4 N. ]* A: L
  1568.   1 "Install Prerequisites" On \
    2 c, U4 ?6 s9 V! X& U9 B
  1569.   2 "Set Download And Install Paths" On \
    , M: J- N% f+ [+ \9 H; b
  1570.   3 "Clone Source Repositories" On \
    ' v6 d; S8 _" m# l
  1571.   4 "Build MaNGOS" On \
    2 o6 r' k% p# K, z- S$ m. _$ S7 e
  1572.   5 "Install MaNGOS" On \
    ; E) |0 s$ e3 S$ n
  1573.   6 "Install Databases" On \2 Q0 V+ J9 d. E
  1574.   7 "Extract Resources" On \
    ; i2 W& P, ?" ?
  1575.   8 "Create Code::Blocks Project File" Off \
    9 w# q8 t; [8 z: R  ~- E
  1576.   3>&2 2>&1 1>&3)/ x* O5 U5 Y; R+ e3 ~

  1577.   P9 D; G& a, N- f
  1578. # Verify that the options were selected1 `: }' f" m/ ~* W
  1579. if [ $? -ne 0 ]; then
    ( g5 r# ?/ U$ [' T. ]
  1580.   Log "All operations cancelled. Exiting." 1- v; G+ Z! `/ X/ z' f6 t& ~
  1581.   exit 0
    * o' u9 j! \3 \. D/ q% e4 Z
  1582. fi) s6 }, H5 Y) Q- F: z# F

  1583. * V: t$ r+ Y! O# Z0 B4 i
  1584. # Install prerequisites?
    5 d- x* e" }! i, m" k2 B
  1585. if [[ $TASKS == *1* ]]; then" {  q5 X7 d0 U  h9 k
  1586.   GetPrerequisites  I" I9 r2 k, ~! G
  1587. fi1 @1 w7 c6 g: y# Z! e4 F6 o3 [0 s1 r

  1588. 0 C- r+ @. P; V& i. C. O9 S) {- l1 M
  1589. # Select release and set paths?
    # A6 i, C- K& |7 y
  1590. if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then
    9 _4 A: M! y; a/ P# l  ^- [2 P/ Z
  1591.   GetUser  e: C9 m. y  n. F) e5 K
  1592.   GetRelease+ f0 ^1 H/ Z4 Z0 e/ }& V
  1593. fi
    % B3 a" F4 ?/ ]' c% i) M; v+ K
  1594. * r9 z2 B: B' S; v. `
  1595. if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *6* ]] || [[ $TASKS == *7* ]]; then/ G) Y% Q" \: w, n
  1596.   GetPaths
    5 h! E/ O# B$ z- ?* s3 r0 x- i3 P. V
  1597. fi' ~% Z1 F3 U6 X! o
  1598. ' {  Y$ E6 F' m4 v+ l3 r
  1599. # Clone repos?
    ' p: e& o2 U/ [$ t; W" o
  1600. if [[ $TASKS == *3* ]]; then, p4 s5 I. U4 V; r! V" J4 T
  1601.   GetMangos
    1 |" ^# a0 v) d' v4 q# l2 s
  1602. fi
    ( o! p2 F5 C$ G4 t+ d! u: X
  1603.   K3 x2 e9 W; o! H3 o, s# J
  1604. # Build MaNGOS?( n+ x! w3 H+ k! U
  1605. if [[ $TASKS == *4* ]]; then1 T* V# |) ^: p: K# k7 C
  1606.   GetBuildOptions
    # R  k; y4 C1 ]$ L: p5 z
  1607.   BuildMaNGOS
    - I$ e7 J! D& D( O; k
  1608. fi: K4 F( @0 l* E& }! v
  1609.   r! C1 W) `/ F3 x2 f  u
  1610. # Install MaNGOS?
    , R9 M: s# f& H$ Z, J
  1611. if [[ $TASKS == *5* ]]; then& {& l: N4 N2 `. Q2 a; D
  1612.   InstallMaNGOS  C4 N, D8 H: U0 D" C
  1613. fi
    . A6 N6 o7 k% _' p
  1614. 7 n7 H5 @8 h) v) t5 H3 |5 ]' X
  1615. # Install databases?: C( N& a" i: r1 z7 \1 N
  1616. if [[ $TASKS == *6* ]]; then
    2 I; D+ _3 G: z$ ?/ x& ?
  1617.   HandleDatabases
    & A' R/ f- u7 V( D
  1618. fi2 m- O# ?, K; J$ r7 m

  1619. ; n9 u* g* u4 [
  1620. # Extract resources from the game?
    9 Z% \: |/ l$ d, U# T
  1621. if [[ $TASKS == *7* ]]; then$ j/ u8 k" ^/ e5 v! Y$ M
  1622.   ExtractResources
      S6 k, E+ e0 ]
  1623. fi; l& b# T) v; p/ K

  1624. + m. E( U% ]3 Q% F
  1625. # Create C::B project?
    9 `% _1 X) q* ~7 M' w$ x
  1626. if [[ $TASKS == *8* ]]; then9 j- V; ]! Z/ H, Q$ r6 A, U
  1627.   CreateCBProject
    ! H* F# X( U, ~+ S/ v0 ?
  1628. fi/ j  a$ T6 f6 z0 s! v% L. @9 [
  1629. / V# P8 C& h/ J2 X
  1630. # If one of these actions has been performed, then we know the user.7 p# q' P3 J9 P
  1631. if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then
    1 I9 @# h* N( F& l( u! H3 m
  1632.   Log "Changing ownership of the extracted directories" 1  t) E2 o( i7 S
  1633.   chown -R $USER:$USER "$INSTPATH"
    ) E5 X+ ^/ D/ k2 c' k0 N
  1634. fi
    6 b% i$ T& \5 c0 f. O
  1635. $ Y$ r6 S* w& Q+ g
  1636. # Display the end message
    * j( g4 j5 k- [9 m
  1637. echo
    * T. {- G, X* c4 g3 S4 ^
  1638. echo "================================================================================"' [* i% M" `) ?. d- i
  1639. echo "The selected tasks have been completed. If you built or installed Mangos, please"
    + w6 r1 i; A6 u
  1640. echo "edit your configuration files to use the database you configured for your MaNGOS"7 ^) Y, U5 K5 |/ d# E
  1641. echo "server. If you have not configured your databases yet, please do so before", F# X7 m1 ^0 Z9 A5 u( u
  1642. echo "starting your server for the first time.", @  |8 }1 N4 `* p
  1643. echo "================================================================================"
    9 `( w) |# w: A/ I8 b
  1644. exit 0
复制代码
  1. wget -c https://raw.githubusercontent.com/mangostwo/database/master/InstallDatabases.sh && bash InstallDatabases.sh
复制代码
  1. #!/bin/sh
    : M& b' W, H4 C; E0 x# B
  2. ##############################################################################
    % y' P8 Y% }7 u7 X# C) G
  3. # This utility assist you in setting up your mangos database.                #
    , _& S: E% F* H, R3 U
  4. # This is a port of InstallDatabases.bat written by Antz for Windows         #; m& p9 C4 c; O7 G
  5. #                                                                            #
    - n8 S9 V7 V/ p) ]5 E/ e  Z- i
  6. ##############################################################################/ K7 M0 B, Y; O
  7. / S5 p6 g) z! @8 c0 G5 h0 x5 u
  8. OLDRELEASE="Rel21"
    0 D' V, x7 S3 v; @% u* d/ ~/ u5 K
  9. RELEASE="Rel22"% M- Y" P; h' D7 V$ u( M
  10. DUMP="NO"3 K( q/ ?( S/ x6 @0 w$ V

  11. ( f, h: |# B0 v$ q8 W! t
  12. dbname=""5 V3 _% \+ Q$ g3 Y
  13. dbcommand=""! u2 H' ?$ K, C& `9 Q' u

  14. & j5 A) D- [6 A) p
  15. createcharDB="YES"
    - F% v" T% I( R8 M% r$ t5 F; y
  16. createworldDB="YES"
    5 q# l# M) h3 i/ B
  17. createrealmDB="YES"
    - y* X# M* _; Y! G

  18. " {$ e0 `) j$ G3 v; s
  19. loadcharDB="YES"
    0 u$ S- F8 R5 G7 {7 p7 V: m
  20. loadworldDB="YES". K. n9 `/ b8 A8 p
  21. loadrealmDB="YES"
    2 c  k( `# k: [! Q6 c' j
  22. dbType="POPULATED"; {" ?6 E' S# X, L/ A1 b
  23. , r) `9 Z# k0 {
  24. updatecharDB="YES"8 N' M" Q1 _" C# ~9 D. a
  25. updateworldDB="YES"  y! c6 I6 P+ i! a8 A! O  U  m" H1 d
  26. updaterealmDB="YES"( A3 C  D5 k/ n" @4 a/ x4 P! h( p
  27. + h0 f- B8 S& K% W
  28. addRealmList="YES"
    , w! b* u6 b, j* d' Q6 ^' A: x& J
  29. ! }; D* |7 x# v; {# r; v0 ?
  30. svr_def="localhost"5 S. v  ?' K% R. F/ `* A
  31. user_def="mangos", M, O- ?" S& x' @% Q% [
  32. pass_def="mangos"
    : G" E4 q5 k* F6 p  |7 |
  33. port_def="3306"9 O. {, b! k+ @' `; P: W, j
  34. wdb_def="mangos2"5 d& U, N& }" S- q
  35. cdb_def="character2". J! @8 W' [. u: s0 _0 ^) w/ i9 f
  36. rdb_def="realmd"
    ; t, |# x/ ~+ ^; @. V7 x

  37. % |/ [0 m3 k8 F2 s; i+ W
  38. printHelp()
    * E6 H2 c: t) H
  39. {
    , b3 F& i6 [: o
  40.         printf "Usage: $0 [-s] [-u] [-d] [-h]\n"5 t3 @" N* y/ b) }
  41.         printf "\t-s: Run this script in silent mode, only prompt for the database information\n"+ h/ [* c7 d% U8 Q
  42.         printf "\t-u: Run only the updates of the database\n"
    , w& H& U- f8 [8 Z
  43.         printf "\t-d: Dump the database configuration into the home directory of the user\n"
    & K/ ?! H; g* e5 j1 x
  44.         printf "\t-h: Display this help\n"
    3 L* T- ]5 F; R
  45. }( W, b$ {' W+ P
  46. 7 M/ G0 b5 `4 {' q, q3 V& v4 h6 [! e
  47. printBanner()6 a8 v* B3 N- m% i! M& r: J
  48. {. j) e/ N/ l7 |
  49.         clear
    7 m- `  g" p; B7 y
  50.         printf " #     #     #    #   #  ###   ###   ####  \n"
    3 _6 i8 @( ?' h) c& N
  51.         printf " ##   ##    # #   ##  # #     #   # #      \n"( W4 `" `  g2 d# D
  52.         printf " # # # #   #   #  # # # # ### #   #  ###   \n"
    . ^" f* ]9 k: {$ V% a
  53.         printf " #  #  #  ####### #  ## #   # #   #     #  \n"  ^% ]+ _" V# k! H2 W$ b; y
  54.         printf " #     #  #     # #   #  ###   ###  ####   \n"( s: v) \! o7 r9 _- ?* h- n
  55.         printf "\n"
    % @/ {$ P0 l* m" F
  56.         printf " Database Setup and World Loader v0.03         \n"
    & G  k2 \2 u, m/ |' x8 k2 p& [( b$ V
  57.         printf " ---------------------------------------------- \n"
    & K5 G  q9 M6 J4 {$ Q3 n# b6 B* l
  58.         printf "  Website / Forum / Wiki : https://getmangos.eu \n"" [# C' x4 ~0 V- h
  59.         printf " ---------------------------------------------- \n"
    7 p6 Z$ S6 X( x; R5 J: e
  60.         printf "\n"
    % [! t$ V: z1 m0 \  v, m$ a9 P6 u+ |9 I
  61.         printf "\n") s1 a8 v+ r+ k+ M1 c5 x- r' q
  62. }* J/ ]0 G2 @# j! ~1 R* o* _% A

  63. " _( ]" a% h  z4 @
  64. printActivities()0 E% G) n) {/ a( [9 ~4 h
  65. {
    . s4 b6 D! W4 [  @
  66.         printf "\tCharacter Database : \tV - Toggle Create DB (${createcharDB})        \n"
    ' V! k* Y+ M) m; N
  67.         printf "\t\t\t\tC - Toggle Create Structure (${loadcharDB}) \n"5 Q) Y' `0 L5 _1 A! F( P
  68.         printf "\t\t\t\tB - Apply Character DB updates (${updatecharDB})\n"; L; r% g5 c7 J: j4 x/ L
  69.         printf "\n"* c, D2 d5 X. _
  70.         printf "\t    World Database : \tE - Toggle Create DB (${createworldDB}) \n"
    ! e$ f/ ~. [( s2 }7 M! O
  71.         printf "\t\t\t\tW - Toggle Create Structure (${loadworldDB}) \n"        0 h, S" v* L2 u- o! n7 R( t. E
  72.         if [ "${loadworldDB}" = "YES" ]; then+ q* a6 N4 c- @1 A7 \4 h' A
  73.                 printf "\t\t\t\tD - Toggle World Type (${dbType})\n"
    & I% P$ V, T# i4 o/ D
  74.         fi
    ! j1 c$ X* P/ [
  75.         printf "\t\t\t\tU - Apply World DB updates (${updateworldDB})\n"
    * v' y6 `; E" Q% M' `; v( |4 T, g
  76.         printf "\n"# z" t0 L  Y8 r* }5 |' s' e
  77.         printf "\t    Realm Database : \tT - Toggle Create DB (${createrealmDB})\n"/ P! A3 m' z: S  l
  78.         printf "\t\t\t\tR - Toggle Create Structure (${loadrealmDB})\n"
    % I4 l: q7 ]/ h
  79.         printf "\t\t\t\tY - Apply Realm DB updates (${updaterealmDB})\n"
    5 Q- o7 i& H- H/ f
  80.         printf "\t\t\t\tL - Toggle Add RealmList Entry (${addRealmList})\n"       
    7 J" f, \% }+ K6 w0 z
  81.         printf "\n"
    , ?. x& M; h+ ]; n" L7 y$ O1 D0 }6 X" E
  82.         printf "\t\t\t\tN - Next Step\n"3 w7 w7 w, Y7 X5 B
  83.         printf "\t\t\t\tX - Exit\n"
    0 ]7 P/ a' _8 K' e9 T* i5 i
  84. }7 n% b8 i( l# k

  85. ( G6 @1 j( k7 B4 h
  86. determineDBName()
    2 \- f5 f9 ]3 w3 [% B7 L
  87. {1 J; n: [' ?3 R4 a2 {0 L! R
  88.         if [ $(which mariadb) ]; then4 C$ e5 ?+ [* c9 E: n. ^
  89.                 printf "MariaDB found.\n"1 R$ i& Q( A( E: ?: u/ X& |7 H
  90.                 dbname="MariaDB"
    2 L& L7 D9 t# t5 B$ _: P
  91.         elif [ $(which mysql) ]; then
    ; @, g* C1 D0 {+ B
  92.                 printf "MySQL found.\n"
    * @! Y. P1 h: p  O; `* p0 e
  93.                 dbname="MySQL": P% Z! O4 H( z# h
  94.         else2 ^8 L) l# q4 e6 a! o# {
  95.                 printf "Did not find mariadb or mysql.\n"  Y4 \  [2 b/ b; l! y: }
  96.         fi1 ~; Z- A  r7 q
  97. }
    0 Z4 n  ~+ ]; n. U
  98. 4 W; T' p* h4 }
  99. mysqlconfigeditor()( T# {, s; I# q
  100. {" S0 X# j; |& t" j2 U4 f6 K
  101.         dbconfig="mysql_config_editor set --login-path=local --host=${svr} --port=${port} --user=${user} --password --skip-warn"
    " U; }- s1 o6 k: z! x) Z
  102. }' M+ j8 k- J& G8 {: V

  103. ' ?- O9 a$ a4 ?! G1 g( _; R; P
  104. determineDBCommand()
    4 N8 i$ \6 x. d2 q! g
  105. {) d) n  l6 b, Q* `
  106.         if [ $dbname = "MariaDB" ]; then. D6 l- J3 m+ u0 q% Z
  107.                 dbcommand="mariadb -h ${svr} -u ${user} -p${pass} -q -s"
    6 _# ]0 g6 z* }) u: `7 Y& J7 y
  108.         elif [ $dbname = "MySQL" ]; then3 n. s2 ^, S+ B0 Z4 z$ q, a) \) F7 a
  109.                 dbcommand="mysql --login-path=local -q -s"% G7 V7 [" I5 h) }# X
  110.         else7 `+ ^: Q7 U; y5 ?9 K+ V; f
  111.                 printf "Did not find mariadb or mysql.\n"
    / q$ j6 F" X% }- J& O
  112.         fi/ z# L2 K7 g- j- g( L1 A" S8 N
  113. }# |: Z  R, u9 V0 h  H/ @* ?

  114. + u& }% E: v5 M7 `0 |' w8 O9 ]
  115. createCharDB()7 `0 I; }/ f7 G, f, @) M- n8 y  N: O
  116. {7 _; @: [. Q/ z5 ]; V: \/ _0 D# I# U
  117.         printf "Creating Character database ${cdb}\n"( K" d9 x1 F; _3 n5 ^: H
  118.         $(${dbcommand} -e "Create database ${cdb}")
    * Z0 r! i3 O5 v% m/ R" J" `

  119. 0 u0 O* L: \/ f. s, r
  120.         if [ "${loadcharDB}" = "YES" ]; then
    3 N& v7 V7 A* ~
  121.                 loadCharDB
    0 Z) {) i6 X6 f: U$ B
  122.         fi2 Z, q7 t: E$ N8 ?6 q7 x
  123. }, L2 b7 K( B# S3 v
  124. " O# c9 J, A6 p, v
  125. loadCharDB()9 b0 ?* b$ Q: z7 c
  126. {
    0 i# L' {" ~6 g! ?: L
  127.         printf "Loading data into character database ${cdb}\n"7 r* }! g' `- U( m
  128.         $(${dbcommand} ${cdb} < Character/Setup/characterLoadDB.sql)
      N- v1 P" A% S3 A4 g
  129. 2 |  h, E1 H+ q* M; l: `
  130.         if [ "${updatecharDB}" = "YES" ]; then0 h1 ~8 U- V3 G5 v. `3 n$ `: Q5 D9 ?
  131.                 updateCharDB
    # |& i% |3 I. c6 }7 k0 {: w
  132.         fi/ ?, o2 F& a1 s" k3 P4 b) n% A
  133. }
    5 U1 u% g; a4 ~: [* f0 l

  134. ; [% k: J' r6 t% l- k1 d8 ^
  135. updateCharDB()
    / Q' q4 K% z( h* P6 E* v
  136. {9 \6 C4 [5 q/ J0 J( s
  137.         printf "Updating data into the character database ${cdb}\n"
    & O+ Q( o; P2 n
  138.         for file in $(ls Character/Updates/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
    * D6 q- O7 K2 s* O
  139.         do
    4 J. V5 m- C6 M# j: U
  140.                 file=$(echo ${file} | tr '|' ' ')
    + i" i! |- m5 _9 u3 q( d& a
  141.                 printf "Applying update ${file}\n"
    $ F1 i: S: K4 X: O
  142.                 ${dbcommand} "${cdb}" < "${file}"
    , c) j8 Z9 ]$ k0 Z5 O" Q- |' J
  143.                 printf "File ${file} imported\n"
    9 Q3 j6 i) j: M4 Y* ?
  144.         done9 B3 F1 i: x0 X/ U. P4 c, ?+ _% D

  145. # i0 r+ Q6 q- J! M  u1 j4 M& j# k% r; R
  146.         for file in $(ls Character/Updates/${RELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
    " w) p3 y  n: V8 ~9 m. x
  147.         do
    3 _' w# b7 S9 N2 n7 i' K
  148.                 file=$(echo ${file} | tr '|' ' ')+ O/ q+ A2 [- H7 Y7 ~
  149.                 printf "Applying update ${file}\n"! F3 m' R3 W) }3 s3 ^* Z. s( o
  150.                 ${dbcommand} "${cdb}" < "${file}"# J7 f% A+ f7 _
  151.                 printf "File ${file} imported\n"2 v9 l5 k3 r( o( `. i4 y( f1 G4 ^
  152.         done. m6 `) D/ z3 B- y. W
  153. }
    5 A* Q) ^; w4 H" p( [! p0 b+ V5 l" u
  154. 1 p. Y1 f, ^0 f- H$ I4 i
  155. createWorldDB()
    ! L/ x1 ]3 `- e) l/ k+ o
  156. {; |- c7 e9 }; \* w6 X1 F" w
  157.         printf "Creating World database ${wdb}\n"
    $ Y8 H8 W  H* c# w- N
  158.         $(${dbcommand} -e "Create database ${wdb}")) N) X: d3 k- @" Z# v9 N3 U( K
  159.   |4 d% O, m' Q! j1 {7 Z1 |
  160.         if [ "${loadworldDB}" = "YES" ]; then+ |' [* {, a& Z+ K" I
  161.                 loadWorldDB) D4 n5 p+ H+ l6 t: K
  162.         fi6 W$ S; @$ q. r9 A% f# j
  163. }/ l/ P6 o8 ~" W% E
  164. 8 Y: H8 ~6 ~; y& ~+ C" L( r( r2 [
  165. loadWorldDB()  r6 A8 v% b$ w+ k' x, o( x; p: S# o
  166. {! @* x5 P* u+ c- G2 g4 N
  167.         printf "Loading data into world database ${wdb}\n"! K1 D' P" R* l  k9 Y0 b
  168.         $(${dbcommand} ${wdb} < World/Setup/mangosdLoadDB.sql)
    , y$ w% q5 |+ \- B; {8 f% X
  169. / t8 ^2 Q" X5 B# E3 W# ~
  170.         if [ "${dbType}" = "POPULATED" ]; then
    1 H. n1 ^2 Z4 r9 C' w! z
  171.                 populateWorldDB  }7 I7 v2 O( O/ E1 V
  172.         fi
    7 _: v' ]1 @4 U( {- l" {
  173. }- z- X6 }7 R4 o6 g% ~6 ?
  174. 8 Z1 q& z3 G; \6 M5 N5 F9 f5 g
  175. populateWorldDB()
    : E: g9 C( q" R$ ~( u' l' i
  176. {( ]' w' Y7 m; S6 U! `
  177.         printf "Importing World database ${wdb}\n"$ K/ g3 W% i0 {5 Q
  178.         for file in $(ls World/Setup/FullDB/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ') % g* s& i+ B: L$ n
  179.         do6 m4 B; \/ q5 e* O) K/ @0 L
  180.                 file=$(echo ${file} | tr '|' ' ')
    0 h8 o" H% l5 p2 _, Z! Q
  181.                 printf "Importing file ${file}\n"" u+ n. j- }. I
  182.                 $(${dbcommand} ${wdb} < ${file})" J$ I1 K- v2 i" L! D4 C
  183.                 printf "File ${file} imported\n"9 R; l' v4 A- e( l! a' y% T
  184.         done
    0 G0 U; e/ i- s6 d: h& x! e

  185. 8 K- |& u3 c9 n
  186.         for file in $(ls World/Setup/FullDB/*.sql | tr ' ' '|' | tr '\n' ' ')   F; P$ g7 v' z4 Z  z3 |# C# `" [
  187.         do  I: I, I+ |9 S) X2 p7 E
  188.                 file=$(echo ${file} | tr '|' ' ')
    3 r+ |) f  R0 _( F
  189.                 printf "Importing file ${file}\n"2 m" a  B5 B% n7 a4 X5 B
  190.                 $(${dbcommand} ${wdb} < ${file})( N$ R/ _6 D. Z! Y  ^* @7 z
  191.                 printf "File ${file} imported\n", r2 {4 _. s2 ~! h+ f
  192.         done6 R, M% |3 A8 j+ m  b' u  S
  193. }
    & C5 {  g' C: [

  194. ; ^: X2 F5 F# a' s
  195. updateWorldDB()1 ?- \8 v  y1 b0 Z
  196. {
    3 N+ ?: i3 e1 y4 p
  197.     printf "Updating data into the World database ${wdb}\n", a" V7 w5 @. R  u5 ?- I, u; K
  198.     for file in World/Updates/${OLDRELEASE}/*.sql
    0 y3 R4 K; L7 h6 S$ w
  199.     do
    " @7 E" \; i+ F4 ]6 _; x# L
  200.         printf "Applying update ${file}\n"
    . H8 y" D+ Q: }6 f2 Q, o
  201.         ${dbcommand} "${wdb}" < "${file}"0 h% w% t' t6 U8 _! V% |# ^
  202.         printf "File ${file} imported\n"
    + W( w  N0 S- S0 s( l4 Y* y
  203.     done! k' y( k! t- r, M! H1 o3 g
  204. - R& z' w; J( d5 W, W* F+ h
  205.     for file in World/Updates/${RELEASE}/*.sql/ h& P  m" N3 T1 v! e0 I
  206.     do- y# u% d! w* b3 H- a9 v
  207.         printf "Applying update ${file}\n"4 m9 ], }  D% {3 E( q* D! J# r
  208.         ${dbcommand} "${wdb}" < "${file}"* H& `& g- v) i0 S9 D6 S
  209.         printf "File ${file} imported\n"
    5 @& m- F1 H9 S& \, w
  210.     done
    ; c* G3 p* x% v4 `, m) i! g
  211. }
    & V$ z/ O8 \4 b8 c7 ^% {% i

  212. 3 H" G6 r7 H2 P' u3 Z" E
  213. createRealmDB()
    8 n+ U4 c! S/ \  L' T- R& m
  214. {! Y# T- K1 R0 C6 L
  215.         printf "Creating realm database ${rdb}\n"
    . [. o+ R- [: p! b5 ?
  216.         $(${dbcommand} -e "Create database ${rdb}")! l: X/ A$ k4 J5 [  Z( c

  217. 2 i6 W4 O5 g/ G- V: [2 i
  218.         if [ "${loadrealmDB}" = "YES" ]; then2 j6 K2 T6 B' `( y8 _0 B
  219.                 loadRealmDB. @7 d* I7 O: |# I
  220.         fi
    1 F; K1 b/ e! O3 G& r3 @
  221. }
    ! M1 H6 c2 B7 d0 k/ w
  222. 4 k2 K+ C$ y8 ?8 E
  223. loadRealmDB()
    2 b9 K' o2 N) d
  224. {
    & U0 ~2 s; w3 ^" `+ ?+ _) \
  225.         printf "Loading data into realm database ${rdb}\n"       
    % f9 B, R; ^# Q( z$ O
  226.         $(${dbcommand} ${rdb} < Realm/Setup/realmdLoadDB.sql)  w4 k, t- h) N: x# t
  227. }
    2 n. \8 g. {- w$ R0 {1 _, M
  228. 7 C# W* e! K2 n4 g, Z+ F
  229. updateRealmDB()
    3 _: J1 r+ z% _9 t# T
  230. {
    * O6 |/ a7 ~( P0 c- Y) c3 _; i
  231.         printf "Updating data into the Realm database ${rdb}\n"3 t. t: x8 J5 p2 p
  232.         for file in $(ls Realm/Updates/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
    & ]4 c/ v% \3 o3 |
  233.         do
    ! D: M: ^" [9 k# x
  234.                 file=$(echo ${file} | tr '|' ' ')
    : b! Q9 @( i2 a) R, X$ Y" Y7 t1 R5 u
  235.                 printf "Applying update ${file}\n") l" {/ V$ O# Y& n
  236.                 $(${dbcommand} ${rdb} < ${file})
    % Q  r* G! u! B/ _3 i
  237.                 printf "File ${file} imported\n"5 B' q6 ]+ q+ c7 C) p- D
  238.         done( h# b' k  a% U( F% r# |

  239. ) x- o1 i" Z; j
  240.         for file in $(ls Realm/Updates/${RELEASE}/*.sql | tr ' ' '|' | tr '\n' ' '): q; u8 z0 X  m. a4 F% l' O
  241.         do& V0 a& Y/ u( F! `( g4 m5 g5 M
  242.                 file=$(echo ${file} | tr '|' ' '), @' Q4 D# e3 ^/ ]( v
  243.                 printf "Applying update ${file}\n"
    ; u  n4 a, V4 v, i8 {$ |* p4 l- w
  244.                 $(${dbcommand} ${rdb} < ${file})
      z; b) S* _# d  w/ z
  245.                 printf "File ${file} imported\n"
    6 T9 q% W* ?+ s; P! E; i& k, C
  246.         done
    + E$ B  ]5 S- L
  247. }
    : Z  `: V: L/ s, `  k

  248. ; {. X+ {/ M) S& l! ?3 h
  249. addRealmList()% a, {% s/ s5 I; W; U
  250. {& i7 Q& V, O( ]3 n0 ]3 o9 y; m
  251.         printf "Adding realm list entries\n"
    ( `8 j5 A; b8 U+ w
  252.         $(${dbcommand} ${rdb} < Tools/updateRealm.sql)
    8 l$ S. f; x3 a/ I- B. j' a
  253. }
    ( a  d- Y4 Q; X( k! \4 l; m
  254. ' ]3 ]# T% U3 A
  255. activity=""' k9 @4 m& w" J/ s$ C+ d' t

  256. # t5 o. p9 X* M: e- J. n/ U0 F# ?
  257. while getopts "suh" o; do
    6 \& D8 A" p/ ^7 f$ Q
  258.         case "${o}" in
    4 }; X5 @8 x' M6 I
  259.                 s)
    ( [0 b4 ~5 a. b- h9 G1 l' C
  260.                         activity="N". s, U2 ~; Y2 \7 z
  261.                         printf "You selected silent mode\n"
    + T: P& C7 \3 \" H) s( Y8 m8 M
  262.                         ;;  s, h  h: K3 O; S7 S% l* U! T
  263.                 u)
    8 A5 h- O( W" h& |: z2 c9 A
  264.                         createcharDB="NO"
      c" }* B7 O  N0 K
  265.                         createworldDB="NO"5 m/ ?+ p1 d/ H5 u" ^
  266.                         createrealmDB="NO"
      H9 N, }  R, K3 i* W

  267. & z, E; B/ k; F! h1 {5 H' N# Q
  268.                         loadcharDB="NO"+ B) q$ [9 `4 g& f
  269.                         loadworldDB="NO"5 v( Z- }0 k  v# Z* J8 `* _
  270.                         loadrealmDB="NO"$ Z9 a2 E# L$ x: D7 w, S/ T! y1 {
  271.                         dbType="EMPTY"
    2 v# l5 H5 E8 V5 d/ q8 u
  272.                         printf "You selected update only\n"' V7 q( `. L# e  `( d3 e3 T. p. }; |$ J
  273.                         ;;
    ! ]* Z2 ]3 _0 ?1 C) r
  274.                 d)8 i% U" H; y+ X6 c& c
  275.                         DUMP="YES"( Q2 g( x/ ^( Y2 v( k6 e2 r
  276.                         ;;& F9 k/ H8 b2 i4 u& v6 ~! H
  277.                 h)& r# b+ t( u' S7 L6 a. `! L3 Z
  278.                         printHelp. P/ x/ G$ m8 u& I8 o
  279.                         exit 05 w2 @/ j0 B9 ~
  280.                         ;;# o  y8 N. J6 l* z9 C
  281.         esac) c  {' c9 {3 y# K3 x2 K0 g
  282. done
    ) S- w% Y# |+ ?. @9 ]1 d- x+ I9 p

  283. # B2 m- A- }% Q) I
  284. while [ -z "${activity}" ] || [ "${activity}" != "N" ]& i3 U* ], O# ]) T
  285. do
    : z2 e" m( ^+ g7 `
  286.         printBanner
    % m7 V* i9 ?; V' p# [
  287.         printActivities
    ! G+ j0 g* S& q4 N, q5 \6 H& e
  288.         printf "Please select an activity : "2 m% O( H/ E% [9 |& q
  289.         read activity8 Y  W; J% w+ ~  T6 x6 W5 o- _6 J" U
  290.         activity=$(echo ${activity} | tr '[:lower:]' '[:upper:]' )9 c. S& f' [6 A  y& k* D! P/ ~
  291.         case ${activity} in
    . ?; ^0 o, e% w1 a- ~/ w. k7 R
  292.                 "V")
    # A: a2 O3 i% U+ L5 y. Y
  293.                         if [ "${createcharDB}" = "YES" ]; then+ }! C# D$ b  X  @
  294.                                 createcharDB="NO"' r( K! X7 Q0 v& ?, J6 I; C
  295.                         else
    2 B  y8 p( k8 l9 E
  296.                                 createcharDB="YES"
    ; F. ]+ ?$ d+ q# [
  297.                         fi3 e3 @, A$ ]& q. J# V) o' x* p8 }
  298.                         ;;- }0 g( h* f, P' ~
  299.                 "C")
    7 z* m, S+ `- p$ W
  300.                         if [ "${loadcharDB}" = "YES" ]; then; K5 P# H- x  d' K* T
  301.                                 loadcharDB="NO"( q: r5 D; Y6 a: O( w1 {6 f. x
  302.                         else
    3 L5 Y# j$ \* B  p) K- J
  303.                                 loadcharDB="YES"
    % W* I3 T) R3 x: D" _
  304.                         fi3 ^7 y) m) U$ e6 T
  305.                         ;;
    6 o( G, |; X9 {( M, q4 Y* t
  306.                 "B")3 j5 ~+ w1 h8 `2 b
  307.                         if [ "${updatecharDB}" = "YES" ]; then
    6 U7 e# R7 B0 j: t
  308.                                 updatecharDB="NO"
    0 `1 R/ f/ c! g, a( y* j& R
  309.                         else
    ; l/ f4 c) A; S, A& p: Z
  310.                                 updatecharDB="YES"! d3 B4 Q6 D. M* P, W: K
  311.                         fi
    / O, I0 h% l" C. X; a
  312.                         ;;$ e+ _0 a/ o+ U, b6 }2 b, S
  313.                 "E")
    9 {3 o/ g* _& q! A! Z
  314.                         if [ "${createworldDB}" = "YES" ]; then
    8 Y) ~: O2 f& E# ^7 |
  315.                                 createworldDB="NO"3 @1 Z2 d* q% ~7 `8 r: a- |) i; t- O
  316.                         else
    * [/ C% I! K6 V: e) M; d
  317.                                 createworldDB="YES"$ g) i& Z- ~$ ^) q+ x; C; m5 `
  318.                         fi       
    5 y3 W2 d9 J" `/ J2 e; `
  319.                         ;;
    5 ^# ]& a# a- h+ }
  320.                 "W")
    4 s& B( N* u: q8 d: O! ^' A0 T
  321.                         if [ "${loadworldDB}" = "YES" ]; then
    8 D& J. l) ?% P: P7 U: P
  322.                                 loadworldDB="NO". S; K- p' [# Z! R
  323.                         else
    3 ]6 A2 p0 c" }) K# u
  324.                                 loadworldDB="YES"! G- B2 O, Y- x* \& ~7 _
  325.                         fi        8 J1 V& i7 N( g
  326.                         ;;* x! L3 [0 `. d" ?8 H
  327.                 "D")
    2 \! m8 e. u- H0 O5 L- Z
  328.                         if [ "${dbType}" = "POPULATED" ]; then
    . O, P/ i4 S* R- U+ t; X2 E( W
  329.                                 dbType="EMPTY": {: W: Y7 G* t  C4 B
  330.                         else 7 y& M. e) g, _( g6 u+ z# j) J
  331.                                 dbType="POPULATED": F+ ]; E" [5 k3 R1 j, {
  332.                         fi                                 & _* n/ X) ~: T  {
  333.                         ;;
    7 D/ f( J1 i) ~- b6 g$ c1 ]6 [4 [
  334.                 "U")
    - N$ q$ E9 R" A3 G/ [: x
  335.                         if [ "${updateworldDB}" = "YES" ]; then
    . k& Y* c$ z5 W/ C. {* q* k
  336.                                 updateworldDB="NO") G- v5 f: H- T9 _4 c$ ?, w! ?
  337.                         else
    # V( D3 B5 Z% F: y; y2 `; |) z# z
  338.                                 updateworldDB="YES"
    5 B& q/ v' W; F0 ?$ t
  339.                         fi  w: i+ T% d9 e9 x: c
  340.                         ;;
    ! T' f8 k% c' L8 x6 [1 G
  341.                 "T")" a. e. f2 i* A5 M2 O3 N" T0 S0 }
  342.                         if [ "${createrealmDB}" = "YES" ]; then
    - ~* T; q$ q  o6 \' X- m" N
  343.                                 createrealmDB="NO"
    ' N8 I' j' ]' v  @9 G9 z# |
  344.                         else " x* @5 w, I# l+ p2 Q: r. V
  345.                                 createrealmDB="YES"
    7 F% o6 Y5 N. G5 e+ e  R
  346.                         fi                                 3 T3 p9 Q5 k6 _: |2 ^0 J& r
  347.                         ;;
    ' i/ C) K9 P/ Z
  348.                 "R")
    : Q& x+ }- Y5 \1 N3 M8 i' X# w
  349.                         if [ "${loadrealmDB}" = "YES" ]; then" h7 s  {# J& r! D2 [  b( w
  350.                                 loadrealmDB="NO"                        . H, [- Q( \" ^) `. w! Y2 P
  351.                         else $ R% d% t; p( p4 ~0 D  v
  352.                                 loadrealmDB="YES"
    * s$ [; F4 _; z3 K, u( Q" i  Z
  353.                         fi% W3 Q* I: x6 ]7 Q
  354.                         ;;
    / M: ~+ @8 m' ^# @3 _
  355.                 "Y")! S& C: S& K3 W
  356.                         if [ "${updaterealmDB}" = "YES" ]; then2 ?" j, P" f. r1 R: v8 I2 S4 H
  357.                                 updaterealmDB="NO"
    0 Z; O7 a: U+ P% x( M4 B+ y
  358.                         else
    ( j* q( X- m; v5 C
  359.                                 updaterealmDB="YES"
    2 j7 @5 a- T+ F, h  r& G# h
  360.                         fi
    & o6 }  ]: ?1 c0 u2 D, w
  361.                         ;;% R( A! ]" G& w1 \1 \
  362.                 "L")! F) Y4 f# ?2 r
  363.                         if [ "${addRealmList}" = "YES" ]; then
    - J7 V# P$ _: t
  364.                                 addRealmList="NO"
      t. c; P& t: l* Q
  365.                         else 8 k1 F5 n: o0 F, A$ z
  366.                                 addRealmList="YES"
    : z1 z+ m7 L4 f
  367.                         fi
    6 W: n2 g" L8 S& x1 {( o
  368.                         ;;
    " }, x, z) M& E  S; L% t* |
  369.                 "X")
    : U. n1 E! B4 w" M; P+ \/ T9 a! F
  370.                         exit 0;;
    . }+ X3 ?& ~+ f2 O  K6 [
  371.                 *)
    $ ~# _9 k! q* W- o
  372.                         printf "Invalid selection";;
    5 ^# {. ?6 h' I5 m8 M/ Z0 [
  373.         esac1 T1 w0 c0 i/ {5 ~1 F
  374. done$ P! h5 @+ l: ~: Z  p: Y

  375. ! T( z+ p/ U4 R' N
  376. printBanner7 p; {3 o( {/ v% t2 J9 S7 K# X. Y% ?( G) U
  377. determineDBName
    : w. F! A  T& O0 Z. h# h4 Y2 b
  378. printf "What is your ${dbname} host name ?\t[${svr_def}]: "1 N9 T) W" n5 j! M! c. ~
  379. read svr1 ~' W) H0 j% e! O' s) s6 @1 y
  380. svr=${svr:-${svr_def}}2 L4 d7 f8 {- c. h0 X$ E1 Q% H
  381. printf "What is your ${dbname} user name ?\t[${user_def}]: "* }) Q9 U# r# C+ _0 Z! H
  382. read user- ?8 u: ]* Q$ y) w/ }
  383. user=${user:-${user_def}}
    9 }3 E# Q7 c2 Z$ S5 u* E
  384. printf "What is your ${dbname} port ?\t[${port_def}]: "7 u( `, T% p0 R
  385. read port
    & B* A1 |0 K$ |4 z8 O5 c. A
  386. port=${port:-${port_def}}1 W9 ]+ ?. F6 W8 T
  387. if [ $dbname = "MariaDB" ]; then" k7 h( a3 U9 F: D( w
  388.         printf "What is your ${dbname} password ?\t []: "
    ; u% l1 r. W! l, n: |6 z3 A
  389.         read pass
    8 _- E( C4 ]0 v, L0 y+ n8 M* Y2 z
  390.         pass=${pass:-${pass_def}}: m% d5 Y. b* n5 g" w& Q6 |
  391. elif [ $dbname = "MySQL" ]; then
    2 U) ]1 e1 m" ~  a3 l
  392.         mysqlconfigeditor
    7 _1 b. e7 V5 [( _. i; a& _* D( V. _
  393.         $dbconfig
    1 c" i) o; h( h# _# R3 x% G! D  i% m
  394. fi
    - `6 g- n) ^9 r+ W9 f$ Y
  395. determineDBCommand
    + i: t5 e- ~7 o) P: X! f5 X: t4 `
  396. 9 |9 {! ], h$ k) l& t  E
  397. if [ "${DUMP}" = "YES" ]; then
    " D; \# y. ]) P; B! o6 K* R: W* w
  398.         printf "Enter it again \t[]: "$ ?* k) M' D, O+ R+ \
  399.         read pass
    ( @0 m+ q# v5 |7 x' S! U
  400. fi
    5 n  A6 }! J; @3 z' n+ e+ `7 N
  401. & C. H& Q3 j" D2 T2 z6 L
  402. if [ "${createcharDB}" = "YES" ] || [ "${loadcharDB}" = "YES" ] || [ "${updatecharDB}" = "YES" ]; then; g- N6 C+ m/ a+ R
  403.         printf "What is your Character database name ?\t[${cdb_def}]: "/ F) a& B2 x* Y- y
  404.         read cdb
    . ?8 [" {8 k. b6 L5 K2 w* l
  405.         cdb=${cdb:-${cdb_def}}
    7 C/ p5 x+ n6 _4 `. U7 V" }$ P
  406. fi3 C% g9 F- H+ `

  407. 0 _5 r0 x# f: o; [& u9 p
  408. if [ "${createworldDB}" = "YES" ] || [ "${loadworldDB}" = "YES" ] || [ "${updateworldDB}" = "YES" ]; then
    6 y* g( c/ Z4 }; O  N
  409.         printf "What is your World database name ?\t[${wdb_def}]: "
    9 e4 d9 ]: [4 _, |+ k8 k7 q
  410.         read wdb" f8 b) U0 [8 N' z% N& R# C- x
  411.         wdb=${wdb:-${wdb_def}}7 o) M! f% K* M* E. _
  412. fi
    ; u* i' o: L  C
  413. ! g5 ^% {5 s2 {* ]8 N
  414. if [ "${createrealmDB}" = "YES" ] || [ "${loadrealmDB}" = "YES" ] || [ "${updaterealmDB}" = "YES" ] || [ "${addRealmList}" = "YES" ]; then! d5 C. K% h3 \' F1 e, }
  415.         printf "What is your Realm database name ?\t[${rdb_def}]: "
    * P/ O8 Z5 P. {9 J- f9 M/ p, [/ J/ {$ \
  416.         read rdb; y1 }4 ?% H: w. _  z9 A
  417.         rdb=${rdb:-${rdb_def}}
    6 Z* e( T. r. N9 P/ q* M1 m
  418. fi
    . x  c  I5 K" u& c! Q/ B7 D
  419. ( i$ N( \7 \5 x1 X5 ~1 U
  420. if [ "${createcharDB}" = "YES" ]; then& [+ \0 g* c) Q+ W
  421.         createCharDB
    6 s+ ~7 O! X% s4 U7 x
  422. fi
    % {& o% l* S* I% j" \3 A

  423. ; T) U1 N, ?( N/ W( R
  424. if [ "${createworldDB}" = "YES" ]; then8 N& F3 V$ f2 C! Q
  425.         createWorldDB4 A% T- Z$ q8 v0 j6 F2 m
  426. fi
    + a  j/ A$ P% L

  427.   T2 o3 d. M) [
  428. if [ "${createrealmDB}" = "YES" ]; then
    8 ^' G0 F2 F3 V
  429.         createRealmDB) c- o2 ]% t( I6 J* P
  430. fi
    3 H% g/ \' W8 l4 }# A4 G. @5 z( p' c
  431. * y3 e3 a0 [& U, _
  432. if [ "${updateworldDB}" = "YES" ]; then$ F4 @7 f2 y2 S
  433.         updateWorldDB9 D( k# d# w7 v% Y) u. T4 t3 q
  434. fi; n8 I: n* [. ~* x, d# Z$ w9 G

  435. . @( A7 T* o1 b: X4 q
  436. if [ "${updaterealmDB}" = "YES" ]; then
    0 X7 O& P2 \5 a1 g
  437.         updateRealmDB
    ' u8 W. g2 }( g' ?5 r! Q* L
  438. fi
    + w4 \( M) o% a! M1 I0 A2 K# o

  439. " a% }( S  n0 z  g1 _
  440. if [ "${addRealmList}" = "YES" ]; then
    - U7 s( V6 l1 T1 s7 ^
  441.         addRealmList" ?5 Q& y  T0 n/ ^3 N$ U5 H) P
  442. fi1 ?6 F- D2 A( c' ?! Q9 B% P3 c
  443. # G& ?% }% z& b, B
  444. if [ "${DUMP}" = "YES" ]; then. `) W& I( j) Q) k2 `+ s
  445.         printf "Dumping database information...\n"
    , [: l  H- d: ^$ Q' V% n
  446.         echo "${svr};${port};${user};${pass};${rdb}" > ~/db.conf
    - @0 y. c/ L6 J! b
  447.         echo "${svr};${port};${user};${pass};${wdb}" >> ~/db.conf
    . W7 {2 X4 B& ^, m
  448.         echo "${svr};${port};${user};${pass};${cdb}" >> ~/db.conf+ l: e" q, |, A
  449. fi( b# {" U2 N1 g4 \0 w: d4 Z+ {( Z1 a

  450. $ g0 U6 d; M0 |0 P9 E
  451. printBanner7 w. R0 c# Y* P
  452. printf "Database creation and load complete :-)\n"2 _# ?/ {: \; O7 H: J7 G( A) y  C
  453. printf "\n"
复制代码

5 R% G( `& V3 W! m1 e: r
回复

使用道具 举报

986

主题

92

回帖

5万

积分

管理员

积分
55255
 楼主| 发表于 2022-7-29 17:24:34 | 显示全部楼层
Playerbot AI 命令
6 X  G& y3 [$ {+ n
( X; N0 o. G: Q7 w( _) F& e使用 Playerbot 密钥的指南:
" u- C, x0 r3 U3 D/ w
1 _) \& l. X4 d! [标识符说明6 |9 N5 Z" A1 |4 l" y
机器人名称    机器人的名称
, ~# ?! K# N& w* P1 {) `. t9 t朋友    命名机器人或玩家角色
3 m2 F( u( f0 N/ L9 y5 F2 f目标    选择目标玩家、尸体或NPC(非玩家角色)" ?# ?: Q8 u: m* B
|    逻辑或  M  r5 T0 S+ s
&    逻辑与
0 O6 v+ P9 e- W7 S..    多个实例' g5 N: q+ {8 Z8 l$ G: D
/命令    MARCO 命令( [+ B* E7 ?5 V2 _1 }
/s    聊天:说
/ ~% C; W! J5 Z( g( a! V/p    聊天派对, S, Y! o% J! K% J3 h, O9 M5 R
/t 机器人名称    聊天:TELL BOTNAME
3 |' M& @0 n7 O) I/w 机器人名称    聊天:告诉 BOTNAME
( \: J: s8 m+ A. s0 @: e- l' i! ^<名称链接>    名字=
, t3 _: J! A+ g' [* @2 W(捷径)    为命令或子命令分配快捷方式
! r7 |0 S" v% F
: l0 a3 m: ^1 O; E- N可用 PlayerBot AI 命令的完整列表 SAY 命令:语法说明0 [" |  W5 c  G* w& c3 C
.bot 添加 BOTBNAME    为世界添加角色: ]* |  Y- q% m5 h/ V/ h* F+ k% u
.bot 删除 BOTNAME    从世界中删除角色
* S; B' G  K1 R+ i  U  D. x( @  U6 P3 V
当前仅与以下 playerbot 代码一起使用:portalzero 和 portalclassic(所有其他代码使用新修订的“命令战斗”命令来设置机器人角色)
- j& N; _  y( |* i.bot < co | 战斗命令 > BOTNAME    分配机器人角色4 Q; _# I9 a% \; ]2 B2 u

1 s4 K3 M6 @- z, G宏命令:/ f, ^& J9 Y( g. Z- W; q5 u" ]
句法    描述
9 G* [, Y4 T/ b/邀请机器人名称    机器人将自动接受聚会邀请
2 t& l4 ^1 V+ G. v9 U/uninvite BOTNAME    机器人将自动接受派对不邀请
! [, i- G& Q; ~/ r$ c8 P; d( C" m" r, E) x
TELL/PARTY 命令:(某些命令可能不适用于某些内核)
* ?5 W0 K2 J8 P- q) g0 |句法    描述
$ W! _) x; Y0 ~协助目标    机器人协助列出的角色,在他们攻击时进行攻击。' I1 r% I* {. ?
攻击目标    命令机器人攻击选定的目标,类似于宠物可以攻击的方式
: M* x3 f1 j* \# U2 m5 W/ }" Y8 O) j拍卖    命令机器人寻找附近的拍卖师并显示机器人的活动 1< Auction LINK >..6 a' \! L; S& n& w5 K
拍卖 (a)add 1< ItemLINK >..    命令机器人寻找附近的拍卖师并添加 1< ItemLINK >..
: i9 M2 N! R+ H3 m2 w! z拍卖 (r)emove 1< 拍卖链接 >..    命令机器人寻找附近的拍卖师并删除 1< Auction LINK >..$ ~2 v0 U- D* K) A
银行    命令机器人寻找附近的银行家并列出机器人的银行余额
+ k$ R; g( M. p5 g银行 (d)eposit 1< ItemLINK >..    命令机器人寻找附近的银行家并将 1< ItemLINK >.. 存入银行0 T- x: p+ s8 ]. x
银行 (w)withdraw 1< 项目链接 >..    命令机器人寻找附近的银行家并从银行提取 1< ItemLINK >..
+ T- N: C- P. @* b% m; t  K(b)uy 1< 项目链接 >..    命令机器人寻找附近的供应商并购买 1< ItemLINK >..
/ B: a6 @7 t4 b6 R9 j9 _©ast SPELL    拼写 = >
, D, v& q: k* {9 ]搜集    显示收集对象选项和当前收集状态' d. f; k4 S  l3 J) W; d
收集对象    设置收集状态,OBJECT = <所有非战斗战利品对象职业任务>- H3 e; q! X5 ]' D
工艺1<配方链接>..    如果机器人知道,则创建所有列出的食谱
+ ?; c+ ~3 O% D* s9 f  G工艺1<配方链接>全部    如果机器人知道,则创建一个配方的多个实例9 C, c/ B' c/ s7 T
工艺(a)炼金术    显示所有炼金术配方 1< 配方链接 >,如果由机器人学习) D0 p+ n1 @+ }" a5 j! \
工艺(b)锻造    显示所有锻造配方 1< 配方链接 >,如果由机器人学习
) n- o0 v1 J" G- S工艺(c)烹饪    显示所有烹饪食谱 1< 食谱链接 >,如果由机器人学习
& c: R# j( t9 h( @- M工艺(电子)工程    显示所有工程配方 1< 配方链接 >,如果通过机器人学习5 m+ A# A8 F& N5 O: {) j- N, M
工艺(f)irstaid    显示所有急救食谱 1< 食谱链接 >,如果由机器人学习* F* U3 c1 A) ~  f( H, S4 a
工艺(i)题字    显示所有铭文配方 1< 配方链接 >,如果通过机器人学习% j& C) \% M7 y* o4 U  V* ~6 A% F
工艺 (j)ewelcrafting    显示所有珠宝制作配方 1< 配方链接 >,如果由机器人学习1 L9 l4 z2 O. C& d* e5 V7 o
手工艺 (l) 皮革加工    显示所有制革配方 1< 配方链接 >,如果由机器人学习* Z6 H( b( k2 v$ X& N, T2 a
工艺(m)魔法    显示所有可制作的附魔(例如魔杖等)recipes1<recipe LINK>,如果由机器人学习# I6 ]( H3 k$ P$ n: C+ k
工艺熔化    显示所有矿石冶炼配方 1< 配方链接 >,如果由机器人学习9 k  z/ V  J  y# o; w4 }
工艺(t)裁缝    显示所有裁缝配方 1< 配方链接 >,如果由机器人学习6 N$ n6 f, t- V: g! ]
掉落 1< 物品链接 >..    命令机器人掉落并销毁指定物品 1<Item LINK>..
* w& j" P$ d) [全部放弃    当机器人库存变满时,丢弃所有低级物品。) L6 J; S  P& k7 T( l. c: Y% i7 c
附魔    列出机器人学习的所有结界 1< Spell LINK >
% u2 M& }! N2 `' {. Z# R/ x) m附魔1<法术链接>..    附魔选择可交易 1< 物品链接 > 装备或包中
- K6 [- |  A6 a' |% A/ G8 H' e(e)quip 1< 物品链接 >..    从它的库存中为机器人配备容器、武器、盔甲和小饰品
9 W( B1 i* u5 o3 c8 y( N  l* M8 l(e)quip auto on    打开自动装备,也立即检查- m$ L$ a% t7 V6 K! y
(e) 装备自动关闭    关闭自动装备。
# X; X% ^5 K& T8 e  n9 o(e)quip auto 一次    运行一次自动装备,然后将其关闭。
5 l+ ?" E. H; r(e)quip 信息    显示装备自动切换状态(开/关)。8 c  c0 w! W% K$ L
(f)ind 1< 游戏对象链接 >    命令机器人定位 1< Gameobject LINK > 然后等待。对任务目标有用
: J9 i$ J/ }. |7 c8 d& }! D7 r跟随    命令机器人跟随玩家;如果死了也会复活机器人,如果很远也会传送机器人
/ a( H- C1 X* X: |  |% A跟随汽车    切换自动跟随距离(开/关)$ S9 l: B% I' z/ X  c4 z/ n
关注信息    显示机器人当前的自动跟随距离,切换状态(开/关)
5 {$ l# f' [  f0 M跟着远    机器人跟随,远离主人。
/ z# F* m3 R: ], Y. v跟随附近    机器人跟随,更接近主人
" U  s& x) g9 Q5 B) [* ]( d9 Z1 p% X跟随重置    机器人跟随距离重置为原始默认值( a# n' i2 |9 C% l) e
(g)et 1< GameobjectLINK >..    获取选中的 1< Gameobject LINK >.. 然后返回给玩家% x% C0 y( S4 s" K/ P' R
订单    显示机器人的战斗命令
* X+ q. Z+ C. z0 }+ X2 f订单延迟<0-10>    在机器人开始战斗之前激活延迟。
7 u( ^0 U) g" T命令战斗 ASSIST FRIEND    协助链接的友方目标,集中我们的杀伤力。; S9 j  L) J+ C- n/ O
命令战斗治疗    命令机器人治愈。最好用于萨满、牧师、德鲁伊或圣骑士。
. ^1 n! s$ @: {$ i0 T命令战斗保护朋友    保护列出的友方目标,试图让仇恨远离目标。
: u: R) S4 o1 _: O9 n) Z命令战斗坦克    命令机器人坦克。最适用于圣骑士、战士、德鲁伊或死亡骑士。8 u$ h/ {( \; k. T
命令战斗RESET    重置机器人战斗命令,就好像他们根本没有下达过一样。
( C% }7 K) Y: W订单恢复    将战斗命令恢复到注销前的状态。  S4 f5 x0 W7 ~3 i4 n" e. y( R5 q& d
邮件收件箱 1< MailboxLINK >    列出来自选定 1<Mailbox LINK> 的所有机器人邮件。邮件按 1< 邮件 ID > 索引。# N6 q8 W% d* ~" J6 G$ p3 ]
mail getcash 1<邮件ID>..    从所有选定的 1< 邮件 ID > 中获取资金..
: h' {+ i; `/ V/ E邮件getitem 1<邮件ID>..    从所有选定的 1<Mail ID> 中获取项目..* D& x9 E5 Q1 r' {: |
邮件删除1<邮件ID>..    删除所有选定的 1< Mail ID >..
$ r/ p7 {! T- N7 G宠物遗弃    放弃活跃的猎人宠物。! n# N  Y+ K# k% \2 [4 e# ]2 _9 q0 ]0 \
宠物驯服目标    驯服选定的生物,如果机器人在法术书中有“驯服野兽”法术( G4 I* x% W$ {
宠物法术    显示 bot 的宠物已知的法术。自动施法法术将显示为绿色" L0 |+ }& H1 r. ^0 [
宠物施放法术    拼写 = >4 G9 S+ D/ j1 J$ b$ R
宠物切换法术    SPELL = >为给定的法术切换自动施法
) Z6 @/ Y0 J: I宠物状态    显示机器人宠物的当前反应模式) ^/ }$ q* ^, v5 L6 k
宠物反应模式    模式 = <(a) 激进 | (d)防御性| (p)被动>
9 ^' q# x6 Y6 d# X+ n% i过程 (d)isenchant1< 物品链接 >..    分解绿色 1< 物品链接 > 或更好的8 K2 X2 H. e$ `9 _7 l
处理 (m)ill 1< ItemLINK >..    研磨 5 种药草 1< 物品链接 > 以产生色素
) U3 x9 ?, ?& _9 z$ e过程(p)前景1<项目链接>..    搜索 5 个金属矿石 1< 物品链接 > 寻找珍贵的宝石+ O6 Y5 y; [/ v) o6 g
拉目标    以协调的队伍/袭击方式拉动目标。
0 Z& z! V9 p/ f4 }3 g拉力测试    机器人会告诉您它们是否可以拉动(可以在任何地方使用)。
( R) j4 O' B$ |* f) E% z* f2 r准备就绪    机器人会告诉您它们是否准备好立即拉动(在具有有效目标的位置上使用)。1 U; \( g7 T: T* Q
寻求    列出机器人当前的任务
0 N/ v! d" N. A) M8 ~quest (a)dd 1< QuestLINK >..    命令机器人寻找附近的 questgiver 并添加 1< Quest LINK >..
* p8 D8 I+ c) Y$ e2 bquest (d)rop 1< QuestLINK >    命令机器人放弃 1< 任务链接 >/ _' ~7 p. S0 d
追求 (e)nd    命令机器人寻找附近的任务提供者并上交所有相关的已完成任务$ N; k, s8 h+ f7 h: [$ X$ e5 }
寻求(r)报告    报告机器人完成任务所需的所有物品、生物或游戏对象
% e* _7 H7 {* r% J: [* Y+ x1 H任务(l)列表    命令机器人寻找任务提供者并显示新的可用 1< 任务链接 >... p8 U' I5 X$ R9 v2 _1 G2 t
quest (c)完成 1< Quest LINK >    自动完成(GM 批准)任务,可在数据库中找到
) z+ p5 I4 @- _& `修复1<项目链接>..    命令 bot 寻找附近的 armourer 并修复选定的 1<Item LINK>..+ C& p( O& d% h: N' I
全部修复    命令机器人寻找附近的装甲师并修理所有损坏的装备或包中的物品4 [, B8 X/ B- e8 g
重置    重置状态、命令和战利品清单
: {$ B2 o; ^, ?5 t+ v8 C(s)ell 1<项目链接>..    命令机器人寻找附近的供应商并出售 1< ItemLINK >..
$ A" m: D. ?$ p5 `) u& v% V7 [(s)卖掉所有    所有低级白色物品的一次性销售(命令不会持续)。* M! ^4 a7 _  N- V1 O
技能    列出 bot(s) 1< Profession LINK >.. 主要职业和武器技能
: K1 s! S/ t9 E4 P2 w* ]: _; y技能 (l) 获得    命令机器人寻找附近的培训师并列出可用的 1< 培训链接 >..
$ M- g8 D$ B% P技能 (l) 获得 1< 训练链接 >..    命令 bot 寻找附近的教练并学习 1< TrainingLINK >..
0 A1 U3 |/ L% l0 N0 W技能 (u)nlearn 1< 职业链接 >    命令机器人在附近寻找训练师并忘记 1< 职业链接 > 和相关法术
; M: c# w$ v# b3 j3 f/ g咒语    显示机器人已知的所有法术
( j& K- p- a& n% |0 Y% J, ~  r统计数据    显示机器人可用资金、可用库存空间和估计的项目维修成本
& `' j6 F" V3 C* I0 ?; O% W$ \停留    命令机器人站立而不跟随玩家
3 L4 ?1 T! D; p, I" G, y0 `召唤    玩家附近的传送机器人
) q; r4 j" Y) h' y& f. ^6 c- m民意调查    在机器人周围的局部范围内显示所有可用的 1< Gameobject LINK >..
, z6 o# D2 w5 F1 e9 V使用 1< 项目链接 >..    使用物品(例如食物、饮料等), ^) X  _( R( u" {" `0 B5 Z2 c
使用 1< 项目链接 >TARGET    在目标上使用物品(例如任务物品)
  F' t: S* {' [# \' e2 B' n句法    描述
8 K$ X6 N5 Z+ a* ]2 L7 C; M天赋    列出机器人 1< Talent LINK >.. & 1< Glyph LINK >..,未使用的天赋点数和重置所有天赋的费用
+ ~' Z5 a# w4 ~9 I4 \人才学习1<人才链接>..    为 bot 选项卡或 1< TalentLINK >..â†'talent> 学习选定的天赋
# o. y3 Q2 n+ |9 U, m. i天赋重置    命令机器人寻找附近的班级教练并重置所有天赋2
& s- i+ _0 l. C7 ~8 S! v人才规格    列出机器人可以使用的所有天赋规格(编号为 #)。" _; b" q" @/ [. L. x
天赋规格#    机器人将遵循此天赋规范。. ]2 V% |" S! {) l$ z

4 R" x. h8 }9 W# {) ~1 要选择 , 。
. G3 v/ i: o8 [$ K, n% S" b! ^: \2 每个机器人的税收增加,每次重置天赋。( M5 W6 S( R# d

8 r/ g. @! X# c9 ?7 B1 M  R; E5 i. G" |+ G" ?
回复

使用道具 举报

986

主题

92

回帖

5万

积分

管理员

积分
55255
 楼主| 发表于 2022-7-30 08:33:50 | 显示全部楼层

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)7 L! D2 S  t) d, j9 t5 X

5 l% J+ v- R  a8 ^& s1. Make a folder for ACE in your preferred location ( I use /opt)
# E0 G# P! J5 A/ K; w; F0 w
7 K/ [% [5 j( Q+ Nmkdir /opt/ace && cd /opt/ace8 g3 E1 v% n6 a- Q3 `
1 [4 h# a% y+ A- Q' [+ o9 d
2. Download and unpack ACE6 O; V* Z8 [! g; [

$ i6 Z0 H/ C% m- \, @8 Dwget http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.7.tar.gz7 e  o& S6 u8 |' v: \" q" [
tar -xvf ACE-6.4.7.tar.gz
0 T7 S! T; W0 m- ?. b% P" ?8 B' c
8 X" H6 X2 D- C$ g5 r) Y3. Add needed environment variables
& ^& F0 f+ G" S9 N' X9 C: I, ^
* H' R1 v8 [/ Dcat >> /etc/profile <<EOF2 C3 Z2 g+ j2 d8 U2 j
export ACE_ROOT=/opt/ace/ACE_wrappers* ?: w( R9 m0 \, c. d' C
EOF
2 r& J* S+ l5 q2 Csource /etc/profile

* y* e* T  z* D& W$ }. s* y5 K- `( w$ P$ Y; m* y. a2 |. L
4. Add the desired headers# r3 d) V$ D, j3 B" n! ^. Z
" }/ _& h7 @2 q4 W; s
cat > /opt/ace/ACE_wrappers/ace/config.h <<EOF  m: F3 i+ ?! f3 `
#include "ace/config-linux.h"
# }- g2 g4 l4 [# @! b% `: oEOF
3 N# F2 ~" F+ [; @% @- L0 N3 ycat > /opt/ace/ACE_wrappers/include/makeinclude/platform_macros.GNU <<EOF$ v  R4 t' X7 q! _- z, N# U
INSTALL_PREFIX = /usr/local+ Y+ |& ^* J- V$ v
include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU$ _$ N* ?7 N$ ?5 @
EOF

9 L  O& \* d  r1 R
! n* U/ G% J  e) p, C8 r5 F5. Build ACE& k) s' [' H1 c1 t1 @; Q
) C- u/ {( x) ~' l2 x7 m  l' l
cd /opt/ace/ACE_wrappers
, K" l) Y, a+ d: M% R3 tmake7 g. e' _- |+ q  f+ o( w( K/ [
make install

" x: n, Z9 S: T7 ^
( A' i+ }0 K: g$ Z1 L2 j6. Add the library to the public path; I& e  J! K# F: T7 C

. \: @( u5 N2 L+ hcat > /etc/ld.so.conf.d/ace.conf <<EOF
$ v' n( L& _/ [3 ?! o/opt/ace/ACE_wrappers/lib& o& s: w: I' V. P: ]  `! j
EOF
  z, U/ W; c& Z- @( P8 x" n0 jldconfig -v

3 a- _% [5 L4 h* o6 O/ e
回复

使用道具 举报

986

主题

92

回帖

5万

积分

管理员

积分
55255
 楼主| 发表于 2022-7-30 09:58:27 | 显示全部楼层
/home/mangos/two/src/server/src/game
回复

使用道具 举报

986

主题

92

回帖

5万

积分

管理员

积分
55255
 楼主| 发表于 2022-7-30 11:10:41 | 显示全部楼层
回复

使用道具 举报

986

主题

92

回帖

5万

积分

管理员

积分
55255
 楼主| 发表于 2022-7-30 13:54:45 | 显示全部楼层
Download WoW Wotlk 3.3.5 Client- {& F; r# m. D0 a) D( K
Torrent Download
1 x3 {4 e: [7 j& U+ y
+ e) O+ q. v$ A$ n) |; W1 vThese 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  M& V5 k' x+ Z1 L3 L
* _# d8 F3 H& B" s1 d, t9 H1 n! A
    Torrent – Client from Dalaran WoW (Recommended)$ x- N( U3 s4 M
    Torrent– Client from Sunwell (Recommended – Fast torrent download, due to a lot of seeds)
1 k' c9 ~9 q8 _; N. Y4 e/ k% u    Magnet – Client from TrueWoW
5 o( @& A% }, q& O7 @! ~8 z% u  ]/ G' M* K
Direct Download# A3 B, {4 v5 u( C% G
) j% W8 }9 I4 D, K! u
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.: L$ v: x( q* [+ s* J) b, B* ^

( n( E' D2 b4 m, A/ d0 E    Direct – English Windows client2 D9 j! L8 j2 J
* O4 e/ w. [1 @7 }/ }9 H
3.3.5 Wotlk MacOS Client
% z) H4 [$ a: i, R
/ b* v5 K  _( t) T+ f; yThe 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.% O. |- h# ~+ H- Q! D

2 j5 b( F4 d( C) D. E. @    Direct 3.3.5 MacOS Download – Client from Sunwell* B' B: r9 t' P, r
    Direct – Client from Paragon-Servers (French)(Mac)/ h7 r/ W" n# V, Z" d
4 z, f1 U' X. M
Modified Clients, LegionRemaster:1 Z9 Y% A" r) k# ^) b2 {9 c$ R0 ^

" \! I1 |% ^8 q& n# T+ v    3.3.5 LegionRemaster Torrent – From Sunwell and Finsternis
2 G/ i8 c: i  ?/ A    LegionRemaster Patch (modified)
5 K! I) U# M7 T6 a/ i; k9 e    LegionRemaster ReadMe (Custom) 9 K, l! x# [( Y
https://zremax.com/blog/wotlk-3- ... e-lich-king-client/
回复

使用道具 举报

986

主题

92

回帖

5万

积分

管理员

积分
55255
 楼主| 发表于 2022-7-31 00:24:58 | 显示全部楼层
开源的魔兽世界 Mangos
2 Z( r% p" f- h- w4 t
  W# D8 q) ]8 d. F& i, B# M在sourceforge上开发的 (Ma ssive N etwork G ame O bject S erver) 项目是基于GPL协议的。据说是和魔兽世界独立无关的网络游戏服务器引擎程序。游戏的内容部分(数据库内容)又是由独立的小组开发的,这样也许避免了很多 法律上的问题。但是大多数魔兽世界的盈利的私服都是基于这个开源的项目的,为此开发小组表示这样盈利性质的服务器和对他们项目的使用是违背协议和非法的。5 n9 P1 N. ]3 G' X; f
+ H1 Z" @- s2 ]: t1 p8 ]
本文 是对mangos作了一个粗略的介绍,并且使用了魔兽世界的客户端对mangos作了一些测试。6 ]' m) `; V: n- J# G8 |- v

) O0 G0 i9 K3 b! [正文如下:
5 V# X' M0 L& U1 p8 l( s5 V& w& w2 w( v: O2 y, r6 I. `
开源社区常常有很多出人意表的项目,让人往往击节叹赏。例如当年在普通PC电脑上虚拟运行苹果机系统的 。把微软游戏机xbox改装成家庭影音中心的 ,以及在ipod上安装linux的 等项目。在电脑游戏方面当然也有很多出色的开源项目。% y5 E. C" k" D, {: l
. n5 ~- D. c" y
暴雪公司的游戏历来都是精品。网络游戏大热以后,它推出的基于10年游戏历史的网游:《魔兽世界》也更是名声在外(当然有好有坏,坏名声在于它太吸引 人以致 于很多人沉湎其中)。网络游戏的盈利模式和传统电脑游戏不同,月费和其他的周边产品使得其赢利空间远远大于传统电脑游戏。对于网游运营商来说很大的一个问 题是私服的问题。很多私服的软件是从网游开发公司或者运营公司内部非法的流出来的,比如说网游《仙境传说》的私服。
1 M1 i7 H- p* U) h; E
0 _. {& W. s1 @" I0 i而现在大多数魔兽世界 的“私服”实际上是服务端软件的模拟器。是在对客户端游戏软件和与服务端的进行通信的数据进行分析解密以后,开发出来的模拟原游戏服务器功能的软件,这样 的模拟器软件大都也是开源软件。比如像现在大部分魔兽私服使用的Mangos服务端软件,mangos项目是一个开源的自由软件(如同linux或者 firefox),并且遵守其中最为严格的GPL协议。
; t$ L, U1 P) C) n* [: u  s* m$ m: o4 v$ {) S
  MaNGOS 是(Ma ssive N etwork G ame O bject S erver) 的缩写。由于暴雪公司对类似的开发小组采取过一些法律行动。为了避免麻烦,如同它的名字,mangos强调自己并非一个魔兽服务器模拟器,而是一个开源的 多人在线游戏服务器的软件。说到底是个网游的游戏引擎。Mangos开发小组强调其软件是用c++和C#编程语言,实现 的一个支持大型多人在线角色扮演游戏服务器的程序框架,在这个框架下,它理论上应该支持任何客户端的网络游戏,由于现在很多人使用魔兽世界来对它进行测 试,所以针对魔兽世界的脚本和数据库文件比较完善,很多人就利用这个开源项目来实现魔兽私服。而游戏的内容,例如故事情节,任务场景的脚本等都是由别的小 组独立开发的。$ ]* x, w8 d5 R% M

3 j- v5 X/ z+ r" m7 V. h开发小组一再强调,这是个研究,教育性质的对怎样开发大型网游的服务器端有好处的项目,是一个技术细节毫无保留向公众开放的软件,是一件很有 意义的事情,如果你使用它作为盈利目的,那你本身就违反了软件的协议。所以任何利用mangos项目进行私服活动的组织和个人都违反了mangos的宗 旨,mangos项目也不会对它们负责。
+ U( C3 C# h' h6 V! m) w( y9 @# r
mangos的技术细节上是这样的,核心部分是个和特定游戏没有关系的核心框架程序,主要是进行进程调度,创造世界,建立心跳机制,处理网络接入 等。数据库可以使用的开源数据库软件MySQL。至于游戏内容数据库,游戏人物,时间,世界脚本,都是由这个核心程序所支持的扩展 脚本来实现,所以有一些独立出来的项目专门模拟魔兽世界来开发支持mangos的核心程序。现在mangos的核心程序已经放到著名的协同开发网站 sourceforge上开发了,使用的开发工具是subversion。大家都可以从sourceforge的subversion数据库中下载最新的 源代码程序。. t1 e& _7 J9 x" b& G' K

, u7 S8 b0 o  Z' f2 ]) h8 @: U5 i! C  q1 c0 G, R/ g
为了测试这个Mangos我自己安装了一个测试了以下,自己对魔兽世界的游戏本身没有太多的了解,请了几个玩过魔兽世界的朋友测试了一下,都说各方面 已经很 完美了。最新的Mangos项目已经支持了魔兽世界的扩展版“燃烧的远征”,简称TBC,对应的魔兽客户端版本到了2.0以上。以下的安装测试步骤适用于 魔兽世界客户端1.12.x的版本。
& P6 L1 Z7 x) p1 ~2 }- W# i% F1 ^, n7 D( @5 `4 J: M1 i* H! u
一、安装需求:
  • 操作系统Windows Xp,解压软件推荐 。(mangos论坛上有人在linux,macosx上安装,为了提取地图方便这里使用windows XP)
  • 魔兽世界的客户端软件,升级到1.12.1版本以上。
  • 编译好的Mangos二进制文件。(你也可以自己编译,我这里提供的是Mangos Rev 3462,3462是开发数据库的版本号),下载地址:
    8 [# B5 H* U3 \% m) W9 _. k
  • 地图提取工具ad.exe(这个地图提取工具是专门针对1.12.x版本的客户端的,TBC需要比较新的ad.exe,TBC的地图提取工具不适用老版本的地图),下载地址:
  • mpq文件包提取工具MPQE_1.2.rar,暴雪公司的游戏都采用一种叫mpq的文件格式,是M ike O'Pack 的缩写,这个Mike就是暴雪公司的首席游戏程序开发人员,和创始者。我们需要使用mpqe.exe从客户端里提取相关文件。下载地址:
    " c5 P" u+ R( H7 q
    Brien
  • 开源数据库软件MySql
    & [, b7 B, R0 c官网:MySQL

    , m3 y! F  g7 C! M1 U% T或者用我下载的版本:
  • MySQL的客户端软件SQLyog,编译管理操作数据库
    " f0 N2 V" ]; i7 S官网:

    6 ~5 ^7 {! `* o% \1 R9 C9 \- e我下载的版本5.30:
  • 游戏内容数据库,配合Mangos Rev 3462的版本。9 R8 j5 w$ X9 g
    文件名:CompleteSDB156-Mangos3462.rar
    6 L6 g; Z& U/ b# y6 d下载地址:# }# A# a# A6 Y. z! X& A
    7 q2 V% X/ [- `0 ^3 z
二、安装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"+ B+ \+ @. c6 s3 Z  {) q
    / A, R1 A0 P; h
点击连接,这样客户端就连接到你的MySQL数据库服务器上了。在左边一栏右键点击“root@localhost”,选择建立数据库"Create Database"。当提示输入数据库名称的时候输入:"mangos"。重复第9,10步建立数据库"realmd"。 三、安装Mangos服务器,配置路径
, g: Q+ z4 R% l. o: R
  • 建立一个目录,例如:"C:\MaNGOS"
  • 把你下载的mangos的二进制文件解压到这个目录里面。
  • 检查你的两个重要的服务器配置文件:“ mangosd .conf”和“realmd.conf”。其中“mangosd .conf”里面可以配置物品,金钱的掉落率,经验值的增长率等等。
    0 ]% v/ p4 D  b9 T, h$ i
四、解压安装地图文件( Y2 y1 b2 y9 n3 {, {- n( \& Z2 y
  • 把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子目录了。" h& \9 i, F5 e7 {
五、解压安装提取的*.dbc文件
$ W) I/ d1 f4 M  ]
  • 在你的mangos的安装目录下建立dbc子目录,结构为:("C:\MaNGOS\dbc")
  • 为了将暴雪公司的mpq文件的内容解压出来,将提取工具mpqe.exe拷贝在魔兽世界安装目录的data目录下,结构为:("C:\World of Warcraft\data")
  • 打开dos窗口,进入魔兽世界的data目录(cd "C:\World of Warcraft\data")。
  • 执行以下命令:
    & i' O0 u) ^; x7 y2 j+ Vmpqe /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")了。5 z8 T. s$ t% q
七、下载安装数据库内容,前文说过,mangos只是游戏引擎,游戏的内容,建立的数据库由独立小组开发,我们这里使用著名的Silver's Database Site的库。版本号为SDB156., A$ |6 m* A( O- ^- ]: }
  • 将下载的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”,导入数据库文件。6 ^( S; x: b1 ]- o! c3 h8 E0 ~+ @3 d
八、配置数据库,配置文件,运行开源魔兽服务器!本文只为测试游戏,在局域网中玩。3 V& Q- i6 H, p/ v1 w+ M. o7 s1 z
  • 使用SQLyog连接到你的数据库。
  • 找到realmd,展开找到"realmlist"选项。
  • 在右下找到"Table Data"。
  • 在name一项填入你的服务器名字,例如叫faif
  • 在地址address一项可以使用"localhost" 或者你的IP地址。
  • 在realmd数据库下找到account表,点击"Table Data",建立你的游戏帐号,里面已经由几个内置的帐号,你可以参照gm,普通玩家的 帐号建立 你的用户名,密码。
  • 在mangos目录下打开realmd.conf 文件,找到: [+ W! I6 p, t, q6 `
    "LoginDatabaseInfo ="
    ) ]* l; B- U' Q( _3 h. w. X改为:"LoginDatabaseInfo = "127.0.0.1;3306;root;[password ];realmd"
    - j' ?, ~" J/ q* S9 n1 r+ b8 F这里的IP地址可以是你的IP,[password ]是你的密码。存盘。
  • 在mangos目录下打开mangosd .conf 文件,找到如下的内容,并设置如下:
    • DataDir = "."
    • WorldDatabaseInfo = "127.0.0.1;3306;root;[password ];mangos"
    • LoginDatabaseInfo = "127.0.0.1;3306;root;[password ];realmd"; w$ }( t/ ]- W0 I7 @
    5 G5 i9 D& c1 l0 `; o, S
同样,这里的IP地址可以是你的IP,[password ]是你的密码。存盘。到这里基本就大功告成了。先运行realmd.exe文件,稍等,运行mangosd .exe,魔兽服务器就已经运行了。连接到你的魔兽服务器,修改你的魔兽世界客户端的realmlist.wtf 的文件,将127.0.0.1 ,或者你的IP地址填在里面,例如:"set realmlist 127.0.0.1"   到此为止,开源的魔兽服务器就架设成功了,我给朋友建立了几个gm帐号,他们测试了一下,觉得这个版本的做的很不错了,开源的宗旨是知识的分享,开源 社区黑客们的探索精神页不得不让人佩服。

+ d, O5 k! j+ ?" ]
- `& e0 {4 |: o$ \1 B
5 t1 E# f' y# T7 \5.安装数据库
* N, t7 q6 K. i8 p( U使用mysql建立 mangos 数据库
6 y1 R; O  w2 e: o- O! I8 S: }5 C* L* C
a1)使用官方最小数据库,mysql用户名及数据权限等请自行设置
" q; s: v; F& `) M& umysql -u root -p mangos< /usr/local/mangos/share/mangos/sql/mangos.sql 导入数据1 Z' A- V* p+ o3 T4 o
" a7 O' ?# z3 g+ E5 _7 {7 ]4 N
a2)使用sdb数据库,mysql用户名及数据权限等请自行设置4 V5 o5 C4 u2 M- e' _. d
假设sdb数据库文件为 /home/wow/SDB/trunk/SDB_r1178.sql
* p! O; q7 w! ~+ Mmysql -u root -p mangos< /home/wow/SDB/trunk/SDB_r1178.sql 导入数据# k! [# ]% d# g& X6 d
9 B& `) E- a' j, R, }4 l
b)编辑 mangos 数据库的 realmlist 表,修改 address 为你运行mangos服务器的IP地址,这里设为192.168.1.1' E: r3 K- k0 T
1 _1 Q( ]# o& {* S* w
6.编辑配置文件  h( }; T  V) s: j6 G' u+ K, S( ~
编辑 /usr/local/mangos/etc/mangosd.conf
" Y) B8 R0 B4 L( u% q, ?+ O5 F8 b4 x5 u: u) d6 n! S
a)找到 DatabaseInfo = \"127.0.0.1;mangos;mangos;mangos\"
* g; a. C# ]2 e- p5 }! l为你自己的配置,格式为 DatabaseInfo = \"mysql服务器ip:mysql用户名:密码:mangos数据库名\"/ R. k7 W- m2 F( c! ~1 k

- A1 g& Y6 [) c3 z5 F) sb)找到 Host = localhost
  p8 r" K6 c2 y' L2 I: \为你自己的配置 Host = 你的IP或域名,这里设为192.168.1.1( y3 g( R- r; @2 u9 \" m

7 _8 v4 C# C8 O4 |9 c4 x5 }7 P6 d
回复

使用道具 举报

986

主题

92

回帖

5万

积分

管理员

积分
55255
 楼主| 发表于 2022-7-31 00:42:45 | 显示全部楼层
您好,在本教程中,我将逐步说明在 CentOS 7 Linux 系统上配置、安装和运行Mangos的方法。要完全执行安装,您需要一份要运行的游戏客户端版本的原始副本。
6 J! u0 i# d& X: H7 @2 ]
$ X- j3 a8 z% A# [1 \1 J9 w本指南已在安装最少的空 CentOS 7 系统上进行了全面测试。
1 I+ a1 g. e  ~) F/ k3 C$ u3 }# [2 k0 `0 M, O3 `) h/ o  D% F
我们走吧..
3 D/ r& q6 |0 r6 E
! r2 E, J9 G( T* Z) y  m设置数据库:
" B( u# J& _4 |; q3 }
& X2 y( Y. O; B6 F0 zCentOS 默认支持 MariaDB 而不是 MySQL。本指南的这一部分将帮助您设置 MariaDB 实例。8 |( A8 t5 K1 Z
9 L; P0 u0 T4 d! C# j) n+ d8 F
启动一个终端,如果还没有,您需要成为“root”用户:) P, Z6 ~* @' `5 Z: u: y" U
. S& J; }) ^; B4 m" x: c6 ^$ V
须藤苏 - 根
7 `0 Q% n- L( w! \( P" A* H$ @2 N然后,安装 MariaDB:- U9 I9 l3 s5 M; f
  ]0 O( A: \  i
yum -y 安装 mariadb-server& X0 e1 u# e) m1 Y
     安装 MariaDB 后,启动它:
! e0 [- V' r# y! G  q7 G' U7 @+ j& S" x3 {6 \" U; B8 ~
systemctl 启动 mariadb
; h. ~  {5 o* B$ @我建议您在启动时添加 mariadb 服务以自动执行它:6 }9 k: N6 O1 W7 N" {, |/ s
0 n9 Z& q! O# ^6 o& s/ ~
systemctl 启用 mariadb5 ~' j# N' D1 `7 L  Y
让我们保护您的 mariadb 安装,执行以下命令:- n6 H/ e! G$ i2 V2 k
4 u; o5 F5 d  \' \8 v) X$ P: n8 i
mysql_secure_installation
* w- S8 S1 e, g0 p我建议您设置以下参数:
: ?+ v6 u! }& M+ F- G* P  _
. [! N* I% Z# t设置 Root 密码6 l9 f4 U* |1 U7 H( H+ M% `
删除匿名访问! L. p# e7 T$ {1 I6 _
禁用 root 用户的远程访问
: n; S" d, A. b; s% e删除测试数据库
, \3 V$ ?! O5 C  d! S3 k重新加载权限) x% A8 u( m$ r4 I- w# M6 J7 Y
验证您的数据库配置是否正常工作,您需要提供刚刚定义的 root 密码:
& p2 Y& Z) R  ~6 P$ J9 a+ B0 D" e& k" c
mysqladmin -u root -p 版本! P; J% c$ T  s/ V$ l
如果一切正常,您应该有如下输出:' e6 A7 f& Q2 k5 V9 W" e( N0 _

8 L2 R0 ~& J+ n! ~4 p7 z, y7 x, Q8 x/ L服务器版本 5.5.52-MariaDB9 b+ j5 A- I. v+ a  b& x9 I
协议版本 10* N; b7 D# U9 j5 X* Y
通过 UNIX 套接字连接本地主机8 h3 ^8 |8 e( f) X
UNIX 套接字 /var/lib/mysql/mysql.sock
  j/ z9 s- V4 M) @3 X6 }正常运行时间 x 秒
! F& s$ E" x; Q* M+ l4 U
' r+ s: P6 C1 r- o. o
7 F. t3 ]' _& f- E现在数据库的设置已经完成,我们需要添加芒果数据库配置的先决条件。我们需要首先为mangos创建一个用户,使用以下命令登录数据库:9 D! L& Z& L- ^4 k0 z0 N
# W; b. w2 F% J( C* G
mysql -u 根目录 -p
8 }1 k" y8 T5 |' L) S9 r5 X3 {创建您想要的用户,给出的示例是创建一个用户“ mangos ”,该用户可以从“localhost”连接并在末尾输入密码“password”(不要忘记“;”):, Z8 A3 D: ^' O2 v! A% _8 c
* D% N6 X. `& t; w5 `. P2 J7 `
创建用户“芒果” @ “本地主机”由“密码”识别;/ U4 \: i# H* ~; ^
然后,我们需要向该用户授予权限,以便我们以后可以使用它来设置Mangos模式(同样,不要忘记“;”符号):
$ y. j4 I- G3 T0 @9 m$ ]6 N
$ ^1 T; l8 a  M( p将*.* 上的所有特权授予“芒果” @ “本地主机” ;9 L. X3 n7 S+ a. F6 V7 ?8 T
退出终端:
9 \, n0 w1 D& u; V0 o) n: L9 E- E0 Z% Y8 L+ W
退出
" C8 c8 d  Q5 h! z( Z- l( g, M恭喜,您已经在 CentOS 上设置了数据库的先决条件!
% U+ d& T# O' X8 J* r4 Z% s6 ], E$ q- E

5 d# `* g1 g  {9 x: P1 Q; q# w, K% _3 O* r, l
安装芒果:& ^: s5 `9 Z0 Z& n1 @8 J! D
1 m7 y- M  G* H7 f" G' x. `
我们现在处于有趣的部分,我们如何在 CentOS 上安装Mangos ?好吧,假设您以“root”身份登录,请转到主目录:+ n+ g0 d( }/ n0 ~" Z+ S5 _. ?

  |6 x: G, T' ~/ E6 O, o9 V# Z光盘~) C4 k: V) m! H
让我们先安装所需的依赖项,wget 是一个小实用程序,可让您下载安装程序脚本:8 P. e5 t4 E, D
4 }6 C; W+ E& E5 F! x5 q0 X1 D
yum -y 安装 wget$ X+ ]- m- m) X- v( u
现在,我们可以下载我们的安装程序:+ l3 ~5 G- g! I
9 N# y2 h7 G2 O
wget https://raw.githubusercontent.co ... /linux/getmangos.sh/ I/ o( \* l) T) x6 A/ O6 `1 O
设置允许执行它的权限:. X# a* H/ C! R: B: w

- B* T+ n8 q: ~! g7 Nchmod 700 getmangos.sh
$ N% {& C7 `. F$ f0 W# U  v8 v/ f并执行它:
$ e$ B8 J# _# |
# y; m! T3 o# [$ T7 T0 ^0 @./getmangos.sh! i/ F6 x4 g  S
在我们进一步讨论之前,对可用活动进行一些解释:
/ ?9 c; A: A3 W- ]* @! e4 P
. O7 m0 C* v1 F8 N- g# B# ^安装先决条件将为您安装所有必要的依赖项以构建和运行mangos。默认切换。
& H3 g8 l% L6 o设置下载和安装路径将允许您指定必须下载源的位置以及必须安装二进制文件的位置。默认切换。
5 i2 {% d0 v% r克隆源存储库将帮助您克隆Mangos源。默认切换。! V) X& c$ x0 x) `2 H' c) Q
Build MaNGOS将协助您完成MaNGOS的构建过程。默认切换。
% I. a7 J- Q, b4 \( {% F安装MaNGOS将帮助您安装MaNGOS。默认切换。' g) c/ F5 Z) A6 M3 J: C
安装数据库将帮助您创建数据库模式。默认切换。
7 E/ M/ x& _& \; P* ^8 L提取资源将帮助您从游戏客户端中提取 DBC、地图、mmap 和 vmap。默认切换。: g. [! A; ^  O5 _
创建 Code::Blocks 项目文件将为 Code::Blocks 编辑器创建一个项目。如果您不打算编辑MaNGOS源,请不要切换此选项。5 m+ a0 A6 M1 b
现在您已经了解了所有内容,请选择默认选项并通过 Tab 键选择“确定”。该脚本现在正在您的 CentOS 上安装必要的依赖项。系统将提示您同意安装构建依赖项。选择“是”两次。
$ G: C0 m" @/ c$ l  r: X% a5 F4 d6 _5 x
用户选择:$ d: @# V# u6 f& Z  h6 T: q

# N- J2 z0 H" b$ QMangos为您提供了在“root”用户以外的其他用户下运行它的机会。这是一种很好的做法,可以隔离软件并在漏洞被利用的情况下限制安全影响。默认建议的运行用户是“ mangos ”,但您可以根据需要进行更改。选择“确定”继续。
# F+ m  `% ]) ?: d. F: l
4 r! d4 ~5 ~" a9 w3 @如果您已经执行了此步骤,安装程序将询问您是否要保留该用户。我建议您回答“是”,除非您知道自己在做什么。9 z* I% c( n9 Q# e
4 @" J) J2 y% f" U6 N$ @
选择魔兽版本:
* `, s: K( W# @  e, m3 _7 a8 P, l3 u0 k, H3 C# {$ d
下一个屏幕要求您选择您愿意安装的 WoW 版本。选择符合您愿望的那个,然后选择“确定”。) s" x5 X3 g3 `7 Q4 {1 k
9 Q% N; w6 K- f$ X* W$ F. z
源代码路径:
; q2 r9 u' K/ ~( Z* Y% g
: O# i, g! f0 B* U7 P下一个屏幕要求您提供源路径。默认情况下,建议的格式是 /home/<run user>/<wow version>/src。例如,对于运行用户“ mangos ”和 wow 版本“Vanilla”,建议的路径将是:$ |! ?* y+ A/ p% E' Z+ v( A
- A4 _5 W- {* h, o- e2 r
/home/芒果/zero/src
& G0 v; p" J2 P! H, E如果目录不存在,请回复“是”以创建目录。如果它确实存在并且包含源,安装程序将询问您是否要删除该内容。
7 x7 F, {4 p/ b6 j1 {. V1 J+ n" C) M. O/ }+ y, f
安装路径:% ^  d7 B( _: _8 l& s9 n
) T1 w! X- H; F1 V! K2 Y
下一个屏幕要求您提供安装路径。这是您将执行Mangos流程的位置。默认情况下,建议的格式是 /home/<run user>/<wow version>。例如,对于运行用户“ mangos ”和 wow 版本“Vanilla”,建议的路径将是:4 `* t. e% g  g5 a& v- K2 w# V" Z6 o

/ ?( ^* d9 K+ {- @/home/芒果/零# D8 A/ ~( b  b5 _1 C
如果它确实存在并且包含已编译的源,安装程序将询问您是否要删除该内容。5 p+ \8 t! _: |! U( ^* m0 B
- }1 m7 D+ @; B+ h5 E9 K# o
克隆或更新MaNGOS:; R# r) N  T; I/ M0 {+ {

. d/ [9 ]/ E7 M, y脚本的下一步是询问您是否要克隆、更新或使用MaNGOS源的现有副本。对于全新安装,请选择选项“0 克隆MaNGOS的全新副本”。安装程序现在将连接到 Github 并检查可用的开发分支,目前,最后一个稳定版本是 Rel21,并托管在“主”分支中。; ^- {6 h2 w/ K' s9 P, }& p) _0 {

2 ~" Q# v0 K4 E% F+ D安装程序现在正在克隆服务器和数据库存储库。
# H3 v+ p  Q9 l+ \: h' Y
: V3 n6 U/ X! I* Y8 Y' ]构建选项:
7 t/ R3 t, J- o4 V
4 ?7 K6 o8 {3 i: b! b# G* l, }" M您现在处于构建步骤。此屏幕上的一些解释:
/ t5 q1 S- n' _  x, ]: s4 d+ q+ _# I
Enable Debug 将在Mangos 上设置调试标志和更多跟踪。仅当您被要求修复错误时才使用此构建选项。在调试模式下构建软件会显着降低其性能。+ o! v+ a, I$ N9 P$ E
使用标准 Malloc,切换此选项以使用标准内存分配。仅当您知道自己在做什么时才取消切换此选项。) E9 b% }% O6 ~2 t0 Z
使用外部 ACE 库。允许您使用来自系统的 ACE 库。此选项在极少数情况下有效,并且将来会被删除,所以不要切换它(无论如何, MaNGOS有一个“内部”ACE)。# i( x( g3 f4 q% E, k
使用 PostgreSQL 代替 MySQL/MariaDB。允许您使用默认数据库提供程序以外的其他数据库提供程序。此选项尚未经过测试,如果您到目前为止已经按照教程进行操作,那么您应该已经设置了 MariaDB
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|

GMT+8, 2026-3-22 02:41 AM , Processed in 0.105541 second(s), 25 queries .

Powered by xyh-moon X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表