diff options
-rw-r--r-- | sql/updates/world/master/2017_11_10_00_world.sql | 52 | ||||
-rw-r--r-- | src/server/game/Conditions/ConditionMgr.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/GossipDef.cpp | 8 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 20 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 127 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.h | 34 |
6 files changed, 144 insertions, 103 deletions
diff --git a/sql/updates/world/master/2017_11_10_00_world.sql b/sql/updates/world/master/2017_11_10_00_world.sql new file mode 100644 index 00000000000..1d788124df5 --- /dev/null +++ b/sql/updates/world/master/2017_11_10_00_world.sql @@ -0,0 +1,52 @@ +-- gossip_menu +ALTER TABLE `gossip_menu` CHANGE `entry` `MenuID` smallint(5) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `gossip_menu` CHANGE `text_id` `TextID` mediumint(8) unsigned NOT NULL DEFAULT '0'; + +-- gossip_menu_option +ALTER TABLE `gossip_menu_option` CHANGE `MenuId` `MenuID` smallint(5) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `gossip_menu_option` CHANGE `OptionIndex` `OptionID` smallint(5) unsigned NOT NULL DEFAULT '0'; + +-- gossip_menu_option_locale +DROP TABLE IF EXISTS `gossip_menu_option_locale`; +CREATE TABLE IF NOT EXISTS `gossip_menu_option_locale` ( + `MenuID` smallint(6) unsigned NOT NULL DEFAULT '0', + `OptionID` smallint(6) unsigned NOT NULL DEFAULT '0', + `Locale` varchar(4) NOT NULL, + `OptionText` text, + `BoxText` text, + PRIMARY KEY (`MenuID`, `OptionID`) +) ENGINE=MYISAM DEFAULT CHARSET=utf8; + +-- koKR +INSERT INTO `gossip_menu_option_locale` (`MenuID`, `OptionID`, `Locale`, `OptionText`, `BoxText`) + (SELECT `menu_id`, `id`, "koKR", `option_text_loc1`, `box_text_loc1` FROM `locales_gossip_menu_option` WHERE LENGTH(option_text_loc1) > 0 || LENGTH(box_text_loc1) > 0); + +-- frFR +INSERT INTO `gossip_menu_option_locale` (`MenuID`, `OptionID`, `Locale`, `OptionText`, `BoxText`) + (SELECT `menu_id`, `id`, "frFR", `option_text_loc2`, `box_text_loc2` FROM `locales_gossip_menu_option` WHERE LENGTH(option_text_loc2) > 0 || LENGTH(box_text_loc2) > 0); + +-- deDE +INSERT INTO `gossip_menu_option_locale` (`MenuID`, `OptionID`, `Locale`, `OptionText`, `BoxText`) + (SELECT `menu_id`, `id`, "deDE", `option_text_loc3`, `box_text_loc3` FROM `locales_gossip_menu_option` WHERE LENGTH(option_text_loc3) > 0 || LENGTH(box_text_loc3) > 0); + +-- zhCN +INSERT INTO `gossip_menu_option_locale` (`MenuID`, `OptionID`, `Locale`, `OptionText`, `BoxText`) + (SELECT `menu_id`, `id`, "zhCN", `option_text_loc4`, `box_text_loc4` FROM `locales_gossip_menu_option` WHERE LENGTH(option_text_loc4) > 0 || LENGTH(box_text_loc4) > 0); + +-- zhTW +INSERT INTO `gossip_menu_option_locale` (`MenuID`, `OptionID`, `Locale`, `OptionText`, `BoxText`) + (SELECT `menu_id`, `id`, "zhTW", `option_text_loc5`, `box_text_loc5` FROM `locales_gossip_menu_option` WHERE LENGTH(option_text_loc5) > 0 || LENGTH(box_text_loc5) > 0); + +-- esES +INSERT INTO `gossip_menu_option_locale` (`MenuID`, `OptionID`, `Locale`, `OptionText`, `BoxText`) + (SELECT `menu_id`, `id`, "esES", `option_text_loc6`, `box_text_loc6` FROM `locales_gossip_menu_option` WHERE LENGTH(option_text_loc6) > 0 || LENGTH(box_text_loc6) > 0); + +-- esMX +INSERT INTO `gossip_menu_option_locale` (`MenuID`, `OptionID`, `Locale`, `OptionText`, `BoxText`) + (SELECT `menu_id`, `id`, "esMX", `option_text_loc7`, `box_text_loc7` FROM `locales_gossip_menu_option` WHERE LENGTH(option_text_loc7) > 0 || LENGTH(box_text_loc7) > 0); + +-- ruRU +INSERT INTO `gossip_menu_option_locale` (`MenuID`, `OptionID`, `Locale`, `OptionText`, `BoxText`) + (SELECT `menu_id`, `id`, "ruRU", `option_text_loc8`, `box_text_loc8` FROM `locales_gossip_menu_option` WHERE LENGTH(option_text_loc8) > 0 || LENGTH(box_text_loc8) > 0); + +DROP TABLE IF EXISTS `locales_gossip_menu_option`; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 1df5f72f718..1f260314a4d 100644 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -1325,9 +1325,9 @@ bool ConditionMgr::addToGossipMenus(Condition* cond) const { for (GossipMenusContainer::iterator itr = pMenuBounds.first; itr != pMenuBounds.second; ++itr) { - if ((*itr).second.entry == cond->SourceGroup && (*itr).second.text_id == uint32(cond->SourceEntry)) + if ((*itr).second.MenuID == cond->SourceGroup && (*itr).second.TextID == uint32(cond->SourceEntry)) { - (*itr).second.conditions.push_back(cond); + (*itr).second.Conditions.push_back(cond); return true; } } @@ -1344,7 +1344,7 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond) const { for (GossipMenuItemsContainer::iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) { - if ((*itr).second.MenuId == cond->SourceGroup && (*itr).second.OptionIndex == uint32(cond->SourceEntry)) + if ((*itr).second.MenuID == cond->SourceGroup && (*itr).second.OptionID == uint32(cond->SourceEntry)) { (*itr).second.Conditions.push_back(cond); return true; diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index fabe6333503..5c5e9f2254f 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -92,13 +92,13 @@ void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, ui for (GossipMenuItemsContainer::const_iterator itr = bounds.first; itr != bounds.second; ++itr) { /// Find the one with the given menu item id. - if (itr->second.OptionIndex != menuItemId) + if (itr->second.OptionID != menuItemId) continue; /// Store texts for localization. std::string strOptionText, strBoxText; - BroadcastTextEntry const* optionBroadcastText = sBroadcastTextStore.LookupEntry(itr->second.OptionBroadcastTextId); - BroadcastTextEntry const* boxBroadcastText = sBroadcastTextStore.LookupEntry(itr->second.BoxBroadcastTextId); + BroadcastTextEntry const* optionBroadcastText = sBroadcastTextStore.LookupEntry(itr->second.OptionBroadcastTextID); + BroadcastTextEntry const* boxBroadcastText = sBroadcastTextStore.LookupEntry(itr->second.BoxBroadcastTextID); /// OptionText if (optionBroadcastText) @@ -132,7 +132,7 @@ void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, ui /// Add menu item with existing method. Menu item id -1 is also used in ADD_GOSSIP_ITEM macro. uint32 optionIndex = AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded); - AddGossipMenuItemData(optionIndex, itr->second.ActionMenuId, itr->second.ActionPoiId, itr->second.TrainerId); + AddGossipMenuItemData(optionIndex, itr->second.ActionMenuID, itr->second.ActionPoiID, itr->second.TrainerId); } } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 23ffee8a2ac..98be38706f0 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -14139,7 +14139,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool bool canTalk = true; if (Creature* creature = source->ToCreature()) { - if (!(itr->second.OptionNpcflag & npcflags)) + if (!(itr->second.OptionNpcFlag & npcflags)) continue; switch (itr->second.OptionType) @@ -14197,7 +14197,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool canTalk = false; break; default: - TC_LOG_ERROR("sql.sql", "Creature entry %u has unknown gossip option %u for menu %u.", creature->GetEntry(), itr->second.OptionType, itr->second.MenuId); + TC_LOG_ERROR("sql.sql", "Creature entry %u has unknown gossip option %u for menu %u.", creature->GetEntry(), itr->second.OptionType, itr->second.MenuID); canTalk = false; break; } @@ -14219,8 +14219,8 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool if (canTalk) { std::string strOptionText, strBoxText; - BroadcastTextEntry const* optionBroadcastText = sBroadcastTextStore.LookupEntry(itr->second.OptionBroadcastTextId); - BroadcastTextEntry const* boxBroadcastText = sBroadcastTextStore.LookupEntry(itr->second.BoxBroadcastTextId); + BroadcastTextEntry const* optionBroadcastText = sBroadcastTextStore.LookupEntry(itr->second.OptionBroadcastTextID); + BroadcastTextEntry const* boxBroadcastText = sBroadcastTextStore.LookupEntry(itr->second.BoxBroadcastTextID); LocaleConstant locale = GetSession()->GetSessionDbLocaleIndex(); if (optionBroadcastText) @@ -14238,20 +14238,20 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool if (!optionBroadcastText) { /// Find localizations from database. - if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionIndex))) + if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID))) ObjectMgr::GetLocaleString(gossipMenuLocale->OptionText, locale, strOptionText); } if (!boxBroadcastText) { /// Find localizations from database. - if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionIndex))) + if (GossipMenuItemsLocale const* gossipMenuLocale = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, itr->second.OptionID))) ObjectMgr::GetLocaleString(gossipMenuLocale->BoxText, locale, strBoxText); } } - menu->GetGossipMenu().AddMenuItem(itr->second.OptionIndex, itr->second.OptionIcon, strOptionText, 0, itr->second.OptionType, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded); - menu->GetGossipMenu().AddGossipMenuItemData(itr->second.OptionIndex, itr->second.ActionMenuId, itr->second.ActionPoiId, itr->second.TrainerId); + menu->GetGossipMenu().AddMenuItem(itr->second.OptionID, itr->second.OptionIcon, strOptionText, 0, itr->second.OptionType, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded); + menu->GetGossipMenu().AddGossipMenuItemData(itr->second.OptionID, itr->second.ActionMenuID, itr->second.ActionPoiID, itr->second.TrainerId); } } } @@ -14423,8 +14423,8 @@ uint32 Player::GetGossipTextId(uint32 menuId, WorldObject* source) for (GossipMenusContainer::const_iterator itr = menuBounds.first; itr != menuBounds.second; ++itr) { - if (sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.conditions)) - textId = itr->second.text_id; + if (sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.Conditions)) + textId = itr->second.TextID; } return textId; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index c2020bbba10..3761fd2b142 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -353,12 +353,8 @@ void ObjectMgr::LoadGossipMenuItemsLocales() _gossipMenuItemsLocaleStore.clear(); // need for reload case - QueryResult result = WorldDatabase.Query("SELECT menu_id, id, " - "option_text_loc1, box_text_loc1, option_text_loc2, box_text_loc2, " - "option_text_loc3, box_text_loc3, option_text_loc4, box_text_loc4, " - "option_text_loc5, box_text_loc5, option_text_loc6, box_text_loc6, " - "option_text_loc7, box_text_loc7, option_text_loc8, box_text_loc8 " - "FROM locales_gossip_menu_option"); + // 0 1 2 3 4 + QueryResult result = WorldDatabase.Query("SELECT MenuID, OptionID, Locale, OptionText, BoxText FROM gossip_menu_option_locale"); if (!result) return; @@ -367,19 +363,21 @@ void ObjectMgr::LoadGossipMenuItemsLocales() { Field* fields = result->Fetch(); - uint16 menuId = fields[0].GetUInt16(); - uint16 id = fields[1].GetUInt16(); - GossipMenuItemsLocale& data = _gossipMenuItemsLocaleStore[MAKE_PAIR32(menuId, id)]; + uint16 menuId = fields[0].GetUInt16(); + uint16 optionId = fields[1].GetUInt16(); + std::string localeName = fields[2].GetString(); + std::string optionText = fields[3].GetString(); + std::string boxText = fields[4].GetString(); - for (uint8 i = OLD_TOTAL_LOCALES - 1; i > 0; --i) - { - LocaleConstant locale = (LocaleConstant) i; - AddLocaleString(fields[2 + 2 * (i - 1)].GetString(), locale, data.OptionText); - AddLocaleString(fields[2 + 2 * (i - 1) + 1].GetString(), locale, data.BoxText); - } - } - while (result->NextRow()); + GossipMenuItemsLocale& data = _gossipMenuItemsLocaleStore[MAKE_PAIR32(menuId, optionId)]; + LocaleConstant locale = GetLocaleByName(localeName); + if (locale == LOCALE_enUS) + continue; + + AddLocaleString(optionText, locale, data.OptionText); + AddLocaleString(boxText, locale, data.BoxText); + } while (result->NextRow()); TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu_option locale strings in %u ms", uint32(_gossipMenuItemsLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); } @@ -442,12 +440,10 @@ void ObjectMgr::LoadCreatureTemplates() } _creatureTemplateStore.rehash(result->GetRowCount()); - uint32 count = 0; do { Field* fields = result->Fetch(); LoadCreatureTemplate(fields); - ++count; } while (result->NextRow()); @@ -455,7 +451,7 @@ void ObjectMgr::LoadCreatureTemplates() for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr) CheckCreatureTemplate(&itr->second); - TC_LOG_INFO("server.loading", ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u creature definitions in %u ms", uint32(_creatureTemplateStore.size()), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadCreatureTemplate(Field* fields) @@ -8798,38 +8794,35 @@ void ObjectMgr::LoadGossipMenu() _gossipMenusStore.clear(); - QueryResult result = WorldDatabase.Query("SELECT entry, text_id FROM gossip_menu"); + + // 0 1 + QueryResult result = WorldDatabase.Query("SELECT MenuID, TextID FROM gossip_menu"); if (!result) { - TC_LOG_ERROR("server.loading", ">> Loaded 0 gossip_menu entries. DB table `gossip_menu` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 gossip_menu IDs. DB table `gossip_menu` is empty!"); return; } - uint32 count = 0; - do { Field* fields = result->Fetch(); GossipMenus gMenu; - gMenu.entry = fields[0].GetUInt16(); - gMenu.text_id = fields[1].GetUInt32(); + gMenu.MenuID = fields[0].GetUInt16(); + gMenu.TextID = fields[1].GetUInt32(); - if (!GetNpcText(gMenu.text_id)) + if (!GetNpcText(gMenu.TextID)) { - TC_LOG_ERROR("sql.sql", "Table gossip_menu entry %u are using non-existing text_id %u", gMenu.entry, gMenu.text_id); + TC_LOG_ERROR("sql.sql", "Table gossip_menu: ID %u is using non-existing TextID %u", gMenu.MenuID, gMenu.TextID); continue; } - _gossipMenusStore.insert(GossipMenusContainer::value_type(gMenu.entry, gMenu)); - - ++count; - } - while (result->NextRow()); + _gossipMenusStore.insert(GossipMenusContainer::value_type(gMenu.MenuID, gMenu)); + } while (result->NextRow()); - TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu IDs in %u ms", uint32(_gossipMenusStore.size()), GetMSTimeDiffToNow(oldMSTime)); } void ObjectMgr::LoadGossipMenuItems() @@ -8840,93 +8833,89 @@ void ObjectMgr::LoadGossipMenuItems() QueryResult result = WorldDatabase.Query( // 0 1 2 3 4 5 6 - "SELECT o.MenuId, o.OptionIndex, o.OptionIcon, o.OptionText, o.OptionBroadcastTextId, o.OptionType, o.OptionNpcflag, " + "SELECT o.MenuID, o.OptionID, o.OptionIcon, o.OptionText, o.OptionBroadcastTextId, o.OptionType, o.OptionNpcflag, " // 7 8 - "oa.ActionMenuId, oa.ActionPoiId, " + "oa.ActionMenuID, oa.ActionPoiID, " // 9 10 11 12 "ob.BoxCoded, ob.BoxMoney, ob.BoxText, ob.BoxBroadcastTextId, " // 13 "ot.TrainerId " "FROM gossip_menu_option o " - "LEFT JOIN gossip_menu_option_action oa ON o.MenuId = oa.MenuId AND o.OptionIndex = oa.OptionIndex " - "LEFT JOIN gossip_menu_option_box ob ON o.MenuId = ob.MenuId AND o.OptionIndex = ob.OptionIndex " - "LEFT JOIN gossip_menu_option_trainer ot ON o.MenuId = ot.MenuId AND o.OptionIndex = ot.OptionIndex " - "ORDER BY o.MenuId, o.OptionIndex"); + "LEFT JOIN gossip_menu_option_action oa ON o.MenuID = oa.MenuID AND o.OptionID = oa.OptionID " + "LEFT JOIN gossip_menu_option_box ob ON o.MenuID = ob.MenuID AND o.OptionID = ob.OptionID " + "LEFT JOIN gossip_menu_option_trainer ot ON o.MenuID = ot.MenuID AND o.OptionID = ot.OptionID " + "ORDER BY o.MenuId, o.OptionID"); if (!result) { - TC_LOG_ERROR("server.loading", ">> Loaded 0 gossip_menu_option entries. DB table `gossip_menu_option` is empty!"); + TC_LOG_ERROR("server.loading", ">> Loaded 0 gossip_menu_option IDs. DB table `gossip_menu_option` is empty!"); return; } - uint32 count = 0; - do { Field* fields = result->Fetch(); GossipMenuItems gMenuItem; - gMenuItem.MenuId = fields[0].GetUInt32(); - gMenuItem.OptionIndex = fields[1].GetUInt32(); + gMenuItem.MenuID = fields[0].GetUInt32(); + gMenuItem.OptionID = fields[1].GetUInt32(); gMenuItem.OptionIcon = fields[2].GetUInt8(); gMenuItem.OptionText = fields[3].GetString(); - gMenuItem.OptionBroadcastTextId = fields[4].GetUInt32(); + gMenuItem.OptionBroadcastTextID = fields[4].GetUInt32(); gMenuItem.OptionType = fields[5].GetUInt32(); - gMenuItem.OptionNpcflag = fields[6].GetUInt64(); - gMenuItem.ActionMenuId = fields[7].GetUInt32(); - gMenuItem.ActionPoiId = fields[8].GetUInt32(); + gMenuItem.OptionNpcFlag = fields[6].GetUInt64(); + gMenuItem.ActionMenuID = fields[7].GetUInt32(); + gMenuItem.ActionPoiID = fields[8].GetUInt32(); gMenuItem.BoxCoded = fields[9].GetBool(); gMenuItem.BoxMoney = fields[10].GetUInt32(); gMenuItem.BoxText = fields[11].GetString(); - gMenuItem.BoxBroadcastTextId = fields[12].GetUInt32(); + gMenuItem.BoxBroadcastTextID = fields[12].GetUInt32(); gMenuItem.TrainerId = fields[13].GetUInt32(); if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX) { - TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuId %u, OptionIndex %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionIcon); + TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuId %u, OptionID %u has unknown icon id %u. Replacing with GOSSIP_ICON_CHAT", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionIcon); gMenuItem.OptionIcon = GOSSIP_ICON_CHAT; } - if (gMenuItem.OptionBroadcastTextId) + if (gMenuItem.OptionBroadcastTextID) { - if (!sBroadcastTextStore.LookupEntry(gMenuItem.OptionBroadcastTextId)) + if (!sBroadcastTextStore.LookupEntry(gMenuItem.OptionBroadcastTextID)) { - TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuId %u, OptionIndex %u has non-existing or incompatible OptionBroadcastTextId %u, ignoring.", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionBroadcastTextId); - gMenuItem.OptionBroadcastTextId = 0; + TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuId %u, OptionID %u has non-existing or incompatible OptionBroadcastTextID %u, ignoring.", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionBroadcastTextID); + gMenuItem.OptionBroadcastTextID = 0; } } if (gMenuItem.OptionType >= GOSSIP_OPTION_MAX) - TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuId %u, OptionIndex %u has unknown option id %u. Option will not be used", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.OptionType); + TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuID %u, OptionID %u has unknown option id %u. Option will not be used", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.OptionType); - if (gMenuItem.ActionPoiId && !GetPointOfInterest(gMenuItem.ActionPoiId)) + if (gMenuItem.ActionPoiID && !GetPointOfInterest(gMenuItem.ActionPoiID)) { - TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuId %u, OptionIndex %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionPoiId); - gMenuItem.ActionPoiId = 0; + TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuID %u, OptionID %u use non-existing action_poi_id %u, ignoring", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.ActionPoiID); + gMenuItem.ActionPoiID = 0; } - if (gMenuItem.BoxBroadcastTextId) + if (gMenuItem.BoxBroadcastTextID) { - if (!sBroadcastTextStore.LookupEntry(gMenuItem.BoxBroadcastTextId)) + if (!sBroadcastTextStore.LookupEntry(gMenuItem.BoxBroadcastTextID)) { - TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuId %u, OptionIndex %u has non-existing or incompatible BoxBroadcastTextId %u, ignoring.", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.BoxBroadcastTextId); - gMenuItem.BoxBroadcastTextId = 0; + TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option` for MenuId %u, OptionID %u has non-existing or incompatible BoxBroadcastTextId %u, ignoring.", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.BoxBroadcastTextID); + gMenuItem.BoxBroadcastTextID = 0; } } if (gMenuItem.TrainerId && !GetTrainer(gMenuItem.TrainerId)) { - TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option_trainer` for MenuId %u, OptionIndex %u use non-existing TrainerId %u, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.TrainerId); + TC_LOG_ERROR("sql.sql", "Table `gossip_menu_option_trainer` for MenuId %u, OptionIndex %u use non-existing TrainerId %u, ignoring", gMenuItem.MenuID, gMenuItem.OptionID, gMenuItem.TrainerId); gMenuItem.TrainerId = 0; } - _gossipMenuItemsStore.insert(GossipMenuItemsContainer::value_type(gMenuItem.MenuId, gMenuItem)); - ++count; - } - while (result->NextRow()); + _gossipMenuItemsStore.insert(GossipMenuItemsContainer::value_type(gMenuItem.MenuID, gMenuItem)); + } while (result->NextRow()); - TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u gossip_menu_option entries in %u ms", uint32(_gossipMenuItemsStore.size()), GetMSTimeDiffToNow(oldMSTime)); } Trainer::Trainer const* ObjectMgr::GetTrainer(uint32 trainerId) const diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 18f24f28df0..f452d8ebb45 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -650,28 +650,28 @@ struct PointOfInterest struct GossipMenuItems { - uint32 MenuId; - uint32 OptionIndex; - uint8 OptionIcon; - std::string OptionText; - uint32 OptionBroadcastTextId; - uint32 OptionType; - uint64 OptionNpcflag; - uint32 ActionMenuId; - uint32 ActionPoiId; - bool BoxCoded; - uint32 BoxMoney; - std::string BoxText; - uint32 BoxBroadcastTextId; - uint32 TrainerId; + uint32 MenuID; + uint32 OptionID; + uint8 OptionIcon; + std::string OptionText; + uint32 OptionBroadcastTextID; + uint32 OptionType; + uint64 OptionNpcFlag; + uint32 ActionMenuID; + uint32 ActionPoiID; + bool BoxCoded; + uint32 BoxMoney; + std::string BoxText; + uint32 BoxBroadcastTextID; + uint32 TrainerId; ConditionContainer Conditions; }; struct GossipMenus { - uint32 entry; - uint32 text_id; - ConditionContainer conditions; + uint32 MenuID; + uint32 TextID; + ConditionContainer Conditions; }; typedef std::multimap<uint32, GossipMenus> GossipMenusContainer; |