要实现Azerothcore使部落/联盟共享所有任务/城市/任务中心,需要进行以下几个步骤:
配置文件修改:
src/server/game/Setup/config.cpp
文件。CONFIG_SHARE_QUESTS
常量,并将其值设置为true
,以启用任务共享功能。CONFIG_SHARE_CITY
常量,并将其值设置为true
,以启用城市共享功能。数据库修改:
CREATE TABLE `shared_quest` (
`quest_id` int(10) unsigned NOT NULL,
`alliance` tinyint(3) unsigned NOT NULL DEFAULT '0',
`horde` tinyint(3) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`quest_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `shared_city` (
`city_id` int(10) unsigned NOT NULL,
`alliance` tinyint(3) unsigned NOT NULL DEFAULT '0',
`horde` tinyint(3) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`city_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
quest_template
表中的任务信息,设置alliance
和horde
字段为1,表示该任务对联盟和部落都可用。例如:UPDATE `quest_template` SET `alliance`=1, `horde`=1 WHERE `entry` = ;
gameobject_template
表中的城市信息,设置alliance
和horde
字段为1,表示该城市对联盟和部落都可用。例如:UPDATE `gameobject_template` SET `alliance`=1, `horde`=1 WHERE `entry` = ;
代码修改:
src/server/game/Quests/SharedQuestMgr.cpp
文件。SharedQuestMgr::Initialize()
方法,并将其中的代码替换为以下代码:void SharedQuestMgr::Initialize()
{
sLog->outString(" >> Loading Shared Quests...");
QueryResult result = WorldDatabase.Query("SELECT * FROM shared_quest");
if (result)
{
do
{
Field* fields = result->Fetch();
uint32 questId = fields[0].GetUInt32();
uint32 alliance = fields[1].GetUInt32();
uint32 horde = fields[2].GetUInt32();
m_sharedQuests[questId] = std::make_pair(alliance, horde);
} while (result->NextRow());
}
sLog->outString(" >> Loading Shared Cities...");
QueryResult result2 = WorldDatabase.Query("SELECT * FROM shared_city");
if (result2)
{
do
{
Field* fields = result2->Fetch();
uint32 cityId = fields[0].GetUInt32();
uint32 alliance = fields[1].GetUInt32();
uint32 horde = fields[2].GetUInt32();
m_sharedCities[cityId] = std::make_pair(alliance, horde);
} while (result2->NextRow());
}
}
重新编译和运行服务器。
现在,任务和城市应该在部落和联盟之间共享。请注意,以上代码示例仅供参考,你可能需要根据自己的需求进行适当的修改和调整。