*Fix a crash caused by possess pet. Thanks to nanouniko
--HG-- branch : trunk
This commit is contained in:
+13
-1
@@ -5129,9 +5129,21 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_MOD_POSSESS_PET:
|
||||
{
|
||||
if(m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return SPELL_FAILED_NO_PET;
|
||||
|
||||
Pet *pet = ((Player*)m_caster)->GetPet();
|
||||
if(!pet)
|
||||
return SPELL_FAILED_NO_PET;
|
||||
|
||||
if(pet->GetCharmerGUID())
|
||||
return SPELL_FAILED_CHARMED;
|
||||
break;
|
||||
}
|
||||
case SPELL_AURA_MOD_POSSESS:
|
||||
case SPELL_AURA_MOD_CHARM:
|
||||
case SPELL_AURA_MOD_POSSESS_PET:
|
||||
case SPELL_AURA_AOE_CHARM:
|
||||
{
|
||||
if(m_caster->GetCharmerGUID())
|
||||
|
||||
@@ -6724,6 +6724,7 @@ void AuraEffect::HandleModPossess(bool apply, bool Real, bool /*changeAmount*/)
|
||||
m_target->RemoveCharmedBy(caster);
|
||||
}
|
||||
|
||||
// only one spell has this aura
|
||||
void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount*/)
|
||||
{
|
||||
if(!Real)
|
||||
@@ -6733,10 +6734,11 @@ void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount*
|
||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if(((Player*)caster)->GetPet() != m_target)
|
||||
return;
|
||||
|
||||
if(apply)
|
||||
{
|
||||
if(caster->GetGuardianPet() != m_target)
|
||||
return;
|
||||
m_target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
|
||||
}
|
||||
else
|
||||
@@ -6748,7 +6750,8 @@ void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount*
|
||||
if(!m_target->getVictim())
|
||||
{
|
||||
m_target->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, m_target->GetFollowAngle());
|
||||
m_target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
|
||||
if(m_target->GetCharmInfo())
|
||||
m_target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user