*Fix a crash caused by possess pet. Thanks to nanouniko
--HG-- branch : trunk
This commit is contained in:
@@ -147,17 +147,9 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI
|
|||||||
for(int i=0; i<3; ++i)
|
for(int i=0; i<3; ++i)
|
||||||
{
|
{
|
||||||
if(Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[i]))
|
if(Creature *portal = Unit::GetCreature(*m_creature, PortalGUID[i]))
|
||||||
{
|
portal->DisappearAndDie();
|
||||||
portal->SetVisibility(VISIBILITY_OFF);
|
|
||||||
portal->DealDamage(portal, portal->GetMaxHealth());
|
|
||||||
portal->RemoveFromWorld();
|
|
||||||
}
|
|
||||||
if(Creature *portal = Unit::GetCreature(*m_creature, BeamerGUID[i]))
|
if(Creature *portal = Unit::GetCreature(*m_creature, BeamerGUID[i]))
|
||||||
{
|
portal->DisappearAndDie();
|
||||||
portal->SetVisibility(VISIBILITY_OFF);
|
|
||||||
portal->DealDamage(portal, portal->GetMaxHealth());
|
|
||||||
portal->RemoveFromWorld();
|
|
||||||
}
|
|
||||||
PortalGUID[i] = 0;
|
PortalGUID[i] = 0;
|
||||||
BeamTarget[i] = 0;
|
BeamTarget[i] = 0;
|
||||||
}
|
}
|
||||||
@@ -204,9 +196,7 @@ struct TRINITY_DLL_DECL boss_netherspiteAI : public ScriptedAI
|
|||||||
if(Creature *beamer = Unit::GetCreature(*portal, BeamerGUID[j]))
|
if(Creature *beamer = Unit::GetCreature(*portal, BeamerGUID[j]))
|
||||||
{
|
{
|
||||||
beamer->CastSpell(target, PortalBeam[j], false);
|
beamer->CastSpell(target, PortalBeam[j], false);
|
||||||
beamer->SetVisibility(VISIBILITY_OFF);
|
beamer->DisappearAndDie();
|
||||||
beamer->DealDamage(beamer, beamer->GetMaxHealth());
|
|
||||||
beamer->RemoveFromWorld();
|
|
||||||
BeamerGUID[j] = 0;
|
BeamerGUID[j] = 0;
|
||||||
}
|
}
|
||||||
// create new one and start beaming on the target
|
// create new one and start beaming on the target
|
||||||
|
|||||||
@@ -6735,11 +6735,15 @@ 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)
|
//seems it may happen that when removing it is no longer owner's pet
|
||||||
return;
|
//if(((Player*)caster)->GetPet() != m_target)
|
||||||
|
// return;
|
||||||
|
|
||||||
if(apply)
|
if(apply)
|
||||||
{
|
{
|
||||||
|
if(((Player*)caster)->GetPet() != m_target)
|
||||||
|
return;
|
||||||
|
|
||||||
m_target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
|
m_target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -6751,8 +6755,8 @@ 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())
|
//if(m_target->GetCharmInfo())
|
||||||
m_target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
|
// m_target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,8 +526,11 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
|
|||||||
|
|
||||||
// TODO: Unit::SetCharmedBy: 28782 is not in world but 0 is trying to charm it! -> crash
|
// TODO: Unit::SetCharmedBy: 28782 is not in world but 0 is trying to charm it! -> crash
|
||||||
if(!unit->IsInWorld())
|
if(!unit->IsInWorld())
|
||||||
|
{
|
||||||
|
sLog.outCrash("Spell click target %u is not in world!", unit->GetEntry());
|
||||||
|
assert(false);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(unit->GetEntry());
|
SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(unit->GetEntry());
|
||||||
for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
|
for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
|
||||||
|
|||||||
Reference in New Issue
Block a user