1. diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
  2. index 0dac303..ca77d59 100755
  3. --- a/src/game/ObjectMgr.cpp
  4. +++ b/src/game/ObjectMgr.cpp
  5. @@ -9102,6 +9102,71 @@ void ObjectMgr::LoadGossipMenuItems(std::set<uint32>& gossipScriptSet)
  6. {
  7. for (std::set<uint32>::const_iterator itr = menu_ids.begin(); itr != menu_ids.end(); ++itr)
  8. sLog.outErrorDb("Table `gossip_menu` contain unused (in creature or GO or menu options) menu id %u.", *itr);
  9. +
  10. + struct array_associative
  11. + {
  12. + array_associative (uint32 key, const char* value)
  13. + {
  14. + bit = key;
  15. + name = value;
  16. + }
  17. + uint32 bit;
  18. + const char* name;
  19. + };
  20. +
  21. + array_associative array_npcflags[] = {
  22. + array_associative(UNIT_NPC_FLAG_TRAINER, "UNIT_NPC_FLAG_TRAINER"),
  23. + array_associative(UNIT_NPC_FLAG_VENDOR, "UNIT_NPC_FLAG_VENDOR"),
  24. + array_associative(UNIT_NPC_FLAG_FLIGHTMASTER, "UNIT_NPC_FLAG_FLIGHTMASTER"),
  25. + array_associative(UNIT_NPC_FLAG_INNKEEPER, "UNIT_NPC_FLAG_INNKEEPER"),
  26. + array_associative(UNIT_NPC_FLAG_BANKER, "UNIT_NPC_FLAG_BANKER"),
  27. + array_associative(UNIT_NPC_FLAG_PETITIONER, "UNIT_NPC_FLAG_PETITIONER"),
  28. + array_associative(UNIT_NPC_FLAG_TABARDDESIGNER, "UNIT_NPC_FLAG_TABARDDESIGNER"),
  29. + array_associative(UNIT_NPC_FLAG_BATTLEMASTER, "UNIT_NPC_FLAG_BATTLEMASTER"),
  30. + array_associative(UNIT_NPC_FLAG_AUCTIONEER, "UNIT_NPC_FLAG_AUCTIONEER"),
  31. + array_associative(UNIT_NPC_FLAG_STABLEMASTER, "UNIT_NPC_FLAG_STABLEMASTER"),
  32. + array_associative(UNIT_NPC_FLAG_GUILD_BANKER, "UNIT_NPC_FLAG_GUILD_BANKER"),
  33. + };
  34. +
  35. + uint32 gossip_npcflags_all = 0;
  36. + uint32 array_size = sizeof (array_npcflags) / sizeof (array_associative);
  37. + for (uint32 i = 0; i < array_size; ++i)
  38. + {
  39. + gossip_npcflags_all |= array_npcflags[i].bit;
  40. + }
  41. +
  42. + QueryResult* result = WorldDatabase.PQuery (
  43. + "SELECT "
  44. + "`creature_template`.`entry`, `creature_template`.`gossip_menu_id`, (`creature_template`.`npcflag` & %u) &~ BIT_OR(`gossip_menu_option`.`npc_option_npcflag`) AS `flags` "
  45. + "FROM "
  46. + "`creature_template`, `gossip_menu_option` "
  47. + "WHERE "
  48. + "`creature_template`.`gossip_menu_id`>0 "
  49. + "AND `creature_template`.`ScriptName`='' "
  50. + "AND `gossip_menu_option`.`menu_id`=`creature_template`.`gossip_menu_id` "
  51. + "GROUP BY "
  52. + "`creature_template`.`entry`, `creature_template`.`gossip_menu_id` "
  53. + "HAVING "
  54. + "`flags`>0", gossip_npcflags_all);
  55. + if (result)
  56. + {
  57. + BarGoLink bar (result->GetRowCount());
  58. + do
  59. + {
  60. + bar.step();
  61. +
  62. + Field* fields = result->Fetch();
  63. +
  64. + for (uint32 i = 0; i < array_size; ++i)
  65. + {
  66. + if (fields[2].GetUInt32() & array_npcflags[i].bit)
  67. + sLog.outErrorDb("Table `creature_template` with `entry` = %u and `gossip_menu_id` = %u has flag %s in `npcflag` but gossip menu does not have option with that value in `npc_option_npcflag`.", fields[0].GetUInt32(), fields[1].GetUInt32(), array_npcflags[i].name);
  68. + }
  69. + }
  70. + while (result->NextRow());
  71. +
  72. + delete result;
  73. + }
  74. }
  75. sLog.outString();