diff options
-rw-r--r-- | src/game/Player.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 454e943a61a..b0b49b4f3a4 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -13209,6 +13209,20 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) if (pMenuItemBounds.first == pMenuItemBounds.second && menuId == GetDefaultGossipMenuForSource(pSource)) pMenuItemBounds = objmgr.GetGossipMenuItemsMapBounds(0); + uint32 npcflags = 0; + Creature *pCreature = NULL; + GameObject *pGo = NULL; + + if (pSource->GetTypeId() == TYPEID_UNIT) + { + pCreature = pSource->ToCreature(); + npcflags = pCreature->GetUInt32Value(UNIT_NPC_FLAGS); + if (npcflags & UNIT_NPC_FLAG_QUESTGIVER) + PrepareQuestMenu(pSource->GetGUID()); + } + else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT) + pGo = (GameObject*)pSource; + for (GossipMenuItemsMap::const_iterator itr = pMenuItemBounds.first; itr != pMenuItemBounds.second; ++itr) { bool bCanTalk = true; @@ -13224,19 +13238,11 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId) if (pSource->GetTypeId() == TYPEID_UNIT) { - Creature *pCreature = pSource->ToCreature(); - - uint32 npcflags = pCreature->GetUInt32Value(UNIT_NPC_FLAGS); - if (!(itr->second.npc_option_npcflag & npcflags)) continue; switch(itr->second.option_id) { - case GOSSIP_OPTION_QUESTGIVER: - PrepareQuestMenu(pSource->GetGUID()); - bCanTalk = false; - break; case GOSSIP_OPTION_ARMORER: bCanTalk = false; // added in special mode break; |