From 838b46e33e36eb4b91b86cbfc256eef7e63b4dd5 Mon Sep 17 00:00:00 2001 From: Chazy Chaz Date: Thu, 4 May 2017 17:11:35 +0200 Subject: Core/Misc: Update locales_npc_text to simple system --- src/server/game/Globals/ObjectMgr.cpp | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'src') 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()); -- cgit v1.2.3