*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;
|
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_POSSESS:
|
||||||
case SPELL_AURA_MOD_CHARM:
|
case SPELL_AURA_MOD_CHARM:
|
||||||
case SPELL_AURA_MOD_POSSESS_PET:
|
|
||||||
case SPELL_AURA_AOE_CHARM:
|
case SPELL_AURA_AOE_CHARM:
|
||||||
{
|
{
|
||||||
if(m_caster->GetCharmerGUID())
|
if(m_caster->GetCharmerGUID())
|
||||||
|
|||||||
@@ -6724,6 +6724,7 @@ void AuraEffect::HandleModPossess(bool apply, bool Real, bool /*changeAmount*/)
|
|||||||
m_target->RemoveCharmedBy(caster);
|
m_target->RemoveCharmedBy(caster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only one spell has this aura
|
||||||
void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount*/)
|
void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount*/)
|
||||||
{
|
{
|
||||||
if(!Real)
|
if(!Real)
|
||||||
@@ -6733,10 +6734,11 @@ void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount*
|
|||||||
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(((Player*)caster)->GetPet() != m_target)
|
||||||
|
return;
|
||||||
|
|
||||||
if(apply)
|
if(apply)
|
||||||
{
|
{
|
||||||
if(caster->GetGuardianPet() != m_target)
|
|
||||||
return;
|
|
||||||
m_target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
|
m_target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -6748,6 +6750,7 @@ void AuraEffect::HandleModPossessPet(bool apply, bool Real, bool /*changeAmount*
|
|||||||
if(!m_target->getVictim())
|
if(!m_target->getVictim())
|
||||||
{
|
{
|
||||||
m_target->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, m_target->GetFollowAngle());
|
m_target->GetMotionMaster()->MoveFollow(caster, PET_FOLLOW_DIST, m_target->GetFollowAngle());
|
||||||
|
if(m_target->GetCharmInfo())
|
||||||
m_target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
|
m_target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user