魔兽世界60级1.12私服搭建架设教程
一、背景
60 魔兽经典旧世是最经典的版本,遗憾的是 60 年代时还在大学读书,穷得很,买不起点卡,后来工作了,大概 70 年代开始玩的。
多年以前,玩游戏时,一直非常期望能够自己控制角色的属性级别,得到各种装备。
多年以后,在这款纯粹的开源服务器问世后,终于如愿以偿。
直到如今,都 2020 年,魔兽世界游戏的服务端源码项目在开源界依然非常活跃。
让我们重温经典吧。
二、demo
客户端下载wow-1.12.3版本,只需要修改一处配置文件 realmlist.wtf
SET realmlist wow.whyalive.org
指向上面的服务器地址即可。
测试帐号: test1/123 wow/123
如果你懒得 DIY 自行编译安装,可以用上面给的 demo 账号和环境,下载客户端,修改配置文件,就可以登录游戏了。
三、服务器端
下面的编译安装过程比较多,但我已经尽可能完整的整理出来。基本上没有疏漏。
1、编译服务端有版本要求
2、升级 cmake
mkdir -p /usr/local/src/wow/
cd /usr/local/src/wow/
wget --no-check-certificate \
https://cmake.org/files/v3.5/cmake-3.5.2.tar.gz
tar -zxvf cmake-3.5.2.tar.gz
cd cmake-3.5.2
./configure --prefix=/usr/local/cmake-3.5.2
make -j16
make install
3、升级 GCC
yum -y install glibc-devel.i686
tar -jxvf gcc-4.8.2.tar.bz2
cd gcc-4.8.2
./contrib/download_prerequisites
mkdir build
cd build
../configure --prefix=/usr/local/gcc-4.8.2
make -j16
make install
4、安装 boost
在 centos6.5 上用 yum 安装的 boost 版本太低,必须重新编译安装。
最好直接安装在默认路径。
wget http://netcologne.dl.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.bz2
tar -jxvf boost_1_60_0.tar.bz2
cd boost_1_60_0
./bootstrap.sh
./b2
./b2 install
5、编译安装
先拿到源码, 然后开始编译并安装 (必须要指定环境变量 LD_LIBRARY_PATH 为新版本 g++ 的库):
cd /usr/local/src/wow/
git clone https://github.com/geektcp/elf-wow.git
export LD_LIBRARY_PATH=/usr/local/gcc-4.9.3/lib64/
export BASE_DIR=/usr/local/wow_mangos_bot_2017.10.2
mkdir -p /usr/local/src/wow/ClassicWOW/build/ &&
rm -rf /usr/local/src/wow/ClassicWOW/build/* &&
cd /usr/local/src/wow/ClassicWOW/build &&
/usr/local/cmake-3.5.2/bin/cmake ../ \
-DCMAKE_INSTALL_PREFIX=$BASE_DIR \
-DCONF_DIR=$BASE_DIR/etc \
-DPCH=1 \
-DDEBUG=0 \
-DCMAKE_C_COMPILER=/usr/local/gcc-4.9.3/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/local/gcc-4.9.3/bin/g++ &&
time make -j16 &&
make install &&
chown -R wow.wow -R $BASE_DIR
6、地图文件生成
map 文件包括 maps,mmaps,vmaps,dbc 四个部分。,每个文件夹下面有大量地图文件。
这些地图文件是从哪里来的呢?
是从客户端的安装文件里面的抽取出来的。
抽取方式,先从服务器端的源码里面找到如下目录:
ls /usr/local/src/wow/mangos-classic/contrib/extractor_binary
ad.exe
ExtractResources.sh
MoveMapGen.exe
MoveMapGen.sh
offmesh.txt
README.txt
vmap_assembler.exe
vmapExtractor.exe
将上米娜的 exe 文件都拷贝 windows 环境的 wow 客户端下,跟 wow.exe 同一级目录
然后依次直接按如下步骤运行:
1、生成 dbc 和 maps 文件
ad.exe
2、创建 vmaps 空文件夹并生成文件
md vmaps
vmap_assembler.exe Buildings vmaps
3、创建 mmpas 文件夹并生成文件,这一步可能要很久,一两个小时。
md mmaps
MoveMapGen.exe
最后,如过不想一步一步完成,可以使用批处理 (写入到 generateMap.bat 文件中):
ad.exe
md vmaps
vmap_assembler.exe Buildings vmaps
md mmaps
MoveMapGen.exe
7、数据库初始化
wow mangos classic 经典版本的数据库数据来源于:
/usr/local/src/wow/mangos-classic/sql
另一部分存在于源码目录下:
git clone git://github.com/cmangos/classic-db.git
创建数据库账号:
grant all on *.* to mangos@'%' IDENTIFIED by 'mangos';
创建 wow 数据库:
CREATE DATABASE `mangos` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE `characters` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE DATABASE `realmd` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
然后进入源码目录下的 sql 目录:
导入对应的 sql 到对应的数据库:
git clone
ls cmangos/mangos-classic/tree/master/sql/base
characters.sql mangos.sql realmd.sql
8、配置文件
mangosd.conf 的关键配置项如下:
# 监听端口
WorldServerPort = 8085
# 监听网卡IP
BindIP = "0.0.0.0"
# 是否启用控制台
Console.Enable = 0
# 日志级别
LogLevel = 1
另外还有数据库连接方式的参数:
LoginDatabaseInfo = "10.10.10.10;3310;mangos;mangos;realmd"
WorldDatabaseInfo = "10.10.10.10;3310;mangos;mangos;mangos"
CharacterDatabaseInfo = "10.10.10.10;3310;mangos;mangos;characters"
标准可用的配置文件如下:
cat /usr/local/wow_mangos/etc/mangosd.conf |grep -v ^# |grep -v ^$
[MangosdConf]
ConfVersion=2015090801
RealmID = 1
DataDir = "/usr/local/wow_mangos/data/"
LogsDir = "/usr/local/wow_mangos/logs/"
LoginDatabaseInfo = "10.10.10.10;3310;mangos;mangos;realmd"
WorldDatabaseInfo = "10.10.10.10;3310;mangos;mangos;mangos"
CharacterDatabaseInfo = "10.10.10.10;3310;mangos;mangos;characters"
LoginDatabaseConnections = 1
WorldDatabaseConnections = 1
CharacterDatabaseConnections = 1
MaxPingTime = 30
WorldServerPort = 8085
BindIP = "0.0.0.0"
SD2ErrorLogFile = "SD2Errors.log"
UseProcessors = 0
ProcessPriority = 1
Compression = 1
PlayerLimit = 100
SaveRespawnTimeImmediately = 1
MaxOverspeedPings = 2
GridUnload = 1
LoadAllGridsOnMaps = ""
GridCleanUpDelay = 300000
MapUpdateInterval = 100
ChangeWeatherInterval = 600000
PlayerSave.Interval = 900000
PlayerSave.Stats.MinLevel = 0
PlayerSave.Stats.SaveOnlyOnLogout = 1
vmap.enableLOS = 1
vmap.enableHeight = 1
vmap.ignoreSpellIds = "7720"
vmap.enableIndoorCheck = 1
DetectPosCollision = 1
TargetPosRecalculateRange = 1.5
mmap.enabled = 1
mmap.ignoreMapIds = ""
UpdateUptimeInterval = 10
MaxCoreStuckTime = 0
AddonChannel = 1
CleanCharacterDB = 1
LogSQL = 1
PidFile = ""
LogLevel = 1
LogTime = 0
LogFile = "Server.log"
LogTimestamp = 0
LogFileLevel = 0
LogFilter_TransportMoves = 1
LogFilter_CreatureMoves = 1
LogFilter_VisibilityChanges = 1
LogFilter_Weather = 1
LogFilter_DbStrictedCheck = 1
LogFilter_Pathfinding = 1
LogFilter_MapsLoading = 1
LogFilter_EventAiDev = 1
LogFilter_PeriodicAffects = 0
LogFilter_PlayerMoves = 1
LogFilter_SQLText = 1
LogFilter_AIAndMovegens = 0
LogFilter_PlayerStats = 0
LogFilter_Damage = 0
LogFilter_Combat = 0
LogFilter_SpellCast = 0
WorldLogFile = ""
WorldLogTimestamp = 0
DBErrorLogFile = "DBErrors.log"
EventAIErrorLogFile = "EventAIErrors.log"
CharLogFile = "Char.log"
CharLogTimestamp = 0
CharLogDump = 0
GmLogFile = ""
GmLogTimestamp = 0
GmLogPerAccount = 0
RaLogFile = ""
LogColors = ""
GameType = 1
RealmZone = 1
DBC.Locale = 255
DeclinedNames = 0
StrictPlayerNames = 0
StrictCharterNames = 0
StrictPetNames = 0
MinPlayerName = 2
MinCharterName = 2
MinPetName = 2
CharactersCreatingDisabled = 0
CharactersPerAccount = 50
CharactersPerRealm = 10
SkipCinematics = 0
MaxPlayerLevel = 60
StartPlayerLevel = 1
StartPlayerMoney = 0
MaxHonorPoints = 75000
StartHonorPoints = 0
MinHonorKills = 15
MaintenanceDay = 3
InstantLogout = 1
AllFlightPaths = 0
AlwaysMaxSkillForLevel = 0
ActivateWeather = 1
CastUnstuck = 1
MaxSpellCastsInChain = 20
RabbitDay = 0
Instance.IgnoreLevel = 0
Instance.IgnoreRaid = 0
Instance.ResetTimeHour = 4
Instance.UnloadDelay = 1800000
Quests.LowLevelHideDiff = 4
Quests.HighLevelHideDiff = 7
Quests.IgnoreRaid = 0
Guild.EventLogRecordsCount = 100
TimerBar.Fatigue.GMLevel = 4
TimerBar.Fatigue.Max = 60
TimerBar.Breath.GMLevel = 4
TimerBar.Breath.Max = 60
TimerBar.Fire.GMLevel = 4
TimerBar.Fire.Max = 1
MaxPrimaryTradeSkill = 2
TradeSkill.GMIgnore.MaxPrimarySkillsCount = 4
TradeSkill.GMIgnore.Level = 4
TradeSkill.GMIgnore.Skill = 4
MinPetitionSigns = 9
MaxGroupXPDistance = 74
MailDeliveryDelay = 3600
MassMailer.SendPerTick = 10
PetUnsummonAtMount = 0
Event.Announce = 0
BeepAtStart = 1
ShowProgressBars = 0
WaitAtStartupError = 0
Motd = "Welcome to the Continued Massive Network Game Object Server."
PlayerCommands = 1
AllowTwoSide.Accounts = 0
AllowTwoSide.Interaction.Chat = 0
AllowTwoSide.Interaction.Channel = 0
AllowTwoSide.Interaction.Group = 0
AllowTwoSide.Interaction.Guild = 0
AllowTwoSide.Interaction.Trade = 0
AllowTwoSide.Interaction.Auction = 0
AllowTwoSide.Interaction.Mail = 0
AllowTwoSide.WhoList = 0
AllowTwoSide.AddFriend = 0
TalentsInspecting = 1
ThreatRadius = 100
Rate.Creature.Aggro = 1
CreatureRespawnAggroDelay = 5000
CreatureFamilyFleeAssistanceRadius = 30
CreatureFamilyAssistanceRadius = 10
CreatureFamilyAssistanceDelay = 1500
CreatureFamilyFleeDelay = 7000
WorldBossLevelDiff = 3
Corpse.EmptyLootShow = 1
Corpse.Decay.NORMAL = 300
Corpse.Decay.RARE = 900
Corpse.Decay.ELITE = 600
Corpse.Decay.RAREELITE = 1200
Corpse.Decay.WORLDBOSS = 3600
Rate.Corpse.Decay.Looted = 0.0
Rate.Creature.Normal.Damage = 1
Rate.Creature.Elite.Elite.Damage = 1
Rate.Creature.Elite.RAREELITE.Damage = 1
Rate.Creature.Elite.WORLDBOSS.Damage = 1
Rate.Creature.Elite.RARE.Damage = 1
Rate.Creature.Normal.SpellDamage = 1
Rate.Creature.Elite.Elite.SpellDamage = 1
Rate.Creature.Elite.RAREELITE.SpellDamage = 1
Rate.Creature.Elite.WORLDBOSS.SpellDamage = 1
Rate.Creature.Elite.RARE.SpellDamage = 1
Rate.Creature.Normal.HP = 1
Rate.Creature.Elite.Elite.HP = 1
Rate.Creature.Elite.RAREELITE.HP = 1
Rate.Creature.Elite.WORLDBOSS.HP = 1
Rate.Creature.Elite.RARE.HP = 1
ListenRange.Say = 40
ListenRange.TextEmote = 40
ListenRange.Yell = 300
GuidReserveSize.Creature = 100
GuidReserveSize.GameObject = 100
ChatFakeMessagePreventing = 0
ChatStrictLinkChecking.Severity = 0
ChatStrictLinkChecking.Kick = 0
ChatFlood.MessageCount = 10
ChatFlood.MessageDelay = 1
ChatFlood.MuteTime = 10
Channel.SilentlyGMJoin = 0
GM.LoginState = 2
GM.Visible = 2
GM.AcceptTickets = 2
GM.Chat = 2
GM.WhisperingTo = 2
GM.InGMList.Level = 3
GM.InWhoList.Level = 3
GM.LogTrade = 1
GM.StartLevel = 1
GM.LowerSecurity = 0
GM.InvisibleAura = 31748
Visibility.GroupMode = 0
Visibility.Distance.Continents = 90
Visibility.Distance.Instances = 120
Visibility.Distance.BG = 180
Visibility.Distance.InFlight = 100
Visibility.Distance.Grey.Unit = 1
Visibility.Distance.Grey.Object = 10
Visibility.RelocationLowerLimit = 10
Visibility.AIRelocationNotifyDelay = 1000
Rate.Health = 1
Rate.Mana = 1
Rate.Rage.Income = 1
Rate.Rage.Loss = 1
Rate.Focus = 1
Rate.Loyalty = 1
Rate.Energy = 1
Rate.Skill.Discovery = 1
Rate.Drop.Item.Poor = 1
Rate.Drop.Item.Normal = 1
Rate.Drop.Item.Uncommon = 1
Rate.Drop.Item.Rare = 1
Rate.Drop.Item.Epic = 1
Rate.Drop.Item.Legendary = 1
Rate.Drop.Item.Artifact = 1
Rate.Drop.Item.Referenced = 1
Rate.Drop.Money = 1
Rate.XP.Kill = 1
Rate.XP.Quest = 1
Rate.XP.Explore = 1
Rate.Rest.InGame = 1
Rate.Rest.Offline.InTavernOrCity = 1
Rate.Rest.Offline.InWilderness = 1
Rate.Damage.Fall = 1
Rate.Auction.Time = 1
Rate.Auction.Deposit = 1
Rate.Auction.Cut = 1
Auction.Deposit.Min = 0
Rate.Honor = 1
Rate.Mining.Amount = 1
Rate.Mining.Next = 1
Rate.Talent = 1
Rate.Reputation.Gain = 1
Rate.Reputation.LowLevel.Kill = 0.2
Rate.Reputation.LowLevel.Quest = 1
Rate.InstanceResetTime = 1
SkillGain.Crafting = 1
SkillGain.Defense = 1
SkillGain.Gathering = 1
SkillGain.Weapon = 1
SkillChance.Orange = 100
SkillChance.Yellow = 75
SkillChance.Green = 25
SkillChance.Grey = 0
SkillChance.MiningSteps = 0
SkillChance.SkinningSteps = 0
SkillFail.Loot.Fishing = 0
SkillFail.Gain.Fishing = 0
SkillFail.Possible.FishingPool = 1
DurabilityLossChance.Damage = 0.5
DurabilityLossChance.Absorb = 0.5
DurabilityLossChance.Parry = 0.05
DurabilityLossChance.Block = 0.05
Death.SicknessLevel = 11
Death.CorpseReclaimDelay.PvP = 1
Death.CorpseReclaimDelay.PvE = 1
Death.Bones.World = 1
Death.Bones.Battleground = 1
Death.Ghost.RunSpeed.World = 1.0
Death.Ghost.RunSpeed.Battleground = 1.0
Battleground.CastDeserter = 1
Battleground.QueueAnnouncer.Join = 0
Battleground.QueueAnnouncer.Start = 0
Battleground.ScoreStatistics = 0
Battleground.InvitationType = 0
BattleGround.PrematureFinishTimer = 300000
BattleGround.PremadeGroupWaitForMatch = 0
OutdoorPvp.SIEnabled = 1
OutdoorPvp.EPEnabled = 1
Network.Threads = 1
Network.OutKBuff = -1
Network.OutUBuff = 65536
Network.TcpNodelay = 1
Network.KickOnBadPacket = 0
Console.Enable = 0
Ra.Enable = 0
Ra.IP = 0.0.0.0
Ra.Port = 3443
Ra.MinLevel = 3
Ra.Secure = 1
Ra.Stricted = 1
SOAP.Enabled = 0
SOAP.IP = 10.10.10.10
SOAP.Port = 7878
CharDelete.Method = 0
CharDelete.MinLevel = 0
CharDelete.KeepDays = 30
cat /usr/local/wow_mangos/etc/realmd.conf |grep -v ^# |grep -v ^$
[RealmdConf]
ConfVersion=2010062001
LoginDatabaseInfo = "10.10.10.10;3310;mangos;mangos;realmd"
LogsDir = ""
MaxPingTime = 30
RealmServerPort = 3724
BindIP = "0.0.0.0"
PidFile = ""
LogLevel = 0
LogTime = 0
LogFile = "Realmd.log"
LogTimestamp = 0
LogFileLevel = 0
LogColors = ""
UseProcessors = 0
ProcessPriority = 1
WaitAtStartupError = 0
RealmsStateUpdateDelay = 20
WrongPass.MaxCount = 0
WrongPass.BanTime = 600
WrongPass.BanType = 0
9、启动服务器
cat /usr/local/wow_mangos/bin/startup.sh
启动脚本内容如下:
#!/bin/sh
# usage : sh shutdown.sh
# author : nagle
# date : Sat Jan 21 16:10:11 CST 2017
# website: https://github.com/geektcp
base_dir=`dirname $0`/..
cd $base_dir/bin/
export LD_LIBRARY_PATH=/usr/local/gcc-4.9.3/lib64/:$base_dir/lib
nohup $base_dir/bin/realmd 2>&1 >> $base_dir/logs/nohup_realmd.out &
$base_dir/bin/mangosd
cat /usr/local/wow_mangos/bin/shutdown.sh
关闭脚本内容:
#!/bin/sh
# usage : sh shutdown.sh
# author : nagle
# date : Sat Jan 21 16:10:11 CST 2017
# website: https://github.com/geektcp
ps -ef |grep wow_mangos |grep wow|grep -v grep |grep -v local|awk '{print $2}' |xargs -t -i kill -9 {}
alais 环境变量 (方便启动,可以忽略):
cat ~/.bash_profile
alias startmangos='screen -S thy -X screen su - wow -c /usr/local/wow_mangos/bin/startup.sh'
alias stopmanos='screen -S thy -X screen su - wow -c /usr/local/wow_mangos/bin/shutdown.sh'
10、创建账号
如果启动 mangosd 服务端时,配置文件指定了启用控制台,那么可以在控制台输入命令:
account create nagle 123
即可创建一个帐号为 nagle,密码为 123 的帐号了。
另外通过数据库也可以创建账号,对应的 sql 语句是:
SET
@username = "test1",
@password = "123",
@email = "test@163.com",
@expansion = 0, -- 0表示经典旧时, 1表示70年代,一次类推
@gmlevel = 0, -- 0 = player, 1=GM, 2=Moderator, 3=Admin, 4=Console
@realmid = 1;
INSERT INTO account
(username, sha_pass_hash, gmlevel, email, expansion, active_realm_id)
VALUES (
UPPER(@username),
(SHA1(CONCAT(UPPER(@username),
':', UPPER (@password))) ),
@gmlevel,
@email,
@expansion,
@realmid
);
INSERT INTO `realmd`.`realmcharacters` (`realmid`, `acctid`) VALUES ('1', '5');