[12049] Let PossessedSummons despawn on Channeled-Aura interrupt

Maybe this mechanic should also be used for normal possessed mobs, but then their special handling must be removed
Also not entirely sure if this a great place for this code to be - but I didn't catch a better suiting one
This commit is contained in:
Schmoozerd 2012-07-16 18:30:41 +02:00
parent 161b18b760
commit f946197259
2 changed files with 32 additions and 2 deletions

View file

@ -4358,8 +4358,38 @@ void Spell::SendInterrupted(uint8 result)
void Spell::SendChannelUpdate(uint32 time) void Spell::SendChannelUpdate(uint32 time)
{ {
if(time == 0) if (time == 0)
{ {
// Reset farsight for some possessing auras of possessed summoned (as they might work with different aura types)
if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_FARSIGHT) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetCharmGuid()
&& !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS) && !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS_PET))
{
Player* player = (Player*)m_caster;
// These Auras are applied to self, so get the possessed first
Unit* possessed = player->GetCharm();
player->SetCharm(NULL);
if (possessed)
player->SetClientControl(possessed, 0);
player->SetMover(NULL);
player->GetCamera().ResetView();
player->RemovePetActionBar();
if (possessed)
{
possessed->clearUnitState(UNIT_STAT_CONTROLLED);
possessed->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
possessed->SetCharmerGuid(ObjectGuid());
// TODO - Requires more specials for target?
// Some possessed might want to despawn?
if (possessed->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id && possessed->GetTypeId() == TYPEID_UNIT)
((Creature*)possessed)->ForcedDespawn();
}
}
m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid()); m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetObjectGuid());
ObjectGuid target_guid = m_caster->GetChannelObjectGuid(); ObjectGuid target_guid = m_caster->GetChannelObjectGuid();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12048" #define REVISION_NR "12049"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__