aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/3.3.5/2017_04_24_00_world.sql43
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp31
2 files changed, 57 insertions, 17 deletions
diff --git a/sql/updates/world/3.3.5/2017_04_24_00_world.sql b/sql/updates/world/3.3.5/2017_04_24_00_world.sql
new file mode 100644
index 00000000000..6bf576c6c7d
--- /dev/null
+++ b/sql/updates/world/3.3.5/2017_04_24_00_world.sql
@@ -0,0 +1,43 @@
+DROP TABLE IF EXISTS `broadcast_text_locale`;
+CREATE TABLE IF NOT EXISTS `broadcast_text_locale` (
+ `ID` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
+ `locale` VARCHAR(4) NOT NULL,
+ `MaleText` TEXT,
+ `FemaleText` TEXT,
+ `VerifiedBuild` SMALLINT(5) DEFAULT '0',
+ PRIMARY KEY (`ID`, `locale`)
+) ENGINE=MYISAM DEFAULT CHARSET=utf8;
+
+-- koKR
+INSERT INTO `broadcast_text_locale` (`ID`, `locale`, `MaleText`, `FemaleText`, `VerifiedBuild`)
+ (SELECT `Id`, "koKR", `MaleText_loc1`, `FemaleText_loc1`, `VerifiedBuild` FROM `locales_broadcast_text` WHERE LENGTH(MaleText_loc1) > 0 OR LENGTH(FemaleText_loc1) > 0);
+
+-- frFR
+INSERT INTO `broadcast_text_locale` (`ID`, `locale`, `MaleText`, `FemaleText`, `VerifiedBuild`)
+ (SELECT `Id`, "frFR", `MaleText_loc2`, `FemaleText_loc2`, `VerifiedBuild` FROM `locales_broadcast_text` WHERE LENGTH(MaleText_loc2) > 0 OR LENGTH(FemaleText_loc2) > 0);
+
+-- deDE
+INSERT INTO `broadcast_text_locale` (`ID`, `locale`, `MaleText`, `FemaleText`, `VerifiedBuild`)
+ (SELECT `Id`, "deDE", `MaleText_loc3`, `FemaleText_loc3`, `VerifiedBuild` FROM `locales_broadcast_text` WHERE LENGTH(MaleText_loc3) > 0 OR LENGTH(FemaleText_loc3) > 0);
+
+-- zhCN
+INSERT INTO `broadcast_text_locale` (`ID`, `locale`, `MaleText`, `FemaleText`, `VerifiedBuild`)
+ (SELECT `Id`, "zhCN", `MaleText_loc4`, `FemaleText_loc4`, `VerifiedBuild` FROM `locales_broadcast_text` WHERE LENGTH(MaleText_loc4) > 0 OR LENGTH(FemaleText_loc4) > 0);
+
+-- zhTW
+INSERT INTO `broadcast_text_locale` (`ID`, `locale`, `MaleText`, `FemaleText`, `VerifiedBuild`)
+ (SELECT `Id`, "zhTW", `MaleText_loc5`, `FemaleText_loc5`, `VerifiedBuild` FROM `locales_broadcast_text` WHERE LENGTH(MaleText_loc5) > 0 OR LENGTH(FemaleText_loc5) > 0);
+
+-- esES
+INSERT INTO `broadcast_text_locale` (`ID`, `locale`, `MaleText`, `FemaleText`, `VerifiedBuild`)
+ (SELECT `Id`, "esES", `MaleText_loc6`, `FemaleText_loc6`, `VerifiedBuild` FROM `locales_broadcast_text` WHERE LENGTH(MaleText_loc6) > 0 OR LENGTH(FemaleText_loc6) > 0);
+
+-- esMX
+INSERT INTO `broadcast_text_locale` (`ID`, `locale`, `MaleText`, `FemaleText`, `VerifiedBuild`)
+ (SELECT `Id`, "esMX", `MaleText_loc7`, `FemaleText_loc7`, `VerifiedBuild` FROM `locales_broadcast_text` WHERE LENGTH(MaleText_loc7) > 0 OR LENGTH(FemaleText_loc7) > 0);
+
+-- ruRU
+INSERT INTO `broadcast_text_locale` (`ID`, `locale`, `MaleText`, `FemaleText`, `VerifiedBuild`)
+ (SELECT `Id`, "ruRU", `MaleText_loc8`, `FemaleText_loc8`, `VerifiedBuild` FROM `locales_broadcast_text` WHERE LENGTH(MaleText_loc8) > 0 OR LENGTH(FemaleText_loc8) > 0);
+
+DROP TABLE IF EXISTS `locales_broadcast_text`;
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)