Core/Player: Moved character_template from character to world db
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,2 @@
|
||||
DROP TABLE IF EXISTS `character_template`;
|
||||
DROP TABLE IF EXISTS `character_template_class`;
|
||||
@@ -0,0 +1,16 @@
|
||||
DROP TABLE IF EXISTS `character_template`;
|
||||
CREATE TABLE IF NOT EXISTS `character_template` (
|
||||
`Id` int(10) unsigned NOT NULL,
|
||||
`Name` varchar(70) NOT NULL,
|
||||
`Description` varchar(100) NOT NULL,
|
||||
`Level` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`Id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
DROP TABLE IF EXISTS `character_template_class`;
|
||||
CREATE TABLE IF NOT EXISTS `character_template_class` (
|
||||
`TemplateId` int(10) unsigned NOT NULL,
|
||||
`FactionGroup` tinyint(3) unsigned NOT NULL COMMENT '3 - Alliance, 5 - Horde',
|
||||
`Class` tinyint(3) unsigned NOT NULL,
|
||||
PRIMARY KEY (`TemplateId`,`FactionGroup`,`Class`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
@@ -73,8 +73,6 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_SEL_CHAR_ZONE, "SELECT zone FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHAR_POSITION_XYZ, "SELECT map, position_x, position_y, position_z FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHAR_POSITION, "SELECT position_x, position_y, position_z, orientation, map, taxi_path FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_TEMPLATES, "SELECT id, name, description, level FROM character_template", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_TEMPLATE_CLASSES, "SELECT factionGroup, class FROM character_template_class WHERE templateId = ?", CONNECTION_SYNCH);
|
||||
|
||||
PrepareStatement(CHAR_DEL_BATTLEGROUND_RANDOM_ALL, "DELETE FROM character_battleground_random", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_BATTLEGROUND_RANDOM, "DELETE FROM character_battleground_random WHERE guid = ?", CONNECTION_ASYNC);
|
||||
|
||||
@@ -58,8 +58,6 @@ enum CharacterDatabaseStatements
|
||||
CHAR_SEL_CHAR_ZONE,
|
||||
CHAR_SEL_CHAR_POSITION_XYZ,
|
||||
CHAR_SEL_CHAR_POSITION,
|
||||
CHAR_SEL_CHARACTER_TEMPLATES,
|
||||
CHAR_SEL_CHARACTER_TEMPLATE_CLASSES,
|
||||
|
||||
CHAR_DEL_BATTLEGROUND_RANDOM_ALL,
|
||||
CHAR_DEL_BATTLEGROUND_RANDOM,
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "Channel.h"
|
||||
#include "ChannelMgr.h"
|
||||
#include "CharacterDatabaseCleaner.h"
|
||||
#include "CharacterTemplateDataStore.h"
|
||||
#include "CharacterPackets.h"
|
||||
#include "Chat.h"
|
||||
#include "ChatPackets.h"
|
||||
@@ -487,6 +488,20 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac
|
||||
else if (getClass() == CLASS_DEMON_HUNTER)
|
||||
start_level = sWorld->getIntConfig(CONFIG_START_DEMON_HUNTER_PLAYER_LEVEL);
|
||||
|
||||
if (createInfo->TemplateSet)
|
||||
{
|
||||
if (m_session->HasPermission(rbac::RBAC_PERM_USE_CHARACTER_TEMPLATES))
|
||||
{
|
||||
if (CharacterTemplate const* charTemplate = sCharacterTemplateDataStore->GetCharacterTemplate(*createInfo->TemplateSet))
|
||||
{
|
||||
if (charTemplate->Level > start_level)
|
||||
start_level = charTemplate->Level;
|
||||
}
|
||||
}
|
||||
else
|
||||
TC_LOG_WARN("cheat", "Account: %u (IP: %s) tried to use a character template without given permission. Possible cheating attempt.", m_session->GetAccountId(), m_session->GetRemoteAddress().c_str());
|
||||
}
|
||||
|
||||
if (m_session->HasPermission(rbac::RBAC_PERM_USE_START_GM_LEVEL))
|
||||
{
|
||||
uint32 gm_level = sWorld->getIntConfig(CONFIG_START_GM_LEVEL);
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CharacterTemplateDataStore.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "Log.h"
|
||||
#include "Timer.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
CharacterTemplateContainer _characterTemplateStore;
|
||||
}
|
||||
|
||||
void CharacterTemplateDataStore::LoadCharacterTemplates()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
_characterTemplateStore.clear();
|
||||
|
||||
std::unordered_map<uint32, std::vector<CharacterTemplateClass>> characterTemplateClasses;
|
||||
|
||||
if (QueryResult classesResult = WorldDatabase.Query("SELECT TemplateId, FactionGroup, Class FROM character_template_class"))
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = classesResult->Fetch();
|
||||
|
||||
uint32 templateId = fields[0].GetUInt32();
|
||||
uint8 factionGroup = fields[1].GetUInt8();
|
||||
uint8 classID = fields[2].GetUInt8();
|
||||
|
||||
if (!((factionGroup & (FACTION_MASK_PLAYER | FACTION_MASK_ALLIANCE)) == (FACTION_MASK_PLAYER | FACTION_MASK_ALLIANCE)) &&
|
||||
!((factionGroup & (FACTION_MASK_PLAYER | FACTION_MASK_HORDE)) == (FACTION_MASK_PLAYER | FACTION_MASK_HORDE)))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Faction group %u defined for character template %u in `character_template_class` is invalid. Skipped.", factionGroup, templateId);
|
||||
continue;
|
||||
}
|
||||
|
||||
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(classID);
|
||||
if (!classEntry)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Class %u defined for character template %u in `character_template_class` does not exists, skipped.", classID, templateId);
|
||||
continue;
|
||||
}
|
||||
|
||||
characterTemplateClasses[templateId].emplace_back(factionGroup, classID);
|
||||
}
|
||||
while (classesResult->NextRow());
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_INFO("server.loading", ">> Loaded 0 character template classes. DB table `character_template_class` is empty.");
|
||||
}
|
||||
|
||||
QueryResult templates = WorldDatabase.Query("SELECT Id, Name, Description, Level FROM character_template");
|
||||
if (!templates)
|
||||
{
|
||||
TC_LOG_INFO("server.loading", ">> Loaded 0 character templates. DB table `character_template` is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = templates->Fetch();
|
||||
|
||||
CharacterTemplate templ;
|
||||
templ.TemplateSetId = fields[0].GetUInt32();
|
||||
templ.Name = fields[1].GetString();
|
||||
templ.Description = fields[2].GetString();
|
||||
templ.Level = fields[3].GetUInt8();
|
||||
templ.Classes = std::move(characterTemplateClasses[templ.TemplateSetId]);
|
||||
|
||||
if (templ.Classes.empty())
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Character template %u does not have any classes defined in `character_template_class`. Skipped.", templ.TemplateSetId);
|
||||
continue;
|
||||
}
|
||||
|
||||
_characterTemplateStore[templ.TemplateSetId] = templ;
|
||||
}
|
||||
while (templates->NextRow());
|
||||
|
||||
TC_LOG_INFO("server.loading", ">> Loaded " SZFMTD " character templates in %u ms.", _characterTemplateStore.size(), GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
CharacterTemplateContainer const& CharacterTemplateDataStore::GetCharacterTemplates() const
|
||||
{
|
||||
return _characterTemplateStore;
|
||||
}
|
||||
|
||||
CharacterTemplate const* CharacterTemplateDataStore::GetCharacterTemplate(uint32 templateId) const
|
||||
{
|
||||
auto itr = _characterTemplateStore.find(templateId);
|
||||
if (itr != _characterTemplateStore.end())
|
||||
return &itr->second;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CharacterTemplateDataStore* CharacterTemplateDataStore::Instance()
|
||||
{
|
||||
static CharacterTemplateDataStore instance;
|
||||
return &instance;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2017 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CharacterTemplateDataStore_h__
|
||||
#define CharacterTemplateDataStore_h__
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
struct CharacterTemplateClass
|
||||
{
|
||||
CharacterTemplateClass(uint8 factionGroup, uint8 classID)
|
||||
: FactionGroup(factionGroup), ClassID(classID) { }
|
||||
|
||||
uint8 FactionGroup;
|
||||
uint8 ClassID;
|
||||
};
|
||||
|
||||
struct CharacterTemplate
|
||||
{
|
||||
uint32 TemplateSetId;
|
||||
std::vector<CharacterTemplateClass> Classes;
|
||||
std::string Name;
|
||||
std::string Description;
|
||||
uint8 Level;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<uint32, CharacterTemplate> CharacterTemplateContainer;
|
||||
|
||||
class TC_GAME_API CharacterTemplateDataStore
|
||||
{
|
||||
public:
|
||||
void LoadCharacterTemplates();
|
||||
|
||||
CharacterTemplateContainer const& GetCharacterTemplates() const;
|
||||
CharacterTemplate const* GetCharacterTemplate(uint32 templateId) const;
|
||||
|
||||
static CharacterTemplateDataStore* Instance();
|
||||
};
|
||||
|
||||
#define sCharacterTemplateDataStore CharacterTemplateDataStore::Instance()
|
||||
|
||||
#endif // CharacterTemplateDataStore_h__
|
||||
@@ -9407,81 +9407,6 @@ void ObjectMgr::LoadRaceAndClassExpansionRequirements()
|
||||
TC_LOG_INFO("server.loading", ">> Loaded 0 class expansion requirements. DB table `class_expansion_requirement` is empty.");
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCharacterTemplates()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
_characterTemplateStore.clear();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_TEMPLATES);
|
||||
PreparedQueryResult templates = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (!templates)
|
||||
{
|
||||
TC_LOG_INFO("server.loading", ">> Loaded 0 character templates. DB table `character_template` is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
PreparedQueryResult classes;
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
Field* fields = templates->Fetch();
|
||||
|
||||
uint32 templateSetId = fields[0].GetUInt32();
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_TEMPLATE_CLASSES);
|
||||
stmt->setUInt32(0, templateSetId);
|
||||
classes = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (classes)
|
||||
{
|
||||
CharacterTemplate templ;
|
||||
templ.TemplateSetId = templateSetId;
|
||||
templ.Name = fields[1].GetString();
|
||||
templ.Description = fields[2].GetString();
|
||||
templ.Level = fields[3].GetUInt8();
|
||||
|
||||
do
|
||||
{
|
||||
fields = classes->Fetch();
|
||||
|
||||
uint8 factionGroup = fields[0].GetUInt8();
|
||||
uint8 classID = fields[1].GetUInt8();
|
||||
|
||||
if (!((factionGroup & (FACTION_MASK_PLAYER | FACTION_MASK_ALLIANCE)) == (FACTION_MASK_PLAYER | FACTION_MASK_ALLIANCE)) &&
|
||||
!((factionGroup & (FACTION_MASK_PLAYER | FACTION_MASK_HORDE)) == (FACTION_MASK_PLAYER | FACTION_MASK_HORDE)))
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Faction group %u defined for character template %u in `character_template_class` is invalid. Skipped.", factionGroup, templateSetId);
|
||||
continue;
|
||||
}
|
||||
|
||||
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(classID);
|
||||
if (!classEntry)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Class %u defined for character template %u in `character_template_class` does not exists, skipped.", classID, templateSetId);
|
||||
continue;
|
||||
}
|
||||
|
||||
templ.Classes.emplace_back(factionGroup, classID);
|
||||
|
||||
} while (classes->NextRow());
|
||||
|
||||
if (!templ.Classes.empty())
|
||||
{
|
||||
_characterTemplateStore[templateSetId] = templ;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Character template %u does not have any classes defined in `character_template_class`. Skipped.", templateSetId);
|
||||
continue;
|
||||
}
|
||||
} while (templates->NextRow());
|
||||
TC_LOG_INFO("server.loading", ">> Loaded %u character templates in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadRealmNames()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
@@ -604,26 +604,6 @@ typedef std::unordered_map<uint32, TrainerSpellData> CacheTrainerSpellContainer;
|
||||
typedef std::unordered_map<uint8, uint8> ExpansionRequirementContainer;
|
||||
typedef std::unordered_map<uint32, std::string> RealmNameContainer;
|
||||
|
||||
struct CharcterTemplateClass
|
||||
{
|
||||
CharcterTemplateClass(uint8 factionGroup, uint8 classID) :
|
||||
FactionGroup(factionGroup), ClassID(classID) { }
|
||||
|
||||
uint8 FactionGroup;
|
||||
uint8 ClassID;
|
||||
};
|
||||
|
||||
struct CharacterTemplate
|
||||
{
|
||||
uint32 TemplateSetId;
|
||||
std::vector<CharcterTemplateClass> Classes;
|
||||
std::string Name;
|
||||
std::string Description;
|
||||
uint8 Level;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<uint32, CharacterTemplate> CharacterTemplateContainer;
|
||||
|
||||
struct SceneTemplate
|
||||
{
|
||||
uint32 SceneId;
|
||||
@@ -1381,7 +1361,6 @@ class TC_GAME_API ObjectMgr
|
||||
bool IsTransportMap(uint32 mapId) const { return _transportMaps.count(mapId) != 0; }
|
||||
|
||||
void LoadRaceAndClassExpansionRequirements();
|
||||
void LoadCharacterTemplates();
|
||||
void LoadRealmNames();
|
||||
|
||||
std::string GetRealmName(uint32 realm) const;
|
||||
@@ -1405,16 +1384,6 @@ class TC_GAME_API ObjectMgr
|
||||
return EXPANSION_CLASSIC;
|
||||
}
|
||||
|
||||
CharacterTemplateContainer const& GetCharacterTemplates() const { return _characterTemplateStore; }
|
||||
CharacterTemplate const* GetCharacterTemplate(uint32 id) const
|
||||
{
|
||||
auto itr = _characterTemplateStore.find(id);
|
||||
if (itr != _characterTemplateStore.end())
|
||||
return &itr->second;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SceneTemplate const* GetSceneTemplate(uint32 sceneId) const
|
||||
{
|
||||
auto itr = _sceneTemplateStore.find(sceneId);
|
||||
@@ -1576,7 +1545,6 @@ class TC_GAME_API ObjectMgr
|
||||
ExpansionRequirementContainer _classExpansionRequirementStore;
|
||||
RealmNameContainer _realmNameStore;
|
||||
|
||||
CharacterTemplateContainer _characterTemplateStore;
|
||||
SceneTemplateContainer _sceneTemplateStore;
|
||||
|
||||
enum CreatureLinkedRespawnType
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "WorldSession.h"
|
||||
#include "AuthenticationPackets.h"
|
||||
#include "BattlenetRpcErrorCodes.h"
|
||||
#include "CharacterTemplateDataStore.h"
|
||||
#include "ClientConfigPackets.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SystemPackets.h"
|
||||
@@ -41,8 +42,8 @@ void WorldSession::SendAuthResponse(uint32 code, bool queued, uint32 queuePos)
|
||||
sObjectMgr->GetRealmName(realm.Id.Realm), sObjectMgr->GetNormalizedRealmName(realm.Id.Realm));
|
||||
|
||||
if (HasPermission(rbac::RBAC_PERM_USE_CHARACTER_TEMPLATES))
|
||||
for (auto& templ : sObjectMgr->GetCharacterTemplates())
|
||||
response.SuccessInfo->Templates.emplace_back(templ.second);
|
||||
for (auto const& templ : sCharacterTemplateDataStore->GetCharacterTemplates())
|
||||
response.SuccessInfo->Templates.push_back(&templ.second);
|
||||
|
||||
response.SuccessInfo->AvailableClasses = &sObjectMgr->GetClassExpansionRequirements();
|
||||
response.SuccessInfo->AvailableRaces = &sObjectMgr->GetRaceExpansionRequirements();
|
||||
|
||||
@@ -761,25 +761,6 @@ void WorldSession::HandleCharCreateOpcode(WorldPackets::Character::CreateCharact
|
||||
|
||||
LoginDatabase.CommitTransaction(trans);
|
||||
|
||||
if (createInfo->TemplateSet)
|
||||
{
|
||||
if (HasPermission(rbac::RBAC_PERM_USE_CHARACTER_TEMPLATES))
|
||||
{
|
||||
if (CharacterTemplate const* charTemplate = sObjectMgr->GetCharacterTemplate(*createInfo->TemplateSet))
|
||||
{
|
||||
if (charTemplate->Level != 1)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
|
||||
stmt->setUInt8(0, uint8(charTemplate->Level));
|
||||
stmt->setUInt64(1, newChar.GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
TC_LOG_WARN("cheat", "Account: %u (IP: %s) tried to use a character template without given permission. Possible cheating attempt.", GetAccountId(), GetRemoteAddress().c_str());
|
||||
}
|
||||
|
||||
SendCharCreate(CHAR_CREATE_SUCCESS);
|
||||
|
||||
TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Create Character: %s %s", GetAccountId(), GetRemoteAddress().c_str(), createInfo->Name.c_str(), newChar.GetGUID().ToString().c_str());
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "AuthenticationPackets.h"
|
||||
#include "CharacterTemplateDataStore.h"
|
||||
#include "HmacHash.h"
|
||||
|
||||
bool WorldPackets::Auth::EarlyProcessClientPacket::ReadNoThrow()
|
||||
@@ -109,13 +110,13 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
|
||||
_worldPacket << uint32(SuccessInfo->CurrencyID);
|
||||
_worldPacket << int32(SuccessInfo->Time);
|
||||
|
||||
for (auto& race : *SuccessInfo->AvailableRaces)
|
||||
for (auto const& race : *SuccessInfo->AvailableRaces)
|
||||
{
|
||||
_worldPacket << uint8(race.first); /// the current race
|
||||
_worldPacket << uint8(race.second); /// the required Expansion
|
||||
}
|
||||
|
||||
for (auto& klass : *SuccessInfo->AvailableClasses)
|
||||
for (auto const& klass : *SuccessInfo->AvailableClasses)
|
||||
{
|
||||
_worldPacket << uint8(klass.first); /// the current class
|
||||
_worldPacket << uint8(klass.second); /// the required Expansion
|
||||
@@ -143,7 +144,7 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
|
||||
if (SuccessInfo->NumPlayersAlliance)
|
||||
_worldPacket << uint16(*SuccessInfo->NumPlayersAlliance);
|
||||
|
||||
for (auto& virtualRealm : SuccessInfo->VirtualRealms)
|
||||
for (auto const& virtualRealm : SuccessInfo->VirtualRealms)
|
||||
{
|
||||
_worldPacket << uint32(virtualRealm.RealmAddress);
|
||||
_worldPacket.WriteBit(virtualRealm.IsLocal);
|
||||
@@ -156,22 +157,22 @@ WorldPacket const* WorldPackets::Auth::AuthResponse::Write()
|
||||
_worldPacket.WriteString(virtualRealm.RealmNameNormalized);
|
||||
}
|
||||
|
||||
for (auto& templat : SuccessInfo->Templates)
|
||||
for (CharacterTemplate const* templat : SuccessInfo->Templates)
|
||||
{
|
||||
_worldPacket << uint32(templat.TemplateSetId);
|
||||
_worldPacket << uint32(templat.Classes.size());
|
||||
for (auto& templateClass : templat.Classes)
|
||||
_worldPacket << uint32(templat->TemplateSetId);
|
||||
_worldPacket << uint32(templat->Classes.size());
|
||||
for (CharacterTemplateClass const& templateClass : templat->Classes)
|
||||
{
|
||||
_worldPacket << uint8(templateClass.ClassID);
|
||||
_worldPacket << uint8(templateClass.FactionGroup);
|
||||
}
|
||||
|
||||
_worldPacket.WriteBits(templat.Name.length(), 7);
|
||||
_worldPacket.WriteBits(templat.Description.length(), 10);
|
||||
_worldPacket.WriteBits(templat->Name.length(), 7);
|
||||
_worldPacket.WriteBits(templat->Description.length(), 10);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
_worldPacket.WriteString(templat.Name);
|
||||
_worldPacket.WriteString(templat.Description);
|
||||
_worldPacket.WriteString(templat->Name);
|
||||
_worldPacket.WriteString(templat->Description);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "SHA1.h"
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
|
||||
struct CharacterTemplate;
|
||||
|
||||
using boost::asio::ip::tcp;
|
||||
|
||||
namespace WorldPackets
|
||||
@@ -142,7 +144,7 @@ namespace WorldPackets
|
||||
BillingInfo Billing;
|
||||
|
||||
std::vector<RealmInfo> VirtualRealms; ///< list of realms connected to this one (inclusive) @todo implement
|
||||
std::vector<CharacterTemplate> Templates; ///< list of pre-made character templates.
|
||||
std::vector<CharacterTemplate const*> Templates; ///< list of pre-made character templates.
|
||||
|
||||
ExpansionRequirementContainer const* AvailableClasses = nullptr; ///< the minimum AccountExpansion required to select the classes
|
||||
ExpansionRequirementContainer const* AvailableRaces = nullptr; ///< the minimum AccountExpansion required to select the races
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "CalendarMgr.h"
|
||||
#include "Channel.h"
|
||||
#include "CharacterDatabaseCleaner.h"
|
||||
#include "CharacterTemplateDataStore.h"
|
||||
#include "Chat.h"
|
||||
#include "Config.h"
|
||||
#include "CreatureAIRegistry.h"
|
||||
@@ -2117,7 +2118,7 @@ void World::SetInitialWorldSettings()
|
||||
sObjectMgr->LoadRaceAndClassExpansionRequirements();
|
||||
|
||||
TC_LOG_INFO("server.loading", "Loading character templates...");
|
||||
sObjectMgr->LoadCharacterTemplates();
|
||||
sCharacterTemplateDataStore->LoadCharacterTemplates();
|
||||
|
||||
TC_LOG_INFO("server.loading", "Loading realm names...");
|
||||
sObjectMgr->LoadRealmNames();
|
||||
|
||||
@@ -27,6 +27,7 @@ EndScriptData */
|
||||
#include "AreaTriggerDataStore.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "CharacterTemplateDataStore.h"
|
||||
#include "Chat.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "DisableMgr.h"
|
||||
@@ -387,7 +388,7 @@ public:
|
||||
static bool HandleReloadCharacterTemplate(ChatHandler* handler, char const* /*args*/)
|
||||
{
|
||||
TC_LOG_INFO("misc", "Re-Loading Character Templates...");
|
||||
sObjectMgr->LoadCharacterTemplates();
|
||||
sCharacterTemplateDataStore->LoadCharacterTemplates();
|
||||
handler->SendGlobalGMSysMessage("DB table `character_template` and `character_template_class` reloaded.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user