void Totem::Update(uint32 update_diff, uint32 time ) { Unit *owner = GetOwner(); if (!owner || !owner->isAlive() || !isAlive()) { UnSummon(); // remove self return; } if (m_duration <= update_diff) { UnSummon(); // remove self return; } else m_duration -= update_diff; // Grounding totem + polymorph = unsummon if(GetCreatureInfo()->Entry == 5925 && HasAuraType(SPELL_AURA_MOD_CONFUSE)) { UnSummon(); // remove self return; } Creature::Update( update_diff, time ); }
void Totem::Update(uint32 time) { if (!m_owner->isAlive() || !isAlive()) { UnSummon(); // remove self return; } if (m_duration <= time) { UnSummon(); // remove self return; } else m_duration -= time; Creature::Update(time); }
void Puppet::Update(uint32 time) { Minion::Update(time); //check if caster is channelling? if (IsInWorld() && !isAlive()) UnSummon(); }
void Totem::Update(uint32 update_diff, uint32 time ) { Unit *owner = GetOwner(); if (!owner || !owner->isAlive() || !isAlive()) { UnSummon(); // remove self return; } if (m_duration <= update_diff) { UnSummon(); // remove self return; } else m_duration -= update_diff; Creature::Update( update_diff, time ); }
void Puppet::Update(uint32 time) { Minion::Update(time); //check if caster is channelling? if (IsInWorld()) { if (!isAlive()) { UnSummon(); // TODO: why long distance .die does not remove it } } }
void Totem::Update( uint32 time ) { Unit *owner = GetOwner(); if (!owner || !owner->isAlive() || !this->isAlive()) { UnSummon(); // remove self return; } if (m_duration <= time) { UnSummon(); // remove self return; } else m_duration -= time; Creature::Update( time ); }
void TempSummon::Update(uint32 diff) { Creature::Update(diff); if (m_deathState == DEAD) { UnSummon(); return; } switch (m_type) { case TEMPSUMMON_MANUAL_DESPAWN: break; case TEMPSUMMON_TIMED_DESPAWN: { if (m_timer <= diff) { UnSummon(); return; } m_timer -= diff; break; } case TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT: { if (!IsInCombat()) { if (m_timer <= diff) { UnSummon(); return; } m_timer -= diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSUMMON_CORPSE_TIMED_DESPAWN: { if (m_deathState == CORPSE) { if (m_timer <= diff) { UnSummon(); return; } m_timer -= diff; } break; } case TEMPSUMMON_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (m_deathState == CORPSE || m_deathState == DEAD) { UnSummon(); return; } break; } case TEMPSUMMON_DEAD_DESPAWN: { if (m_deathState == DEAD) { UnSummon(); return; } break; } case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (m_deathState == CORPSE || m_deathState == DEAD) { UnSummon(); return; } if (!IsInCombat()) { if (m_timer <= diff) { UnSummon(); return; } else m_timer -= diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (m_deathState == DEAD) { UnSummon(); return; } if (!IsInCombat() && IsAlive()) { if (m_timer <= diff) { UnSummon(); return; } else m_timer -= diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } default: UnSummon(); TC_LOG_ERROR("entities.unit", "Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); break; } }
void TemporarySummon::Update( uint32 update_diff, uint32 diff ) { switch(m_type) { case TEMPSUMMON_MANUAL_DESPAWN: break; case TEMPSUMMON_TIMED_DESPAWN: { if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; break; } case TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT: { if (!isInCombat()) { if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSUMMON_CORPSE_TIMED_DESPAWN: { if (IsCorpse()) { if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; } break; } case TEMPSUMMON_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (isDead()) { UnSummon(); return; } break; } case TEMPSUMMON_DEAD_DESPAWN: { if (IsDespawned()) { UnSummon(); return; } break; } case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (isDead()) { UnSummon(); return; } if (m_timer <= update_diff) { UnSummon(); return; } else m_timer -= update_diff; break; } case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (IsDespawned()) { UnSummon(); return; } if (m_timer <= update_diff) { UnSummon(); return; } else m_timer -= update_diff; break; } default: UnSummon(); sLog.outError("Temporary summoned creature (entry: %u) have unknown type %u of ",GetEntry(),m_type); break; } Creature::Update( update_diff, diff ); }
void TemporarySummon::Update(uint32 update_diff, uint32 diff) { switch (m_type) { case TEMPSUMMON_MANUAL_DESPAWN: break; case TEMPSUMMON_TIMED_DESPAWN: { if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; break; } case TEMPSUMMON_TIMED_OOC_DESPAWN: { if (!IsInCombat()) { if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSUMMON_CORPSE_TIMED_DESPAWN: { if (IsCorpse()) { if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; } if (IsDespawned()) { UnSummon(); return; } break; } case TEMPSUMMON_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (IsDead()) { UnSummon(); return; } break; } case TEMPSUMMON_DEAD_DESPAWN: { if (IsDespawned()) { UnSummon(); return; } break; } case TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (IsDead()) { UnSummon(); return; } if (!IsInCombat()) { if (m_timer <= update_diff) { UnSummon(); return; } else m_timer -= update_diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (IsDespawned()) { UnSummon(); return; } if (!IsInCombat() && IsAlive()) { if (m_timer <= update_diff) { UnSummon(); return; } else m_timer -= update_diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (IsDead()) { UnSummon(); return; } if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; break; } case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (IsDespawned()) { UnSummon(); return; } if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; break; } default: UnSummon(); sLog.outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); break; } switch (m_deathState) { case ALIVE: if (m_linkedToOwnerAura & TEMPSUMMON_LINKED_AURA_OWNER_CHECK) { // we have to check if owner still have the required aura Unit* owner = GetCharmerOrOwner(); uint32 const& spellId = GetUInt32Value(UNIT_CREATED_BY_SPELL); if (!owner || !spellId || !owner->HasAura(spellId)) UnSummon(); } break; case DEAD: case CORPSE: if (m_linkedToOwnerAura & TEMPSUMMON_LINKED_AURA_REMOVE_OWNER) { RemoveAuraFromOwner(); m_linkedToOwnerAura = 0; // we dont need to recheck } default: break; } Creature::Update(update_diff, diff); }
void TemporarySpawn::Update(uint32 update_diff, uint32 diff) { switch (m_type) { case TEMPSPAWN_MANUAL_DESPAWN: break; case TEMPSPAWN_TIMED_DESPAWN: { if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; break; } case TEMPSPAWN_TIMED_OOC_DESPAWN: { if (isAlive()) { if (!isInCombat()) { if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; } else if (IsDespawned()) { UnSummon(); return; } break; } case TEMPSPAWN_CORPSE_TIMED_DESPAWN: { if (IsCorpse()) { if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; } if (IsDespawned()) { UnSummon(); return; } break; } case TEMPSPAWN_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (isDead()) { UnSummon(); return; } break; } case TEMPSPAWN_DEAD_DESPAWN: { if (IsDespawned()) { UnSummon(); return; } break; } case TEMPSPAWN_TIMED_OOC_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (isDead()) { UnSummon(); return; } if (!isInCombat()) { if (m_timer <= update_diff) { UnSummon(); return; } else m_timer -= update_diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSPAWN_TIMED_OOC_OR_DEAD_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (IsDespawned()) { UnSummon(); return; } if (!isInCombat() && isAlive() && !GetCharmerGuid()) { if (m_timer <= update_diff) { UnSummon(); return; } else m_timer -= update_diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSPAWN_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (isDead()) { UnSummon(); return; } if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; break; } case TEMPSPAWN_TIMED_OR_DEAD_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (IsDespawned()) { UnSummon(); return; } if (m_timer <= update_diff) { UnSummon(); return; } m_timer -= update_diff; break; } default: UnSummon(); sLog.outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); break; } switch (m_deathState) { case ALIVE: if (m_linkedToOwnerAura & TEMPSPAWN_LINKED_AURA_OWNER_CHECK) { if (!CheckAuraOnOwner()) UnSummon(); } break; case DEAD: case CORPSE: if (m_linkedToOwnerAura & TEMPSPAWN_LINKED_AURA_REMOVE_OWNER) { RemoveAuraFromOwner(); m_linkedToOwnerAura = 0; // we dont need to recheck } default: break; } Creature::Update(update_diff, diff); }
void TempSummon::Update(uint32 diff) { Creature::Update(diff); if (m_deathState == DEAD) { UnSummon(); return; } switch (m_type) { case TEMPSUMMON_MANUAL_DESPAWN: break; case TEMPSUMMON_TIMED_DESPAWN: { if (m_timer <= diff) { if (IsAIEnabled) AI()->JustDespawned(); UnSummon(); return; } m_timer -= diff; break; } case TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT: { if (!isInCombat()) { if (m_timer <= diff) { UnSummon(); return; } m_timer -= diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSUMMON_CORPSE_TIMED_DESPAWN: { if (m_deathState == CORPSE) { if (m_timer <= diff) { UnSummon(); return; } m_timer -= diff; } break; } case TEMPSUMMON_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (m_deathState == CORPSE || m_deathState == DEAD) { UnSummon(); return; } break; } case TEMPSUMMON_DEAD_DESPAWN: { if (m_deathState == DEAD) { UnSummon(); return; } break; } case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (m_deathState == CORPSE || m_deathState == DEAD) { UnSummon(); return; } if (!isInCombat()) { if (m_timer <= diff) { UnSummon(); return; } else m_timer -= diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (m_deathState == DEAD) { UnSummon(); return; } if (!isInCombat() && isAlive()) { if (m_timer <= diff) { UnSummon(); return; } else m_timer -= diff; } else if (m_timer != m_lifetime) m_timer = m_lifetime; break; } default: UnSummon(); sLog->outError(LOG_FILTER_UNITS, "Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type); break; } }
void TemporarySummon::Update(uint32 update_diff, uint32 diff) { TSUpdateActions ua = TSUA_NONE; switch (m_type) { case TEMPSUMMON_MANUAL_DESPAWN: break; case TEMPSUMMON_DEAD_DESPAWN: { if (IsDespawned()) ua = TSUA_UNSUMMON; break; } case TEMPSUMMON_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped if (isDead()) ua = TSUA_UNSUMMON; break; } case TEMPSUMMON_CORPSE_TIMED_DESPAWN: { if (IsDespawned()) ua = TSUA_UNSUMMON; else if (IsCorpse()) ua = TSUA_CHECK_TIMER; break; } case TEMPSUMMON_TIMED_DESPAWN: { ua = TSUA_CHECK_TIMER; break; } case TEMPSUMMON_TIMED_OOC_DESPAWN: { ua = isInCombat() ? TSUA_RESET_TIMER : TSUA_CHECK_TIMER; break; } case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN: { ua = IsDespawned() ? TSUA_UNSUMMON : TSUA_CHECK_TIMER; break; } case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN: { // if m_deathState is DEAD, CORPSE was skipped ua = isDead() ? TSUA_UNSUMMON : TSUA_CHECK_TIMER; break; } case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN: { if (IsDespawned()) ua = TSUA_UNSUMMON; else ua = (!isInCombat() && isAlive()) ? TSUA_CHECK_TIMER : TSUA_RESET_TIMER; break; } case TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN: { if (isDead()) ua = TSUA_UNSUMMON; else ua = isInCombat() ? TSUA_RESET_TIMER : TSUA_CHECK_TIMER; break; } case TEMPSUMMON_LOST_OWNER_DESPAWN: case TEMPSUMMON_DEAD_OR_LOST_OWNER_DESPAWN: { if (m_type == TEMPSUMMON_DEAD_OR_LOST_OWNER_DESPAWN && IsDespawned()) ua = TSUA_UNSUMMON; else if (!GetSummoner()) { m_type = TEMPSUMMON_TIMED_DESPAWN; m_lifetime = DEFAULT_DESPAWN_DELAY; ua = TSUA_RESET_TIMER; } break; } case TEMPSUMMON_TIMED_OR_DEAD_OR_LOST_OWNER_DESPAWN: { ua = (IsDespawned() || !GetSummoner()) ? TSUA_UNSUMMON : TSUA_CHECK_TIMER; break; } case TEMPSUMMON_TIMED_OR_DEAD_OR_LOST_UNIQUENESS_DESPAWN: { ua = IsDespawned() ? TSUA_UNSUMMON : TSUpdateActions(TSUA_CHECK_UNIQUENESS | TSUA_CHECK_TIMER); break; } case TEMPSUMMON_DEAD_OR_LOST_UNIQUENESS_DESPAWN: { ua = IsDespawned() ? TSUA_UNSUMMON : TSUA_CHECK_UNIQUENESS; break; } default: ua = TSUA_UNSUMMON; sLog.outError("Temporary summoned %s have unknown type %u of", GetGuidStr().c_str(), m_type); break; } if (ua & TSUA_RESET_TIMER) { if (m_timer != m_lifetime) m_timer = m_lifetime; } else if (ua & TSUA_CHECK_TIMER) { if (m_timer <= update_diff) ua = TSUA_UNSUMMON; else m_timer -= update_diff; } if (ua & TSUA_CHECK_UNIQUENESS) { std::list<Creature*> tlist; MaNGOS::AllIdenticalObjectsInRangeCheck check(this, GetMap()->GetVisibilityDistance()); MaNGOS::CreatureListSearcher<MaNGOS::AllIdenticalObjectsInRangeCheck> searcher(tlist, check); Cell::VisitGridObjects(this, searcher, GetMap()->GetVisibilityDistance(), true); for (std::list<Creature*>::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr) { Creature* pCre = *itr; if (!pCre || !pCre->isAlive() || !pCre->IsTemporarySummon()) continue; if (((TemporarySummon*)pCre)->GetTempSummonType() == GetTempSummonType() && ((TemporarySummon*)pCre)->GetSummonerGuid() == GetSummonerGuid()) { ua = TSUA_UNSUMMON; break; } } } if (ua & TSUA_UNSUMMON) { UnSummon(); return; } if (!m_isActive) return; Creature::Update(update_diff, diff); }