aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChazy Chaz <ChazyTheBest@hotmail.es>2017-04-24 01:50:19 +0200
committerAokromes <Aokromes@users.noreply.github.com>2017-04-24 01:50:19 +0200
commit9a3b28894da14a4d839ddad77fa85be61ff03287 (patch)
tree58a162ddd938a53ae41aef709471ac0ee18fe598 /src
parentf0bf1fc77aa304ad278618aae25274ed46d308d5 (diff)
Core/Misc: Update locales_broadcast_text to simple system
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 587e776ff74..dd0bbeb5451 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -8823,41 +8823,38 @@ void ObjectMgr::LoadBroadcastTextLocales()
{
uint32 oldMSTime = getMSTime();
- // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
- QueryResult result = WorldDatabase.Query("SELECT Id, MaleText_loc1, MaleText_loc2, MaleText_loc3, MaleText_loc4, MaleText_loc5, MaleText_loc6, MaleText_loc7, MaleText_loc8, FemaleText_loc1, FemaleText_loc2, FemaleText_loc3, FemaleText_loc4, FemaleText_loc5, FemaleText_loc6, FemaleText_loc7, FemaleText_loc8 FROM locales_broadcast_text");
+ // 0 1 2 3
+ QueryResult result = WorldDatabase.Query("SELECT ID, locale, MaleText, FemaleText FROM broadcast_text_locale");
if (!result)
{
- TC_LOG_INFO("server.loading", ">> Loaded 0 broadcast text locales. DB table `locales_broadcast_text` is empty.");
+ TC_LOG_INFO("server.loading", ">> Loaded 0 broadcast text locales. DB table `broadcast_text_locale` is empty.");
return;
}
- uint32 count = 0;
-
do
{
Field* fields = result->Fetch();
- uint32 id = fields[0].GetUInt32();
+ uint32 id = fields[0].GetUInt32();
+ std::string localeName = fields[1].GetString();
+ std::string MaleText = fields[2].GetString();
+ std::string FemaleText = fields[3].GetString();
+
BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id);
if (bct == _broadcastTextStore.end())
{
- TC_LOG_ERROR("sql.sql", "BroadcastText (Id: %u) in table `locales_broadcast_text` does not exist. Skipped!", id);
+ TC_LOG_ERROR("sql.sql", "BroadcastText (Id: %u) in table `broadcast_text_locale` does not exist. Skipped!", id);
continue;
}
- for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
- {
- LocaleConstant locale = LocaleConstant(i);
- AddLocaleString(fields[1 + (i - 1)].GetString(), locale, bct->second.MaleText);
- AddLocaleString(fields[9 + (i - 1)].GetString(), locale, bct->second.FemaleText);
- }
+ LocaleConstant locale = GetLocaleByName(localeName);
- ++count;
- }
- while (result->NextRow());
+ AddLocaleString(MaleText, locale, bct->second.MaleText);
+ AddLocaleString(FemaleText, locale, bct->second.FemaleText);
+ } while (result->NextRow());
- TC_LOG_INFO("server.loading", ">> Loaded %u broadcast text locales in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ TC_LOG_INFO("server.loading", ">> Loaded %u broadcast text locales in %u ms", uint32(_broadcastTextStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 level, uint8 unitClass)