void Vehicle::Dismiss() { SendObjectDeSpawnAnim(GetGUID()); CombatStop(); CleanupsBeforeDelete(); AddObjectToRemoveList(); }
void TemporarySummon::UnSummon() { CombatStop(); CleanupsBeforeDelete(); AddObjectToRemoveList(); Unit* sum = m_summoner ? ObjectAccessor::GetUnit(*this, m_summoner) : NULL; if (sum && sum->GetTypeId() == TYPEID_UNIT && ((Creature*)sum)->AI()) { ((Creature*)sum)->AI()->SummonedCreatureDespawn(this); } }
void Totem::UnSummon() { SendObjectDeSpawnAnim(GetGUID()); CombatStop(); RemoveAurasDueToSpell(GetSpell()); Unit *owner = this->GetOwner(); if (owner) { // clear owenr's totem slot for(int i = 0; i < MAX_TOTEM; ++i) { if(owner->m_TotemSlot[i]==GetGUID()) { owner->m_TotemSlot[i] = 0; break; } } owner->RemoveAurasDueToSpell(GetSpell()); //remove aura all party members too Group *pGroup = NULL; if (owner->GetTypeId() == TYPEID_PLAYER) { // Not only the player can summon the totem (scripted AI) pGroup = ((Player*)owner)->GetGroup(); if (pGroup) { for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); if(Target && pGroup->SameSubGroup((Player*)owner, Target)) Target->RemoveAurasDueToSpell(GetSpell()); } } } } CleanupsBeforeDelete(); AddObjectToRemoveList(); }
GameObject::~GameObject() { CleanupsBeforeDelete(); }