aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChazy Chaz <ChazyTheBest@hotmail.es>2017-05-04 17:11:35 +0200
committerAokromes <Aokromes@users.noreply.github.com>2017-05-04 17:11:35 +0200
commit838b46e33e36eb4b91b86cbfc256eef7e63b4dd5 (patch)
treed6f04c181b2705c8fdfb1f61f0c759f6501d15fe
parentd17a45ee7e348d6fc9146dd81e0457316eef1a62 (diff)
Core/Misc: Update locales_npc_text to simple system
-rw-r--r--sql/updates/world/3.3.5/2017_05_04_01_world.sql72
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp32
2 files changed, 85 insertions, 19 deletions
diff --git a/sql/updates/world/3.3.5/2017_05_04_01_world.sql b/sql/updates/world/3.3.5/2017_05_04_01_world.sql
new file mode 100644
index 00000000000..78feb315ddd
--- /dev/null
+++ b/sql/updates/world/3.3.5/2017_05_04_01_world.sql
@@ -0,0 +1,72 @@
+DROP TABLE IF EXISTS `npc_text_locale`;
+CREATE TABLE `npc_text_locale` (
+ `ID` mediumint(8) unsigned NOT NULL DEFAULT '0',
+ `Locale` varchar(4) NOT NULL,
+ `Text0_0` longtext,
+ `Text0_1` longtext,
+ `Text1_0` longtext,
+ `Text1_1` longtext,
+ `Text2_0` longtext,
+ `Text2_1` longtext,
+ `Text3_0` longtext,
+ `Text3_1` longtext,
+ `Text4_0` longtext,
+ `Text4_1` longtext,
+ `Text5_0` longtext,
+ `Text5_1` longtext,
+ `Text6_0` longtext,
+ `Text6_1` longtext,
+ `Text7_0` longtext,
+ `Text7_1` longtext,
+ PRIMARY KEY (`ID`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- koKR
+INSERT INTO `npc_text_locale` (`ID`, `Locale`, `Text0_0`, `Text0_1`, `Text1_0`, `Text1_1`, `Text2_0`, `Text2_1`, `Text3_0`, `Text3_1`, `Text4_0`, `Text4_1`, `Text5_0`, `Text5_1`, `Text6_0`, `Text6_1`, `Text7_0`, `Text7_1`)
+ (SELECT `ID`, "koKR", `Text0_0_loc1`, `Text0_1_loc1`, `Text1_0_loc1`, `Text1_1_loc1`, `Text2_0_loc1`, `Text2_1_loc1`, `Text3_0_loc1`, `Text3_1_loc1`, `Text4_0_loc1`, `Text4_1_loc1`, `Text5_0_loc1`, `Text5_1_loc1`, `Text6_0_loc1`, `Text6_1_loc1`, `Text7_0_loc1`, `Text7_1_loc1`
+ FROM `locales_npc_text`
+ WHERE LENGTH(Text0_0_loc1) > 0 && LENGTH(Text0_1_loc1) > 0 && LENGTH(Text1_0_loc1) > 0 && LENGTH(Text1_1_loc1) > 0 && LENGTH(Text2_0_loc1) > 0 && LENGTH(Text2_1_loc1) > 0 && LENGTH(Text3_0_loc1) > 0 && LENGTH(Text3_1_loc1) > 0 && LENGTH(Text4_0_loc1) > 0 && LENGTH(Text4_1_loc1) > 0 && LENGTH(Text5_0_loc1) > 0 && LENGTH(Text5_1_loc1) > 0 && LENGTH(Text6_0_loc1) > 0 && LENGTH(Text6_1_loc1) > 0 && LENGTH(Text7_0_loc1) > 0 && LENGTH(Text7_1_loc1) > 0);
+
+-- frFR
+INSERT INTO `npc_text_locale` (`ID`, `Locale`, `Text0_0`, `Text0_1`, `Text1_0`, `Text1_1`, `Text2_0`, `Text2_1`, `Text3_0`, `Text3_1`, `Text4_0`, `Text4_1`, `Text5_0`, `Text5_1`, `Text6_0`, `Text6_1`, `Text7_0`, `Text7_1`)
+ (SELECT `ID`, "frFR", `Text0_0_loc2`, `Text0_1_loc2`, `Text1_0_loc2`, `Text1_1_loc2`, `Text2_0_loc2`, `Text2_1_loc2`, `Text3_0_loc2`, `Text3_1_loc2`, `Text4_0_loc2`, `Text4_1_loc2`, `Text5_0_loc2`, `Text5_1_loc2`, `Text6_0_loc2`, `Text6_1_loc2`, `Text7_0_loc2`, `Text7_1_loc2`
+ FROM `locales_npc_text`
+ WHERE LENGTH(Text0_0_loc2) > 0 && LENGTH(Text0_1_loc2) > 0 && LENGTH(Text1_0_loc2) > 0 && LENGTH(Text1_1_loc2) > 0 && LENGTH(Text2_0_loc2) > 0 && LENGTH(Text2_1_loc2) > 0 && LENGTH(Text3_0_loc2) > 0 && LENGTH(Text3_1_loc2) > 0 && LENGTH(Text4_0_loc2) > 0 && LENGTH(Text4_1_loc2) > 0 && LENGTH(Text5_0_loc2) > 0 && LENGTH(Text5_1_loc2) > 0 && LENGTH(Text6_0_loc2) > 0 && LENGTH(Text6_1_loc2) > 0 && LENGTH(Text7_0_loc2) > 0 && LENGTH(Text7_1_loc2) > 0);
+
+-- deDE
+INSERT INTO `npc_text_locale` (`ID`, `Locale`, `Text0_0`, `Text0_1`, `Text1_0`, `Text1_1`, `Text2_0`, `Text2_1`, `Text3_0`, `Text3_1`, `Text4_0`, `Text4_1`, `Text5_0`, `Text5_1`, `Text6_0`, `Text6_1`, `Text7_0`, `Text7_1`)
+ (SELECT `ID`, "deDE", `Text0_0_loc3`, `Text0_1_loc3`, `Text1_0_loc3`, `Text1_1_loc3`, `Text2_0_loc3`, `Text2_1_loc3`, `Text3_0_loc3`, `Text3_1_loc3`, `Text4_0_loc3`, `Text4_1_loc3`, `Text5_0_loc3`, `Text5_1_loc3`, `Text6_0_loc3`, `Text6_1_loc3`, `Text7_0_loc3`, `Text7_1_loc3`
+ FROM `locales_npc_text`
+ WHERE LENGTH(Text0_0_loc3) > 0 && LENGTH(Text0_1_loc3) > 0 && LENGTH(Text1_0_loc3) > 0 && LENGTH(Text1_1_loc3) > 0 && LENGTH(Text2_0_loc3) > 0 && LENGTH(Text2_1_loc3) > 0 && LENGTH(Text3_0_loc3) > 0 && LENGTH(Text3_1_loc3) > 0 && LENGTH(Text4_0_loc3) > 0 && LENGTH(Text4_1_loc3) > 0 && LENGTH(Text5_0_loc3) > 0 && LENGTH(Text5_1_loc3) > 0 && LENGTH(Text6_0_loc3) > 0 && LENGTH(Text6_1_loc3) > 0 && LENGTH(Text7_0_loc3) > 0 && LENGTH(Text7_1_loc3) > 0);
+
+-- zhCN
+INSERT INTO `npc_text_locale` (`ID`, `Locale`, `Text0_0`, `Text0_1`, `Text1_0`, `Text1_1`, `Text2_0`, `Text2_1`, `Text3_0`, `Text3_1`, `Text4_0`, `Text4_1`, `Text5_0`, `Text5_1`, `Text6_0`, `Text6_1`, `Text7_0`, `Text7_1`)
+ (SELECT `ID`, "zhCN", `Text0_0_loc4`, `Text0_1_loc4`, `Text1_0_loc4`, `Text1_1_loc4`, `Text2_0_loc4`, `Text2_1_loc4`, `Text3_0_loc4`, `Text3_1_loc4`, `Text4_0_loc4`, `Text4_1_loc4`, `Text5_0_loc4`, `Text5_1_loc4`, `Text6_0_loc4`, `Text6_1_loc4`, `Text7_0_loc4`, `Text7_1_loc4`
+ FROM `locales_npc_text`
+ WHERE LENGTH(Text0_0_loc4) > 0 && LENGTH(Text0_1_loc4) > 0 && LENGTH(Text1_0_loc4) > 0 && LENGTH(Text1_1_loc4) > 0 && LENGTH(Text2_0_loc4) > 0 && LENGTH(Text2_1_loc4) > 0 && LENGTH(Text3_0_loc4) > 0 && LENGTH(Text3_1_loc4) > 0 && LENGTH(Text4_0_loc4) > 0 && LENGTH(Text4_1_loc4) > 0 && LENGTH(Text5_0_loc4) > 0 && LENGTH(Text5_1_loc4) > 0 && LENGTH(Text6_0_loc4) > 0 && LENGTH(Text6_1_loc4) > 0 && LENGTH(Text7_0_loc4) > 0 && LENGTH(Text7_1_loc4) > 0);
+
+-- zhTW
+INSERT INTO `npc_text_locale` (`ID`, `Locale`, `Text0_0`, `Text0_1`, `Text1_0`, `Text1_1`, `Text2_0`, `Text2_1`, `Text3_0`, `Text3_1`, `Text4_0`, `Text4_1`, `Text5_0`, `Text5_1`, `Text6_0`, `Text6_1`, `Text7_0`, `Text7_1`)
+ (SELECT `ID`, "zhTW", `Text0_0_loc5`, `Text0_1_loc5`, `Text1_0_loc5`, `Text1_1_loc5`, `Text2_0_loc5`, `Text2_1_loc5`, `Text3_0_loc5`, `Text3_1_loc5`, `Text4_0_loc5`, `Text4_1_loc5`, `Text5_0_loc5`, `Text5_1_loc5`, `Text6_0_loc5`, `Text6_1_loc5`, `Text7_0_loc5`, `Text7_1_loc5`
+ FROM `locales_npc_text`
+ WHERE LENGTH(Text0_0_loc5) > 0 && LENGTH(Text0_1_loc5) > 0 && LENGTH(Text1_0_loc5) > 0 && LENGTH(Text1_1_loc5) > 0 && LENGTH(Text2_0_loc5) > 0 && LENGTH(Text2_1_loc5) > 0 && LENGTH(Text3_0_loc5) > 0 && LENGTH(Text3_1_loc5) > 0 && LENGTH(Text4_0_loc5) > 0 && LENGTH(Text4_1_loc5) > 0 && LENGTH(Text5_0_loc5) > 0 && LENGTH(Text5_1_loc5) > 0 && LENGTH(Text6_0_loc5) > 0 && LENGTH(Text6_1_loc5) > 0 && LENGTH(Text7_0_loc5) > 0 && LENGTH(Text7_1_loc5) > 0);
+
+-- esES
+INSERT INTO `npc_text_locale` (`ID`, `Locale`, `Text0_0`, `Text0_1`, `Text1_0`, `Text1_1`, `Text2_0`, `Text2_1`, `Text3_0`, `Text3_1`, `Text4_0`, `Text4_1`, `Text5_0`, `Text5_1`, `Text6_0`, `Text6_1`, `Text7_0`, `Text7_1`)
+ (SELECT `ID`, "esES", `Text0_0_loc6`, `Text0_1_loc6`, `Text1_0_loc6`, `Text1_1_loc6`, `Text2_0_loc6`, `Text2_1_loc6`, `Text3_0_loc6`, `Text3_1_loc6`, `Text4_0_loc6`, `Text4_1_loc6`, `Text5_0_loc6`, `Text5_1_loc6`, `Text6_0_loc6`, `Text6_1_loc6`, `Text7_0_loc6`, `Text7_1_loc6`
+ FROM `locales_npc_text`
+ WHERE LENGTH(Text0_0_loc6) > 0 && LENGTH(Text0_1_loc6) > 0 && LENGTH(Text1_0_loc6) > 0 && LENGTH(Text1_1_loc6) > 0 && LENGTH(Text2_0_loc6) > 0 && LENGTH(Text2_1_loc6) > 0 && LENGTH(Text3_0_loc6) > 0 && LENGTH(Text3_1_loc6) > 0 && LENGTH(Text4_0_loc6) > 0 && LENGTH(Text4_1_loc6) > 0 && LENGTH(Text5_0_loc6) > 0 && LENGTH(Text5_1_loc6) > 0 && LENGTH(Text6_0_loc6) > 0 && LENGTH(Text6_1_loc6) > 0 && LENGTH(Text7_0_loc6) > 0 && LENGTH(Text7_1_loc6) > 0);
+
+-- esMX
+INSERT INTO `npc_text_locale` (`ID`, `Locale`, `Text0_0`, `Text0_1`, `Text1_0`, `Text1_1`, `Text2_0`, `Text2_1`, `Text3_0`, `Text3_1`, `Text4_0`, `Text4_1`, `Text5_0`, `Text5_1`, `Text6_0`, `Text6_1`, `Text7_0`, `Text7_1`)
+ (SELECT `ID`, "esMX", `Text0_0_loc7`, `Text0_1_loc7`, `Text1_0_loc7`, `Text1_1_loc7`, `Text2_0_loc7`, `Text2_1_loc7`, `Text3_0_loc7`, `Text3_1_loc7`, `Text4_0_loc7`, `Text4_1_loc7`, `Text5_0_loc7`, `Text5_1_loc7`, `Text6_0_loc7`, `Text6_1_loc7`, `Text7_0_loc7`, `Text7_1_loc7`
+ FROM `locales_npc_text`
+ WHERE LENGTH(Text0_0_loc7) > 0 && LENGTH(Text0_1_loc7) > 0 && LENGTH(Text1_0_loc7) > 0 && LENGTH(Text1_1_loc7) > 0 && LENGTH(Text2_0_loc7) > 0 && LENGTH(Text2_1_loc7) > 0 && LENGTH(Text3_0_loc7) > 0 && LENGTH(Text3_1_loc7) > 0 && LENGTH(Text4_0_loc7) > 0 && LENGTH(Text4_1_loc7) > 0 && LENGTH(Text5_0_loc7) > 0 && LENGTH(Text5_1_loc7) > 0 && LENGTH(Text6_0_loc7) > 0 && LENGTH(Text6_1_loc7) > 0 && LENGTH(Text7_0_loc7) > 0 && LENGTH(Text7_1_loc7) > 0);
+
+-- ruRU
+INSERT INTO `npc_text_locale` (`ID`, `Locale`, `Text0_0`, `Text0_1`, `Text1_0`, `Text1_1`, `Text2_0`, `Text2_1`, `Text3_0`, `Text3_1`, `Text4_0`, `Text4_1`, `Text5_0`, `Text5_1`, `Text6_0`, `Text6_1`, `Text7_0`, `Text7_1`)
+ (SELECT `ID`, "ruRU", `Text0_0_loc8`, `Text0_1_loc8`, `Text1_0_loc8`, `Text1_1_loc8`, `Text2_0_loc8`, `Text2_1_loc8`, `Text3_0_loc8`, `Text3_1_loc8`, `Text4_0_loc8`, `Text4_1_loc8`, `Text5_0_loc8`, `Text5_1_loc8`, `Text6_0_loc8`, `Text6_1_loc8`, `Text7_0_loc8`, `Text7_1_loc8`
+ FROM `locales_npc_text`
+ WHERE LENGTH(Text0_0_loc8) > 0 && LENGTH(Text0_1_loc8) > 0 && LENGTH(Text1_0_loc8) > 0 && LENGTH(Text1_1_loc8) > 0 && LENGTH(Text2_0_loc8) > 0 && LENGTH(Text2_1_loc8) > 0 && LENGTH(Text3_0_loc8) > 0 && LENGTH(Text3_1_loc8) > 0 && LENGTH(Text4_0_loc8) > 0 && LENGTH(Text4_1_loc8) > 0 && LENGTH(Text5_0_loc8) > 0 && LENGTH(Text5_1_loc8) > 0 && LENGTH(Text6_0_loc8) > 0 && LENGTH(Text6_1_loc8) > 0 && LENGTH(Text7_0_loc8) > 0 && LENGTH(Text7_1_loc8) > 0);
+
+DROP TABLE IF EXISTS `locales_npc_text`;
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 9ccf2544439..ab86079bd6e 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -5559,16 +5559,10 @@ void ObjectMgr::LoadNpcTextLocales()
_npcTextLocaleStore.clear(); // need for reload case
- QueryResult result = WorldDatabase.Query("SELECT ID, "
- "Text0_0_loc1, Text0_1_loc1, Text1_0_loc1, Text1_1_loc1, Text2_0_loc1, Text2_1_loc1, Text3_0_loc1, Text3_1_loc1, Text4_0_loc1, Text4_1_loc1, Text5_0_loc1, Text5_1_loc1, Text6_0_loc1, Text6_1_loc1, Text7_0_loc1, Text7_1_loc1, "
- "Text0_0_loc2, Text0_1_loc2, Text1_0_loc2, Text1_1_loc2, Text2_0_loc2, Text2_1_loc2, Text3_0_loc2, Text3_1_loc1, Text4_0_loc2, Text4_1_loc2, Text5_0_loc2, Text5_1_loc2, Text6_0_loc2, Text6_1_loc2, Text7_0_loc2, Text7_1_loc2, "
- "Text0_0_loc3, Text0_1_loc3, Text1_0_loc3, Text1_1_loc3, Text2_0_loc3, Text2_1_loc3, Text3_0_loc3, Text3_1_loc1, Text4_0_loc3, Text4_1_loc3, Text5_0_loc3, Text5_1_loc3, Text6_0_loc3, Text6_1_loc3, Text7_0_loc3, Text7_1_loc3, "
- "Text0_0_loc4, Text0_1_loc4, Text1_0_loc4, Text1_1_loc4, Text2_0_loc4, Text2_1_loc4, Text3_0_loc4, Text3_1_loc1, Text4_0_loc4, Text4_1_loc4, Text5_0_loc4, Text5_1_loc4, Text6_0_loc4, Text6_1_loc4, Text7_0_loc4, Text7_1_loc4, "
- "Text0_0_loc5, Text0_1_loc5, Text1_0_loc5, Text1_1_loc5, Text2_0_loc5, Text2_1_loc5, Text3_0_loc5, Text3_1_loc1, Text4_0_loc5, Text4_1_loc5, Text5_0_loc5, Text5_1_loc5, Text6_0_loc5, Text6_1_loc5, Text7_0_loc5, Text7_1_loc5, "
- "Text0_0_loc6, Text0_1_loc6, Text1_0_loc6, Text1_1_loc6, Text2_0_loc6, Text2_1_loc6, Text3_0_loc6, Text3_1_loc1, Text4_0_loc6, Text4_1_loc6, Text5_0_loc6, Text5_1_loc6, Text6_0_loc6, Text6_1_loc6, Text7_0_loc6, Text7_1_loc6, "
- "Text0_0_loc7, Text0_1_loc7, Text1_0_loc7, Text1_1_loc7, Text2_0_loc7, Text2_1_loc7, Text3_0_loc7, Text3_1_loc1, Text4_0_loc7, Text4_1_loc7, Text5_0_loc7, Text5_1_loc7, Text6_0_loc7, Text6_1_loc7, Text7_0_loc7, Text7_1_loc7, "
- "Text0_0_loc8, Text0_1_loc8, Text1_0_loc8, Text1_1_loc8, Text2_0_loc8, Text2_1_loc8, Text3_0_loc8, Text3_1_loc1, Text4_0_loc8, Text4_1_loc8, Text5_0_loc8, Text5_1_loc8, Text6_0_loc8, Text6_1_loc8, Text7_0_loc8, Text7_1_loc8 "
- " FROM locales_npc_text");
+ QueryResult result = WorldDatabase.Query("SELECT ID, Locale, "
+ // 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
+ "Text0_0, Text0_1, Text1_0, Text1_1, Text2_0, Text2_1, Text3_0, Text3_1, Text4_0, Text4_1, Text5_0, Text5_1, Text6_0, Text6_1, Text7_0, Text7_1 "
+ "FROM npc_text_locale");
if (!result)
return;
@@ -5577,18 +5571,18 @@ void ObjectMgr::LoadNpcTextLocales()
{
Field* fields = result->Fetch();
- uint32 entry = fields[0].GetUInt32();
+ uint32 id = fields[0].GetUInt32();
+ std::string localeName = fields[1].GetString();
- NpcTextLocale& data = _npcTextLocaleStore[entry];
+ NpcTextLocale& data = _npcTextLocaleStore[id];
+ LocaleConstant locale = GetLocaleByName(localeName);
+ if (locale == LOCALE_enUS)
+ continue;
- for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i)
+ for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
{
- LocaleConstant locale = (LocaleConstant) i;
- for (uint8 j = 0; j < MAX_GOSSIP_TEXT_OPTIONS; ++j)
- {
- AddLocaleString(fields[1 + 8 * 2 * (i - 1) + 2 * j].GetString(), locale, data.Text_0[j]);
- AddLocaleString(fields[1 + 8 * 2 * (i - 1) + 2 * j + 1].GetString(), locale, data.Text_1[j]);
- }
+ AddLocaleString(fields[2 + i * 2].GetString(), locale, data.Text_0[i - 1]);
+ AddLocaleString(fields[3 + i * 2].GetString(), locale, data.Text_1[i - 1]);
}
} while (result->NextRow());