aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2017-01-29 16:09:46 +0100
committerjoschiwald <joschiwald.trinity@gmail.com>2017-01-29 16:09:46 +0100
commita6d238b833baa28e3d607b615f1296ea676bbcb8 (patch)
tree07258947599fa71e8482ae8489a236610d26cfcb /src
parentc8af5de0d37af82793647e532702895251567e06 (diff)
Core/Player: Moved character_template from character to world db
Diffstat (limited to 'src')
-rw-r--r--src/server/database/Database/Implementation/CharacterDatabase.cpp2
-rw-r--r--src/server/database/Database/Implementation/CharacterDatabase.h2
-rw-r--r--src/server/game/Entities/Player/Player.cpp15
-rw-r--r--src/server/game/Globals/CharacterTemplateDataStore.cpp118
-rw-r--r--src/server/game/Globals/CharacterTemplateDataStore.h58
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp75
-rw-r--r--src/server/game/Globals/ObjectMgr.h32
-rw-r--r--src/server/game/Handlers/AuthHandler.cpp5
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp19
-rw-r--r--src/server/game/Server/Packets/AuthenticationPackets.cpp23
-rw-r--r--src/server/game/Server/Packets/AuthenticationPackets.h4
-rw-r--r--src/server/game/World/World.cpp3
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp3
13 files changed, 213 insertions, 146 deletions
diff --git a/src/server/database/Database/Implementation/CharacterDatabase.cpp b/src/server/database/Database/Implementation/CharacterDatabase.cpp
index 4f93df640ea..af2d0fdd355 100644
--- a/src/server/database/Database/Implementation/CharacterDatabase.cpp
+++ b/src/server/database/Database/Implementation/CharacterDatabase.cpp
@@ -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);
diff --git a/src/server/database/Database/Implementation/CharacterDatabase.h b/src/server/database/Database/Implementation/CharacterDatabase.h
index 414330ea187..4cbe44edcde 100644
--- a/src/server/database/Database/Implementation/CharacterDatabase.h
+++ b/src/server/database/Database/Implementation/CharacterDatabase.h
@@ -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,
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index bfb0bc377f2..455aaa6b238 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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);
diff --git a/src/server/game/Globals/CharacterTemplateDataStore.cpp b/src/server/game/Globals/CharacterTemplateDataStore.cpp
new file mode 100644
index 00000000000..2ee235e52d9
--- /dev/null
+++ b/src/server/game/Globals/CharacterTemplateDataStore.cpp
@@ -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;
+}
diff --git a/src/server/game/Globals/CharacterTemplateDataStore.h b/src/server/game/Globals/CharacterTemplateDataStore.h
new file mode 100644
index 00000000000..570adb33019
--- /dev/null
+++ b/src/server/game/Globals/CharacterTemplateDataStore.h
@@ -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__
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 1ee182f4273..0144dc27549 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -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();
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index d8fc9830844..03cc59171af 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -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
diff --git a/src/server/game/Handlers/AuthHandler.cpp b/src/server/game/Handlers/AuthHandler.cpp
index c4309271b7d..342982bbe00 100644
--- a/src/server/game/Handlers/AuthHandler.cpp
+++ b/src/server/game/Handlers/AuthHandler.cpp
@@ -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();
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index c32f6d4a149..d97a020b56e 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -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());
diff --git a/src/server/game/Server/Packets/AuthenticationPackets.cpp b/src/server/game/Server/Packets/AuthenticationPackets.cpp
index d8e94418d8e..70dec6bd274 100644
--- a/src/server/game/Server/Packets/AuthenticationPackets.cpp
+++ b/src/server/game/Server/Packets/AuthenticationPackets.cpp
@@ -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);
}
}
diff --git a/src/server/game/Server/Packets/AuthenticationPackets.h b/src/server/game/Server/Packets/AuthenticationPackets.h
index b5fc2b62044..68f32e6ce5e 100644
--- a/src/server/game/Server/Packets/AuthenticationPackets.h
+++ b/src/server/game/Server/Packets/AuthenticationPackets.h
@@ -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
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 382d1cd3b65..aa34b58a910 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -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();
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 4bc97623254..e547002ea37 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -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;
}