*Do not consider possessed creatures as pet. Also fix the bug that possessed creature does not display spells.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-25 22:52:08 -05:00
parent 320ac7f91e
commit d971d0121f
11 changed files with 86 additions and 56 deletions

View File

@@ -2985,21 +2985,11 @@ void Spell::finish(bool ok)
// Unsummon summon as possessed creatures on spell cancel
if(IsChanneledSpell(m_spellInfo) && m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (Unit * charm = m_caster->GetCharm())
for(int i = 0; i < 3; ++i)
{
if(m_spellInfo->Effect[i] == SPELL_EFFECT_SUMMON)
if(SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i]))
if(SummonProperties->Category == SUMMON_CATEGORY_POSSESSED)
{
if(charm->GetTypeId() == TYPEID_UNIT)
{
if(((Creature*)charm)->isPet() && ((Pet*)charm)->getPetType() == POSSESSED_PET)
((Pet*)charm)->Remove(PET_SAVE_AS_DELETED);
break;
}
}
}
if(Unit *charm = m_caster->GetCharm())
if(charm->GetTypeId() == TYPEID_UNIT
&& ((Creature*)charm)->HasSummonMask(SUMMON_MASK_PUPPET)
&& charm->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id)
((Puppet*)charm)->UnSummon();
}
// other code related only to successfully finished spells
@@ -4544,7 +4534,7 @@ SpellCastResult Spell::CheckCast(bool strict)
case SUMMON_CATEGORY_PET:
if(m_caster->GetPetGUID())
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
case SUMMON_CATEGORY_POSSESSED:
case SUMMON_CATEGORY_PUPPET:
if(m_caster->GetCharmGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;
break;