Index: AIInterface.cpp
===================================================================
--- AIInterface.cpp (revision 1021)
+++ AIInterface.cpp (working copy)
-567,18 +567,19 @@
}
- //Pet Dismiss after a certian ditance away
- /*if(m_AIType == AITYPE_PET && m_PetOwner != NULL)
+ //Pet Dismiss after a certain distance away
+ if(m_AIType == AITYPE_PET && m_PetOwner != NULL)
{
float dist = (m_Unit->GetInstanceID() == m_PetOwner->GetInstanceID()) ?
m_Unit->GetDistanceSq(m_PetOwner) : 99999.0f;
if(dist > 8100.0f) //90 yard away we Dismissed
{
- DismissPet();
+ ((Player*)m_PetOwner)->GetSummon()->Remove(true, true, true);
+ sLog.outString("Pet dismissed; dist. > 90 yards");
return;
}
- }*/
+ }
}
void AIInterface::_UpdateTimer(uint32 p_time)
-1005,41 +1006,6 @@
}
}
-void AIInterface::DismissPet()
-{
- /*
- if(m_AIType != AITYPE_PET)
- return;
-
- if(!m_PetOwner)
- return;
-
- if(m_PetOwner->GetTypeId() != TYPEID_PLAYER)
- return;
-
- if(m_Unit->GetUInt32Value(UNIT_CREATED_BY_SPELL) == 0)
- ((Player*)m_PetOwner)->SetFreePetNo(false, (int)m_Unit->GetUInt32Value(UNIT_FIELD_PETNUMBER));
- ((Player*)m_PetOwner)->SetPet(NULL);
- ((Player*)m_PetOwner)->SetPetName("");
-
- //FIXME:Check hunter pet or not
- //FIXME:Check enslaved creature
- m_PetOwner->SetUInt64Value(UNIT_FIELD_SUMMON, 0);
-
- WorldPacket data;
- data.Initialize(SMSG_PET_SPELLS);
- data << (uint64)0;
- ((Player*)m_PetOwner)->GetSession()->SendPacket(&data);
-
- sEventMgr.RemoveEvents(((Creature*)m_Unit));
- if(m_Unit->IsInWorld())
- {
- m_Unit->RemoveFromWorld();
- }
- //setup an event to delete the Creature
- sEventMgr.AddEvent(((Creature*)this->m_Unit), &Creature::DeleteMe, EVENT_DELETE_TIMER, 1, 1);*/
-}
-
void AIInterface::AttackReaction(Unit* pUnit, uint32 damage_dealt, uint32 spellId)
{
if(m_AIState == STATE_EVADE || m_fleeTimer != 0 || !pUnit
Index: AIInterface.h
===================================================================
--- AIInterface.h (revision 1021)
+++ AIInterface.h (working copy)
-174,7 +174,6 @@
void Init(Unit *un, AIType at, MovementType mt, Unit *owner); // used for pets
Unit *GetUnit() { return m_Unit; }
Unit *GetPetOwner() { return m_PetOwner; }
- void DismissPet();
void SetUnitToFollow(Unit* un) { UnitToFollow = un; };
void SetUnitToFear(Unit* un) { UnitToFear = un; };
void SetFollowDistance(float dist) { FollowDistance = dist; };