[7755] Allow mini-pet has been questgivers or gossip holders.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
megamage 2009-05-04 12:03:00 +04:00 committed by VladimirMangos
parent df119a4b59
commit ebafe6a7b9
3 changed files with 14 additions and 9 deletions

View file

@ -1962,8 +1962,8 @@ Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
if(!IsInWorld()) if(!IsInWorld())
return NULL; return NULL;
// exist // exist (we need look pets also for some interaction (quest/etc)
Creature *unit = GetMap()->GetCreature(guid); Creature *unit = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid);
if (!unit) if (!unit)
return NULL; return NULL;
@ -1979,8 +1979,8 @@ Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
if(!unit->isAlive() && (!unit->isSpiritService() || isAlive() )) if(!unit->isAlive() && (!unit->isSpiritService() || isAlive() ))
return NULL; return NULL;
// not allow interaction under control // not allow interaction under control, but allow with own pets
if(unit->GetCharmerOrOwnerGUID()) if(unit->GetCharmerGUID())
return NULL; return NULL;
// not enemy // not enemy
@ -11817,7 +11817,9 @@ void Player::PrepareQuestMenu( uint64 guid )
Object *pObject; Object *pObject;
QuestRelations* pObjectQR; QuestRelations* pObjectQR;
QuestRelations* pObjectQIR; QuestRelations* pObjectQIR;
Creature *pCreature = GetMap()->GetCreature(guid);
// pets also can have quests
Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid);
if( pCreature ) if( pCreature )
{ {
pObject = (Object*)pCreature; pObject = (Object*)pCreature;
@ -11903,7 +11905,9 @@ void Player::SendPreparedQuest( uint64 guid )
qe._Delay = 0; qe._Delay = 0;
qe._Emote = 0; qe._Emote = 0;
std::string title = ""; std::string title = "";
Creature *pCreature = GetMap()->GetCreature(guid);
// need pet case for some quests
Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid);
if( pCreature ) if( pCreature )
{ {
uint32 textid = pCreature->GetNpcTextId(); uint32 textid = pCreature->GetNpcTextId();
@ -11967,7 +11971,7 @@ Quest const * Player::GetNextQuest( uint64 guid, Quest const *pQuest )
QuestRelations* pObjectQR; QuestRelations* pObjectQR;
QuestRelations* pObjectQIR; QuestRelations* pObjectQIR;
Creature *pCreature = GetMap()->GetCreature(guid); Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this,guid);
if( pCreature ) if( pCreature )
{ {
pObject = (Object*)pCreature; pObject = (Object*)pCreature;

View file

@ -611,7 +611,8 @@ void WorldSession::HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket& /*recv
if(IS_CREATURE_GUID(*itr)) if(IS_CREATURE_GUID(*itr))
{ {
Creature *questgiver = GetPlayer()->GetMap()->GetCreature(*itr); // need also pet quests case support
Creature *questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(),*itr);
if(!questgiver || questgiver->IsHostileTo(_player)) if(!questgiver || questgiver->IsHostileTo(_player))
continue; continue;
if(!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) if(!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7754" #define REVISION_NR "7755"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__