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

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-04 17:26:24 -05:00
parent e478030b06
commit c401cb49a4
2 changed files with 12 additions and 7 deletions
+10 -6
View File
@@ -2026,8 +2026,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;
@@ -2043,7 +2043,7 @@ 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->GetCharmerGUID()) if(unit->GetCharmerGUID())
return NULL; return NULL;
@@ -12095,7 +12095,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;
@@ -12181,7 +12183,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();
@@ -12245,7 +12249,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;
+2 -1
View File
@@ -621,7 +621,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))