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

MangOs搭建魔兽世界私服

[复制链接]

985

主题

92

回帖

5万

积分

管理员

积分
53561
发表于 2022-7-29 09:16:01 | 显示全部楼层 |阅读模式
话不多说,开整!
/ n: G: G5 p# c6 V6 J/ r考虑再三,我选择了CentOs来做游戏的服务端操作系统。3 j0 t9 f; U+ v# e" [' v" Y
通过Git获得Mangos的源码之后自行编译搭建服务器。& L# ~/ r2 K* b9 R- l
这么做处于几方面的考虑。. N% Q$ E( a1 E9 _" c9 R
  • 我看不起Windows操作系统。
  • 我更看不起那些Win系列一键安装包。
  • 考虑的可持续运行的服务器,Centos肯定是不二之选。
  • 不自己编译安装,怎么能进步呢?
  • 万一后期自己想修改游戏,设计任务,添加物品呢?
  • 没错,我就喜欢开手动挡。自动挡,那是给残疾人开的。
    5 F+ N. n% X" C; |1 F& w( i, `
首先在本地安装虚拟机,虚拟一台纯净的Centos7操作系统。( Q# h) o! \0 S2 b3 D! b- V1 s
把该打的补丁都给打了(yum update)
. ^; H4 c2 p- i% R$ X完了之后,咱们安装一些基础的组件和环境。6 Z7 }2 l: ~- {7 l" ]1 i; M: l
Yum install git cmake gcc patch autoconf mariadb-server mariadb-devel libtool zfstream gcc-c++ subversion boost-devel8 C8 i: z0 D1 O5 S9 L
如果有些组件提示没找到,无所谓。继续往下。2 [9 d8 U+ s1 e( L" @
我编译安装的第一个版本是cmangos。
% e% I3 N1 D, e- y7 S9 v9 W这个版本支持机器人,地图提取工具。在编译的时候可以添加参数。
, {/ k5 H' c) R% W. ncmake -DCMAKE_INSTALL_PREFIX= -DBUILD_EXTRACTORS=ON -DPCH=1 -DDEBUG=0 -DBUILD_PLAYERBOT=ON; X3 z9 w4 Q& v$ P" M+ u/ Q+ B8 ^
编译参数中:& N% Q( B. w  W1 }# J4 [
DCMAKE_INSTALL_PREFIX是指你的服务端安装目录,可以自定义。
/ V) @# v# i* T. SDBUILD_EXTRACTORS是指是否安装地图提取工具
* I- i+ P  K+ C5 CDBUILD_PLAYERBOT是指是否打开机器人
$ i! R/ H  V' w这里我做科普2:/ }# ?% n2 R, O, q$ F
首先是科普1我们提到过,MangOs是一个大型多人在线角色扮演的游戏服务器程序框架。理论上他是可以模拟所有的络游戏的。
( |0 i5 G$ e% R' }% B5 |  ~既然,现在我们用它来模拟魔兽世界。那么肯定要对魔兽世界进行独立的一些补充(数据补充)。这就是上边地图提取工具那个参数的作用。我们需要上传一个魔兽客户端(你想要搭建的版本)的地图文件。然后我们使用地图提取工具,对客户端进行分析和提取。配上专用的数据库来模拟暴雪的游戏服务端。
% q# n7 U' B  M& l- T9 q至于那个机器人吗?那是个笑话,请自行忽略。
; @4 H& P9 n* b6 R+ p; |4 N! |我们继续,我把整理好的搭建步骤列一个明细:, S1 J! B* `& j: I2 v
  • 首先使用git选择一个自己喜欢的版本git到本地服务器。
  • 然后设置编译参数开始编译。
  • 提取地图放到服务端(下载别人编译好的可以不用自己提取)。
  • 下载安装导入数据库(感谢Mangos使用了mysql数据库)
  • 对服务器进行配置。
  • 启动服务器。
  • 配置客户端的服务器链接地址。
  • 开始游戏。0 U% ]" f$ W, {* X0 I- R% \% _1 p8 ]- l
这中间,我把一些别人不会告诉你的关键步骤做科普3:
9 X4 c* M3 v9 Y% p
  • 在编译的时候需要用到gcc、cmake3、ace等几个核心支持。
  • 某些特殊的服务器版本,不支持地图提取工具的参数。只能曲线救国去找,下载别人提取好的地图文件(我这里去找了个别人制作的win一键安装包,借用了他们的地图文件)。
  • 数据库汉化是个细致的活儿。没有编程数据库基础的,建议曲线救国。
  • 有些魔兽客户端版本,并没有太好的大脚插件支持。(反正我玩怀旧感觉大脚怀旧服专用版就做得很好,可惜不兼容我的1.12.1)- x+ R- e8 s, q4 B
放几个链接仅做Mark:
# x% `! r3 N5 n. a: oCmake3 安装
, f9 a# f) a5 j5 H' G7 C; ^https://blog.csdn.net/weixin_38883338/article/details/86408749
8 e% o) F& j# L  B  v% O9 b+ eGcc 6, F: o; N- X  O% ?1 Q, K
https://blog.csdn.net/Al_xin/article/details/92438055! y$ l0 f+ y( P
ACE6.3.3% a: D' t; B% o+ d
https://blog.csdn.net/u010587274/article/details/50965369: a3 {& U  E# w4 I! }5 q
Git源码和数据库编译安装服务器
" f0 ]+ {. t$ ^; `7 xgit clone git://github.com/cmangos/mangos-classic.git mangos
7 V' Y1 T% h* z9 _git clone git://github.com/cmangos/classic-db.git2 G" v: n0 p8 \' Q0 K4 Q
ACE的编译安装和地图提取,确实有点耗费性能和时间,不过地图和数据库后期你熟悉了可以越过,而上述三个环境的安装是铁定要做的。& D; r& A/ X  s* W; k9 b* n* i, `
我们来说一下服务器的配置。
9 G* ~: f4 b& |1 K* x3 U! G) u在编译好服务端,上传提取好的地图后。我们要设置两个文件来启动服务器。分别是etc目录下的:+ }+ t! m) W8 A
  • mangosd.conf(服务器参数配置)
  • realmd.conf(账户认证服务配置)
    % ?1 B# @, p# G1 W2 D* W
有几个关键点,我整理如下:  d' x( N$ Q* a  C* C; W+ l' s
  • 首先是地图目录的配置,你可以写绝对路径,或者相对路径。只要写不正确,服务器启动不起来。会提示xxx.map exits之类的。意思就是找不到地图文件。
  • 你要配置数据库的链接地址这里可以连接远程,本地都ok。只要连接地址、数据库用户名、密码、数据库名字正确就ok。
  • 我们一般会配置一下进入游戏的欢迎语,人物出生的携带金钱和出生等级,还有打怪升级的经验倍数这些参数。
  • 如果你需要做一些有特色的的东西。可能就涉及到修改数据库了。比如说人物出生送T3套装。这个就需要去数据库中进行配置。
  • 如果你是为了让朋友一起来玩。就吧那个BindIP给注释掉。否则可能引起一些无法连上服务器的奇怪现象。
      T$ i; S/ G3 Z. A
参数名称:+ u) V% k- P+ L
地图目录
% u9 \% ~2 v( TDataDir = “../data” + V; @9 f% N0 x/ `& {
日志目录
' ]6 J/ ]1 }3 G1 xLogsDir = “../logs”
5 U) n0 I2 ?* D% \( N  k+ K游戏欢迎语- [$ I% S( X4 f0 W+ n
Motd= “游戏欢迎语”
0 w, `* r7 |) [出生等级1 ^) N8 o& b/ r
StartPlayerLevel = 1
+ q* ?+ R4 s3 I  \1 z, o5 N出生携带金钱1000G
9 W: Z* L% I$ e6 a! w3 KStartPlayerMoney = 10000000  h$ f4 I! w, T* o& m# U
杀怪经验5倍
; [' b0 s; F2 C6 E" [  n9 LRate.XP.Kill    = 5/ |  S  x2 f# m4 ?7 v2 I
任务经验15倍$ l' H, @& d4 s1 o
Rate.XP.Quest   = 151 q/ W8 G1 T+ R$ j) R
探索地图10倍
* s+ W# A  Y4 L) H. ^2 ?Rate.XP.Explore = 10
( v9 {2 J' F. o2 Q/ E# z数据库连接(应该有3-4条之多,按下面格式修改即可)8 S2 o" q9 w8 [0 ~$ N
LoginDatabase.Info              = “地址;端口;用户名;密码;数据库”
; I3 z% y* y6 a6 O- E  P! s配置结束,就是启动。
% k, O0 j# h% R因为,我们搭建的服务器属于广域网,可以让朋友一起来玩的。那么肯定要对防火墙这些进行配置。否则防火墙会阻断服务端提供服务。
" D- u9 F6 h- y0 V$ r我们需要开启如下端口:; }. }- T) j- d8 F. l: L
8085,9600,3724% o- U; N. t& V+ g, ?
把他们添加到你防火墙的白名单即可。+ i/ E. Y" C9 F3 C
(当然,考虑安全呢你可以修改一下端口号。这我就不多费口舌了)0 N7 G5 @9 I' z3 a0 b) m) v! ?
一些收尾工作:
6 ]6 _2 x' V+ d/ H5 U
  • 主要是对服务器进行安全加固,例如修改ssh登录端口,禁止root登录。开启防火墙等等。
  • 对游戏数据进行定时备份。毕竟是自己家的服务器,有时候可能会来做一些测试。数据备份显得就非常重要了。我反正是1小时已备份。这个用shell脚本去备份mysql数据库即可(注意清理)。
  • 可以要制作一个网页,开放给新用户去注册、修改密码、下载客户端等等。这个就是另一项技术了。有机会我们再聊。/ J4 f$ ]$ @4 }5 T2 G% [6 g2 q% G

游戏登录界面

游戏登录界面

成功进入游戏

成功进入游戏

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

985

主题

92

回帖

5万

积分

管理员

积分
53561
 楼主| 发表于 2022-7-29 16:13:58 | 显示全部楼层
yum install git& |1 C" U, K2 z
git clone https://github.com/mangostwo/server.git
, U' f' a5 \8 a$ ?% D+ |git clone https://github.com/mangostwo/database.git
$ O$ \4 J1 S% C7 M: X4 b7 T8 z8 e7 q, S0 f" B0 t5 j5 M2 f
  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" [, C: h% E$ d) t$ c
  2. yum -y install devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-binutils: d  Y  o1 Q5 e" k
  3. scl enable devtoolset-7 bash# ]  H* d" G1 @8 G* C9 V6 E" ~# _
  4. echo "source /opt/rh/devtoolset-7/enable" >>/etc/profile' y3 g; b3 w' T# q$ p
  5. # 查看安装的包
    3 W, z  p/ V6 {* _8 P
  6. scl -l ) A7 a5 n/ ]; u2 o. h
  7. yum -y install rh-python35
    8 E- \. e2 F4 T+ \/ q# L* M
  8. scl enable rh-python35 bash
    0 \9 R; q: ~6 P2 B% B
  9. echo "source /opt/rh/rh-python35/enable" >>/etc/profile
    ' j5 W6 q1 b  ~! D% x8 y
  10. $ R, m7 M9 o+ `3 x
复制代码
  1. wget -c https://download.dre.vanderbilt.edu/previous_versions/ACE-6.3.3.tar.gz
    " ^) x# P, t. }
  2. tar -xvf ACE-6.3.3.tar.gz5 ~' I$ t) `  v
  3. vi /etc/profile; E+ I* v+ @" k. j' ^" p- I! j
  4. #在文本尾部添加:+ P4 h0 H$ l1 {5 C3 \5 Z; T9 o
  5. export ACE_ROOT=/root/ACE_wrappers
    ) {. D7 a1 z2 p- D; v( @9 d
  6. export LD_LIBRARY_PATH=$ACE_ROOT/lib:$LD_LIBRARY_PATH) n/ a3 X$ K& R" Q7 c
  7. vi /root/ACE_wrappers/ace/config.h  C- a0 V/ s2 r: q0 H6 h8 T5 |7 l
  8. #写入如下内容:
    5 L8 j! i) p/ g3 h/ s- o
  9. <code>#include "ace/config-linux.h"( s' R' Z0 H# ]! r& l
  10. </code>4 |* ~, E- n& C
  11. vi /root/ACE_wrappers/include/makeinclude/platform_macros.GNU8 |( J2 `" Y, r! [( A
  12. 写入如下内容:8 Z) L6 h/ {* t: f
  13. <code>include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU</code>* _; k" \; @2 z3 I- q
  14. <code>INSTALL_PREFIX = /usr/local</code>1 z7 I% e/ a% m7 g
  15. 8 M' ^3 d1 j$ d; ~! M' V9 Y
  16. chmod 775 -R /root/ACE_wrappers
    3 K$ }! p" Y- S; ?
  17. cd /root/ACE_wrappers/* O$ j* ]1 M, R0 H
  18. make, ?4 m. `7 o/ s
  19. make install
    0 ], z# ~0 p9 J; G' d- C+ J2 L
复制代码
回复

使用道具 举报

985

主题

92

回帖

5万

积分

管理员

积分
53561
 楼主| 发表于 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
    ! D% T0 R1 x9 j( B3 W; E
  2. ###############################################################################
    # j* W" Y3 G3 L8 H, ^
  3. # MaNGOS Build Automation Script                                              #
    2 j& Y( W! G4 G  l3 ~" U1 |5 b
  4. # Written By: Ryan Ashley                                                     #  U* ^$ y1 G; q. |
  5. # Updated By: Cedric Servais                                                  #
    , {- l4 M1 ^* e/ I9 M
  6. # Copyright (C) 2014-2022 MaNGOS https://getmangos.eu/                        #
    6 I( |- i' s- u% P5 \2 W4 k
  7. #                                                                             #
    0 P6 S! r2 g1 D. q: W
  8. # This program is free software; you can redistribute it and/or modify        #
    # ]9 \4 W. J3 {) ]
  9. # it under the terms of the GNU General Public License as published by        #3 p- k$ v/ Q- B- q' S
  10. # the Free Software Foundation; either version 2 of the License, or           #) L. w' p7 W$ r9 z
  11. # (at your option) any later version.                                         #
    * \; ?1 z) B0 t/ J4 H1 {
  12. #                                                                             #) R- T( G* U5 Q7 b8 t
  13. # This program is distributed in the hope that it will be useful,             #* z: b# h8 k; R; x8 Z
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
    # M( g8 a3 I. K) l7 }
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                #+ ^" l: \$ [- Y* l2 i1 ]' f
  16. # GNU General Public License for more details.                                #
    2 h5 U* o6 J; W' W1 p
  17. #                                                                             #' [* Q: D$ ]; z! z1 q5 m& N. Z- a
  18. # You should have received a copy of the GNU General Public License           #
    + p) i7 A1 N; Q+ Q3 e4 a3 Z' f
  19. # along with this program; if not, write to the Free Software                 #
    7 o7 w7 V1 w0 N) N3 ^3 o
  20. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA     #& F4 e3 D( L0 ~& e5 q: n5 w! i0 i
  21. ###############################################################################! w8 d& u. G: h7 U" R7 d2 z

  22. $ ]5 N9 a- k! L6 t' A9 G
  23. # Global variables
    ( g5 D4 x  A4 t. L3 P8 O1 H5 p4 E- f
  24. DLGAPP="whiptail"
    , V/ o' Y0 U6 ^) N2 P
  25. VERSION="2"
    # T# H8 n2 q# w- x0 F
  26. ROOTPATH="$HOME") Y3 y! @! F3 n, F
  27. SRCPATH="$HOME/mangos/src"3 Z& l* ]  r" N' F; K* K
  28. INSTPATH="$HOME/mangos"' ?: k, ^9 c5 M7 |5 K
  29. DB_PREFIX="two"
    9 }1 `( ^6 l; m  [. `
  30. USER="mangos"- m9 a  d) X, F! s2 A. K" @  n
  31. P_SOAP="0"$ K7 V7 G( h$ Q2 v/ G. p' U, a
  32. P_DEBUG="0"
    5 c% U8 `$ E# A! [
  33. P_STD_MALLOC="1"
    4 o4 v  f8 u5 ?7 D# N: u, @8 O; `( {! N
  34. P_ACE_EXTERNAL="1"' D4 w+ I, X1 P- G6 o
  35. P_PGRESQL="0"
      X/ r7 E5 L. U
  36. P_TOOLS="0"# w- A- B: f5 g( s" Q
  37. P_SD3="1": @9 `) d6 z8 C) ~
  38. P_ELUNA="1") q# d: g9 F' w8 y3 Y
  39. P_BOTS="0"
    $ R7 l1 l# ~4 h: D% s5 g
  40. CMAKE_CMD="cmake"% L8 H/ i' {) K. W

  41. ! R, E) ~1 U' p' {0 f

  42. 7 [/ V) d7 U$ l0 `' Z! N% I1 \$ J
  43. function UseCmake3()
    & `9 |" n! K! T# \' W9 L
  44. {
    , J: R* i- Q# Z& s( O
  45.     # set the command to cmake3 if its there8 w! c8 ]; Y6 K+ u# \' Y9 M' ]' P2 d
  46.     which cmake37 ^- A7 X2 v+ F3 J# e0 J
  47.     if [ $? -eq 0 ]; then
    ! H4 ~2 B) C  j% A' X6 S& X/ [
  48.         CMAKE_CMD="cmake3"/ W; D% M, O- ~" u6 o$ S
  49.     fi2 `' ?4 f% J, j0 S
  50. }
    ; m9 ^, ]! [. M. _' S5 Q9 D

  51. $ E1 Y0 K! f/ T6 H
  52. # Function to test for dialog
      k2 K  S0 g$ [( u# L% Q7 \
  53. function UseDialog()
    0 B& U9 t' Q$ q
  54. {' p* A* {& [- a% n: i+ V
  55.   # Search for dialog
      T9 Y' d7 e/ I3 t- X8 m$ s' O$ }
  56.   which dialog
    3 I7 d' v& z  |1 ^+ ^, p3 ?/ D

  57. 6 z0 d$ u6 W. C) m! a: q
  58.   # See if dialog was found: c' g% w/ ?* u, P8 ~5 _
  59.   if [ $? -eq 0 ]; then' i8 I+ E' B+ ^6 N. G1 b
  60.     DLGAPP="dialog"- @4 ~! {1 [5 K- z& k" d
  61.   fi
    1 U+ `* [* `( m
  62. }4 n3 V, V1 h3 z  A/ p& R5 I* d) j

  63. ) A' p, Z* S; P
  64. # Function to test if the user is root or not# K' u1 s; W/ W/ V! |
  65. function CheckRoot()6 H8 _6 n& @9 W) \0 V- b
  66. {
    $ j8 l: G: }  H0 O3 `: q
  67.   if [ "$(id -u)" != "0" ]; then
    / k: O1 O6 q5 i  K
  68.       Log "This script can only be used as root!" 1
    : M  d3 G; ^7 y- h0 x9 v
  69.       exit 1' u9 y5 U+ G$ S
  70.   else) r, r, [1 t3 m7 O: L
  71.       Log "User is root, check passed" 0$ R' y, i) |. |# K* V8 C1 w
  72.   fi
    . Z7 L! P& I! c# h, _( x6 h5 I
  73. }
    5 f) w' n4 S: _, z9 l

  74. " W1 _# c6 B4 v4 r+ f$ @7 a/ ^- ]
  75. # Function to detect the repos. V- Z- O6 b4 N6 x% I$ D2 h
  76. function DetectLocalRepo()% M/ \% Q2 h6 c8 _
  77. {
      p6 ]  b4 T# h/ \  K
  78.   local CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"# ^% f- P& b/ I( m3 e/ T$ Y7 s
  79. 3 F5 P+ A% r) x- B% s- ]! Z
  80.   # First see if the Windows stuff is in place2 G% Y3 P- ]+ t$ K. o
  81.   if [ ! -d ../win ]; then5 B4 _4 @) D' _2 T4 Y
  82.     Log "Windows files directory does not exist, assuming repo has not been cloned." 0! c/ K) f  v4 ?  }" g
  83.     return 0
    / P6 t. t3 H" O& `7 L0 {( w
  84.   fi' @/ n. Z! U2 X/ h9 p1 k  y+ \$ E* G
  85. 2 v8 G- W' W3 r
  86.   # See if the sources dircetory exists3 B9 O& O3 [- B- t) E. E; r3 i
  87.   if [ ! -d ../src ]; then
    $ f+ n  v8 [0 L1 E/ }- z+ q
  88.     Log "Source files directory does not exist, assuming repo has not been cloned." 09 }( k) a9 c7 S. l3 f3 \
  89.     return 0
    + b% N4 S) b& ]1 K
  90.   fi; @8 F, R: j: R  E; }

  91.   q; H* h; ^; K' W, n3 M; C  `+ S1 B3 |
  92.   # Check for the CMake directory* q& f( q' p  c
  93.   if [ ! -d ../cmake ]; then
    * Q* {# w0 k, p5 ?; i$ U8 z
  94.     Log "CMake directory does not exist, assuming repo has not been cloned." 0
      C, r4 c; ?) i5 J5 I
  95.     return 0
    ; s# z6 o% l) O. u2 ~' J( L. n
  96.   fi2 [6 {& }) k7 N0 r6 a3 P4 U

  97. / u; ]- ^' L$ u1 O) ?* i
  98.   # Set the default paths based on the current location; A8 D" j9 q/ L: S
  99.   SRCPATH=$( dirname $CUR_DIR )
    9 ^7 N# ^5 m# o
  100.   SRCPATH=$( dirname $SRCPATH )
    . Y1 L' ]4 p/ V: C" Z4 U, P* R& k7 K

  101. 1 `+ W' {+ m+ G3 w2 e( L4 j  {
  102.   # Log the detected path
    ! v$ w2 }" q9 D0 Y1 @% o7 v! x: x
  103.   Log "Detected cloned repository in $SRCPATH" 0
    ! d# J) P- M1 _4 N2 ?1 y
  104. }% k2 @* D3 v$ z+ Z: R/ b6 M

  105. ' G3 e8 N5 b2 `% V+ r  t7 l: n
  106. 2 q& g6 A& O& @- ^

  107. 7 ?% f+ o( \2 j" \
  108. # Function to log results3 k. R( s1 X& T9 Q3 a2 h" o
  109. function Log()
    ; I+ |) D8 R  A3 m0 y! h
  110. {
    ( F# r* S0 |9 j) a$ L
  111.   local TIMESTAMP=$( date +%Y-%m-%d:%H:%M:%S )
    7 E- c  o+ h  {) b6 K: \
  112. 6 a1 r5 o; Y' T1 S+ Q; M
  113.   # Check the number of parameters, q9 S- r- |; J2 {6 _+ q% s
  114.   if [ $# -ne 2 ]; then
    8 _0 F$ q! I% W: X  {) X0 }
  115.     echo "Logging usage: Log <message> <echo flag>"! o7 r0 `  X3 u3 n
  116.     return 1; n' C9 q# C6 t  {% D, j
  117.   fi2 V* U8 J( |, }  g- \* W- O

  118. / t. W2 `0 ]7 k3 O; e
  119.   # Echo to the console if requested' x3 Z) v+ X* P5 L+ y) \
  120.   if [ $2 -eq 1 ]; then
    ' A5 A7 ~/ @7 x% k  z, A/ a
  121.     echo "$1"
    / u8 l( g" j# d' B1 A0 K$ ^* K
  122.   fi' k" z* p, x* g7 H0 D& U, Y, k

  123. 2 T( n: a/ R# S$ z) [6 G
  124.   # Append the string to the log: h0 r' Q) h( M- [, E, C
  125.   echo "$TIMESTAMP $1" >> ~/getmangos.log* ]% A  v8 U$ J
  126. }# ^1 z6 R! Q. N4 c* T6 B+ _

  127. - V$ y# p, m8 M; U8 l. p

  128. , X$ n+ T, ^- J' R0 E" g  T
  129. 7 z3 d0 x: ~7 ^) Q1 C* a: h
  130. # Function to install prerequisite libraries
    2 F1 x. ?) F1 k4 N, O1 L# Q" e$ D
  131. function GetPrerequisites()
    6 D- s; f, ?/ {6 p1 j
  132. {4 {6 ^/ o( k* ^: f, c. b$ \
  133.   # First, we need to check the installer., M* s" D9 v5 N+ [" Y/ {4 e1 D
  134.   installer=0
    0 b  }/ n( f) U
  135. ( O( I( i. c) E- d$ Y. |
  136.   which apt-get
    9 ^- r6 D, y9 J1 M' F5 v9 d

  137. " Y8 }; |* d# S
  138.   if [ $? -ne 0 ]; then) F* W% A0 j- C1 ?4 V; {) R
  139.     Log "apt-get isn't the installer by default" 1
    $ N# T: x; J+ R. U% Z/ d/ F, A
  140.   else
    ; J6 Q" W3 E: S6 D; o7 v
  141.     installer=1+ N* e5 Z# ~4 }6 _6 g
  142.   # On a fresh OS boot (EC2) libace was not found without first updating
    - X. Z( K& k6 k2 n: V
  143.     apt-get update -y && apt-get -y install git lsb-release curl7 \5 ]8 n8 K! C8 e4 H; d
  144.   fi
    # }) p$ N+ t3 X: q) ^0 y
  145. & o: {9 f! D6 L) h* v
  146.   which yum
    & o- R; B4 K# L* \6 F( @: P, C, ~
  147. 6 [1 }% @( _7 `+ `
  148.   if [ $? -ne 0 ]; then3 S0 ~' t4 Q) h! Y3 i
  149.     Log "yum isn't the installer by default" 1
    $ d+ v1 K0 I; d- D
  150.   else
    : `8 R* w. ~" H& o3 N! V. W8 `
  151.     installer=1
    ; m5 _3 \4 O1 c. ?  L3 M$ R! P
  152.     yum -y install git redhat-lsb curl% |$ [" i# n/ L: o
  153.   fi
    2 A6 I1 a; u5 o- n8 B( I2 Y2 N

  154. : P* o! R; |  s+ \
  155.   which aptitude
    6 l' b1 n& Z4 m# N9 S7 z0 q
  156.   if [ $? -ne 0 ]; then
    2 ?4 L" z" V9 Q4 C% |( ]
  157.     Log "aptitude isn't the installer by default" 18 }) [' @8 `' t" {
  158.   else) [( f3 h; u# [( H
  159.     installer=12 f6 H  [6 m/ j. z4 j9 @6 k6 H
  160.     aptitude -y install git lsb-release curl
    / W, i: `" ~; w. s& D& H( g4 Q; c1 d$ o
  161.   fi
    9 U- C. z) R% O
  162. + _$ {4 `7 \3 K0 p+ e
  163.   # Then, let's check that we have the necessary tools to define the OS version.  O( {0 O  s; S! {, O8 y. X/ @6 F
  164.   which lsb_release) u% W: ~, h- e& O. n+ ~' Q3 t

  165. 1 ~4 d4 a% U% [& s- w
  166.   if [ $? -ne 0 ]; then
    " n7 \) w9 e, d6 ]* g2 G: J0 T
  167.     Log "Cannot define your OS distribution and version." 1
    + b9 l  c- T. ]0 M; M
  168.     return 0
    5 U: c( U5 W7 S2 e# |1 x/ W
  169.   fi2 F0 _8 p4 |# G' u
  170. % U) j& y; S) U' H5 v! {0 b# E& {
  171.   local OS=$(lsb_release -si)
    9 }# l- \3 ]: }
  172.   local VER=$(lsb_release -sc)/ W( z: }1 F2 Q
  173.   local OS_VER=1
    + {4 E8 K+ I5 S; |1 M: i% G  q

  174. ( a/ c9 t1 y3 h# P
  175.   # Ask the user to continue
    - M3 Q) Y: |5 M# S: }0 [1 v+ S
  176.   $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install Required Dependencies" \. P: X& S  z' T0 f5 h- Z' p0 t1 J  @
  177.     --yesno "Would you like to install the required build and development packages?" 8 60
    % o: @- X0 e+ d  z+ k1 Y
  178. + C9 ^0 v. K2 o2 Q8 W: j
  179.   # Check the user's response
    2 C$ e2 z! o( G; }' }- e  L
  180.   if [ $? -ne 0 ]; then% O% O- Z7 b0 @$ U2 h# H7 V- P3 Q
  181.     Log "User declined to install required tools and development libraries." 1
    ) R6 O/ B/ d# G- m  l  j
  182.     return 0! g! k3 h- x5 @  X- w2 ]7 O% s. P/ H# N
  183.   fi; u2 ~) E+ m- Y! h* K' s) |4 t7 l

  184. # w! C' E# V& c& `  E2 ]3 {! H
  185.   # Inform the user of the need for root access7 [2 A2 w( n$ ^4 m+ W3 [
  186.   $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install Required Dependencies" \& z, `0 \5 `! Y) p
  187.     --yesno "Installing packages requires root access, which you will be prompted for.\nDo you want to proceed?" 8 605 b' F2 C) o1 M

  188. , U0 Q) t6 B% t, l7 A
  189.   # Check the user's response$ p8 B, p$ c. Y) B# ?4 r
  190.   if [ $? -ne 0 ]; then
    $ @) _' @/ D6 {' m' ~) r
  191.     Log "User declined to proved root access for package installation." 1; u- c1 r1 J8 h( W, j6 \% p4 F9 n
  192.     return 0
    : C! k# d" H/ x4 c( t
  193.   fi/ D( M* H6 O5 ^: s- B

  194. $ e  ~1 W  |6 U1 t
  195.   # Handle OS$ D& T& a- [+ @. U
  196.   case ${OS} in
    # I: ^9 h8 f# v1 t: n
  197.     "LinuxMint")+ K$ C% j. E5 m8 @
  198.       case ${VER} in1 f8 Y& p9 I* v3 N* y, S
  199.         "sarah")
    ; x! a) S) I+ e) j; o
  200.           # Linux Mint 18 - Ubuntu Xenial based
    + j/ Z1 q# x4 B' _8 U2 g9 w
  201.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root! E+ P' Q! m  a
  202.           ;;8 L8 r  O" [1 Q$ L; ]1 }$ U
  203.         "rosa")
    / E7 G1 v% v3 C6 _8 e/ D
  204.           # Linux Mint 17.3 - Ubuntu Trusty based
    7 m! z7 [. c4 b% k- k$ [
  205.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root7 ~% |, j6 Q/ p8 S
  206.           ;;
    & O$ [3 W5 b( z+ w8 W( i! q8 L9 O8 E
  207.         "rafaela")+ v, h: i7 m) g6 X6 f3 k7 e
  208.           # Linux Mint 17.2 - Ubuntu Trusty based; a- q/ L: X9 A0 x
  209.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root# s( i1 f8 j: b3 F
  210.           ;;/ @4 i4 L! d2 q0 a
  211.         "rebecca")! t( \7 O5 o- q4 U
  212.           # Linux Mint 17.1 - Ubuntu Trusty based% h$ }6 G0 |$ e0 h! b/ @
  213.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root5 n6 e6 B/ o% Z( K. U
  214.           ;;8 |) _+ m" b) G7 j& O/ r  J
  215.         "qiana")5 o9 [# z0 O; Y2 e
  216.           # Linux Mint 17 - Ubuntu Trusty based, Y; D+ t9 s( @$ d- I  W
  217.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
    ; d+ [3 i  M; J1 k/ f" z1 @
  218.           ;;
    9 @; |, Y0 v) n8 Y6 u7 ?) L& h
  219.         "maya")" O# X. H, s! O" Q, W
  220.           # Linux Mint 13 - Ubuntu Precise based
    " @$ u  _) `8 G1 i/ f+ T+ o
  221.           su -c "aptitude -y install build-essential cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev" root
    1 y2 g, x5 ^+ B+ @
  222.           ;;5 V( b) M# j0 D+ r! j* k( _
  223.         "betsy")3 v5 }- p* M4 H2 _- c, l: C
  224.           # LMDE 2 - Debian Jessie based
      D' W  R) Z# q6 ^/ B; }8 T; h& ~
  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
    4 `! I7 E& _- G/ H- |  l
  226.           ;;
    - K4 R% u' W/ [0 t/ D
  227.         *)0 D/ T8 n0 ~& A
  228.           OS_VER=0
    6 p) w& ~* ~, p' J) \7 S0 r0 w
  229.           ;;
    $ O: l) L9 h- b( h# w- W
  230.       esac* f4 I$ ]6 A3 j- E
  231.       ;;; I: k2 Y3 W) a& d
  232.     "Ubuntu")$ ?9 X1 w( m3 k" G
  233.       case ${VER} in0 \' }3 k* ?# x8 C& ~
  234.         "precise")
    % l6 K! E+ H9 s' |% ?2 y  l$ m6 r
  235.           # Ubuntu 12.04 LTS4 T  H* X% d  Z& s, T5 ?
  236.           su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
    9 T( ?! K" v. {& V
  237.           ;;/ }$ i4 [( @6 d& j' [# m& `7 s' k
  238.         "trusty")8 _, p# p2 n& f2 _
  239.           # Ubuntu 14.04 LTS9 s' p/ _$ q7 S& x
  240.           su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
    " d& [+ S: Q  J- X1 f, ^! L
  241.           ;;% O0 S7 u" y+ q
  242.         "xenial")
    # c, Y; s$ v4 l
  243.           # Ubuntu 16.04 LTS% r  Q* |6 g  F! ]9 u
  244.           su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root. x; R1 i7 g' r& s5 b1 _
  245.           ;;$ \6 W1 K$ V$ _8 P" S
  246.         "yakkety"). [* V. B$ `5 m2 @- |' ^
  247.           # Ubuntu 16.10& n8 |4 |# G  U- G
  248.           su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
    * w6 w2 \' ?, b" S; H+ X) C8 O
  249.           ;;
    , j* F: Y4 A. P8 p$ q, F2 t
  250.     "zesty")
    ( |8 Q5 {8 E2 W8 }
  251.       # Ubuntu 17.04
    7 s- ^2 I9 P% n; t
  252.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root8 D, U7 x& n5 h8 ]! O
  253.       ;;
    , ~2 L: N" K% j/ L5 A
  254.     "artful")
    & o  {9 ]$ p8 z- x" N. c4 B$ u5 c
  255.       # Ubuntu 17.10& A( v+ j" L5 Z* `# D* o
  256.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
    & H8 G! z( V5 N3 {
  257.       ;;2 M2 n0 b, \9 n0 P+ {  a! B
  258.     "bionic")
    & e) s, Z9 q  n$ T# d( D* R. Z
  259.       # Ubuntu 18.04 LTS
    1 c* t7 N$ d3 j* `+ I& P3 |! b
  260.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root9 b! g1 X0 W* Y9 r) p
  261.       ;;
    ) a6 ~# d6 K2 h: l0 _
  262.     "disco")9 C% Y( J; n# Q, {3 s. [
  263.       # Ubuntu 19.04! y1 J& X5 d$ w+ r5 P' f! J0 Y+ w
  264.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root
    " h7 y$ M8 _9 D3 C
  265.       ;;- [, B; a* Q6 R4 s# b5 @
  266.     "focal")6 _0 R  t3 b9 q
  267.       # Ubuntu 20.04
    $ X! z6 }" ?  w. a- n
  268.       su -c "apt-get -y install build-essential curl autoconf automake cmake libbz2-dev libace-dev libssl-dev libmysqlclient-dev libtool" root; H8 L. e7 U- A* G
  269.       ;;! T0 E. ~+ ~+ v8 }3 b5 \; M
  270.         *)2 O/ T% x" i7 R# P) Z/ O
  271.           OS_VER=0
    . K. t; L+ `' d% g! W( g
  272.           ;;$ i, a# D9 M0 k  Q
  273.       esac7 Q& N' U( k& U+ {! r& G
  274.       ;;( R' S7 I/ x: Y7 }+ ?- |8 ^0 @+ \. \/ i& g
  275.     "Debian")0 K; I6 }# O( k2 e
  276.       case ${VER} in( U4 R" _0 h$ j" }
  277.         "jessie")
    8 ?/ P$ R: y. R1 q( d9 S& p
  278.           # Debian 8.0 "current"
    7 a: C1 {8 @; ]/ D0 j. d
  279.           su -c "aptitude -y install curl build-essential autoconf automake cmake libbz2-dev libace-dev libssl-dev default-libmysqlclient-dev libtool" root
    8 T2 |4 U" n5 f" c+ u3 g6 [. J7 x
  280.           ;;& S, |' M& g, j0 c- ^$ p" e
  281.         "stretch")
    * P0 }9 U+ X1 f, d. c! Y
  282.           # Debian Next
    * s& A" {- W; l+ P# T8 S% K% }
  283.           su -c "aptitude -y install curl build-essential autoconf automake cmake libbz2-dev libace-dev libssl-dev default-libmysqlclient-dev libtool" root% |, d7 B; l0 t
  284.           ;;% N! ?! a+ _# q/ e% T* \$ U
  285.         *)1 ?" e: Z! D( ?$ V
  286.           OS_VER=0: R+ F6 g: y/ J# f
  287.           ;;/ V9 |, l$ i5 ]: N
  288.       esac. Q. B* o  ~% d3 ?/ d/ Q" a4 k
  289.       ;;- h; ?3 D( {+ h6 y3 V7 K
  290.     "RedHatEntrepriseServer")7 o# \/ q' ^$ }$ B0 q0 [
  291.       case ${VER} in& O) W" p' G: S2 S. y: F
  292.         "santiago")) S+ b. H9 I0 @& M; Q1 i4 M
  293.           # Red Hat 6.x6 Z' E! ]% H$ f7 Q) B' \: @
  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" root
    $ t& n/ K- i: D' B: X; i4 a
  295.           ;;
    / e, k& [2 S/ W* I
  296.         "maipo"). `( Q# Q7 N  o) B! f: z
  297.           # Red Hat 7.x3 H9 p# Q$ m6 X: p( j" R
  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" root
    7 b: X2 w' f$ b7 a% p; y; i
  299.           ;;3 F$ M3 |& K& |8 m8 @4 k
  300.         *)/ L: c! E& g8 V* z/ ]' M
  301.           OS_VER=0
    2 L0 R6 z+ s& k5 b- d
  302.           ;;3 }9 O& R* N5 A% K; l
  303.       esac- @7 f# }) M, u1 J. y
  304.       ;;
    1 S7 z( ^1 l# Z. K, g
  305.     "CentOS")8 Y* B% S$ p+ Z1 ?# A6 h. X' C
  306.       case ${VER} in
    . ^: g7 Q; L6 B4 Q4 Z4 r/ Y3 ^
  307.         "Core")
    ( y, L5 u. G, B
  308.           # Default CentOS - Adding necessary RPM third-party.3 n) l8 h1 N. h0 }
  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  b( }: @, |" u" j) B1 V
  310.           rpm -Uv ftp://rpmfind.net/linux/centos/7/os/x86_64/Packages/perl-Net-Telnet-3.03-19.el7.noarch.rpm
    ) Z# ?6 b* g, W# q
  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
    , y3 w( g; a0 E# I4 a5 b$ ?6 [
  312.           rpm -Uv ftp://rpmfind.net/linux/centos/7/os/x86_64/Packages/libtool-2.4.2-22.el7_3.x86_64.rpm
    : d! b0 S& N  s. Z! M
  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
    5 t9 l2 _/ Q$ ], H8 ~- R
  314.           su -c "yum -y install epel-release"
    2 u# {- j' I8 {. J
  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' _( r5 F9 {" i2 }' J
  316.           ;;
    0 O% o& B* T# k
  317.         *)& P: ]# [- j- f% f; k! y
  318.           OS_VER=0
    4 {: Q. d6 [7 I2 ]. X! K- }0 {
  319.           ;;8 t% X" b( [  c$ C$ W, v1 \
  320.       esac+ c) v' G9 s5 ?7 O  `* X
  321.       ;;' U3 v* M- e) D8 C) Z. l' B
  322.     "Fedora")" k) B' x# n& ~1 P4 S* y
  323.       case ${VER} in
    & h  Y+ g$ N( _1 @9 q2 z- |9 R
  324.         "TwentyFive")$ l( B- Z8 ?, h9 y/ |
  325.           # Fedora 25 - Adding necessary RPM third-party.
    5 ~; T( ]" Q1 H4 Q
  326.           su -c "yum -y install autoconf automake libtool gcc-c++" root( Z) d* B! K" c
  327.           # Getting and building ACE. Not provided in RPM for Fedora.... v% `6 ^# z- S3 M0 S
  328.           rm -rf ACE-6.3.3.tar.bz21 e, a6 I/ Q9 C* _
  329.           rm -rf ACE_wrappers
    9 g7 j( q9 l, |9 m
  330.           wget ftp://download.dre.vanderbilt.edu/previous_versions/ACE-6.3.3.tar.bz2: ?+ R* V: r& m8 O2 T# n$ i
  331.           tar xjvf ACE-6.3.3.tar.bz2
    ; a! Z9 ]$ L" M4 L
  332.           export ACE_ROOT=/root/ACE_wrappers
    1 Z: ~- u8 q% M- P0 U& f
  333.           echo '#include "ace/config-linux.h"' >> $ACE_ROOT/ace/config.h) P8 Q7 Q4 {3 M
  334.           echo 'include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU' >> $ACE_ROOT/include/makeinclude/platform_macros.GNU9 ^3 B" Z' p% L1 S- m
  335.           echo 'INSTALL_PREFIX=/usr/local' >> $ACE_ROOT/include/makeinclude/platform_macros.GNU
    ( K3 |2 ?! H' f* K
  336.           export LD_LIBRARY_PATH=$ACE_ROOT/lib:$LD_LIBRARY_PATH. L, A/ T& \  j1 o( _1 K: W# l. ?
  337.           CD $ACE_ROOT
    : a% D' {- |2 q% k
  338.           make
    ; }: N+ n1 i  ~2 \! B
  339.           make install# p, x1 i7 m* s1 u6 ~9 A7 D
  340.           cd ~
    5 z- U5 R4 h- m2 J8 f
  341.           # Installing remaining dependencies..& q: V+ F4 U& H" N
  342.           su -c "yum -y install cmake openssl-devel mariadb-devel" root
    ; x. D! N$ b$ l
  343.           ;;
    8 B* _! O( A/ x# `1 C  V, c
  344.         *), H+ }! T& H0 c; O
  345.           OS_VER=0% O; y/ [# k2 a2 G( l- I
  346.           ;;# q1 f6 e, Z% C* |9 t
  347.       esac& ^8 K5 m1 Z, c3 \3 y
  348.       ;;" l' M# x7 m- n  ~: x" O
  349.     *)
    # o1 Q( I6 f6 h
  350.       OS_VER=04 O: [' p2 v( I7 ]3 Y
  351.       ;;
    & X2 t1 `; S* D
  352.   esac
    ' P1 s, y0 `4 H/ `

  353. # Q2 I% Q# G: H
  354.   # See if a supported OS was detected
    7 ]! Z/ d" r* m1 \) Q% t
  355.   if [ ${OS_VER} -ne 0 ]; then" t& O6 ?5 S8 D
  356.     # Log success9 h2 ^& ^2 v) V& o( e( S
  357.     Log "The development tools and libraries have been installed!" 19 O9 U" y7 b$ j" T1 _
  358.   else: F& D) r, h8 {# r6 {
  359.     # Note the error5 v8 L8 X+ ~4 Q, Q7 S
  360.     Log "Could not identify the current OS. Nothing was installed." 1
    2 T: y! o: @3 |! y
  361.   fi( ]5 R- o: v8 w+ K0 |1 q& |
  362. }
    1 q# W0 n  U8 u8 y

  363. ' H  a% G  k3 p/ q' U$ U

  364. . x! V0 E  J" E: a& V2 Q
  365. " G8 s. ~4 i1 T6 V
  366. # Function to get the WoW version0 x6 e8 F1 u' T+ t( J5 @) x* c
  367. function GetRelease()
    4 a( u1 ^2 G" B
  368. {. b0 a# @! ]& b5 e1 u! R
  369.   VERSION=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Choose WoW Release" \
    & }2 ^  s2 X2 G6 u8 K2 [2 q
  370.     --menu "Select a version of WoW" 0 0 5 \2 `3 u# U4 v3 J2 B
  371.     0 "Original Release (Vanilla)" \3 X" _' j0 w( j# u; [3 e, K
  372.     1 "The Burning Crusade" \
    7 R- n0 Z: D5 [
  373.     2 "Wrath of The Lich King" \2 k2 B5 q$ Q1 x% i: _. @
  374.     3 "Cataclysm" \& u) L, s( L9 ~' m
  375.     4 "Mists of Pandaria" \6 {" Y- u3 H! V
  376.     5 "Warlords of Draenor" \4 n. Y) v; S8 ^4 g7 q( q0 K3 p. I- W
  377.     3>&2 2>&1 1>&3)
    6 F  N$ Q! \9 ~; J. k4 P6 o9 O
  378. " H- u9 J$ }" `* A* F* X* _
  379.   # Exit if cancelled
    # q# V* w6 x, Y+ C5 J. k
  380.   if [ $? -ne 0 ]; then& p; O' u# l* \+ f. P  _
  381.     Log "Version selection cancelled by user. No changes have been made to your system." 1
    5 K0 n. N9 ]& z% t) }. o+ u4 Y
  382.     exit 0
    " @0 T* _. I# R1 ~$ d
  383.   fi
    , T- Q7 ~7 V& g& C$ F8 i
  384. 0 A1 i( s. ]) Z9 V3 X5 S
  385.   # Set some defaults based on the release
    3 R% o( {  d9 q" n" S+ h
  386.   case "$VERSION" in9 ?( K8 x  }" J+ ?& x3 V
  387.     0)( @9 b2 }, O& W
  388.       SRCPATH="$ROOTPATH/zero/src"
    3 X6 l( i# d6 w( _
  389.       INSTPATH="$ROOTPATH/zero"" b2 Z9 n2 g1 |1 d" j/ }
  390.       DB_PREFIX="zero"* N# M; g3 X& {- b6 S; B) ?% n' O! E
  391.       ;;9 p& g& }6 F& \$ m" O4 e

  392. ) [0 X1 A9 {2 t! O# I8 {
  393.     1)
    0 G2 y7 [, d" S0 e" s" M
  394.       SRCPATH="$ROOTPATH/one/src"
    9 N2 _4 t9 f2 [
  395.       INSTPATH="$ROOTPATH/one"9 R+ c' H$ u/ ^, Y5 u) d
  396.       DB_PREFIX="one"
    3 s0 u' e0 B4 Y. @" G+ U5 A* g, @
  397.       ;;
    3 z8 f2 }+ E5 A- j: }& ~( }

  398. 1 W1 o3 O4 [7 h, ?, r; C" f: t
  399.     2)& m2 V& t% {2 X. Y3 A0 T1 |
  400.       SRCPATH="$ROOTPATH/two/src"
    ' m. [7 j8 L# C0 h# \/ i4 y1 @
  401.       INSTPATH="$ROOTPATH/two". p1 I* |* W0 ]: _
  402.       DB_PREFIX="two"
    & e8 W) G9 w# e3 M
  403.       ;;
    / A; n: X7 p2 j$ l
  404. 6 E' p: N& s1 E
  405.     3)
    . a5 Z* A( A9 {& V* J7 \
  406.       SRCPATH="$ROOTPATH/three/src"
    5 M% O5 m4 y! z) H5 Z4 @
  407.       INSTPATH="$ROOTPATH/three"7 k  W0 ]' K9 k- }8 c* p
  408.       DB_PREFIX="three"; }+ G, U: f. \6 s8 F: c
  409.       ;;
    6 n% M0 n( P% b& V
  410. 2 J6 Q8 I+ P! G- Z0 ~8 I7 {
  411.     4)
    + x, K- Z" d( v
  412.       SRCPATH="$ROOTPATH/four/src"
    1 z8 d  S" g1 a4 \2 S2 [1 e, O' N
  413.       INSTPATH="$ROOTPATH/four"1 E1 `9 d6 y' U+ ^, @! d: J8 f
  414.       DB_PREFIX="four"
    1 n" y& F# n) H- v% t% I
  415.       ;;* h9 y0 {+ O" @/ S5 ]$ d* f
  416.     5)
    5 u9 F. U$ ?  j4 L4 I( \0 q
  417.       SRCPATH="$ROOTPATH/five/src"
    3 A5 M0 y. E6 s: H& J# m
  418.       INSTPATH="$ROOTPATH/five"
    0 c: ~  ]/ n: |! o; }0 F$ N
  419.       DB_PREFIX="five"
    ) M" G' |( y0 ?8 m# V( y7 M
  420.       ;;' m" r" ]1 Q- c. {
  421.     *)
      \. [$ g; F- x
  422.       Log "Error: Unknown version selected!" 1; L" s1 ]+ U! }  `& h' v
  423.       exit 1
    / D+ x  `% J! e* ?
  424.       ;;6 H& y& }0 f8 P: Z# P
  425.   esac0 |. C' M. ~8 g5 C
  426. - i3 r4 k* L% e5 \3 r6 Z: H  ?2 o
  427.   # Now set the correct source path if the repo has been cloned already  M# m6 {" N: F0 t6 w
  428.   DetectLocalRepo
    + M5 i3 C$ S( ^7 I; p2 ]- p0 c
  429. }
    : X, z' s$ U4 u

  430.   g, i& |4 Q$ p& D# ^3 p& X
  431. # Function to setup the technical user
    * N$ q. m9 y) E# {
  432. function GetUser()
    ' `3 b. j# o3 P: c! ?+ Z
  433. {8 I- q4 a$ Z1 \
  434.   local TMPUSER="$USER"- Y/ ^4 C% |7 }9 A( `6 V9 J/ C

  435. . e+ z; P7 u3 `) w, d" \% _
  436.   # Set the user, F% Z( s' ^8 J/ ^! C$ ?( N
  437.   TMPUSER=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User to run Mangos" \' c# Y: @0 |1 `% ^
  438.      --inputbox "Default: $USER" 8 60 3>&2 2>&1 1>&3). r6 Y- \& {5 u& {; e; i3 T
  439. $ U- _- A3 Y/ J5 f* f0 P
  440.   # Exit if cancelled- C* t" x  G. q% h8 O9 g( V# q. e
  441.   if [ $? -ne 0 ]; then8 ]- d$ k0 u( a) Y$ t
  442.     Log "User selection was cancelled. No changes have been made to your system." 1; f: b, R! J- Z+ _. n
  443.     exit 0
    8 Y* m. k+ g& o: |3 a# h
  444.   fi/ \" X% T$ a/ o* W
  445. ! m) q7 S. S& {8 T; z
  446.   # Change the user only if it was modified
    4 j" e3 j: c- z1 |
  447.   if [ ! -z "$TMPUSER" ]; then7 y8 {$ h/ ]6 W1 t+ k% a0 ^* d
  448.     USER="$TMPUSER"
    $ D/ g, _: t& D: p: S
  449.   fi3 u; g* m" J& K9 l4 n3 W; n
  450. / g" Y6 E% R4 D
  451.   # Validate user7 U3 p$ q5 m% v  u7 t; S; }
  452.   id $USER > /dev/null 2>&14 x, Z7 t0 |5 _3 M$ l: V% m6 D
  453.   if [ $? -ne 0 ]; then
    ! k! ~0 V1 g* z8 a, u3 E
  454.     Log "Creating user: $USER" 1# j$ G' `$ F0 @, ~' G
  455.     useradd -m -d /home/$USER $USER > /dev/null 2>&1
    : I" r6 e# r, y0 Z1 M6 H" f  H
  456. 3 @' }3 p& G' L
  457.     if [ $? -ne 0 ]; then3 m$ y: l3 t+ F. y* c  W
  458.       Log "Error: Failed to create the specified user!" 1+ _9 w( t' V6 e, K9 @
  459.       exit 1+ n7 }# F0 B  I9 {/ |+ D( f3 x6 ^
  460.     fi
    . d8 H$ j& l. K$ O

  461. 8 s; l' w; C  P" R
  462.         usermod -L $USER > /dev/null 2>&1. s& a2 Z3 Y9 D" X! L  ~4 G
  463.   else) b' z0 q# H0 T
  464.     # User already exist, asking to keep the user
    9 w, F) T; s$ W4 |
  465.     $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "User already exist" \" U- ?3 l  F/ ~, F' H
  466.       --yesno "Would you like to keep the user "$USER"?" 8 60
    5 Z& ^( ?0 F' _  }7 U1 u
  467. " G& U$ L. R7 A. p1 f
  468.     if [ $? -ne 0 ]; then
    * L/ f( m; b0 }$ c+ J$ b" }5 g! z! c. ^
  469.       Log "Removing user: $USER" 18 H( |0 B' Q, R% N$ o2 P# }
  470.       userdel -r $USER > /dev/null 2>&1
    0 u4 z3 o1 M) w7 y

  471. . I- e6 T1 S6 Z) x0 }' K5 |
  472.       Log "Creating user: $USER" 1/ @$ N* }/ S1 |5 }1 l$ Y. R
  473.       useradd -m -d /home/$USER $USER > /dev/null 2>&1
    " f- @, s1 u9 D+ @* n

  474. 8 |9 h2 X0 z& ]  T
  475.       if [ $? -ne 0 ]; then3 p7 Y, w+ u- `# U
  476.         Log "Error: Failed to create the specified user!" 1
    * j) e  K2 C& c0 o% J( Y
  477.         exit 1
    9 A2 d3 ~# o* c$ f) p0 @
  478.       fi
    - P. N  t3 z: Q+ z' z
  479. 0 }- r; j" S/ c+ [) p- p# \; A* j: d# R
  480.           usermod -L $USER > /dev/null 2>&1" B+ F$ {4 P5 ~) W3 o, @6 I
  481.     fi
    - C9 Q) p( x# D& l
  482.   fi% L2 V+ {; P! N: U. P+ @
  483. - H7 y- _- h) L! k5 }% e* j0 A
  484.   ROOTPATH="/home/"$USER. Z& m: v% f- c. k$ o! c, }3 E
  485.   Log "User: $USER" 09 n; R& q7 z/ b: s% o
  486. }; D/ s, c0 S! L( ~4 Z+ {% t

  487. 6 j$ C, b8 X7 d. }5 u! C& F! h
  488. # Function to get the source and installation paths6 ?& G' V0 k' V- p7 I+ J- W/ ?
  489. function GetPaths()
    & J; m2 A. P( z* j4 I, `
  490. {; M1 R) g1 l/ ]  T
  491.   local TMPPATH="$HOME"
    ( J! s1 {9 v2 W; B& P8 L

  492. 5 H/ {6 J1 Q& p$ I7 M! ]
  493.   # Set the source path$ Y+ A3 b- |' `( L* ~! Q
  494.   TMPPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Source-Code Path" \' U. R0 Z/ P* n2 n' n0 V; ?2 Z
  495.     --inputbox "Default: $SRCPATH" 8 60 3>&2 2>&1 1>&3)
    * l! ]3 a6 i( ?- Y* `4 q
  496. 8 [+ y2 k+ o  O" W+ I1 r
  497.   # Exit if cancelled
    3 P6 X9 _1 l* d7 Y: D
  498.   if [ $? -ne 0 ]; then5 \* u1 ~  X2 B0 V& g  ?
  499.     Log "Source path selection was cancelled. No changes have been made to your system." 1
    4 T1 J' z; @0 z9 `3 t5 Q5 r  C
  500.     exit 09 u! L7 x: k* S
  501.   fi
    4 K) Q* L4 t( Y' P% c/ ~1 I, z0 l
  502. - u$ V$ C" G$ @4 U( Y
  503.   # Change the path only if it was modified
    ; [0 u) _, `& N7 S% @
  504.   if [ ! -z "$TMPPATH" ]; then# y* U) q4 Y+ Q  [" J$ }' n
  505.     SRCPATH="$TMPPATH"
    % k. i! c5 R' t: s
  506.   fi( q- h, L) Q5 A' K3 J* Z

  507. & V" `# N+ J7 H6 z. F4 M
  508.   # Validate source path
      J2 W" d0 |, O4 |
  509.   if [ ! -d "$SRCPATH" ]; then: ]4 Q6 q0 ~6 n) D5 I
  510.     $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path does not exist" \
    . o4 _" L# o3 e* S/ w/ y
  511.       --yesno "Would you like to create the directory "$SRCPATH"?" 8 60
    ) U6 S) M# J9 ]# p2 L2 @6 X

  512. ! D( e, {2 o1 L0 E2 d) H4 L
  513.     if [ $? -eq 0 ]; then
    8 S. q; k3 b: {# o
  514.       Log "Creating source path: $SRCPATH" 1
      ?, I. h1 D" y1 W
  515.       mkdir -p "$SRCPATH" > /dev/null 2>&1
    6 O  o) [& L3 b! }! l7 w3 b

  516. ; N/ ^8 e' Y# j
  517.       # Check to see if the directory was created2 I$ @3 p. C) c3 r# @
  518.       if [ $? -ne 0 ]; then
    , D# v' P5 D/ g. L* E
  519.         Log "Error: Failed to create the specified source-code directory!" 1
    8 e7 z9 v- T0 f4 q( N8 |
  520.         exit 1$ L' l. C7 r+ J2 E- g
  521.       fi9 Y  m  l# L0 H# s& [, ~
  522.     else
    . e# z0 h9 K, ^* I; q; _8 G( i; D
  523.       Log "Source path creation cancelled. No modifications have been made to your system." 1
    9 b% f3 H- Y3 a; {  N) T* D! E
  524.       exit 04 t; b  E: k$ e5 K8 s# h2 t/ F
  525.     fi
    ) U0 b  t" A! d1 q! r
  526.   else
    ) b9 S7 o- l3 p6 ^0 O2 e' ~
  527.     # Check for old sources# W4 C! r0 W+ Y2 S7 R2 b4 i
  528.     if [ -d "$SRCPATH/server" ] || [ -d "$SRCPATH/database" ]; then
    . _% T0 a9 r- @8 ]. @/ h$ W
  529.       # Ask to remove the old sources# Q# d9 ]& C( c$ u/ f, [* X% r
  530.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path already exists" \
    0 V8 b5 h, s( u9 n/ c
  531.         --yesno "Would you like to remove the old sources? (Answer yes if you are cloning MaNGOS)" 9 60
    5 ]% m3 C' P6 f
  532. 8 k" X$ i6 s' \( v- G7 i0 P
  533.       # Remove the old sources if requested
    , k* Z3 q4 _/ V  {2 m$ ^
  534.       if [ $? -eq 0 ]; then
    1 i6 h  F  b* w/ r2 b# _; l
  535.         Log "Removing old sources from: $SRCPATH/*" 1  f* w% G. N  ?' L
  536.         rm -rf $SRCPATH/*0 Q1 B* j9 ?7 i: w
  537. 2 h' K1 T6 z( O2 D1 y2 M' |* l
  538.         # Check for removal failure
    + w% A( P( d1 f5 g* C6 M
  539.         if [ $? -ne 0 ]; then
    0 ]0 s7 b. C5 q4 x8 J
  540.           Log "Error: Failed to remove old sources!" 18 a: m; R7 y! x' C+ t0 r- W6 o
  541.           exit 1/ z& }6 D( l, v
  542.         fi
    5 r0 b( H2 W* s# m" z% {9 {* i
  543.       fi/ b8 C' t7 N1 O2 w4 X) g- ^/ d
  544.     fi
    2 \3 K4 o: E7 {/ b, y' _5 h
  545.   fi
      `3 h4 n4 p2 s. d- r) h# }
  546. . _) K2 j0 u9 j
  547.   # Set the installation path
    : B( j9 ^$ r+ l
  548.   TMPPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Installation Path" \7 B  E( F: `: d, R! h) G
  549.     --inputbox "Default: $INSTPATH" 8 60 3>&2 2>&1 1>&3)
    9 o& N2 U3 w2 e7 }& a

  550. * }# Q3 `. ?( V6 Y" x9 G) X: j
  551.   # Exit if cancelled2 A" j) O& U  V# Y
  552.   if [ $? -ne 0 ]; then
    % q1 M1 n( p6 Y, j4 \
  553.     Log "Install path selection cancelled. Only the source path has been created." 11 k5 [$ ^$ R4 ?* M2 G
  554.     exit 0
    ( U. |: P. x+ u% j! |- u
  555.   fi! P# {2 I. v/ y( n7 K- `( _1 l* j5 g( @
  556. 8 L, v2 ^' h! C  `0 Y9 `; ]3 M7 S6 G% l
  557.   # Change the path only if it was modified: q) j# |& g3 G: B% p; R
  558.   if [ ! -z "$TMPPATH" ]; then# M1 u. `8 u0 i- C/ V+ x
  559.     INSTPATH="$TMPPATH"
    ; k9 g! M) W5 A
  560.   fi5 R( v) d+ E7 x4 O; ?( D) ]' B
  561. & f# g1 a; U# v% k% r% P
  562.   # Validate install path
    # E+ b" g8 L3 V8 E/ z0 `7 E
  563.   if [ ! -d "$INSTPATH" ]; then
    1 q4 ?6 b' d( M9 R- T0 l: ^
  564.     $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path does not exist" \
    # u6 s5 s$ _0 m! t3 [* O
  565.       --yesno "Would you like to create the directory "$INSTPATH"?" 8 60
    1 @: {) x8 U  S9 b( Z# A
  566. 0 x! a9 J  }1 c, b  X, h
  567.     if [ $? -eq 0 ];then# U9 Q- I- F+ `  u9 [
  568.       Log "Creating install path: $INSTPATH" 1. y) j9 v9 C7 t6 A) G+ s5 U
  569.       mkdir -p "$INSTPATH" > /dev/null 2>&1. V- F: P2 e% J, M

  570. 5 r% n) H& @. p6 g+ N7 D6 U3 Q
  571.       # Check to see if the directory was created
    . b4 @  L/ w  e# S0 \* L, E
  572.       if [ $? -ne 0 ]; then6 h$ m1 L1 K$ \! [
  573.         Log "Error: Failed to create the specified installation directory!" 1( i' i" H- N% {3 L2 Z' j  i
  574.         exit 15 m- y/ S2 ]! c% J9 |
  575.       fi1 o9 z$ S% D  Y: K
  576.     else
    6 i' z1 ~- L2 ]2 t6 @$ }) z5 U
  577.       Log "Install path creation cancelled. Only the source path has been created."
    / q) j2 D2 _* O" N
  578.       exit 09 o2 O* A4 a. c8 P. s
  579.     fi& }2 Q2 a0 `( Q. y( W5 l* w
  580.   else9 ]" `" Y5 `7 F' w& P0 ~) N& q
  581.     # Check for an old installation
    7 V. ]! c: E9 }1 G
  582.     if [ -d "$INSTPATH/bin" ] || [ -d "$INSTPATH/lib" ] || [ -d "$INSTPATH/include" ]; then
    ' e$ r! U; C( g4 U1 [' b
  583. 0 f' J# @0 {' y" R- K
  584.       # Ask to remove the old installation; L4 v  [. Q6 c+ q% U* \
  585.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Path already exists" \
    1 G+ S; }  B& F4 T6 _
  586.         --yesno "Would you like to uninstall the current version of MaNGOS first?" 0 0
    2 `, U  T& K) l# S" M
  587. 4 ~9 A( n+ r. {& d( s- l
  588.       # Check the user's response( i" F6 C* i7 f
  589.       if [ $? -eq 0 ]; then6 m) Z) [" u% ~( {2 f- ^
  590.         Log "Removing old MaNGOS installation..." 1
    . r- B7 K$ k+ D0 v, X7 A+ Q
  591. , p8 I2 S2 l& C1 I" f# w) _  l
  592.         # Clean up the binaries
    , M/ q3 v- P6 p, I% ?
  593.         if [ -d "$INSTPATH/bin" ]; then
      B' V* Q3 Z2 r. y* o% a$ D
  594.           rm -rf $INSTPATH/bin$ |  L5 k, T; A
  595.         fi: M0 ~! ]0 [8 m5 D  E( r

  596. * c! l3 Z) ?2 P* j. ?; N4 u; f
  597.         # Clean up the old includes: S, g& p7 h8 g
  598.         if [ -d "$INSTPATH/include" ]; then
    2 ]+ Q0 x' r5 Z0 F
  599.           rm -rf $INSTPATH/include' ]# y1 J7 K, k3 N
  600.         fi
    0 X' C6 r  y# W9 s% y5 P7 X% I

  601. % X5 ~! B3 \, x, a% J
  602.         # Clean up the library files$ o3 @3 T9 V4 n8 H2 v# o- p$ {
  603.         if [ -d "$INSTPATH/lib" ]; then- l/ k8 K/ I8 |( ^( V7 x8 M
  604.           rm -rf $INSTPATH/lib/ {+ z1 y4 V8 d! E" y  `2 {
  605.         fi
    6 E' X* s7 Z  A
  606. 5 |; |! G6 y5 u
  607.         # Clean up the old logs
    : i+ G. b& @+ ?0 ?4 O! y
  608.         if [ -d "$INSTPATH/logs" ]; then  q& o) s  ]. p# ]2 L
  609.           rm -rf $INSTPATH/logs/*
    - p0 d- b+ G  N
  610.         fi* [+ ]2 A+ F6 P6 t. M/ N) i, m
  611.       fi
    ; p' x8 u- Q- Y2 Q# y3 ]
  612.     fi! m9 w8 A; C$ j5 ~
  613.   fi" _5 Z+ g& f& H# J. H

  614. ' x4 B: |1 _7 X
  615.   # Log the settings
      g0 J1 L  p  W5 R; r
  616.   Log "Install path: $INSTPATH" 0
    ( b- @' a; T+ z( G* Y) O7 r+ k
  617.   Log "Source path: $SRCPATH" 0
    4 v: U) ^8 [6 }- y
  618. }
    ; `+ p5 n; D  H1 V  G; Q7 f0 i. U. @
  619. . r/ j& R$ Y7 ^# F( w6 B' c

  620. ' @$ a& a4 Z* [; d7 n& S# n
  621. , `6 R* }% L" F
  622. # Function to clone or update sources8 z% u- w3 r" x+ p
  623. function GetMangos(): O  ?" S% Y# M
  624. {  X( P0 f% v+ l. x$ l4 ~' u
  625.   local CLONE="0") ~! C! F: U$ O' ~8 Z
  626.   local BRANCH="") S4 V, t# N- K4 j' D

  627. : t* k+ a! b5 Q
  628.   CLONE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Clone or update MaNGOS" \/ T3 m% [) s  z* }2 i
  629.     --menu "Would you like to clone, update, or continue?" 0 0 3 \3 [2 Y. Z( H$ s! I
  630.     0 "Clone a fresh copy of MaNGOS" \) V- C/ a# m2 s
  631.     1 "Update your existing copy of MaNGOS" \
    ! [' F1 j2 N. D. s3 g3 `
  632.     2 "Use existing copy" \0 p( _1 i' u: s! P
  633.     3>&2 2>&1 1>&3): H5 C4 F3 _! b  e: Y1 S# ]+ T9 q) ~& c
  634. . G/ I- C: ^$ G( u9 J. o
  635.   # Exit if cancelled! k- S7 H# D% n: L+ Y
  636.   if [ $? -ne 0 ]; then
    6 f' }( w* T+ n5 P) w. ?
  637.     Log "Source cloning cancelled. Only the install and source paths have been created." 1
    4 Q# k2 a7 \% R5 |: G
  638.     exit 02 [% I! Y0 E- V- k) P
  639.   fi
    8 `: @/ \) M- |1 J0 G9 r+ _* q' t

  640. * x4 I1 D( a! H6 J% _1 g
  641.   # Clone from scratch if selected
    % _" F$ D0 X" V9 \9 o/ M* `+ W
  642.   if [[ $CLONE = *0* ]]; then& R4 M. `: d; y8 o5 ?# Z! s
  643.     # Pull a different branch?2 x2 Y& [. q& }$ S  t
  644.     case "$VERSION" in4 f  P$ L: C  i5 G, |' C
  645.       0)
    - ~+ ?+ }3 ?1 b# U4 Y
  646.         releases=$(curl -s 'https://api.github.com/repos/mangoszero/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')
    1 c1 M( d' C7 u8 z$ C4 t
  647.         ;;- ~! \2 V. n' Q3 j. f- w. K/ k8 x
  648.       1)* h# M5 ^5 S1 w! M7 Q5 B
  649.         releases=$(curl -s 'https://api.github.com/repos/mangosone/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')$ P( ^6 ^6 E; O" h/ ^
  650.         ;;
    # {& G$ b3 V+ d% _5 I9 S
  651.       2)0 }+ N3 D8 a& c+ q. ?, w
  652.         releases=$(curl -s 'https://api.github.com/repos/mangostwo/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')
    . g4 a/ ^" F* L' u3 L0 @
  653.         ;;, [$ m! z  K: R* [7 q! e
  654.       3)
    2 d! J) w8 i  j& r7 i
  655.         releases=$(curl -s 'https://api.github.com/repos/mangosthree/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' '); u- m  J: O$ I6 N- w$ ~
  656.         ;;+ P( V( N" Y" O% H1 y4 l" z
  657.       4)5 u# x) a# ^' J8 E, {2 i" }" m: q
  658.         releases=$(curl -s 'https://api.github.com/repos/mangosfour/server/branches' | grep "name" | awk 'BEGIN{FS="""}{print $4}' | tr '\n' ' ')
    & h: o$ p( k9 ~- h% _0 Y
  659.         ;;
    9 T% [$ k  h3 w
  660.       *)
    % b# l* S1 h, p$ L1 {5 y# w
  661.         Log "Error: Unknown version to select branch" 1
    & z/ [2 p! j  t6 ^. R
  662.         ;;7 }1 F! e. y# M0 S
  663.     esac
    9 D9 y( [7 n, k, }9 v0 E; T

  664. + P1 t8 S" E0 I* L6 W
  665.     COUNTER=1
    ! p$ _6 k0 ]9 w3 d
  666.     RADIOLIST=""  # variable where we will keep the list entries for radiolist dialog
    & @! h$ z$ ]8 }  f* A0 n* I- f2 G
  667.     for i in $releases; do
    # V) {  a* {7 W5 R  ?% y
  668.       if [ $COUNTER -eq 1 ]; then
    5 _  X) i3 m& t3 h+ j, |1 f; e
  669.         RADIOLIST="$RADIOLIST $COUNTER $i on "
    . {1 }; y. C2 S3 v% \5 Q, c) t" @
  670.         BRANCH=$i
    6 }8 a; s/ t5 }# N  h/ m/ s2 u7 w
  671.       else
    6 o$ C% A" X+ ^+ Q$ E6 L
  672.         RADIOLIST="$RADIOLIST $COUNTER $i off "% a& l: Y+ P+ d0 {# T
  673.       fi
    ! v, g, S. v5 {
  674.       let COUNTER=COUNTER+15 v0 M7 ]: \1 N: ^' q
  675.     done$ n+ I# Z) ~) L+ U3 }( B+ i1 u
  676. $ [! _) W2 A+ s4 q; B3 H
  677.     TMPBRANCH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Branch" \
    ; x8 N6 {! `3 ~$ C& E! v' n
  678.       --radiolist "Default: $BRANCH" 0 0 $COUNTER \2 H# e  \! A0 j+ V& z3 G
  679.       $RADIOLIST \. G2 k1 X7 j$ ^  |- U. N% K
  680.       3>&2 2>&1 1>&3)7 j, h7 G* n# O0 R3 q' @
  681. ! x& v* {$ W$ F3 N2 v$ r7 t
  682.     # Exit if cancelled
    ' T5 |% I2 t2 H# \
  683.     if [ $? -ne 0 ]; then
    . }% r* F# J5 T# g& g5 j/ \
  684.       Log "Branch selection cancelled. Only the install and source paths have been created." 1% d  x% ]# m' X
  685.       exit 09 {- p# R3 K0 |$ L4 N4 S. w' c
  686.     fi6 [1 h4 u" F1 E/ ~8 o; h) r

  687. 5 i2 ^7 y" M% k$ M
  688.     BRANCH=$(echo $releases | awk '{print $'$TMPBRANCH'}')
    ' \, S) r: l8 d. @3 L
  689. 1 \/ b5 A3 Z  f5 ~+ i- w
  690.     # Set the branch6 k* N! T% ?2 L+ f
  691.     if [ -z "$BRANCH" ]; then3 r3 E$ y+ w5 D* k- b, i/ k! v
  692.       BRANCH="$releases | awk '{print $1}'". u+ Q* Q) @4 k, J+ c2 ~
  693.     fi. s) N& T( n% P, ^" _0 ^

  694. * |0 g' d( |& g8 ]$ I! O0 D
  695.     # Clone the selected version. [. ?+ w( \" g, n; [7 b) f+ p
  696.     case "$VERSION" in  W1 v; i# p1 @3 G, \5 v' ]& |
  697.       0)
    ) W% a% i/ X$ \- W6 g
  698.         Log "Cloning Zero branch: $BRANCH" 1
    9 B. g5 x$ B) G4 u9 u9 `
  699.         git clone http://github.com/mangoszero/server.git "$SRCPATH/server" -b $BRANCH --recursive# |% e/ b' [% Q% b
  700.         git clone http://github.com/mangoszero/database.git "$SRCPATH/database" -b $BRANCH --recursive9 ~* x2 p# i. b) E6 \! U+ S* q0 Q
  701.         ;;, h( Q/ l5 S( H$ F; I6 C

  702. , b" A; x$ F* p
  703.       1)( e6 g1 j& p; q. U! p7 T
  704.         Log "Cloning One branch: $BRANCH" 1' A: G. X/ @( E$ {! W1 n
  705.         git clone http://github.com/mangosone/server.git "$SRCPATH/server" -b $BRANCH --recursive
    + O4 [+ ]8 v7 L" |$ D
  706.         git clone http://github.com/mangosone/database.git "$SRCPATH/database" -b $BRANCH --recursive' o( ?5 ?, a; z% w# O) b5 P9 T2 \
  707.         ;;! s$ f7 o  }  h: E+ P  {

  708. # `) w+ |' x) J( P9 w
  709.       2)
    % k& R7 K6 L% s
  710.         Log "Cloning Two branch: $BRANCH" 1
    " z' w$ S8 A( w' V) V) v
  711.         git clone http://github.com/mangostwo/server.git "$SRCPATH/server" -b $BRANCH --recursive; p5 w5 w3 u! S2 _! ?4 v7 e
  712.         git clone http://github.com/mangostwo/database.git "$SRCPATH/database" -b $BRANCH --recursive- }+ E2 r  J  b- u5 I2 x% e) W
  713.         ;;0 R# D; x- n4 l6 g# \. W/ Z( g

  714. # j* P* [% _* ~: Z8 \$ i; I6 ]
  715.       3)- R, X2 }& G2 c" y7 [
  716.         Log "Cloning Three branch: $BRANCH" 1+ Q& d" V7 ^) J6 d( Z3 j
  717.         git clone http://github.com/mangosthree/server.git "$SRCPATH/server" -b $BRANCH --recursive1 R1 U/ ?! x3 v& z5 |7 }, v
  718.         git clone http://github.com/mangosthree/database.git "$SRCPATH/database" -b $BRANCH --recursive7 I% n1 Q: n0 p. R2 V( f2 r
  719.         ;;) X# J, g1 t, E% P

  720. 4 R- z; x4 U% Q0 ]6 M
  721.       4)
    " K1 T+ e6 `+ Y
  722.         Log "Cloning Four branch: $BRANCH" 18 k: p8 W# p/ U( A0 h* U/ W
  723.         git clone http://github.com/mangosfour/server.git "$SRCPATH/server" -b $BRANCH --recursive6 K5 T3 X, U& h! I) W: a- Y
  724.         git clone http://github.com/mangosfour/database.git "$SRCPATH/database" -b $BRANCH --recursive
    & u: o3 D3 Y' {7 S" |
  725.         ;;2 K# b) j- y8 E
  726. * p: p. I( a$ O  ^
  727.       *)* _; T  e9 X- l- i5 O7 F) G; _
  728.         Log "Error: Unknown release selected for cloning!" 1
    : ]5 M" s  ^' ]$ s
  729.         exit 14 l3 _' i) b; j' n$ ^. P
  730.         ;;8 L; C0 a% l+ ~; h# E
  731.     esac8 a, P6 S) L3 J' F+ ?/ Y& x9 }* I

  732. . n1 x$ L8 d& V4 d: L9 m
  733.     # Log success
    . K$ D2 ~8 l6 r; c- ~$ p
  734.     Log "Cloned the selected repository!" 16 b8 z$ X' g, h; N$ t, e9 Y/ N" A
  735.   fi& |$ e% u  o; O5 n+ U, g0 w

  736. 7 n& }; v  M1 z5 g+ V4 f$ `/ L
  737.   # Update the local repositories if selected
    ; K, a& l" K' b
  738.   if [[ $CLONE = *1* ]]; then
    / y* C( I* Q+ Z4 y
  739.     Log "Updating your local repository..." 1
    1 A" c! P' x* r' P4 D% V# G

  740. : v$ m' p+ B* f7 f
  741.     # Update the core sources
    * T0 I9 c; g2 ^" c0 H, S- {5 _
  742.     cd "$SRCPATH/server"
    " s+ I) o% d: i4 P9 m1 }
  743.     git pull8 d7 m, B3 h. h8 G! k
  744. - [/ L8 @! `" g$ i6 r
  745.     # Now update the database sources
    2 i7 V' V5 A6 G6 K
  746.     cd "$SRCPATH/database"
    " _" d7 o! g& D" J; E9 |2 \+ B6 ]
  747.     git pull% Q/ \5 x. O8 T

  748. % m7 G' U9 c$ L2 t1 A- K# z
  749.     # Log success
    . g1 k6 t3 |/ }5 p. {( ?% ~
  750.     Log "Updated the local respository!" 1! `% J7 {+ I# F3 a9 C$ ^/ g* @
  751.   fi1 B/ O* O  {) U/ V! |

  752. / d8 w) Y% H9 q: R- h. x- e$ o
  753.   # use existing repository- o  Q0 S1 a; q0 I, d
  754.   if [[ $CLONE = *2* ]]; then
    ! ~+ `! U4 J" E  H; w7 }
  755.     Log "Using existing local repository" 1
    + k' g6 o  }0 F* `+ E2 g
  756.   fi* C( J1 u9 d( l( U2 s( l
  757. }
    & m  B! M) k' K8 e2 f3 F( |
  758. $ r2 }& ~- j1 }

  759. 4 }* |1 ?6 m) k$ k
  760. - C: P2 w) Y6 |5 l
  761. # Function to set the build options
    3 h: V% ^( E$ [/ e5 {
  762. function GetBuildOptions()+ |/ t1 k8 l0 h8 ?. U) d
  763. {
    . l. |2 y# D( H4 k& h
  764.   # Select build options
    / F4 ^1 y) p0 ~3 q5 p0 \
  765.   OPTIONS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" \3 {* \! l: n% Q7 S! n# [
  766.     --title "Build Options" \
    7 W4 K" E! U/ F* g
  767.     --checklist "Please select your build options" 0 56 7 \
    % D$ S3 Z, P0 z
  768.     1 "Enable Debug" Off \6 H2 m3 w  ?6 q1 @, F
  769.     2 "Use Standard Malloc" On \( |  G1 X  S% X
  770.     3 "Use External ACE Libraries" On \# A7 C- Q# D: d% y/ i
  771.     4 "Use PostgreSQL Instead Of MySQL/MariaDB" Off \
    2 V5 {, e; w. i) H, Q
  772.     5 "Build Client Tools" On \
    - Y' r2 n# w3 g" S
  773.     6 "Use SD3" On \4 [. x/ C1 ?6 ?/ Y5 r
  774.     7 "Use Eluna" On \* @- e9 j6 n; d! K
  775.     8 "Use SOAP" Off \6 m/ D  p/ V. L3 G+ A
  776.     9 "Use Player Bots AI" Off \1 u8 l$ n7 c5 O  j7 U; g
  777.     3>&2 2>&1 1>&3). Z, [& f( j. c8 d
  778. 9 u, E$ S7 ]; q3 P2 o
  779.   if [ $? -ne 0 ]; then# r% C6 p" O% k! c9 h
  780.     Log "Build option selection cancelled. MaNGOS sources have been cloned." 1
      ?- C# t! j& e2 w* M) ~7 I( b
  781.     return 0
    8 E. q1 j  {5 [
  782.   fi8 z4 z1 v" f- q2 P! C8 C+ G
  783. 4 l% I* I+ b& t% N$ s  r
  784.   # See if debug was selected1 Q# q  n3 g1 Q1 X+ T
  785.   if [[ $OPTIONS == *1* ]]; then: v0 B2 v+ g0 B3 N% O! O
  786.     P_DEBUG="1"
    - r, V$ V) p* v
  787.   else" q& W4 A5 e3 P- U+ ?! A
  788.     P_DEBUG="0"
    ) v2 V  t$ }8 g& Q6 v
  789.   fi# \4 K) ~9 _- Y8 P8 a# ^

  790. $ T" ?2 v* `1 s# N3 L
  791.   # See if standard malloc was selected7 X. x) ~0 B0 ~5 J
  792.   if [[ $OPTIONS == *2* ]]; then
    8 r. Z8 M$ b" L8 e, b
  793.     P_STD_MALLOC="1"
    ( x; I" |8 v9 o( D/ Q$ b4 D! X
  794.   else
    # X9 \) B3 j; o! a3 ]
  795.     P_STD_MALLOC="0"
    - P8 m  m; [3 q* b) Y2 _* o
  796.   fi
    : C) e' E. c. D! p3 F8 g

  797. : T& t2 f0 }7 r: M% D2 Y
  798.   # See if external ACE was selected
    2 J1 T0 h) \" W* Z0 q
  799.   if [[ $OPTIONS == *3* ]]; then
    . ~, u! N: e7 Y8 W! Z* |
  800.     P_ACE_EXTERNAL="1"" G. V  B+ m  P% Z
  801.   else
    . x9 u6 E$ P7 f; A
  802.     P_ACE_EXTERNAL="0"
      f( ~8 s; Y% J: d6 I8 X
  803.   fi% P+ f4 M3 c$ }: {) V3 M9 l4 u

  804. ( j8 C6 q5 H$ e/ a- e) n! g1 S
  805.   # See if PostgreSQL was selected
    5 ^% e+ i* Q  g+ Q5 B0 ?9 c  F+ Z
  806.   if [[ $OPTIONS == *4* ]]; then* i1 @/ j( c! S5 ^  H( a9 L1 Q
  807.     P_PGRESQL="1"
    ' s$ k. x/ V6 C5 p" q8 d
  808.   else
    ' Q4 ?, w  F- ^4 g! W4 S
  809.     P_PGRESQL="0"
    8 W* h/ ]. e. [
  810.   fi8 v# m0 T0 C; I( E  E5 z
  811. 8 Z2 ?5 T2 ?' L* q
  812.   # See if the client tools were selected5 d& k. `2 r1 X; H# d7 \! q2 |
  813.   if [[ $OPTIONS == *5* ]]; then
    + t; H( R" a' u9 @  J0 X) _
  814.     P_TOOLS="1"
    9 r) J" O9 J6 K/ [4 f; J9 E
  815.   else
    # C& @; G9 v( Q/ h
  816.     P_TOOLS="0"
    8 d: f5 @" h3 j5 |
  817.   fi
    7 V) c' I  {4 f/ W1 D& }6 W
  818. # P7 x. L$ I0 X9 O4 V9 N2 [/ |% J+ n. i% I
  819.   # See if SD3 will be used( |5 t% j/ A  N$ |' B; b8 U0 p
  820.   if [[ $OPTIONS == *6* ]]; then% o* w4 Z+ `* q' c# J, k
  821.     P_SD3="1"' O2 b: ?2 K! X1 s$ i
  822.   else
    $ V8 E2 {1 t0 I; }/ r2 [
  823.     P_SD3="0"  ?' I) f" T- r8 C. Q' M" N7 ]* M
  824.   fi, a4 U6 {6 L& z# D0 @
  825. 6 ^; u, ^( P9 Z9 j/ W6 o
  826.   # See if Eluna will be used
    1 M3 N3 o6 I9 K: N- }6 z
  827.   if [[ $OPTIONS == *7* ]]; then
    ( N7 G: I: y1 Q- V6 O7 s
  828.     P_ELUNA="1"
    1 t8 \3 }5 _* w" ~( B
  829.   else  ~+ I3 J5 G, p( O
  830.     P_ELUNA="0"
    , c) B7 n% d! o4 v$ b
  831.   fi
    $ [4 V$ g" D8 ^; d9 b/ ~

  832. 7 d' h( O( l4 @5 g* [
  833.   # See if SOAP will be used
    8 J8 ~2 K* Z, ~4 ~" Q+ W4 {6 s1 L
  834.   if [[ $OPTIONS == *8* ]]; then, M" c+ V% e* M, t* F; I
  835.     P_SOAP="1"  Z8 i  X& B& Q; j
  836.   else' f0 h$ c+ z% i
  837.     P_SOAP="0"4 K1 u- \0 S! h' e8 i, w
  838.   fi9 E# c$ A3 N8 c0 N
  839. 0 W& i5 s2 T1 w$ ^! Q# j* F
  840.   if [[ $OPTIONS == *9* ]]; then: E" _  r# v$ P/ |! ]  O- d7 o, w3 w
  841.     P_BOTS="1"* v  P/ T' {9 G  i
  842.   else  f( g- c+ v6 W5 J
  843.     P_BOTS="0"
    + }9 ~( C$ k) u' }* R% T
  844.   fi
    + E* i: Q! V+ R0 ]+ H- ~1 _9 n
  845. " T0 C" k1 p" a! o0 @
  846.   # Verify that at least one scripting library is enabled: d0 K  ?' m6 y& y1 }. R
  847.   if [ $P_SD3 -eq 0 ] && [ $P_ELUNA -eq 0 ]; then
    / q' v. l5 S1 l
  848.     Log "Error: You must enable either SD3, Eluna, or both to build MaNGOS!" 1. d. `& R+ J. Z. V6 ]* g
  849.     exit 1( R/ \, ^( m" E  k# V3 m7 u
  850.   fi1 x$ V; }4 E5 \& h$ Y0 f$ J
  851. }- Y, `5 @( U4 v; Z/ _& ~+ r

  852. " n" b1 p& I  x. i  l+ c" u0 \5 }
  853. 1 G2 {: C* B. i

  854. , K, [8 G' t) n" |
  855. # Function to build MaNGOS
    3 g: V9 I) ?7 w- ~
  856. function BuildMaNGOS()0 F7 O0 s% j) t, m+ @) P$ A) _
  857. {# N' _7 s8 Z+ g4 E2 Z" \
  858.   # Last chance to cancel building$ G' G2 e6 Z1 ?3 o7 D& K
  859.   $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Proceed to build MaNGOS" \
    + ~0 X& W1 a$ ?# d
  860.     --yesno "Are you sure you want to build MaNGOS?" 8 60
    ! X$ F! ?# C- h# D. n0 {* X: u
  861. . {3 c" |% c( Q
  862.   # Check the user's answer
    6 h  H; k  U9 k: J
  863.   if [ $? -ne 0 ]; then
    - [4 }3 M% R8 o$ e
  864.     Log "Cancelled by user. MaNGOS has been cloned but not built." 17 |. w; d( Y. `4 _
  865.     exit 0
    % Y& v, P, ~  g& x5 F" ^1 y
  866.   fi
    ( D2 i% u& O" n2 M; q( j

  867. 0 K9 b/ c, h- @' H2 {, R3 Q
  868.   # See if the build directory exists and clean up if possible  J4 x3 |0 f+ r& m
  869.   if [ -d "$SRCPATH/server/linux" ]; then) o1 P1 A/ S1 H* M4 @2 O4 F* T
  870.     # See if a makefile exists and clean up9 L& R. g- h) b  Z, R1 N% k
  871.     if [ -f $SRCPATH/server/linux/Makefile ]; then
    ; ?; @* M7 o# I: P
  872.       Log "Cleaning the old build..." 14 a% @/ a* A7 R- n
  873.       cd "$SRCPATH/server/linux"
      f9 |7 {" t8 f" k
  874.       make clean% {' q% O& a* Y9 b- U" {# T
  875.     fi% [5 v% n$ A- B2 g
  876.   fi
    ' ]- c9 I: ]1 q) R1 F$ z. m
  877. 6 i. e/ F7 b6 a' Y
  878.   # Attempt to create the build directory if it doesn't exist3 M0 c$ \2 \. W, `/ s/ @0 b, w
  879.   if [ ! -d "$SRCPATH/server/linux" ]; then* r  |. g  z; i) ]/ _
  880.     mkdir "$SRCPATH/server/linux". F. P7 O2 @) O: n
  881. - @' W& t' V. L7 C. o- F) y8 D' D
  882.     # See if creation was successful2 ?8 g# W- e4 X7 D
  883.     if [ $? -ne 0 ]; then
    1 u+ B7 X, K: \! V/ `* i# l
  884.       Log "Error: Failed to create the build directory!" 1
    " H- B0 M6 m8 n/ |0 A
  885.       exit 10 k' t0 W' w/ i1 k1 u9 y
  886.     fi9 v6 E& W: w2 d, Q+ y% |6 H
  887.   fi; p6 f9 G" X5 B5 F
  888. + g8 X1 H; c+ L# I" V
  889.   # Attempt to configure and build MaNGOS, n! N; g" E% h( ^
  890.   Log "Building MaNGOS..." 0
    : s7 Y2 T+ z6 U0 [( f
  891.   cd "$SRCPATH/server/linux"
    , s% v9 ?* Q* w4 v1 I. g
  892.   # make sure we are using the cmake3
    + [  T4 d& z6 K/ x9 c% W% _
  893.   UseCmake3
    % w3 `, @2 `- I! @0 S' 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"
      R+ J3 c; ~# S
  895.   make
    ; O: t5 y& D2 ~
  896. 4 z  @% B9 Z" J7 n
  897.   # Check for an error/ H+ t& O1 W2 _# T1 t
  898.   if [ $? -ne 0 ]; then
    2 t: v# v1 g/ j4 w
  899.     Log "There was an error building MaNGOS!" 10 Z3 `$ g# E1 p, ?. ~( A' {0 V
  900.     exit 1
    6 n" L3 `, W) l! b
  901.   fi* }% e$ Y2 Q. w/ y5 v" {

  902. 1 }) @2 S4 {7 S# I. Q& A
  903.   # Log success2 N4 K8 u% i8 M: P2 B
  904.   Log "MaNGOS has been built!" 06 T: Y( ]' Q# T" P; J6 h
  905. }
    6 B% {- k' H7 G0 U

  906. 5 h# ^6 ?4 f7 z0 _
  907. / p; e1 O+ @1 ]& e- k4 H
  908. ' Y/ z' Q: O6 G4 i$ q
  909. # Function to install MaNGOS
    . ?7 y9 H  c2 B/ @" r5 e
  910. function InstallMaNGOS(): @1 |2 O' G7 y
  911. {6 S' f) J$ U  \" G0 v2 O
  912.   # Ask to install now
    ( q% G0 a0 s2 p) m! m. I
  913.   $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install MaNGOS" \/ X8 F+ K( ]1 [0 W* A7 ^" D
  914.     --yesno "Do you want to install MaNGOS now?" 8 0
    0 R9 u, i# U0 k$ P9 a# I0 Q

  915. ) Z6 y# V; F! d4 D7 H$ A
  916.   # Return if no4 e$ p. Y2 R% X! `) D- \2 z( |
  917.   if [ $? -ne 0 ]; then
    / k3 w# B* x/ L5 X. l7 y/ i3 y
  918.     $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Install MaNGOS" \6 q& ?( }0 N7 \0 T3 Z7 d; Z8 e7 R
  919.       --msgbox "You may install MaNGOS later by changing to:\n$SRCPATH/server/linux\nAnd running: make install" 24 60
    - P2 I0 S1 u- V& i2 x

  920. 0 F- }+ s7 |$ }4 K) ~9 ^  H+ n
  921.     Log "MaNGOS has not been installed after being built." 18 P' r+ `3 e7 q! h/ P/ N
  922.     exit 0
    2 P% h6 _' {" _( V# ~. r  t
  923.   fi& n- n- G& ?* V- y' C

  924. / V9 M# E* ~( e1 H2 P
  925.   # Install MaNGOS* d& _& A/ q2 T5 C. |  L
  926.   cd "$SRCPATH/server/linux". I9 V# C3 k. n) G1 Q6 s! K, }
  927.   make install
    : y! H* B- Y" X- y' M
  928. ' p2 Y% l' ], x: n9 \* Y& r
  929.   # Make sure the install succeeded" v  S9 Q" n7 S6 d3 f( H
  930.   if [ $? -ne 0 ]; then! e% G' i1 G2 n6 i9 n( z6 ?
  931.     Log "There was an error installing MaNGOS!" 1
    $ ^/ N3 i. w. M2 o, l# r& O
  932.     exit 19 k  N& ], }8 T2 B* `
  933.   fi
    % F! ]" e+ Z  o  l6 t0 y& b
  934. }: M4 `0 k% g0 a+ A- i3 j
  935. + u5 \+ ?8 T& |9 |9 ?9 T
  936. # Function to apply database updates
    # t/ v  T0 R8 h3 ?, f. n7 q
  937. function UpdateDatabases()4 P3 c4 V9 ?; L, G
  938. {
    / b, @6 t+ b8 x  k( k
  939.   local DB_HOST="$1") c8 G6 K# x. T* c4 _' w
  940.   local DB_TYPE="$2"
    4 ?+ B* F1 |5 @0 Z" g9 B5 i2 a
  941.   local DB_COMMAND="$3"! f7 x5 D+ U' a! t& h. K" Q
  942.   local DB_USER="$4"
    ' l) x0 q, q2 |  `
  943.   local DB_UPW="$5"
    % j+ n1 k( m! T/ o$ B% g
  944.   local DB_REALM="$6"
    ' r/ ^, ?  r( ~( q: z! v
  945.   local DB_WORLD="$7"" t; i2 o2 e; @; M  `* ]
  946.   local DB_TOONS="$8"
    + h1 R3 ~& N- e5 c# u, Q( N

  947. + ]4 q- L0 w. R+ g( j- r
  948.   # Loop through the character files: J. c+ S/ _( T' y. P& F! |% T
  949.   for pFile in $(ls $SRCPATH/database/Character/Updates/$(ls -a $SRCPATH/database/Character/Updates/ | tail -1)/*.sql 2>>/dev/null); do7 z$ o, |1 [6 o& f: T& \4 J7 x
  950.     if [ ! -f "$pFile" ]; then
    + K+ C# z' e& M) t! W
  951.       continue- Z% D1 L6 r; |& ~# m+ f: j8 d
  952.     fi
    - r& o8 W& L% v8 v5 E+ V8 L
  953.     # Attempt to apply the update, L; `. R- Y: U" R4 l: T$ b
  954.     $DB_COMMAND $DB_TOONS < "$pFile" > /dev/null 2>&1. d% q5 \6 v8 Q' ]$ E3 x1 z
  955. 3 F* \  U- X  c8 [8 D
  956.     # Notify the user of which updates were and were not applied
    6 G7 P/ p0 X5 f8 `. z
  957.     if [ $? -ne 0 ]; then4 [. u* v6 R# o# D0 q; f& ?4 g
  958.        Log "Database update "$pFile" was not applied!" 01 `2 K5 [& [9 {7 q0 u
  959.        Log "Database update "$pFile" was not applied!" 1
    1 [- _/ i  Y+ T
  960.     else
    6 m! ?7 n7 r, u4 a, R
  961.        Log "Database update "$pFile" was successfully applied!" 0
    * f) Q+ G' @2 |2 t
  962.        Log "Database update "$pFile" was successfully applied!" 1
    % b+ O  a7 x+ Z4 ~# o
  963.     fi  V+ ?' n! i: L8 C- u! u
  964.   done, k; ]( z! {9 k/ A, F2 W  @' _

  965. % w* `; P, z$ X: o! ]* C
  966.   # Loop through the realm files4 `  |4 r! p! o4 c  o
  967.   for pFile in $(ls $SRCPATH/database/Realm/Updates/$(ls -a $SRCPATH/database/Realm/Updates/ | tail -1)/*.sql 2>>/dev/null); do
    9 B. S0 O+ D' Q; K6 ~6 ^; D
  968.     if [ ! -f "$pFile" ]; then
    ( x% g% t3 p4 k; o1 i
  969.       continue! L4 T' r; K& ~: B
  970.     fi1 x; x2 P0 K* P+ g% c/ q
  971.     # Attempt to apply the update
    . f! F' \8 ]) I. u
  972.     $DB_COMMAND $DB_REALM < "$pFile" > /dev/null 2>&14 u, ~5 |- d& v7 L3 m

  973. 5 e( L6 ]4 t) A0 Z2 Q
  974.     # Notify the user of which updates were and were not applied* H7 k' V& p; B0 `3 |9 _
  975.     if [ $? -ne 0 ]; then
    5 q2 I8 R% a' H5 k
  976.       Log "Database update "$pFile" was not applied!" 00 V# b( v& d5 A3 U: i1 W
  977.       Log "Database update "$pFile" was not applied!" 1
    " t3 V0 u, p% P6 k2 Y' ^
  978.     else
    4 v( X5 F8 t, m4 x* \  M9 M
  979.       Log "Database update "$pFile" was successfully applied!" 0( v6 _5 x' c7 L' x# k
  980.       Log "Database update "$pFile" was successfully applied!" 15 ]: ?" o2 ~* F5 v
  981.     fi) a9 J1 D2 k( `/ X. S6 u: @
  982.   done* n3 m' q0 N' U! u
  983. " c% g! M: C( J, L/ T# ~
  984.   # Loop through the world files
    3 b) G1 F: @8 C
  985.   for pFile in $(ls $SRCPATH/database/World/Updates/$(ls -a $SRCPATH/database/World/Updates/ | tail -1)/*.sql 2>>/dev/null); do) i7 i# a( }0 ~3 {5 B# X6 d6 N
  986.     if [ ! -f "$pFile" ]; then7 L/ d1 g( E5 R. K; l$ ]
  987.       continue
    ; l, r' f8 v- g0 a3 |/ d
  988.     fi' b: }, t. D3 a) X5 d5 M; `
  989.     # Attempt to apply the update
    # F' F2 |& h: Z4 _" f  H; y
  990.     $DB_COMMAND $DB_WORLD < "$pFile" > /dev/null 2>&1
    : r9 s4 D5 B' ~0 g- N

  991. * B& v, n$ H( T6 Q+ s. `4 u; l  @7 B
  992.     # Notify the user of which updates were and were not applied
    - U9 E9 [3 w9 l8 g  _0 A
  993.     if [ $? -ne 0 ]; then( ]& ~$ o. q2 y1 K; `7 S
  994.       Log "Database update "$pFile" was not applied!" 01 M3 z7 `' o  L
  995.       Log "Database update "$pFile" was not applied!" 1) `# B* z4 D5 {; ~
  996.     else
    ' [  i- h! }5 l7 |3 n0 T0 j' `- u
  997.       Log "Database update "$pFile" was successfully applied!" 0
    4 W. Y! o2 `/ R' D4 O
  998.       Log "Database update "$pFile" was successfully applied!" 18 y& A6 E3 H" V* J! F( W
  999.     fi
    ' b- I  F7 N. Q( K' X5 B
  1000.   done  n3 j+ f% y9 u6 D) J! K4 o0 V
  1001. }
    $ m. ^! X) C9 ~6 ?0 j% r+ R

  1002. ' S) }4 G9 B+ x) ^% p$ N
  1003. # Function to install or reinstall the databases
    & H: C3 x/ X/ S
  1004. function InstallDatabases()
    7 N7 M2 i3 x+ a- o4 ^5 X: E
  1005. {
    9 N+ @& O! q8 n( r/ Q: F/ |( u* p
  1006.   local DB_HOST="$1"4 C' f  c- H) @+ O* P: F. g' w# H
  1007.   local DB_TYPE="$2"
      V0 i' C8 Y/ Z+ w
  1008.   local DB_COMMAND="$3"
    1 E! j! U5 p& u0 D
  1009.   local DB_USER="$4"9 @: _  f. t+ Z, v
  1010.   local DB_UPW="$5"
    ) i- l  X; D. d, u2 J+ H
  1011.   local DB_REALM="$6"& l: L" s8 U% e0 r! U! `  q; x
  1012.   local DB_WORLD="$7"2 n3 ^; A" p& ?" s$ @6 P
  1013.   local DB_TOONS="$8"
    3 C+ h) g; Y" B4 `, [3 u0 h) {
  1014. 1 S3 j1 c2 A  y8 [0 H
  1015.   # First create the realm database structure
    3 X* G5 a7 X! O( x
  1016.   $DB_COMMAND $DB_REALM < $SRCPATH/database/Realm/Setup/realmdLoadDB.sql
    / T  J3 w5 y# S

  1017. 3 S! r% \! q# l- {' c# a, N* Q
  1018.   # Check for success
    # ~: J& [( i1 k2 q( ^
  1019.   if [ $? -ne 0 ]; then  D' b6 a9 T7 m& A" c9 P
  1020.     Log "There was an error creating the realm database!" 1+ z% ?" e2 h! Y7 Q- Z- t! L3 r9 ?
  1021.     return 1
    ( k0 r; y' W! O5 K( i7 j
  1022.   else( g7 W" Q: @( ^5 N0 X+ D+ R  r
  1023.     Log "The realm database has been created!" 1. U2 B0 t) R1 x2 Q
  1024.   fi3 {! @+ a5 G7 I6 Z9 g

  1025. # k, V9 e  G6 j3 D' y
  1026.   # Now create the characters database structure# i! L% f; d- k8 G9 u
  1027.   $DB_COMMAND $DB_TOONS < $SRCPATH/database/Character/Setup/characterLoadDB.sql
    " V# j; P8 g0 P; b
  1028. $ x7 k6 }$ P6 x0 }/ a5 e
  1029.   # Check for success. c. j! u' A; Q0 @
  1030.   if [ $? -ne 0 ]; then  q- `& S+ h3 Z3 w$ X
  1031.     Log "There was an error creating the characters database!" 1
    ; H  }# w- O" A9 ?& @
  1032.     return 1
    / v; |8 c- H* u( \
  1033.   else
    0 u( `* T1 }4 U
  1034.     Log "The characters database has been created!" 1
    - C9 |" \2 x9 Z; w
  1035.   fi
    8 r* Q! U" [$ k0 w/ S

  1036. ( Y# S, z, I% E9 L2 ^! B+ L
  1037.   # Next create the world database structure  m& Y, c# t4 N; y8 C5 q
  1038.   $DB_COMMAND $DB_WORLD < $SRCPATH/database/World/Setup/mangosdLoadDB.sql/ g0 U, p  U4 \, A8 t% I
  1039. 5 J. Y+ A) ?, f' Z: c4 {. F5 O8 ~
  1040.   # Check for success# B- r& R( H! Q8 t- U' R
  1041.   if [ $? -ne 0 ]; then
    8 L& H! K' p6 c+ c! C8 T& c
  1042.     Log "There was an error creating the world database!" 1( r( P3 u# G0 U
  1043.     return 1
    . q" W6 X0 u7 i7 }1 v7 r
  1044.   else) W# ]! j, T3 J; V% W( }
  1045.     Log "The world database has been created!" 11 V5 D5 Y4 t, K5 }6 S9 }
  1046.   fi9 f5 r8 i1 e/ D; o, Q. W

  1047. % u& j/ O' r! x$ r* x" ~3 E+ R
  1048.   # Finally, loop through and build the world database database7 Q0 c! X3 ?5 C& Q/ m
  1049.   for fFile in $SRCPATH/database/World/Setup/FullDB/*.sql; do
    ' j7 m6 p' Z5 n5 A. M3 r. V( h8 q
  1050.     # Attempt to execute the SQL file, n+ A0 y7 q- s* y' X7 ~
  1051.     $DB_COMMAND $DB_WORLD < $fFile' d. v' X. F' ^; T7 v, m! g, c/ q

  1052. + \" I6 H$ ]/ _/ s
  1053.     # Check for success
    1 Q2 t# j! N+ t3 y3 e9 k, j9 ?
  1054.     if [ $? -ne 0 ]; then# j, z5 {: ], h1 I1 k/ F) p
  1055.       Log "There was an error processing "$fFile" during database creation!" 1
    3 \: f2 s$ c* H% _
  1056.       return 1
    ; H" T8 \# S. o/ }- Y
  1057.     else; x$ H$ \) g5 e/ Z
  1058.       Log "The file "$fFile" was processed properly" 1* y) s& B1 p2 h
  1059.     fi
    ) g; Q% ?: C- V  X! Q% O5 ]) g6 M: C
  1060.   done
    # L) G7 Z2 l9 O
  1061. 9 _4 R6 p7 ^5 D" z' c
  1062.   # Now apply any updates
    . B" K( g' N3 v9 K
  1063.   UpdateDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
    / S2 L7 z) m8 x1 P
  1064. }
    8 D$ h$ }/ V7 z& b4 k

  1065. : I+ N0 A8 A& j0 w1 n% m8 T  _+ ^
  1066. # Function to install or update the MySQL/MariaDB databases
    6 {" N9 w; y/ r2 E- y  Z- a6 @
  1067. function HandleDatabases()
    2 B; V, J+ k8 N+ w
  1068. {# G1 E+ o& m# ^3 q8 W
  1069.   local DBMODE="0"
    ' ^0 a' x2 M' e& H+ _
  1070.   local DB_TYPE="0"$ T: c' W$ }9 h( d& c# [  E- N
  1071.   local DB_COMMAND=""
    : A% @' _/ S. a; X
  1072.   local DB_TMP="0"
    ) b7 ]8 C7 a4 d4 }+ D9 ?2 x0 I
  1073.   local DB_USER="mangos"" M: y3 Z6 i' C# L. G5 ]
  1074.   local DB_UPW="mangos"1 u; B4 b/ O; S
  1075.   local DB_HOST="localhost"
      y& w# S/ C% j+ P# {! p
  1076.   local DB_PORT="3306"
    % I  l6 c7 v+ W# y
  1077.   local DBSEL="3"0 Q2 A$ j/ [# Y* \, M( B
  1078.   local DB_REALM="_realm"- r$ l: ^9 t* E* ]% r- u5 }
  1079.   local DB_WORLD="_world"
    - k9 X+ g8 ?+ G$ L" {
  1080.   local DB_TOONS="_characters"+ W7 N0 l  I( h. r
  1081. % h, \9 y& B+ w2 X
  1082.   # Ask the user what to do here
    # |- v9 u$ f, z
  1083.   DBMODE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Operations" \0 H4 c* Y5 x  ~
  1084.     --menu "What would you like to do?" 0 0 3 \' ]' y/ f3 U% l$ t1 U( z4 U
  1085.     0 "Install clean databases" \# k7 g" v" V* @% A6 J. Y3 Q
  1086.     1 "Update existing databases" \2 n. E4 Z0 k+ S  S4 r# P
  1087.     2 "Skip database work" \
    0 }; K; u9 C3 o1 t  g
  1088.     3>&2 2>&1 1>&3)- E; d5 H" P# v' Y
  1089. 9 q8 j. n8 d0 @- x
  1090.   # Exit if cancelled
    + r5 \: O2 Z6 s' u& V! l! _
  1091.   if [ $? -ne 0 ]; then6 Q$ ?% R3 A: J& W
  1092.     Log "Database operations cancelled. No modifications have been made to your databases." 1
    7 j$ @9 B% `# v% i2 G( n, \
  1093.     return 0
    4 ^/ O: n0 N# {1 Z2 B4 @
  1094.   fi7 a* ?9 j3 v6 `
  1095. 8 b, S0 g$ ~2 ^& z2 |; K5 W( N
  1096.   # Exit if skipping
    6 u8 R) D: g1 y8 o9 B) N
  1097.   if [ "$DBMODE" = "2" ]; then
    ) ~/ ?2 e+ v- _: Z* ]
  1098.     Log "Skipping database work. Nothing has been modified." 1
    3 ^( N6 T# x" b3 a& k
  1099.     return 0# w. @1 `* h. O+ N; E' W" ^. E
  1100.   fi
    0 v3 r/ I6 T1 ^/ ?

  1101. 0 \) a- D2 m. d9 q( P
  1102.   # Ask the user the DB type' k5 y, p4 B" K
  1103.   DB_TYPE=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Type" \
    % f! x! x' |3 x# E' t
  1104.     --menu "Which database are you using?" 0 0 3 \$ O" K4 {3 j% X: R' J
  1105.     0 "MariaDB" \
    8 Q1 u. S2 d: g8 |
  1106.     1 "MySQL" \$ v+ S3 H' Z' Q: ~1 H9 b  m! j
  1107.     2 "PostgreSQL" \. v0 V" x7 y4 T! i
  1108.     3>&2 2>&1 1>&3)
    9 G: r2 k) e3 Q% c; y. ~! ^

  1109. 1 ?5 C- G- Q( z; |- b- w
  1110.   # Exit if cancelled; _, z! _% U7 }+ R
  1111.   if [ $? -ne 0 ]; then
    3 P9 V1 \3 e. G7 t$ I$ f
  1112.     Log "Database type selection cancelled. No modifications have been made to your databases." 1; g$ q4 q5 L# A
  1113.     return 0. T# m9 n% S4 Q; W7 l" z0 R6 o; }
  1114.   fi
    : r0 E# ]; O8 {: [

  1115. # g- v* O. E' j3 F4 f! z* \
  1116.   # Get the database hostname or IP address
      R; [# z' O6 |4 B6 N) o3 S0 `
  1117.   DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database Hostname Or IP Address" \
    8 r* v7 M* b; d2 B
  1118.     --inputbox "Default: localhost" 0 0 3>&2 2>&1 1>&3). @! P8 v' o3 _) p

  1119. . i4 {' z: Z) P
  1120.   # Exit if cancelled
    % G+ Q6 D( a2 b' x+ e: ~1 Y
  1121.   if [ $? -ne 0 ]; then; |( p0 T8 y0 T7 v: |
  1122.     Log "DB host entry cancelled. No modifications have been made to your databases." 1% S3 C: d; a# _$ ]5 U' H
  1123.     return 0
    6 W% q( Q6 N) U+ t" E. k/ N
  1124.   fi- H& m9 W( a. x, @, j
  1125. 7 z  F5 i0 U# y6 `) L/ ~
  1126.   # Set the hostname or IP address if one was specified- R/ W" |) e. P0 t8 k+ o2 E
  1127.   if [ ! -z "$DB_TMP" ]; then% T# G3 T. W: C8 v- M
  1128.     DB_HOST="$DB_TMP"$ `  r: S" U  F; t8 m
  1129.   fi
    / b0 B9 j& }1 C! F! y1 T

  1130. ' i; u' l6 d4 I: @) N1 F
  1131.   # Get the database port
    $ D: L0 x, I& p8 J
  1132.   DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database port" \
    ; {3 j+ i9 Z: g/ |
  1133.     --inputbox "Default: 3306" 0 0 3>&2 2>&1 1>&3)
    ' B; ~9 j! p3 V5 F/ [
  1134. & t$ g- P8 ?) Z. Q% ]% X. N
  1135.   # Exit if cancelled
    + R7 ]" ^1 w9 g0 E2 M# h/ X
  1136.   if [ $? -ne 0 ]; then7 `& O" u; a8 b; z) m$ @4 F
  1137.     Log "DB port entry cancelled. No modifications have been made to your databases." 1
    ! t$ D# b! ?4 K  U" W/ c0 Z* q
  1138.     return 0: i7 ~5 G7 f3 Q9 [
  1139.   fi
    * Q  o( `* t" k. L/ M; @3 V

  1140. 6 |8 z2 |) ]! ~# j# K& a
  1141.   # Set the port number if one was specified6 Y$ D/ Z0 X1 B$ i
  1142.   if [ ! -z "$DB_TMP" ]; then
    , F2 |. R% `, A# Z; n
  1143.     DB_PORT="$DB_TMP"/ o, I1 g1 x2 G& Y+ e, Y6 u3 w' y
  1144.   fi, Y& R) E9 k# e. W6 n

  1145. / R) T5 z3 K* r! y$ a/ W; z8 V
  1146.   # Get the database user username
    6 Q" _* j6 ^; r9 w( {1 ~
  1147.   DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Username" \1 E  Y# F0 H$ f* F2 V( I
  1148.     --inputbox "Default: $DB_USER" 8 60 3>&2 2>&1 1>&3)
    : k6 O9 n; B7 y& X$ A; Z( r
  1149. 4 N* S/ E% ^( X# \% [, B( ^
  1150.   # Exit if cancelled% n9 k/ l2 f- H
  1151.   if [ $? -ne 0 ]; then3 t; I' x- W9 g; b
  1152.     Log "DB user name entry cancelled. No modifications have been made to your databases." 1# V6 u/ e  ~+ r* Q/ z" u1 e
  1153.     return 0$ b$ i% h& d4 z) d4 I, e
  1154.   fi
    ' @" e( w1 U% P

  1155. ! v1 ^) M+ ]; `8 h" g
  1156.   # Set the user username if one was specified
    * o, ?( s) P( P& y6 p1 u  ]
  1157.   if [ ! -z "$DB_TMP" ]; then
    / S( p) B9 f0 ^! h2 {
  1158.     DB_USER="$DB_TMP"
    ; F( L' Q$ C. Q( g/ C
  1159.   fi$ I6 b" G3 u2 C7 M4 C

  1160. 3 s9 L% s' ]' _9 Q& z' Z4 R
  1161.   # Get the database user password! Q3 O, s9 M  s/ D
  1162.   DB_TMP=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Database User Password" \
    4 \2 f8 J- o: ]+ B0 D
  1163.     --passwordbox "Default: $DB_UPW" 8 60 3>&2 2>&1 1>&3)
    % ?$ [( O9 H" B9 s

  1164. % f% o2 E9 _! ?' G% Y5 h7 i
  1165.   # Exit if cancelled3 k1 t3 k. |, Z# w; U2 ]
  1166.   if [ $? -ne 0 ]; then
    5 h, f  Q3 l& q+ O9 N7 V
  1167.     Log "DB user PW entry cancelled. No modifications have been made to your databases." 1
    5 L5 h4 L$ b3 Z5 w
  1168.     return 0
    . e2 O& G. y5 P* \# Y
  1169.   fi+ r( R; E1 |- x; \9 N4 g

  1170. + P3 \: C+ d2 d9 v- z& D" y
  1171.   # Set the user password if one was specified: u5 J8 `/ Q5 ?
  1172.   if [ ! -z "$DB_TMP" ]; then2 H5 y- w; u( f% g6 T
  1173.     DB_UPW="$DB_TMP"& N+ @, @9 d; ^: }* B! ^
  1174.   fi
      r, Q) |  V- N6 y* U: h
  1175. ) f- G# I5 Z/ D, R0 m, g
  1176.   case "${DB_TYPE}" in
    ' V3 l$ B4 c6 j, F( ^
  1177.     "0")
    7 K% k1 O4 }& W/ p$ }
  1178.         DB_COMMAND="mysql -u ${DB_USER} -p${DB_UPW} "1 w7 u' i* M* A0 K. X
  1179.         ;;
    9 o4 e. x% I+ c' S7 G: g
  1180.     "1")
    8 N/ M; _; O2 Q# Z$ s' w. D  f
  1181.         printf "Confirm your MySQL password\t, "/ Y( I5 t6 U/ G/ ], h6 {7 T
  1182.         mysql_config_editor set --login-path=local --host=$DB_HOST --port=$DB_PORT --user=$DB_USER --password --skip-warn+ o( j. U- q: c5 X: f% E! {
  1183.         DB_COMMAND="mysql --login-path=local -q -s "
    - f" [  H/ Q; N% [
  1184.         ;;
    , G/ K. G4 h, O' k& W
  1185.     "2")
    % s6 V. g% o' H9 g
  1186.         Log "Currently not supported." 1% m3 I  B  k6 y% N& d+ `
  1187.         return 0, F& i1 D! w. J. x! h( S! ]
  1188.         ;;
    8 ~( I, |- ?8 X0 R, ^! @  }$ W* z
  1189.   esac3 `) D; V) ~. `$ D* ]  ^6 n

  1190. 3 g2 L% V4 D9 F  }- P
  1191.   # Setup database names based on release' j2 Y, V8 F) D9 T- [  P
  1192.   DB_REALM="$DB_PREFIX$DB_REALM"
    ! k" R4 K) Q% d7 z
  1193.   DB_WORLD="$DB_PREFIX$DB_WORLD") M- {7 x# l9 ~0 a9 a
  1194.   DB_TOONS="$DB_PREFIX$DB_TOONS"
    : s+ Q8 C2 ^# t! y  U# \

  1195. 7 ^; W) t% ?  c/ d' A6 Q4 Y
  1196.   # Install fresh databases if requested4 e9 @9 J# z. H3 I* d' ]# i
  1197.   if [ "$DBMODE" = "0" ]; then
    - ]1 z( F& M0 _, \( j
  1198.     # Ask which databases to install/reinstall5 S# u6 h# u2 W  s& X
  1199.     DBSEL=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Databases" \) x! A) O  J5 t9 x5 k2 o- ^8 {
  1200.       --checklist "Select which databases should be (re)installed" 0 60 4 \
    # @% z$ H! L& S& g7 I8 O1 C  i$ p: G
  1201.       0 "(Re)Install Realm Database" On \
    2 o, }+ i2 ?3 f! c& b, i; p/ o
  1202.       1 "(Re)Install World Database" On \* x3 S; H5 ^. Y* ]5 _
  1203.       2 "(Re)Install Characters Database" On \' {0 a' g- P0 H0 k
  1204.       3 "Update the realmlist" On \) I) A9 f) ]3 ?; N) Y2 T* b( s" y
  1205.       3>&2 2>&1 1>&3)3 i1 m2 D# V5 k: R7 ~

  1206. # Z. \$ m$ N% _, {1 A
  1207.     # Exit if cancelled2 c9 }6 R- J  G' N2 I5 n- h. ~, M5 p
  1208.     if [ $? -ne 0 ]; then9 y, C* R  F1 t3 Z' h% u/ f7 O
  1209.       Log "DB selection cancelled. No modifications have been made to your databases." 1
    % _& u6 {. L* X! o. I0 F
  1210.       return 0
    * x2 `$ W5 b9 F0 y
  1211.     fi
    4 @4 v: f- V3 |

  1212. 2 N* r1 S0 g& T9 N  L1 t( M
  1213.     # Remove and create the realm DB if selected
    8 G- ?& _1 B6 _7 j
  1214.     if [[ $DBSEL == *0* ]]; then
    ; S4 _7 D; o% R/ I$ ^
  1215.       $DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_REALM;"
    0 a7 t0 Y' g: Q5 P
  1216.       $DB_COMMAND -e "CREATE DATABASE $DB_REALM;"$ }5 @1 A8 I+ {' o6 b8 s
  1217.     fi+ S$ T, C: R5 U, V0 @' K
  1218. 9 L& @$ \- ~4 g0 x1 F+ c4 k
  1219.     # Remove and create the world DB if selected; e" _6 N+ ~* F+ k
  1220.     if [[ $DBSEL == *1* ]]; then+ b3 [( N9 c  I' ]' j& Z
  1221.       $DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_WORLD;"5 Q3 ^6 a: ~  J( E: W
  1222.       $DB_COMMAND -e "CREATE DATABASE $DB_WORLD;"
    . D: {' h- L( N* i8 T
  1223.     fi! g% \7 k3 b7 T% }. g

  1224. 5 J: m7 d% _$ X' |
  1225.     # Remove and create the character DB if selected  a& |4 F  Y% K
  1226.     if [[ $DBSEL == *2* ]]; then
    / x4 }9 @' I& V" o' ^' G5 B
  1227.       $DB_COMMAND -e "DROP DATABASE IF EXISTS $DB_TOONS;"5 m% M& K, ]! j/ `5 c+ _
  1228.       $DB_COMMAND -e "CREATE DATABASE $DB_TOONS;"
    " ?4 s0 u+ C. |  P% m6 e+ j
  1229.     fi1 P' @) p( S( B$ G) ^, Q% i

  1230. 5 R* x# F- p6 s* ~. M# R4 i
  1231.     # Validate success" w$ k* Z9 X/ F! Z  }8 }
  1232.     if [ $? -ne 0 ]; then
    & Q% X+ L/ o' X1 |1 C
  1233.       Log "There was an error creating the databases!" 1
    4 b0 C# A. |  a- o
  1234.       return 1
    " C: l/ \. F7 I& x- M! o7 q
  1235.     fi
    ' j- @% {, |0 u# o$ U$ ~; X4 s
  1236. + }  a! b/ y4 m# \2 {
  1237.     # Finally, populate the databases
    3 B) F; k! h; I  f
  1238.     InstallDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
    6 A; e* ~. ~  Q4 z$ t; N6 g& \6 ]$ u

  1239. 5 P$ q6 h1 _0 h7 o$ x, D) A
  1240.     # Updating the realmlist: G3 n4 V$ z  p- m5 s2 a  r0 I
  1241.     if [[ $DBSEL == *3* ]]; then0 H/ _! T- O: o/ I, y
  1242.       $DB_COMMAND $DB_REALM < $SRCPATH/database/Tools/updateRealm.sql6 i! |  X$ v. ~5 ]! H
  1243.     fi; b3 }. V# R( J9 ^* m3 s8 ^1 `( m
  1244.   fi
    ! j, n8 d! P+ N+ T/ a+ U; u

  1245. ; \8 Y; R" k! ~1 Q3 d
  1246.   # Update the databases if requested
    ; B8 D/ B0 V# c
  1247.   if [ "$DBMODE" = "1" ]; then% U$ C% N3 \1 I9 m' `8 D
  1248.     UpdateDatabases $DB_HOST $DB_TYPE "$DB_COMMAND" $DB_USER $DB_UPW $DB_REALM $DB_WORLD $DB_TOONS
    & ]; x" D2 E! R8 C& ^7 n. h
  1249.   fi% C9 c. w" w, G7 z
  1250. }
    % Y) W1 G2 w6 K0 ]* N4 M
  1251. ; O9 H* R- X! G
  1252. # Function helper to extract resources (mmaps, vmaps, dbc, ...) from the game  L/ q; C& q/ w0 w  j" S
  1253. function ExtractResources
    4 t8 G! g4 u3 c( ?0 X: x* K
  1254. {* P7 t8 _$ ^; l7 m" ]. _$ G9 ^
  1255.   INSTGAMEPATH=$(dirname $(find /home -name "WoW.exe"| head -1 2>>/dev/null))
    # s) B2 [# @$ J, N9 G
  1256. 1 v1 X$ X2 s, O$ y$ Y, {9 K
  1257.   GAMEPATH=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "WoW Game Path" \
    4 Y: Q, e+ |! k( ^
  1258.     --inputbox "Please, provide the path to your game directory. Default: $INSTGAMEPATH" 8 60 3>&2 2>&1 1>&3)
    0 @: A- u$ j  C0 d
  1259. " G# W( H4 R* a$ p# E
  1260.   if [ -z "$GAMEPATH" ]; then
    ) U6 N" E/ @: l+ G$ \7 X, n
  1261.     GAMEPATH="$INSTGAMEPATH"
    9 A% h: Z) R$ ^1 M# {+ {
  1262.   fi* C" o( j! b8 H, z' _/ |

  1263. 4 R, K) Z+ \; @( Z$ I
  1264.   if [ ! -d "$GAMEPATH" ]; then9 K9 ~- P; [1 A  [
  1265.     Log "There is no game at this location" 1
    ; B  _" y! u( {& K/ d) K- M
  1266.     exit 12 X$ H" m3 I- H; a' A5 P8 H1 s" P
  1267.   fi1 S' y$ {" k# U0 V0 _" |

  1268. 7 L/ S- a) b/ ]9 C  f9 }
  1269.   ACTIONS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \& K$ R/ e) z3 o+ I4 g, q3 n5 M* P
  1270.     --checklist "Please select the extractions to perform" 0 70 3 \
    5 ]) ?% R+ i5 L: f# N
  1271.     1 "DBC and Maps" On \
    3 h0 q/ g  C% J# ^, X. A
  1272.     2 "Vmaps" On \
    6 y9 A( f4 Z7 }( K/ ~% a
  1273.     3 "Mmaps" On \
    ! p5 a7 K1 q! E1 @( y8 x) l
  1274.     3>&2 2>&1 1>&3)
    5 j& n* d/ d- A! f
  1275. 8 S' P! g$ X# h1 o0 h/ O7 }1 P4 B
  1276.   if [ ! -d "$INSTPATH/bin/tools" ]; then
    5 v. L+ j1 _  F+ e. X2 c$ v
  1277.     Log "The client tools have not been built, cannot extract data" 14 O: `' q! f- a3 I. |% |4 ]
  1278.     exit 1
    7 V0 O9 L7 m$ f/ `
  1279.   fi
    - f8 H7 c& Y5 i. |

  1280. 9 _, @* O; P# x# Z
  1281. #TODO What if DBC are not yet generated ??# Y0 B% u0 P5 ^6 t- H. a
  1282.   if [[ $ACTIONS == *1* ]]; then5 C! k9 g  @& m) `1 |3 t2 w3 C
  1283.     if [ -d "$GAMEPATH/dbc" ]; then
    4 l, E' I% w6 b( q5 j4 J
  1284.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "DBC and Maps were already generated" \  R$ S, f6 }, I
  1285.         --yesno "Do you want to generate them again?" 8 609 w- }* S* \1 z3 A
  1286. 6 P+ W, G9 ?1 r4 u8 W% h
  1287.       # Check the user's answer* d. @& Y7 T8 T, g9 }% y& g
  1288.       if [ $? -eq 0 ]; then% \2 K6 O+ T" h5 V8 k( i2 O1 D
  1289.         Log "Deleting DBC and Maps previously generated." 1. c) n: C# Z  g
  1290.         rm -rf "$GAMEPATH/dbc") u) w8 e% u8 {' H8 z1 g
  1291.         rm -rf "$GAMEPATH/maps"
    5 _0 {0 U2 Q1 S8 C2 y6 a. s6 j7 n$ E
  1292. & n+ O4 B  ~6 j$ k
  1293.         Log "Copying DBC and Maps extractor" 0
    3 X+ h. ^/ l# m5 R9 {8 ~- t
  1294.         rm -f "$GAMEPATH/map-extractor"
    ( E% L5 m' Q2 W4 k4 E( o! H
  1295.         cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH"8 s) ?3 T& ]" N" i- T0 ^" _( E
  1296. % }4 [& y  ]9 ^: D! a1 E
  1297.         Log "Extracting DBC and Maps" 0
    % M9 |, }+ b5 g
  1298.         cd "$GAMEPATH"
    . n+ D3 O; `5 Z$ H3 \
  1299.         ./map-extractor! y2 t( E/ L4 m$ y& j
  1300.   U5 {- @& u* ]0 x' f4 B
  1301.         if [ $? -eq 0 ]; then# _% Z' K7 O  P0 C" f5 ?. @
  1302.           Log "DBC and Maps are extracted" 0  O1 O+ g. x0 k6 j6 c( K% \2 a! c
  1303.           Log "Copying DBC and Maps files to installation directory" 0; `" q( q! s3 R; |
  1304.           cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
    1 X4 M; h; ]4 C5 X$ R: G
  1305.           cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
    ( c  V9 l' T4 e! O2 Y1 s) H  w/ q
  1306.           rm -rf "$GAMEPATH/map-extractor"
    : f( J: l# B- @* b
  1307.           Log "Changing ownership of the extracted directories"
    $ y8 s. I: Z" ^, S; b% o
  1308.           chown -R $USER:$USER "$INSTPATH"
    # L0 C: b* ?6 `
  1309.         else
    : J4 R- H  W6 t) k" g. J! q
  1310.           Log "There was an issue while extracting DBC and Maps!" 1# v3 Y8 S& g9 ~) n
  1311.           rm -rf "$GAMEPATH/map-extractor"' x* |& r3 z5 f1 E$ C# z' U
  1312.           rm -rf "$GAMEPATH/dbc"  P  d) @" L: @2 [" ^- g$ [
  1313.           rm -rf "$GAMEPATH/maps"# t0 `. Q3 i3 L/ a9 U$ m& U) u
  1314.           exit 1! \" b* x* @' F1 T* i% \1 X, I
  1315.         fi. y$ K' n  R  p
  1316.       else( q  y* Z# a6 d
  1317.         Log "Copying DBC and Maps files to installation directory" 0
    7 ^/ e; X9 r2 X0 Y+ B- R) M
  1318.         cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
    9 s# d" C& T9 s. w7 ^' N2 O
  1319.         cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
    9 k" X6 B+ p* g5 U' o- r
  1320.       fi% ]/ X) h" l* A5 v
  1321.     else
    . X) L4 d# l) U% j
  1322.     rm -rf "$GAMEPATH/map-extractor"7 T3 `: F4 _$ S. M- p' d
  1323.     cp "$INSTPATH/bin/tools/map-extractor" "$GAMEPATH"
    + s$ b; h  U8 O
  1324. 8 m& E: N: x# {; i$ z
  1325.     Log "Extracting DBC and Maps" 0
    2 [8 P3 |6 i) j, _5 p# m$ f, z$ D
  1326.     cd "$GAMEPATH") q) o; l4 Q  }% ]! O' q: ~
  1327.     ./map-extractor
    ; f( O+ ]! N0 G- n
  1328. 2 S. }* j- Q4 o
  1329.     if [ $? -eq 0 ]; then! Z0 |% Z! R4 L: g
  1330.       Log "DBC and Maps are extracted" 0
    4 a0 \$ Q* D& a2 J# _! t# `8 }
  1331.       Log "Copying DBC and Maps files to installation directory" 0
    - E- I: @( c& D) o% n
  1332.       cp -R "$GAMEPATH/dbc" "$INSTPATH/bin"
    ' S2 H$ z3 X) h* A& H# U! s
  1333.           cp -R "$GAMEPATH/maps" "$INSTPATH/bin"
    % p3 ]7 \. @: [9 T
  1334.           rm -rf "$GAMEPATH/map-extractor"
    0 y8 k. \" f9 ^7 y
  1335.           Log "Changing ownership of the extracted directories"
    7 h- ]( h: l' u+ D% c
  1336.           chown -R $USER:$USER "$INSTPATH"5 o" W" ~, _, K, V
  1337.         else
    % ~! n6 x" ~' L. u. m; ~
  1338.           Log "There was an issue while extracting DBC and Maps!" 1$ c5 e1 R8 V  @2 h4 Z6 X5 e
  1339.           rm -rf "$GAMEPATH/map-extractor"9 ~3 ^1 ^. k, `+ q% s9 i
  1340.           rm -rf "$GAMEPATH/dbc"! m( K) _6 s& i8 m2 A, @
  1341.           rm -rf "$GAMEPATH/maps"6 y0 g: Q+ M% x& D6 |8 o
  1342.           exit 1
    * V. E% m3 L& e) r! I
  1343.         fi. g0 F( T+ h/ |% P/ q( I9 U
  1344.     fi
    / P4 W; u6 E% n) o6 \3 g
  1345.   fi' e; |/ S) Y6 l: ~
  1346. % a$ A0 f; I' u: i
  1347.   if [[ $ACTIONS == *2* ]]; then
    1 U& c6 |/ s+ s  x# |6 d
  1348.     if [ -d "$GAMEPATH/vmaps" ]; then4 y# E6 `8 Y( [" {8 D: C
  1349.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "VMaps were already generated" \
    3 u% n, _: c4 F( w
  1350.         --yesno "Do you want to generate them again?" 8 60
    , o/ y# H8 |5 E& F! `. C% b9 R

  1351. # t: H% b  V7 g1 E* `
  1352.       # Check the user's answer
    & o+ Z0 @" [2 ^- r+ F
  1353.       if [ $? -eq 0 ]; then( m' A7 x$ r$ o. d" A8 i
  1354.         Log "Deleting VMaps previously generated." 1
    ' L' F& z/ y) A) ?# g1 U8 M
  1355.         rm -rf $GAMEPATH/vmaps# N; d1 n6 w6 Y. @! l
  1356.         Log "Copying VMaps extractor" 0' L: R1 I0 E2 I# B5 M" }, s
  1357.         rm -f "$GAMEPATH/vmap-extractor"
    , e! N6 A+ Q! L( r
  1358.         cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH"
    4 m' o* X' f) H7 @1 ]$ K
  1359. " m0 }# k# @. X2 S) V5 ?4 v8 G
  1360.         Log "Extracting VMaps" 0
    9 w- e2 j& U, |8 S" P" z
  1361.         cd $GAMEPATH2 v2 B4 M5 O- l! d
  1362.         # Make sure there is no previous vmaps generation that cause issue.) X3 r6 d9 ]) Y# v
  1363.         rm -rf Buildings& J# C2 z" h# R; s3 f; A
  1364.         ./vmap-extractor
      @9 F* o# C3 t9 H1 q* {% n" f

  1365. 6 e! }( o, ?& c2 G5 s
  1366.         if [ $? -eq 0 ]; then0 ]/ W& {; ?" `7 G& {2 O$ D
  1367.           Log "VMaps are extracted" 0
    ! s4 C" W( H, ^+ d( K
  1368.           Log "Copying VMaps files to installation directory" 0
    ! P! b5 b2 S: L4 B3 E: x
  1369.           cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
    8 n8 @5 x5 y- M, B' g6 F
  1370.           rm -rf "$GAMEPATH/vmap-extractor"
    7 c! h' g% P$ Q: X, m
  1371.           Log "Changing ownership of the extracted directories"
    ) z6 G: C. I2 |, t  K) O6 i
  1372.           chown -R $USER:$USER "$INSTPATH"
    ' \* G) ]+ F: H6 u
  1373.         else
    8 C/ B- b% o0 m5 ~: `" k" @
  1374.           Log "There was an issue while extracting VMaps!" 1
    4 r0 N3 F( L' ~2 P$ l( A
  1375.           rm -rf "$GAMEPATH/vmap-extractor"
    . r  U# l! w4 o3 P/ {$ P0 r$ x
  1376.           rm -rf "$GAMEPATH/vmaps"
    $ @% |1 ~6 b) B6 V( s
  1377.           exit 1: v& a: }. E+ Y. m  E
  1378.         fi
    + h* [  H% r" I1 T$ J6 V
  1379.       else6 ?9 u0 P+ L; \5 |" i2 E" T7 k. T
  1380.         Log "Copying VMaps files to installation directory" 0
    " I/ U$ ^! o$ P9 c* j8 P/ N
  1381.         cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"# ?% C9 \7 d/ B( o3 D
  1382.       fi
    5 d& Q( K9 }' A9 }; \
  1383.     else
    7 Z! J& b/ M% O9 h' G5 I4 t; x
  1384.      Log "Copying VMaps extractor" 0
    . F1 T: C' I( {' e9 z# f. ]
  1385.      rm -f "$GAMEPATH/vmap-extractor"$ D2 }: Q0 W* U- ]/ f
  1386.      cp "$INSTPATH/bin/tools/vmap-extractor" "$GAMEPATH"
    0 q) P7 i( v# V$ y: S
  1387. 0 {  `% ~3 `1 V
  1388.      Log "Extracting VMaps" 0
    ) e2 h/ R8 ~4 V9 ]1 K1 ]$ z
  1389.      cd $GAMEPATH3 l( ^  p5 U# K& m1 \/ l
  1390.      # Make sure there is no previous vmaps generation that cause issue.
    $ L. y2 x; l1 E! Y1 ?
  1391.      rm -rf Buildings
    0 B+ f: c. O9 P7 J2 J% l
  1392.      ./vmap-extractor* [. A& {* o' m6 N0 w" D8 d3 l
  1393. ' {0 F' D( g* T9 G6 q7 Q
  1394.      if [ $? -eq 0 ]; then
      A7 Y$ ]# O  C& G4 ]7 w' H
  1395.        Log "VMaps are extracted" 0  j* D( M' ~; K
  1396.        Log "Copying VMaps files to installation directory" 0' M" T, I6 ?% Y7 D$ j
  1397.        cp -R "$GAMEPATH/vmaps" "$INSTPATH/bin"
      @; E8 m3 }: F. g' [
  1398.        rm -rf "$GAMEPATH/vmap-extractor"& F* q1 d% q1 @  h( A5 }7 B% z
  1399.        Log "Changing ownership of the extracted directories"
    . c0 `9 \0 L% h! `) a) V
  1400.        chown -R $USER:$USER "$INSTPATH"
    6 e5 P3 G$ Z+ O) O/ v/ @
  1401.      else
    1 F, ]; m( A2 L
  1402.        Log "There was an issue while extracting VMaps!" 1. V$ b% ^2 S  |3 t- i' H3 e. J
  1403.        rm -rf "$GAMEPATH/vmap-extractor"" `. A" j$ E8 S- D2 h' m. b
  1404.        rm -rf "$GAMEPATH/vmaps"
    ' x, t: U8 G' X8 }4 ~- u
  1405.        exit 1
    , C$ h% ?, H) c. L' V  N
  1406.      fi
    % V  J' q6 W9 x( R
  1407.     fi8 n. l6 s! h" N' g7 V! t$ ]
  1408.   fi
    $ g% j* `6 D* P3 G/ |/ P

  1409. 5 E0 ?9 C* D2 |1 ?0 H: o
  1410.   if [[ $ACTIONS == *3* ]]; then5 B* k0 ^, O9 u) h8 d
  1411.     if [ ! -d "$GAMEPATH/maps" ]; then
    $ r" V0 ]8 R3 q; W- H  I7 ^
  1412.       Log "Error: maps files must be created to be able to generate MMaps!" 1( _4 l/ S0 r- `& h0 E& l
  1413.       exit 1& ~. M4 ]# r4 D- K! I. C* \5 w8 I
  1414.     fi
    $ V! s8 |: C* d" o
  1415. ) H( ^/ N* Q, {
  1416.     if [ -d "$GAMEPATH/mmaps" ]; then
    ( J6 }7 @" w( o1 }
  1417.       $DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "MMaps were already generated" \
    - }) p+ V' q& }
  1418.         --yesno "Do you want to generate them again?" 8 60( e8 J/ C" H( l. S) Z4 `

  1419. " F+ c. h2 d: w. [
  1420.       # Check the user's answer* N: F# U: X, z, A% ]: s" Q
  1421.       if [ $? -eq 0 ]; then
    ( n, p* n0 f/ S
  1422.         Log "Deleting MMaps previously generated." 1
    # Z% z' x% {( x
  1423.         rm -rf $GAMEPATH/mmaps
    ' }8 D" L5 u  ?

  1424. $ U& K% Y3 Y, ?  l4 ^8 }
  1425.         Log "Copying MMaps extractor" 0
    / k( ]9 Q( L1 P$ h  Q$ l
  1426.         rm -f "$GAMEPATH/MoveMapGen.sh"
    7 |$ ]1 [3 A( u5 Y# j9 _0 a: |
  1427.         cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH"
    ) Q9 }' f9 C! b* T5 q
  1428.         cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH"
    & v9 |& Q+ W5 M( k+ ?9 {$ M
  1429.         cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH"
    - i7 Z5 n0 Z$ _) N7 _' l" Z2 D% l: v2 d1 }
  1430.         cp "$INSTPATH/bin/tools/mmap-extractor" "$GAMEPATH"
    $ V% N4 d/ ]: A4 Q; N3 H: {& ]

  1431. : M0 l) J- q/ o, H* _
  1432.         CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \
    " T- H3 Y: u$ d7 |
  1433.          --inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3)& L1 |$ `) X; m0 [/ L0 a3 l

  1434.   p; I3 W# x8 f: h5 }% s
  1435.         # User cancelled his choice, set default to 1.
    , P* i% P# w/ j9 R. o
  1436.         if [ $? -ne 0 ]; then
    0 \( S9 f4 ~% E; }* q/ [# y
  1437.           Log "User selection was cancelled. Max CPU set to 1." 1
    ! F& p( c$ j1 s
  1438.           CPU=1
      d$ T5 ]; _$ z* U7 ~# t
  1439.         fi) |- z6 e7 `: U, |: j

  1440. 7 ]4 `. f% b" b: {- j; q/ y
  1441.         if [ -z "$CPU" ]; then
    7 @/ [4 L' j3 y  a& g2 K/ R3 g2 o
  1442.           Log "User didn't gave any value. Max CPU set to 1." 1! L5 x& @1 D; V% `) @2 h
  1443.           CPU=1
    & H( y) s. I5 x0 w9 }
  1444.         fi- c) g- I# o: Y' I6 Q- @
  1445. 5 o" _: y' c1 D5 u9 [# R
  1446.         if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then
    ' X1 M% l6 f. S- Z, {, I
  1447.           Log "User entered invalid value. Max CPU set to 1." 1/ {5 D3 Z/ n. H- g  m/ g1 D  x) u
  1448.           CPU=1& o5 W6 S3 D8 w" A) y5 ^& `
  1449.         fi; z2 R1 m% w4 I9 w
  1450. 7 L% Z* x" q; o2 @
  1451.         Log "Extracting MMaps" 01 f, G; {/ t& Q+ U$ v0 J
  1452.         cd $GAMEPATH
    ; J+ b. T. F3 v- z! }1 W$ U) }
  1453.         # Making sure we can execute the script, s% w+ }! R5 y' ?
  1454.         chmod 700 MoveMapGen.sh& y& \! a6 d3 U/ n
  1455.         ./MoveMapGen.sh $CPU1 ?) B6 y- G6 O5 G' L

  1456. ! @7 U: c% h5 E& g1 a- B$ l9 `
  1457.         if [ $? -eq 0 ]; then! C6 V" C" ~2 H6 j, O9 ?, ^4 f  Z
  1458.           Log "MMaps are extracted" 0
    / K  |" v  v1 Y  f* V; x* G
  1459.           Log "Copying MMaps files to installation directory" 0
      N" A) `* c8 ]5 ^, r
  1460.           cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"1 Q( t. n2 a0 ?: H/ ?/ f7 @
  1461.           rm -rf "$GAMEPATH/MoveMapGen.sh"
    4 }( c/ L+ x) p+ O+ d
  1462.           rm -rf "$GAMEPATH/offmesh.txt"
    ; H3 O7 y( k, S/ M
  1463.           rm -rf "$GAMEPATH/mmap_excluded.txt"- j2 f( F' o1 C- p, T
  1464.           rm -rf "$GAMEPATH/mmap-extractor"% G% r; n, w6 Y/ y$ j3 e7 k
  1465.           Log "Changing ownership of the extracted directories"6 Y% ^# ^' l0 g: I. Q6 C
  1466.           chown -R $USER:$USER "$INSTPATH"
    ) i1 Y! }( v1 x9 g8 ?! ]6 @6 I$ x
  1467.         else: w4 K. Z& r8 {  Z5 M0 ]
  1468.           Log "There was an issue while extracting MMaps!" 1' I3 L9 @  e. t  r
  1469.           rm -rf "$GAMEPATH/MoveMapGen.sh"
    % ]: i- ?  p$ G& F, W
  1470.           rm -rf "$GAMEPATH/mmaps"' B: N& ~( M2 b3 g" f  J
  1471.           rm -rf "$GAMEPATH/offmesh.txt"
    0 p& e3 }8 ?4 S4 J
  1472.           rm -rf "$GAMEPATH/mmap_excluded.txt"
    5 j) k( M; \  a1 g; I
  1473.           rm -rf "$GAMEPATH/mmap-extractor"
    9 E& b& w) u8 @4 q7 K2 u- Z
  1474.           exit 1+ {, [- {' t2 D$ q0 ^: U
  1475.         fi8 l% G+ v% U& _$ \" ?
  1476.       else/ z) o. r' O5 g1 v3 r2 T
  1477.         Log "Copying MMaps files to installation directory" 0
    + |! y/ p! {6 ?! Z0 C( h% L' m
  1478.         cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"
    , \1 F7 l0 ?# i# B( i! t9 ?
  1479.       fi
    3 M( n2 P" p/ F% H
  1480.     else$ e/ p2 i  R4 W* D$ n
  1481.     Log "Copying MMaps extractor" 0% r3 f' v" R. C: B  b, O
  1482.         rm -f "$GAMEPATH/MoveMapGen.sh"7 F2 g1 S1 H- m; h
  1483.         cp "$INSTPATH/bin/tools/MoveMapGen.sh" "$GAMEPATH"! I/ x4 _7 |& W9 q1 i
  1484.         cp "$INSTPATH/bin/tools/offmesh.txt" "$GAMEPATH"
    & H! Z$ @+ @7 t. L" p# W
  1485.         cp "$INSTPATH/bin/tools/mmap_excluded.txt" "$GAMEPATH"
    ' G8 d; I7 @+ C; j
  1486.         cp "$INSTPATH/bin/tools/mmap-extractor" "$GAMEPATH"" r0 }$ n3 |, J
  1487.     CPU=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Please provide the number of CPU to be used to generate MMaps (1-4)" \3 H( v/ }0 m: U8 I
  1488.          --inputbox "Default: 1" 8 80 3>&2 2>&1 1>&3)
    2 o" \/ P  X( ]$ r$ w

  1489. " b/ V# U0 W$ x3 Q- y* m
  1490.         # User cancelled his choice, set default to 1.' s% g- g+ Q" N0 t, Q# C' f
  1491.         if [ $? -ne 0 ]; then& E& `; I+ O3 L: k
  1492.           Log "User selection was cancelled. Max CPU set to 1." 11 R  w& O& j3 C5 z: t  D
  1493.           CPU=1" z2 Z8 u0 y0 a6 Z* r" j
  1494.         fi8 Y6 {% G4 Z( t" U$ u, r( C

  1495. - g  V* e; o' ^; V% J2 B6 v
  1496.         if [ -z "$CPU" ]; then% U7 O& Y0 L/ W4 s
  1497.           Log "User didn't gave any value. Max CPU set to 1." 1, `7 @0 q5 P$ o. L! U; P. L
  1498.           CPU=1, v0 @. c4 C$ I/ |
  1499.         fi, F$ ~: [$ U9 Z' D. i& G6 G

  1500. & _5 F1 m- x; g. Q' o$ T9 ?
  1501.         if [ "$CPU" -lt 1 ] || [ "$CPU" -gt 4 ]; then
    ' R) P. ~; {: R4 w! {, D0 a, C
  1502.           Log "User entered invalid value. Max CPU set to 1." 1
    4 C: @! U+ s% E( x( z: ~, H% C+ X
  1503.           CPU=1
    ; E; z' i7 h8 h
  1504.         fi
    9 [1 _9 Y8 j7 l/ h' r
  1505. & M1 I+ D% a. m3 |0 D0 `# i1 M
  1506.         Log "Extracting MMaps" 0: D4 I! T- o2 ^% |! H( C$ g
  1507.         cd $GAMEPATH
    ( k5 U2 r+ K; q5 m: z1 U: Y* Q
  1508.         # Making sure we can execute the script
    4 C; S. q% M9 Q& ~
  1509.         chmod 700 MoveMapGen.sh( E( ]$ Q1 }9 \1 o  w. [
  1510.         ./MoveMapGen.sh $CPU
    + i1 ~% _' Z  F! [/ M, l

  1511. " d7 F' n7 ~# j  t
  1512.         if [ $? -eq 0 ]; then
    6 W( p8 n- k3 B4 n8 X# E- G
  1513.           Log "MMaps are extracted" 07 R3 U6 y0 _: ^
  1514.           Log "Copying MMaps files to installation directory" 04 p0 s' I7 S: Z/ [9 j& |
  1515.           cp -R "$GAMEPATH/mmaps" "$INSTPATH/bin"
    # q# I& ~4 X8 w& F9 _9 o' t- C1 e# a
  1516.           rm -rf "$GAMEPATH/MoveMapGen.sh"
    ; L7 c0 f* o* H
  1517.           rm -rf "$GAMEPATH/offmesh.txt"- s; p4 c  _& r2 S0 F
  1518.           rm -rf "$GAMEPATH/mmap_excluded.txt"
    - C+ [  |+ z- Q4 l7 N
  1519.           rm -rf "$GAMEPATH/mmap-extractor"3 q6 z" I& O0 n# J
  1520.           Log "Changing ownership of the extracted directories"1 a" |) r8 u$ @( q9 [; n
  1521.           chown -R $USER:$USER "$INSTPATH"
    5 ?, R$ P& o5 }* z$ V& g8 a9 y
  1522.         else! N$ S8 q- i( l0 g8 R
  1523.       Log "There was an issue while extracting MMaps!" 1
    $ d4 u: L* ]: G! k
  1524.           rm -rf "$GAMEPATH/MoveMapGen.sh"9 o+ P' E6 a0 T
  1525.           rm -rf "$GAMEPATH/mmaps"
    5 Q+ A7 q' @6 s. |' E
  1526.           rm -rf "$GAMEPATH/offmesh.txt"
    & y6 _; \% i. C* ~
  1527.           rm -rf "$GAMEPATH/mmap_excluded.txt"
    $ O# ~' E" a# e& Q- `
  1528.           rm -rf "$GAMEPATH/mmap-extractor"
    ) C" u" s/ ?  a* L5 h; b% x
  1529.           exit 1
    # r7 X: I- x. M  X! L/ i) t3 r
  1530.         fi
    0 Y( d6 G7 U5 B) y
  1531.     fi3 ^% e. n4 }+ x% i9 Z- i
  1532.   fi
    ( e4 A9 q/ X5 s0 D3 ?; S
  1533. }
    ! }* p' q* c2 H4 E

  1534. " K8 C( I$ R0 V( a0 e
  1535. # Function to create a Code::Blocks project
    7 @& C. o! b8 a0 o3 F0 C
  1536. function CreateCBProject
    ( ~( n; b2 H$ @$ y, Q  f. z1 {
  1537. {( F( L* j* D0 P9 S1 j/ @2 w
  1538.   # Create the dircetory if it does not exist
    ( e% K+ f* d# ^8 {/ D* q
  1539.   if [ ! -d $SRCPATH/server/linux ]; then
    8 Z' n  R2 \+ y4 |, n, }
  1540.     mkdir $SRCPATH/server/linux
    / J6 ?$ j" v" V& H) Z% ?
  1541.   fi
    ( S; Y/ `6 _  N: ?! R4 T

  1542. 6 L8 E" d# d# L0 B" f3 Q$ H
  1543.   # Now create the C::B project9 f" ]6 d  a3 n" W2 c) M
  1544.   cd $SRCPATH/server/linux
    & P3 K$ q" |: X2 V! y
  1545.   # make sure we are using the cmake3' H/ L" @$ c  Q
  1546.   UseCmake34 \9 q! g! r) w/ Z# V9 {9 n
  1547.   $CMAKE_CMD .. -G "CodeBlocks - Unix Makefiles"5 e" }2 |& O+ ~+ O. N- k
  1548. }% K& C1 Y$ Z9 M4 S, O) ^
  1549. # e0 \1 U" A7 c$ K; ]$ ~
  1550. $ E/ A0 u' A+ ^2 ^& J8 f1 B7 V0 D

  1551. & r! L- b6 G5 j! @8 Y4 i. I, u+ W
  1552. # Prepare the log
    * f; l  u5 l% E
  1553. Log "+------------------------------------------------------------------------------+" 0% `4 @' J# F7 c2 Q1 ~
  1554. Log "| MaNGOS Configuration Script                                                  |" 0
    , g1 O9 U+ e  k' W; o4 `5 A! p+ ?
  1555. Log "| Written By: Ryan Ashley                                                      |" 0
    5 m+ b& w  m( m2 C% C
  1556. Log "| Updated By: Cedric Servais                                                   |" 05 v; @1 J# e8 ~
  1557. Log "+------------------------------------------------------------------------------+" 0" x! {5 Y6 b) @: m+ o4 C
  1558. . V9 }4 l% e1 X2 _) t8 v
  1559. # Check if user who is running this is root
    ( S( P2 w8 ?# [! l
  1560. CheckRoot! ?' Y5 e& H+ n2 ]" z

  1561. $ d( K- I+ k" l) \0 C
  1562. # Select which dialog to use8 J' w$ x0 z2 \! U
  1563. UseDialog
    7 P( v% p; q! b/ H2 f

  1564. - B$ d6 z% O& A6 Y; D
  1565. # Select which activities to do
    8 I  }# f9 x6 a7 Y, z3 q
  1566. TASKS=$($DLGAPP --backtitle "MaNGOS Linux Build Configuration" --title "Select Tasks" \$ S  Z9 m* q8 \- q% C' K6 Q- ?
  1567.   --checklist "Please select the tasks to perform" 0 70 8 \
    / I3 s9 P' N. s
  1568.   1 "Install Prerequisites" On \9 I3 [: d2 f2 F" c, u
  1569.   2 "Set Download And Install Paths" On \
    * o) n( w" n/ A0 W+ t! L$ a
  1570.   3 "Clone Source Repositories" On \+ S* Y. r) c) V( u
  1571.   4 "Build MaNGOS" On \! w5 n* U$ o. u
  1572.   5 "Install MaNGOS" On \
    6 i# O4 \- ]$ ~0 ]
  1573.   6 "Install Databases" On \
    7 K; R% p- L3 x# U; z
  1574.   7 "Extract Resources" On \
    * ~, A& x3 v$ V) {9 O2 F3 N# ?
  1575.   8 "Create Code::Blocks Project File" Off \# |5 y- a  H* |, A6 ]. U6 b
  1576.   3>&2 2>&1 1>&3)
    ) N9 L6 {% @; r
  1577. % Y& ]' d1 e) Z/ Y0 d3 _
  1578. # Verify that the options were selected- b. R& }% u7 T: r7 u& g7 X* N
  1579. if [ $? -ne 0 ]; then# |( @( f/ p8 T& J2 l% i
  1580.   Log "All operations cancelled. Exiting." 16 w4 j& T2 y2 v. e0 q) j: I
  1581.   exit 0
    ) C+ d  x9 T  @5 M+ Z/ R
  1582. fi! R$ F# S+ J+ R
  1583. * e- E1 L4 P' f3 \
  1584. # Install prerequisites?
    . p; g% E- Q3 Y% N1 c! J# i
  1585. if [[ $TASKS == *1* ]]; then
    ) g2 g1 y( {: Y% o  ]9 ~, i
  1586.   GetPrerequisites5 S. X4 {: X, n
  1587. fi& m5 l& L+ T* k1 j  w7 N9 Q3 e

  1588. 9 f) v2 z* }! m; |
  1589. # Select release and set paths?
    0 {! K. f, Q  T, }. d
  1590. if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then- C1 r8 E' u1 A5 y8 A" p: W9 D
  1591.   GetUser" x4 i  w! b: i: k
  1592.   GetRelease( T, h# o! e3 _9 ~9 u
  1593. fi/ r! o0 X( o, X" j
  1594. 9 D# l% Z0 y# U  h  V2 C& A6 Q& c" l/ L2 T
  1595. if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *6* ]] || [[ $TASKS == *7* ]]; then
    . I7 j6 j  o2 F: N* Q
  1596.   GetPaths! N. C: G+ f7 @8 A+ D
  1597. fi; |1 O" {+ s( M% k& k
  1598. ! P$ q3 g: a" ~3 h* j! P
  1599. # Clone repos?2 \7 [9 G1 u" a7 j
  1600. if [[ $TASKS == *3* ]]; then$ X0 ^* l8 S1 u% t9 B1 N3 X
  1601.   GetMangos: c6 T# k# S5 x
  1602. fi
    8 S! W( c9 r' a
  1603. & x& I7 u" r; u3 K- K  l# i2 P
  1604. # Build MaNGOS?
    ! @5 r" E% H6 K; }
  1605. if [[ $TASKS == *4* ]]; then4 F2 ^9 n* s1 H0 ^4 q( K
  1606.   GetBuildOptions! l! N. R$ t+ T9 W0 q; N
  1607.   BuildMaNGOS
    : i: \5 R2 R  B1 ^, t9 o. F
  1608. fi* y  g, y, m) k3 s/ K6 v( t7 W

  1609. ' {# k& d% X1 ^5 T2 I
  1610. # Install MaNGOS?
    8 ~% Q( Q/ W; ]# G% e' ~% Z9 P( e
  1611. if [[ $TASKS == *5* ]]; then) ~9 B8 `) R, _: r) X
  1612.   InstallMaNGOS
    0 ]1 f6 o2 X. O+ {. _! i
  1613. fi
    * B9 J$ ]& i! ^2 u
  1614. # F- X% J2 Z! F) W4 d* ]
  1615. # Install databases?: [# i6 B; i) C% O9 c
  1616. if [[ $TASKS == *6* ]]; then
    7 S9 ?7 U8 |  `( T7 [# I% W# y3 @
  1617.   HandleDatabases  Q( c, P; X, g- T2 P6 P
  1618. fi/ t4 d+ r$ E, b

  1619. ; X% t) \7 ^' E) l
  1620. # Extract resources from the game?  Z. h6 `( W3 E1 W# e4 W
  1621. if [[ $TASKS == *7* ]]; then; K+ C4 J5 Y) c4 m  o! }& t
  1622.   ExtractResources2 u) s; m+ I) m( Y- Z4 _
  1623. fi
      p5 Y5 Y: x  W% n: S* o+ V1 C) K

  1624. ' j1 W, X& g( k! I' N: j
  1625. # Create C::B project?
    ) e  L+ C6 q+ l6 X* j& L4 a" U
  1626. if [[ $TASKS == *8* ]]; then0 l" L# s+ m+ R
  1627.   CreateCBProject
    $ K' K* v  n' ^9 ^  z3 J# A% A1 n
  1628. fi
    - T, G" d2 y6 C& `
  1629. 5 E2 m+ p4 P4 G
  1630. # If one of these actions has been performed, then we know the user." k& e) i3 G3 \' Q3 G8 Y" b- M
  1631. if [[ $TASKS == *2* ]] || [[ $TASKS == *3* ]] || [[ $TASKS == *4* ]] || [[ $TASKS == *5* ]] || [[ $TASKS == *7* ]]; then
    : C* M& g  T6 e8 K
  1632.   Log "Changing ownership of the extracted directories" 1
    $ o" l* x# I4 R1 M+ b2 e! ]8 L
  1633.   chown -R $USER:$USER "$INSTPATH"
    & U4 L0 a8 {  Y
  1634. fi! m0 V. l8 f  M, x. S# u
  1635. / L3 ^7 @: Y. L0 I. e
  1636. # Display the end message
    3 X, l& C- A$ ^9 S, H8 \
  1637. echo$ ]8 `+ s" z  `2 |2 Q7 ^) r5 Z3 E
  1638. echo "================================================================================"/ I4 v- k3 y" }: f( s: z# u5 E
  1639. echo "The selected tasks have been completed. If you built or installed Mangos, please"2 ^2 G1 o' R$ _
  1640. echo "edit your configuration files to use the database you configured for your MaNGOS"
    : S6 |' d0 r. Z# o
  1641. echo "server. If you have not configured your databases yet, please do so before"" ~1 J. g8 J4 Y* Y
  1642. echo "starting your server for the first time."
    2 k% F0 C! s* ], W0 l2 Q
  1643. echo "================================================================================"
    4 u0 M/ n  C; i2 F
  1644. exit 0
复制代码
  1. wget -c https://raw.githubusercontent.com/mangostwo/database/master/InstallDatabases.sh && bash InstallDatabases.sh
复制代码
  1. #!/bin/sh+ p3 B+ ?* b7 c! Z) I
  2. ##############################################################################) o& O4 I4 |4 x6 [- D  X
  3. # This utility assist you in setting up your mangos database.                ## T& C3 S! S8 c+ n- s) y- P
  4. # This is a port of InstallDatabases.bat written by Antz for Windows         #% V) p8 Y) m/ C+ }: y9 T8 @/ A
  5. #                                                                            #
    : o: m$ c5 h  W
  6. ##############################################################################& u: @) }0 I$ m3 Y
  7. : P# I( E0 z5 u/ m4 z# c4 ?/ w
  8. OLDRELEASE="Rel21"8 }  a0 [7 ]4 U. J
  9. RELEASE="Rel22"
    - l" W4 S2 {0 x  s7 X+ s1 Z1 j
  10. DUMP="NO"+ D6 x8 a) q3 E* B6 {

  11. 9 l' R' b# o' s8 t
  12. dbname=""8 d+ k* W# g( A
  13. dbcommand=""# d" `2 S2 b% f/ ]

  14. - P0 ^: ^7 ^" K: k! {
  15. createcharDB="YES"$ s1 ]' |' V9 O7 ~
  16. createworldDB="YES"
    2 ]& X8 A+ ?3 I( `* ~) P9 x
  17. createrealmDB="YES"
    5 E/ w  Y" N3 {  ^

  18. . x5 u9 W' o) g+ w
  19. loadcharDB="YES"5 q7 N8 b7 N& Y' G
  20. loadworldDB="YES"
    ) d) p6 @( K. ]' ~; j4 ]
  21. loadrealmDB="YES"
    . U1 ], e5 b$ A9 i' Q0 }" x  E
  22. dbType="POPULATED"$ z. f0 V; ^' [6 \. k

  23. 3 s- E" }. |  j. n8 X) S
  24. updatecharDB="YES"7 g8 U- B# Q& o+ E
  25. updateworldDB="YES"0 e. ~! l& D+ G6 H/ _1 T, Q+ y
  26. updaterealmDB="YES"1 d6 Z& U6 z: y7 T6 J$ a
  27. + B+ k3 U& [# M. B; d% b6 C4 n" P
  28. addRealmList="YES"* t* h: I8 o7 L) F9 i& t0 x

  29. - l& F5 Z6 |% p# r7 e
  30. svr_def="localhost"- q" ^4 f: c7 @" [; E0 a* J
  31. user_def="mangos"
    0 `+ S/ p7 u& ~1 B1 p/ v
  32. pass_def="mangos"
    4 {8 L7 m* O. l+ Z" m  z) G
  33. port_def="3306"+ Z# l8 l3 Z9 O1 S! O
  34. wdb_def="mangos2". f# b' ?9 `+ O! m8 D
  35. cdb_def="character2"
    % M# L3 a4 Z' ?, w# ^& K
  36. rdb_def="realmd"8 P+ B2 S% e' i  M+ i8 _. J

  37. . T. k5 W3 e8 l5 z; d
  38. printHelp()
    # L- A9 Y0 t/ ?6 B- j$ g
  39. {4 P" S5 A1 F  l
  40.         printf "Usage: $0 [-s] [-u] [-d] [-h]\n"% ^' b- _! ?% a, _- [
  41.         printf "\t-s: Run this script in silent mode, only prompt for the database information\n"5 A5 @: S: Z3 w' W  r& a/ C4 B8 g
  42.         printf "\t-u: Run only the updates of the database\n"
    7 T' w4 k! H/ }' A
  43.         printf "\t-d: Dump the database configuration into the home directory of the user\n"  q& {/ t+ s6 L& n
  44.         printf "\t-h: Display this help\n"& g4 V1 W& U, u0 T8 Q/ _2 f
  45. }0 C) n: |; N2 C+ l$ t, H! L
  46. & \% E2 ~0 s6 [5 d
  47. printBanner()1 L) a4 [0 p- r' w! R9 U0 {7 y4 Q
  48. {9 I3 p% J- E3 n! @
  49.         clear
    0 `" y/ S$ A8 ~, l9 f( Y
  50.         printf " #     #     #    #   #  ###   ###   ####  \n"1 c) B' W* p+ a
  51.         printf " ##   ##    # #   ##  # #     #   # #      \n"' |( q$ o& @, E9 ?9 W
  52.         printf " # # # #   #   #  # # # # ### #   #  ###   \n"
    7 _7 [, a6 S0 s  T5 k
  53.         printf " #  #  #  ####### #  ## #   # #   #     #  \n"9 Y9 |7 G) A" u2 r# E; I, h
  54.         printf " #     #  #     # #   #  ###   ###  ####   \n"
    ( n" z; M- y8 j) C5 C1 \, {. |9 r
  55.         printf "\n"0 {; [( _+ Y4 N9 ~& ^0 q2 @
  56.         printf " Database Setup and World Loader v0.03         \n"
    7 Y" \7 Z( ^& ~7 Q3 }
  57.         printf " ---------------------------------------------- \n"
    ' r- p+ F8 R5 X( Y/ c& W
  58.         printf "  Website / Forum / Wiki : https://getmangos.eu \n"
    0 }0 ]8 C- F0 Q% l2 ^
  59.         printf " ---------------------------------------------- \n"
    " F) c3 N! O/ {. k. ^
  60.         printf "\n"1 A8 ^6 u: U: O' Y
  61.         printf "\n"
    $ ~* [+ C; n- b
  62. }
    - p+ w% ^& Q/ }! B

  63. 8 i( n' N: t) V* l3 Y
  64. printActivities()
    " F/ V$ a* w$ R  ?
  65. {
    % G9 f& h5 Y1 c! y
  66.         printf "\tCharacter Database : \tV - Toggle Create DB (${createcharDB})        \n"1 c- {9 b. r' w: h4 W* C$ M
  67.         printf "\t\t\t\tC - Toggle Create Structure (${loadcharDB}) \n"
    , J' M1 y0 U/ B# u
  68.         printf "\t\t\t\tB - Apply Character DB updates (${updatecharDB})\n"
    2 a- f( O5 A" l; y
  69.         printf "\n". Q5 d7 ]* T# i6 t
  70.         printf "\t    World Database : \tE - Toggle Create DB (${createworldDB}) \n"8 p% b9 h* C, P
  71.         printf "\t\t\t\tW - Toggle Create Structure (${loadworldDB}) \n"       
    9 S$ j/ @/ \& L5 s% U1 G2 o
  72.         if [ "${loadworldDB}" = "YES" ]; then
    ' R( N& w* k# {; _  R1 r
  73.                 printf "\t\t\t\tD - Toggle World Type (${dbType})\n"
    6 h( n. M, C; e0 H' x
  74.         fi! w; H1 F0 v5 S
  75.         printf "\t\t\t\tU - Apply World DB updates (${updateworldDB})\n"
    ; k  @* p% {1 [; V9 `
  76.         printf "\n"
    " W6 i+ g8 `# m, @( O$ i5 O
  77.         printf "\t    Realm Database : \tT - Toggle Create DB (${createrealmDB})\n") W- e; q# }% y5 c' Z
  78.         printf "\t\t\t\tR - Toggle Create Structure (${loadrealmDB})\n"& B  z- {+ S, k
  79.         printf "\t\t\t\tY - Apply Realm DB updates (${updaterealmDB})\n"$ ~/ b# r6 }7 S/ M
  80.         printf "\t\t\t\tL - Toggle Add RealmList Entry (${addRealmList})\n"          A* l' s0 n6 ?9 K6 q
  81.         printf "\n"; s" g# p. T2 p* q3 s
  82.         printf "\t\t\t\tN - Next Step\n"
    - n( [: H$ [! K3 m; k: |" h
  83.         printf "\t\t\t\tX - Exit\n"  |9 t7 g- e2 A5 X  P1 `
  84. }2 K# _+ V* m0 y3 e# `* i
  85. 3 S% U: R. ^4 |
  86. determineDBName(): }. [# R; [; V3 C: z. ]% I# B8 C
  87. {
    0 z4 i) j! @7 X/ y
  88.         if [ $(which mariadb) ]; then) n) j0 G0 P* v
  89.                 printf "MariaDB found.\n"$ A; c2 {9 ^# `
  90.                 dbname="MariaDB"& z8 e6 J& Y+ v& X$ C9 \' `
  91.         elif [ $(which mysql) ]; then
    2 {; r+ }0 T) [; M% `8 [# s9 s
  92.                 printf "MySQL found.\n"
    . a2 j8 V5 d# G1 J
  93.                 dbname="MySQL"
    ' T3 u+ _  [5 A0 g5 O6 `$ t: l
  94.         else
    , h; \! I9 q; w4 o5 R, P. W) w) \
  95.                 printf "Did not find mariadb or mysql.\n"
    4 [: m# {! R. {) M
  96.         fi
    & y, u* D' m9 d' c/ H3 T
  97. }
    4 g  ?$ t4 l* {. _. l
  98. . D3 I1 ~# @! r
  99. mysqlconfigeditor()5 `3 l9 n0 [* r* ?5 L' a
  100. {* _$ M$ c; h. b! f$ ~2 I  f  y
  101.         dbconfig="mysql_config_editor set --login-path=local --host=${svr} --port=${port} --user=${user} --password --skip-warn": T3 @1 v- D* {' v0 U5 M* g- O
  102. }
    - m# d* ]9 ^! e/ S% x% J* A3 a

  103. & O: @" X, }7 r+ |2 L
  104. determineDBCommand()" h! \- y" H9 a  c
  105. {- b2 L0 K1 E1 r6 s
  106.         if [ $dbname = "MariaDB" ]; then
    7 j0 b' y4 g' s, r* o# g- x  b
  107.                 dbcommand="mariadb -h ${svr} -u ${user} -p${pass} -q -s"# K8 D, [% ?# O
  108.         elif [ $dbname = "MySQL" ]; then! P, {0 i: p' r+ c1 y+ g
  109.                 dbcommand="mysql --login-path=local -q -s"
    $ t. {( V0 ]- H% E3 s2 x
  110.         else
    / o/ d" r9 N2 L, c/ B& H
  111.                 printf "Did not find mariadb or mysql.\n"
    ! Q( Q' m6 v6 ?
  112.         fi& p. t7 T1 o- h3 C5 T
  113. }, x2 I) E' ^2 T5 ^' o8 L5 g3 q; b! U

  114. ' H+ j7 X6 Q5 E$ H
  115. createCharDB()
    8 R: I3 ]% Y+ q  g
  116. {" p. ]2 Q5 }. {3 I$ T( U, z) m
  117.         printf "Creating Character database ${cdb}\n"
    ; R, X  P0 y" d* o. M" K" _; O: Z$ u$ |
  118.         $(${dbcommand} -e "Create database ${cdb}")
    # O( n& a/ B$ a6 M* s, X: P

  119. & i& n. b% s) T9 [. e& Z7 L
  120.         if [ "${loadcharDB}" = "YES" ]; then
    / [" V1 Z% |- S2 A; p- h$ a4 Q. u
  121.                 loadCharDB; Y) u" P% J: I8 {( R8 J
  122.         fi8 j+ U5 g- N8 d( M
  123. }2 [- j: R" {+ T. ~2 ^0 l

  124. 0 e. I8 p5 S- T: V
  125. loadCharDB(): ~6 z" c0 I5 G$ z) o9 n# z2 g) f4 p
  126. {
    5 @, [% B. v1 A( S
  127.         printf "Loading data into character database ${cdb}\n"
    $ m! A/ H5 p! q. L% v! o# q& a
  128.         $(${dbcommand} ${cdb} < Character/Setup/characterLoadDB.sql)
    6 v$ n! o' K3 `- O

  129. ) B7 i8 M3 k4 H: K' q( K# }8 R
  130.         if [ "${updatecharDB}" = "YES" ]; then
    1 U& W2 l7 I* l3 T
  131.                 updateCharDB
    * R5 T# B1 N* B" [
  132.         fi
    ( J9 l( {; [' K# \1 n6 ^
  133. }
    % Z) d; U- t8 d- |3 N) X; d$ t" f# a
  134. 1 s' o0 ~( r$ }( g
  135. updateCharDB()& B2 T. E! X2 T2 [3 e
  136. {! n! s  T* D1 _6 e9 T; _  O
  137.         printf "Updating data into the character database ${cdb}\n"
    ' U$ S' j1 O9 u% j
  138.         for file in $(ls Character/Updates/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
    : }  w# y! _. i# I
  139.         do- j: D' F4 ^4 _
  140.                 file=$(echo ${file} | tr '|' ' ')3 J% w) j( D4 |& i
  141.                 printf "Applying update ${file}\n"$ ]- ]6 h4 |* w4 D* N+ @) a
  142.                 ${dbcommand} "${cdb}" < "${file}"
    7 y7 H; D, g- F! @7 I* v- V; L' U
  143.                 printf "File ${file} imported\n"
    ' k1 T2 `+ r* z8 H* j3 m2 n( [3 m& M
  144.         done
    ) b6 u" z/ z; b( B' m

  145. 6 E2 Q! L1 z) N2 U  {3 Q; E$ w- }
  146.         for file in $(ls Character/Updates/${RELEASE}/*.sql | tr ' ' '|' | tr '\n' ' '). y' c4 @5 ^/ Z* T
  147.         do2 L! C+ z/ M  l$ `
  148.                 file=$(echo ${file} | tr '|' ' ')! _3 O5 _( J* ^3 a
  149.                 printf "Applying update ${file}\n"# R. E( z, X) _/ D" D- f* U
  150.                 ${dbcommand} "${cdb}" < "${file}"" R9 l" A1 Y5 C$ @2 ?9 b
  151.                 printf "File ${file} imported\n"
    ' b  b: g9 Q- X( S. i" F  o
  152.         done
    $ a1 B- R+ p# u! X+ t$ Z3 q
  153. }
    . F9 l3 c. [( ?& a
  154. 7 @1 h' B  B$ t& s4 }7 K
  155. createWorldDB()
    ' d, @  M! g( h
  156. {# w/ i8 U, f; \7 S) s
  157.         printf "Creating World database ${wdb}\n"
    " t1 k% G' g3 z" @2 ^# B. w
  158.         $(${dbcommand} -e "Create database ${wdb}")! t; W( M# W; ^/ z) |9 k2 X3 L

  159. ; C, A% ?" t; Z' R3 M
  160.         if [ "${loadworldDB}" = "YES" ]; then
    . B. u  O. T7 I( Z: [
  161.                 loadWorldDB
    % u: S. y! H( W( O& G
  162.         fi
    * e3 R$ }8 j" s, K" s, P
  163. }- Q! o8 M3 F2 i

  164. " ^; m0 f6 s% C9 [9 `) H
  165. loadWorldDB()- k' y2 R. g, F1 H2 s/ B
  166. {  D6 _& r  y2 S- ~* S) P* q8 j
  167.         printf "Loading data into world database ${wdb}\n"  u4 k9 O1 r8 P8 p8 c# r" |. N2 L
  168.         $(${dbcommand} ${wdb} < World/Setup/mangosdLoadDB.sql)
    * Q9 o/ H5 t( `5 ?6 X2 O- b

  169. ! h* r1 X7 u" y+ m) q& Q
  170.         if [ "${dbType}" = "POPULATED" ]; then" V  }. N( A2 R2 i; o) H
  171.                 populateWorldDB
    ; }5 Q5 w* w) w- {
  172.         fi
    " z$ o" h* ^( ^' M  Z1 l" a, C
  173. }
    ; q/ u( A" N( k7 A+ M. D

  174. ' _) Y/ w2 i5 M' ^6 |( ^
  175. populateWorldDB()6 V- N. `: N1 N3 ~. a, t. x3 A
  176. {9 v7 S5 A1 O7 B( N) T' n9 g
  177.         printf "Importing World database ${wdb}\n"
    8 e8 F% |/ B; h! |
  178.         for file in $(ls World/Setup/FullDB/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ') 4 O- Q& w1 S7 [
  179.         do4 P! v3 f: n) H8 l0 Y8 X- c4 h# r
  180.                 file=$(echo ${file} | tr '|' ' ')- m  p6 v% y9 \6 q9 `
  181.                 printf "Importing file ${file}\n"
    $ P) p/ \5 E6 A) {
  182.                 $(${dbcommand} ${wdb} < ${file})
    3 Z* M+ e4 Y$ p6 H' Y  L
  183.                 printf "File ${file} imported\n"/ z8 Z7 Y! i1 m( P8 J
  184.         done& c1 s- A6 k# ?* j( |% Z& N
  185. 3 f; w- ^( L$ z# y
  186.         for file in $(ls World/Setup/FullDB/*.sql | tr ' ' '|' | tr '\n' ' ') , `) d+ Q9 d1 A( X* p) L
  187.         do
    ; S% w3 f+ T/ H8 b' D
  188.                 file=$(echo ${file} | tr '|' ' ')- O. Z5 B$ n& Z7 k5 E
  189.                 printf "Importing file ${file}\n"
    7 P& R8 q6 i/ t
  190.                 $(${dbcommand} ${wdb} < ${file})
    2 ^$ ], B' v( |$ Z+ t
  191.                 printf "File ${file} imported\n"; D; A) S" `* K# l% |# E
  192.         done
    0 Z) o$ X9 w4 Z
  193. }
    ; \. y* k2 k9 s% P7 f
  194. 1 O3 k4 Y' M0 b% j* P! W- p- i
  195. updateWorldDB()0 _( [) K. Y' z' }6 Z/ u7 \
  196. {
    ' {! X6 }3 B4 W$ B1 s* m% r, ?
  197.     printf "Updating data into the World database ${wdb}\n"8 k6 o4 U. Q( P# y, J9 A' ]- K+ a
  198.     for file in World/Updates/${OLDRELEASE}/*.sql0 Q  u) C. `2 ?- {# B
  199.     do
    9 O# `: T6 c$ b% m% n
  200.         printf "Applying update ${file}\n"
    " h- y, Z9 q0 ]: s
  201.         ${dbcommand} "${wdb}" < "${file}"
    5 m* _; D8 E( {; n: A
  202.         printf "File ${file} imported\n"1 N- ~) r2 J9 Q
  203.     done5 ^; y5 P, q$ T+ L9 W$ k
  204. ; D( ?1 T8 z' t/ j
  205.     for file in World/Updates/${RELEASE}/*.sql5 f8 x* t  v5 k9 O& T- ^7 n3 _2 P
  206.     do
    * m( w1 u& u# C
  207.         printf "Applying update ${file}\n"
    - X  B1 ~/ b6 U* x7 L
  208.         ${dbcommand} "${wdb}" < "${file}"
    " g+ Y* v; ^+ r2 e  c
  209.         printf "File ${file} imported\n"
      g# P. ^, U; H9 E) B- E
  210.     done1 @/ I) S" e8 h
  211. }
    . R4 }  c& H% i- k; ^3 x8 S
  212. * {( m  C- X% f( ]! d
  213. createRealmDB()
    5 W. M7 r. ~! d# J" c6 H7 P
  214. {
    8 G+ E1 p3 N2 a) E3 J0 p1 c% N
  215.         printf "Creating realm database ${rdb}\n"
    8 h4 l) ^; @# O/ }5 x8 `0 u0 y7 Y
  216.         $(${dbcommand} -e "Create database ${rdb}")6 v( m" i+ ]! Y$ O. {2 }
  217. . p% P8 r1 z$ U) m
  218.         if [ "${loadrealmDB}" = "YES" ]; then
    ( Y; N8 [6 h5 s- k+ A
  219.                 loadRealmDB3 U1 |# N  @1 f% q2 w# q. E/ L
  220.         fi
    ( q5 y, @, k7 _
  221. }2 E5 b5 I! \7 R# B5 X% l9 ~

  222. 2 X' w1 l$ r5 q  i, ]& c
  223. loadRealmDB()
    ( ?, W! q% N* c0 W6 Y' }: c
  224. {8 M6 |: [9 g) m. l6 U
  225.         printf "Loading data into realm database ${rdb}\n"        2 \5 f+ e8 W5 t
  226.         $(${dbcommand} ${rdb} < Realm/Setup/realmdLoadDB.sql)6 F5 i: C4 V9 K! e" ?9 \% Y
  227. }% o: Z2 |) w  }+ I8 {4 `- n

  228. , L. ]4 ~& S- {5 M) A
  229. updateRealmDB()9 U6 z7 V; o5 N6 _- S
  230. {: L7 ]4 j. j  i: ^! S
  231.         printf "Updating data into the Realm database ${rdb}\n"
    % [% z& W+ r8 @2 t: i5 B5 I: U
  232.         for file in $(ls Realm/Updates/${OLDRELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')2 w& ]- d& z1 Q8 ?% s
  233.         do
    + M- _- E% M! t1 O# B2 D( l
  234.                 file=$(echo ${file} | tr '|' ' ')
    7 F0 I' r* q! G, Z9 l  I
  235.                 printf "Applying update ${file}\n"
    9 n# o& Z2 n$ [, s
  236.                 $(${dbcommand} ${rdb} < ${file})6 f( Q* o9 o, }! b
  237.                 printf "File ${file} imported\n") j, z2 n/ X; ^! ]+ N7 |: c# W; Q5 H
  238.         done
    * k2 n0 `- c; @

  239. 6 i; g7 p, I+ F+ l' u/ b
  240.         for file in $(ls Realm/Updates/${RELEASE}/*.sql | tr ' ' '|' | tr '\n' ' ')
    4 I) L( o# C7 o+ a
  241.         do
    & v7 _/ t# a" Q& @# \' M
  242.                 file=$(echo ${file} | tr '|' ' ')
    6 r3 m( ~6 d- w) f8 t1 l3 s
  243.                 printf "Applying update ${file}\n"
    + ~& i' e6 E7 U9 L4 ~
  244.                 $(${dbcommand} ${rdb} < ${file})
    2 K6 x, W% a/ m5 ~- A" [; w
  245.                 printf "File ${file} imported\n"
    1 g  f+ [" p0 ^$ F
  246.         done9 |) @( G: I0 Z' R0 c. ~
  247. }
    ' i/ ]* o- t2 o: K
  248. + W. U1 v8 U* j' }1 D9 l3 p
  249. addRealmList()
    ) |9 P+ k3 \. z1 P) }% |
  250. {
    6 G$ z7 a- n  Q# u: S/ y3 K! r
  251.         printf "Adding realm list entries\n"/ B5 d5 a( y1 @( u/ Z. f# V
  252.         $(${dbcommand} ${rdb} < Tools/updateRealm.sql)
    7 j! h( t* M, C, u- n4 d
  253. }' R1 t) V1 n9 b: E' s, \

  254. $ {8 R! ?& B) y/ f' z) \/ ~' m$ {
  255. activity=""7 e7 j6 T8 S4 B8 h

  256. 0 p1 v0 o4 k. S% d4 [" J
  257. while getopts "suh" o; do3 f  p' {: ?; u* }+ N) x
  258.         case "${o}" in
    ; P1 F" _9 E! a8 k* n* N& J* }& ]! {" s
  259.                 s)
    ; i, c# h" G# H" X8 s- q9 m5 h
  260.                         activity="N"" t8 U3 j) h  F
  261.                         printf "You selected silent mode\n"
    7 {' E8 X- e* _  a% E7 v! p
  262.                         ;;
    4 @% U$ G5 d+ D% S/ B$ Z
  263.                 u)
    # ~1 s4 c' u. e+ t
  264.                         createcharDB="NO"$ s3 e* k& T9 c  z: o
  265.                         createworldDB="NO"
    % j. _2 `; z5 C! |8 v; I$ A2 S
  266.                         createrealmDB="NO"2 o. [* o! r$ Z( z4 c1 O
  267. ) ~2 y, S& n+ r& w( l
  268.                         loadcharDB="NO"
    1 o3 F) e! Z9 i0 ]3 g( [) B
  269.                         loadworldDB="NO"+ i* Z0 L4 t9 e
  270.                         loadrealmDB="NO"7 s+ }/ }6 x) J: _, @
  271.                         dbType="EMPTY"
    6 y) J- [! D: M
  272.                         printf "You selected update only\n"
    7 [/ w8 y, z- {( f( Y$ Q
  273.                         ;;! R: e) V* ^& v! u( \* j
  274.                 d)
    & R7 ]) _0 u. _: @: p& _. `
  275.                         DUMP="YES"
    # |! [. k4 L8 F# s; ^1 ~( Q: @* Z
  276.                         ;;
    4 ]* D" J, k# `
  277.                 h)
    1 i, ?1 k: k- W  H3 @
  278.                         printHelp& Q* b  Y. n- ^+ g9 ]: ~  W
  279.                         exit 0- \# z. k- ^+ L4 ]+ S3 ^% e( a
  280.                         ;;9 H1 |& \( O% e9 L1 a* b
  281.         esac
    ( k' D2 m" `% P, Y$ s+ ?9 k  i+ V2 u
  282. done! }6 A$ T, r0 F" u7 g) @: h+ O
  283. # c  J' h' K/ L6 d8 v9 e( V
  284. while [ -z "${activity}" ] || [ "${activity}" != "N" ]
    5 J" b1 v( \: J3 w5 [$ x
  285. do
    : `( R5 z' s6 \+ H: t$ i
  286.         printBanner
    2 N  j* I% L" a2 z4 V3 O
  287.         printActivities
    5 H' m% M" k( k5 W* `5 B- d% d
  288.         printf "Please select an activity : "
    4 d! e. P  i, N  `8 R
  289.         read activity0 w7 B, u+ i: r
  290.         activity=$(echo ${activity} | tr '[:lower:]' '[:upper:]' )1 r* g4 G2 ?* j" ^9 ?% Y; X
  291.         case ${activity} in5 w' j& N, J! r
  292.                 "V"). B: p$ C  O- @: ?. O+ U. z
  293.                         if [ "${createcharDB}" = "YES" ]; then
    + f/ U6 q6 R1 ?* _
  294.                                 createcharDB="NO"0 D4 L( _# c& U% B
  295.                         else ( {# N" L; [) \6 q) I( M
  296.                                 createcharDB="YES"/ F# `0 e8 ]! M9 U
  297.                         fi$ E% ~  \2 P1 x5 S& G
  298.                         ;;) c4 Y6 E  Z1 i. E
  299.                 "C")
    * g- q' E! d0 [: e  [/ u: Z7 |4 H% u$ a
  300.                         if [ "${loadcharDB}" = "YES" ]; then- _$ o. _' z3 A. e
  301.                                 loadcharDB="NO"/ t. g+ B2 {) t  G
  302.                         else
    9 `+ @! X) U8 {
  303.                                 loadcharDB="YES"
    5 ~' `- |/ X* y$ L! @1 K% O
  304.                         fi
    / m' B& b/ ~/ C3 r5 h, k# h
  305.                         ;;+ l" Z0 c5 S8 a+ J" F, A) A
  306.                 "B")" U2 f9 I5 o8 Y2 s+ S7 K. G
  307.                         if [ "${updatecharDB}" = "YES" ]; then! S  _  o. B( P* g
  308.                                 updatecharDB="NO"
    ( L- v4 d4 H& L
  309.                         else # n- h4 d* }6 M/ C+ r
  310.                                 updatecharDB="YES"4 X. a( a7 I9 A$ f3 u; z4 b
  311.                         fi
    + J) P0 V/ U/ @3 B: `' m
  312.                         ;;9 b8 x1 N& m/ c5 p) S' S
  313.                 "E")' ?9 b7 m/ a7 j
  314.                         if [ "${createworldDB}" = "YES" ]; then# [' ^7 ~- n7 u3 X# J
  315.                                 createworldDB="NO"
    " W9 c/ w. }5 ?) k0 @& ]
  316.                         else
    & `, c8 W& W  d
  317.                                 createworldDB="YES", I/ ?8 ]  m2 @' w( q
  318.                         fi        + L5 w/ J' M9 _; x
  319.                         ;;) r$ |. s: t+ `: Z& p/ m6 z
  320.                 "W")
    ; s" I$ d" E$ K% N- p9 T& S" s8 s9 g
  321.                         if [ "${loadworldDB}" = "YES" ]; then
    ) G1 r6 m" k% E; v. G, Z7 E
  322.                                 loadworldDB="NO"
    + ~0 w3 R) N+ R, I* `  x
  323.                         else 5 J  N1 Q$ v/ @; w5 N( M
  324.                                 loadworldDB="YES"9 ^7 B: J4 G/ T4 |$ q( A. O
  325.                         fi       
    5 F. S3 k* T3 Z6 I
  326.                         ;;. ^" v+ w8 p$ q# x+ i3 U& A
  327.                 "D")/ g' ?8 T- w6 j0 X, t& d6 [
  328.                         if [ "${dbType}" = "POPULATED" ]; then
      S) W. C" s3 i) k4 B* |& C
  329.                                 dbType="EMPTY"
    ) K, r* V: c4 O2 i, W# A* W0 v8 ^
  330.                         else ( z" f& s4 l- M, K8 a
  331.                                 dbType="POPULATED"
    4 X8 A; L) A- K/ o7 o* G- S/ S. z$ [+ Y
  332.                         fi                                 8 p4 D$ S  R1 @8 H( ~) Q2 |
  333.                         ;;% D2 E6 t7 I8 X8 U+ D5 u8 E
  334.                 "U")
    $ j5 |6 K7 t3 O) s8 ]  A& n2 R
  335.                         if [ "${updateworldDB}" = "YES" ]; then7 ~9 A$ V3 F- M8 ^. x" d, d
  336.                                 updateworldDB="NO"3 y- g7 z- H1 r4 Y, s8 q* b
  337.                         else & V( D9 G7 e+ K
  338.                                 updateworldDB="YES"
    6 z( P) ]1 I( I7 Q( q0 ?# i
  339.                         fi
    6 A4 ^) R" N: G* m
  340.                         ;;
      f7 J  U0 Q, f' ~) R- h
  341.                 "T")4 {+ [! B# m: E6 J' r6 Y3 w) @% m
  342.                         if [ "${createrealmDB}" = "YES" ]; then: L7 h- T0 X) P  o/ `& n
  343.                                 createrealmDB="NO"
    6 b2 l% E) n; y" E, u
  344.                         else
    4 [8 j$ H3 F# t  ?$ H' X
  345.                                 createrealmDB="YES"! [3 V  a9 @% ]
  346.                         fi                                
    , m* k1 U9 f* {3 V$ h2 u) H  I
  347.                         ;;2 M& c# w8 U+ Q
  348.                 "R")
    ) g* U. W% ^* _1 L" U
  349.                         if [ "${loadrealmDB}" = "YES" ]; then
    * \: j0 t' S" @% r! q- k
  350.                                 loadrealmDB="NO"                       
    9 A! D5 F# G+ [0 e) i* Z+ z
  351.                         else ' |9 A- |8 U1 M+ d
  352.                                 loadrealmDB="YES"/ I$ H* }% @1 x6 S0 G4 x
  353.                         fi4 m! v  C* @+ w" f2 Y( L
  354.                         ;;' K3 j# q5 z7 ?* E
  355.                 "Y")
    8 _% D9 x5 Z) ^- M; c1 R. Y' K
  356.                         if [ "${updaterealmDB}" = "YES" ]; then1 p' X! T* W5 ^* |
  357.                                 updaterealmDB="NO"' _5 k8 P2 \: A. M& ^- h6 |
  358.                         else
    / b7 K" W. S- G# T  D% y% }; X5 \
  359.                                 updaterealmDB="YES"
    $ C+ }' Z4 t; G" u  i& o
  360.                         fi; {+ I4 ?- y- i5 k% c& b
  361.                         ;;
    9 ~" o" E1 {5 j* c9 m7 J. R
  362.                 "L")
    3 c, U, K! w) w2 i! Y* C5 s
  363.                         if [ "${addRealmList}" = "YES" ]; then3 U0 H( g5 C1 ~1 V) B7 b/ e& N8 a
  364.                                 addRealmList="NO"
    ! Y0 R0 N# L8 C" e% `$ z& m+ o
  365.                         else
    2 b7 j: H- ~8 a- |3 [
  366.                                 addRealmList="YES"
    ) n0 Z- u1 O0 |' O" G9 k) x2 [
  367.                         fi
    , f, ^; t* H3 r
  368.                         ;;* u; ~% ~, V& j. o
  369.                 "X")
    - V% i+ m1 b0 N; N
  370.                         exit 0;;
    3 t( n9 |: n# X; m
  371.                 *). B9 @! Z6 ]# v4 `* B* P
  372.                         printf "Invalid selection";;
    ; z6 _; J( O5 V+ x4 K$ k  h
  373.         esac
    * }  q) _) V: X0 G0 B/ w
  374. done
    - W2 K! J; i* }! t4 I+ W) X; m$ R

  375. " M& }! S7 M8 T! U8 Q" |
  376. printBanner
    - {# Q! k% b. i) x7 K  D0 a7 Q. M
  377. determineDBName
    ! u* \( E0 b2 }9 m# W5 ?
  378. printf "What is your ${dbname} host name ?\t[${svr_def}]: "
    ' a& t( ?1 u* r6 Q% K9 q
  379. read svr
    " b( y, O8 q# D5 y8 g2 f: u
  380. svr=${svr:-${svr_def}}
    3 E% H1 r3 j, I
  381. printf "What is your ${dbname} user name ?\t[${user_def}]: "
    ; s: q; |9 x( q2 j" A
  382. read user( ?- }- ?8 {  y- I
  383. user=${user:-${user_def}}1 p- f# H% @1 o) b2 t1 e
  384. printf "What is your ${dbname} port ?\t[${port_def}]: "& W  ?" @% q0 Q4 m6 V
  385. read port) E$ }9 H. s$ g# l
  386. port=${port:-${port_def}}* o- k! w% J# b# z) m, R( D0 b7 S
  387. if [ $dbname = "MariaDB" ]; then
    $ e2 y/ J  t/ X% g' P, g7 W4 S
  388.         printf "What is your ${dbname} password ?\t []: "8 M" C  L" A8 x( b! W0 k0 \
  389.         read pass5 m. @9 g* \! j! ?+ z6 A
  390.         pass=${pass:-${pass_def}}
    ! n8 R' a; t3 ]8 @) t
  391. elif [ $dbname = "MySQL" ]; then
    / g; U+ y+ l- _! M
  392.         mysqlconfigeditor
    / A7 n7 Y! R* d  q
  393.         $dbconfig/ _: {# U9 ^7 A9 q9 B3 o/ j
  394. fi- P  l. j" F5 P+ g4 f$ Z
  395. determineDBCommand7 K: P7 h; A8 ^" p, E# }2 X3 p" `
  396. , h7 t2 ^0 N! I2 O  K# s3 I: d
  397. if [ "${DUMP}" = "YES" ]; then
    $ Y- `: Z; j7 w, ~( x/ c
  398.         printf "Enter it again \t[]: "
    0 K9 |1 I" U$ v  p
  399.         read pass/ V' P3 L+ g* v* }( G3 j2 Y
  400. fi
    0 V5 N+ F4 g1 O+ l/ g' w' O

  401.   b7 U  X2 ]9 r' m" ^7 E% A
  402. if [ "${createcharDB}" = "YES" ] || [ "${loadcharDB}" = "YES" ] || [ "${updatecharDB}" = "YES" ]; then3 G1 o* B7 G, T7 J
  403.         printf "What is your Character database name ?\t[${cdb_def}]: "
    & L+ L" D- \* `* V! m; g1 V  X
  404.         read cdb+ }' d5 i3 W0 h, D
  405.         cdb=${cdb:-${cdb_def}}
    + _- E  H/ j: z9 [! R7 N
  406. fi
    ) X9 a. _* w$ r( h3 f8 C) \) @

  407. % n& g* `! I4 t4 M, N- S% G) e1 x3 T
  408. if [ "${createworldDB}" = "YES" ] || [ "${loadworldDB}" = "YES" ] || [ "${updateworldDB}" = "YES" ]; then
    0 P" e) M6 o+ L; }) k6 e
  409.         printf "What is your World database name ?\t[${wdb_def}]: "
    # D9 a3 m6 D. Z: R+ h" S3 {, X! _
  410.         read wdb
    & h: }$ a! Y5 p! ?4 V
  411.         wdb=${wdb:-${wdb_def}}
    0 h' x3 l4 N+ x2 |# G5 N
  412. fi. ~# J; `& R7 E
  413. ! F7 a9 T3 p! |* ^6 g6 ?" S
  414. if [ "${createrealmDB}" = "YES" ] || [ "${loadrealmDB}" = "YES" ] || [ "${updaterealmDB}" = "YES" ] || [ "${addRealmList}" = "YES" ]; then
      k+ [* w, p, t3 [# u5 M" O
  415.         printf "What is your Realm database name ?\t[${rdb_def}]: "
    9 \' L" S  u5 ]! \" i5 M
  416.         read rdb+ i' Z, d: A) ]
  417.         rdb=${rdb:-${rdb_def}}/ k) d$ T' R# K2 a4 r* p/ i* d
  418. fi
    6 Q7 {! M9 P: b* ]

  419. " g2 u$ j, f9 x2 y
  420. if [ "${createcharDB}" = "YES" ]; then
    + }6 i1 k, k& U. _" |
  421.         createCharDB) |4 C9 E7 m) w' ?
  422. fi
    9 g8 y4 \- a6 r7 O* j  G5 m' q

  423. ) |) C+ k2 g2 ?& x9 l8 ^9 C
  424. if [ "${createworldDB}" = "YES" ]; then/ ~" y$ ^! ~. z5 K
  425.         createWorldDB# \+ A: R( G/ B
  426. fi
    8 j2 @$ M, ^# [" y' k/ ^: f- e7 G
  427. 3 c& N7 X7 ^) V$ R
  428. if [ "${createrealmDB}" = "YES" ]; then+ ?+ Y$ b6 f) q3 P
  429.         createRealmDB" e7 ~; x6 F% \3 y
  430. fi
    4 O9 q$ d8 x, ?% M+ M
  431.   b( o$ d2 {* D5 x6 {  `! o
  432. if [ "${updateworldDB}" = "YES" ]; then! F8 x3 P# w9 U. y0 x# }) d$ s
  433.         updateWorldDB+ b- \6 N. U( A9 a
  434. fi5 ], X! \; @) ~+ ]: [
  435. " U0 E0 s7 v/ ~4 ?. N& ]
  436. if [ "${updaterealmDB}" = "YES" ]; then) ^4 a4 ~. z7 F) z' Z5 p; F1 Q
  437.         updateRealmDB
    ( j* D, _- a1 K8 r
  438. fi4 @5 p# V9 h! B
  439. - [8 E8 E4 e, _6 u4 h$ v) D0 ?
  440. if [ "${addRealmList}" = "YES" ]; then
    / v1 w. Z/ z- y' |
  441.         addRealmList
    & {4 |# C; ?# e
  442. fi
      G" ?) b. q0 M& u2 D& r
  443. $ _6 H8 u) ?/ }/ P& w
  444. if [ "${DUMP}" = "YES" ]; then' M6 ]2 q0 s. B0 [$ i$ Z% @
  445.         printf "Dumping database information...\n"
    6 W4 s- x) B+ Z# X# s/ A% R8 p
  446.         echo "${svr};${port};${user};${pass};${rdb}" > ~/db.conf9 A& k  _/ J0 Y& i# F+ ^
  447.         echo "${svr};${port};${user};${pass};${wdb}" >> ~/db.conf
    ; q$ A! c4 |6 O: w/ v# K2 Q
  448.         echo "${svr};${port};${user};${pass};${cdb}" >> ~/db.conf
    ; v' `$ ?) x: E. m: \0 n! h( E
  449. fi
    ( L+ s! a7 V2 P+ C# Z5 ~

  450. 9 Y$ u$ Q, {' k7 e. e5 I/ }& X
  451. printBanner
    " |4 O9 q; o/ x/ F- d" h
  452. printf "Database creation and load complete :-)\n"
    6 W5 `% ~3 S  U8 A0 B1 _: W- W
  453. printf "\n"
复制代码

. `) ~, B+ }. J& S: t2 H
回复

使用道具 举报

985

主题

92

回帖

5万

积分

管理员

积分
53561
 楼主| 发表于 2022-7-29 17:24:34 | 显示全部楼层
Playerbot AI 命令6 V; m3 d0 |0 C

+ d( R0 [2 w2 x" D使用 Playerbot 密钥的指南:
7 {" s/ G( O/ ^$ O* t3 I
) h! ~" T# s  J9 U标识符说明3 |$ J: n: r/ _" ]% ~- e
机器人名称    机器人的名称. Z' S* c/ r2 H) L" N
朋友    命名机器人或玩家角色
- i$ a2 B$ U4 ?8 S. r' k目标    选择目标玩家、尸体或NPC(非玩家角色)
+ ~6 {. F: {/ _7 E0 G$ B|    逻辑或0 B/ V5 \* I9 y' B: r+ E
&    逻辑与
- b: m& e6 a2 D, l; C& e# l  R..    多个实例5 j* i7 ~2 K  |; Q
/命令    MARCO 命令
  y4 @% s! a# J* q# F8 q: e3 x8 _/s    聊天:说( p  |4 r( [9 k# P4 \
/p    聊天派对7 A9 m! Z5 i4 k( l) k; z6 x
/t 机器人名称    聊天:TELL BOTNAME
- S) _1 }4 u+ m8 f! G6 C$ r! p/w 机器人名称    聊天:告诉 BOTNAME
: H% T7 |3 U2 j  b: O, T<名称链接>    名字=
/ p. L5 z2 k8 k  n. R% o' }(捷径)    为命令或子命令分配快捷方式. J: j9 b* M# P; j8 C$ c- e
; R# N; ~1 ~- @/ `6 v
可用 PlayerBot AI 命令的完整列表 SAY 命令:语法说明
8 i7 ?& w4 ^7 n% M' J$ @.bot 添加 BOTBNAME    为世界添加角色( s( |1 ^6 W# a; a
.bot 删除 BOTNAME    从世界中删除角色5 b8 w- g+ R" X1 a
& g7 k7 g( K( [
当前仅与以下 playerbot 代码一起使用:portalzero 和 portalclassic(所有其他代码使用新修订的“命令战斗”命令来设置机器人角色)
# r, Z  s6 }$ O) d0 o; G.bot < co | 战斗命令 > BOTNAME    分配机器人角色( y. S3 Y5 ]3 t

2 t, X, m/ t3 A6 C/ o: ?$ F宏命令:
1 h/ ?, f, m) i! `  A' F句法    描述0 z  D( h! A& H; V1 [$ ?  X
/邀请机器人名称    机器人将自动接受聚会邀请& v8 X( n9 h' c: P1 |/ H
/uninvite BOTNAME    机器人将自动接受派对不邀请
0 [0 a8 C# ]9 W, ?* ?/ c2 M) {/ ]' T4 Q! r, A0 X
TELL/PARTY 命令:(某些命令可能不适用于某些内核)" ?4 b) T" N! T1 o1 N
句法    描述. V% u. n( @7 y# V
协助目标    机器人协助列出的角色,在他们攻击时进行攻击。! {, v9 Y8 \) L6 \. [$ f; w  @0 S
攻击目标    命令机器人攻击选定的目标,类似于宠物可以攻击的方式
1 H! h/ {, N  w8 \8 a6 V( K# |拍卖    命令机器人寻找附近的拍卖师并显示机器人的活动 1< Auction LINK >..
/ V7 J: I5 W1 F6 i, c8 U4 d( ^拍卖 (a)add 1< ItemLINK >..    命令机器人寻找附近的拍卖师并添加 1< ItemLINK >..1 m8 P& u! O+ p: r. h' i1 l& Q
拍卖 (r)emove 1< 拍卖链接 >..    命令机器人寻找附近的拍卖师并删除 1< Auction LINK >..
1 V* h- z! m% R" T3 Y. e" ^银行    命令机器人寻找附近的银行家并列出机器人的银行余额. V& F4 Q/ X* f" w4 y: f
银行 (d)eposit 1< ItemLINK >..    命令机器人寻找附近的银行家并将 1< ItemLINK >.. 存入银行
: I2 i4 Y3 z" f5 }9 t: c银行 (w)withdraw 1< 项目链接 >..    命令机器人寻找附近的银行家并从银行提取 1< ItemLINK >..
* W) @) w6 e8 {" X(b)uy 1< 项目链接 >..    命令机器人寻找附近的供应商并购买 1< ItemLINK >../ U7 e, }- ]( F3 e: B
©ast SPELL    拼写 = >
; G5 `6 }% x7 }% M0 a搜集    显示收集对象选项和当前收集状态
  R3 k8 H9 I) k5 \% _- f. }, J: \* X' ~收集对象    设置收集状态,OBJECT = <所有非战斗战利品对象职业任务>5 ~1 U, X8 S+ g3 O9 X
工艺1<配方链接>..    如果机器人知道,则创建所有列出的食谱
, `  t; |: [" M, x, ?3 @) c  K3 b工艺1<配方链接>全部    如果机器人知道,则创建一个配方的多个实例/ i4 U0 A& V5 e9 ]
工艺(a)炼金术    显示所有炼金术配方 1< 配方链接 >,如果由机器人学习3 ]' D7 ^6 Z/ X6 ?8 E+ \
工艺(b)锻造    显示所有锻造配方 1< 配方链接 >,如果由机器人学习/ G& o; X" Y% y
工艺(c)烹饪    显示所有烹饪食谱 1< 食谱链接 >,如果由机器人学习- Q; e" J! O5 u; y6 F
工艺(电子)工程    显示所有工程配方 1< 配方链接 >,如果通过机器人学习
7 q7 A: W* ~4 r+ U+ G2 u工艺(f)irstaid    显示所有急救食谱 1< 食谱链接 >,如果由机器人学习! U% r: e3 w$ G  [2 R; z6 z3 }
工艺(i)题字    显示所有铭文配方 1< 配方链接 >,如果通过机器人学习
& H$ ~9 J( k+ g' i工艺 (j)ewelcrafting    显示所有珠宝制作配方 1< 配方链接 >,如果由机器人学习
" B4 d( M6 y. A" T" p; R9 I手工艺 (l) 皮革加工    显示所有制革配方 1< 配方链接 >,如果由机器人学习7 F% j" v8 I7 ]/ r
工艺(m)魔法    显示所有可制作的附魔(例如魔杖等)recipes1<recipe LINK>,如果由机器人学习
! @, j$ q) j( B! ~% u$ a/ j% d4 I: z工艺熔化    显示所有矿石冶炼配方 1< 配方链接 >,如果由机器人学习
3 ]: ^7 v1 H; V- l, F) ]工艺(t)裁缝    显示所有裁缝配方 1< 配方链接 >,如果由机器人学习* j% N5 y4 ]/ e( h( s2 |6 ]
掉落 1< 物品链接 >..    命令机器人掉落并销毁指定物品 1<Item LINK>..% ]$ i6 N! X6 V& u
全部放弃    当机器人库存变满时,丢弃所有低级物品。+ n: R5 V2 e) f) `3 J. M
附魔    列出机器人学习的所有结界 1< Spell LINK >
) G( B6 p# B3 a3 D: C( q附魔1<法术链接>..    附魔选择可交易 1< 物品链接 > 装备或包中# Z2 X+ p7 _) x* s! t, X4 a3 [
(e)quip 1< 物品链接 >..    从它的库存中为机器人配备容器、武器、盔甲和小饰品
+ C9 z" o4 j' P# K" h7 v# {(e)quip auto on    打开自动装备,也立即检查7 U* C4 S5 S% Y+ G. D
(e) 装备自动关闭    关闭自动装备。
% ^+ s/ P7 Q' r* b) r; y(e)quip auto 一次    运行一次自动装备,然后将其关闭。
8 ?! _' f/ ~- v( s1 A0 o(e)quip 信息    显示装备自动切换状态(开/关)。/ z! L( K4 u4 N  x1 a1 E9 V
(f)ind 1< 游戏对象链接 >    命令机器人定位 1< Gameobject LINK > 然后等待。对任务目标有用
& A% N) q: V9 J' T; }; l* Y跟随    命令机器人跟随玩家;如果死了也会复活机器人,如果很远也会传送机器人
* C3 {/ }$ S* j" w/ a! U8 s# K! V" m7 f- g跟随汽车    切换自动跟随距离(开/关)$ I  k7 z/ N6 N+ p" z
关注信息    显示机器人当前的自动跟随距离,切换状态(开/关)9 \( Q6 a- m2 r: U6 B
跟着远    机器人跟随,远离主人。
- M( G6 B9 i8 I" E' _& l# O, A跟随附近    机器人跟随,更接近主人2 u2 ~  R: \, w
跟随重置    机器人跟随距离重置为原始默认值4 v( [: m! e7 A6 l3 D  V
(g)et 1< GameobjectLINK >..    获取选中的 1< Gameobject LINK >.. 然后返回给玩家$ ^. \5 d; @9 ~; o* K
订单    显示机器人的战斗命令- d6 i, ^: v/ o$ W& x3 x5 F5 ?
订单延迟<0-10>    在机器人开始战斗之前激活延迟。0 o8 h" }2 B  I2 C3 k9 ~
命令战斗 ASSIST FRIEND    协助链接的友方目标,集中我们的杀伤力。$ X! ?; r) I" K7 p9 u: r
命令战斗治疗    命令机器人治愈。最好用于萨满、牧师、德鲁伊或圣骑士。
% ?1 z5 O3 T/ c$ w; y- N命令战斗保护朋友    保护列出的友方目标,试图让仇恨远离目标。1 P3 Z2 X- x9 z- @
命令战斗坦克    命令机器人坦克。最适用于圣骑士、战士、德鲁伊或死亡骑士。$ c* J0 q! S- x2 o! k: g; @% _
命令战斗RESET    重置机器人战斗命令,就好像他们根本没有下达过一样。
: |' M4 ^% ?, q* W& Q6 l* A# O6 n订单恢复    将战斗命令恢复到注销前的状态。' M4 D) B) ]( T) b
邮件收件箱 1< MailboxLINK >    列出来自选定 1<Mailbox LINK> 的所有机器人邮件。邮件按 1< 邮件 ID > 索引。9 z! l  p0 B+ p: N4 G# F8 m, w
mail getcash 1<邮件ID>..    从所有选定的 1< 邮件 ID > 中获取资金..
9 G; S5 _  }1 ?7 b, A邮件getitem 1<邮件ID>..    从所有选定的 1<Mail ID> 中获取项目..+ W/ T) W7 W" H& E, `& S
邮件删除1<邮件ID>..    删除所有选定的 1< Mail ID >..* _3 i8 Y1 g; |1 w
宠物遗弃    放弃活跃的猎人宠物。" W; o$ Z% `1 L2 s
宠物驯服目标    驯服选定的生物,如果机器人在法术书中有“驯服野兽”法术& t$ U2 ~1 b4 ~6 W! t
宠物法术    显示 bot 的宠物已知的法术。自动施法法术将显示为绿色- F( s. d/ N1 o( K1 o
宠物施放法术    拼写 = >+ X) x* I1 B" {7 _% o6 a4 f+ k
宠物切换法术    SPELL = >为给定的法术切换自动施法2 R" y( l5 [! {: i' \$ Z
宠物状态    显示机器人宠物的当前反应模式$ |* e0 t  d- w6 s% M3 T# Z
宠物反应模式    模式 = <(a) 激进 | (d)防御性| (p)被动>
8 v9 H8 P7 o4 C; v" M  `9 W# x# e过程 (d)isenchant1< 物品链接 >..    分解绿色 1< 物品链接 > 或更好的
& m% Z5 e! H0 `& p7 B, n处理 (m)ill 1< ItemLINK >..    研磨 5 种药草 1< 物品链接 > 以产生色素# n" n% P& U# b% C+ I, T
过程(p)前景1<项目链接>..    搜索 5 个金属矿石 1< 物品链接 > 寻找珍贵的宝石
, ?& E3 \/ X& M/ u: o7 D8 h拉目标    以协调的队伍/袭击方式拉动目标。
& N1 o- w0 A$ |6 K! f9 P8 E5 y  O拉力测试    机器人会告诉您它们是否可以拉动(可以在任何地方使用)。: F; U9 r0 E1 V! ~
准备就绪    机器人会告诉您它们是否准备好立即拉动(在具有有效目标的位置上使用)。
7 z, l+ {3 }2 @9 H寻求    列出机器人当前的任务2 S4 ]8 |7 n( u
quest (a)dd 1< QuestLINK >..    命令机器人寻找附近的 questgiver 并添加 1< Quest LINK >..7 @2 \* _! v' M3 w( r( U7 e- k
quest (d)rop 1< QuestLINK >    命令机器人放弃 1< 任务链接 >
3 D6 A6 y1 R5 d- U" A7 m追求 (e)nd    命令机器人寻找附近的任务提供者并上交所有相关的已完成任务  z$ S3 x, p5 N- e; q0 l
寻求(r)报告    报告机器人完成任务所需的所有物品、生物或游戏对象. e( a+ w- s6 Y; F8 V# q2 U
任务(l)列表    命令机器人寻找任务提供者并显示新的可用 1< 任务链接 >..
1 _0 _; `" a! D. Iquest (c)完成 1< Quest LINK >    自动完成(GM 批准)任务,可在数据库中找到
$ D6 [7 {% J3 X修复1<项目链接>..    命令 bot 寻找附近的 armourer 并修复选定的 1<Item LINK>..: n. B( L- Z1 B3 n$ ~5 M
全部修复    命令机器人寻找附近的装甲师并修理所有损坏的装备或包中的物品: L7 }- b2 \. i3 q* F
重置    重置状态、命令和战利品清单) O9 _1 k. U" [1 ~$ \$ i3 b+ V! S
(s)ell 1<项目链接>..    命令机器人寻找附近的供应商并出售 1< ItemLINK >..
8 P1 ^2 X& A  ]* ?' a" }: G+ L(s)卖掉所有    所有低级白色物品的一次性销售(命令不会持续)。
% c9 n( \- n1 o0 h. p技能    列出 bot(s) 1< Profession LINK >.. 主要职业和武器技能( f; H- J+ s: ?3 h! S; {+ X
技能 (l) 获得    命令机器人寻找附近的培训师并列出可用的 1< 培训链接 >..
7 g8 ]& J& t- W/ h, E1 o% r技能 (l) 获得 1< 训练链接 >..    命令 bot 寻找附近的教练并学习 1< TrainingLINK >..
" L  T9 v0 f# E: K4 J技能 (u)nlearn 1< 职业链接 >    命令机器人在附近寻找训练师并忘记 1< 职业链接 > 和相关法术! x7 X6 s% \& B+ j6 @' c) Q7 r
咒语    显示机器人已知的所有法术; `9 |# z8 v, ?6 ]/ Y; T' m
统计数据    显示机器人可用资金、可用库存空间和估计的项目维修成本
8 s) X$ o9 P- E' I$ g停留    命令机器人站立而不跟随玩家0 o4 P5 f5 e2 G; S+ R
召唤    玩家附近的传送机器人" a. u: P) c. u$ N( _
民意调查    在机器人周围的局部范围内显示所有可用的 1< Gameobject LINK >..0 J+ v# D2 d  q
使用 1< 项目链接 >..    使用物品(例如食物、饮料等)
9 n* Y2 X4 {0 C使用 1< 项目链接 >TARGET    在目标上使用物品(例如任务物品)$ n! P' ~1 A! n/ k. |/ g8 D
句法    描述% S7 e6 ^- {6 R9 ~+ t
天赋    列出机器人 1< Talent LINK >.. & 1< Glyph LINK >..,未使用的天赋点数和重置所有天赋的费用
# V1 W0 ]9 F. O0 N6 k- G4 Z人才学习1<人才链接>..    为 bot 选项卡或 1< TalentLINK >..â†'talent> 学习选定的天赋3 t, [7 e  t9 @3 M* v0 I+ q" g, K
天赋重置    命令机器人寻找附近的班级教练并重置所有天赋26 c' f; A, x  h. L5 Y, Y1 o8 p1 l
人才规格    列出机器人可以使用的所有天赋规格(编号为 #)。
" Y# j& Y9 W! z( p' C2 N天赋规格#    机器人将遵循此天赋规范。
, n( {) ?- a- W7 s# U; E' q0 q5 R3 B; E- T6 U9 B$ y
1 要选择 , 。) m  I0 g' A' |+ j1 m9 C- r
2 每个机器人的税收增加,每次重置天赋。0 r1 t1 N% Q% m8 b) u/ l3 \

4 ]3 ~: e& t9 }3 s, x0 ?/ a/ _0 P' ^" z, h* a* U6 }# w  \8 P
回复

使用道具 举报

985

主题

92

回帖

5万

积分

管理员

积分
53561
 楼主| 发表于 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)4 B+ @( v& R0 K: T

" [# Z4 _5 R8 ]8 U4 S. T1. Make a folder for ACE in your preferred location ( I use /opt)
0 U& x$ j  A1 O, a. z! e" c  g# D! F$ z, O# t% t# g9 d9 p
mkdir /opt/ace && cd /opt/ace
  b8 J5 L2 p5 N# l: o, Z9 t+ o3 ]' i
2. Download and unpack ACE/ R2 g! S0 `% |( R

/ m% ~/ }. A9 a5 ~7 ]wget http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.7.tar.gz
4 N3 e  j8 }( Y% Rtar -xvf ACE-6.4.7.tar.gz
. N9 \5 A$ S& ?1 J& G
2 B5 J8 K4 u( u3. Add needed environment variables
2 j3 g+ R, {! G1 g6 ~  o4 ^6 D1 H$ m+ {! r% x
cat >> /etc/profile <<EOF
' Q# h9 ^8 p% B  U$ v+ C+ cexport ACE_ROOT=/opt/ace/ACE_wrappers
- \5 ^4 ~$ m, |  i$ K9 [! \EOF/ q& l1 J$ Q- }7 G: }% r) n
source /etc/profile
6 p4 a- X- d: ]0 ^2 S) @3 Z) j6 P

$ g% Y- k- `4 \8 m8 {4 P4. Add the desired headers: s- V* x* o: A) `- p

- v; m3 Q$ u* Scat > /opt/ace/ACE_wrappers/ace/config.h <<EOF/ N0 `; I. @5 M0 a
#include "ace/config-linux.h"
! ]" X& s5 N+ \8 TEOF; z, z3 h: ~4 h# Y  w% ~3 b
cat > /opt/ace/ACE_wrappers/include/makeinclude/platform_macros.GNU <<EOF" _3 {* k& ~- ^' X+ V
INSTALL_PREFIX = /usr/local
7 D2 ?  i' F8 a; F2 zinclude $(ACE_ROOT)/include/makeinclude/platform_linux.GNU) q# `; f- r& Y; o5 L
EOF
8 ~; i! N  F( ~
/ N. H  n, X9 L) u3 J5 b
5. Build ACE
) M# M6 I1 W/ s% z4 ?, m% P, r1 [  V- Y
cd /opt/ace/ACE_wrappers' Z( c3 Y( i4 p. v! J" S6 p
make; I. ^, E( K  `
make install

7 \2 r( ~) `* _8 w3 p/ P6 }
  O/ o) ^4 K# k$ M' F6. Add the library to the public path; O7 g* X: G4 l& G

( @3 o: p+ W7 i7 jcat > /etc/ld.so.conf.d/ace.conf <<EOF
2 `7 J5 |2 _) a; b  G% g& l' P/opt/ace/ACE_wrappers/lib
; E! l1 z1 p$ R  dEOF+ ]$ c5 k. y1 r
ldconfig -v

& w9 m7 j7 j/ ^5 Q% ?+ ?
回复

使用道具 举报

985

主题

92

回帖

5万

积分

管理员

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

使用道具 举报

985

主题

92

回帖

5万

积分

管理员

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

使用道具 举报

985

主题

92

回帖

5万

积分

管理员

积分
53561
 楼主| 发表于 2022-7-30 13:54:45 | 显示全部楼层
Download WoW Wotlk 3.3.5 Client
/ G( o  N2 ?; s5 O7 D0 Z' VTorrent Download
2 I* S5 ~5 D1 v$ N; }: ]: C( c0 K
1 i! a! J  f5 T% r; e- OThese 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
' w1 p* R6 z" {
. l5 S6 C/ Z8 }2 w, s5 ^* @    Torrent – Client from Dalaran WoW (Recommended)& ~2 M8 n, w/ V5 J; F) m2 T2 i
    Torrent– Client from Sunwell (Recommended – Fast torrent download, due to a lot of seeds)4 g3 Z" ~/ ]2 F
    Magnet – Client from TrueWoW
5 ?$ d9 f1 G6 F: g+ k6 F) p5 H6 k( k6 Q2 c# M
Direct Download1 ]+ h4 q& S. k8 ~* l; d

) t: T) U0 N6 ?- g# ABelow, 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.# ~+ P5 m7 k' K# F, @1 a; ]

6 v# y) J7 H' H( c1 ]    Direct – English Windows client3 v3 G% o! c( h: s0 Y4 ?' @! Y
& o3 o% e0 Q: q6 M
3.3.5 Wotlk MacOS Client
1 c* w7 E) ^- ], U9 P& ?0 m9 m
" v1 Y* ]. L' ]! uThe 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.
& \8 n# t% Z0 a$ M0 y" c
; Y: V4 ?; s1 w1 ]    Direct 3.3.5 MacOS Download – Client from Sunwell) N( i/ L7 Q$ ?; k6 _6 X
    Direct – Client from Paragon-Servers (French)(Mac)
' x4 J  d: o( z) N/ |# j! K9 p. s, w. i+ P+ P* I4 i" d# G5 n/ L+ f
Modified Clients, LegionRemaster:2 d+ c5 g" u0 g2 C. u' k9 r8 c
( C" m! w- X$ m6 F  L: V
    3.3.5 LegionRemaster Torrent – From Sunwell and Finsternis, Z; ~% K& i. v0 [
    LegionRemaster Patch (modified)
# k2 q6 U, s* `( f" M' G4 ^' e    LegionRemaster ReadMe (Custom) 6 |' q) y' s9 k9 z* b* [
https://zremax.com/blog/wotlk-3- ... e-lich-king-client/
回复

使用道具 举报

985

主题

92

回帖

5万

积分

管理员

积分
53561
 楼主| 发表于 2022-7-31 00:24:58 | 显示全部楼层
开源的魔兽世界 Mangos& z* ~; W2 `: A! S8 [* j) v8 O# z
: {" M- X7 O/ ~% W6 u6 Q
在sourceforge上开发的 (Ma ssive N etwork G ame O bject S erver) 项目是基于GPL协议的。据说是和魔兽世界独立无关的网络游戏服务器引擎程序。游戏的内容部分(数据库内容)又是由独立的小组开发的,这样也许避免了很多 法律上的问题。但是大多数魔兽世界的盈利的私服都是基于这个开源的项目的,为此开发小组表示这样盈利性质的服务器和对他们项目的使用是违背协议和非法的。2 i5 q& H9 r' T$ Y
/ h- P! J9 `- t' A5 s  ~5 J0 ?
本文 是对mangos作了一个粗略的介绍,并且使用了魔兽世界的客户端对mangos作了一些测试。
, x# H+ d1 S$ ~% w  \
# I/ Z7 o& v/ E4 q  c) N正文如下:
0 f9 A" \" ?9 l2 J$ e& R
" z2 V; Q( c) e/ Z开源社区常常有很多出人意表的项目,让人往往击节叹赏。例如当年在普通PC电脑上虚拟运行苹果机系统的 。把微软游戏机xbox改装成家庭影音中心的 ,以及在ipod上安装linux的 等项目。在电脑游戏方面当然也有很多出色的开源项目。) `" N+ i/ j9 Q, h% ?! z

4 Q5 q! D5 B1 e; u暴雪公司的游戏历来都是精品。网络游戏大热以后,它推出的基于10年游戏历史的网游:《魔兽世界》也更是名声在外(当然有好有坏,坏名声在于它太吸引 人以致 于很多人沉湎其中)。网络游戏的盈利模式和传统电脑游戏不同,月费和其他的周边产品使得其赢利空间远远大于传统电脑游戏。对于网游运营商来说很大的一个问 题是私服的问题。很多私服的软件是从网游开发公司或者运营公司内部非法的流出来的,比如说网游《仙境传说》的私服。  e: A" _9 ]1 W" S7 T' V; e8 N* g
: y8 p6 v( B6 R2 f( q6 W
而现在大多数魔兽世界 的“私服”实际上是服务端软件的模拟器。是在对客户端游戏软件和与服务端的进行通信的数据进行分析解密以后,开发出来的模拟原游戏服务器功能的软件,这样 的模拟器软件大都也是开源软件。比如像现在大部分魔兽私服使用的Mangos服务端软件,mangos项目是一个开源的自由软件(如同linux或者 firefox),并且遵守其中最为严格的GPL协议。
1 ~  [7 Q; o7 p9 I  \* g0 O9 U* B! C0 o  r, [. i, X
  MaNGOS 是(Ma ssive N etwork G ame O bject S erver) 的缩写。由于暴雪公司对类似的开发小组采取过一些法律行动。为了避免麻烦,如同它的名字,mangos强调自己并非一个魔兽服务器模拟器,而是一个开源的 多人在线游戏服务器的软件。说到底是个网游的游戏引擎。Mangos开发小组强调其软件是用c++和C#编程语言,实现 的一个支持大型多人在线角色扮演游戏服务器的程序框架,在这个框架下,它理论上应该支持任何客户端的网络游戏,由于现在很多人使用魔兽世界来对它进行测 试,所以针对魔兽世界的脚本和数据库文件比较完善,很多人就利用这个开源项目来实现魔兽私服。而游戏的内容,例如故事情节,任务场景的脚本等都是由别的小 组独立开发的。
$ a+ s* p  Y: n5 M+ k
4 w% R, R1 r4 K$ ]+ Q) T开发小组一再强调,这是个研究,教育性质的对怎样开发大型网游的服务器端有好处的项目,是一个技术细节毫无保留向公众开放的软件,是一件很有 意义的事情,如果你使用它作为盈利目的,那你本身就违反了软件的协议。所以任何利用mangos项目进行私服活动的组织和个人都违反了mangos的宗 旨,mangos项目也不会对它们负责。2 Z6 z% e3 Q% v0 q% B
# E/ L* l) G/ N: n- p; t
mangos的技术细节上是这样的,核心部分是个和特定游戏没有关系的核心框架程序,主要是进行进程调度,创造世界,建立心跳机制,处理网络接入 等。数据库可以使用的开源数据库软件MySQL。至于游戏内容数据库,游戏人物,时间,世界脚本,都是由这个核心程序所支持的扩展 脚本来实现,所以有一些独立出来的项目专门模拟魔兽世界来开发支持mangos的核心程序。现在mangos的核心程序已经放到著名的协同开发网站 sourceforge上开发了,使用的开发工具是subversion。大家都可以从sourceforge的subversion数据库中下载最新的 源代码程序。: i( R: g- o% M2 M9 R. }
  o# d1 B0 O' `
3 W8 C6 t1 D' P! q+ \
为了测试这个Mangos我自己安装了一个测试了以下,自己对魔兽世界的游戏本身没有太多的了解,请了几个玩过魔兽世界的朋友测试了一下,都说各方面 已经很 完美了。最新的Mangos项目已经支持了魔兽世界的扩展版“燃烧的远征”,简称TBC,对应的魔兽客户端版本到了2.0以上。以下的安装测试步骤适用于 魔兽世界客户端1.12.x的版本。* c. }+ e$ t) b5 _* t
- c, _# N8 ~9 v
一、安装需求:
  • 操作系统Windows Xp,解压软件推荐 。(mangos论坛上有人在linux,macosx上安装,为了提取地图方便这里使用windows XP)
  • 魔兽世界的客户端软件,升级到1.12.1版本以上。
  • 编译好的Mangos二进制文件。(你也可以自己编译,我这里提供的是Mangos Rev 3462,3462是开发数据库的版本号),下载地址:
    : S& T; ~# i# F/ Z: Y
  • 地图提取工具ad.exe(这个地图提取工具是专门针对1.12.x版本的客户端的,TBC需要比较新的ad.exe,TBC的地图提取工具不适用老版本的地图),下载地址:
  • mpq文件包提取工具MPQE_1.2.rar,暴雪公司的游戏都采用一种叫mpq的文件格式,是M ike O'Pack 的缩写,这个Mike就是暴雪公司的首席游戏程序开发人员,和创始者。我们需要使用mpqe.exe从客户端里提取相关文件。下载地址:
    * X  l. p+ v! H- I, N$ Y
    Brien
  • 开源数据库软件MySql# H* m3 R+ q3 |1 O( h0 |2 r9 c" o" \
    官网:MySQL
    0 Z( _  }& T% [) ~9 ]. w0 N
    或者用我下载的版本:
  • MySQL的客户端软件SQLyog,编译管理操作数据库
    5 p4 ]/ G+ U+ b$ \3 S5 @官网:
    # L  u4 h* B- g) S: g& \
    我下载的版本5.30:
  • 游戏内容数据库,配合Mangos Rev 3462的版本。- G, t+ c" o# N  ~( ]
    文件名:CompleteSDB156-Mangos3462.rar
    + {0 W) V0 @- x' Q9 n0 u$ D7 N! U下载地址:
    " X2 _/ s: Q9 g, @
    3 E% `4 f9 {/ Y2 F
二、安装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"1 X7 v3 E# C7 k% o* F# x% q
    ( O6 C; G, m3 F! {6 A% X! E
点击连接,这样客户端就连接到你的MySQL数据库服务器上了。在左边一栏右键点击“root@localhost”,选择建立数据库"Create Database"。当提示输入数据库名称的时候输入:"mangos"。重复第9,10步建立数据库"realmd"。 三、安装Mangos服务器,配置路径
/ A' Z& }$ g6 `# B  w& N* x- Z
  • 建立一个目录,例如:"C:\MaNGOS"
  • 把你下载的mangos的二进制文件解压到这个目录里面。
  • 检查你的两个重要的服务器配置文件:“ mangosd .conf”和“realmd.conf”。其中“mangosd .conf”里面可以配置物品,金钱的掉落率,经验值的增长率等等。
    , Q; x, p7 G6 m/ \' Q
四、解压安装地图文件/ J4 i; I. x9 N# l2 D5 f! @& F, p
  • 把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子目录了。8 X* ~2 O1 R9 r+ p# E$ X9 u% S  }
五、解压安装提取的*.dbc文件
; `; t8 e3 F6 L  P4 e( ~
  • 在你的mangos的安装目录下建立dbc子目录,结构为:("C:\MaNGOS\dbc")
  • 为了将暴雪公司的mpq文件的内容解压出来,将提取工具mpqe.exe拷贝在魔兽世界安装目录的data目录下,结构为:("C:\World of Warcraft\data")
  • 打开dos窗口,进入魔兽世界的data目录(cd "C:\World of Warcraft\data")。
  • 执行以下命令:
    6 J9 t$ |- I' e* s" s7 Lmpqe /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")了。$ c3 }* A. G5 S; O
七、下载安装数据库内容,前文说过,mangos只是游戏引擎,游戏的内容,建立的数据库由独立小组开发,我们这里使用著名的Silver's Database Site的库。版本号为SDB156.4 g& ^# b7 o9 l; N
  • 将下载的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”,导入数据库文件。
    9 ?0 N4 L6 Y+ S
八、配置数据库,配置文件,运行开源魔兽服务器!本文只为测试游戏,在局域网中玩。
) q* ]' {' h+ C( c/ s0 j$ f
  • 使用SQLyog连接到你的数据库。
  • 找到realmd,展开找到"realmlist"选项。
  • 在右下找到"Table Data"。
  • 在name一项填入你的服务器名字,例如叫faif
  • 在地址address一项可以使用"localhost" 或者你的IP地址。
  • 在realmd数据库下找到account表,点击"Table Data",建立你的游戏帐号,里面已经由几个内置的帐号,你可以参照gm,普通玩家的 帐号建立 你的用户名,密码。
  • 在mangos目录下打开realmd.conf 文件,找到
    ; B/ H" O" m) O- R"LoginDatabaseInfo ="
    5 b" u( u; c. E% B; B4 f改为:"LoginDatabaseInfo = "127.0.0.1;3306;root;[password ];realmd"4 {. f; E3 o1 q/ A
    这里的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"9 P- _( V* @/ J  w; K! N7 X
    8 J+ m6 h, B' ^, o/ E8 f" j( X
同样,这里的IP地址可以是你的IP,[password ]是你的密码。存盘。到这里基本就大功告成了。先运行realmd.exe文件,稍等,运行mangosd .exe,魔兽服务器就已经运行了。连接到你的魔兽服务器,修改你的魔兽世界客户端的realmlist.wtf 的文件,将127.0.0.1 ,或者你的IP地址填在里面,例如:"set realmlist 127.0.0.1"   到此为止,开源的魔兽服务器就架设成功了,我给朋友建立了几个gm帐号,他们测试了一下,觉得这个版本的做的很不错了,开源的宗旨是知识的分享,开源 社区黑客们的探索精神页不得不让人佩服。

, S2 F1 {3 U+ N* Q! q1 D, A3 `' E5 I0 t! m2 F
, _& w7 @2 D' e) P4 C) m
5.安装数据库
9 F5 b- S* t# C2 H- Y' H$ X% A9 e使用mysql建立 mangos 数据库
2 b8 r& j2 z' I! v& `
/ f( x2 m6 _( g% _  ]a1)使用官方最小数据库,mysql用户名及数据权限等请自行设置; \: ]# @2 r" i9 N' @9 B6 A
mysql -u root -p mangos< /usr/local/mangos/share/mangos/sql/mangos.sql 导入数据
4 c& N" ~( j, }1 e5 U9 x
+ G- t: q7 |7 d, Na2)使用sdb数据库,mysql用户名及数据权限等请自行设置
. v$ `% o( ]) A2 G  R; t2 V5 L假设sdb数据库文件为 /home/wow/SDB/trunk/SDB_r1178.sql
; M+ [9 S7 A: ]- ]3 Q$ k& Amysql -u root -p mangos< /home/wow/SDB/trunk/SDB_r1178.sql 导入数据
& ^$ z: H1 v2 Q; f* ^( ^* ?; p& `1 Y& S' |5 ~* h  U
b)编辑 mangos 数据库的 realmlist 表,修改 address 为你运行mangos服务器的IP地址,这里设为192.168.1.1$ O$ |5 @2 J  i0 W2 }& t& y

2 v) m" ^5 \+ h' D" a. |3 t) N6.编辑配置文件
# Y( O+ a& a7 R( ~7 ?' L' N编辑 /usr/local/mangos/etc/mangosd.conf
7 S; {* f4 r) h6 G; {- f' h% O: ~3 f! ]6 v  ?* M4 @2 S
a)找到 DatabaseInfo = \"127.0.0.1;mangos;mangos;mangos\"3 W8 S' M. h3 F/ a6 S8 q
为你自己的配置,格式为 DatabaseInfo = \"mysql服务器ip:mysql用户名:密码:mangos数据库名\"- s( b# A; b0 ?4 E% T- D0 Y
" d1 U6 L- h2 ?# u4 p) Z
b)找到 Host = localhost
) _" e/ o9 W) }" d$ F1 m9 P" b# z* c为你自己的配置 Host = 你的IP或域名,这里设为192.168.1.1
, t) ~) z9 f* F8 n5 c  g3 G- D4 h  c: K( P: l- J
回复

使用道具 举报

985

主题

92

回帖

5万

积分

管理员

积分
53561
 楼主| 发表于 2022-7-31 00:42:45 | 显示全部楼层
您好,在本教程中,我将逐步说明在 CentOS 7 Linux 系统上配置、安装和运行Mangos的方法。要完全执行安装,您需要一份要运行的游戏客户端版本的原始副本。
6 n. g  U" ^6 s: m1 w' `1 F$ M* D+ h0 X, S. q# ]) x* Y
本指南已在安装最少的空 CentOS 7 系统上进行了全面测试。
/ N$ _# v" X$ {% X& H( y# l* k0 a( `0 o
我们走吧..! r1 o( g( h+ a. X1 i

2 B- \" ?# D  {$ O  m设置数据库:
+ D8 W/ P4 H. o7 @( [" `0 r8 a# Y6 G. C, g+ ]
CentOS 默认支持 MariaDB 而不是 MySQL。本指南的这一部分将帮助您设置 MariaDB 实例。4 x" O  X9 w# J; D6 z

: _4 k" m' ~$ _启动一个终端,如果还没有,您需要成为“root”用户:. w' ^4 ~, v: b1 t! l( p9 U8 l. X
1 t; b" i5 ^+ u# F1 t9 C
须藤苏 - 根5 V* V/ ~" U7 D/ \
然后,安装 MariaDB:
- _( F9 g* o" Q. c9 k
+ n* Y* `( F$ _) g  N1 y  p$ S9 T2 F0 i9 kyum -y 安装 mariadb-server: U3 z+ J) L+ s8 F  i
     安装 MariaDB 后,启动它:
; p: e$ x% g; V4 r- p8 V& M3 A0 O9 w& b( f! }
systemctl 启动 mariadb" t7 R1 w( D+ z
我建议您在启动时添加 mariadb 服务以自动执行它:4 t" Q7 @2 j. w: ]+ p

3 |" B+ m2 a+ E' S# x! \: Zsystemctl 启用 mariadb/ W" _! w% e. R$ u2 K
让我们保护您的 mariadb 安装,执行以下命令:! |" Z0 Q3 o3 E

  ?; q4 H  @2 g, l0 O* [0 Rmysql_secure_installation* Z: b; Y' X$ `  H, g- v
我建议您设置以下参数:9 X2 b0 @( V0 R* ]
! @. K/ H/ \8 M, ?* s1 E- H$ l/ P
设置 Root 密码5 c: d  U! E/ B  @& ^
删除匿名访问
4 |$ \- r- E7 U3 ~1 z* R3 `7 |禁用 root 用户的远程访问; T! y7 r+ e3 g; g. c/ v
删除测试数据库+ a9 J/ l4 Y2 |' ~
重新加载权限
( I/ f. R; R$ v* J. ~验证您的数据库配置是否正常工作,您需要提供刚刚定义的 root 密码:
/ {' G& f4 p! J* C2 @8 U' A+ O( L" `6 G
mysqladmin -u root -p 版本& ?' M8 ?) k7 ]7 r8 o
如果一切正常,您应该有如下输出:9 X' O/ ?' N9 ?: F- e7 E" N5 Q

; V/ n( p$ G8 @服务器版本 5.5.52-MariaDB( Y+ y, x. j1 B# [
协议版本 10
0 f7 C) o& F. h通过 UNIX 套接字连接本地主机
) t$ N4 g& t! d/ [% u7 p) ?4 i# mUNIX 套接字 /var/lib/mysql/mysql.sock5 Q' |* i8 f& |) K1 I9 u9 t
正常运行时间 x 秒2 p; b& H; l! k% C
0 L% Q6 T8 o; k' r  i1 X  ~3 F
& J. S/ i' x/ a/ q8 e% Y0 y
现在数据库的设置已经完成,我们需要添加芒果数据库配置的先决条件。我们需要首先为mangos创建一个用户,使用以下命令登录数据库:
9 x) f9 K6 c% Q4 K3 l; }; V0 m8 O) a! n* c) O/ U( ^
mysql -u 根目录 -p
; a9 H2 f) b" Y4 V: e2 [创建您想要的用户,给出的示例是创建一个用户“ mangos ”,该用户可以从“localhost”连接并在末尾输入密码“password”(不要忘记“;”):
% u) V  }1 k( K4 j; ?
/ u9 |5 c* m  \) B/ m# c创建用户“芒果” @ “本地主机”由“密码”识别;
- t* `7 h7 j" j: m4 j% A然后,我们需要向该用户授予权限,以便我们以后可以使用它来设置Mangos模式(同样,不要忘记“;”符号):
" e9 l9 `: `5 x/ c4 o% ?1 V, P$ W: F# D4 N; q( Z( t- B5 x: i* p
将*.* 上的所有特权授予“芒果” @ “本地主机” ;, Z9 i" J) Y  N% N, y4 D7 Q
退出终端:) Y6 R0 [, B1 ~3 n* h6 e- B
+ C4 b5 W! W2 w/ W
退出
( p9 ?" }5 l  l6 L恭喜,您已经在 CentOS 上设置了数据库的先决条件!# v# s/ p% T, x9 e

* a6 o' o0 j. Q- D $ }1 J& u) y! i# g- j

8 g( g0 ?2 m/ a: V! m安装芒果:, L9 Z' k# n# H- W0 C# i* r
1 m$ L; d5 W* L' w6 w  S1 q9 U
我们现在处于有趣的部分,我们如何在 CentOS 上安装Mangos ?好吧,假设您以“root”身份登录,请转到主目录:, f/ K# |4 I) [7 i6 `: g

! @7 U/ l3 Q4 X光盘~
1 n8 d4 L# a, H) X% a; I& h让我们先安装所需的依赖项,wget 是一个小实用程序,可让您下载安装程序脚本:$ _- s* b/ e% n

. }+ l0 S( a* z' E8 Q7 U. dyum -y 安装 wget- P( _) [  \, X
现在,我们可以下载我们的安装程序:4 ?  _. F4 ?! A4 ~8 l# L
2 i! S8 F) p! W4 i5 V2 p
wget https://raw.githubusercontent.co ... /linux/getmangos.sh
+ e% G& @' @- Y0 D7 L  Z# t' V' M1 P设置允许执行它的权限:  f2 Y+ i6 C1 Y; M, q, m7 T

* z: Z; c6 p! t- @chmod 700 getmangos.sh
2 H4 b& D$ ?, }) D$ g- y并执行它:8 d6 A1 o: c4 I; K; X5 i

( p  h8 ^. K" ^4 ~& U& [1 \./getmangos.sh6 Z" q8 ^5 Y2 ^* d/ g
在我们进一步讨论之前,对可用活动进行一些解释:
6 C! H" `) ~0 c: G' S6 w2 b5 u; K4 [/ c/ R
安装先决条件将为您安装所有必要的依赖项以构建和运行mangos。默认切换。
5 _4 a% b  u( |$ I. I8 g+ C设置下载和安装路径将允许您指定必须下载源的位置以及必须安装二进制文件的位置。默认切换。
2 n6 p4 @7 i7 k$ m克隆源存储库将帮助您克隆Mangos源。默认切换。
' C" b6 P2 ?* k* q, D$ N0 @Build MaNGOS将协助您完成MaNGOS的构建过程。默认切换。' o5 v' h. g" ^" i
安装MaNGOS将帮助您安装MaNGOS。默认切换。4 M% I* w- E4 V" p) x
安装数据库将帮助您创建数据库模式。默认切换。
) j0 b# j4 A/ K* P8 f3 e6 h提取资源将帮助您从游戏客户端中提取 DBC、地图、mmap 和 vmap。默认切换。5 f8 z" Q  n0 r/ {$ D% T# `
创建 Code::Blocks 项目文件将为 Code::Blocks 编辑器创建一个项目。如果您不打算编辑MaNGOS源,请不要切换此选项。3 N2 I+ e/ J- ?
现在您已经了解了所有内容,请选择默认选项并通过 Tab 键选择“确定”。该脚本现在正在您的 CentOS 上安装必要的依赖项。系统将提示您同意安装构建依赖项。选择“是”两次。
; l- m/ ?% F& h% c5 O# S+ \
  o2 l" z4 ^" C用户选择:) `0 K2 ]2 G/ A# m4 K, o5 N
4 x, F6 C: I/ s- s
Mangos为您提供了在“root”用户以外的其他用户下运行它的机会。这是一种很好的做法,可以隔离软件并在漏洞被利用的情况下限制安全影响。默认建议的运行用户是“ mangos ”,但您可以根据需要进行更改。选择“确定”继续。8 X# c$ d' O) _. M

/ Y1 D! e( q) {* t, d8 O5 N4 Y7 F如果您已经执行了此步骤,安装程序将询问您是否要保留该用户。我建议您回答“是”,除非您知道自己在做什么。
+ m0 D" ^: t/ I0 E8 w  ~; Z
" V2 q, }% Z' q1 P6 L" r选择魔兽版本:$ J+ H7 h- ?- Z

8 I4 T6 @+ g' d4 r$ ]( T, [0 A下一个屏幕要求您选择您愿意安装的 WoW 版本。选择符合您愿望的那个,然后选择“确定”。
7 i8 V- E- B3 |. T) J9 z
9 I0 y7 z0 A6 K/ P3 x源代码路径:6 U- a" b- s& G" A

) P0 E, Z4 j0 p6 }8 O8 l下一个屏幕要求您提供源路径。默认情况下,建议的格式是 /home/<run user>/<wow version>/src。例如,对于运行用户“ mangos ”和 wow 版本“Vanilla”,建议的路径将是:7 `2 D- g: c$ G: s  ^
" y, _3 B; A, |3 [8 u
/home/芒果/zero/src# e( O2 a' H: Z
如果目录不存在,请回复“是”以创建目录。如果它确实存在并且包含源,安装程序将询问您是否要删除该内容。' S8 Z: r9 ?, m

5 N* R0 X- I: m安装路径:
$ ~2 \2 s" ^& ^; ?; \5 O0 F" G5 i0 a( _. P* @
下一个屏幕要求您提供安装路径。这是您将执行Mangos流程的位置。默认情况下,建议的格式是 /home/<run user>/<wow version>。例如,对于运行用户“ mangos ”和 wow 版本“Vanilla”,建议的路径将是:4 W) o! ?+ l2 D, N- T1 N  _0 }
! ]; g% h3 H# j/ r3 z( \: ?
/home/芒果/零
$ z7 v% }2 B  ^9 z, Q$ u如果它确实存在并且包含已编译的源,安装程序将询问您是否要删除该内容。' d& L- d& |, y1 M( P& g
. i3 Q1 h+ ]( }0 I% Q
克隆或更新MaNGOS:
# n1 `8 _/ \& i. ^/ P4 G/ Y: T6 j. V4 L% F: t
脚本的下一步是询问您是否要克隆、更新或使用MaNGOS源的现有副本。对于全新安装,请选择选项“0 克隆MaNGOS的全新副本”。安装程序现在将连接到 Github 并检查可用的开发分支,目前,最后一个稳定版本是 Rel21,并托管在“主”分支中。
# P8 O3 _) A* @2 \+ |+ c: z; H; |' u/ K- u0 [( c& `/ j" x
安装程序现在正在克隆服务器和数据库存储库。
7 j5 o! U+ d3 D2 U8 @' W* x+ w( W. T# y5 P2 r
构建选项:
5 k+ w6 v: N& a( h: I& @
! r' S* L& N/ U4 h# H3 l! g您现在处于构建步骤。此屏幕上的一些解释:8 [4 M; X- s% y+ P" O" X, _

+ h' ^, }" F$ Z* s) K5 ]Enable Debug 将在Mangos 上设置调试标志和更多跟踪。仅当您被要求修复错误时才使用此构建选项。在调试模式下构建软件会显着降低其性能。
2 [) U8 j0 A* M3 G' b- K使用标准 Malloc,切换此选项以使用标准内存分配。仅当您知道自己在做什么时才取消切换此选项。
3 l5 I3 O: O8 U$ W8 z使用外部 ACE 库。允许您使用来自系统的 ACE 库。此选项在极少数情况下有效,并且将来会被删除,所以不要切换它(无论如何, MaNGOS有一个“内部”ACE)。
% ]. R% |; G! i) m! ]使用 PostgreSQL 代替 MySQL/MariaDB。允许您使用默认数据库提供程序以外的其他数据库提供程序。此选项尚未经过测试,如果您到目前为止已经按照教程进行操作,那么您应该已经设置了 MariaDB
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|

GMT+8, 2025-11-5 05:41 AM , Processed in 0.138121 second(s), 26 queries .

Powered by xyh-moon X3.5

© 2001-2025 Discuz! Team.

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