void AIUpdate() { ParentClass::AIUpdate(); // Bear Form if(IsTimerFinished(MorphTimer) && GetPhase() == 1) { SetPhase(2, Morph); // Morph into a bear since the spell doesnt work SetDisplayId(21635); // 20 Seconds until switch to Troll Form ResetTimer(MorphTimer, 20000); } // Troll Form else if(IsTimerFinished(MorphTimer) && GetPhase() == 2) { // Remove Bear Form RemoveAura(42377); // Transform back into a Troll SetDisplayId(21631); SetPhase(1); // 45 Seconds until switch to Bear Form ResetTimer(MorphTimer, 45000); Emote("Make way for Nalorakk!", Text_Yell, 12073); } }
void AIUpdate() { if(GetHealthPercent() <= 50 && SerpentForm->mEnabled == true) { CastSpellNowNoScheduling(SerpentForm); SerpentForm->mEnabled = false; LightningBolt->mEnabled = false; DruidsSlumber->mEnabled = false; } // If they dont have serpent form aura then re-enable normal spells else if(SerpentForm->mEnabled == false && !GetUnit()->HasAura(8041)) { LightningBolt->mEnabled = true; DruidsSlumber->mEnabled = true; } if(GetHealthPercent() <= 5 && HealingTouch->mEnabled == true) { // Remove Serpent Form RemoveAura(8041); CastSpellNowNoScheduling(HealingTouch); HealingTouch->mEnabled = false; } ParentClass::AIUpdate(); }
void OnCombatStop(Unit* pTarget) { m_bEnraged = false; RemoveAura(ENRAGESPELL); ParentClass::OnCombatStop(pTarget); };
void AIUpdate() { if (!IsCasting()) { if (IsTimerFinished(mGrowthTimer)) { if (mGrowthStacks == 30) { RemoveAura(GRUUL_THE_DRAGONKILLER_GROWTH); mGrowthStacks = 0; } if (mGrowthStacks != 29) { ResetTimer(mGrowthTimer, 30000); } else if (mGrowthStacks == 29) { ResetTimer(mGrowthTimer, 300000); } ApplyAura(GRUUL_THE_DRAGONKILLER_GROWTH); ++mGrowthStacks; } else if (IsTimerFinished(mHurtfulTimer)) { Unit* pCurrentTarget = _unit->GetAIInterface()->GetNextTarget(); if (pCurrentTarget != NULL) { Unit* pTarget = pCurrentTarget; for (unordered_set<Player*>::iterator itr = _unit->GetInRangePlayerSetBegin(); itr != _unit->GetInRangePlayerSetEnd(); itr++) { Player* pPlayer = TO_PLAYER(*itr); if (!pPlayer->isAlive()) continue; // if (pPlayer->m_auracount[SPELL_AURA_MOD_INVISIBILITY]) // continue; if (pPlayer->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FEIGN_DEATH)) continue; if (GetRangeToUnit(pPlayer) > 8.0f) continue; if (_unit->GetAIInterface()->getThreatByPtr(pPlayer) >= _unit->GetAIInterface()->getThreatByPtr(pCurrentTarget)) continue; pTarget = TO_UNIT(pPlayer); } if (pTarget == pCurrentTarget) CastSpellNowNoScheduling(mHurtfulStrike); else _unit->CastSpell(pTarget, GRUUL_THE_DRAGONKILLER_HURTFUL_STRIKE, true); } ResetTimer(mHurtfulTimer, 8000); } } ParentClass::AIUpdate(); }
void AIUpdate() { if(GetHealthPercent() <= 75 && GetPhase() == 1) { SetPhase(2, HowlingRage1); } else if(GetHealthPercent() <= 45 && GetPhase() == 2) { if(GetUnit()->HasAura(7481)) RemoveAura(7481); SetPhase(3, HowlingRage2); } else if(GetHealthPercent() <= 20 && GetPhase() == 3) { if(GetUnit()->HasAura(7483)) RemoveAura(7483); SetPhase(4, HowlingRage3); } ParentClass::AIUpdate(); }
void UpdateGO() { --mGoCount; if( mGoCount == 0 ) // start encounter { SetCanEnterCombat( true ); RemoveAura( 47543 ); ApplyAura( INTENSE_COLD ); }; };
void OnCombatStop(Unit* pTarget) { if (GetPhase() == 4) RemoveAura(SMITES_HAMMER); if (!IsAlive()) SetWieldWeapon(false); SetPhase(1); SwitchWeapons(); RemoveTimer(mWaitAtChest); ParentClass::OnCombatStop(pTarget); }
void AIUpdate() { if(GetPhase() == 1 && GetHealthPercent() <= (mPhaseRepeat * 25)) { switch(rand() % 2) { case 0: Emote("I'll give you more than you can handle.", Text_Yell, 13321); break; case 1: Emote("There's plenty of me to go around.", Text_Yell, 13322); break; } SetPhase(2); SetCanMove(false); SetAllowRanged(false); SetAllowSpell(false); SetAllowTargeting(false); ApplyAura(60191); for(int i = 0; i < 3; ++i) { mAddArray[i] = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_TELESTRA_FIRE + i, FormSpawns[i].x, FormSpawns[i].y, FormSpawns[i].z, FormSpawns[i].o, true, true, 0, 0); if(mAddArray[i] != NULL) ++mAddCount; } }; if(GetPhase() == 2) { for(int i = 0; i < 3; ++i) { if(mAddArray[i] != NULL) { mAddArray[i]->Despawn(1000, 0); mAddArray[i] = NULL; --mAddCount; } } if(mAddCount != 0) return; Emote("Now to finish the job!", Text_Yell, 13323); RemoveAura(60191); SetCanMove(true); mPhaseRepeat = 1; SetPhase(mHeroic ? 1 : 3); //3 disables p2 }; ParentClass::AIUpdate(); };
void phaseTester() { _unit->Root(); GetAllowMelee(); SetBehavior(Behavior_Spell); if ((HandOfTheDeceiver1 && HandOfTheDeceiver2 && HandOfTheDeceiver3) && (HandOfTheDeceiver1->isDead() && HandOfTheDeceiver2->isDead() && HandOfTheDeceiver3->isDead()) && (GetPhase() != 1) && (GetPhase() != 2) && (starter == 0)) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_EMERGE); _unit->PlaySoundToSet(SOUND_KJ_EMERGE); RemoveAura(42866); _unit->m_invisible = false; starter = 1; } switch(GetPhase()) { case 1: { if(GetHealthPercent()<=85 && phase == 2) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_PHASE3); _unit->PlaySoundToSet(SOUND_KJ_PHASE3); AddPhaseSpell(1, AddSpell(SPELL_SINISTER_REFLECTION, Target_RandomPlayer, 10, 1.5f, 4, 0, 35)); AddPhaseSpell(1, AddSpell(SPELL_SHADOW_SPIKE, Target_RandomDestination, 10, 2.0f, 6, 0, 35)); AddPhaseSpell(1, AddSpell(SPELL_FLAME_DART, Target_RandomPlayer, 10, 1.3f, 4, 0, 35)); ShieldOrb2 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SHIELD_ORB, 1712.00f, 604.00f, 48.00f, 0.00f, true, true, 0, 0); phase++; } if(GetHealthPercent()<=55 && phase == 3) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_PHASE4); _unit->PlaySoundToSet(SOUND_KJ_PHASE4); ShieldOrb3 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SHIELD_ORB, 1684.00f, 651.00f, 48.00f, 0.00f, true, true, 0, 0); dtimmer = 0; phase++; } if(GetHealthPercent()<=25 && phase == 4 && (dtimmer > 54 || dtimmer == 0)) { _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, SAY_KJ_PHASE5); _unit->PlaySoundToSet(SOUND_KJ_PHASE5); ShieldOrb4 = _unit->GetMapMgr()->GetInterface()->SpawnCreature(CN_SHIELD_ORB, 1720.00f, 642.00f, 48.00f, 0.00f, true, true, 0, 0); CastSpellOnTarget(_unit, Target_Self, dbcSpell.LookupEntry(SPELL_SACRIFICE_OF_ANVEENA), true); dtimmer = 0; phase++; } }break; } }
//ex:to remove morph spells void AuraInterface::RemoveAllAurasOfType(uint32 auratype) { for(uint32 x = 0; x < MAX_AURAS; x++) { if(m_auras.find(x) != m_auras.end()) { SpellEntry *proto = NULL; proto = m_auras.at(x)->GetSpellProto(); if(proto != NULL && proto->EffectApplyAuraName[0] == auratype || proto->EffectApplyAuraName[1] == auratype || proto->EffectApplyAuraName[2] == auratype) RemoveAura(m_auras.at(x)->GetSpellId());//remove all morph auras containig to this spell (like wolf motph also gives speed) } } }
bool Aura::Process() { // Aura::Depop clears buffs if (p_depop) return false; auto owner = entity_list.GetMob(m_owner); if (owner == nullptr) { Depop(); return true; } if (remove_timer.Check()) { owner->RemoveAura(GetID(), false, true); return true; } if (movement_type == AuraMovement::Follow && GetPosition() != owner->GetPosition() && movement_timer.Check()) { m_Position = owner->GetPosition(); auto app = new EQApplicationPacket(OP_ClientUpdate, sizeof(PlayerPositionUpdateServer_Struct)); auto spu = (PlayerPositionUpdateServer_Struct*)app->pBuffer; MakeSpawnUpdate(spu); auto it = spawned_for.begin(); while (it != spawned_for.end()) { auto client = entity_list.GetClientByID(*it); if (client) { client->QueuePacket(app); ++it; } else { it = spawned_for.erase(it); } } safe_delete(app); } // TODO: waypoints? if (!process_timer.Check()) return true; if (spawn_type != AuraSpawns::Noone) ProcessSpawns(); // bit of a hack if (process_func) process_func(*this, owner); // TODO: quest calls return true; }
void AIUpdate() { if((GetHealthPercent() <= 76 && summon == 0) || (GetHealthPercent() <= 51 && summon == 2) || (GetHealthPercent() <= 25 && summon == 4)) summon += 1; if(summon == 1 || summon == 3 || summon == 5) Summon(); if( mRift == true && ( pChaoticRift == NULL || !pChaoticRift->isAlive() )) { RemoveAura(47748); mRift = false; }; ParentClass::AIUpdate(); };
void DynamicObject::RemoveFromWorld() { ///- Remove the dynamicObject from the accessor and from all lists of objects in world if (IsInWorld()) { if (m_isViewpoint) RemoveCasterViewpoint(); if (m_aura) RemoveAura(); // dynobj could get removed in Aura::RemoveAura if (!IsInWorld()) return; UnbindFromCaster(); WorldObject::RemoveFromWorld(); sObjectAccessor->RemoveObject(this); } }
void AIUpdate() { if(GetHealthPercent() <= 50 && GetPhase() == 1) { const char * Text = ""; uint32 pSoundID = 0; uint32 Random = rand()%2; switch (Random) { case 0: Text = "I'll give you more than you can handle."; pSoundID = 13321; break; case 1: Text = "There's plenty of me to go around."; pSoundID = 13322; break; } Emote(Text, Text_Yell, pSoundID); SetPhase(2); SetCanMove(false); ApplyAura(60191); pFire = _unit->GetMapMgr()->GetInterface()->SpawnCreature( CN_TELESTRA_FIRE, 494.726990f, 89.128799f, -15.941300f, 6.021390f, true, true, NULL, NULL ); pFrost = _unit->GetMapMgr()->GetInterface()->SpawnCreature( CN_TELESTRA_FROST, 495.006012f, 89.328102f, -16.124609f, 0.027486f, true, true, NULL, NULL ); pArcane = _unit->GetMapMgr()->GetInterface()->SpawnCreature( CN_TELESTRA_ARCANE, 504.798431f, 102.248375f, -16.124609f, 4.629921f, true, true, NULL, NULL ); }; if( GetPhase() == 2 ) { if( ( pFrost != NULL && pFrost->isAlive() ) || ( pFire != NULL && pFire->isAlive() ) || ( pArcane != NULL && pArcane->isAlive() ) ) return; Emote("Now to finish the job!", Text_Yell, 13323); RemoveAura(60191); SetCanMove(true); SetPhase(3); }; ParentClass::AIUpdate(); };
void DynamicObject::RemoveFromWorld() { ///- Remove the dynamicObject from the accessor and from all lists of objects in world if (IsInWorld()) { if (_isViewpoint) RemoveCasterViewpoint(); if (_aura) RemoveAura(); // dynobj could get removed in Aura::RemoveAura if (!IsInWorld()) return; UnbindFromCaster(); WorldObject::RemoveFromWorld(); GetMap()->GetObjectsStore().Remove<DynamicObject>(GetGUID()); } }
void AIUpdate() { if((GetHealthPercent() <= 50 && mSummon == 0)) mSummon += 1; if(mSummon == 1) ChargeRift(); if(IsTimerFinished(mSummonTimer) && mRift == false) { SummonRift(false); ResetTimer(mSummonTimer, IsHeroic() ? 14000 : 18000); }; if(mRift == true && (GetLinkedCreature() == NULL || ! GetLinkedCreature()->IsAlive())) { RemoveAura(47748); mRift = false; }; ParentClass::AIUpdate(); };
bool Player::UpdateAllStats() { for (int8 i = STAT_STRENGTH; i < MAX_STATS; ++i) { float value = GetTotalStatValue(Stats(i)); SetStat(Stats(i), int32(value)); } UpdateArmor(); // calls UpdateAttackPowerAndDamage() in UpdateArmor for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR UpdateAttackPowerAndDamage(true); UpdateMaxHealth(); for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i) UpdateMaxPower(Powers(i)); // Custom MoP script // Jab Override Driver if (GetTypeId() == TYPEID_PLAYER && getClass() == CLASS_MONK) { Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); if (mainItem && mainItem->GetTemplate()->Class == ITEM_CLASS_WEAPON && !HasAura(125660)) { RemoveAura(108561); // 2H Staff Override RemoveAura(115697); // 2H Polearm Override RemoveAura(115689); // D/W Axes RemoveAura(115694); // D/W Maces RemoveAura(115696); // D/W Swords switch (mainItem->GetTemplate()->SubClass) { case ITEM_SUBCLASS_WEAPON_STAFF: CastSpell(this, 108561, true); break; case ITEM_SUBCLASS_WEAPON_POLEARM: CastSpell(this, 115697, true); break; case ITEM_SUBCLASS_WEAPON_AXE: CastSpell(this, 115689, true); break; case ITEM_SUBCLASS_WEAPON_MACE: CastSpell(this, 115694, true); break; case ITEM_SUBCLASS_WEAPON_SWORD: CastSpell(this, 115696, true); break; default: break; } } else if (HasAura(125660)) { RemoveAura(108561); // 2H Staff Override RemoveAura(115697); // 2H Polearm Override RemoveAura(115689); // D/W Axes RemoveAura(115694); // D/W Maces RemoveAura(115696); // D/W Swords } } UpdateAllRatings(); UpdateAllCritPercentages(); UpdateAllSpellCritChances(); UpdateBlockPercentage(); UpdateParryPercentage(); UpdateDodgePercentage(); UpdateSpellDamageAndHealingBonus(); UpdateManaRegen(); UpdateExpertise(BASE_ATTACK); UpdateExpertise(OFF_ATTACK); UpdateExpertise(RANGED_ATTACK); for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) UpdateResistances(i); return true; }
bool Player::UpdateAllStats() { for (int8 i = STAT_STRENGTH; i < MAX_STATS; ++i) { float value = GetTotalStatValue(Stats(i)); SetStat(Stats(i), int32(value)); } UpdateArmor(); // calls UpdateAttackPowerAndDamage() in UpdateArmor for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR UpdateAttackPowerAndDamage(true); UpdateMaxHealth(); for (uint8 i = POWER_MANA; i < MAX_POWERS; ++i) UpdateMaxPower(Powers(i)); // Custom MoP script // Jab Override Driver if (GetTypeId() == TYPEID_PLAYER && getClass() == CLASS_MONK) { Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); if (mainItem && mainItem->GetTemplate()->Class == ITEM_CLASS_WEAPON && !HasAura(125660)) { RemoveAura(108561); // 2H Staff Override RemoveAura(115697); // 2H Polearm Override RemoveAura(115689); // D/W Axes RemoveAura(115694); // D/W Maces RemoveAura(115696); // D/W Swords switch (mainItem->GetTemplate()->SubClass) { case ITEM_SUBCLASS_WEAPON_STAFF: CastSpell(this, 108561, true); break; case ITEM_SUBCLASS_WEAPON_POLEARM: CastSpell(this, 115697, true); break; case ITEM_SUBCLASS_WEAPON_AXE: CastSpell(this, 115689, true); break; case ITEM_SUBCLASS_WEAPON_MACE: CastSpell(this, 115694, true); break; case ITEM_SUBCLASS_WEAPON_SWORD: CastSpell(this, 115696, true); break; default: break; } } else if (HasAura(125660)) { RemoveAura(108561); // 2H Staff Override RemoveAura(115697); // 2H Polearm Override RemoveAura(115689); // D/W Axes RemoveAura(115694); // D/W Maces RemoveAura(115696); // D/W Swords } } // Way of the Monk - 120277 if (GetTypeId() == TYPEID_PLAYER) { if (getClass() == CLASS_MONK && HasAura(120277)) { RemoveAurasDueToSpell(120275); RemoveAurasDueToSpell(108977); uint32 trigger = 0; if (IsTwoHandUsed()) { trigger = 120275; } else { Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (mainItem && mainItem->GetTemplate()->Class == ITEM_CLASS_WEAPON && offItem && offItem->GetTemplate()->Class == ITEM_CLASS_WEAPON) trigger = 108977; } if (trigger) CastSpell(this, trigger, true); } } // Assassin's Resolve - 84601 if (GetTypeId() == TYPEID_PLAYER) { if (getClass() == CLASS_ROGUE && ToPlayer()->GetSpecializationId(ToPlayer()->GetActiveSpec()) == SPEC_ROGUE_ASSASSINATION) { Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (((mainItem && mainItem->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER) || (offItem && offItem->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER))) { if (HasAura(84601)) RemoveAura(84601); CastSpell(this, 84601, true); } else RemoveAura(84601); } } UpdateAllRatings(); UpdateAllCritPercentages(); UpdateAllSpellCritChances(); UpdateBlockPercentage(); UpdateParryPercentage(); UpdateDodgePercentage(); UpdateSpellDamageAndHealingBonus(); UpdateManaRegen(); UpdateExpertise(BASE_ATTACK); UpdateExpertise(OFF_ATTACK); UpdateExpertise(RANGED_ATTACK); for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) UpdateResistances(i); return true; }
void AuraInterface::AddAura(Aura* aur) { uint32 x,delslot = 0; Unit* pCaster = NULLUNIT; if(aur->GetUnitTarget() != NULL) pCaster = aur->GetUnitCaster(); else if( aur->GetCasterGUID() == m_Unit->GetGUID() ) pCaster = m_Unit; else if( m_Unit->GetMapMgr() && aur->GetCasterGUID()) pCaster = m_Unit->GetMapMgr()->GetUnit( aur->GetCasterGUID()); if(pCaster == NULL) return; if( !aur->IsPassive() ) { uint32 maxStack = aur->GetSpellProto()->maxstack; if( m_Unit->IsPlayer() && TO_PLAYER(m_Unit)->stack_cheat ) maxStack = 255; SpellEntry * info = aur->GetSpellProto(); bool deleteAur = false; Aura* curAura = NULLAURA; //check if we already have this aura by this caster -> update duration // Nasty check for Blood Fury debuff (spell system based on namehashes is bs anyways) if( !info->always_apply ) { for( x = 0; x < MAX_AURAS; x++ ) { if(m_auras.find(x) == m_auras.end()) continue; curAura = m_auras.at(x); if( curAura != NULL && !curAura->m_deleted ) { if( curAura->GetSpellProto()->Id != aur->GetSpellId() && ( aur->pSpellId != curAura->GetSpellProto()->Id )) //if this is a proc spell then it should not remove it's mother : test with combustion later { if( info->buffType > 0 && m_auras.at(x)->GetSpellProto()->buffType > 0 && (info->buffType & m_auras.at(x)->GetSpellProto()->buffType) ) { if( m_auras.at(x)->GetSpellProto()->buffType & SPELL_TYPE_BLESSING ) { // stupid blessings // if you have better idea correct bool ispair = false; switch( info->NameHash ) { case SPELL_HASH_BLESSING_OF_MIGHT: case SPELL_HASH_GREATER_BLESSING_OF_MIGHT: { if( m_auras.at(x)->GetSpellProto()->NameHash == SPELL_HASH_BLESSING_OF_MIGHT || m_auras.at(x)->GetSpellProto()->NameHash == SPELL_HASH_GREATER_BLESSING_OF_MIGHT ) ispair = true; }break; case SPELL_HASH_BLESSING_OF_WISDOM: case SPELL_HASH_GREATER_BLESSING_OF_WISDOM: { if( m_auras.at(x)->GetSpellProto()->NameHash == SPELL_HASH_BLESSING_OF_WISDOM || m_auras.at(x)->GetSpellProto()->NameHash == SPELL_HASH_GREATER_BLESSING_OF_WISDOM ) ispair = true; }break; case SPELL_HASH_BLESSING_OF_KINGS: case SPELL_HASH_GREATER_BLESSING_OF_KINGS: { if( m_auras.at(x)->GetSpellProto()->NameHash == SPELL_HASH_BLESSING_OF_KINGS || m_auras.at(x)->GetSpellProto()->NameHash == SPELL_HASH_GREATER_BLESSING_OF_KINGS ) ispair = true; }break; case SPELL_HASH_BLESSING_OF_SANCTUARY: case SPELL_HASH_GREATER_BLESSING_OF_SANCTUARY: { if( m_auras.at(x)->GetSpellProto()->NameHash == SPELL_HASH_BLESSING_OF_SANCTUARY || m_auras.at(x)->GetSpellProto()->NameHash == SPELL_HASH_GREATER_BLESSING_OF_SANCTUARY ) ispair = true; }break; } if( m_auras.at(x)->GetUnitCaster() == aur->GetUnitCaster() || ispair ) { RemoveAuraBySlot(x); continue; } } else if( m_auras.at(x)->GetSpellProto()->buffType & SPELL_TYPE_AURA ) { if( m_auras.at(x)->GetUnitCaster() == aur->GetUnitCaster() || m_auras.at(x)->GetSpellProto()->NameHash == info->NameHash ) { RemoveAuraBySlot(x); continue; } } else { RemoveAuraBySlot(x); continue; } } else if( info->poison_type > 0 && m_auras.at(x)->GetSpellProto()->poison_type == info->poison_type ) { if( m_auras.at(x)->GetSpellProto()->RankNumber < info->RankNumber || maxStack == 0) { RemoveAuraBySlot(x); continue; } else if( m_auras.at(x)->GetSpellProto()->RankNumber > info->RankNumber ) { RemoveAuraBySlot(x); break; } } else if( m_auras.at(x)->GetSpellProto()->NameHash == info->NameHash ) { if( m_auras.at(x)->GetUnitCaster() == aur->GetUnitCaster() ) { RemoveAuraBySlot(x); continue; } else if( m_auras.at(x)->GetSpellProto()->Unique ) { if( m_auras.at(x)->GetSpellProto()->RankNumber < info->RankNumber ) { RemoveAuraBySlot(x); continue; } else { delslot = x; deleteAur = true; break; } } } } else if( curAura->GetSpellId() == aur->GetSpellId() ) { if( !aur->IsPositive() && curAura->GetCasterGUID() != aur->GetCasterGUID() && maxStack == 0 && !info->Unique ) continue; // target already has this aura. Update duration, time left, procCharges curAura->SetDuration(aur->GetDuration()); curAura->SetTimeLeft(aur->GetDuration()); curAura->procCharges = curAura->GetMaxProcCharges(pCaster); curAura->UpdateModifiers(); curAura->ModStackSize(1); // increment stack size return; } } } } if(deleteAur) { sEventMgr.RemoveEvents(aur); RemoveAuraBySlot(delslot); return; } } //////////////////////////////////////////////////////// if( aur->m_auraSlot != 255 && aur->m_auraSlot < TOTAL_AURAS) { if( m_auras.find(aur->m_auraSlot) != m_auras.end() ) RemoveAuraBySlot(aur->m_auraSlot); } aur->m_auraSlot = 255; Unit* target = aur->GetUnitTarget(); if(target == NULL) return; // Should never happen. aur->SetAuraFlags(AFLAG_VISIBLE | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2 | AFLAG_NOT_GUID | (aur->GetDuration() ? AFLAG_HAS_DURATION : AFLAG_NONE) | (aur->IsPositive() ? (AFLAG_POSITIVE) : (AFLAG_NEGATIVE))); aur->SetAuraLevel(aur->GetUnitCaster() != NULL ? aur->GetUnitCaster()->getLevel() : MAXIMUM_ATTAINABLE_LEVEL); if(!aur->IsPassive()) { aur->AddAuraVisual(); if(aur->m_auraSlot == 255) { //add to invisible slot for(x = MAX_AURAS; x < TOTAL_AURAS; x++) { if(m_auras.find(x) == m_auras.end()) { m_auras.insert(make_pair(x, aur)); aur->m_auraSlot = x; break; } } if(aur->m_auraSlot == 255) { DEBUG_LOG("Unit","AddAura error in active aura. removing. SpellId: %u", aur->GetSpellProto()->Id); RemoveAura(aur); return; } } else { m_auras.insert(make_pair(aur->m_auraSlot, aur)); } } else { if(aur->m_spellProto->AttributesEx & 1024) aur->AddAuraVisual(); for(x = MAX_AURAS; x < TOTAL_AURAS; x++) { if(m_auras.find(x) == m_auras.end()) { m_auras.insert(make_pair(x, aur)); aur->m_auraSlot = x; break; } } if(aur->m_auraSlot == 255) { DEBUG_LOG("Unit","AddAura error in passive aura. removing. SpellId: %u", aur->GetSpellProto()->Id); RemoveAura(aur); return; } } if(aur->GetSpellId() == 15007) //Resurrection sickness { aur->SetNegative(100); //we're negative aur->SetDuration(target->getLevel() > 19 ? 600000 : 60000); } aur->ApplyModifiers(true); // We add 500ms here to allow for the last tick in DoT spells. This is a dirty hack, but at least it doesn't crash like my other method. // - Burlex, Crow: Changed to 400ms if(aur->GetDuration() > 0) { uint32 addTime = 400; for(uint32 spx = 0; spx < 3; spx++) { if( aur->GetSpellProto()->EffectApplyAuraName[spx] == SPELL_AURA_MOD_STUN || aur->GetSpellProto()->EffectApplyAuraName[spx] == SPELL_AURA_MOD_FEAR || aur->GetSpellProto()->EffectApplyAuraName[spx] == SPELL_AURA_MOD_ROOT || aur->GetSpellProto()->EffectApplyAuraName[spx] == SPELL_AURA_MOD_CHARM ) addTime = 50; } sEventMgr.AddAuraEvent(m_Unit, &Unit::RemoveAuraBySlot, uint8(aur->m_auraSlot), aur->GetDuration() + addTime, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT | EVENT_FLAG_DELETES_OBJECT, aur->GetSpellId()); } aur->RelocateEvents(); // Send log to client if (target != NULL) { //send the aura log WorldPacket data(SMSG_AURACASTLOG, 28); data << aur->GetCasterGUID(); data << aur->GetTargetGUID(); data << aur->m_spellProto->Id; data << uint64(0); target->SendMessageToSet(&data, true); } m_Unit->m_chargeSpellsInUse = true; if( aur->procCharges > 0 && !(aur->GetSpellProto()->procflags2 & PROC_REMOVEONUSE)) m_Unit->m_chargeSpells.push_back(aur); m_Unit->m_chargeSpellsInUse = false; aur->m_added = true; // Reaction from enemy AI if( !aur->IsPositive() && CanAgroHash( aur->GetSpellProto()->NameHash ) ) { if(pCaster != NULL && m_Unit->isAlive()) { pCaster->CombatStatus.OnDamageDealt(TO_UNIT(this), 1); if(m_Unit->IsCreature()) m_Unit->GetAIInterface()->AttackReaction(pCaster, 1, aur->GetSpellId()); } } if (aur->GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_ON_INVINCIBLE) { if( pCaster != NULL ) { pCaster->RemoveStealth(); pCaster->RemoveInvisibility(); pCaster->m_AuraInterface.RemoveAllAurasByNameHash(SPELL_HASH_ICE_BLOCK, false); pCaster->m_AuraInterface.RemoveAllAurasByNameHash(SPELL_HASH_DIVINE_SHIELD, false); pCaster->m_AuraInterface.RemoveAllAurasByNameHash(SPELL_HASH_BLESSING_OF_PROTECTION, false); } } }
void Vehicle::RemovePassenger(Unit* pPassenger) { if(pPassenger == NULL) // We have enough problems that we need to do this :( return; uint8 slot = pPassenger->GetSeatID(); pPassenger->SetVehicle(NULL); pPassenger->SetSeatID(NULL); pPassenger->RemoveFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_UNKNOWN_5 | UNIT_FLAG_PREPARATION | UNIT_FLAG_NOT_SELECTABLE)); if( pPassenger->IsPlayer() && TO_PLAYER(pPassenger)->m_MountSpellId != m_mountSpell ) pPassenger->RemoveAura(TO_PLAYER(pPassenger)->m_MountSpellId); if( m_mountSpell ) pPassenger->RemoveAura( m_mountSpell ); if( m_CastSpellOnMount ) pPassenger->RemoveAura( m_CastSpellOnMount ); WorldPacket data(SMSG_MONSTER_MOVE, 85); data << pPassenger->GetNewGUID(); // PlayerGUID data << uint8(0x40); // Unk - blizz uses 0x40 data << pPassenger->GetPosition(); // Player Position xyz data << getMSTime(); // Timestamp data << uint8(0x4); // Flags data << pPassenger->GetOrientation(); // Orientation data << uint32(MOVEFLAG_AIR_SUSPENSION); // MovementFlags data << uint32(0); // MovementTime data << uint32(1); // Pointcount data << GetPosition(); // Vehicle Position xyz SendMessageToSet(&data, false); pPassenger->movement_info.flags &= ~MOVEFLAG_TAXI; pPassenger->movement_info.transX = 0; pPassenger->movement_info.transY = 0; pPassenger->movement_info.transZ = 0; pPassenger->movement_info.transO = 0; pPassenger->movement_info.transTime = 0; pPassenger->movement_info.transSeat = 0; pPassenger->movement_info.transGuid = WoWGuid(uint64(NULL)); if(pPassenger->IsPlayer()) { Player* plr = TO_PLAYER(pPassenger); if(plr == GetControllingUnit()) { plr->m_CurrentCharm = NULL; data.Initialize(SMSG_CLIENT_CONTROL_UPDATE); data << GetNewGUID() << (uint8)0; plr->GetSession()->SendPacket(&data); } RemoveFlag(UNIT_FIELD_FLAGS, (UNIT_FLAG_PLAYER_CONTROLLED_CREATURE | UNIT_FLAG_PLAYER_CONTROLLED)); plr->SetPlayerStatus(TRANSFER_PENDING); // We get an ack later, if we don't set this now, we get disconnected. sEventMgr.AddEvent(plr, &Player::CheckPlayerStatus, (uint8)TRANSFER_PENDING, EVENT_PLAYER_CHECK_STATUS_Transfer, 5000, 0, 0); plr->m_sentTeleportPosition.ChangeCoords(GetPositionX(), GetPositionY(), GetPositionZ()); plr->SetPosition(GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); data.Initialize(MSG_MOVE_TELEPORT_ACK); data << plr->GetNewGUID(); data << plr->m_teleportAckCounter; plr->m_teleportAckCounter++; data << uint32(MOVEFLAG_FLYING); data << uint16(0x40); data << getMSTime(); data << GetPositionX(); data << GetPositionY(); data << GetPositionZ(); data << GetOrientation(); data << uint32(0); plr->GetSession()->SendPacket(&data); plr->SetUInt64Value( PLAYER_FARSIGHT, 0 ); data.Initialize(SMSG_PET_DISMISS_SOUND); data << uint32(m_vehicleSeats[slot]->m_exitUISoundID); data << plr->GetPosition(); plr->GetSession()->SendPacket(&data); data.Initialize(SMSG_PET_SPELLS); data << uint64(0); data << uint32(0); plr->GetSession()->SendPacket(&data); CreatureProtoVehicle* vehicleproto = CreatureProtoVehicleStorage.LookupEntry(GetEntry()); if(vehicleproto && vehicleproto->healthfromdriver) { if(slot == 0) { uint32 health = GetUInt32Value(UNIT_FIELD_HEALTH); uint32 maxhealth = GetUInt32Value(UNIT_FIELD_MAXHEALTH); uint32 protomaxhealth = GetProto()->MaxHealth; uint32 healthdiff = maxhealth - health; uint32 plritemlevel = plr->GetTotalItemLevel(); uint32 convrate = vehicleproto->healthunitfromitemlev; if(plritemlevel != 0 && convrate != 0) { uint32 healthloss = healthdiff+plritemlevel*convrate; SetUInt32Value(UNIT_FIELD_HEALTH, GetProto()->MaxHealth - healthloss); } else if(protomaxhealth > healthdiff) SetUInt32Value(UNIT_FIELD_HEALTH, protomaxhealth-healthdiff); else SetUInt32Value(UNIT_FIELD_HEALTH, 1); SetUInt32Value(UNIT_FIELD_MAXHEALTH, protomaxhealth); } } } if(slot == 0) { m_redirectSpellPackets = NULLPLR; CombatStatus.Vanished(); pPassenger->SetUInt64Value( UNIT_FIELD_CHARM, 0 ); SetUInt64Value(UNIT_FIELD_CHARMEDBY, 0); if(!m_faction || m_faction->ID == 35 || m_faction->ID == 2105) SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, GetCharmTempVal()); RemoveAura(62064); } SendHeartBeatMsg(false); m_passengers[slot] = NULL; pPassenger->m_TransporterGUID = NULL; // We need to null this out if(pPassenger->IsPlayer()) --m_ppassengerCount; //note: this is not blizz like we should despawn //and respawn at spawn point. //Well actually this is how blizz wanted it //but they couldnt get it to work xD bool haspassengers = false; for(uint8 i = 0; i < m_seatSlotMax; i++) { if(m_passengers[i] != NULL && m_passengers[i]->IsPlayer()) { haspassengers = true; break; } } if(!haspassengers && !GetVehicle()) // Passenger and accessory checks. { if( m_spawn == NULL ) SafeDelete(); } if(!IsFull()) SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); if(canFly()) DisableFlight(); _setFaction(); }
void AIUpdate() { if ((HandOfTheDeceiver1 && HandOfTheDeceiver2 && HandOfTheDeceiver3 && HandOfTheDeceiver4) && (HandOfTheDeceiver1->isDead() || HandOfTheDeceiver2->isDead() || HandOfTheDeceiver3->isDead() || HandOfTheDeceiver4->isDead()) && (GetPhase() != 1)) { RemoveAura(46410); } if ((HandOfTheDeceiver1 && HandOfTheDeceiver2 && HandOfTheDeceiver3 && HandOfTheDeceiver4) && (HandOfTheDeceiver1->isDead() && HandOfTheDeceiver2->isDead() && HandOfTheDeceiver3->isDead() && HandOfTheDeceiver4->isDead()) && (GetPhase() != 1) && (GetPhase() != 2)) { SetPhase(1); _unit->SetUInt64Value(UNIT_FIELD_FLAGS, ( true ) ? 0 : UNIT_FLAG_NOT_ATTACKABLE_9); _unit->GetAIInterface()->SetAllowedToEnterCombat(true); RemoveAura(46367); ShieldOrb1 = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(CN_SHIELD_ORB, 1678.00f, 610.00f, 28.00f, 0.00f, false, 0, 0); } if (ShieldOrb1) { //ShieldOrb1->CastSpell(ShShadowbolt); } if (ShieldOrb2) { //ShieldOrb2->CastSpell(ShShadowbolt); } if (ShieldOrb3) { //ShieldOrb3->CastSpell(ShShadowbolt); } if (ShieldOrb4) { //ShieldOrb4->CastSpell(ShShadowbolt); } switch (dtimmer) { case 100: { dtimmer++; if (GetHealthPercent()<=85) { SetPhase(2); SetAllowMelee(false); SetCanMove(false); _unit->SendChatMessage(CHAT_MSG_MONSTER_YELL, LANG_UNIVERSAL, "Kil'jaeden begins to channel dark energy"); } }break; case 120: { dtimmer++; if (GetPhase() == 2) CastSpellOnTarget(_unit, Target_RandomPlayer, Darkness_explosion, true); //CastSpellOnTarget(_unit, Target_RandomPlayer, Darkness, true); //this is the correct, but the dragon doesn't work. SetAllowMelee(false); SetCanMove(false); }break; case 128: { SetPhase(1); SetAllowMelee(false); SetCanMove(false); dtimmer = 1; }break; default: { SetCanMove(false); SetAllowMelee(false); dtimmer++; }break; } switch(GetPhase()) { case 1: { if(GetHealthPercent()<=85) { AddPhaseSpell(1, AddSpell(SINISTER_REFLECTION, Target_RandomPlayer, 10, 1.5f, 4, 0, 35)); AddPhaseSpell(1, AddSpell(SHADOW_SPIKE, Target_RandomDestination, 10, 2.0f, 6, 0, 35)); AddPhaseSpell(1, AddSpell(FLAME_DART_EXPLOSION, Target_RandomPlayer, 10, 1.3f, 4, 0, 35)); ShieldOrb1 = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(CN_SHIELD_ORB, 1678.00f, 610.00f, 28.00f, -1.72788f, false, 0, 0); } if(GetHealthPercent()<=55) { ShieldOrb1 = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(CN_SHIELD_ORB, 1684.00f, 651.00f, 28.00f, 0.00f, false, 0, 0); } if(GetHealthPercent()<=25) { //Armageddon ShieldOrb1 = _unit->GetMapMgr()->GetInterface()->SpawnGameObject(CN_SHIELD_ORB, 1720.00f, 642.00f, 28.00f, 0.00f, false, 0, 0); AddPhaseSpell(1, AddSpell(SACRIFICE_OF_ANVEENA, Target_RandomPlayer, 50, 0.5f, 10, 0, 35)); } }break; } ParentClass::AIUpdate(); }
bool Creature::RemoveEnslave() { return RemoveAura(m_enslaveSpell); }
void StartEncounter() { RemoveAura( 46410 ); SpawnCreature( CN_KILJADEN, false ); };
void Release() { SetCanEnterCombat(true); RemoveAura(47543); ApplyAura(INTENSE_COLD); };