Exemplo n.º 1
0
Arquivo: Totem.cpp Projeto: gc/mangos
void Totem::UnSummon()
{
    CombatStop();

    uint32 maxIdx = GetSpellMaxIndex();

    for (int32 i = maxIdx; i >= 0; --i)
    {
        if (uint32 spellId = GetSpell(i))
            RemoveAurasDueToSpell(spellId);
    }

    if (Unit* owner = GetOwner())
    {
        owner->_RemoveTotem(this);

        for (int32 i = maxIdx; i >= 0; --i)
        {
            if (uint32 spellId = GetSpell(i))
                owner->RemoveAurasDueToSpell(spellId);
        }

        // Remove Sentry Totem aura on totem unsummon
        if (GetEntry() == SENTRY_TOTEM_ENTRY)
            owner->RemoveAurasDueToSpell(6495);

        //remove aura all party members too
        if (owner->GetTypeId() == TYPEID_PLAYER)
        {
            ((Player*)owner)->SendAutoRepeatCancel(this);

            // Not only the player can summon the totem (scripted AI)
            if (Group* pGroup = ((Player*)owner)->GetGroup())
            {
                for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
                {
                    Player* Target = itr->getSource();
                    if (Target && pGroup->SameSubGroup((Player*)owner, Target))
                    {
                        for (int32 i = maxIdx; i >= 0; --i)
                        {
                            if (uint32 spellId = GetSpell(i))
                                Target->RemoveAurasDueToSpell(spellId);
                        }
                    }
                }
            }
        }

        if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
            ((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this);
    }

    // any totem unsummon look like as totem kill, req. for proper animation
    if (isAlive())
        SetDeathState(DEAD);

    AddObjectToRemoveList();
}
Exemplo n.º 2
0
void Totem::UnSummon()
{
    CombatStop();
    for (int i=0; i<MAX_CREATURE_SPELL_DATA_SLOT; ++i)
        if (m_spells[i])
            RemoveAurasDueToSpell(m_spells[i]);

    if (Unit *owner = GetOwner())
    {
        owner->_RemoveTotem(this);
        for (int i=0; i<MAX_CREATURE_SPELL_DATA_SLOT; ++i)
            if (m_spells[i])
                owner->RemoveAurasDueToSpell(m_spells[i]);

        //remove aura all party members too
        if (owner->GetTypeId() == TYPEID_PLAYER)
        {
            ((Player*)owner)->SendAutoRepeatCancel(this);

            // Not only the player can summon the totem (scripted AI)
            if (Group *pGroup = ((Player*)owner)->GetGroup())
            {
                for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
                {
                    Player* Target = itr->getSource();
                    if(Target && pGroup->SameSubGroup((Player*)owner, Target))
                        for (int i=0; i<MAX_CREATURE_SPELL_DATA_SLOT; ++i)
                            if (m_spells[i])
                                Target->RemoveAurasDueToSpell(m_spells[i]);
                }
            }
        }

        if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
            ((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this);
    }

    // any totem unsummon look like as totem kill, req. for proper animation
    if (isAlive())
        SetDeathState(DEAD);

    AddObjectToRemoveList();
}
Exemplo n.º 3
0
void Totem::UnSummon()
{
    SendObjectDeSpawnAnim(GetGUID());

    CombatStop();
    RemoveAurasDueToSpell(GetSpell());

    if (Unit *owner = GetOwner())
    {
        owner->_RemoveTotem(this);
        owner->RemoveAurasDueToSpell(GetSpell());

        //remove aura all party members too
        if (owner->GetTypeId() == TYPEID_PLAYER)
        {
            // Not only the player can summon the totem (scripted AI)
            if (Group *pGroup = ((Player*)owner)->GetGroup())
            {
                for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
                {
                    Player* Target = itr->getSource();
                    if(Target && pGroup->SameSubGroup((Player*)owner, Target))
                        Target->RemoveAurasDueToSpell(GetSpell());
                }
            }
        }

        if (owner->GetTypeId() == TYPEID_UNIT && ((Creature*)owner)->AI())
            ((Creature*)owner)->AI()->SummonedCreatureDespawn((Creature*)this);
    }

    // any totem unsummon look like as totem kill, req. for proper animation
    if (isAlive())
        SetDeathState(DEAD);

    AddObjectToRemoveList();
}