aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/creature/mob_event_ai.cpp5
-rw-r--r--src/bindings/scripts/scripts/examples/example_escort.cpp2
-rw-r--r--src/bindings/scripts/scripts/item/item_scripts.cpp2
-rw-r--r--src/bindings/scripts/scripts/npc/npc_innkeeper.cpp4
-rw-r--r--src/bindings/scripts/scripts/npc/npcs_special.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp10
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp18
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/blackwing_lair/boss_chromaggus.cpp10
-rw-r--r--src/bindings/scripts/scripts/zone/blackwing_lair/boss_ebonroc.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/bloodmyst_isle/bloodmyst_isle.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/dark_portal.cpp12
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp18
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp30
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp20
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp22
-rw-r--r--src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp6
-rw-r--r--src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp15
-rw-r--r--src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp8
-rw-r--r--src/bindings/scripts/scripts/zone/undercity/undercity.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp2
-rw-r--r--src/game/AuctionHouseHandler.cpp14
-rw-r--r--src/game/BattleGround.cpp6
-rw-r--r--src/game/CharacterHandler.cpp2
-rw-r--r--src/game/ChatHandler.cpp10
-rw-r--r--src/game/Creature.cpp5
-rw-r--r--src/game/CreatureAI.cpp6
-rw-r--r--src/game/DBCStructure.h42
-rw-r--r--src/game/DynamicObject.cpp2
-rw-r--r--src/game/GridNotifiers.h2
-rw-r--r--src/game/GridNotifiersImpl.h3
-rw-r--r--src/game/GroupHandler.cpp19
-rw-r--r--src/game/GuardAI.cpp2
-rw-r--r--src/game/GuildHandler.cpp2
-rw-r--r--src/game/ItemHandler.cpp6
-rw-r--r--src/game/Level0.cpp2
-rw-r--r--src/game/Level3.cpp68
-rw-r--r--src/game/MiscHandler.cpp6
-rw-r--r--src/game/MovementHandler.cpp4
-rw-r--r--src/game/NPCHandler.cpp30
-rw-r--r--src/game/Object.cpp12
-rw-r--r--src/game/OutdoorPvPSI.cpp4
-rw-r--r--src/game/Pet.cpp120
-rw-r--r--src/game/PetitionsHandler.cpp4
-rw-r--r--src/game/Player.cpp336
-rw-r--r--src/game/Player.h6
-rw-r--r--src/game/QuestHandler.cpp2
-rw-r--r--src/game/SkillHandler.cpp2
-rw-r--r--src/game/Spell.cpp167
-rw-r--r--src/game/Spell.h4
-rw-r--r--src/game/SpellAuraDefines.h1
-rw-r--r--src/game/SpellAuras.cpp2689
-rw-r--r--src/game/SpellAuras.h310
-rw-r--r--src/game/SpellEffects.cpp414
-rw-r--r--src/game/SpellHandler.cpp2
-rw-r--r--src/game/SpellMgr.cpp43
-rw-r--r--src/game/SpellMgr.h8
-rw-r--r--src/game/StatSystem.cpp52
-rw-r--r--src/game/TaxiHandler.cpp4
-rw-r--r--src/game/Unit.cpp2020
-rw-r--r--src/game/Unit.h122
-rw-r--r--src/game/WorldSession.cpp2
95 files changed, 3206 insertions, 3647 deletions
diff --git a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
index 095632c653b..ed0e8d2a0a7 100644
--- a/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
+++ b/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
@@ -666,9 +666,8 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
// If cast flag CAST_AURA_NOT_PRESENT is active, check if target already has aura on them
if(param3 & CAST_AURA_NOT_PRESENT)
{
- for(uint8 i = 0; i < 3; ++i)
- if(target->HasAura(param1, i))
- return;
+ if(target->HasAura(param1))
+ return;
}
if (canCast)
diff --git a/src/bindings/scripts/scripts/examples/example_escort.cpp b/src/bindings/scripts/scripts/examples/example_escort.cpp
index 46c80de652d..1cc5356a9ac 100644
--- a/src/bindings/scripts/scripts/examples/example_escort.cpp
+++ b/src/bindings/scripts/scripts/examples/example_escort.cpp
@@ -138,7 +138,7 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI
if (IsBeingEscorted)
if (ChatTimer < diff)
{
- if (m_creature->HasAura(3593, 0))
+ if (m_creature->HasAura(3593))
{
DoScriptText(SAY_RAND_1, m_creature);
m_creature->CastSpell(m_creature, 11540, false);
diff --git a/src/bindings/scripts/scripts/item/item_scripts.cpp b/src/bindings/scripts/scripts/item/item_scripts.cpp
index b749b5f087f..0d09d7a67ed 100644
--- a/src/bindings/scripts/scripts/item/item_scripts.cpp
+++ b/src/bindings/scripts/scripts/item/item_scripts.cpp
@@ -223,7 +223,7 @@ bool ItemUse_item_flying_machine(Player *player, Item* _Item, SpellCastTargets c
bool ItemUse_item_gor_dreks_ointment(Player *player, Item* _Item, SpellCastTargets const& targets)
{
if( targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId()==TYPEID_UNIT &&
- targets.getUnitTarget()->GetEntry() == 20748 && !targets.getUnitTarget()->HasAura(32578,0) )
+ targets.getUnitTarget()->GetEntry() == 20748 && !targets.getUnitTarget()->HasAura(32578) )
return false;
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,_Item,NULL);
diff --git a/src/bindings/scripts/scripts/npc/npc_innkeeper.cpp b/src/bindings/scripts/scripts/npc/npc_innkeeper.cpp
index 7e01a85719d..ccd2b69f8bf 100644
--- a/src/bindings/scripts/scripts/npc/npc_innkeeper.cpp
+++ b/src/bindings/scripts/scripts/npc/npc_innkeeper.cpp
@@ -52,7 +52,7 @@ bool GossipHello_npc_innkeeper(Player *player, Creature *_Creature)
if (_Creature->isQuestGiver())
player->PrepareQuestMenu( _Creature->GetGUID() );
- if (isEventActive()&& !player->GetAura(SPELL_TRICK_OR_TREATED,0))
+ if (isEventActive()&& !player->GetAura(SPELL_TRICK_OR_TREATED, player->GetGUID()))
{
char* localizedEntry;
switch (player->GetSession()->GetSessionDbLocaleIndex())
@@ -83,7 +83,7 @@ bool GossipHello_npc_innkeeper(Player *player, Creature *_Creature)
bool GossipSelect_npc_innkeeper(Player *player, Creature *_Creature, uint32 sender, uint32 action )
{
- if (action == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && isEventActive() && !player->GetAura(SPELL_TRICK_OR_TREATED,0))
+ if (action == GOSSIP_ACTION_INFO_DEF+HALLOWEEN_EVENTID && isEventActive() && !player->GetAura(SPELL_TRICK_OR_TREATED, player->GetGUID()))
{
player->CLOSE_GOSSIP_MENU();
player->CastSpell(player, SPELL_TRICK_OR_TREATED, true);
diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp
index a0023fb1c53..517cf391893 100644
--- a/src/bindings/scripts/scripts/npc/npcs_special.cpp
+++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp
@@ -199,7 +199,7 @@ bool ReceiveEmote_npc_dancing_flames( Player *player, Creature *flame, uint32 em
case TEXTEMOTE_JOKE: flame->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break;
case TEXTEMOTE_DANCE:
{
- if (!player->HasAura(SPELL_SEDUCTION,0))
+ if (!player->HasAura(SPELL_SEDUCTION))
flame->CastSpell(player,SPELL_SEDUCTION,true);
}
break;
@@ -1213,7 +1213,7 @@ CreatureAI* GetAI_npc_tonk_mine(Creature *_Creature)
bool ReceiveEmote_npc_winter_reveler( Player *player, Creature *_Creature, uint32 emote )
{
//TODO: check auralist.
- if(player->HasAura(26218, 0))
+ if(player->HasAura(26218))
return false;
if( emote == TEXTEMOTE_KISS )
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp
index f771cb94ad9..6c64a255370 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp
@@ -80,7 +80,7 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI
if (pInstance->GetData(TYPE_OVERSEER) == DONE)
{
- if (m_creature->HasAura(SPELL_BANISH,0))
+ if (m_creature->HasAura(SPELL_BANISH))
m_creature->RemoveAurasDueToSpell(SPELL_BANISH);
Intro = true;
}
@@ -89,7 +89,7 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI
void MoveInLineOfSight(Unit *who)
{
- if (m_creature->HasAura(SPELL_BANISH,0))
+ if (m_creature->HasAura(SPELL_BANISH))
return;
ScriptedAI::MoveInLineOfSight(who);
@@ -105,7 +105,7 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI
{
DoScriptText(SAY_INTRO, m_creature);
- if (m_creature->HasAura(SPELL_BANISH,0))
+ if (m_creature->HasAura(SPELL_BANISH))
m_creature->RemoveAurasDueToSpell(SPELL_BANISH);
IsBanished = false;
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
index 45e093f807e..c58bae35137 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp
@@ -60,12 +60,6 @@ float VoidPortalCoords[5][3] =
{-261.4533, -297.3298, 17.1}
};
-class EmpoweringShadowsAura: public Aura
-{
- public:
- EmpoweringShadowsAura(SpellEntry *spell, uint32 eff, int32 *bp, Unit *target, Unit *caster) : Aura(spell, eff, bp, target, caster, NULL) {}
-};
-
struct TRINITY_DLL_DECL mob_voidtravelerAI : public ScriptedAI
{
mob_voidtravelerAI(Creature *c) : ScriptedAI(c)
@@ -100,7 +94,7 @@ struct TRINITY_DLL_DECL mob_voidtravelerAI : public ScriptedAI
{
SpellEntry *spell = (SpellEntry *)GetSpellStore()->LookupEntry(HeroicMode?H_SPELL_EMPOWERING_SHADOWS:SPELL_EMPOWERING_SHADOWS);
if( spell )
- Vorpil->AddAura(new EmpoweringShadowsAura(spell, 0, NULL, Vorpil, m_creature));
+ Vorpil->AddAura(new Aura(spell, 1, NULL, Vorpil, m_creature));
Vorpil->SetHealth(Vorpil->GetHealth()+Vorpil->GetMaxHealth()/25);
DoCast(m_creature, SPELL_SHADOW_NOVA, true);
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
@@ -277,7 +271,7 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI
Map::PlayerList const &PlayerList = map->GetPlayers();
for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
if (Player* i_pl = i->getSource())
- if (i_pl->isAlive() && !i_pl->HasAura(SPELL_BANISH,0))
+ if (i_pl->isAlive() && !i_pl->HasAura(SPELL_BANISH))
i_pl->TeleportTo(m_creature->GetMapId(), VorpilPosition[0],VorpilPosition[1],VorpilPosition[2], 0, TELE_TO_NOT_LEAVE_COMBAT);
m_creature->Relocate(VorpilPosition[0],VorpilPosition[1],VorpilPosition[2]);
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp
index 91eedc2bf26..61d71ddb256 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/boss_murmur.cpp
@@ -73,7 +73,7 @@ struct TRINITY_DLL_DECL boss_murmurAI : public Scripted_NoMovementAI
if (target && target->GetTypeId() == TYPEID_PLAYER)
{
//Not do anything without aura, spell can be resisted!
- if (target->HasAura(SPELL_SONIC_BOOM_CAST,1) && m_creature->IsWithinDistInMap(target, 34.0f))
+ if (target->HasAura(SPELL_SONIC_BOOM_CAST) && m_creature->IsWithinDistInMap(target, 34.0f))
{
//This will be wrong calculation. Also, comments suggest it must deal damage
target->SetHealth(uint32(target->GetMaxHealth() - target->GetMaxHealth() * 0.8));
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp
index a37d55c7417..b181f50f69b 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp
@@ -215,7 +215,7 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI
FelAcidTimer = 25000;
}else FelAcidTimer -= diff;
- if(!m_creature->HasAura(SPELL_BERSERK, 0))
+ if(!m_creature->HasAura(SPELL_BERSERK))
{
if(EnrageTimer < diff)
{
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
index 3ce8f6b2a2b..7e656bccee0 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
@@ -748,7 +748,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
if(m_creature->IsNonMeleeSpellCasted(false))
return;
- if(Phase == PHASE_NORMAL || Phase == PHASE_NORMAL_2 || Phase == PHASE_NORMAL_MAIEV && !m_creature->HasAura(SPELL_CAGED, 0))
+ if(Phase == PHASE_NORMAL || Phase == PHASE_NORMAL_2 || Phase == PHASE_NORMAL_MAIEV && !m_creature->HasAura(SPELL_CAGED))
{
switch(Event)
{
@@ -933,7 +933,7 @@ struct TRINITY_DLL_DECL flame_of_azzinothAI : public ScriptedAI
AttackStart(m_creature->getVictim());
}
}
- else if(!m_creature->HasAura(SPELL_AZZINOTH_CHANNEL, 0))
+ else if(!m_creature->HasAura(SPELL_AZZINOTH_CHANNEL))
{
Glaive->CastSpell(m_creature, SPELL_AZZINOTH_CHANNEL, false);
m_creature->RemoveAurasDueToSpell(SPELL_FLAME_ENRAGE);
@@ -1625,12 +1625,12 @@ struct TRINITY_DLL_DECL cage_trap_triggerAI : public ScriptedAI
{
if(who->GetEntry() == ILLIDAN_STORMRAGE) // Check if who is Illidan
{
- if(!IllidanGUID && m_creature->IsWithinDistInMap(who, 3) && (!who->HasAura(SPELL_CAGED, 0)))
+ if(!IllidanGUID && m_creature->IsWithinDistInMap(who, 3) && (!who->HasAura(SPELL_CAGED)))
{
IllidanGUID = who->GetGUID();
who->CastSpell(who, SPELL_CAGED, true);
DespawnTimer = 5000;
- if(who->HasAura(SPELL_ENRAGE, 0))
+ if(who->HasAura(SPELL_ENRAGE))
who->RemoveAurasDueToSpell(SPELL_ENRAGE); // Dispel his enrage
//if(GameObject* CageTrap = GameObject::GetGameObject(*m_creature, CageTrapGUID))
// CageTrap->SetLootState(GO_JUST_DEACTIVATED);
@@ -1708,7 +1708,7 @@ struct TRINITY_DLL_DECL shadow_demonAI : public ScriptedAI
if(m_creature->getVictim()->GetTypeId() != TYPEID_PLAYER) return; // Only cast the below on players.
- if(!m_creature->getVictim()->HasAura(SPELL_PARALYZE, 0))
+ if(!m_creature->getVictim()->HasAura(SPELL_PARALYZE))
{
TargetGUID = m_creature->getVictim()->GetGUID();
m_creature->AddThreat(m_creature->getVictim(), 10000000.0f);
@@ -1750,8 +1750,8 @@ struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI
{
if( m_creature->isAttackReady() && m_creature->IsWithinMeleeRange(m_creature->getVictim()))
{
- if(!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0)
- && !m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2, 0))
+ if(!m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND)
+ && !m_creature->getVictim()->HasAura(SPELL_PARASITIC_SHADOWFIEND2))
{
m_creature->CastSpell(m_creature->getVictim(), SPELL_PARASITIC_SHADOWFIEND2, true, 0, 0, IllidanGUID); //do not stack
}
@@ -1862,8 +1862,8 @@ void boss_illidan_stormrageAI::JustSummoned(Creature* summon)
return;
}
Unit *target = SelectUnit(SELECT_TARGET_TOPAGGRO, 0, 999, true);
- if(!target || target->HasAura(SPELL_PARASITIC_SHADOWFIEND, 0)
- || target->HasAura(SPELL_PARASITIC_SHADOWFIEND2, 0))
+ if(!target || target->HasAura(SPELL_PARASITIC_SHADOWFIEND)
+ || target->HasAura(SPELL_PARASITIC_SHADOWFIEND2))
target = SelectUnit(SELECT_TARGET_RANDOM, 0, 999, true);
if(target)
summon->AI()->AttackStart(target);
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp
index 102c5c598d2..e459e1aa687 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_mother_shahraz.cpp
@@ -276,7 +276,7 @@ struct TRINITY_DLL_DECL boss_shahrazAI : public ScriptedAI
}else SaberTimer -= diff;
//Enrage
- if(!m_creature->HasAura(SPELL_BERSERK, 0))
+ if(!m_creature->HasAura(SPELL_BERSERK))
if(EnrageTimer < diff)
{
DoCast(m_creature, SPELL_BERSERK);
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
index 46b6ad0bf9a..f8f742d3a3c 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
@@ -290,7 +290,7 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
debug_log("SD2: Increasing Death Count for Shade of Akama encounter");
++DeathCount;
- m_creature->RemoveSingleAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2, 0);
+ m_creature->RemoveAuraFromStack(SPELL_SHADE_SOUL_CHANNEL_2);
if(guid)
{
if(Sorcerers.empty())
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp
index 72429886626..44122355311 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp
@@ -153,7 +153,7 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI
if (!UpdateVictim())
return;
- if(!m_creature->HasAura(SPELL_BERSERK, 0))
+ if(!m_creature->HasAura(SPELL_BERSERK))
{
if(BerserkTimer < diff)
DoCast(m_creature, SPELL_BERSERK);
@@ -276,7 +276,7 @@ struct TRINITY_DLL_DECL npc_volcanoAI : public ScriptedAI
}
else if(Eruption && ((boss_supremusAI*)Supremus->AI())->Phase1)
{
- m_creature->RemoveAura(SPELL_VOLCANIC_ERUPTION, 0);
+ m_creature->RemoveAura(SPELL_VOLCANIC_ERUPTION);
}
CheckTimer = 1500;
}else CheckTimer -= diff;
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp
index 327b670c6d3..8fc92648130 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_teron_gorefiend.cpp
@@ -331,7 +331,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI
Unit* Ghost = NULL;
if(GhostGUID)
Ghost = Unit::GetUnit((*m_creature), GhostGUID);
- if(Ghost && Ghost->isAlive() && Ghost->HasAura(SPELL_SHADOW_OF_DEATH, 0))
+ if(Ghost && Ghost->isAlive() && Ghost->HasAura(SPELL_SHADOW_OF_DEATH))
{
/*float x,y,z;
Ghost->GetPosition(x,y,z);
@@ -487,7 +487,7 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI
RandomYellTimer = 50000 + rand()%51 * 1000;
}else RandomYellTimer -= diff;
- if(!m_creature->HasAura(SPELL_BERSERK, 0))
+ if(!m_creature->HasAura(SPELL_BERSERK))
{
if(EnrageTimer < diff)
{
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp
index 9316e108db7..b605c16394b 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_warlord_najentus.cpp
@@ -95,7 +95,7 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI
void SpellHit(Unit *caster, const SpellEntry *spell)
{
- if(spell->Id == SPELL_HURL_SPINE && m_creature->HasAura(SPELL_TIDAL_SHIELD, 0))
+ if(spell->Id == SPELL_HURL_SPINE && m_creature->HasAura(SPELL_TIDAL_SHIELD))
{
m_creature->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
m_creature->CastSpell(m_creature, SPELL_TIDAL_BURST, true);
@@ -116,7 +116,7 @@ struct TRINITY_DLL_DECL boss_najentusAI : public ScriptedAI
{
if(!SpineTargetGUID) return false;
Unit* target = Unit::GetUnit(*m_creature, SpineTargetGUID);
- if(target && target->HasAura(SPELL_IMPALING_SPINE, 1))
+ if(target && target->HasAura(SPELL_IMPALING_SPINE))
target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
SpineTargetGUID=0;
return true;
diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_chromaggus.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_chromaggus.cpp
index 6d73fdf93e9..4e54fe2ce35 100644
--- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_chromaggus.cpp
+++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_chromaggus.cpp
@@ -258,11 +258,11 @@ struct TRINITY_DLL_DECL boss_chromaggusAI : public ScriptedAI
DoCast(pUnit, SpellAfflict, true);
//Chromatic mutation if target is effected by all afflictions
- if (pUnit->HasAura(SPELL_BROODAF_BLUE,0)
- && pUnit->HasAura(SPELL_BROODAF_BLACK,0)
- && pUnit->HasAura(SPELL_BROODAF_RED,0)
- && pUnit->HasAura(SPELL_BROODAF_BRONZE,0)
- && pUnit->HasAura(SPELL_BROODAF_GREEN,0))
+ if (pUnit->HasAura(SPELL_BROODAF_BLUE)
+ && pUnit->HasAura(SPELL_BROODAF_BLACK)
+ && pUnit->HasAura(SPELL_BROODAF_RED)
+ && pUnit->HasAura(SPELL_BROODAF_BRONZE)
+ && pUnit->HasAura(SPELL_BROODAF_GREEN))
{
//target->RemoveAllAuras();
//DoCast(target,SPELL_CHROMATIC_MUT_1);
diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_ebonroc.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_ebonroc.cpp
index 83c0d3eebc9..54348dd86c4 100644
--- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_ebonroc.cpp
+++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_ebonroc.cpp
@@ -76,7 +76,7 @@ struct TRINITY_DLL_DECL boss_ebonrocAI : public ScriptedAI
ShadowOfEbonroc_Timer = 25000 + rand()%10000;
}else ShadowOfEbonroc_Timer -= diff;
- if (m_creature->getVictim()->HasAura(SPELL_SHADOWOFEBONROC,0))
+ if (m_creature->getVictim()->HasAura(SPELL_SHADOWOFEBONROC))
{
if (Heal_Timer < diff)
{
diff --git a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp
index 19d4385e34b..ff29427664f 100644
--- a/src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp
+++ b/src/bindings/scripts/scripts/zone/blackwing_lair/boss_razorgore.cpp
@@ -104,7 +104,7 @@ struct TRINITY_DLL_DECL boss_razorgoreAI : public ScriptedAI
}else Conflagration_Timer -= diff;
// Aura Check. If the gamer is affected by confliguration we attack a random gamer.
- if (m_creature->getVictim()->HasAura(SPELL_CONFLAGRATION,0))
+ if (m_creature->getVictim()->HasAura(SPELL_CONFLAGRATION))
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,1);
diff --git a/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp b/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp
index bf3ccea909e..03c3a57568c 100644
--- a/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp
+++ b/src/bindings/scripts/scripts/zone/blades_edge_mountains/blades_edge_mountains.cpp
@@ -258,7 +258,7 @@ struct TRINITY_DLL_DECL npc_daranelleAI : public ScriptedAI
{
if (who->GetTypeId() == TYPEID_PLAYER)
{
- if (who->HasAura(36904,0) && m_creature->IsWithinDistInMap(who, 10.0f))
+ if (who->HasAura(36904) && m_creature->IsWithinDistInMap(who, 10.0f))
{
DoScriptText(SAY_SPELL_INFLUENCE, m_creature, who);
//TODO: Move the below to updateAI and run if this statement == true
diff --git a/src/bindings/scripts/scripts/zone/bloodmyst_isle/bloodmyst_isle.cpp b/src/bindings/scripts/scripts/zone/bloodmyst_isle/bloodmyst_isle.cpp
index af80343943b..79d7b19e108 100644
--- a/src/bindings/scripts/scripts/zone/bloodmyst_isle/bloodmyst_isle.cpp
+++ b/src/bindings/scripts/scripts/zone/bloodmyst_isle/bloodmyst_isle.cpp
@@ -81,7 +81,7 @@ CreatureAI* GetAI_mob_webbed_creature(Creature *_Creature)
bool GossipHello_npc_captured_sunhawk_agent(Player *player, Creature *_Creature)
{
- if (player->HasAura(31609,1) && player->GetQuestStatus(9756) == QUEST_STATUS_INCOMPLETE)
+ if (player->HasAura(31609) && player->GetQuestStatus(9756) == QUEST_STATUS_INCOMPLETE)
{
player->ADD_GOSSIP_ITEM( 0, "[PH] ", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->SEND_GOSSIP_MENU(9136, _Creature->GetGUID());
diff --git a/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp b/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp
index ddf7be8e752..b16b6551c78 100644
--- a/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp
+++ b/src/bindings/scripts/scripts/zone/burning_steppes/burning_steppes.cpp
@@ -52,7 +52,7 @@ struct TRINITY_DLL_DECL npc_ragged_johnAI : public ScriptedAI
void MoveInLineOfSight(Unit *who)
{
- if( who->HasAura(16468,0) )
+ if( who->HasAura(16468) )
{
if( who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 15) && who->isInAccessiblePlaceFor(m_creature) )
{
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/dark_portal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/dark_portal.cpp
index 423682ca0ab..db8db78f723 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/dark_portal.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/dark_portal.cpp
@@ -79,8 +79,8 @@ struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI
if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS)
m_creature->CastSpell(m_creature,SPELL_CHANNEL,true);
- else if (m_creature->HasAura(SPELL_CHANNEL,0))
- m_creature->RemoveAura(SPELL_CHANNEL,0);
+ else if (m_creature->HasAura(SPELL_CHANNEL))
+ m_creature->RemoveAura(SPELL_CHANNEL);
m_creature->CastSpell(m_creature,SPELL_PORTAL_RUNE,true);
}
@@ -160,9 +160,9 @@ struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI
{
pInstance->SetData(TYPE_MEDIVH,SPECIAL);
- if (m_creature->HasAura(SPELL_CORRUPT_AEONUS,0))
+ if (m_creature->HasAura(SPELL_CORRUPT_AEONUS))
SpellCorrupt_Timer = 1000;
- else if (m_creature->HasAura(SPELL_CORRUPT,0))
+ else if (m_creature->HasAura(SPELL_CORRUPT))
SpellCorrupt_Timer = 3000;
else
SpellCorrupt_Timer = 0;
@@ -207,8 +207,8 @@ struct TRINITY_DLL_DECL npc_medivh_bmAI : public ScriptedAI
DoScriptText(SAY_WIN, m_creature);
Check_Timer = 0;
- if (m_creature->HasAura(SPELL_CHANNEL,0))
- m_creature->RemoveAura(SPELL_CHANNEL,0);
+ if (m_creature->HasAura(SPELL_CHANNEL))
+ m_creature->RemoveAura(SPELL_CHANNEL);
//TODO: start the post-event here
pInstance->SetData(TYPE_MEDIVH,DONE);
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
index 0ac8193585b..5b8617cdf01 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/boss_archimonde.cpp
@@ -411,9 +411,9 @@ struct TRINITY_DLL_DECL boss_archimondeAI : public ScriptedAI
break;
}
- if (m_creature->HasAura(chargeSpell, 0))
+ if (m_creature->HasAura(chargeSpell))
{
- m_creature->RemoveSingleAuraFromStack(chargeSpell, 0);
+ m_creature->RemoveAuraFromStack(chargeSpell);
DoCast(m_creature->getVictim(), unleashSpell);
HasCast = true;
SoulChargeCount--;
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
index 4023157b09a..e9b5841d005 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_fathomlord_karathress.cpp
@@ -519,7 +519,7 @@ struct TRINITY_DLL_DECL boss_fathomguard_tidalvessAI : public ScriptedAI
return;
}
- if( !m_creature->HasAura(SPELL_WINDFURY_WEAPON, 0) )
+ if( !m_creature->HasAura(SPELL_WINDFURY_WEAPON) )
{
DoCast(m_creature, SPELL_WINDFURY_WEAPON);
}
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
index e3c8d654b93..aefd6062427 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp
@@ -365,7 +365,7 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI
Unit *target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM, 0);
- if(target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER, 0))
+ if(target && !target->HasAura(SPELL_STATIC_CHARGE_TRIGGER))
//cast Static Charge every 2 seconds for 20 seconds
DoCast(target, SPELL_STATIC_CHARGE_TRIGGER);
@@ -571,12 +571,7 @@ struct TRINITY_DLL_DECL boss_lady_vashjAI : public ScriptedAI
}
}
};
-class TRINITY_DLL_DECL VashjSurgeAura : public Aura
-{
- public:
- VashjSurgeAura(SpellEntry *spell, uint32 eff, int32 *bp, Unit *target, Unit *caster) : Aura(spell, eff, bp, target, caster, NULL)
- {}
-};
+
//Enchanted Elemental
//If one of them reaches Vashj he will increase her damage done by 5%.
struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI
@@ -660,13 +655,14 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI
SpellEntry *spell = (SpellEntry *)GetSpellStore()->LookupEntry(SPELL_SURGE);
if( spell )
{
- for(uint32 i = 0;i<3;i++)
+ uint8 eff_mask=0;
+ for (int i=0; i<3; i++)
{
if (!spell->Effect[i])
continue;
-
- Vashj->AddAura(new VashjSurgeAura(spell, i, NULL, Vashj, Vashj));
+ eff_mask|=1<<i;
}
+ Vashj->AddAura(new Aura(spell, eff_mask, NULL, Vashj, Vashj));
}
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
@@ -918,7 +914,7 @@ struct TRINITY_DLL_DECL mob_shield_generator_channelAI : public ScriptedAI
if(Vashj && Vashj->isAlive())
{
//start visual channel
- if (!Casted || !Vashj->HasAura(SPELL_MAGIC_BARRIER,0))
+ if (!Casted || !Vashj->HasAura(SPELL_MAGIC_BARRIER))
{
m_creature->CastSpell(Vashj,SPELL_MAGIC_BARRIER,true);
Casted = true;
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
index 44490d6afd9..c21c2cf7921 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp
@@ -65,12 +65,6 @@ EndScriptData */
#define SAY_FREE -1548019
#define SAY_DEATH -1548020
-class TRINITY_DLL_DECL InsidiousAura : public Aura {
-public:
- InsidiousAura(SpellEntry *spell, uint32 eff, int32 *bp, Unit *target, Unit *caster) : Aura(spell, eff, bp, target, caster, NULL)
- {}
-};
-
struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI
{
mob_inner_demonAI(Creature *c) : ScriptedAI(c)
@@ -91,7 +85,7 @@ struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI
void JustDied(Unit *victim)
{
Unit* pUnit = Unit::GetUnit((*m_creature),victimGUID);
- if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER,0))
+ if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER))
pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER);
}
@@ -128,7 +122,7 @@ struct TRINITY_DLL_DECL mob_inner_demonAI : public ScriptedAI
}else Link_Timer -= diff;
- if(!m_creature->HasAura(AURA_DEMONIC_ALIGNMENT, 0))
+ if(!m_creature->HasAura(AURA_DEMONIC_ALIGNMENT))
DoCast(m_creature, AURA_DEMONIC_ALIGNMENT,true);
if(ShadowBolt_Timer < diff)
@@ -229,7 +223,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
}
void MoveInLineOfSight(Unit *who)
{
- if(m_creature->HasAura(AURA_BANISH, 0))
+ if(m_creature->HasAura(AURA_BANISH))
return;
if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessiblePlaceFor(m_creature) )
@@ -267,7 +261,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
}
// channelers == 0 remove banish aura
- if(AliveChannelers == 0 && m_creature->HasAura(AURA_BANISH, 0))
+ if(AliveChannelers == 0 && m_creature->HasAura(AURA_BANISH))
{
// removing banish aura
m_creature->RemoveAurasDueToSpell(AURA_BANISH);
@@ -290,7 +284,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
StartEvent();
}
}
- else if(AliveChannelers != 0 && !m_creature->HasAura(AURA_BANISH, 0))
+ else if(AliveChannelers != 0 && !m_creature->HasAura(AURA_BANISH))
{
// channelers != 0 apply banish aura
// removing Leotheras banish immune to apply AURA_BANISH
@@ -390,7 +384,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
void Aggro(Unit *who)
{
- if(m_creature->HasAura(AURA_BANISH, 0))
+ if(m_creature->HasAura(AURA_BANISH))
return;
m_creature->LoadEquipment(m_creature->GetEquipmentId());
@@ -399,7 +393,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
//Return since we have no target
- if (m_creature->HasAura(AURA_BANISH, 0) || !UpdateVictim())
+ if (m_creature->HasAura(AURA_BANISH) || !UpdateVictim())
{
if(BanishTimer<diff)
{
@@ -408,7 +402,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
}else BanishTimer -= diff;
return;
}
- if(m_creature->HasAura(SPELL_WHIRLWIND, 0))
+ if(m_creature->HasAura(SPELL_WHIRLWIND))
if(Whirlwind_Timer < diff)
{
Unit *newTarget = SelectUnit(SELECT_TARGET_RANDOM, 0);
@@ -422,7 +416,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
}else Whirlwind_Timer -= diff;
// reseting after changing forms and after ending whirlwind
- if(NeedThreatReset && !m_creature->HasAura(SPELL_WHIRLWIND, 0))
+ if(NeedThreatReset && !m_creature->HasAura(SPELL_WHIRLWIND))
{
// when changing forms seting timers (or when ending whirlwind - to avoid adding new variable i use Whirlwind_Timer to countdown 2s while whirlwinding)
if(DemonForm)
@@ -446,7 +440,7 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
if(!DemonForm)
{
//Whirldind Timer
- if(!m_creature->HasAura(SPELL_WHIRLWIND, 0))
+ if(!m_creature->HasAura(SPELL_WHIRLWIND))
{
if(Whirlwind_Timer < diff)
{
@@ -513,12 +507,14 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
((ScriptedAI *)demon->AI())->AttackStart( (*itr) );
((mob_inner_demonAI *)demon->AI())->victimGUID = (*itr)->GetGUID();
+ uint8 eff_mask=0;
for (int i=0; i<3; i++)
{
if (!spell->Effect[i])
continue;
- (*itr)->AddAura(new InsidiousAura(spell, i, NULL, (*itr), (*itr)));
+ eff_mask|=1<<i;
}
+ (*itr)->AddAura(new Aura(spell, eff_mask, NULL, (*itr), (*itr)));
if( InnderDemon_Count > 4 ) InnderDemon_Count = 0;
//Safe storing of creatures
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp
index aa862ea42f7..653799f08f5 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/serpent_shrine/boss_lurker_below.cpp
@@ -266,7 +266,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
- if (i->getSource()->isAlive() && i->getSource()->IsInWater() && !i->getSource()->HasAura(SPELL_SCALDINGWATER, 0))
+ if (i->getSource()->isAlive() && i->getSource()->IsInWater() && !i->getSource()->HasAura(SPELL_SCALDINGWATER))
i->getSource()->CastSpell(i->getSource(), SPELL_SCALDINGWATER, true);
else if(!i->getSource()->IsInWater())
i->getSource()->RemoveAurasDueToSpell(SPELL_SCALDINGWATER);
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp
index 325b6ffe244..079c9fd42d1 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/underbog/boss_the_black_stalker.cpp
@@ -121,7 +121,7 @@ struct TRINITY_DLL_DECL boss_the_black_stalkerAI : public ScriptedAI
{
if(Unit* target = (Unit*)Unit::GetUnit(*m_creature, LevitatedTarget))
{
- if(!target->HasAura(SPELL_LEVITATE,0))
+ if(!target->HasAura(SPELL_LEVITATE))
{
LevitatedTarget = 0;
return;
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
index d4505d58e18..de74db2a251 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp
@@ -62,12 +62,6 @@ const float ShadowmoonChannelers[5][4]=
{316,-109,-24.6,1.257}
};
-class TRINITY_DLL_DECL BurningNovaAura : public Aura
-{
- public:
- BurningNovaAura(SpellEntry *spell, uint32 eff, Unit *target, Unit *caster) : Aura(spell, eff, NULL, target, caster, NULL){}
-};
-
struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
{
boss_kelidan_the_breakerAI(Creature *c) : ScriptedAI(c)
@@ -234,12 +228,14 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
if(SpellEntry *nova = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_BURNING_NOVA))
{
- for(uint32 i = 0; i < 3; ++i)
- if(nova->Effect[i] == SPELL_EFFECT_APPLY_AURA)
- {
- Aura *Aur = new BurningNovaAura(nova, i, m_creature, m_creature);
- m_creature->AddAura(Aur);
- }
+ uint8 eff_mask=0;
+ for (int i=0; i<3; i++)
+ {
+ if (!nova->Effect[i])
+ continue;
+ eff_mask|=1<<i;
+ }
+ m_creature->AddAura(new Aura(nova, eff_mask, NULL, m_creature, m_creature));
}
if (HeroicMode)
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
index a00c3cbde2e..16d4b07ba15 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/magtheridons_lair/boss_magtheridon.cpp
@@ -257,7 +257,7 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI
for(CubeMap::iterator i = Cube.begin(); i != Cube.end(); ++i)
{
Unit *clicker = Unit::GetUnit(*m_creature, (*i).second);
- if(!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP, 1))
+ if(!clicker || !clicker->HasAura(SPELL_SHADOW_GRASP))
{
DebuffClicker(clicker);
(*i).second = 0;
@@ -265,12 +265,12 @@ struct TRINITY_DLL_DECL boss_magtheridonAI : public ScriptedAI
}
// if 5 clickers from other cubes apply shadow cage
- if(ClickerNum >= CLICKERS_COUNT && !m_creature->HasAura(SPELL_SHADOW_CAGE, 0))
+ if(ClickerNum >= CLICKERS_COUNT && !m_creature->HasAura(SPELL_SHADOW_CAGE))
{
DoScriptText(SAY_BANISH, m_creature);
m_creature->CastSpell(m_creature, SPELL_SHADOW_CAGE, true);
}
- else if(ClickerNum < CLICKERS_COUNT && m_creature->HasAura(SPELL_SHADOW_CAGE, 0))
+ else if(ClickerNum < CLICKERS_COUNT && m_creature->HasAura(SPELL_SHADOW_CAGE))
m_creature->RemoveAurasDueToSpell(SPELL_SHADOW_CAGE);
if(!ClickerNum) NeedCheckCube = false;
@@ -510,7 +510,7 @@ bool GOHello_go_Manticron_Cube(Player *player, GameObject* _GO)
if(!Magtheridon || !Magtheridon->isAlive()) return true;
// if exhausted or already channeling return
- if(player->HasAura(SPELL_MIND_EXHAUSTION, 0) || player->HasAura(SPELL_SHADOW_GRASP, 1))
+ if(player->HasAura(SPELL_MIND_EXHAUSTION) || player->HasAura(SPELL_SHADOW_GRASP))
return true;
player->InterruptNonMeleeSpells(false);
diff --git a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
index bbc181f1099..75d78fde331 100644
--- a/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
+++ b/src/bindings/scripts/scripts/zone/isle_of_queldanas/isle_of_queldanas.cpp
@@ -164,7 +164,7 @@ struct TRINITY_DLL_DECL npc_greengill_slaveAI : public ScriptedAI
if(!caster)
return;
- if(caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !m_creature->HasAura(ENRAGE, 0))
+ if(caster->GetTypeId() == TYPEID_PLAYER && spell->Id == ORB && !m_creature->HasAura(ENRAGE))
{
PlayerGUID = caster->GetGUID();
if(PlayerGUID)
diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
index 76327c6ee1d..cf235b99880 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/boss_moroes.cpp
@@ -150,7 +150,7 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{
- if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_GARROTE,0))
+ if (i->getSource()->isAlive() && i->getSource()->HasAura(SPELL_GARROTE))
i->getSource()->RemoveAurasDueToSpell(SPELL_GARROTE);
}
}
diff --git a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
index c5646167c3c..33899c4cd83 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
@@ -625,7 +625,7 @@ struct TRINITY_DLL_DECL mob_cycloneAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(!m_creature->HasAura(SPELL_KNOCKBACK, 0))
+ if(!m_creature->HasAura(SPELL_KNOCKBACK))
DoCast(m_creature, SPELL_KNOCKBACK, true);
if(MoveTimer < diff)
diff --git a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
index 3f839300f3f..0c48b9b8bfd 100644
--- a/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
+++ b/src/bindings/scripts/scripts/zone/magisters_terrace/boss_priestess_delrissa.cpp
@@ -277,7 +277,7 @@ struct TRINITY_DLL_DECL boss_priestess_delrissaAI : public ScriptedAI
{
std::vector<Add*>::iterator itr = Adds.begin() + rand()%Adds.size();
if (Unit* pAdd = Unit::GetUnit(*m_creature, (*itr)->guid))
- if (!pAdd->HasAura(SPELL_SHIELD, 0) && pAdd->isAlive())
+ if (!pAdd->HasAura(SPELL_SHIELD) && pAdd->isAlive())
target = pAdd;
}
DoCast(target, SPELL_SHIELD);
diff --git a/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp b/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp
index 4080676d99b..8b43005b5df 100644
--- a/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp
+++ b/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp
@@ -134,8 +134,8 @@ struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI
void Aggro(Unit *who)
{
- if (m_creature->HasAura(SPELL_VISUAL_SLEEP,0))
- m_creature->RemoveAura(SPELL_VISUAL_SLEEP,0);
+ if (m_creature->HasAura(SPELL_VISUAL_SLEEP))
+ m_creature->RemoveAura(SPELL_VISUAL_SLEEP);
if (!m_creature->IsStandState())
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
diff --git a/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp b/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp
index 0766e432105..815b273d185 100644
--- a/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp
+++ b/src/bindings/scripts/scripts/zone/naxxramas/boss_anubrekhan.cpp
@@ -109,7 +109,7 @@ struct TRINITY_DLL_DECL boss_anubrekhanAI : public ScriptedAI
{
//Cast Impale on a random target
//Do NOT cast it when we are afflicted by locust swarm
- if (!m_creature->HasAura(SPELL_LOCUSTSWARM,1))
+ if (!m_creature->HasAura(SPELL_LOCUSTSWARM))
{
if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0))
DoCast(target,SPELL_IMPALE);
diff --git a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
index 2e2157ed857..e8f6cae5e40 100644
--- a/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
+++ b/src/bindings/scripts/scripts/zone/netherstorm/netherstorm.cpp
@@ -652,7 +652,7 @@ Creature* SearchDawnforge(Player *source, uint32 entry, float range)
bool AreaTrigger_at_commander_dawnforge(Player *player, AreaTriggerEntry *at)
{
//if player lost aura or not have at all, we should not try start event.
- if (!player->HasAura(SPELL_SUNFURY_DISGUISE,0))
+ if (!player->HasAura(SPELL_SUNFURY_DISGUISE))
return false;
if (player->isAlive() && player->GetQuestStatus(QUEST_INFO_GATHERING) == QUEST_STATUS_INCOMPLETE)
@@ -858,7 +858,7 @@ struct TRINITY_DLL_DECL mob_phase_hunterAI : public ScriptedAI
DoScriptText(EMOTE_WEAK, m_creature);
Weak = true;
}
- if(Weak && !Drained && m_creature->HasAura(34219, 0))
+ if(Weak && !Drained && m_creature->HasAura(34219))
{
Drained = true;
diff --git a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp
index cdca1d62455..6b14a4c9e45 100644
--- a/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp
+++ b/src/bindings/scripts/scripts/zone/scarlet_monastery/boss_headless_horseman.cpp
@@ -176,7 +176,7 @@ struct TRINITY_DLL_DECL mob_wisp_invisAI : public ScriptedAI
if (!who || Creaturetype != 1 || !who->isTargetableForAttack())
return;
- if (m_creature->GetDistance2d(who) < 0.1 && !who->HasAura(SPELL_SQUASH_SOUL,0))
+ if (m_creature->GetDistance2d(who) < 0.1 && !who->HasAura(SPELL_SQUASH_SOUL))
DoCast(who,SPELL_SQUASH_SOUL);
}
@@ -505,7 +505,7 @@ struct TRINITY_DLL_DECL boss_headless_horsemanAI : public ScriptedAI
void SpellHitTarget(Unit* unit, const SpellEntry* spell)
{
if (spell->Id == SPELL_CONFLAGRATION)
- if (unit->HasAura(SPELL_CONFLAGRATION,0))
+ if (unit->HasAura(SPELL_CONFLAGRATION))
SaySound(SAY_CONFLAGRATION,unit);
}
diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp
index 5174f5c8e28..ea84a299403 100644
--- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/boss_doomwalker.cpp
@@ -131,7 +131,7 @@ struct TRINITY_DLL_DECL boss_doomwalkerAI : public ScriptedAI
//remove enrage before casting earthquake because enrage + earthquake = 16000dmg over 8sec and all dead
if (InEnrage)
- m_creature->RemoveAura(SPELL_ENRAGE, 0);
+ m_creature->RemoveAura(SPELL_ENRAGE);
DoCast(m_creature,SPELL_EARTHQUAKE);
Quake_Timer = 30000 + rand()%25000;
diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
index caf3a8ef51d..516ef7c5b09 100644
--- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
@@ -94,7 +94,7 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI
if(!caster)
return;
- if(caster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_PLACE_CARCASS && !m_creature->HasAura(SPELL_JUST_EATEN, 0) && !PlayerGUID)
+ if(caster->GetTypeId() == TYPEID_PLAYER && spell->Id == SPELL_PLACE_CARCASS && !m_creature->HasAura(SPELL_JUST_EATEN) && !PlayerGUID)
{
float PlayerX, PlayerY, PlayerZ;
caster->GetClosePoint(PlayerX, PlayerY, PlayerZ, m_creature->GetObjectSize());
diff --git a/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp b/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp
index 62b210313a1..200195d76af 100644
--- a/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp
+++ b/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp
@@ -280,10 +280,10 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance
if (!pGroupie)
continue;
- if (pGroupie->HasAura(SPELL_BARON_ULTIMATUM,0))
+ if (pGroupie->HasAura(SPELL_BARON_ULTIMATUM))
pGroupie->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM);
}
- } else if (player->HasAura(SPELL_BARON_ULTIMATUM,0))
+ } else if (player->HasAura(SPELL_BARON_ULTIMATUM))
player->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM);
if (Unit *temp = Unit::GetUnit(*player,GetData64(DATA_BARON)))
diff --git a/src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp b/src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp
index 74aa992323a..91c7553bff7 100644
--- a/src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp
+++ b/src/bindings/scripts/scripts/zone/stratholme/stratholme.cpp
@@ -54,12 +54,12 @@ bool GOHello_go_gauntlet_gate(Player *player, GameObject* _GO)
continue;
if (pGroupie->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE &&
- !pGroupie->HasAura(SPELL_BARON_ULTIMATUM,0) &&
+ !pGroupie->HasAura(SPELL_BARON_ULTIMATUM) &&
pGroupie->GetMap() == _GO->GetMap())
pGroupie->CastSpell(pGroupie,SPELL_BARON_ULTIMATUM,true);
}
} else if (player->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE &&
- !player->HasAura(SPELL_BARON_ULTIMATUM,0) &&
+ !player->HasAura(SPELL_BARON_ULTIMATUM) &&
player->GetMap() == _GO->GetMap())
player->CastSpell(player,SPELL_BARON_ULTIMATUM,true);
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp
index 4dcc95a79c1..e848557f859 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_brutallus.cpp
@@ -133,7 +133,7 @@ struct TRINITY_DLL_DECL boss_brutallusAI : public ScriptedAI
Unit *Target = m_creature->getVictim();
DoCast(Target,SPELL_STOMP);
- if(Target->HasAura(45151,0)) Target->RemoveAura(45151,0);
+ if(Target->HasAura(45151)) Target->RemoveAura(45151);
StompTimer = 30000;
}else StompTimer -= diff;
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp
index 884d14db552..bf2b11c3b9b 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_eredar_twins.cpp
@@ -209,9 +209,9 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI
switch(TouchedType)
{
case SPELL_FLAME_TOUCHED:
- if(!target->HasAura(SPELL_DARK_FLAME,0))
+ if(!target->HasAura(SPELL_DARK_FLAME))
{
- if(target->HasAura(SPELL_DARK_TOUCHED,0))
+ if(target->HasAura(SPELL_DARK_TOUCHED))
{
target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED);
target->CastSpell(target,SPELL_DARK_FLAME,true);
@@ -222,9 +222,9 @@ struct TRINITY_DLL_DECL boss_sacrolashAI : public ScriptedAI
}
break;
case SPELL_DARK_TOUCHED:
- if(!target->HasAura(SPELL_DARK_FLAME,0))
+ if(!target->HasAura(SPELL_DARK_FLAME))
{
- if(target->HasAura(SPELL_FLAME_TOUCHED,0))
+ if(target->HasAura(SPELL_FLAME_TOUCHED))
{
target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED);
target->CastSpell(target,SPELL_DARK_FLAME,true);
@@ -507,9 +507,9 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI
switch(TouchedType)
{
case SPELL_FLAME_TOUCHED:
- if(!target->HasAura(SPELL_DARK_FLAME,0))
+ if(!target->HasAura(SPELL_DARK_FLAME))
{
- if(target->HasAura(SPELL_DARK_TOUCHED,0))
+ if(target->HasAura(SPELL_DARK_TOUCHED))
{
target->RemoveAurasDueToSpell(SPELL_DARK_TOUCHED);
target->CastSpell(target,SPELL_DARK_FLAME,true);
@@ -520,9 +520,9 @@ struct TRINITY_DLL_DECL boss_alythessAI : public Scripted_NoMovementAI
}
break;
case SPELL_DARK_TOUCHED:
- if(!target->HasAura(SPELL_DARK_FLAME,0))
+ if(!target->HasAura(SPELL_DARK_FLAME))
{
- if(target->HasAura(SPELL_FLAME_TOUCHED,0))
+ if(target->HasAura(SPELL_FLAME_TOUCHED))
{
target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED);
target->CastSpell(target,SPELL_DARK_FLAME,true);
@@ -709,9 +709,9 @@ struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI
case SPELL_SHADOW_FURY:
case SPELL_DARK_STRIKE:
- if(!target->HasAura(SPELL_DARK_FLAME,0))
+ if(!target->HasAura(SPELL_DARK_FLAME))
{
- if(target->HasAura(SPELL_FLAME_TOUCHED,0))
+ if(target->HasAura(SPELL_FLAME_TOUCHED))
{
target->RemoveAurasDueToSpell(SPELL_FLAME_TOUCHED);
target->CastSpell(target,SPELL_DARK_FLAME,true);
@@ -726,7 +726,7 @@ struct TRINITY_DLL_DECL mob_shadow_imageAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
- if(!m_creature->HasAura(SPELL_IMAGE_VISUAL,0))
+ if(!m_creature->HasAura(SPELL_IMAGE_VISUAL))
DoCast(m_creature,SPELL_IMAGE_VISUAL);
if(kill_timer < diff)
diff --git a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp
index d462b3be7cd..c39c14b7f20 100644
--- a/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp
+++ b/src/bindings/scripts/scripts/zone/sunwell_plateau/boss_kalecgos.cpp
@@ -384,7 +384,7 @@ struct TRINITY_DLL_DECL boss_sathrovarrAI : public ScriptedAI
if(ResetThreat < diff)
{
- if ( ( m_creature->getVictim()->HasAura(AURA_SPECTRAL_EXHAUSTION,0)) && (m_creature->getVictim()->GetTypeId() == TYPEID_PLAYER) )
+ if ( ( m_creature->getVictim()->HasAura(AURA_SPECTRAL_EXHAUSTION)) && (m_creature->getVictim()->GetTypeId() == TYPEID_PLAYER) )
{
for(std::list<HostilReference*>::iterator itr = m_creature->getThreatManager().getThreatList().begin(); itr != m_creature->getThreatManager().getThreatList().end(); ++itr)
{
@@ -609,7 +609,7 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff)
{
//this is a hack. we need to find a victim without aura in core
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
- if( ( target != m_creature->getVictim() ) && target->isAlive() && !(target->HasAura(AURA_SPECTRAL_EXHAUSTION, 0)) )
+ if( ( target != m_creature->getVictim() ) && target->isAlive() && !(target->HasAura(AURA_SPECTRAL_EXHAUSTION)) )
{
DoCast(target, SPELL_SPECTRAL_BLAST);
SpectralBlastTimer = 20000+(rand()%5000);
@@ -626,7 +626,7 @@ void boss_kalecgosAI::UpdateAI(const uint32 diff)
bool GOkalocegos_teleporter(Player *player, GameObject* _GO)
{
- if(player->HasAura(AURA_SPECTRAL_EXHAUSTION, 0))
+ if(player->HasAura(AURA_SPECTRAL_EXHAUSTION))
player->GetSession()->SendNotification(GO_FAILED);
else
player->CastSpell(player, SPELL_TELEPORT_SPECTRAL, true);
diff --git a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
index a23c5495ef5..ab83d78e266 100644
--- a/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
+++ b/src/bindings/scripts/scripts/zone/tanaris/tanaris.cpp
@@ -191,7 +191,7 @@ struct TRINITY_DLL_DECL npc_custodian_of_timeAI : public npc_escortAI
if( who->GetTypeId() == TYPEID_PLAYER )
{
- if( ((Player*)who)->HasAura(34877,1) && ((Player*)who)->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE )
+ if( ((Player*)who)->HasAura(34877) && ((Player*)who)->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE )
{
float Radius = 10.0;
if( m_creature->IsWithinDistInMap(who, Radius) )
diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp
index 8ced55f5741..b12a9eff520 100644
--- a/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp
+++ b/src/bindings/scripts/scripts/zone/tempest_keep/arcatraz/arcatraz.cpp
@@ -347,7 +347,7 @@ struct TRINITY_DLL_DECL npc_warden_mellicharAI : public ScriptedAI
if( pInstance )
{
m_creature->InterruptNonMeleeSpells(true);
- m_creature->RemoveSpellsCausingAura(SPELL_AURA_DUMMY);
+ m_creature->RemoveAurasByType(SPELL_AURA_DUMMY);
switch( Phase )
{
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp
index 32b815e876b..3dfa7008e9a 100644
--- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp
+++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_cthun.cpp
@@ -965,7 +965,7 @@ struct TRINITY_DLL_DECL eye_tentacleAI : public Scripted_NoMovementAI
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
- if (target && !target->HasAura(SPELL_DIGESTIVE_ACID, 0))
+ if (target && !target->HasAura(SPELL_DIGESTIVE_ACID))
DoCast(target,SPELL_MIND_FLAY);
//Mindflay every 10 seconds
@@ -1033,7 +1033,7 @@ struct TRINITY_DLL_DECL claw_tentacleAI : public Scripted_NoMovementAI
return;
}
- if (!target->HasAura(SPELL_DIGESTIVE_ACID, 0))
+ if (!target->HasAura(SPELL_DIGESTIVE_ACID))
{
m_creature->GetMap()->CreatureRelocation(m_creature, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
Unit* p = DoSpawnCreature(MOB_SMALL_PORTAL,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN, 0);
@@ -1129,7 +1129,7 @@ struct TRINITY_DLL_DECL giant_claw_tentacleAI : public Scripted_NoMovementAI
return;
}
- if (!target->HasAura(SPELL_DIGESTIVE_ACID, 0))
+ if (!target->HasAura(SPELL_DIGESTIVE_ACID))
{
m_creature->GetMap()->CreatureRelocation(m_creature, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
Unit* p = DoSpawnCreature(MOB_GIANT_PORTAL,0,0,0,0,TEMPSUMMON_CORPSE_DESPAWN, 0);
@@ -1213,7 +1213,7 @@ struct TRINITY_DLL_DECL giant_eye_tentacleAI : public Scripted_NoMovementAI
{
Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM,0);
- if (target && !target->HasAura(SPELL_DIGESTIVE_ACID, 0))
+ if (target && !target->HasAura(SPELL_DIGESTIVE_ACID))
DoCast(target,SPELL_GREEN_BEAM);
//Beam every 2 seconds
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp
index 58d77bf17b2..0abaf8e79d9 100644
--- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp
+++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/boss_twinemperors.cpp
@@ -404,13 +404,6 @@ struct TRINITY_DLL_DECL boss_twinemperorsAI : public ScriptedAI
}
};
-class TRINITY_DLL_DECL BugAura : public Aura
-{
- public:
- BugAura(SpellEntry *spell, uint32 eff, int32 *bp, Unit *target, Unit *caster) : Aura(spell, eff, bp, target, caster, NULL)
- {}
-};
-
struct TRINITY_DLL_DECL boss_veknilashAI : public boss_twinemperorsAI
{
bool IAmVeklor() {return false;}
@@ -441,12 +434,14 @@ struct TRINITY_DLL_DECL boss_veknilashAI : public boss_twinemperorsAI
target->setFaction(14);
((CreatureAI*)target->AI())->AttackStart(m_creature->getThreatManager().getHostilTarget());
SpellEntry *spell = (SpellEntry *)GetSpellStore()->LookupEntry(SPELL_MUTATE_BUG);
+ uint8 eff_mask=0;
for (int i=0; i<3; i++)
{
if (!spell->Effect[i])
continue;
- target->AddAura(new BugAura(spell, i, NULL, target, target));
+ eff_mask|=1<<i;
}
+ target->AddAura(new Aura(spell, eff_mask, NULL, target, target));
target->SetHealth(target->GetMaxHealth());
}
@@ -524,12 +519,14 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI
{
target->setFaction(14);
SpellEntry *spell = (SpellEntry *)GetSpellStore()->LookupEntry(SPELL_EXPLODEBUG);
+ uint8 eff_mask=0;
for (int i=0; i<3; i++)
{
if (!spell->Effect[i])
continue;
- target->AddAura(new BugAura(spell, i, NULL, target, target));
+ eff_mask|=1<<i;
}
+ target->AddAura(new Aura(spell, eff_mask, NULL, target, target));
target->SetHealth(target->GetMaxHealth());
}
diff --git a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
index 97a139a9c3d..ceda8c5f915 100644
--- a/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
+++ b/src/bindings/scripts/scripts/zone/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp
@@ -247,13 +247,16 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI
void GainSentinelAbility(uint32 id)
{
const SpellEntry *spell = GetSpellStore()->LookupEntry(id);
+ uint8 eff_mask=0;
for (int i=0; i<3; i++)
{
if (!spell->Effect[i])
continue;
- SentinelAbilityAura *a = new SentinelAbilityAura(this, (SpellEntry *)spell, id, i);
- m_creature->AddAura(a);
+ eff_mask=1<<i;
}
+ SentinelAbilityAura *a = new SentinelAbilityAura(this, (SpellEntry *)spell, id, eff_mask);
+ m_creature->AddAura(a);
+
if (id == SPELL_KNOCK_BUFF)
{
m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true);
@@ -341,6 +344,5 @@ SentinelAbilityAura::SentinelAbilityAura(aqsentinelAI *abilityOwner, SpellEntry
{
aOwner = abilityOwner;
abilityId = ability;
- currentBasePoints = 0;
}
diff --git a/src/bindings/scripts/scripts/zone/undercity/undercity.cpp b/src/bindings/scripts/scripts/zone/undercity/undercity.cpp
index 316c47ef2f4..3194ebc5439 100644
--- a/src/bindings/scripts/scripts/zone/undercity/undercity.cpp
+++ b/src/bindings/scripts/scripts/zone/undercity/undercity.cpp
@@ -110,7 +110,7 @@ struct TRINITY_DLL_DECL npc_lady_sylvanas_windrunnerAI : public ScriptedAI
m_creature->SummonCreature(ENTRY_HIGHBORNE_BUNNY, raX, raY, myZ, 0, TEMPSUMMON_TIMED_DESPAWN, 3000);
LamentEvent_Timer = 2000;
- if( !m_creature->HasAura(SPELL_SYLVANAS_CAST, 0))
+ if( !m_creature->HasAura(SPELL_SYLVANAS_CAST))
{
DoScriptText(SAY_LAMENT_END, m_creature);
DoScriptText(EMOTE_LAMENT_END, m_creature);
@@ -210,7 +210,7 @@ bool GossipHello_npc_parqual_fintallas(Player *player, Creature *_Creature)
if (_Creature->isQuestGiver())
player->PrepareQuestMenu( _Creature->GetGUID() );
- if (player->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !player->HasAura(SPELL_MARK_OF_SHAME,0) )
+ if (player->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !player->HasAura(SPELL_MARK_OF_SHAME) )
{
player->ADD_GOSSIP_ITEM( 0, GOSSIP_HPF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
player->ADD_GOSSIP_ITEM( 0, GOSSIP_HPF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
index 7fa0fb871de..8a9310a7444 100644
--- a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_ingvar_the_plunderer.cpp
@@ -344,7 +344,7 @@ struct TRINITY_DLL_DECL mob_annhylde_the_callerAI : public ScriptedAI
switch (id)
{
case 1:
- ingvar->RemoveAura(SPELL_SUMMON_BANSHEE,1);
+ ingvar->RemoveAura(SPELL_SUMMON_BANSHEE);
ingvar->CastSpell(ingvar,SPELL_SCOURG_RESURRECTION_DUMMY,true);
DoCast(ingvar,SPELL_SCOURG_RESURRECTION_BEAM);
Resurect_Timer = 8000;
diff --git a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp
index 0b26eeafcc0..a417decdb94 100644
--- a/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp
+++ b/src/bindings/scripts/scripts/zone/utgarde_keep/utgarde_keep/boss_keleseth.cpp
@@ -86,7 +86,7 @@ struct TRINITY_DLL_DECL mob_frost_tombAI : public ScriptedAI
void UpdateAI(const uint32 diff)
{
Unit* temp = Unit::GetUnit((*m_creature),FrostTombGUID);
- if((temp && temp->isAlive() && !temp->HasAura(SPELL_FROST_TOMB,0)) || !temp )
+ if((temp && temp->isAlive() && !temp->HasAura(SPELL_FROST_TOMB)) || !temp )
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
};
diff --git a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp
index d45750cc4df..0212e4005f5 100644
--- a/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp
+++ b/src/bindings/scripts/scripts/zone/zulaman/boss_nalorakk.cpp
@@ -394,7 +394,7 @@ struct TRINITY_DLL_DECL boss_nalorakkAI : public ScriptedAI
if(Mangle_Timer < diff)
{
- if(m_creature->getVictim() && !m_creature->getVictim()->HasAura(SPELL_MANGLEEFFECT, 0))
+ if(m_creature->getVictim() && !m_creature->getVictim()->HasAura(SPELL_MANGLEEFFECT))
{
DoCast(m_creature->getVictim(), SPELL_MANGLE);
Mangle_Timer = 1000;
diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp
index ef9d8d92682..4d657fd6c84 100644
--- a/src/game/AuctionHouseHandler.cpp
+++ b/src/game/AuctionHouseHandler.cpp
@@ -50,7 +50,7 @@ void WorldSession::HandleAuctionHelloOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendAuctionHello(guid, unit);
}
@@ -199,7 +199,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Item *it = pl->GetItemByGuid( item );
//do not allow to sell already auctioned items
@@ -304,7 +304,7 @@ void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() );
@@ -430,7 +430,7 @@ void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() );
@@ -515,7 +515,7 @@ void WorldSession::HandleAuctionListBidderItems( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() );
@@ -564,7 +564,7 @@ void WorldSession::HandleAuctionListOwnerItems( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() );
@@ -611,7 +611,7 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
AuctionHouseObject* auctionHouse = auctionmgr.GetAuctionsMap( pCreature->getFaction() );
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index 772b8c596ca..9f1e9f6218d 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -703,7 +703,7 @@ void BattleGround::EndBattleGround(uint32 winner)
// should remove spirit of redemption
if(plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
- plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
+ plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if(!plr->isAlive())
{
@@ -928,7 +928,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
// should remove spirit of redemption
if(plr && plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
- plr->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
+ plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if(plr && !plr->isAlive()) // resurrect on exit
{
@@ -1312,7 +1312,7 @@ void BattleGround::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid
SpellEntry const *spellInfo = sSpellStore.LookupEntry( SPELL_WAITING_FOR_RESURRECT );
if(spellInfo)
{
- Aura *Aur = CreateAura(spellInfo, 0, NULL, plr);
+ Aura *Aur = new Aura(spellInfo, 1, NULL, plr);
plr->AddAura(Aur);
}
}
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp
index c9b37289e64..1e118d2c04a 100644
--- a/src/game/CharacterHandler.cpp
+++ b/src/game/CharacterHandler.cpp
@@ -66,7 +66,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points,bgid,bgteam,bgmap,bgx,bgy,bgz,bgo FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid));
- res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
+ res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_mask,stackcount,amount0, amount1, amount2 ,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp
index 398a871d946..ae282b05c1e 100644
--- a/src/game/ChatHandler.cpp
+++ b/src/game/ChatHandler.cpp
@@ -67,11 +67,11 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if(langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
{
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
- Unit::AuraList const& langAuras = _player->GetAurasByType(SPELL_AURA_COMPREHEND_LANGUAGE);
+ Unit::AuraEffectList const& langAuras = _player->GetAurasByType(SPELL_AURA_COMPREHEND_LANGUAGE);
bool foundAura = false;
- for(Unit::AuraList::const_iterator i = langAuras.begin();i != langAuras.end(); ++i)
+ for(Unit::AuraEffectList::const_iterator i = langAuras.begin();i != langAuras.end(); ++i)
{
- if((*i)->GetModifier()->m_miscvalue == lang)
+ if((*i)->GetMiscValue() == lang)
{
foundAura = true;
break;
@@ -138,9 +138,9 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
}
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
- Unit::AuraList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);
+ Unit::AuraEffectList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);
if(!ModLangAuras.empty())
- lang = ModLangAuras.front()->GetModifier()->m_miscvalue;
+ lang = ModLangAuras.front()->GetMiscValue();
}
if (!_player->CanSpeak())
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp
index 69e371d323e..76537754b26 100644
--- a/src/game/Creature.cpp
+++ b/src/game/Creature.cpp
@@ -2066,9 +2066,8 @@ bool Creature::LoadCreaturesAddon(bool reload)
continue;
}
- Aura* AdditionalAura = CreateAura(AdditionalSpellInfo, cAura->effect_idx, NULL, this, this, 0);
- AddAura(AdditionalAura);
- sLog.outDebug("Spell: %u with Aura %u added to creature (GUIDLow: %u Entry: %u )", cAura->spell_id, AdditionalSpellInfo->EffectApplyAuraName[0],GetGUIDLow(),GetEntry());
+ AddAuraEffect(AdditionalSpellInfo->Id, cAura->effect_idx, this);
+ sLog.outDebug("Spell: %u with Aura %u added to creature (GUIDLow: %u Entry: %u )", cAura->spell_id, AdditionalSpellInfo->EffectApplyAuraName[cAura->effect_idx],GetGUIDLow(),GetEntry());
}
}
return true;
diff --git a/src/game/CreatureAI.cpp b/src/game/CreatureAI.cpp
index 3295c1149c5..45608ef317e 100644
--- a/src/game/CreatureAI.cpp
+++ b/src/game/CreatureAI.cpp
@@ -118,9 +118,9 @@ void SimpleCharmedAI::UpdateAI(const uint32 /*diff*/)
//kill self if charm aura has infinite duration
if(charmer->IsInEvadeMode())
{
- Unit::AuraList const& auras = me->GetAurasByType(SPELL_AURA_MOD_CHARM);
- for(Unit::AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
- if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->IsPermanent())
+ Unit::AuraEffectList const& auras = me->GetAurasByType(SPELL_AURA_MOD_CHARM);
+ for(Unit::AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
+ if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetParentAura()->IsPermanent())
{
charmer->Kill(me);
return;
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
index ec62a460701..98fe0000ed4 100644
--- a/src/game/DBCStructure.h
+++ b/src/game/DBCStructure.h
@@ -1186,6 +1186,8 @@ struct SoundEntriesEntry
// 28 m_EAXDef
};
+#define MAX_SPELL_EFFECTS 3
+
struct SpellEntry
{
uint32 Id; // 0 m_ID
@@ -1241,26 +1243,26 @@ struct SpellEntry
int32 EquippedItemClass; // 65 m_equippedItemClass (value)
int32 EquippedItemSubClassMask; // 66 m_equippedItemSubclass (mask)
int32 EquippedItemInventoryTypeMask; // 67 m_equippedItemInvTypes (mask)
- uint32 Effect[3]; // 68-70 m_effect
- int32 EffectDieSides[3]; // 71-73 m_effectDieSides
- uint32 EffectBaseDice[3]; // 74-76 m_effectBaseDice
- float EffectDicePerLevel[3]; // 77-79 m_effectDicePerLevel
- float EffectRealPointsPerLevel[3]; // 80-82 m_effectRealPointsPerLevel
- int32 EffectBasePoints[3]; // 83-85 m_effectBasePoints (don't must be used in spell/auras explicitly, must be used cached Spell::m_currentBasePoints)
- uint32 EffectMechanic[3]; // 86-88 m_effectMechanic
- uint32 EffectImplicitTargetA[3]; // 89-91 m_implicitTargetA
- uint32 EffectImplicitTargetB[3]; // 92-94 m_implicitTargetB
- uint32 EffectRadiusIndex[3]; // 95-97 m_effectRadiusIndex - spellradius.dbc
- uint32 EffectApplyAuraName[3]; // 98-100 m_effectAura
- uint32 EffectAmplitude[3]; // 101-103 m_effectAuraPeriod
- float EffectMultipleValue[3]; // 104-106 m_effectAmplitude
- uint32 EffectChainTarget[3]; // 107-109 m_effectChainTargets
- uint32 EffectItemType[3]; // 110-112 m_effectItemType
- int32 EffectMiscValue[3]; // 113-115 m_effectMiscValue
- int32 EffectMiscValueB[3]; // 116-118 m_effectMiscValueB
- uint32 EffectTriggerSpell[3]; // 119-121 m_effectTriggerSpell
- float EffectPointsPerComboPoint[3]; // 122-124 m_effectPointsPerCombo
- flag96 EffectSpellClassMask[3]; //
+ uint32 Effect[MAX_SPELL_EFFECTS]; // 68-70 m_effect
+ int32 EffectDieSides[MAX_SPELL_EFFECTS]; // 71-73 m_effectDieSides
+ uint32 EffectBaseDice[MAX_SPELL_EFFECTS]; // 74-76 m_effectBaseDice
+ float EffectDicePerLevel[MAX_SPELL_EFFECTS]; // 77-79 m_effectDicePerLevel
+ float EffectRealPointsPerLevel[MAX_SPELL_EFFECTS]; // 80-82 m_effectRealPointsPerLevel
+ int32 EffectBasePoints[MAX_SPELL_EFFECTS]; // 83-85 m_effectBasePoints (don't must be used in spell/auras explicitly, must be used cached Spell::m_currentBasePoints)
+ uint32 EffectMechanic[MAX_SPELL_EFFECTS]; // 86-88 m_effectMechanic
+ uint32 EffectImplicitTargetA[MAX_SPELL_EFFECTS]; // 89-91 m_implicitTargetA
+ uint32 EffectImplicitTargetB[MAX_SPELL_EFFECTS]; // 92-94 m_implicitTargetB
+ uint32 EffectRadiusIndex[MAX_SPELL_EFFECTS]; // 95-97 m_effectRadiusIndex - spellradius.dbc
+ uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]; // 98-100 m_effectAura
+ uint32 EffectAmplitude[MAX_SPELL_EFFECTS]; // 101-103 m_effectAuraPeriod
+ float EffectMultipleValue[MAX_SPELL_EFFECTS]; // 104-106 m_effectAmplitude
+ uint32 EffectChainTarget[MAX_SPELL_EFFECTS]; // 107-109 m_effectChainTargets
+ uint32 EffectItemType[MAX_SPELL_EFFECTS]; // 110-112 m_effectItemType
+ int32 EffectMiscValue[MAX_SPELL_EFFECTS]; // 113-115 m_effectMiscValue
+ int32 EffectMiscValueB[MAX_SPELL_EFFECTS]; // 116-118 m_effectMiscValueB
+ uint32 EffectTriggerSpell[MAX_SPELL_EFFECTS]; // 119-121 m_effectTriggerSpell
+ float EffectPointsPerComboPoint[MAX_SPELL_EFFECTS]; // 122-124 m_effectPointsPerCombo
+ flag96 EffectSpellClassMask[MAX_SPELL_EFFECTS]; //
uint32 SpellVisual[2]; // 134-135 m_spellVisualID
uint32 SpellIconID; // 136 m_spellIconID
uint32 activeIconID; // 137 m_activeIconID
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
index 93a311bcbe1..d294886619c 100644
--- a/src/game/DynamicObject.cpp
+++ b/src/game/DynamicObject.cpp
@@ -155,7 +155,7 @@ void DynamicObject::Delay(int32 delaytime)
m_aliveDuration -= delaytime;
for(AffectedSet::iterator iunit= m_affected.begin();iunit != m_affected.end();++iunit)
if (*iunit)
- (*iunit)->DelayAura(m_spellId, m_effIndex, delaytime);
+ (*iunit)->DelayAura(m_spellId, GetCaster()->GetGUID() , delaytime);
}
bool DynamicObject::isVisibleForInState(Player const* u, bool inVisibleList) const
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index e0d96221d04..a7b8c753782 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -960,7 +960,7 @@ namespace Trinity
bool operator()(Unit* u)
{
if(u->isAlive() && u->isInCombat() && /*!i_obj->IsHostileTo(u)*/ i_obj->IsFriendlyTo(u) && i_obj->IsWithinDistInMap(u, i_range) &&
- !(u->HasAura(i_spell, 0) || u->HasAura(i_spell, 1) || u->HasAura(i_spell, 2)))
+ !(u->HasAura(i_spell)))
{
return true;
}
diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h
index 0b19f89d60c..97daafa6ced 100644
--- a/src/game/GridNotifiersImpl.h
+++ b/src/game/GridNotifiersImpl.h
@@ -205,8 +205,7 @@ inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target)
if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo, eff_index))
return;
// Apply PersistentAreaAura on target
- PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, eff_index, NULL, target, i_dynobject.GetCaster());
- target->AddAura(Aur);
+ target->AddAuraEffect(spellInfo->Id, eff_index, i_dynobject.GetCaster());
i_dynobject.AddAffected(target);
}
diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp
index df9f0fc0a1a..b0094989e19 100644
--- a/src/game/GroupHandler.cpp
+++ b/src/game/GroupHandler.cpp
@@ -30,6 +30,9 @@
#include "Group.h"
#include "SocialMgr.h"
#include "Util.h"
+#include "SpellAuras.h"
+
+class Aura;
/* differeces from off:
-you can uninvite yourself - is is useful
@@ -713,8 +716,8 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
{
if(auramask & (uint64(1) << i))
{
- AuraSlotEntry * pAura = player->GetVisibleAura(i);
- *data << uint32(pAura ? pAura->m_spellId : 0);
+ Aura * pAura = player->GetVisibleAura(i);
+ *data << uint32(pAura ? pAura->GetId() : 0);
*data << uint8(1);
}
}
@@ -795,8 +798,8 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
{
if(auramask & (uint64(1) << i))
{
- AuraSlotEntry * pAura = pet->GetVisibleAura(i);
- *data << uint32(pAura ? pAura->m_spellId : 0);
+ Aura * pAura = pet->GetVisibleAura(i);
+ *data << uint32(pAura ? pAura->GetId() : 0);
*data << uint8(1);
}
}
@@ -855,10 +858,10 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data << (uint64) auramask; // placeholder
for(uint8 i = 0; i < MAX_AURAS; ++i)
{
- if(AuraSlotEntry * pAura = player->GetVisibleAura(i))
+ if(Aura * pAura = player->GetVisibleAura(i))
{
auramask |= (uint64(1) << i);
- data << (uint32) pAura->m_spellId;
+ data << (uint32) pAura->GetId();
data << (uint8) 1;
}
}
@@ -881,10 +884,10 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data << (uint64) petauramask; // placeholder
for(uint8 i = 0; i < MAX_AURAS; ++i)
{
- if(AuraSlotEntry * pAura = pet->GetVisibleAura(i))
+ if(Aura * pAura = pet->GetVisibleAura(i))
{
petauramask |= (uint64(1) << i);
- data << (uint32) pAura->m_spellId;
+ data << (uint32) pAura->GetId();
data << (uint8) 1;
}
}
diff --git a/src/game/GuardAI.cpp b/src/game/GuardAI.cpp
index 1aabe1beeda..09314d5e69f 100644
--- a/src/game/GuardAI.cpp
+++ b/src/game/GuardAI.cpp
@@ -52,7 +52,7 @@ void GuardAI::MoveInLineOfSight(Unit *u)
{
//Need add code to let guard support player
AttackStart(u);
- //u->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
+ //u->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
}
}
}
diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp
index 358d48292a3..ac91f47bf95 100644
--- a/src/game/GuildHandler.cpp
+++ b/src/game/GuildHandler.cpp
@@ -793,7 +793,7 @@ void WorldSession::HandleGuildSaveEmblemOpcode(WorldPacket& recvPacket)
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
recvPacket >> EmblemStyle;
recvPacket >> EmblemColor;
diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp
index 854ef9e1d29..27aa29267df 100644
--- a/src/game/ItemHandler.cpp
+++ b/src/game/ItemHandler.cpp
@@ -528,7 +528,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Item *pItem = _player->GetItemByGuid( itemguid );
if( pItem )
@@ -633,7 +633,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Item *pItem = _player->GetItemFromBuyBackSlot( slot );
if( pItem )
@@ -720,7 +720,7 @@ void WorldSession::SendListInventory( uint64 vendorguid )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
pCreature->StopMoving();
diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp
index a8bbbfb95a1..50aa1e46538 100644
--- a/src/game/Level0.cpp
+++ b/src/game/Level0.cpp
@@ -127,7 +127,7 @@ bool ChatHandler::HandleDismountCommand(const char* /*args*/)
}
m_session->GetPlayer()->Unmount();
- m_session->GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
+ m_session->GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
return true;
}
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 075b41ca743..b20c1ffb02b 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -4018,6 +4018,7 @@ bool ChatHandler::HandleAuraCommand(const char* args)
uint32 spellID = extractSpellIdFromLink((char*)args);
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID );
+ uint8 eff_mask=0;
if(spellInfo)
{
for(uint32 i = 0;i<3;i++)
@@ -4029,11 +4030,12 @@ bool ChatHandler::HandleAuraCommand(const char* args)
eff == SPELL_EFFECT_APPLY_AURA ||
eff == SPELL_EFFECT_PERSISTENT_AREA_AURA )
{
- Aura *Aur = CreateAura(spellInfo, i, NULL, target);
- target->AddAura(Aur);
+ eff_mask|=1<<i;
}
}
}
+ Aura *Aur = new Aura(spellInfo, eff_mask, NULL, target);
+ target->AddAura(Aur);
return true;
}
@@ -4938,16 +4940,18 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
std::ostringstream ss_name;
ss_name << "|cffffffff|Hspell:" << itr->second->GetId() << "|h[" << name << "]|h|r";
- PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffIndex(),
- itr->second->GetModifier()->m_auraname, itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(),
+ PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffectMask(),
+ itr->second->GetAuraCharges(), itr->second->GetStackAmount(),itr->second->GetAuraSlot(),
+ itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(),
ss_name.str().c_str(),
(itr->second->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID()));
}
else
{
- PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffIndex(),
- itr->second->GetModifier()->m_auraname, itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(),
+ PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffectMask(),
+ itr->second->GetAuraCharges(), itr->second->GetStackAmount(),itr->second->GetAuraSlot(),
+ itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(),
name,
(itr->second->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID()));
@@ -4955,30 +4959,18 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
}
for (int i = 0; i < TOTAL_AURAS; i++)
{
- Unit::AuraList const& uAuraList = unit->GetAurasByType(AuraType(i));
+ Unit::AuraEffectList const& uAuraList = unit->GetAurasByType(AuraType(i));
if (uAuraList.empty()) continue;
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
- for (Unit::AuraList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
+ for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
{
- bool talent = GetTalentSpellCost((*itr)->GetId()) > 0;
-
char const* name = (*itr)->GetSpellProto()->SpellName[m_session->GetSessionDbcLocale()];
- if (m_session)
- {
- std::ostringstream ss_name;
- ss_name << "|cffffffff|Hspell:" << (*itr)->GetId() << "|h[" << name << "]|h|r";
+ std::ostringstream ss_name;
+ ss_name << "|cffffffff|Hspell:" << (*itr)->GetId() << "|h[" << name << "]|h|r";
- PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(),
- ss_name.str().c_str(),((*itr)->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
- IS_PLAYER_GUID((*itr)->GetCasterGUID()) ? "player" : "creature",GUID_LOPART((*itr)->GetCasterGUID()));
- }
- else
- {
- PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(),
- name,((*itr)->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
- IS_PLAYER_GUID((*itr)->GetCasterGUID()) ? "player" : "creature",GUID_LOPART((*itr)->GetCasterGUID()));
- }
+ PSendSysMessage(LANG_COMMAND_TARGET_AURASIMPLE, (*itr)->GetId(), (*itr)->GetEffIndex(),
+ (*itr)->GetAmount());
}
}
return true;
@@ -7405,26 +7397,10 @@ bool ChatHandler::HandleFreezeCommand(const char *args)
}
}
- //stop movement and disable spells
- uint32 spellID = 9454;
//m_session->GetPlayer()->CastSpell(player,spellID,false);
- SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID );
- if(spellInfo) //TODO: Change the duration of the aura to -1 instead of 5000000
- {
- for(uint32 i = 0;i<3;i++)
- {
- uint8 eff = spellInfo->Effect[i];
- if (eff>=TOTAL_SPELL_EFFECTS)
- continue;
- if( eff == SPELL_EFFECT_APPLY_AREA_AURA_PARTY || eff == SPELL_EFFECT_APPLY_AURA ||
- eff == SPELL_EFFECT_PERSISTENT_AREA_AURA || eff == SPELL_EFFECT_APPLY_AREA_AURA_FRIEND ||
- eff == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY)
- {
- Aura *Aur = CreateAura(spellInfo, i, NULL, player);
- player->AddAura(Aur);
- }
- }
- }
+ SpellEntry const *spellInfo = sSpellStore.LookupEntry( 9454 );
+ Aura *Aur = new Aura(spellInfo, 1, NULL, player);
+ player->AddAura(Aur);
//save player
player->SaveToDB();
@@ -7580,9 +7556,9 @@ bool ChatHandler::HandleUnPossessCommand(const char* args)
Unit* pUnit = getSelectedUnit();
if(!pUnit) pUnit = m_session->GetPlayer();
- pUnit->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
- pUnit->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS_PET);
- pUnit->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
+ pUnit->RemoveAurasByType(SPELL_AURA_MOD_CHARM);
+ pUnit->RemoveAurasByType(SPELL_AURA_MOD_POSSESS_PET);
+ pUnit->RemoveAurasByType(SPELL_AURA_MOD_POSSESS);
return true;
}
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 35842906e49..81cdace92c8 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -118,7 +118,7 @@ void WorldSession::HandleGossipSelectOptionOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if(!code.empty())
{
@@ -354,7 +354,7 @@ void WorldSession::HandleLogoutRequestOpcode( WorldPacket & /*recv_data*/ )
//Can not logout if...
if( GetPlayer()->isInCombat() || //...is in combat
GetPlayer()->duel || //...is in Duel
- GetPlayer()->HasAura(9454,0) || //...is frozen by GM via freeze command
+ GetPlayer()->HasAura(9454) || //...is frozen by GM via freeze command
//...is jumping ...is falling
GetPlayer()->HasUnitMovementFlag(MOVEMENTFLAG_JUMPING | MOVEMENTFLAG_FALLING))
{
@@ -1648,7 +1648,7 @@ void WorldSession::HandleDismountOpcode( WorldPacket & /*recv_data*/ )
}
_player->Unmount();
- _player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
+ _player->RemoveAurasByType(SPELL_AURA_MOUNTED);
}
void WorldSession::HandleMoveFlyModeChangeAckOpcode( WorldPacket & recv_data )
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index 28317cc1471..69a8572e7a5 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -150,7 +150,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// mount allow check
if(!mEntry->IsMountAllowed())
- _player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
+ _player->RemoveAurasByType(SPELL_AURA_MOUNTED);
// honorless target
if(GetPlayer()->pvpInfo.inHostileArea)
@@ -262,7 +262,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
plMover->UpdateFallInformationIfNeed(movementInfo,recv_data.GetOpcode());
if(plMover->isMovingOrTurning())
- plMover->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ plMover->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if(movementInfo.z < -500.0f)
{
diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp
index 134789a4e31..f3a268a3b06 100644
--- a/src/game/NPCHandler.cpp
+++ b/src/game/NPCHandler.cpp
@@ -54,7 +54,7 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendTabardVendorActivate(guid);
}
@@ -85,7 +85,7 @@ void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendShowBank(guid);
}
@@ -126,7 +126,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// trainer list loaded at check;
if(!unit->isCanTrainingOf(_player,true))
@@ -212,7 +212,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if(!unit->isCanTrainingOf(_player,true))
return;
@@ -279,7 +279,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
GetPlayer()->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_TALK);
// remove fake death
//if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- // GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ // GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if( unit->isArmorer() || unit->isCivilian() || unit->isQuestGiver() || unit->isServiceProvider())
{
@@ -337,7 +337,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if(!code.empty())
{
@@ -370,7 +370,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendSpiritResurrect();
}
@@ -431,7 +431,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
SendBindPoint(unit);
}
@@ -500,11 +500,11 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// remove mounts this fix bug where getting pet from stable while mounted deletes pet.
if(GetPlayer()->IsMounted())
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_MOUNTED);
SendStablePet(npcGUID);
}
@@ -580,7 +580,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
Pet *pet = _player->GetPet();
@@ -641,7 +641,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
WorldPacket data(SMSG_STABLE_RESULT, 200); // guess size
@@ -700,7 +700,7 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
WorldPacket data(SMSG_STABLE_RESULT, 200);
@@ -746,7 +746,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
WorldPacket data(SMSG_STABLE_RESULT, 200); // guess size
@@ -802,7 +802,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// reputation discount
float discountMod = _player->GetReputationPriceDiscount(unit);
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 0d53cfc4ab7..170c49fe78f 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1802,10 +1802,10 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
if(petType == SUMMON_PET && pet->LoadPetFromDB(this, entry))
{
// Remove Demonic Sacrifice auras (known pet)
- Unit::AuraList const& auraClassScripts = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for(Unit::AuraList::const_iterator itr = auraClassScripts.begin();itr!=auraClassScripts.end();)
+ Unit::AuraEffectList const& auraClassScripts = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin();itr!=auraClassScripts.end();)
{
- if((*itr)->GetModifier()->m_miscvalue==2228)
+ if((*itr)->GetMiscValue()==2228)
{
RemoveAurasDueToSpell((*itr)->GetId());
itr = auraClassScripts.begin();
@@ -1880,10 +1880,10 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
if(petType == SUMMON_PET)
{
// Remove Demonic Sacrifice auras (known pet)
- Unit::AuraList const& auraClassScripts = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for(Unit::AuraList::const_iterator itr = auraClassScripts.begin();itr!=auraClassScripts.end();)
+ Unit::AuraEffectList const& auraClassScripts = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin();itr!=auraClassScripts.end();)
{
- if((*itr)->GetModifier()->m_miscvalue==2228)
+ if((*itr)->GetMiscValue()==2228)
{
RemoveAurasDueToSpell((*itr)->GetId());
itr = auraClassScripts.begin();
diff --git a/src/game/OutdoorPvPSI.cpp b/src/game/OutdoorPvPSI.cpp
index 04bebb2bc4e..2bd35ef5a54 100644
--- a/src/game/OutdoorPvPSI.cpp
+++ b/src/game/OutdoorPvPSI.cpp
@@ -129,7 +129,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
switch(trigger)
{
case SI_AREATRIGGER_A:
- if(plr->GetTeam() == ALLIANCE && plr->HasAura(SI_SILITHYST_FLAG,0))
+ if(plr->GetTeam() == ALLIANCE && plr->HasAura(SI_SILITHYST_FLAG))
{
// remove aura
plr->RemoveAurasDueToSpell(SI_SILITHYST_FLAG);
@@ -154,7 +154,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player *plr, uint32 trigger)
}
return true;
case SI_AREATRIGGER_H:
- if(plr->GetTeam() == HORDE && plr->HasAura(SI_SILITHYST_FLAG,0))
+ if(plr->GetTeam() == HORDE && plr->HasAura(SI_SILITHYST_FLAG))
{
// remove aura
plr->RemoveAurasDueToSpell(SI_SILITHYST_FLAG);
diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp
index efdee1f0d54..f5e0d5ad7fc 100644
--- a/src/game/Pet.cpp
+++ b/src/game/Pet.cpp
@@ -564,10 +564,10 @@ void Pet::RegenerateFocus()
float addvalue = 24 * sWorld.getRate(RATE_POWER_FOCUS);
- AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
- for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
- if ((*i)->GetModifier()->m_miscvalue == POWER_FOCUS)
- addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f;
+ AuraEffectList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
+ for(AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
+ if ((*i)->GetMiscValue() == POWER_FOCUS)
+ addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
ModifyPower(POWER_FOCUS, (int32)addvalue);
}
@@ -1079,41 +1079,39 @@ void Pet::_SaveSpells()
void Pet::_LoadAuras(uint32 timediff)
{
+ sLog.outDebug("Loading auras for pet %u",GetGUIDLow());
m_Auras.clear();
for (int i = 0; i < TOTAL_AURAS; i++)
m_modAuras[i].clear();
- QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM pet_aura WHERE guid = '%u'",m_charmInfo->GetPetNumber());
+ QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_mask,stackcount,amount0, amount1, amount2 ,maxduration,remaintime,remaincharges FROM pet_aura WHERE guid = '%u'",m_charmInfo->GetPetNumber());
if(result)
{
do
{
+ int32 damage[3];
Field *fields = result->Fetch();
uint64 caster_guid = fields[0].GetUInt64();
uint32 spellid = fields[1].GetUInt32();
- uint32 effindex = fields[2].GetUInt32();
- uint32 stackcount= fields[3].GetUInt32();
- int32 damage = (int32)fields[4].GetUInt32();
- int32 maxduration = (int32)fields[5].GetUInt32();
- int32 remaintime = (int32)fields[6].GetUInt32();
- int32 remaincharges = (int32)fields[7].GetUInt32();
+ uint32 effmask = fields[2].GetUInt32();
+ uint32 stackcount = fields[3].GetUInt32();
+ damage[0] = int32(fields[4].GetUInt32());
+ damage[1] = int32(fields[5].GetUInt32());
+ damage[2] = int32(fields[6].GetUInt32());
+ int32 maxduration = (int32)fields[7].GetUInt32();
+ int32 remaintime = (int32)fields[8].GetUInt32();
+ int32 remaincharges = (int32)fields[9].GetUInt32();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if(!spellproto)
{
- sLog.outError("Unknown aura (spellid %u, effindex %u), ignore.",spellid,effindex);
- continue;
- }
-
- if(effindex >= 3)
- {
- sLog.outError("Invalid effect index (spellid %u, effindex %u), ignore.",spellid,effindex);
+ sLog.outError("Unknown aura (spellid %u), ignore.",spellid);
continue;
}
// negative effects should continue counting down after logout
- if (remaintime != -1 && !IsPositiveEffect(spellid, effindex))
+ if (remaintime != -1 && !IsPositiveSpell(spellid))
{
if(remaintime <= int32(timediff))
continue;
@@ -1128,21 +1126,12 @@ void Pet::_LoadAuras(uint32 timediff)
remaincharges = spellproto->procCharges;
}
else
- remaincharges = -1;
-
- /// do not load single target auras (unless they were cast by the player)
- if (caster_guid != GetGUID() && IsSingleTargetSpell(spellproto))
- continue;
+ remaincharges = 0;
- for(uint32 i=0; i<stackcount; i++)
- {
- Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL);
-
- if(!damage)
- damage = aura->GetModifier()->m_amount;
- aura->SetLoadedState(caster_guid,damage,maxduration,remaintime,remaincharges);
- AddAura(aura);
- }
+ Aura* aura = new Aura(spellproto, effmask, NULL, this, NULL, NULL);
+ aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]);
+ AddAura(aura);
+ sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
}
while( result->NextRow() );
@@ -1155,52 +1144,33 @@ void Pet::_SaveAuras()
CharacterDatabase.PExecute("DELETE FROM pet_aura WHERE guid = '%u'", m_charmInfo->GetPetNumber());
AuraMap const& auras = GetAuras();
- if (auras.empty())
- return;
-
- spellEffectPair lastEffectPair = auras.begin()->first;
- uint32 stackCounter = 1;
-
- for(AuraMap::const_iterator itr = auras.begin(); ; ++itr)
+ for(AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr)
{
- if(itr == auras.end() || lastEffectPair != itr->first)
+ // skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras.
+ // do not save single target auras (unless they were cast by the player)
+ if (itr->second->IsPassive()
+ || (itr->second->GetCasterGUID() != GetGUID() && itr->second->IsSingleTarget()))
+ continue;
+ SpellEntry const *spellInfo = itr->second->GetSpellProto();
+ for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
+ if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH ||
+ spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_OWNER ||
+ spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PET )
+ continue;
+ uint32 amounts[MAX_SPELL_EFFECTS];
+ for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
{
- AuraMap::const_iterator itr2 = itr;
- // save previous spellEffectPair to db
- itr2--;
- SpellEntry const *spellInfo = itr2->second->GetSpellProto();
- /// do not save single target auras (unless they were cast by the player)
- if (!(itr2->second->GetCasterGUID() != GetGUID() && IsSingleTargetSpell(spellInfo)))
- {
- if(!itr2->second->IsPassive())
- {
- // skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras.
- uint8 i;
- for (i = 0; i < 3; i++)
- if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH ||
- spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_OWNER ||
- spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PET )
- break;
-
- if (i == 3)
- {
- CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) "
- "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%u', '%d', '%d', '%d', '%d')",
- m_charmInfo->GetPetNumber(), itr2->second->GetCasterGUID(),(uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount ,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges()));
- }
- }
- }
- if(itr == auras.end())
- break;
+ if (AuraEffect * partAura = itr->second->GetPartAura(i))
+ amounts[i]=partAura->GetAmount();
+ else
+ amounts[i]=0;
}
- if (lastEffectPair == itr->first)
- stackCounter++;
- else
- {
- lastEffectPair = itr->first;
- stackCounter = 1;
- }
+ CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_mask,stackcount,amount0, amount1, amount2,maxduration,remaintime,remaincharges) "
+ "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%u', '%u', '%u', '%d', '%d', '%d', '%d')",
+ m_charmInfo->GetPetNumber(), itr->second->GetCasterGUID(),(uint32)itr->second->GetId(), (uint32)itr->second->GetEffectMask(),
+ (uint32)itr->second->GetStackAmount(), amounts[0], amounts[1], amounts[2]
+ ,int(itr->second->GetAuraMaxDuration()),int(itr->second->GetAuraDuration()),int(itr->second->GetAuraCharges()));
}
}
diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp
index 2b225283749..0ec0eee3d9e 100644
--- a/src/game/PetitionsHandler.cpp
+++ b/src/game/PetitionsHandler.cpp
@@ -91,7 +91,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
uint32 charterid = 0;
uint32 cost = 0;
@@ -915,7 +915,7 @@ void WorldSession::SendPetitionShowList(uint64 guid)
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
uint8 count = 0;
if(pCreature->isTabardDesigner())
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 668434825b4..e0f2a162b8d 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -64,6 +64,7 @@
#include "SocialMgr.h"
#include "GameEventMgr.h"
#include "AchievementMgr.h"
+#include "SpellAuras.h"
#include <cmath>
@@ -933,9 +934,9 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_DISABLE_BREATHING))
return DISABLED_MIRROR_TIMER;
int32 UnderWaterTime = 3*MINUTE*IN_MILISECONDS;
- AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING);
- for(AuraList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
- UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetModifier()->m_amount) / 100.0f);
+ AuraEffectList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING);
+ for(AuraEffectList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
+ UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetAmount()) / 100.0f);
return UnderWaterTime;
}
case FIRE_TIMER:
@@ -1997,10 +1998,10 @@ void Player::Regenerate(Powers power)
// Exist only for POWER_MANA, POWER_ENERGY, POWER_FOCUS auras
if(power != POWER_MANA)
{
- AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
- for(AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
- if ((*i)->GetModifier()->m_miscvalue == power)
- addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f;
+ AuraEffectList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
+ for(AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
+ if ((*i)->GetMiscValue() == power)
+ addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
}
if (power != POWER_RAGE && power != POWER_RUNIC_POWER)
@@ -2039,9 +2040,9 @@ void Player::RegenerateHealth()
addvalue = OCTRegenHPPerSpirit()* HealthIncreaseRate;
if (!isInCombat())
{
- AuraList const& mModHealthRegenPct = GetAurasByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
- for(AuraList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
- addvalue *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f;
+ AuraEffectList const& mModHealthRegenPct = GetAurasByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
+ for(AuraEffectList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
+ addvalue *= (100.0f + (*i)->GetAmount()) / 100.0f;
}
else if(HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
addvalue *= GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT) / 100.0f;
@@ -2112,7 +2113,7 @@ void Player::SetGameMaster(bool on)
else
{
// restore phase
- AuraList const& phases = GetAurasByType(SPELL_AURA_PHASE);
+ AuraEffectList const& phases = GetAurasByType(SPELL_AURA_PHASE);
SetPhaseMask(!phases.empty() ? phases.front()->GetMiscValue() : PHASEMASK_NORMAL,false);
m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
@@ -2243,9 +2244,9 @@ void Player::GiveXP(uint32 xp, Unit* victim)
return;
// handle SPELL_AURA_MOD_XP_PCT auras
- Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_XP_PCT);
- for(Unit::AuraList::const_iterator i = ModXPPctAuras.begin();i != ModXPPctAuras.end(); ++i)
- xp = uint32(xp*(1.0f + (*i)->GetModifier()->m_amount / 100.0f));
+ Unit::AuraEffectList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_XP_PCT);
+ for(Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin();i != ModXPPctAuras.end(); ++i)
+ xp = uint32(xp*(1.0f + (*i)->GetAmount() / 100.0f));
// XP resting bonus for kill
uint32 rested_bonus_xp = victim ? GetXPRestBonus(xp) : 0;
@@ -4049,12 +4050,9 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
{
int32 delta = (int32(getLevel()) - startLevel + 1)*MINUTE;
- for(int i =0; i < 3; ++i)
+ if(Aura* Aur = GetAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS, GetGUID()))
{
- if(Aura* Aur = GetAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS,i))
- {
- Aur->SetAuraDurationAndUpdate(delta*IN_MILISECONDS);
- }
+ Aur->SetAuraDuration(delta*IN_MILISECONDS);
}
}
}
@@ -4780,10 +4778,10 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
int32 amount = uint32(m_baseRatingValue[cr]);
// Apply bonus from SPELL_AURA_MOD_RATING_FROM_STAT
// stat used stored in miscValueB for this aura
- AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
- for(AuraList::const_iterator i = modRatingFromStat.begin();i != modRatingFromStat.end(); ++i)
+ AuraEffectList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
+ for(AuraEffectList::const_iterator i = modRatingFromStat.begin();i != modRatingFromStat.end(); ++i)
if ((*i)->GetMiscValue() & (1<<cr))
- amount += int32(GetStat(Stats((*i)->GetMiscBValue())) * (*i)->GetModifier()->m_amount / 100.0f);
+ amount += int32(GetStat(Stats((*i)->GetMiscBValue())) * (*i)->GetAmount() / 100.0f);
if (amount < 0)
amount = 0;
SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));
@@ -5270,15 +5268,15 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i),0);
// temporary bonuses
- AuraList const& mModSkill = GetAurasByType(SPELL_AURA_MOD_SKILL);
- for(AuraList::const_iterator i = mModSkill.begin(); i != mModSkill.end(); ++i)
- if ((*i)->GetModifier()->m_miscvalue == int32(id))
+ AuraEffectList const& mModSkill = GetAurasByType(SPELL_AURA_MOD_SKILL);
+ for(AuraEffectList::const_iterator i = mModSkill.begin(); i != mModSkill.end(); ++i)
+ if ((*i)->GetMiscValue() == int32(id))
(*i)->ApplyModifier(true);
// permanent bonuses
- AuraList const& mModSkillTalent = GetAurasByType(SPELL_AURA_MOD_SKILL_TALENT);
- for(AuraList::const_iterator i = mModSkillTalent.begin(); i != mModSkillTalent.end(); ++i)
- if ((*i)->GetModifier()->m_miscvalue == int32(id))
+ AuraEffectList const& mModSkillTalent = GetAurasByType(SPELL_AURA_MOD_SKILL_TALENT);
+ for(AuraEffectList::const_iterator i = mModSkillTalent.begin(); i != mModSkillTalent.end(); ++i)
+ if ((*i)->GetMiscValue() == int32(id))
(*i)->ApplyModifier(true);
// Learn all spells for skill
@@ -6306,7 +6304,7 @@ void Player::DuelComplete(DuelCompleteType type)
}
for(size_t i=0; i<auras2remove.size(); i++)
- duel->opponent->RemoveAurasByCasterSpell(auras2remove[i], GetGUID(), AURA_REMOVE_BY_DELETE);
+ duel->opponent->RemoveAurasDueToSpell(auras2remove[i], GetGUID());
auras2remove.clear();
AuraMap const& auras = GetAuras();
@@ -6316,7 +6314,7 @@ void Player::DuelComplete(DuelCompleteType type)
auras2remove.push_back(i->second->GetId());
}
for(size_t i=0; i<auras2remove.size(); i++)
- RemoveAurasByCasterSpell(auras2remove[i], duel->opponent->GetGUID(), AURA_REMOVE_BY_DELETE);
+ RemoveAurasDueToSpell(auras2remove[i], duel->opponent->GetGUID());
// cleanup combo points
if(GetComboTarget()==duel->opponent->GetGUID())
@@ -6647,20 +6645,20 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
void Player::_ApplyWeaponDependentAuraMods(Item *item,WeaponAttackType attackType,bool apply)
{
- AuraList const& auraCritList = GetAurasByType(SPELL_AURA_MOD_CRIT_PERCENT);
- for(AuraList::const_iterator itr = auraCritList.begin(); itr!=auraCritList.end();++itr)
+ AuraEffectList const& auraCritList = GetAurasByType(SPELL_AURA_MOD_CRIT_PERCENT);
+ for(AuraEffectList::const_iterator itr = auraCritList.begin(); itr!=auraCritList.end();++itr)
_ApplyWeaponDependentAuraCritMod(item,attackType,*itr,apply);
- AuraList const& auraDamageFlatList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
- for(AuraList::const_iterator itr = auraDamageFlatList.begin(); itr!=auraDamageFlatList.end();++itr)
+ AuraEffectList const& auraDamageFlatList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
+ for(AuraEffectList::const_iterator itr = auraDamageFlatList.begin(); itr!=auraDamageFlatList.end();++itr)
_ApplyWeaponDependentAuraDamageMod(item,attackType,*itr,apply);
- AuraList const& auraDamagePCTList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
- for(AuraList::const_iterator itr = auraDamagePCTList.begin(); itr!=auraDamagePCTList.end();++itr)
+ AuraEffectList const& auraDamagePCTList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ for(AuraEffectList::const_iterator itr = auraDamagePCTList.begin(); itr!=auraDamagePCTList.end();++itr)
_ApplyWeaponDependentAuraDamageMod(item,attackType,*itr,apply);
}
-void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply)
+void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply)
{
// generic not weapon specific case processes in aura code
if(aura->GetSpellProto()->EquippedItemClass == -1)
@@ -6677,15 +6675,14 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attac
if (item->IsFitToSpellRequirements(aura->GetSpellProto()))
{
- HandleBaseModValue(mod, FLAT_MOD, float (aura->GetModifier()->m_amount), apply);
+ HandleBaseModValue(mod, FLAT_MOD, float (aura->GetAmount()), apply);
}
}
-void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply)
+void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply)
{
// ignore spell mods for not wands
- Modifier const* modifier = aura->GetModifier();
- if((modifier->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)==0 && (getClassMask() & CLASSMASK_WAND_USERS)==0)
+ if((aura->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)==0 && (getClassMask() & CLASSMASK_WAND_USERS)==0)
return;
// generic not weapon specific case processes in aura code
@@ -6702,7 +6699,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
}
UnitModifierType unitModType = TOTAL_VALUE;
- switch(modifier->m_auraname)
+ switch(aura->GetAuraName())
{
case SPELL_AURA_MOD_DAMAGE_DONE: unitModType = TOTAL_VALUE; break;
case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: unitModType = TOTAL_PCT; break;
@@ -6711,7 +6708,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
if (item->IsFitToSpellRequirements(aura->GetSpellProto()))
{
- HandleStatModifier(unitMod, unitModType, float(aura->GetModifier()->m_amount),apply);
+ HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()),apply);
}
}
@@ -6755,24 +6752,10 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
if(form_change) // check aura active state from other form
{
- bool found = false;
- for (int k=0; k < 3; ++k)
- {
- spellEffectPair spair = spellEffectPair(spellInfo->Id, k);
- for (AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair); ++iter)
- {
- if(!item || iter->second->GetCastItemGUID() == item->GetGUID())
- {
- found = true;
- break;
- }
- }
- if(found)
- break;
- }
-
- if(found) // and skip re-cast already active aura at form change
- return;
+ AuraMap const& auras = GetAuras();
+ for(AuraMap::const_iterator itr = auras.lower_bound(spellInfo->Id); itr != auras.upper_bound(spellInfo->Id); ++itr)
+ if(!item || itr->second->GetCastItemGUID()==item->GetGUID())
+ return;
}
DEBUG_LOG("WORLD: cast %s Equip spellId - %i", (item ? "item" : "itemset"), spellInfo->Id);
@@ -12542,7 +12525,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
- if( !HasAura(itr->second->spellId,0) )
+ if( !HasAura(itr->second->spellId) )
CastSpell(this,itr->second->spellId,true);
}
@@ -12770,7 +12753,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
if(itr->second->autocast && itr->second->IsFitToRequirements(this,zone,area))
- if( !HasAura(itr->second->spellId,0) )
+ if( !HasAura(itr->second->spellId) )
CastSpell(this,itr->second->spellId,true);
}
}
@@ -14695,41 +14678,39 @@ void Player::_LoadActions(QueryResult *result)
void Player::_LoadAuras(QueryResult *result, uint32 timediff)
{
+ sLog.outDebug("Loading auras for player %u",GetGUIDLow());
m_Auras.clear();
for (int i = 0; i < TOTAL_AURAS; i++)
m_modAuras[i].clear();
- //QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'",GetGUIDLow());
+ //QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_mask,stackcount,amount0,amount1,amount2,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'",GetGUIDLow());
if(result)
{
do
{
+ int32 damage[3];
Field *fields = result->Fetch();
uint64 caster_guid = fields[0].GetUInt64();
uint32 spellid = fields[1].GetUInt32();
- uint32 effindex = fields[2].GetUInt32();
+ uint32 effmask = fields[2].GetUInt32();
uint32 stackcount = fields[3].GetUInt32();
- int32 damage = (int32)fields[4].GetUInt32();
- int32 maxduration = (int32)fields[5].GetUInt32();
- int32 remaintime = (int32)fields[6].GetUInt32();
- int32 remaincharges = (int32)fields[7].GetUInt32();
+ damage[0] = int32(fields[4].GetUInt32());
+ damage[1] = int32(fields[5].GetUInt32());
+ damage[2] = int32(fields[6].GetUInt32());
+ int32 maxduration = (int32)fields[7].GetUInt32();
+ int32 remaintime = (int32)fields[8].GetUInt32();
+ int32 remaincharges = (int32)fields[9].GetUInt32();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if(!spellproto)
{
- sLog.outError("Unknown aura (spellid %u, effindex %u), ignore.",spellid,effindex);
- continue;
- }
-
- if(effindex >= 3)
- {
- sLog.outError("Invalid effect index (spellid %u, effindex %u), ignore.",spellid,effindex);
+ sLog.outError("Unknown aura (spellid %u), ignore.",spellid);
continue;
}
// negative effects should continue counting down after logout
- if (remaintime != -1 && !IsPositiveEffect(spellid, effindex))
+ if (remaintime != -1 && !IsPositiveSpell(spellid))
{
if(remaintime <= int32(timediff))
continue;
@@ -14746,21 +14727,10 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
else
remaincharges = 0;
-
- for(uint32 i=0; i<stackcount; i++)
- {
- Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL);
- if(!damage)
- damage = aura->GetModifier()->m_amount;
-
- // reset stolen single target auras
- if (caster_guid != GetGUID() && aura->IsSingleTarget())
- aura->SetIsSingleTarget(false);
-
- aura->SetLoadedState(caster_guid,damage,maxduration,remaintime,remaincharges);
- AddAura(aura);
- sLog.outDetail("Added aura spellid %u, effect %u", spellproto->Id, effindex);
- }
+ Aura* aura = new Aura(spellproto, effmask, NULL, this, NULL, NULL);
+ aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]);
+ AddAura(aura);
+ sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
}
while( result->NextRow() );
@@ -15852,57 +15822,33 @@ void Player::_SaveAuras()
CharacterDatabase.PExecute("DELETE FROM character_aura WHERE guid = '%u'",GetGUIDLow());
AuraMap const& auras = GetAuras();
-
- if (auras.empty())
- return;
-
- spellEffectPair lastEffectPair = auras.begin()->first;
- uint32 stackCounter = 1;
-
- for(AuraMap::const_iterator itr = auras.begin(); ; ++itr)
+ for(AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr)
{
- if(itr == auras.end() || lastEffectPair != itr->first)
+ // skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras.
+ // do not save single target auras (unless they were cast by the player)
+ if (itr->second->IsPassive()
+ || (itr->second->GetCasterGUID() != GetGUID() && itr->second->IsSingleTarget())
+ || itr->second->IsRemovedOnShapeLost())
+ continue;
+ SpellEntry const *spellInfo = itr->second->GetSpellProto();
+ for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
+ if (spellInfo->Effect[i] == SPELL_AURA_MOD_SHAPESHIFT ||
+ spellInfo->Effect[i] == SPELL_AURA_MOD_STEALTH )
+ continue;
+ uint32 amounts[MAX_SPELL_EFFECTS];
+ for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
{
- AuraMap::const_iterator itr2 = itr;
- // save previous spellEffectPair to db
- itr2--;
-
- SpellEntry const *spellInfo = itr2->second->GetSpellProto();
-
- //skip all auras from spells that are passive or need a shapeshift
- if (!(itr2->second->IsPassive() || itr2->second->IsRemovedOnShapeLost()))
- {
- //do not save single target auras (unless they were cast by the player)
- if (!(itr2->second->GetCasterGUID() != GetGUID() && itr2->second->IsSingleTarget()))
- {
- uint8 i;
- // or apply at cast SPELL_AURA_MOD_SHAPESHIFT or SPELL_AURA_MOD_STEALTH auras
- for (i = 0; i < 3; i++)
- if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT ||
- spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH)
- break;
-
- if (i == 3)
- {
- CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) "
- "VALUES ('%u', '" I64FMTD "' ,'%u', '%u', '%u', '%d', '%d', '%d', '%d')",
- GetGUIDLow(), itr2->second->GetCasterGUID(), (uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), (uint32)itr2->second->GetStackAmount(), itr2->second->GetModifier()->m_amount ,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges()));
- }
- }
- }
-
- if(itr == auras.end())
- break;
+ if (AuraEffect * partAura = itr->second->GetPartAura(i))
+ amounts[i]=partAura->GetAmount();
+ else
+ amounts[i]=0;
}
- //TODO: if need delete this
- if (lastEffectPair == itr->first)
- stackCounter++;
- else
- {
- lastEffectPair = itr->first;
- stackCounter = 1;
- }
+ CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_mask,stackcount,amount0, amount1, amount2,maxduration,remaintime,remaincharges) "
+ "VALUES ('%u', '" I64FMTD "', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%d')",
+ GetGUIDLow(), itr->second->GetCasterGUID(),(uint32)itr->second->GetId(), (uint32)itr->second->GetEffectMask(),
+ (uint32)itr->second->GetStackAmount(), amounts[0], amounts[1], amounts[2]
+ ,int(itr->second->GetAuraMaxDuration()),int(itr->second->GetAuraDuration()),int(itr->second->GetAuraCharges()));
}
}
@@ -16592,9 +16538,9 @@ void Player::StopCastingCharm()
}
if(GetCharmGUID())
{
- charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
- charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS_PET);
- charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
+ charm->RemoveAurasByType(SPELL_AURA_MOD_CHARM);
+ charm->RemoveAurasByType(SPELL_AURA_MOD_POSSESS_PET);
+ charm->RemoveAurasByType(SPELL_AURA_MOD_POSSESS);
}
if(GetCharmGUID())
@@ -18342,7 +18288,7 @@ void Player::AddComboPoints(Unit* target, int8 count)
return;
// without combo points lost (duration checked in aura)
- RemoveSpellsCausingAura(SPELL_AURA_RETAIN_COMBO_POINTS);
+ RemoveAurasByType(SPELL_AURA_RETAIN_COMBO_POINTS);
if(target->GetGUID() == m_comboTarget)
{
@@ -18372,7 +18318,7 @@ void Player::ClearComboPoints()
return;
// without combopoints lost (duration checked in aura)
- RemoveSpellsCausingAura(SPELL_AURA_RETAIN_COMBO_POINTS);
+ RemoveAurasByType(SPELL_AURA_RETAIN_COMBO_POINTS);
m_comboPoints = 0;
@@ -18468,7 +18414,7 @@ void Player::SendInitialPacketsAfterAddToMap()
};
for(AuraType const* itr = &auratypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
{
- Unit::AuraList const& auraList = GetAurasByType(*itr);
+ Unit::AuraEffectList const& auraList = GetAurasByType(*itr);
if(!auraList.empty())
auraList.front()->ApplyModifier(true,true);
}
@@ -18725,43 +18671,29 @@ void Player::SendAurasForTarget(Unit *target)
Unit::VisibleAuraMap const *visibleAuras = target->GetVisibleAuras();
for(Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
{
- Aura * aura=NULL;
- for (uint8 i=0 ; i<3; i++)
+ Aura * aura=itr->second;
+ data << uint8(aura->GetAuraSlot());
+ data << uint32(aura->GetId());
+
+ // flags
+ data << aura->m_auraFlags;
+ // level
+ data << aura->m_auraLevel;
+ // charges
+ data << uint8(aura->GetStackAmount() ? aura->GetStackAmount() : aura->GetAuraCharges());
+
+ if(!(aura->m_auraFlags & AFLAG_CASTER))
{
- if (itr->second.m_slotAuras[i])
- {
- aura=itr->second.m_slotAuras[i];
- break;
- }
+ if (Unit * caster = aura->GetCaster())
+ data.append(caster->GetPackGUID());
+ else
+ data << uint8(0);
}
- if(aura)
- {
- data << uint8(aura->GetAuraSlot());
- data << uint32(aura->GetId());
- if(aura->GetId())
- {
- // flags
- data << itr->second.m_Flags;
- // level
- data << itr->second.m_Level;
- // charges
- data << uint8(aura->GetAuraCharges());
-
- if(!(itr->second.m_Flags & AFLAG_CASTER))
- {
- if (Unit * caster = aura->GetCaster())
- data.append(caster->GetPackGUID());
- else
- data << uint8(0);
- }
-
- if(itr->second.m_Flags & AFLAG_DURATION) // include aura duration
- {
- data << uint32(aura->GetAuraMaxDuration());
- data << uint32(aura->GetAuraDuration());
- }
- }
+ if(aura->m_auraFlags & AFLAG_DURATION) // include aura duration
+ {
+ data << uint32(aura->GetAuraMaxDuration());
+ data << uint32(aura->GetAuraDuration());
}
}
@@ -19124,8 +19056,8 @@ uint32 Player::GetResurrectionSpellId()
// search priceless resurrection possibilities
uint32 prio = 0;
uint32 spell_id = 0;
- AuraList const& dummyAuras = GetAurasByType(SPELL_AURA_DUMMY);
- for(AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
+ AuraEffectList const& dummyAuras = GetAurasByType(SPELL_AURA_DUMMY);
+ for(AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
{
// Soulstone Resurrection // prio: 3 (max, non death persistent)
if( prio < 2 && (*itr)->GetSpellProto()->SpellVisual[0] == 99 && (*itr)->GetSpellProto()->SpellIconID == 92 )
@@ -19368,15 +19300,15 @@ void Player::UpdateZoneDependentAuras( uint32 newZone )
// remove new continent flight forms
if( !IsAllowUseFlyMountsHere() )
{
- RemoveSpellsCausingAura(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED);
- RemoveSpellsCausingAura(SPELL_AURA_FLY);
+ RemoveAurasByType(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED);
+ RemoveAurasByType(SPELL_AURA_FLY);
}
// Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update
SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newZone);
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
if(itr->second->autocast && itr->second->IsFitToRequirements(this,newZone,0))
- if( !HasAura(itr->second->spellId,0) )
+ if( !HasAura(itr->second->spellId) )
CastSpell(this,itr->second->spellId,true);
}
@@ -19396,7 +19328,7 @@ void Player::UpdateAreaDependentAuras( uint32 newArea )
SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAreaMapBounds(newArea);
for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
if(itr->second->autocast && itr->second->IsFitToRequirements(this,m_zoneUpdateId,newArea))
- if( !HasAura(itr->second->spellId,0) )
+ if( !HasAura(itr->second->spellId) )
CastSpell(this,itr->second->spellId,true);
}
@@ -19645,9 +19577,9 @@ void Player::StopCastingBindSight()
{
if(target->isType(TYPEMASK_UNIT))
{
- ((Unit*)target)->RemoveAuraTypeByCaster(SPELL_AURA_BIND_SIGHT, GetGUID());
- ((Unit*)target)->RemoveAuraTypeByCaster(SPELL_AURA_MOD_POSSESS, GetGUID());
- ((Unit*)target)->RemoveAuraTypeByCaster(SPELL_AURA_MOD_POSSESS_PET, GetGUID());
+ ((Unit*)target)->RemoveAura(SPELL_AURA_BIND_SIGHT, GetGUID());
+ ((Unit*)target)->RemoveAura(SPELL_AURA_MOD_POSSESS, GetGUID());
+ ((Unit*)target)->RemoveAura(SPELL_AURA_MOD_POSSESS_PET, GetGUID());
}
}
}
@@ -19703,7 +19635,7 @@ bool Player::CanUseBattleGroundObject()
!isTotalImmune() && // not totally immune
!HasStealthAura() && // not stealthed
!HasInvisibilityAura() && // not invisible
- !HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup
+ !HasAura(SPELL_RECENTLY_DROPPED_FLAG) && // can't pickup
//TODO player cannot use object when he is invulnerable (immune) - (ice block, divine shield, divine protection, divine intervention ...)
isAlive() // live player
);
@@ -19866,12 +19798,12 @@ void Player::ExitVehicle(Vehicle *vehicle)
bool Player::isTotalImmune()
{
- AuraList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
+ AuraEffectList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
uint32 immuneMask = 0;
- for(AuraList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
+ for(AuraEffectList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
{
- immuneMask |= (*itr)->GetModifier()->m_miscvalue;
+ immuneMask |= (*itr)->GetMiscValue();
if( immuneMask & SPELL_SCHOOL_MASK_ALL ) // total immunity
return true;
}
@@ -19898,19 +19830,19 @@ void Player::SetTitle(CharTitlesEntry const* title)
/*-----------------------TRINITY--------------------------*/
bool Player::isTotalImmunity()
{
- AuraList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
+ AuraEffectList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
- for(AuraList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
+ for(AuraEffectList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
{
- if (((*itr)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_ALL) !=0) // total immunity
+ if (((*itr)->GetMiscValue() & SPELL_SCHOOL_MASK_ALL) !=0) // total immunity
{
return true;
}
- if (((*itr)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) !=0) // physical damage immunity
+ if (((*itr)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) !=0) // physical damage immunity
{
- for(AuraList::const_iterator i = immune.begin(); i != immune.end(); ++i)
+ for(AuraEffectList::const_iterator i = immune.begin(); i != immune.end(); ++i)
{
- if (((*i)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_MAGIC) !=0) // magic immunity
+ if (((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) !=0) // magic immunity
{
return true;
}
@@ -19928,9 +19860,9 @@ void Player::UpdateCharmedAI()
//kill self if charm aura has infinite duration
if(charmer->IsInEvadeMode())
{
- AuraList const& auras = GetAurasByType(SPELL_AURA_MOD_CHARM);
- for(AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
- if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->IsPermanent())
+ AuraEffectList const& auras = GetAurasByType(SPELL_AURA_MOD_CHARM);
+ for(AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
+ if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetParentAura()->IsPermanent())
{
charmer->DealDamage(this, GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
@@ -20137,7 +20069,7 @@ uint32 Player::GetPhaseMaskForSpawn() const
phase = GetPhaseMask();
else
{
- AuraList const& phases = GetAurasByType(SPELL_AURA_PHASE);
+ AuraEffectList const& phases = GetAurasByType(SPELL_AURA_PHASE);
if(!phases.empty())
phase = phases.front()->GetMiscValue();
}
diff --git a/src/game/Player.h b/src/game/Player.h
index e1f79f993a1..deafd63c0e9 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -1729,8 +1729,8 @@ class TRINITY_DLL_SPEC Player : public Unit
void _RemoveAllStatBonuses();
void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply);
- void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply);
- void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, Aura* aura, bool apply);
+ void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply);
+ void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply);
void _ApplyItemMods(Item *item,uint8 slot,bool apply);
void _RemoveAllItemMods();
@@ -2359,7 +2359,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
continue;
// special case (skip >10sec spell casts for instant cast setting)
- if( mod->op==SPELLMOD_CASTING_TIME && basevalue >= T(10*IN_MILISECONDS) && mod->value <= -100)
+ if( mod->op==SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
continue;
totalpct += mod->value;
diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp
index f6e5b4f5c90..c7f83c9b7ae 100644
--- a/src/game/QuestHandler.cpp
+++ b/src/game/QuestHandler.cpp
@@ -101,7 +101,7 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// Stop the npc if moving
pCreature->StopMoving();
diff --git a/src/game/SkillHandler.cpp b/src/game/SkillHandler.cpp
index ccc2eea8297..06a7317d09d 100644
--- a/src/game/SkillHandler.cpp
+++ b/src/game/SkillHandler.cpp
@@ -55,7 +55,7 @@ void WorldSession::HandleTalentWipeOpcode( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if(!(_player->resetTalents()))
{
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index eec6d76bb87..8291056e15f 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1148,7 +1148,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
// TODO: Handle all of special spells in one place?
if(m_preCastSpell==61988)
{
- //Cast forbearance
+ //Cast Forbearance
m_caster->CastSpell(unit,25771, true, m_CastItem);
// Cast Avenging Wrath Marker
m_caster->CastSpell(unit,61987, true, m_CastItem);
@@ -1156,11 +1156,45 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
else
m_caster->CastSpell(unit,m_preCastSpell, true, m_CastItem);
}
+ uint8 t_effmask=0;
+ for (uint8 i=0;i<3;++i)
+ if (effectMask & (1<<i) && (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA || IsAreaAuraEffect(m_spellInfo->Effect[i])))
+ t_effmask |=1<<i;
+ if (t_effmask)
+ {
+ Unit * caster = m_originalCaster ? m_originalCaster : m_caster;
+ Aura * Aur= new Aura(m_spellInfo, t_effmask, &m_currentBasePoints[0], unit, caster , m_CastItem);
+
+ if (!Aur->IsAreaAura())
+ {
+ // Now Reduce spell duration using data received at spell hit
+ int32 duration = Aur->GetAuraMaxDuration();
+ unit->ApplyDiminishingToDuration(m_diminishGroup,duration,caster,m_diminishLevel);
+ Aur->setDiminishGroup(m_diminishGroup);
+
+ duration = caster->ModSpellDuration(m_spellInfo, unit, duration, Aur->IsPositive());
+
+ //mod duration of channeled aura by spell haste
+ if (IsChanneledSpell(m_spellInfo))
+ caster->ModSpellCastTime(m_spellInfo, duration, this);
+
+ if(duration != Aur->GetAuraMaxDuration())
+ {
+ Aur->SetAuraMaxDuration(duration);
+ Aur->SetAuraDuration(duration);
+ }
+ // Prayer of Mending (jump animation), we need formal caster instead original for correct animation
+ if( m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (m_spellInfo->SpellFamilyFlags[1] & 0x000020))
+ m_caster->CastSpell(unit, 41637, true, NULL, NULL, m_originalCasterGUID);
+ }
+ unit->AddAura(Aur);
+ }
+ t_effmask = effectMask& ~t_effmask;
for(uint32 effectNumber=0;effectNumber<3;effectNumber++)
{
- if (effectMask & (1<<effectNumber))
+ if (t_effmask & (1<<effectNumber))
{
HandleEffects(unit,NULL,NULL,effectNumber/*,m_damageMultipliers[effectNumber]*/);
//Only damage and heal spells need this
@@ -1188,20 +1222,23 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
int _duration=0;
for(ChanceTriggerSpells::const_iterator i = m_ChanceTriggerSpells.begin(); i != m_ChanceTriggerSpells.end(); ++i)
{
+ // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
+ // set duration equal to triggering spell
if(roll_chance_i(i->second))
{
m_caster->CastSpell(unit, i->first, true);
- // SPELL_AURA_ADD_TARGET_TRIGGER auras shouldn't trigger auras without duration
- // set duration equal to triggering spell
- if (GetSpellDuration(i->first)==-1)
+ }
+ if (GetSpellDuration(i->first)==-1)
+ {
+ if (Aura * triggeredAur = unit->GetAura(i->first->Id, m_caster->GetGUID()))
{
// get duration from aura-only once
if (!_duration)
{
- Aura * aur = unit->GetAuraByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
+ Aura * aur = unit->GetAura(m_spellInfo->Id, m_caster->GetGUID());
_duration = aur ? aur->GetAuraDuration() : -1;
}
- unit->SetAurasDurationByCasterSpell(i->first->Id, m_caster->GetGUID(), _duration);
+ triggeredAur->SetAuraDuration(_duration);
}
}
}
@@ -1342,7 +1379,7 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
{
if (!(*m)->isAffectedOnSpell(m_spellInfo))
continue;
- unMaxTargets+=(*m)->GetModifier()->m_amount;
+ unMaxTargets+=(*m)->GetAmount();
}*/
//FIXME: This very like horrible hack and wrong for most spells
@@ -1501,11 +1538,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i];
uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets;
- Unit::AuraList const& Auras = m_caster->GetAurasByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS);
- for(Unit::AuraList::const_iterator j = Auras.begin();j != Auras.end(); ++j)
+ Unit::AuraEffectList const& Auras = m_caster->GetAurasByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS);
+ for(Unit::AuraEffectList::const_iterator j = Auras.begin();j != Auras.end(); ++j)
{
if((*j)->isAffectedOnSpell(m_spellInfo))
- unMaxTargets+=(*j)->GetModifier()->m_amount;
+ unMaxTargets+=(*j)->GetAmount();
}
if(m_originalCaster)
@@ -2073,7 +2110,7 @@ struct PrioritizeMana
}
};
-void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
+void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura)
{
if(m_CastItem)
m_castItemGUID = m_CastItem->GetGUID();
@@ -2145,7 +2182,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
if(triggeredByAura)
{
SendChannelUpdate(0);
- triggeredByAura->SetAuraDuration(0);
+ triggeredByAura->GetParentAura()->SetAuraDuration(0);
}
SendCastResult(result);
finish(false);
@@ -2208,11 +2245,10 @@ void Spell::cancel()
{
Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if( unit && unit->isAlive() )
- unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID(), AURA_REMOVE_BY_CANCEL);
+ unit->RemoveAurasDueToSpell(m_spellInfo->Id, m_caster->GetGUID(), AURA_REMOVE_BY_CANCEL);
}
}
-
- m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID(), AURA_REMOVE_BY_CANCEL);
+ m_caster->RemoveAurasDueToSpell(m_spellInfo->Id, m_caster->GetGUID(), AURA_REMOVE_BY_CANCEL);
SendChannelUpdate(0);
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
@@ -2299,8 +2335,8 @@ void Spell::cast(bool skipCheck)
// this is related to combo points so must be done before takepower
// are there any spells need to be triggered after hit?
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras
- Unit::AuraList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER);
- for(Unit::AuraList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i)
+ Unit::AuraEffectList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER);
+ for(Unit::AuraEffectList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i)
{
if (!(*i)->isAffectedOnSpell(m_spellInfo))
continue;
@@ -2310,7 +2346,7 @@ void Spell::cast(bool skipCheck)
{
// Calculate chance at that moment (can be depend for example from combo points)
int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBasePoints(), NULL);
- m_ChanceTriggerSpells.push_back(std::make_pair(spellInfo, chance * (*i)->GetStackAmount()));
+ m_ChanceTriggerSpells.push_back(std::make_pair(spellInfo, chance * (*i)->GetParentAura()->GetStackAmount()));
}
}
@@ -3579,8 +3615,8 @@ SpellCastResult Spell::CheckCast(bool strict)
{
bool checkForm = true;
// Ignore form req aura
- Unit::AuraList const& ignore = m_caster->GetAurasByType(SPELL_AURA_MOD_IGNORE_SHAPESHIFT);
- for(Unit::AuraList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
+ Unit::AuraEffectList const& ignore = m_caster->GetAurasByType(SPELL_AURA_MOD_IGNORE_SHAPESHIFT);
+ for(Unit::AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
{
if (!(*i)->isAffectedOnSpell(m_spellInfo))
continue;
@@ -3600,12 +3636,12 @@ SpellCastResult Spell::CheckCast(bool strict)
}
bool reqCombat=true;
- Unit::AuraList const& stateAuras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
- for(Unit::AuraList::const_iterator j = stateAuras.begin();j != stateAuras.end(); ++j)
+ Unit::AuraEffectList const& stateAuras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
+ for(Unit::AuraEffectList::const_iterator j = stateAuras.begin();j != stateAuras.end(); ++j)
{
if((*j)->isAffectedOnSpell(m_spellInfo))
{
- if ((*j)->GetModifier()->m_miscvalue==1)
+ if ((*j)->GetMiscValue()==1)
{
reqCombat=false;
break;
@@ -4521,37 +4557,43 @@ SpellCastResult Spell::CheckCasterAuras() const
{
if(itr->second)
{
- if( GetSpellMechanicMask(itr->second->GetSpellProto(), itr->second->GetEffIndex()) & mechanic_immune )
+ if( GetAllSpellMechanicMask(itr->second->GetSpellProto()) & mechanic_immune )
continue;
- if( GetSpellSchoolMask(itr->second->GetSpellProto()) & school_immune )
+ if( GetAllSpellMechanicMask(itr->second->GetSpellProto()) & school_immune )
continue;
if( (1<<(itr->second->GetSpellProto()->Dispel)) & dispel_immune)
continue;
//Make a second check for spell failed so the right SPELL_FAILED message is returned.
//That is needed when your casting is prevented by multiple states and you are only immune to some of them.
- switch(itr->second->GetModifier()->m_auraname)
+ for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
{
- case SPELL_AURA_MOD_STUN:
- if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))
- return SPELL_FAILED_STUNNED;
- break;
- case SPELL_AURA_MOD_CONFUSE:
- if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED))
- return SPELL_FAILED_CONFUSED;
- break;
- case SPELL_AURA_MOD_FEAR:
- if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED))
- return SPELL_FAILED_FLEEING;
- break;
- case SPELL_AURA_MOD_SILENCE:
- case SPELL_AURA_MOD_PACIFY:
- case SPELL_AURA_MOD_PACIFY_SILENCE:
- if( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY)
- return SPELL_FAILED_PACIFIED;
- else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE)
- return SPELL_FAILED_SILENCED;
- break;
+ if (AuraEffect * part = itr->second->GetPartAura(i))
+ {
+ switch(part->GetAuraName())
+ {
+ case SPELL_AURA_MOD_STUN:
+ if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))
+ return SPELL_FAILED_STUNNED;
+ break;
+ case SPELL_AURA_MOD_CONFUSE:
+ if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED))
+ return SPELL_FAILED_CONFUSED;
+ break;
+ case SPELL_AURA_MOD_FEAR:
+ if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED))
+ return SPELL_FAILED_FLEEING;
+ break;
+ case SPELL_AURA_MOD_SILENCE:
+ case SPELL_AURA_MOD_PACIFY:
+ case SPELL_AURA_MOD_PACIFY_SILENCE:
+ if( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY)
+ return SPELL_FAILED_PACIFIED;
+ else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE)
+ return SPELL_FAILED_SILENCED;
+ break;
+ }
+ }
}
}
}
@@ -4573,18 +4615,18 @@ bool Spell::CanAutoCast(Unit* target)
{
if( m_spellInfo->StackAmount <= 1)
{
- if( target->HasAura(m_spellInfo->Id, j) )
+ if( target->HasAuraEffect(m_spellInfo->Id, j) )
return false;
}
else
{
- if( target->GetAuras().count(Unit::spellEffectPair(m_spellInfo->Id, j)) >= m_spellInfo->StackAmount)
+ if( (target->GetAuraEffect(m_spellInfo->Id, j))->GetParentAura()->GetStackAmount() >= m_spellInfo->StackAmount)
return false;
}
}
else if ( IsAreaAuraEffect( m_spellInfo->Effect[j] ))
{
- if( target->HasAura(m_spellInfo->Id, j) )
+ if( target->HasAuraEffect(m_spellInfo->Id, j) )
return false;
}
}
@@ -4746,7 +4788,7 @@ SpellCastResult Spell::CheckPower()
// Check valid power type
if( m_spellInfo->powerType >= MAX_POWERS )
{
- sLog.outError("Spell::CheckMana: Unknown power type '%d'", m_spellInfo->powerType);
+ sLog.outError("Spell::CheckPower: Unknown power type '%d'", m_spellInfo->powerType);
return SPELL_FAILED_UNKNOWN;
}
@@ -5231,11 +5273,8 @@ void Spell::DelayedChannel()
Unit* unit = m_caster->GetGUID()==ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if (unit)
{
- for (int j=0;j<3;j++)
- if( ihit->effectMask & (1<<j) )
- unit->DelayAura(m_spellInfo->Id, j, delaytime);
+ unit->DelayAura(m_spellInfo->Id, m_caster->GetGUID(), delaytime);
}
-
}
}
@@ -5266,11 +5305,6 @@ void Spell::UpdatePointers()
m_targets.Update(m_caster);
}
-bool Spell::IsAffectedByAura(Aura *aura)
-{
- return spellmgr.IsAffectedByMod(m_spellInfo, aura->getAuraSpellMod());
-}
-
bool Spell::CheckTargetCreatureType(Unit* target) const
{
uint32 spellCreatureTargetMask = m_spellInfo->TargetCreatureType;
@@ -5405,12 +5439,12 @@ Unit* Spell::SelectMagnetTarget()
if(target && m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && target->HasAuraType(SPELL_AURA_SPELL_MAGNET)) //Attributes & 0x10 what is this?
{
- Unit::AuraList const& magnetAuras = target->GetAurasByType(SPELL_AURA_SPELL_MAGNET);
- for(Unit::AuraList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
+ Unit::AuraEffectList const& magnetAuras = target->GetAurasByType(SPELL_AURA_SPELL_MAGNET);
+ for(Unit::AuraEffectList::const_iterator itr = magnetAuras.begin(); itr != magnetAuras.end(); ++itr)
{
if(Unit* magnet = (*itr)->GetCaster())
{
- if((*itr)->DropAuraCharge())
+ if((*itr)->GetParentAura()->DropAuraCharge())
{
target = magnet;
m_targets.setUnitTarget(target);
@@ -5514,9 +5548,6 @@ bool SpellEvent::Execute(uint64 e_time, uint32 p_time)
// another non-melee non-delayed spell is casted now, abort
m_Spell->cancel();
}
- // Check if target of channeled spell still in range
- else if (m_Spell->CheckRange(false))
- m_Spell->cancel();
else
{
// do the action (pass spell to channeling state)
@@ -5620,8 +5651,8 @@ void Spell::CalculateDamageDoneForAllTargets()
}
bool usesAmmo=true;
- Unit::AuraList const& Auras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
- for(Unit::AuraList::const_iterator j = Auras.begin();j != Auras.end(); ++j)
+ Unit::AuraEffectList const& Auras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
+ for(Unit::AuraEffectList::const_iterator j = Auras.begin();j != Auras.end(); ++j)
{
if((*j)->isAffectedOnSpell(m_spellInfo))
usesAmmo=false;
diff --git a/src/game/Spell.h b/src/game/Spell.h
index a7daf94cf22..7c52a4e8bb3 100644
--- a/src/game/Spell.h
+++ b/src/game/Spell.h
@@ -354,7 +354,7 @@ class Spell
Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL, bool skipCheck = false );
~Spell();
- void prepare(SpellCastTargets const* targets, Aura* triggeredByAura = NULL);
+ void prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura = NULL);
void cancel();
void update(uint32 difftime);
void cast(bool skipCheck = false);
@@ -461,8 +461,6 @@ class Spell
void UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
- bool IsAffectedByAura(Aura *aura);
-
bool CheckTargetCreatureType(Unit* target) const;
void AddTriggeredSpell(SpellEntry const* spell) { m_TriggerSpells.push_back(spell); }
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index 9fdf622633f..5953ae9fb13 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -21,6 +21,7 @@
#define TRINITY_SPELLAURADEFINES_H
#define MAX_AURAS 64 // client support up to 255, but it will cause problems with group auras updating
+#define FRIENDLY_AA_REMOVE_TIME 2*IN_MILISECONDS
enum AURA_FLAGS
{
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index fca044ba411..34395a13f1c 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -49,331 +49,314 @@
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
-#define NULL_AURA_SLOT 0xFF
-
pAuraHandler AuraHandler[TOTAL_AURAS]=
{
- &Aura::HandleNULL, // 0 SPELL_AURA_NONE
- &Aura::HandleBindSight, // 1 SPELL_AURA_BIND_SIGHT
- &Aura::HandleModPossess, // 2 SPELL_AURA_MOD_POSSESS
- &Aura::HandlePeriodicDamage, // 3 SPELL_AURA_PERIODIC_DAMAGE
- &Aura::HandleAuraDummy, // 4 SPELL_AURA_DUMMY
- &Aura::HandleModConfuse, // 5 SPELL_AURA_MOD_CONFUSE
- &Aura::HandleModCharm, // 6 SPELL_AURA_MOD_CHARM
- &Aura::HandleModFear, // 7 SPELL_AURA_MOD_FEAR
- &Aura::HandlePeriodicHeal, // 8 SPELL_AURA_PERIODIC_HEAL
- &Aura::HandleModAttackSpeed, // 9 SPELL_AURA_MOD_ATTACKSPEED
- &Aura::HandleModThreat, // 10 SPELL_AURA_MOD_THREAT
- &Aura::HandleModTaunt, // 11 SPELL_AURA_MOD_TAUNT
- &Aura::HandleAuraModStun, // 12 SPELL_AURA_MOD_STUN
- &Aura::HandleModDamageDone, // 13 SPELL_AURA_MOD_DAMAGE_DONE
- &Aura::HandleNoImmediateEffect, // 14 SPELL_AURA_MOD_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
- &Aura::HandleNoImmediateEffect, // 15 SPELL_AURA_DAMAGE_SHIELD implemented in Unit::DoAttackDamage
- &Aura::HandleModStealth, // 16 SPELL_AURA_MOD_STEALTH
- &Aura::HandleNoImmediateEffect, // 17 SPELL_AURA_MOD_STEALTH_DETECT
- &Aura::HandleInvisibility, // 18 SPELL_AURA_MOD_INVISIBILITY
- &Aura::HandleInvisibilityDetect, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECTION
- &Aura::HandleAuraModTotalHealthPercentRegen, // 20 SPELL_AURA_OBS_MOD_HEALTH
- &Aura::HandleAuraModTotalEnergyPercentRegen, // 21 SPELL_AURA_OBS_MOD_ENERGY
- &Aura::HandleAuraModResistance, // 22 SPELL_AURA_MOD_RESISTANCE
- &Aura::HandlePeriodicTriggerSpell, // 23 SPELL_AURA_PERIODIC_TRIGGER_SPELL
- &Aura::HandlePeriodicEnergize, // 24 SPELL_AURA_PERIODIC_ENERGIZE
- &Aura::HandleAuraModPacify, // 25 SPELL_AURA_MOD_PACIFY
- &Aura::HandleAuraModRoot, // 26 SPELL_AURA_MOD_ROOT
- &Aura::HandleAuraModSilence, // 27 SPELL_AURA_MOD_SILENCE
- &Aura::HandleNoImmediateEffect, // 28 SPELL_AURA_REFLECT_SPELLS implement in Unit::SpellHitResult
- &Aura::HandleAuraModStat, // 29 SPELL_AURA_MOD_STAT
- &Aura::HandleAuraModSkill, // 30 SPELL_AURA_MOD_SKILL
- &Aura::HandleAuraModIncreaseSpeed, // 31 SPELL_AURA_MOD_INCREASE_SPEED
- &Aura::HandleAuraModIncreaseMountedSpeed, // 32 SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
- &Aura::HandleAuraModDecreaseSpeed, // 33 SPELL_AURA_MOD_DECREASE_SPEED
- &Aura::HandleAuraModIncreaseHealth, // 34 SPELL_AURA_MOD_INCREASE_HEALTH
- &Aura::HandleAuraModIncreaseEnergy, // 35 SPELL_AURA_MOD_INCREASE_ENERGY
- &Aura::HandleAuraModShapeshift, // 36 SPELL_AURA_MOD_SHAPESHIFT
- &Aura::HandleAuraModEffectImmunity, // 37 SPELL_AURA_EFFECT_IMMUNITY
- &Aura::HandleAuraModStateImmunity, // 38 SPELL_AURA_STATE_IMMUNITY
- &Aura::HandleAuraModSchoolImmunity, // 39 SPELL_AURA_SCHOOL_IMMUNITY
- &Aura::HandleAuraModDmgImmunity, // 40 SPELL_AURA_DAMAGE_IMMUNITY
- &Aura::HandleAuraModDispelImmunity, // 41 SPELL_AURA_DISPEL_IMMUNITY
- &Aura::HandleAuraProcTriggerSpell, // 42 SPELL_AURA_PROC_TRIGGER_SPELL implemented in Unit::ProcDamageAndSpellFor and Unit::HandleProcTriggerSpell
- &Aura::HandleNoImmediateEffect, // 43 SPELL_AURA_PROC_TRIGGER_DAMAGE implemented in Unit::ProcDamageAndSpellFor
- &Aura::HandleAuraTrackCreatures, // 44 SPELL_AURA_TRACK_CREATURES
- &Aura::HandleAuraTrackResources, // 45 SPELL_AURA_TRACK_RESOURCES
- &Aura::HandleUnused, // 46 SPELL_AURA_46 (used in test spells 54054 and 54058, and spell 48050) (3.0.8a)
- &Aura::HandleAuraModParryPercent, // 47 SPELL_AURA_MOD_PARRY_PERCENT
- &Aura::HandleNULL, // 48 SPELL_AURA_48 spell Napalm (area damage spell with additional delayed damage effect)
- &Aura::HandleAuraModDodgePercent, // 49 SPELL_AURA_MOD_DODGE_PERCENT
- &Aura::HandleNoImmediateEffect, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT implemented in Unit::SpellCriticalHealingBonus
- &Aura::HandleAuraModBlockPercent, // 51 SPELL_AURA_MOD_BLOCK_PERCENT
- &Aura::HandleAuraModCritPercent, // 52 SPELL_AURA_MOD_CRIT_PERCENT
- &Aura::HandlePeriodicLeech, // 53 SPELL_AURA_PERIODIC_LEECH
- &Aura::HandleModHitChance, // 54 SPELL_AURA_MOD_HIT_CHANCE
- &Aura::HandleModSpellHitChance, // 55 SPELL_AURA_MOD_SPELL_HIT_CHANCE
- &Aura::HandleAuraTransform, // 56 SPELL_AURA_TRANSFORM
- &Aura::HandleModSpellCritChance, // 57 SPELL_AURA_MOD_SPELL_CRIT_CHANCE
- &Aura::HandleAuraModIncreaseSwimSpeed, // 58 SPELL_AURA_MOD_INCREASE_SWIM_SPEED
- &Aura::HandleNoImmediateEffect, // 59 SPELL_AURA_MOD_DAMAGE_DONE_CREATURE implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
- &Aura::HandleAuraModPacifyAndSilence, // 60 SPELL_AURA_MOD_PACIFY_SILENCE
- &Aura::HandleAuraModScale, // 61 SPELL_AURA_MOD_SCALE
- &Aura::HandlePeriodicHealthFunnel, // 62 SPELL_AURA_PERIODIC_HEALTH_FUNNEL
- &Aura::HandleUnused, // 63 unused (3.0.8a) old SPELL_AURA_PERIODIC_MANA_FUNNEL
- &Aura::HandlePeriodicManaLeech, // 64 SPELL_AURA_PERIODIC_MANA_LEECH
- &Aura::HandleModCastingSpeed, // 65 SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
- &Aura::HandleFeignDeath, // 66 SPELL_AURA_FEIGN_DEATH
- &Aura::HandleAuraModDisarm, // 67 SPELL_AURA_MOD_DISARM
- &Aura::HandleAuraModStalked, // 68 SPELL_AURA_MOD_STALKED
- &Aura::HandleSchoolAbsorb, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalcAbsorbResist
- &Aura::HandleUnused, // 70 SPELL_AURA_EXTRA_ATTACKS Useless, used by only one spell that has only visual effect
- &Aura::HandleModSpellCritChanceShool, // 71 SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
- &Aura::HandleModPowerCostPCT, // 72 SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
- &Aura::HandleModPowerCost, // 73 SPELL_AURA_MOD_POWER_COST_SCHOOL
- &Aura::HandleNoImmediateEffect, // 74 SPELL_AURA_REFLECT_SPELLS_SCHOOL implemented in Unit::SpellHitResult
- &Aura::HandleNoImmediateEffect, // 75 SPELL_AURA_MOD_LANGUAGE
- &Aura::HandleFarSight, // 76 SPELL_AURA_FAR_SIGHT
- &Aura::HandleModMechanicImmunity, // 77 SPELL_AURA_MECHANIC_IMMUNITY
- &Aura::HandleAuraMounted, // 78 SPELL_AURA_MOUNTED
- &Aura::HandleModDamagePercentDone, // 79 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
- &Aura::HandleModPercentStat, // 80 SPELL_AURA_MOD_PERCENT_STAT
- &Aura::HandleNoImmediateEffect, // 81 SPELL_AURA_SPLIT_DAMAGE_PCT
- &Aura::HandleWaterBreathing, // 82 SPELL_AURA_WATER_BREATHING
- &Aura::HandleModBaseResistance, // 83 SPELL_AURA_MOD_BASE_RESISTANCE
- &Aura::HandleModRegen, // 84 SPELL_AURA_MOD_REGEN
- &Aura::HandleModPowerRegen, // 85 SPELL_AURA_MOD_POWER_REGEN
- &Aura::HandleChannelDeathItem, // 86 SPELL_AURA_CHANNEL_DEATH_ITEM
- &Aura::HandleNoImmediateEffect, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
- &Aura::HandleNoImmediateEffect, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
- &Aura::HandlePeriodicDamagePCT, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT
- &Aura::HandleUnused, // 90 unused (3.0.8a) old SPELL_AURA_MOD_RESIST_CHANCE
- &Aura::HandleNoImmediateEffect, // 91 SPELL_AURA_MOD_DETECT_RANGE implemented in Creature::GetAttackDistance
- &Aura::HandlePreventFleeing, // 92 SPELL_AURA_PREVENTS_FLEEING
- &Aura::HandleModUnattackable, // 93 SPELL_AURA_MOD_UNATTACKABLE
- &Aura::HandleNoImmediateEffect, // 94 SPELL_AURA_INTERRUPT_REGEN implemented in Player::RegenerateAll
- &Aura::HandleAuraGhost, // 95 SPELL_AURA_GHOST
- &Aura::HandleNoImmediateEffect, // 96 SPELL_AURA_SPELL_MAGNET implemented in Spell::SelectMagnetTarget
- &Aura::HandleManaShield, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalcAbsorbResist
- &Aura::HandleAuraModSkill, // 98 SPELL_AURA_MOD_SKILL_TALENT
- &Aura::HandleAuraModAttackPower, // 99 SPELL_AURA_MOD_ATTACK_POWER
- &Aura::HandleUnused, //100 SPELL_AURA_AURAS_VISIBLE obsolete? all player can see all auras now, but still have spells including GM-spell
- &Aura::HandleModResistancePercent, //101 SPELL_AURA_MOD_RESISTANCE_PCT
- &Aura::HandleNoImmediateEffect, //102 SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
- &Aura::HandleAuraModTotalThreat, //103 SPELL_AURA_MOD_TOTAL_THREAT
- &Aura::HandleAuraWaterWalk, //104 SPELL_AURA_WATER_WALK
- &Aura::HandleAuraFeatherFall, //105 SPELL_AURA_FEATHER_FALL
- &Aura::HandleAuraHover, //106 SPELL_AURA_HOVER
- &Aura::HandleAddModifier, //107 SPELL_AURA_ADD_FLAT_MODIFIER
- &Aura::HandleAddModifier, //108 SPELL_AURA_ADD_PCT_MODIFIER
- &Aura::HandleAddTargetTrigger, //109 SPELL_AURA_ADD_TARGET_TRIGGER
- &Aura::HandleModPowerRegenPCT, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT
- &Aura::HandleNULL, //111 SPELL_AURA_ADD_CASTER_HIT_TRIGGER chance redirect attack to caster
- &Aura::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
- &Aura::HandleNoImmediateEffect, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
- &Aura::HandleNoImmediateEffect, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
- &Aura::HandleNoImmediateEffect, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim
- &Aura::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
- &Aura::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
- &Aura::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
- &Aura::HandleUnused, //119 unused (3.0.8a) old SPELL_AURA_SHARE_PET_TRACKING
- &Aura::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE
- &Aura::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY
- &Aura::HandleModOffhandDamagePercent, //122 SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
- &Aura::HandleModTargetResistance, //123 SPELL_AURA_MOD_TARGET_RESISTANCE
- &Aura::HandleAuraModRangedAttackPower, //124 SPELL_AURA_MOD_RANGED_ATTACK_POWER
- &Aura::HandleNoImmediateEffect, //125 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
- &Aura::HandleNoImmediateEffect, //126 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
- &Aura::HandleNoImmediateEffect, //127 SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
- &Aura::HandleModPossessPet, //128 SPELL_AURA_MOD_POSSESS_PET
- &Aura::HandleAuraModIncreaseSpeed, //129 SPELL_AURA_MOD_SPEED_ALWAYS
- &Aura::HandleAuraModIncreaseMountedSpeed, //130 SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
- &Aura::HandleNoImmediateEffect, //131 SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
- &Aura::HandleAuraModIncreaseEnergyPercent, //132 SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
- &Aura::HandleAuraModIncreaseHealthPercent, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
- &Aura::HandleAuraModRegenInterrupt, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
- &Aura::HandleModHealingDone, //135 SPELL_AURA_MOD_HEALING_DONE
- &Aura::HandleNoImmediateEffect, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus
- &Aura::HandleModTotalPercentStat, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
- &Aura::HandleHaste, //138 SPELL_AURA_MOD_HASTE
- &Aura::HandleForceReaction, //139 SPELL_AURA_FORCE_REACTION
- &Aura::HandleAuraModRangedHaste, //140 SPELL_AURA_MOD_RANGED_HASTE
- &Aura::HandleRangedAmmoHaste, //141 SPELL_AURA_MOD_RANGED_AMMO_HASTE
- &Aura::HandleAuraModBaseResistancePCT, //142 SPELL_AURA_MOD_BASE_RESISTANCE_PCT
- &Aura::HandleAuraModResistanceExclusive, //143 SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
- &Aura::HandleNoImmediateEffect, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
- &Aura::HandleAuraModPetTalentsPoints, //145 SPELL_AURA_MOD_PET_TALENT_POINTS
- &Aura::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE
- &Aura::HandleModMechanicImmunity, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK
- &Aura::HandleAuraRetainComboPoints, //148 SPELL_AURA_RETAIN_COMBO_POINTS
- &Aura::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK
- &Aura::HandleShieldBlockValue, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
- &Aura::HandleAuraTrackStealthed, //151 SPELL_AURA_TRACK_STEALTHED
- &Aura::HandleNoImmediateEffect, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
- &Aura::HandleNoImmediateEffect, //153 SPELL_AURA_SPLIT_DAMAGE_FLAT
- &Aura::HandleNoImmediateEffect, //154 SPELL_AURA_MOD_STEALTH_LEVEL
- &Aura::HandleNoImmediateEffect, //155 SPELL_AURA_MOD_WATER_BREATHING
- &Aura::HandleNoImmediateEffect, //156 SPELL_AURA_MOD_REPUTATION_GAIN
- &Aura::HandleNULL, //157 SPELL_AURA_PET_DAMAGE_MULTI
- &Aura::HandleShieldBlockValue, //158 SPELL_AURA_MOD_SHIELD_BLOCKVALUE
- &Aura::HandleNoImmediateEffect, //159 SPELL_AURA_NO_PVP_CREDIT only for Honorless Target spell
- &Aura::HandleNoImmediateEffect, //160 SPELL_AURA_MOD_AOE_AVOIDANCE implemented in Unit::MagicSpellHitResult
- &Aura::HandleNoImmediateEffect, //161 SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
- &Aura::HandleAuraPowerBurn, //162 SPELL_AURA_POWER_BURN_MANA
- &Aura::HandleNoImmediateEffect, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS_MELEE
- &Aura::HandleUnused, //164 unused (3.0.8a), only one test spell
- &Aura::HandleNoImmediateEffect, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
- &Aura::HandleAuraModAttackPowerPercent, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT
- &Aura::HandleAuraModRangedAttackPowerPercent, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
- &Aura::HandleNoImmediateEffect, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
- &Aura::HandleNoImmediateEffect, //169 SPELL_AURA_MOD_CRIT_PERCENT_VERSUS implemented in Unit::DealDamageBySchool, Unit::DoAttackDamage, Unit::SpellCriticalBonus
- &Aura::HandleNULL, //170 SPELL_AURA_DETECT_AMORE different spells that ignore transformation effects
- &Aura::HandleAuraModIncreaseSpeed, //171 SPELL_AURA_MOD_SPEED_NOT_STACK
- &Aura::HandleAuraModIncreaseMountedSpeed, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
- &Aura::HandleUnused, //173 unused (3.0.8a) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
- &Aura::HandleModSpellDamagePercentFromStat, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus
- &Aura::HandleModSpellHealingPercentFromStat, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus
- &Aura::HandleSpiritOfRedemption, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end
- &Aura::HandleNULL, //177 SPELL_AURA_AOE_CHARM
- &Aura::HandleNoImmediateEffect, //178 SPELL_AURA_MOD_DEBUFF_RESISTANCE implemented in Unit::MagicSpellHitResult
- &Aura::HandleNoImmediateEffect, //179 SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE implemented in Unit::SpellCriticalBonus
- &Aura::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
- &Aura::HandleUnused, //181 unused (3.0.8a) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
- &Aura::HandleAuraModResistenceOfStatPercent, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
- &Aura::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746
- &Aura::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
- &Aura::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
- &Aura::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
- &Aura::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
- &Aura::HandleNoImmediateEffect, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
- &Aura::HandleModRating, //189 SPELL_AURA_MOD_RATING
- &Aura::HandleNULL, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN
- &Aura::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
- &Aura::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_HASTE_MELEE
- &Aura::HandleModCombatSpeedPct, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct)
- &Aura::HandleNULL, //194 SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
- &Aura::HandleNoImmediateEffect, //195 SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
- &Aura::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN
- &Aura::HandleNoImmediateEffect, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
- &Aura::HandleUnused, //198 unused (3.0.8a) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
- &Aura::HandleNoImmediateEffect, //199 SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT implemented in Unit::MagicSpellHitResult
- &Aura::HandleNoImmediateEffect, //200 SPELL_AURA_MOD_XP_PCT implemented in Player::GiveXP
- &Aura::HandleAuraAllowFlight, //201 SPELL_AURA_FLY this aura enable flight mode...
- &Aura::HandleNoImmediateEffect, //202 SPELL_AURA_CANNOT_BE_DODGED implemented in Unit::RollPhysicalOutcomeAgainst
- &Aura::HandleNoImmediateEffect, //203 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
- &Aura::HandleNoImmediateEffect, //204 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
- &Aura::HandleNULL, //205 vulnerable to school dmg?
- &Aura::HandleNULL, //206 SPELL_AURA_MOD_SPEED_MOUNTED
- &Aura::HandleAuraModIncreaseFlightSpeed, //207 SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
- &Aura::HandleAuraModIncreaseFlightSpeed, //208 SPELL_AURA_MOD_SPEED_FLIGHT, used only in spell: Flight Form (Passive)
- &Aura::HandleAuraModIncreaseFlightSpeed, //209 SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS
- &Aura::HandleNULL, //210 Commentator's Command
- &Aura::HandleAuraModIncreaseFlightSpeed, //211 SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK
- &Aura::HandleAuraModRangedAttackPowerOfStatPercent, //212 SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT
- &Aura::HandleNoImmediateEffect, //213 SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT implemented in Player::RewardRage
- &Aura::HandleNULL, //214 Tamed Pet Passive
- &Aura::HandleArenaPreparation, //215 SPELL_AURA_ARENA_PREPARATION
- &Aura::HandleModCastingSpeed, //216 SPELL_AURA_HASTE_SPELLS
- &Aura::HandleUnused, //217 unused (3.0.8a)
- &Aura::HandleAuraModRangedHaste, //218 SPELL_AURA_HASTE_RANGED
- &Aura::HandleModManaRegen, //219 SPELL_AURA_MOD_MANA_REGEN_FROM_STAT
- &Aura::HandleModRatingFromStat, //220 SPELL_AURA_MOD_RATING_FROM_STAT
- &Aura::HandleNULL, //221 ignored
- &Aura::HandleUnused, //222 unused (3.0.8a) only for spell 44586 that not used in real spell cast
- &Aura::HandleNoImmediateEffect, //223 SPELL_AURA_RAID_PROC_FROM_CHARGE
- &Aura::HandleUnused, //224 unused (3.0.8a)
- &Aura::HandleNoImmediateEffect, //225 SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
- &Aura::HandleAuraPeriodicDummy, //226 SPELL_AURA_PERIODIC_DUMMY
- &Aura::HandlePeriodicTriggerSpellWithValue, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
- &Aura::HandleNoImmediateEffect, //228 stealth detection
- &Aura::HandleNULL, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
- &Aura::HandleAuraModIncreaseHealth, //230 SPELL_AURA_MOD_INCREASE_HEALTH_2
- &Aura::HandleNoImmediateEffect, //231 SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
- &Aura::HandleNoImmediateEffect, //232 SPELL_AURA_MECHANIC_DURATION_MOD implement in Unit::CalculateSpellDuration
- &Aura::HandleNULL, //233 set model id to the one of the creature with id m_modifier.m_miscvalue
- &Aura::HandleNoImmediateEffect, //234 SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK implement in Unit::CalculateSpellDuration
- &Aura::HandleAuraModDispelResist, //235 SPELL_AURA_MOD_DISPEL_RESIST implement in Unit::MagicSpellHitResult
- &Aura::HandleAuraControlVehicle, //236 SPELL_AURA_CONTROL_VEHICLE
- &Aura::HandleModSpellDamagePercentFromAttackPower, //237 SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER implemented in Unit::SpellBaseDamageBonus
- &Aura::HandleModSpellHealingPercentFromAttackPower, //238 SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER implemented in Unit::SpellBaseHealingBonus
- &Aura::HandleAuraModScale, //239 SPELL_AURA_MOD_SCALE_2 only in Noggenfogger Elixir (16595) before 2.3.0 aura 61
- &Aura::HandleAuraModExpertise, //240 SPELL_AURA_MOD_EXPERTISE
- &Aura::HandleForceMoveForward, //241 Forces the player to move forward
- &Aura::HandleUnused, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING
- &Aura::HandleNULL, //243 faction reaction override spells
- &Aura::HandleComprehendLanguage, //244 Comprehend language
- &Aura::HandleNoImmediateEffect, //245 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
- &Aura::HandleNoImmediateEffect, //246 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK implemented in Spell::EffectApplyAura
- &Aura::HandleNULL, //247 target to become a clone of the caster
- &Aura::HandleNoImmediateEffect, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
- &Aura::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE
- &Aura::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
- &Aura::HandleNoImmediateEffect, //251 SPELL_AURA_MOD_ENEMY_DODGE
- &Aura::HandleNULL, //252 haste all?
- &Aura::HandleNoImmediateEffect, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE implemented in Unit::isBlockCritical
- &Aura::HandleAuraModDisarm, //254 SPELL_AURA_MOD_DISARM_OFFHAND
- &Aura::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus
- &Aura::HandleNoReagentUseAura, //256 SPELL_AURA_NO_REAGENT_USE Use SpellClassMask for spell select
- &Aura::HandleNULL, //257 SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS Use SpellClassMask for spell select
- &Aura::HandleNULL, //258 SPELL_AURA_MOD_SPELL_VISUAL
- &Aura::HandleNoImmediateEffect, //259 SPELL_AURA_MOD_HOT_PCT implemented in Unit::SpellHealingBonus
- &Aura::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code
- &Aura::HandlePhase, //261 SPELL_AURA_PHASE undetactable invisibility? implemented in Unit::isVisibleForOrDetect
- &Aura::HandleNoImmediateEffect, //262 SPELL_AURA_ABILITY_IGNORE_AURASTATE implemented in spell::cancast
- &Aura::HandleAuraAllowOnlyAbility, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
- &Aura::HandleUnused, //264 unused (3.0.8a)
- &Aura::HandleUnused, //265 unused (3.0.8a)
- &Aura::HandleUnused, //266 unused (3.0.8a)
- &Aura::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect
- &Aura::HandleAuraModAttackPowerOfStatPercent, //268 SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
- &Aura::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage
- &Aura::HandleNoImmediateEffect, //270 SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage
- &Aura::HandleNoImmediateEffect, //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonus
- &Aura::HandleNULL, //272 reduce spell cast time?
- &Aura::HandleUnused, //273 clientside
- &Aura::HandleNoImmediateEffect, //274 SPELL_AURA_CONSUME_NO_AMMO implemented in spell::CalculateDamageDoneForAllTargets
- &Aura::HandleNoImmediateEffect, //275 SPELL_AURA_MOD_IGNORE_SHAPESHIFT Use SpellClassMask for spell select
- &Aura::HandleNULL, //276 mod damage % mechanic?
- &Aura::HandleNoImmediateEffect, //277 SPELL_AURA_MOD_ABILITY_AFFECTED_TARGETS implemented in spell::settargetmap
- &Aura::HandleAuraModDisarm, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon
- &Aura::HandleNULL, //279 visual effects? 58836 and 57507
- &Aura::HandleNoImmediateEffect, //280 SPELL_AURA_MOD_WEAPONTYPE_IGNORE_TARGET_RESISTANCE
- &Aura::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor
- &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
- &Aura::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
- &Aura::HandleUnused, //284 not used by any spells (3.08a)
- &Aura::HandleUnused, //285 not used by any spells (3.08a)
- &Aura::HandleUnused, //286 not used by any spells (3.08a)
- &Aura::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
- &Aura::HandleUnused, //288 not used by any spells (3.09) except 1 test spell.
+ &AuraEffect::HandleNULL, // 0 SPELL_AURA_NONE
+ &AuraEffect::HandleBindSight, // 1 SPELL_AURA_BIND_SIGHT
+ &AuraEffect::HandleModPossess, // 2 SPELL_AURA_MOD_POSSESS
+ &AuraEffect::HandlePeriodicDamage, // 3 SPELL_AURA_PERIODIC_DAMAGE
+ &AuraEffect::HandleAuraDummy, // 4 SPELL_AURA_DUMMY
+ &AuraEffect::HandleModConfuse, // 5 SPELL_AURA_MOD_CONFUSE
+ &AuraEffect::HandleModCharm, // 6 SPELL_AURA_MOD_CHARM
+ &AuraEffect::HandleModFear, // 7 SPELL_AURA_MOD_FEAR
+ &AuraEffect::HandlePeriodicHeal, // 8 SPELL_AURA_PERIODIC_HEAL
+ &AuraEffect::HandleModAttackSpeed, // 9 SPELL_AURA_MOD_ATTACKSPEED
+ &AuraEffect::HandleModThreat, // 10 SPELL_AURA_MOD_THREAT
+ &AuraEffect::HandleModTaunt, // 11 SPELL_AURA_MOD_TAUNT
+ &AuraEffect::HandleAuraModStun, // 12 SPELL_AURA_MOD_STUN
+ &AuraEffect::HandleModDamageDone, // 13 SPELL_AURA_MOD_DAMAGE_DONE
+ &AuraEffect::HandleNoImmediateEffect, // 14 SPELL_AURA_MOD_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
+ &AuraEffect::HandleNoImmediateEffect, // 15 SPELL_AURA_DAMAGE_SHIELD implemented in Unit::DoAttackDamage
+ &AuraEffect::HandleModStealth, // 16 SPELL_AURA_MOD_STEALTH
+ &AuraEffect::HandleNoImmediateEffect, // 17 SPELL_AURA_MOD_STEALTH_DETECT
+ &AuraEffect::HandleInvisibility, // 18 SPELL_AURA_MOD_INVISIBILITY
+ &AuraEffect::HandleInvisibilityDetect, // 19 SPELL_AURA_MOD_INVISIBILITY_DETECTION
+ &AuraEffect::HandleAuraModTotalHealthPercentRegen, // 20 SPELL_AURA_OBS_MOD_HEALTH
+ &AuraEffect::HandleAuraModTotalEnergyPercentRegen, // 21 SPELL_AURA_OBS_MOD_ENERGY
+ &AuraEffect::HandleAuraModResistance, // 22 SPELL_AURA_MOD_RESISTANCE
+ &AuraEffect::HandlePeriodicTriggerSpell, // 23 SPELL_AURA_PERIODIC_TRIGGER_SPELL
+ &AuraEffect::HandlePeriodicEnergize, // 24 SPELL_AURA_PERIODIC_ENERGIZE
+ &AuraEffect::HandleAuraModPacify, // 25 SPELL_AURA_MOD_PACIFY
+ &AuraEffect::HandleAuraModRoot, // 26 SPELL_AURA_MOD_ROOT
+ &AuraEffect::HandleAuraModSilence, // 27 SPELL_AURA_MOD_SILENCE
+ &AuraEffect::HandleNoImmediateEffect, // 28 SPELL_AURA_REFLECT_SPELLS implement in Unit::SpellHitResult
+ &AuraEffect::HandleAuraModStat, // 29 SPELL_AURA_MOD_STAT
+ &AuraEffect::HandleAuraModSkill, // 30 SPELL_AURA_MOD_SKILL
+ &AuraEffect::HandleAuraModIncreaseSpeed, // 31 SPELL_AURA_MOD_INCREASE_SPEED
+ &AuraEffect::HandleAuraModIncreaseMountedSpeed, // 32 SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED
+ &AuraEffect::HandleAuraModDecreaseSpeed, // 33 SPELL_AURA_MOD_DECREASE_SPEED
+ &AuraEffect::HandleAuraModIncreaseHealth, // 34 SPELL_AURA_MOD_INCREASE_HEALTH
+ &AuraEffect::HandleAuraModIncreaseEnergy, // 35 SPELL_AURA_MOD_INCREASE_ENERGY
+ &AuraEffect::HandleAuraModShapeshift, // 36 SPELL_AURA_MOD_SHAPESHIFT
+ &AuraEffect::HandleAuraModEffectImmunity, // 37 SPELL_AURA_EFFECT_IMMUNITY
+ &AuraEffect::HandleAuraModStateImmunity, // 38 SPELL_AURA_STATE_IMMUNITY
+ &AuraEffect::HandleAuraModSchoolImmunity, // 39 SPELL_AURA_SCHOOL_IMMUNITY
+ &AuraEffect::HandleAuraModDmgImmunity, // 40 SPELL_AURA_DAMAGE_IMMUNITY
+ &AuraEffect::HandleAuraModDispelImmunity, // 41 SPELL_AURA_DISPEL_IMMUNITY
+ &AuraEffect::HandleAuraProcTriggerSpell, // 42 SPELL_AURA_PROC_TRIGGER_SPELL implemented in Unit::ProcDamageAndSpellFor and Unit::HandleProcTriggerSpell
+ &AuraEffect::HandleNoImmediateEffect, // 43 SPELL_AURA_PROC_TRIGGER_DAMAGE implemented in Unit::ProcDamageAndSpellFor
+ &AuraEffect::HandleAuraTrackCreatures, // 44 SPELL_AURA_TRACK_CREATURES
+ &AuraEffect::HandleAuraTrackResources, // 45 SPELL_AURA_TRACK_RESOURCES
+ &AuraEffect::HandleUnused, // 46 SPELL_AURA_46 (used in test spells 54054 and 54058, and spell 48050) (3.0.8a)
+ &AuraEffect::HandleAuraModParryPercent, // 47 SPELL_AURA_MOD_PARRY_PERCENT
+ &AuraEffect::HandleNULL, // 48 SPELL_AURA_48 spell Napalm (area damage spell with additional delayed damage effect)
+ &AuraEffect::HandleAuraModDodgePercent, // 49 SPELL_AURA_MOD_DODGE_PERCENT
+ &AuraEffect::HandleNoImmediateEffect, // 50 SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT implemented in Unit::SpellCriticalHealingBonus
+ &AuraEffect::HandleAuraModBlockPercent, // 51 SPELL_AURA_MOD_BLOCK_PERCENT
+ &AuraEffect::HandleAuraModCritPercent, // 52 SPELL_AURA_MOD_CRIT_PERCENT
+ &AuraEffect::HandlePeriodicLeech, // 53 SPELL_AURA_PERIODIC_LEECH
+ &AuraEffect::HandleModHitChance, // 54 SPELL_AURA_MOD_HIT_CHANCE
+ &AuraEffect::HandleModSpellHitChance, // 55 SPELL_AURA_MOD_SPELL_HIT_CHANCE
+ &AuraEffect::HandleAuraTransform, // 56 SPELL_AURA_TRANSFORM
+ &AuraEffect::HandleModSpellCritChance, // 57 SPELL_AURA_MOD_SPELL_CRIT_CHANCE
+ &AuraEffect::HandleAuraModIncreaseSwimSpeed, // 58 SPELL_AURA_MOD_INCREASE_SWIM_SPEED
+ &AuraEffect::HandleNoImmediateEffect, // 59 SPELL_AURA_MOD_DAMAGE_DONE_CREATURE implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
+ &AuraEffect::HandleAuraModPacifyAndSilence, // 60 SPELL_AURA_MOD_PACIFY_SILENCE
+ &AuraEffect::HandleAuraModScale, // 61 SPELL_AURA_MOD_SCALE
+ &AuraEffect::HandlePeriodicHealthFunnel, // 62 SPELL_AURA_PERIODIC_HEALTH_FUNNEL
+ &AuraEffect::HandleUnused, // 63 unused (3.0.8a) old SPELL_AURA_PERIODIC_MANA_FUNNEL
+ &AuraEffect::HandlePeriodicManaLeech, // 64 SPELL_AURA_PERIODIC_MANA_LEECH
+ &AuraEffect::HandleModCastingSpeed, // 65 SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK
+ &AuraEffect::HandleFeignDeath, // 66 SPELL_AURA_FEIGN_DEATH
+ &AuraEffect::HandleAuraModDisarm, // 67 SPELL_AURA_MOD_DISARM
+ &AuraEffect::HandleAuraModStalked, // 68 SPELL_AURA_MOD_STALKED
+ &AuraEffect::HandleSchoolAbsorb, // 69 SPELL_AURA_SCHOOL_ABSORB implemented in Unit::CalcAbsorbResist
+ &AuraEffect::HandleUnused, // 70 SPELL_AURA_EXTRA_ATTACKS Useless, used by only one spell that has only visual effect
+ &AuraEffect::HandleModSpellCritChanceShool, // 71 SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
+ &AuraEffect::HandleModPowerCostPCT, // 72 SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
+ &AuraEffect::HandleModPowerCost, // 73 SPELL_AURA_MOD_POWER_COST_SCHOOL
+ &AuraEffect::HandleNoImmediateEffect, // 74 SPELL_AURA_REFLECT_SPELLS_SCHOOL implemented in Unit::SpellHitResult
+ &AuraEffect::HandleNoImmediateEffect, // 75 SPELL_AURA_MOD_LANGUAGE
+ &AuraEffect::HandleFarSight, // 76 SPELL_AURA_FAR_SIGHT
+ &AuraEffect::HandleModMechanicImmunity, // 77 SPELL_AURA_MECHANIC_IMMUNITY
+ &AuraEffect::HandleAuraMounted, // 78 SPELL_AURA_MOUNTED
+ &AuraEffect::HandleModDamagePercentDone, // 79 SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
+ &AuraEffect::HandleModPercentStat, // 80 SPELL_AURA_MOD_PERCENT_STAT
+ &AuraEffect::HandleNoImmediateEffect, // 81 SPELL_AURA_SPLIT_DAMAGE_PCT
+ &AuraEffect::HandleWaterBreathing, // 82 SPELL_AURA_WATER_BREATHING
+ &AuraEffect::HandleModBaseResistance, // 83 SPELL_AURA_MOD_BASE_RESISTANCE
+ &AuraEffect::HandleModRegen, // 84 SPELL_AURA_MOD_REGEN
+ &AuraEffect::HandleModPowerRegen, // 85 SPELL_AURA_MOD_POWER_REGEN
+ &AuraEffect::HandleChannelDeathItem, // 86 SPELL_AURA_CHANNEL_DEATH_ITEM
+ &AuraEffect::HandleNoImmediateEffect, // 87 SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN implemented in Unit::MeleeDamageBonus and Unit::SpellDamageBonus
+ &AuraEffect::HandleNoImmediateEffect, // 88 SPELL_AURA_MOD_HEALTH_REGEN_PERCENT
+ &AuraEffect::HandlePeriodicDamagePCT, // 89 SPELL_AURA_PERIODIC_DAMAGE_PERCENT
+ &AuraEffect::HandleUnused, // 90 unused (3.0.8a) old SPELL_AURA_MOD_RESIST_CHANCE
+ &AuraEffect::HandleNoImmediateEffect, // 91 SPELL_AURA_MOD_DETECT_RANGE implemented in Creature::GetAttackDistance
+ &AuraEffect::HandlePreventFleeing, // 92 SPELL_AURA_PREVENTS_FLEEING
+ &AuraEffect::HandleModUnattackable, // 93 SPELL_AURA_MOD_UNATTACKABLE
+ &AuraEffect::HandleNoImmediateEffect, // 94 SPELL_AURA_INTERRUPT_REGEN implemented in Player::RegenerateAll
+ &AuraEffect::HandleAuraGhost, // 95 SPELL_AURA_GHOST
+ &AuraEffect::HandleNoImmediateEffect, // 96 SPELL_AURA_SPELL_MAGNET implemented in Spell::SelectMagnetTarget
+ &AuraEffect::HandleManaShield, // 97 SPELL_AURA_MANA_SHIELD implemented in Unit::CalcAbsorbResist
+ &AuraEffect::HandleAuraModSkill, // 98 SPELL_AURA_MOD_SKILL_TALENT
+ &AuraEffect::HandleAuraModAttackPower, // 99 SPELL_AURA_MOD_ATTACK_POWER
+ &AuraEffect::HandleUnused, //100 SPELL_AURA_AURAS_VISIBLE obsolete? all player can see all auras now, but still have spells including GM-spell
+ &AuraEffect::HandleModResistancePercent, //101 SPELL_AURA_MOD_RESISTANCE_PCT
+ &AuraEffect::HandleNoImmediateEffect, //102 SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
+ &AuraEffect::HandleAuraModTotalThreat, //103 SPELL_AURA_MOD_TOTAL_THREAT
+ &AuraEffect::HandleAuraWaterWalk, //104 SPELL_AURA_WATER_WALK
+ &AuraEffect::HandleAuraFeatherFall, //105 SPELL_AURA_FEATHER_FALL
+ &AuraEffect::HandleAuraHover, //106 SPELL_AURA_HOVER
+ &AuraEffect::HandleAddModifier, //107 SPELL_AURA_ADD_FLAT_MODIFIER
+ &AuraEffect::HandleAddModifier, //108 SPELL_AURA_ADD_PCT_MODIFIER
+ &AuraEffect::HandleAddTargetTrigger, //109 SPELL_AURA_ADD_TARGET_TRIGGER
+ &AuraEffect::HandleModPowerRegenPCT, //110 SPELL_AURA_MOD_POWER_REGEN_PERCENT
+ &AuraEffect::HandleNULL, //111 SPELL_AURA_ADD_CASTER_HIT_TRIGGER chance redirect attack to caster
+ &AuraEffect::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
+ &AuraEffect::HandleNoImmediateEffect, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
+ &AuraEffect::HandleNoImmediateEffect, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
+ &AuraEffect::HandleNoImmediateEffect, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim
+ &AuraEffect::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
+ &AuraEffect::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
+ &AuraEffect::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
+ &AuraEffect::HandleUnused, //119 unused (3.0.8a) old SPELL_AURA_SHARE_PET_TRACKING
+ &AuraEffect::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE
+ &AuraEffect::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY
+ &AuraEffect::HandleModOffhandDamagePercent, //122 SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT
+ &AuraEffect::HandleModTargetResistance, //123 SPELL_AURA_MOD_TARGET_RESISTANCE
+ &AuraEffect::HandleAuraModRangedAttackPower, //124 SPELL_AURA_MOD_RANGED_ATTACK_POWER
+ &AuraEffect::HandleNoImmediateEffect, //125 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
+ &AuraEffect::HandleNoImmediateEffect, //126 SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
+ &AuraEffect::HandleNoImmediateEffect, //127 SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
+ &AuraEffect::HandleModPossessPet, //128 SPELL_AURA_MOD_POSSESS_PET
+ &AuraEffect::HandleAuraModIncreaseSpeed, //129 SPELL_AURA_MOD_SPEED_ALWAYS
+ &AuraEffect::HandleAuraModIncreaseMountedSpeed, //130 SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS
+ &AuraEffect::HandleNoImmediateEffect, //131 SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS implemented in Unit::MeleeDamageBonus
+ &AuraEffect::HandleAuraModIncreaseEnergyPercent, //132 SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT
+ &AuraEffect::HandleAuraModIncreaseHealthPercent, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
+ &AuraEffect::HandleAuraModRegenInterrupt, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
+ &AuraEffect::HandleModHealingDone, //135 SPELL_AURA_MOD_HEALING_DONE
+ &AuraEffect::HandleNoImmediateEffect, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus
+ &AuraEffect::HandleModTotalPercentStat, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
+ &AuraEffect::HandleHaste, //138 SPELL_AURA_MOD_HASTE
+ &AuraEffect::HandleForceReaction, //139 SPELL_AURA_FORCE_REACTION
+ &AuraEffect::HandleAuraModRangedHaste, //140 SPELL_AURA_MOD_RANGED_HASTE
+ &AuraEffect::HandleRangedAmmoHaste, //141 SPELL_AURA_MOD_RANGED_AMMO_HASTE
+ &AuraEffect::HandleAuraModBaseResistancePCT, //142 SPELL_AURA_MOD_BASE_RESISTANCE_PCT
+ &AuraEffect::HandleAuraModResistanceExclusive, //143 SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
+ &AuraEffect::HandleNoImmediateEffect, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes
+ &AuraEffect::HandleAuraModPetTalentsPoints, //145 SPELL_AURA_MOD_PET_TALENT_POINTS
+ &AuraEffect::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE
+ &AuraEffect::HandleModMechanicImmunity, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK
+ &AuraEffect::HandleAuraRetainComboPoints, //148 SPELL_AURA_RETAIN_COMBO_POINTS
+ &AuraEffect::HandleNoImmediateEffect, //149 SPELL_AURA_REDUCE_PUSHBACK
+ &AuraEffect::HandleShieldBlockValue, //150 SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT
+ &AuraEffect::HandleAuraTrackStealthed, //151 SPELL_AURA_TRACK_STEALTHED
+ &AuraEffect::HandleNoImmediateEffect, //152 SPELL_AURA_MOD_DETECTED_RANGE implemented in Creature::GetAttackDistance
+ &AuraEffect::HandleNoImmediateEffect, //153 SPELL_AURA_SPLIT_DAMAGE_FLAT
+ &AuraEffect::HandleNoImmediateEffect, //154 SPELL_AURA_MOD_STEALTH_LEVEL
+ &AuraEffect::HandleNoImmediateEffect, //155 SPELL_AURA_MOD_WATER_BREATHING
+ &AuraEffect::HandleNoImmediateEffect, //156 SPELL_AURA_MOD_REPUTATION_GAIN
+ &AuraEffect::HandleNULL, //157 SPELL_AURA_PET_DAMAGE_MULTI
+ &AuraEffect::HandleShieldBlockValue, //158 SPELL_AURA_MOD_SHIELD_BLOCKVALUE
+ &AuraEffect::HandleNoImmediateEffect, //159 SPELL_AURA_NO_PVP_CREDIT only for Honorless Target spell
+ &AuraEffect::HandleNoImmediateEffect, //160 SPELL_AURA_MOD_AOE_AVOIDANCE implemented in Unit::MagicSpellHitResult
+ &AuraEffect::HandleNoImmediateEffect, //161 SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT
+ &AuraEffect::HandleAuraPowerBurn, //162 SPELL_AURA_POWER_BURN_MANA
+ &AuraEffect::HandleNoImmediateEffect, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS_MELEE
+ &AuraEffect::HandleUnused, //164 unused (3.0.8a), only one test spell
+ &AuraEffect::HandleNoImmediateEffect, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
+ &AuraEffect::HandleAuraModAttackPowerPercent, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT
+ &AuraEffect::HandleAuraModRangedAttackPowerPercent, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
+ &AuraEffect::HandleNoImmediateEffect, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
+ &AuraEffect::HandleNoImmediateEffect, //169 SPELL_AURA_MOD_CRIT_PERCENT_VERSUS implemented in Unit::DealDamageBySchool, Unit::DoAttackDamage, Unit::SpellCriticalBonus
+ &AuraEffect::HandleNULL, //170 SPELL_AURA_DETECT_AMORE different spells that ignore transformation effects
+ &AuraEffect::HandleAuraModIncreaseSpeed, //171 SPELL_AURA_MOD_SPEED_NOT_STACK
+ &AuraEffect::HandleAuraModIncreaseMountedSpeed, //172 SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK
+ &AuraEffect::HandleUnused, //173 unused (3.0.8a) no spells, old SPELL_AURA_ALLOW_CHAMPION_SPELLS only for Proclaim Champion spell
+ &AuraEffect::HandleModSpellDamagePercentFromStat, //174 SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT implemented in Unit::SpellBaseDamageBonus
+ &AuraEffect::HandleModSpellHealingPercentFromStat, //175 SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT implemented in Unit::SpellBaseHealingBonus
+ &AuraEffect::HandleSpiritOfRedemption, //176 SPELL_AURA_SPIRIT_OF_REDEMPTION only for Spirit of Redemption spell, die at aura end
+ &AuraEffect::HandleNULL, //177 SPELL_AURA_AOE_CHARM
+ &AuraEffect::HandleNoImmediateEffect, //178 SPELL_AURA_MOD_DEBUFF_RESISTANCE implemented in Unit::MagicSpellHitResult
+ &AuraEffect::HandleNoImmediateEffect, //179 SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE implemented in Unit::SpellCriticalBonus
+ &AuraEffect::HandleNoImmediateEffect, //180 SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS implemented in Unit::SpellDamageBonus
+ &AuraEffect::HandleUnused, //181 unused (3.0.8a) old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS
+ &AuraEffect::HandleAuraModResistenceOfStatPercent, //182 SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT
+ &AuraEffect::HandleNULL, //183 SPELL_AURA_MOD_CRITICAL_THREAT only used in 28746
+ &AuraEffect::HandleNoImmediateEffect, //184 SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
+ &AuraEffect::HandleNoImmediateEffect, //185 SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
+ &AuraEffect::HandleNoImmediateEffect, //186 SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE implemented in Unit::MagicSpellHitResult
+ &AuraEffect::HandleNoImmediateEffect, //187 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
+ &AuraEffect::HandleNoImmediateEffect, //188 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE implemented in Unit::GetUnitCriticalChance
+ &AuraEffect::HandleModRating, //189 SPELL_AURA_MOD_RATING
+ &AuraEffect::HandleNULL, //190 SPELL_AURA_MOD_FACTION_REPUTATION_GAIN
+ &AuraEffect::HandleAuraModUseNormalSpeed, //191 SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED
+ &AuraEffect::HandleModMeleeRangedSpeedPct, //192 SPELL_AURA_HASTE_MELEE
+ &AuraEffect::HandleModCombatSpeedPct, //193 SPELL_AURA_MELEE_SLOW (in fact combat (any type attack) speed pct)
+ &AuraEffect::HandleNULL, //194 SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
+ &AuraEffect::HandleNoImmediateEffect, //195 SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL implemented in Unit::CalcAbsorbResist
+ &AuraEffect::HandleNULL, //196 SPELL_AURA_MOD_COOLDOWN
+ &AuraEffect::HandleNoImmediateEffect, //197 SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE implemented in Unit::SpellCriticalBonus Unit::GetUnitCriticalChance
+ &AuraEffect::HandleUnused, //198 unused (3.0.8a) old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
+ &AuraEffect::HandleNoImmediateEffect, //199 SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT implemented in Unit::MagicSpellHitResult
+ &AuraEffect::HandleNoImmediateEffect, //200 SPELL_AURA_MOD_XP_PCT implemented in Player::GiveXP
+ &AuraEffect::HandleAuraAllowFlight, //201 SPELL_AURA_FLY this aura enable flight mode...
+ &AuraEffect::HandleNoImmediateEffect, //202 SPELL_AURA_CANNOT_BE_DODGED implemented in Unit::RollPhysicalOutcomeAgainst
+ &AuraEffect::HandleNoImmediateEffect, //203 SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
+ &AuraEffect::HandleNoImmediateEffect, //204 SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE implemented in Unit::CalculateMeleeDamage and Unit::CalculateSpellDamage
+ &AuraEffect::HandleNULL, //205 vulnerable to school dmg?
+ &AuraEffect::HandleNULL, //206 SPELL_AURA_MOD_SPEED_MOUNTED
+ &AuraEffect::HandleAuraModIncreaseFlightSpeed, //207 SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED
+ &AuraEffect::HandleAuraModIncreaseFlightSpeed, //208 SPELL_AURA_MOD_SPEED_FLIGHT, used only in spell: Flight Form (Passive)
+ &AuraEffect::HandleAuraModIncreaseFlightSpeed, //209 SPELL_AURA_MOD_FLIGHT_SPEED_ALWAYS
+ &AuraEffect::HandleNULL, //210 Commentator's Command
+ &AuraEffect::HandleAuraModIncreaseFlightSpeed, //211 SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK
+ &AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent, //212 SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT
+ &AuraEffect::HandleNoImmediateEffect, //213 SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT implemented in Player::RewardRage
+ &AuraEffect::HandleNULL, //214 Tamed Pet Passive
+ &AuraEffect::HandleArenaPreparation, //215 SPELL_AURA_ARENA_PREPARATION
+ &AuraEffect::HandleModCastingSpeed, //216 SPELL_AURA_HASTE_SPELLS
+ &AuraEffect::HandleUnused, //217 unused (3.0.8a)
+ &AuraEffect::HandleAuraModRangedHaste, //218 SPELL_AURA_HASTE_RANGED
+ &AuraEffect::HandleModManaRegen, //219 SPELL_AURA_MOD_MANA_REGEN_FROM_STAT
+ &AuraEffect::HandleModRatingFromStat, //220 SPELL_AURA_MOD_RATING_FROM_STAT
+ &AuraEffect::HandleNULL, //221 ignored
+ &AuraEffect::HandleUnused, //222 unused (3.0.8a) only for spell 44586 that not used in real spell cast
+ &AuraEffect::HandleNoImmediateEffect, //223 SPELL_AURA_RAID_PROC_FROM_CHARGE
+ &AuraEffect::HandleUnused, //224 unused (3.0.8a)
+ &AuraEffect::HandleNoImmediateEffect, //225 SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE
+ &AuraEffect::HandleAuraPeriodicDummy, //226 SPELL_AURA_PERIODIC_DUMMY
+ &AuraEffect::HandlePeriodicTriggerSpellWithValue, //227 SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE
+ &AuraEffect::HandleNoImmediateEffect, //228 stealth detection
+ &AuraEffect::HandleNULL, //229 SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE
+ &AuraEffect::HandleAuraModIncreaseHealth, //230 SPELL_AURA_MOD_INCREASE_HEALTH_2
+ &AuraEffect::HandleNoImmediateEffect, //231 SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE
+ &AuraEffect::HandleNoImmediateEffect, //232 SPELL_AURA_MECHANIC_DURATION_MOD implement in Unit::CalculateSpellDuration
+ &AuraEffect::HandleNULL, //233 set model id to the one of the creature with id GetMiscValue()
+ &AuraEffect::HandleNoImmediateEffect, //234 SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK implement in Unit::CalculateSpellDuration
+ &AuraEffect::HandleAuraModDispelResist, //235 SPELL_AURA_MOD_DISPEL_RESIST implement in Unit::MagicSpellHitResult
+ &AuraEffect::HandleAuraControlVehicle, //236 SPELL_AURA_CONTROL_VEHICLE
+ &AuraEffect::HandleModSpellDamagePercentFromAttackPower, //237 SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER implemented in Unit::SpellBaseDamageBonus
+ &AuraEffect::HandleModSpellHealingPercentFromAttackPower, //238 SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER implemented in Unit::SpellBaseHealingBonus
+ &AuraEffect::HandleAuraModScale, //239 SPELL_AURA_MOD_SCALE_2 only in Noggenfogger Elixir (16595) before 2.3.0 aura 61
+ &AuraEffect::HandleAuraModExpertise, //240 SPELL_AURA_MOD_EXPERTISE
+ &AuraEffect::HandleForceMoveForward, //241 Forces the player to move forward
+ &AuraEffect::HandleUnused, //242 SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING
+ &AuraEffect::HandleNULL, //243 faction reaction override spells
+ &AuraEffect::HandleComprehendLanguage, //244 Comprehend language
+ &AuraEffect::HandleNoImmediateEffect, //245 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL
+ &AuraEffect::HandleNoImmediateEffect, //246 SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK implemented in Spell::EffectApplyAura
+ &AuraEffect::HandleNULL, //247 target to become a clone of the caster
+ &AuraEffect::HandleNoImmediateEffect, //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE implemented in Unit::RollMeleeOutcomeAgainst
+ &AuraEffect::HandleAuraConvertRune, //249 SPELL_AURA_CONVERT_RUNE
+ &AuraEffect::HandleAuraModIncreaseHealth, //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
+ &AuraEffect::HandleNoImmediateEffect, //251 SPELL_AURA_MOD_ENEMY_DODGE
+ &AuraEffect::HandleNULL, //252 haste all?
+ &AuraEffect::HandleNoImmediateEffect, //253 SPELL_AURA_MOD_BLOCK_CRIT_CHANCE implemented in Unit::isBlockCritical
+ &AuraEffect::HandleAuraModDisarm, //254 SPELL_AURA_MOD_DISARM_OFFHAND
+ &AuraEffect::HandleNoImmediateEffect, //255 SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT implemented in Unit::SpellDamageBonus
+ &AuraEffect::HandleNoReagentUseAura, //256 SPELL_AURA_NO_REAGENT_USE Use SpellClassMask for spell select
+ &AuraEffect::HandleNULL, //257 SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS Use SpellClassMask for spell select
+ &AuraEffect::HandleNULL, //258 SPELL_AURA_MOD_SPELL_VISUAL
+ &AuraEffect::HandleNoImmediateEffect, //259 SPELL_AURA_MOD_HOT_PCT implemented in Unit::SpellHealingBonus
+ &AuraEffect::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code
+ &AuraEffect::HandlePhase, //261 SPELL_AURA_PHASE undetactable invisibility? implemented in Unit::isVisibleForOrDetect
+ &AuraEffect::HandleNoImmediateEffect, //262 SPELL_AURA_ABILITY_IGNORE_AURASTATE implemented in spell::cancast
+ &AuraEffect::HandleAuraAllowOnlyAbility, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
+ &AuraEffect::HandleUnused, //264 unused (3.0.8a)
+ &AuraEffect::HandleUnused, //265 unused (3.0.8a)
+ &AuraEffect::HandleUnused, //266 unused (3.0.8a)
+ &AuraEffect::HandleNoImmediateEffect, //267 SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL implemented in Unit::IsImmunedToSpellEffect
+ &AuraEffect::HandleAuraModAttackPowerOfStatPercent, //268 SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
+ &AuraEffect::HandleNoImmediateEffect, //269 SPELL_AURA_MOD_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage
+ &AuraEffect::HandleNoImmediateEffect, //270 SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST implemented in Unit::CalcAbsorbResist and CalcArmorReducedDamage
+ &AuraEffect::HandleNoImmediateEffect, //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER implemented in Unit::SpellDamageBonus
+ &AuraEffect::HandleNULL, //272 reduce spell cast time?
+ &AuraEffect::HandleUnused, //273 clientside
+ &AuraEffect::HandleNoImmediateEffect, //274 SPELL_AURA_CONSUME_NO_AMMO implemented in spell::CalculateDamageDoneForAllTargets
+ &AuraEffect::HandleNoImmediateEffect, //275 SPELL_AURA_MOD_IGNORE_SHAPESHIFT Use SpellClassMask for spell select
+ &AuraEffect::HandleNULL, //276 mod damage % mechanic?
+ &AuraEffect::HandleNoImmediateEffect, //277 SPELL_AURA_MOD_ABILITY_AFFECTED_TARGETS implemented in spell::settargetmap
+ &AuraEffect::HandleAuraModDisarm, //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon
+ &AuraEffect::HandleNULL, //279 visual effects? 58836 and 57507
+ &AuraEffect::HandleNoImmediateEffect, //280 SPELL_AURA_MOD_WEAPONTYPE_IGNORE_TARGET_RESISTANCE
+ &AuraEffect::HandleNoImmediateEffect, //281 SPELL_AURA_MOD_HONOR_GAIN_PCT implemented in Player::RewardHonor
+ &AuraEffect::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
+ &AuraEffect::HandleNoImmediateEffect, //283 SPELL_AURA_MOD_HEALING_RECEIVED implemented in Unit::SpellHealingBonus
+ &AuraEffect::HandleUnused, //284 not used by any spells (3.08a)
+ &AuraEffect::HandleUnused, //285 not used by any spells (3.08a)
+ &AuraEffect::HandleUnused, //286 not used by any spells (3.08a)
+ &AuraEffect::HandleNoImmediateEffect, //287 SPELL_AURA_DEFLECT_SPELLS implemented in Unit::MagicSpellHitResult and Unit::MeleeSpellHitResult
+ &AuraEffect::HandleUnused, //288 not used by any spells (3.09) except 1 test spell.
};
-Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) :
-m_spellmod(NULL), m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target),
-m_timeCla(1000), m_periodicTimer(0), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE),
-m_effIndex(eff), m_auraSlot(MAX_AURAS), m_auraFlags(AFLAG_NONE), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),
-m_positive(false), m_permanent(false), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
-m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false)
+Aura::Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) :
+m_caster_guid(0), m_castItemGuid(castItem?castItem->GetGUID():0), m_target(target),
+m_timeCla(1000), m_removeMode(AURA_REMOVE_BY_DEFAULT), m_AuraDRGroup(DIMINISHING_NONE),
+m_auraSlot(MAX_AURAS), m_auraLevel(1), m_procCharges(0), m_stackAmount(1),m_auraStateMask(0), m_updated(false)
{
assert(target);
assert(spellproto && spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element");
- m_spellProto = spellproto;
+ m_auraFlags = effMask;
- int32 damage;
- if(currentBasePoints)
- {
- damage = *currentBasePoints;
- m_currentBasePoints = damage - 1;
- }
- else
- {
- m_currentBasePoints = m_spellProto->EffectBasePoints[eff];
- if(caster)
- damage = caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, target);
- else
- damage = m_currentBasePoints + 1;
- }
+ m_spellProto = spellproto;
m_isPassive = IsPassiveSpell(GetId());
- m_positive = IsPositiveEffect(GetId(), m_effIndex);
+
m_auraStateMask = 0;
m_isSingleTargetAura = IsSingleTargetSpell(m_spellProto);
@@ -392,34 +375,12 @@ m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false)
//damage = caster->CalculateSpellDamage(m_spellProto,m_effIndex,m_currentBasePoints,target);
m_maxduration = caster->CalcSpellDuration(m_spellProto);
-
- if (!damage && castItem && castItem->GetItemSuffixFactor())
- {
- ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId()));
- if(item_rand_suffix)
- {
- for (int k=0; k<3; k++)
- {
- SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]);
- if(pEnchant)
- {
- for (int t=0; t<3; t++)
- if(pEnchant->spellid[t] == m_spellProto->Id)
- {
- damage = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000 );
- break;
- }
- }
-
- if(damage)
- break;
- }
- }
- }
}
if(m_maxduration == -1 || m_isPassive && m_spellProto->DurationIndex == 0)
m_permanent = true;
+ else
+ m_permanent = false;
Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;
@@ -433,24 +394,6 @@ m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false)
m_duration = m_maxduration;
- sLog.outDebug("Aura: construct Spellid : %u, Aura : %u Duration : %d Target : %d Damage : %d", m_spellProto->Id, m_spellProto->EffectApplyAuraName[eff], m_maxduration, m_spellProto->EffectImplicitTargetA[eff],damage);
-
- m_effIndex = eff;
- int32 periodicTime = m_spellProto->EffectAmplitude[eff];
- //apply casting time mods for channeled spells
- if (caster && IsChanneledSpell(m_spellProto))
- caster->ModSpellCastTime(m_spellProto, periodicTime);
-
- SetModifier(AuraType(m_spellProto->EffectApplyAuraName[eff]), damage,periodicTime , m_spellProto->EffectMiscValue[eff]);
-
- // Apply periodic time mod
- if(modOwner && m_modifier.periodictime)
- modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_modifier.periodictime);
-
- // Start periodic on next tick or at aura apply
- if (!(m_spellProto->AttributesEx5 & SPELL_ATTR_EX5_START_PERIODIC_AT_APPLY))
- m_periodicTimer += m_modifier.periodictime;
-
m_isDeathPersist = IsDeathPersistentSpell(m_spellProto);
m_procCharges = m_spellProto->procCharges;
@@ -461,21 +404,127 @@ m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false)
m_spellProto->Stances &&
!(m_spellProto->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) &&
!(m_spellProto->Attributes & SPELL_ATTR_NOT_SHAPESHIFT));
+
+ for (uint8 i=0 ;i<MAX_SPELL_EFFECTS;++i)
+ {
+ if (m_auraFlags & (uint8(1) << i))
+ {
+ if (&currentBasePoints[0])
+ m_partAuras[i]=CreateAuraEffect(this, i,&currentBasePoints[0]+i, caster);
+ else
+ m_partAuras[i]=CreateAuraEffect(this, i, NULL , caster);
+ // correct flags if aura couldn't be created
+ if (!m_partAuras[i])
+ m_auraFlags &= (~(uint8(1) << i));
+ }
+ else
+ {
+ m_partAuras[i]=NULL;
+ }
+ }
+
+ // Aura is positive when it is casted by friend and at least one aura is positive
+ // or when it is casted by enemy and at least one aura is negative
+ bool swap=false;
+ if (!caster || caster==target)
+ m_positive=IsPositiveSpell(m_spellProto->Id);
+ else
+ {
+ m_positive = !caster->IsHostileTo(m_target);
+ for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
+ {
+ if (!(1<<i & GetEffectMask()))
+ continue;
+ if (m_positive == IsPositiveEffect(GetId(), i))
+ {
+ swap = true;
+ break;
+ }
+ }
+ if (!swap)
+ m_positive=!m_positive;
+ }
}
Aura::~Aura()
{
+ // free part auras memory
+ for (uint8 i=0 ; i<MAX_SPELL_EFFECTS;++i)
+ if (m_partAuras[i])
+ delete m_partAuras[i];
}
-AreaAura::AreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target,
-Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target, caster, castItem)
+AuraEffect::AuraEffect(Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit * caster, Item* castItem) :
+m_parentAura(parentAura), m_spellmod(NULL), m_periodicTimer(0), m_isPeriodic(false), m_isAreaAura(false), m_isPersistent(false),
+m_in_use(false), m_target(parentAura->GetTarget())
{
+ m_spellProto = parentAura->GetSpellProto();
+ m_effIndex = effIndex;
+ m_auraName = AuraType(m_spellProto->EffectApplyAuraName[m_effIndex]);
+
+ if(currentBasePoints)
+ {
+ m_amount = *currentBasePoints;
+ m_currentBasePoints = m_amount - 1;
+ }
+ else
+ {
+ m_currentBasePoints = m_spellProto->EffectBasePoints[m_effIndex];
+ if(caster)
+ m_amount = caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, m_target);
+ else
+ m_amount = m_currentBasePoints + 1;
+ }
+
+ if (!m_amount && castItem && castItem->GetItemSuffixFactor())
+ {
+ ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId()));
+ if(item_rand_suffix)
+ {
+ for (int k=0; k<3; k++)
+ {
+ SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(item_rand_suffix->enchant_id[k]);
+ if(pEnchant)
+ {
+ for (int t=0; t<3; t++)
+ if(pEnchant->spellid[t] == m_spellProto->Id)
+ {
+ m_amount = uint32((item_rand_suffix->prefix[k]*castItem->GetItemSuffixFactor()) / 10000 );
+ break;
+ }
+ }
+
+ if(m_amount)
+ break;
+ }
+ }
+ }
+
+ Player* modOwner = caster ? caster->GetSpellModOwner() : NULL;
+ m_amplitude = m_spellProto->EffectAmplitude[m_effIndex];
+
+ //apply casting time mods for channeled spells
+ if (modOwner && m_amplitude && IsChanneledSpell(m_spellProto))
+ modOwner->ModSpellCastTime(m_spellProto, m_amplitude);
+
+ // Apply periodic time mod
+ if(modOwner && m_amplitude)
+ modOwner->ApplySpellMod(GetId(), SPELLMOD_ACTIVATION_TIME, m_amplitude);
+
+ // Start periodic on next tick or at aura apply
+ if (!(m_spellProto->AttributesEx5 & SPELL_ATTR_EX5_START_PERIODIC_AT_APPLY))
+ m_periodicTimer += m_amplitude;
+}
+
+AreaAuraEffect::AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster, Item * castItem)
+: AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem)
+{
+ m_removeTime = FRIENDLY_AA_REMOVE_TIME;
m_isAreaAura = true;
- // caster==NULL in constructor args if target==caster in fact
- Unit* caster_ptr = caster ? caster : target;
+ Unit* caster_ptr = caster ? caster : m_target;
- if (spellproto->Effect[eff]==SPELL_EFFECT_APPLY_AREA_AURA_ENEMY)
+ if (m_spellProto->Effect[effIndex] == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY)
m_radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[m_effIndex]));
else
m_radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[m_effIndex]));
@@ -483,33 +532,33 @@ Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target,
if(Player* modOwner = caster_ptr->GetSpellModOwner())
modOwner->ApplySpellMod(GetId(), SPELLMOD_RADIUS, m_radius);
- switch(spellproto->Effect[eff])
+ switch(m_spellProto->Effect[effIndex])
{
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
m_areaAuraType = AREA_AURA_PARTY;
- if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
- m_modifier.m_auraname = SPELL_AURA_NONE;
+ if(m_target->GetTypeId() == TYPEID_UNIT && ((Creature*)m_target)->isTotem())
+ m_auraName = SPELL_AURA_NONE;
break;
case SPELL_EFFECT_APPLY_AREA_AURA_RAID:
m_areaAuraType = AREA_AURA_RAID;
- if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
- m_modifier.m_auraname = SPELL_AURA_NONE;
+ if(m_target->GetTypeId() == TYPEID_UNIT && ((Creature*)m_target)->isTotem())
+ m_auraName = SPELL_AURA_NONE;
break;
case SPELL_EFFECT_APPLY_AREA_AURA_FRIEND:
m_areaAuraType = AREA_AURA_FRIEND;
break;
case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
m_areaAuraType = AREA_AURA_ENEMY;
- if(target == caster_ptr)
- m_modifier.m_auraname = SPELL_AURA_NONE; // Do not do any effect on self
+ if(m_target == caster_ptr)
+ m_auraName = SPELL_AURA_NONE; // Do not do any effect on self
break;
case SPELL_EFFECT_APPLY_AREA_AURA_PET:
m_areaAuraType = AREA_AURA_PET;
break;
case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
m_areaAuraType = AREA_AURA_OWNER;
- if(target == caster_ptr)
- m_modifier.m_auraname = SPELL_AURA_NONE;
+ if(m_target == caster_ptr)
+ m_auraName = SPELL_AURA_NONE;
break;
default:
sLog.outError("Wrong spell effect in AreaAura constructor");
@@ -518,26 +567,30 @@ Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target,
}
}
-AreaAura::~AreaAura()
+AreaAuraEffect::~AreaAuraEffect()
{
}
-PersistentAreaAura::PersistentAreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target,
-Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target, caster, castItem)
+PersistentAreaAuraEffect::PersistentAreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster,Item * castItem)
+: AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem)
{
m_isPersistent = true;
}
-PersistentAreaAura::~PersistentAreaAura()
+PersistentAreaAuraEffect::~PersistentAreaAuraEffect()
{
}
-Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem)
+AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem)
{
- if (IsAreaAuraEffect(spellproto->Effect[eff]))
- return new AreaAura(spellproto, eff, currentBasePoints, target, caster, castItem);
-
- return new Aura(spellproto, eff, currentBasePoints, target, caster, castItem);
+ assert (parentAura);
+ if (IsAreaAuraEffect(parentAura->GetSpellProto()->Effect[effIndex]))
+ return new AreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem);
+ else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_APPLY_AURA)
+ return new AuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem);
+ else if (parentAura->GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
+ return new PersistentAreaAuraEffect(parentAura, effIndex, currentBasePoints, caster, castItem);
+ else return NULL;
}
Unit* Aura::GetCaster() const
@@ -551,14 +604,6 @@ Unit* Aura::GetCaster() const
return unit && unit->IsInWorld() ? unit : NULL;
}
-void Aura::SetModifier(AuraType t, int32 a, uint32 pt, int32 miscValue)
-{
- m_modifier.m_auraname = t;
- m_modifier.m_amount = a;
- m_modifier.m_miscvalue = miscValue;
- m_modifier.periodictime = pt;
-}
-
void Aura::Update(uint32 diff)
{
if (m_duration > 0)
@@ -568,9 +613,8 @@ void Aura::Update(uint32 diff)
m_duration = 0;
m_timeCla -= diff;
- // GetEffIndex()==0 prevent double/triple apply manaPerSecond/manaPerSecondPerLevel to same spell with many auras
// all spells with manaPerSecond/manaPerSecondPerLevel have aura in effect 0
- if(GetEffIndex()==0 && m_timeCla <= 0)
+ if(m_timeCla <= 0)
{
if(Unit* caster = GetCaster())
{
@@ -584,12 +628,12 @@ void Aura::Update(uint32 diff)
if (caster->GetHealth()>manaPerSecond)
caster->ModifyHealth(-manaPerSecond);
else
- m_target->RemoveAurasByCasterSpell(GetId(),GetCasterGUID());
+ m_target->RemoveAurasDueToSpell(GetId(),GetCasterGUID());
}
else if (caster->GetPower(powertype)>=manaPerSecond)
caster->ModifyPower(powertype,-manaPerSecond);
else
- m_target->RemoveAurasByCasterSpell(GetId(),GetCasterGUID());
+ m_target->RemoveAurasDueToSpell(GetId(),GetCasterGUID());
}
}
}
@@ -601,19 +645,22 @@ void Aura::Update(uint32 diff)
Unit* caster = GetCaster();
if(!caster)
{
- m_target->RemoveAura(GetId(),GetEffIndex());
+ m_target->RemoveAurasDueToSpell(GetId(),GetCasterGUID());
return;
}
-
// Get spell range
- float radius;
+ float radius=-1.0f;
SpellModOp mod;
- if (m_spellProto->EffectRadiusIndex[GetEffIndex()])
+ for (uint8 i=0;i<3;++i)
{
- radius = caster->GetSpellRadiusForTarget(m_target, sSpellRadiusStore.LookupEntry(m_spellProto->EffectRadiusIndex[GetEffIndex()]));
- mod = SPELLMOD_RADIUS;
+ if (HasEffect(i) && m_spellProto->EffectRadiusIndex[i])
+ {
+ radius = caster->GetSpellRadiusForTarget(m_target, sSpellRadiusStore.LookupEntry(m_spellProto->EffectRadiusIndex[i]));
+ mod = SPELLMOD_RADIUS;
+ break;
+ }
}
- else
+ if (radius<0)
{
radius = caster->GetSpellMaxRangeForTarget(m_target, sSpellRangeStore.LookupEntry(m_spellProto->rangeIndex)) ;
mod = SPELLMOD_RANGE;
@@ -624,18 +671,32 @@ void Aura::Update(uint32 diff)
if(!caster->IsWithinDistInMap(m_target,radius))
{
- m_target->RemoveAura(GetId(),GetEffIndex());
+ m_target->RemoveAurasDueToSpell(GetId(),GetCasterGUID());
return;
}
}
- if(m_isPeriodic && (m_duration >= 0 || m_isPassive || m_permanent))
+ for (uint8 i = 0; i<MAX_SPELL_EFFECTS;++i)
+ if (m_partAuras[i])
+ {
+ if (m_partAuras[i]->IsAreaAura())
+ ((AreaAuraEffect *) m_partAuras[i])->Update(diff);
+ else if(m_partAuras[i]->IsPersistent())
+ ((PersistentAreaAuraEffect *) m_partAuras[i])->Update(diff);
+ else
+ m_partAuras[i]->Update(diff);
+ }
+}
+
+void AuraEffect::Update(uint32 diff)
+{
+ if (m_isPeriodic && (GetParentAura()->GetAuraDuration() >=0 || GetParentAura()->IsPassive() || GetParentAura()->IsPermanent()))
{
m_periodicTimer -= diff;
if(m_periodicTimer <= 0) // tick also at m_periodicTimer==0 to prevent lost last tick in case max m_duration == (max m_periodicTimer)*N
{
// update before applying (aura can be removed in TriggerSpell or PeriodicTick calls)
- m_periodicTimer += m_modifier.periodictime;
+ m_periodicTimer += m_amplitude;
if(!m_target->hasUnitState(UNIT_STAT_ISOLATED))
PeriodicTick();
@@ -643,10 +704,10 @@ void Aura::Update(uint32 diff)
}
}
-void AreaAura::Update(uint32 diff)
+void AreaAuraEffect::Update(uint32 diff)
{
// update for the caster of the aura
- if(m_caster_guid == m_target->GetGUID())
+ if(GetCasterGUID() == m_target->GetGUID())
{
Unit* caster = m_target;
@@ -687,7 +748,7 @@ void AreaAura::Update(uint32 diff)
for(std::list<Unit *>::iterator tIter = targets.begin(); tIter != targets.end(); tIter++)
{
- if((*tIter)->HasAura(GetId(), m_effIndex))
+ if((*tIter)->HasAuraEffect(GetId(), GetEffIndex(), GetCasterGUID()))
continue;
if(SpellEntry const *actualSpellInfo = spellmgr.SelectAuraRankForPlayerLevel(GetSpellProto(), (*tIter)->getLevel()))
@@ -696,62 +757,74 @@ void AreaAura::Update(uint32 diff)
// recalculate basepoints for lower rank (all AreaAura spell not use custom basepoints?)
//if(actualSpellInfo != GetSpellProto())
// actualBasePoints = actualSpellInfo->EffectBasePoints[m_effIndex];
- AreaAura *aur;
- if(actualSpellInfo == GetSpellProto())
- aur = new AreaAura(actualSpellInfo, m_effIndex, &m_modifier.m_amount, (*tIter), caster, NULL);
- else
- aur = new AreaAura(actualSpellInfo, m_effIndex, NULL, (*tIter), caster, NULL);
- aur->SetAuraDuration(GetAuraDuration());
- (*tIter)->AddAura(aur);
+ Aura * aur = (*tIter)->AddAuraEffect(actualSpellInfo->Id, GetEffIndex(), caster);
+ aur->SetAuraDuration(aur->GetAuraDuration());
if(m_areaAuraType == AREA_AURA_ENEMY)
caster->CombatStart(*tIter);
}
}
}
- Aura::Update(diff);
+ AuraEffect::Update(diff);
}
else // aura at non-caster
{
Unit * tmp_target = m_target;
Unit* caster = GetCaster();
- uint32 tmp_spellId = GetId(), tmp_effIndex = m_effIndex;
+ uint32 tmp_spellId = GetId();
+ uint32 tmp_effIndex = GetEffIndex();
+ uint64 tmp_guid = GetCasterGUID();
// WARNING: the aura may get deleted during the update
// DO NOT access its members after update!
- Aura::Update(diff);
+ AuraEffect::Update(diff);
// remove aura if out-of-range from caster (after teleport for example)
// or caster is isolated or caster no longer has the aura
// or caster is (no longer) friendly
bool needFriendly = (m_areaAuraType == AREA_AURA_ENEMY ? false : true);
if( !caster || caster->hasUnitState(UNIT_STAT_ISOLATED) ||
- !caster->IsWithinDistInMap(tmp_target, m_radius) ||
- !caster->HasAura(tmp_spellId, tmp_effIndex) ||
+ !caster->HasAuraEffect(tmp_spellId, tmp_effIndex) ||
caster->IsFriendlyTo(tmp_target) != needFriendly
)
{
- tmp_target->RemoveAura(tmp_spellId, tmp_effIndex);
- }
- else if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group
- {
- if(!tmp_target->IsInPartyWith(caster))
- tmp_target->RemoveAura(tmp_spellId, tmp_effIndex);
+ tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid);
}
- else if( m_areaAuraType == AREA_AURA_RAID) // TODO: fix me!
+ else if (!caster->IsWithinDistInMap(tmp_target, m_radius))
{
- if(!tmp_target->IsInRaidWith(caster))
- tmp_target->RemoveAura(tmp_spellId, tmp_effIndex);
+ if (needFriendly)
+ {
+ m_removeTime -= diff;
+ if (m_removeTime < 0)
+ tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid);
+ }
+ else
+ tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid);
}
- else if( m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER )
+ else
{
- if( tmp_target->GetGUID() != caster->GetCharmerOrOwnerGUID() )
- tmp_target->RemoveAura(tmp_spellId, tmp_effIndex);
+ // Reset aura remove timer
+ m_removeTime = FRIENDLY_AA_REMOVE_TIME;
+ if( m_areaAuraType == AREA_AURA_PARTY) // check if in same sub group
+ {
+ if(!tmp_target->IsInPartyWith(caster))
+ tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid);
+ }
+ else if( m_areaAuraType == AREA_AURA_RAID)
+ {
+ if(!tmp_target->IsInRaidWith(caster))
+ tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid);
+ }
+ else if( m_areaAuraType == AREA_AURA_PET || m_areaAuraType == AREA_AURA_OWNER )
+ {
+ if( tmp_target->GetGUID() != caster->GetCharmerOrOwnerGUID() )
+ tmp_target->RemoveAurasDueToSpell(tmp_spellId, tmp_guid);
+ }
}
}
}
-void PersistentAreaAura::Update(uint32 diff)
+void PersistentAreaAuraEffect::Update(uint32 diff)
{
bool remove = false;
@@ -773,19 +846,20 @@ void PersistentAreaAura::Update(uint32 diff)
remove = true;
Unit *tmp_target = m_target;
- uint32 tmp_id = GetId(), tmp_index = GetEffIndex();
+ uint32 tmp_id = GetId();
+ uint64 tmp_guid = GetCasterGUID();
// WARNING: the aura may get deleted during the update
// DO NOT access its members after update!
- Aura::Update(diff);
+ AuraEffect::Update(diff);
if(remove)
- tmp_target->RemoveAura(tmp_id, tmp_index);
+ tmp_target->RemoveAurasDueToSpell(tmp_id, tmp_guid);
}
-void Aura::ApplyModifier(bool apply, bool Real)
+void AuraEffect::ApplyModifier(bool apply, bool Real)
{
- AuraType aura = m_modifier.m_auraname;
+ AuraType aura = m_auraName;
m_in_use = true;
if(aura<TOTAL_AURAS)
@@ -793,6 +867,74 @@ void Aura::ApplyModifier(bool apply, bool Real)
m_in_use = false;
}
+void AuraEffect::CleanupTriggeredSpells()
+{
+ uint32 tSpellId = m_spellProto->EffectTriggerSpell[GetEffIndex()];
+ if(!tSpellId)
+ return;
+
+ SpellEntry const* tProto = sSpellStore.LookupEntry(tSpellId);
+ if(!tProto)
+ return;
+
+ if(GetSpellDuration(tProto) != -1)
+ return;
+
+ // needed for spell 43680, maybe others
+ // TODO: is there a spell flag, which can solve this in a more sophisticated way?
+ if(m_spellProto->EffectApplyAuraName[GetEffIndex()] == SPELL_AURA_PERIODIC_TRIGGER_SPELL &&
+ GetSpellDuration(m_spellProto) == m_spellProto->EffectAmplitude[GetEffIndex()])
+ return;
+
+ m_target->RemoveAurasDueToSpell(tSpellId, GetCasterGUID());
+}
+
+void Aura::ApplyAllModifiers(bool apply, bool Real)
+{
+ for (uint8 i = 0; i<MAX_SPELL_EFFECTS;++i)
+ if (m_partAuras[i])
+ m_partAuras[i]->ApplyModifier(apply, Real);
+}
+
+void Aura::SendAuraUpdate()
+{
+ if (m_auraSlot>=MAX_AURAS)
+ return;
+ WorldPacket data(SMSG_AURA_UPDATE);
+
+ data.append(m_target->GetPackGUID());
+ data << uint8(m_auraSlot);
+
+ if(!m_target->GetVisibleAura(m_auraSlot))
+ {
+ data << uint32(0);
+ sLog.outDebug("Aura %u removed slot %u",GetId(), m_auraSlot);
+ m_target->SendMessageToSet(&data, true);
+ return;
+ }
+
+ data << uint32(GetId());
+ data << uint8(m_auraFlags);
+ data << uint8(m_auraLevel);
+ data << uint8(m_stackAmount ? m_stackAmount : m_procCharges);
+
+ if(!(m_auraFlags & AFLAG_CASTER))
+ {
+ if (Unit * caster = GetCaster())
+ data.append(caster->GetPackGUID());
+ else
+ data << uint8(0);
+ }
+
+ if(m_auraFlags & AFLAG_DURATION)
+ {
+ data << uint32(m_maxduration);
+ data << uint32(m_duration);
+ }
+
+ m_target->SendMessageToSet(&data, true);
+}
+
void Aura::_AddAura()
{
if (!GetId())
@@ -814,46 +956,27 @@ void Aura::_AddAura()
// passive auras (except totem auras) do not get placed in the slots
// area auras with SPELL_AURA_NONE are not shown on target
- // all further code applies only to active spells
- if(!(((m_spellProto->Attributes & 0x80 && GetTalentSpellPos(GetId())) || !m_isPassive || (caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem())) &&
- (m_spellProto->Effect[GetEffIndex()] != SPELL_EFFECT_APPLY_AREA_AURA_ENEMY || m_target != caster)))
- return;
-
- // Second aura if some spell
- bool secondaura = false;
- // Try find slot for aura
- uint8 slot = MAX_AURAS;
- // Lookup for auras already applied from spell
- for(uint8 i = 0; i < 3; ++i)
- {
- Unit::spellEffectPair spair = Unit::spellEffectPair(GetId(), i);
- for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr)
+ if((m_spellProto->Attributes & 0x80 && GetTalentSpellPos(GetId())) || !m_isPassive || (caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem())
+ && (!IsAreaAura()
+ || m_target!=caster ||
+ (m_spellProto->Effect[0]!=SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
+ && m_spellProto->Effect[1]!=SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
+ && m_spellProto->Effect[2]!=SPELL_EFFECT_APPLY_AREA_AURA_ENEMY)))
+ {
+ // Try find slot for aura
+ uint8 slot = MAX_AURAS;
+ // Lookup for auras already applied from spell
+ if (Aura * foundAura = m_target->GetAura(GetId(), GetCasterGUID()))
{
// allow use single slot only by auras from same caster
- if(itr->second->GetCasterGUID()==GetCasterGUID())
- {
- slot = itr->second->GetAuraSlot();
- secondaura = true;
- break;
- }
+ slot = foundAura->GetAuraSlot();
}
- if (secondaura)
- break;
- }
-
- // Register Visible Aura
- AuraSlotEntry *entry = NULL;
- if(slot < MAX_AURAS)
- entry = m_target->GetVisibleAura(slot);
- else
- {
- Unit::VisibleAuraMap const *visibleAuras = m_target->GetVisibleAuras();
- if(visibleAuras->size() < MAX_AURAS)
+ else
{
- // Even if this is the second aura and slot == MAX_AURAS,
- // it is still possible that a free slot can be founded
- Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin();
- for(int freeSlot = 0; freeSlot < MAX_AURAS; ++itr, ++freeSlot)
+ Unit::VisibleAuraMap const * visibleAuras= m_target->GetVisibleAuras();
+ // lookup for free slots in units visibleAuras
+ Unit::VisibleAuraMap::const_iterator itr = visibleAuras->find(0);
+ for(uint32 freeSlot = 0; freeSlot < MAX_AURAS; ++itr , ++freeSlot)
{
if(itr == visibleAuras->end() || itr->first != freeSlot)
{
@@ -861,56 +984,43 @@ void Aura::_AddAura()
break;
}
}
+ }
- assert(slot < MAX_AURAS); // assert that we find a slot and it is valid
- entry = m_target->GetVisibleAuraSlot(slot);
-
- entry->m_Flags = (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE) |
+ // Register Visible Aura
+ if(slot < MAX_AURAS)
+ {
+ m_auraFlags |= (IsPositive() ? AFLAG_POSITIVE : AFLAG_NEGATIVE) |
(GetCasterGUID() == m_target->GetGUID() ? AFLAG_CASTER : AFLAG_NONE) |
(GetAuraMaxDuration() > 0 ? AFLAG_DURATION : AFLAG_NONE);
- entry->m_Level = (caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL));
- entry->m_spellId = GetId();
- //init pointers-prevent unexpected behaviour
- for(uint8 i = 0; i < 3; ++i)
- entry->m_slotAuras[i] = NULL;
+ m_auraLevel = (caster ? caster->getLevel() : sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL));
+ SetAuraSlot( slot );
+ m_target->SetVisibleAura(slot, this);
+ m_target->UpdateAuraForGroup(slot);
+ SendAuraUpdate();
+ sLog.outDebug("Aura: %u Effect: %d put to unit visible auras slot: %u",GetId(), GetEffectMask(), slot);
}
+ else
+ sLog.outDebug("Aura: %u Effect: %d could not find empty unit visible slot",GetId(), GetEffectMask());
}
- if(entry)
- {
- entry->m_Flags |= (1 << GetEffIndex());
- entry->m_slotAuras[GetEffIndex()] = this;
+ // Sitdown on apply aura req seated
+ if (m_spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED && !m_target->IsSitState())
+ m_target->SetStandState(UNIT_STAND_STATE_SIT);
- SetAuraSlot( slot );
+ // register aura diminishing on apply
+ if (getDiminishGroup() != DIMINISHING_NONE )
+ m_target->ApplyDiminishingAura(getDiminishGroup(),true);
- // update for out of range group members (on 1 slot use)
- m_target->UpdateAuraForGroup(slot);
- sLog.outDebug("Aura: %u Effect: %d put to unit visible auras slot: %u",GetId(), GetEffIndex(), slot);
- }
- else
- sLog.outDebug("Aura: %u Effect: %d could not find empty unit visible slot",GetId(), GetEffIndex());
-
- if(!secondaura)
+ // Apply linked auras (On first aura apply)
+ uint32 id = GetId();
+ if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA)
{
- // Sitdown on apply aura req seated
- if (m_spellProto->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED && !m_target->IsSitState())
- m_target->SetStandState(UNIT_STAND_STATE_SIT);
-
- // register aura diminishing on apply
- if (getDiminishGroup() != DIMINISHING_NONE )
- m_target->ApplyDiminishingAura(getDiminishGroup(),true);
-
- // Apply linked auras (On first aura apply)
- uint32 id = GetId();
- if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA)
- {
- if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA))
- for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
- if(*itr < 0)
- m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), m_target);
- else if(Unit* caster = GetCaster())
- m_target->AddAura(*itr, m_target);
- }
+ if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA))
+ for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
+ if(*itr < 0)
+ m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), m_target);
+ else if(Unit* caster = GetCaster())
+ m_target->AddAura(*itr, m_target);
}
//*****************************************************
@@ -945,93 +1055,93 @@ void Aura::_AddAura()
if(m_spellProto->Dispel == DISPEL_ENRAGE)
SetAuraState(AURA_STATE_ENRAGE);
+ if(GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST)
+ {
+ for (uint8 i = 0;i<MAX_SPELL_EFFECTS;++i)
+ {
+ if (m_spellProto->EffectApplyAuraName[i]==SPELL_AURA_MOD_STUN
+ || m_spellProto->EffectApplyAuraName[i]==SPELL_AURA_MOD_ROOT)
+ {
+ SetAuraState(AURA_STATE_FROZEN);
+ break;
+ }
+ }
+ }
+
m_target->ApplyModFlag(UNIT_FIELD_AURASTATE, GetAuraStateMask(), true);
}
+bool Aura::SetPartAura(AuraEffect* aurEff, uint8 effIndex)
+{
+ if (m_auraFlags & 1<<effIndex)
+ return false;
+ m_auraFlags |= 1<<effIndex;
+ m_partAuras[effIndex]=aurEff;
+ m_target->HandleAuraEffect(aurEff, true);
+ SendAuraUpdate();
+ return true;
+}
+
void Aura::_RemoveAura()
{
Unit* caster = GetCaster();
- if(caster && IsPersistent())
- {
- DynamicObject *dynObj = caster->GetDynObject(GetId(), GetEffIndex());
- if (dynObj)
- dynObj->RemoveAffected(m_target);
- }
-
//passive auras do not get put in slots
// Note: but totem can be not accessible for aura target in time remove (to far for find in grid)
//if(m_isPassive && !(caster && caster->GetTypeId() == TYPEID_UNIT && ((Creature*)caster)->isTotem()))
// return;
uint8 slot = GetAuraSlot();
- if(slot < MAX_AURAS) // slot not set
- {
- if (AuraSlotEntry *entry = m_target->GetVisibleAura(slot))
- {
- // we have more auras, do not clear slot
- if (entry->m_slotAuras[GetEffIndex()]==this)
- {
- entry->m_slotAuras[GetEffIndex()]=NULL; //unregister aura
- }
- }
- }
- bool lastaura=true;
- for(uint8 i = 0; i < 3; i++)
+ if (Aura * foundAura = m_target->GetAura(GetId(), GetCasterGUID()))
{
- Unit::spellEffectPair spair = Unit::spellEffectPair(GetId(), i);
- for(Unit::AuraMap::const_iterator itr = m_target->GetAuras().lower_bound(spair); itr != m_target->GetAuras().upper_bound(spair); ++itr)
- {
- if(itr->second->GetCasterGUID()==GetCasterGUID())
+ // allow use single slot only by auras from same caster
+ slot = foundAura->GetAuraSlot();
+ if(slot < MAX_AURAS) // slot not set
+ if (Aura *entry = m_target->GetVisibleAura(slot))
{
- lastaura = false;
- break;
+ // set not valid slot for aura - prevent removing other visible aura
+ slot = MAX_AURAS;
}
- }
- if(!lastaura)
- break;
}
- if (lastaura)
+ // update for out of range group members
+ if (slot < MAX_AURAS)
{
- // update for out of range group members
- if (slot < MAX_AURAS)
- m_target->UpdateAuraForGroup(slot);
+ m_target->RemoveVisibleAura(slot);
+ m_target->UpdateAuraForGroup(slot);
+ SendAuraUpdate();
+ }
- // unregister aura diminishing (and store last time)
- if (getDiminishGroup() != DIMINISHING_NONE )
- m_target->ApplyDiminishingAura(getDiminishGroup(),false);
+ // unregister aura diminishing (and store last time)
+ if (getDiminishGroup() != DIMINISHING_NONE )
+ m_target->ApplyDiminishingAura(getDiminishGroup(),false);
- // Check needed only if aura applies aurastate
- if(GetAuraStateMask())
- {
- uint32 foundMask = 0;
- Unit::AuraMap& Auras = m_target->GetAuras();
- // Get mask of all aurastates from remaining auras
- for(Unit::AuraMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
- {
- foundMask|=(*i).second->GetAuraStateMask();
- }
- // Remove only aurastates which were not found
- foundMask = GetAuraStateMask() &~foundMask;
- if (foundMask)
- m_target->ApplyModFlag(UNIT_FIELD_AURASTATE, foundMask, false);
- }
-
- // reset cooldown state for spells
- if(caster && caster->GetTypeId() == TYPEID_PLAYER)
+ // Check needed only if aura applies aurastate
+ if(GetAuraStateMask())
+ {
+ uint32 foundMask = 0;
+ Unit::AuraMap& Auras = m_target->GetAuras();
+ // Get mask of all aurastates from remaining auras
+ for(Unit::AuraMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
{
- if ( GetSpellProto()->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE )
- // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
- ((Player*)caster)->SendCooldownEvent(GetSpellProto());
+ foundMask|=(*i).second->GetAuraStateMask();
}
+ // Remove only aurastates which were not found
+ foundMask = GetAuraStateMask() &~foundMask;
+ if (foundMask)
+ m_target->ApplyModFlag(UNIT_FIELD_AURASTATE, foundMask, false);
+ }
- // not cancel, overkill
- // do not proc anything if aura is cancelled
- if(m_removeMode == AURA_REMOVE_BY_DELETE)
- return;
-
+ // reset cooldown state for spells
+ if(caster && caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ if ( GetSpellProto()->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE )
+ // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
+ ((Player*)caster)->SendCooldownEvent(GetSpellProto());
+ }
+ if (m_removeMode==AURA_REMOVE_BY_EXPIRE)
+ {
// Remove Linked Auras (on last aura remove)
uint32 id = GetId();
if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_REMOVE)
@@ -1052,28 +1162,29 @@ void Aura::_RemoveAura()
else
m_target->RemoveAurasDueToSpell(*itr);
}
- // Proc on aura remove (only spell flags for now)
- if (caster)
+ }
+ // Proc on aura remove (only spell flags for now)
+ if (caster)
+ {
+ uint32 ProcCaster, ProcVictim;
+ if (IsPositiveSpell(GetId()))
{
- uint32 ProcCaster, ProcVictim;
- if (IsPositiveSpell(GetId()))
- {
- ProcCaster = PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL;
- ProcVictim = PROC_FLAG_TAKEN_POSITIVE_SPELL;
- }
- else
- {
- ProcCaster = PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT;
- ProcVictim = PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT;
- }
- uint32 procEx=0;
- if (m_removeMode == AURA_REMOVE_BY_ENEMY_SPELL)
- procEx = PROC_EX_AURA_REMOVE_DESTROY;
- else if (m_removeMode == AURA_REMOVE_BY_DEFAULT || m_removeMode == AURA_REMOVE_BY_CANCEL)
- procEx = PROC_EX_AURA_REMOVE_EXPIRE;
-
- caster->ProcDamageAndSpell(m_target,ProcCaster, ProcVictim, procEx, m_modifier.m_amount, BASE_ATTACK, m_spellProto);
+ ProcCaster = PROC_FLAG_SUCCESSFUL_POSITIVE_SPELL;
+ ProcVictim = PROC_FLAG_TAKEN_POSITIVE_SPELL;
}
+ else
+ {
+ ProcCaster = PROC_FLAG_SUCCESSFUL_NEGATIVE_SPELL_HIT;
+ ProcVictim = PROC_FLAG_TAKEN_NEGATIVE_SPELL_HIT;
+ }
+ uint32 procEx=0;
+ if (m_removeMode == AURA_REMOVE_BY_ENEMY_SPELL)
+ procEx = PROC_EX_AURA_REMOVE_DESTROY;
+ else if (m_removeMode == AURA_REMOVE_BY_EXPIRE || m_removeMode == AURA_REMOVE_BY_CANCEL)
+ procEx = PROC_EX_AURA_REMOVE_EXPIRE;
+ else return;
+
+ caster->ProcDamageAndSpell(m_target,ProcCaster, ProcVictim, procEx, m_procDamage, BASE_ATTACK, m_spellProto);
}
}
@@ -1086,25 +1197,25 @@ void Aura::SetStackAmount(uint8 stackAmount)
if (!target || !caster)
return;
m_stackAmount = stackAmount;
- int32 amount = m_stackAmount * caster->CalculateSpellDamage(m_spellProto, m_effIndex, m_currentBasePoints, target);
- // Reapply if amount change
- if (amount!=m_modifier.m_amount)
+ for (uint8 i=0;i<MAX_SPELL_EFFECTS;++i)
{
- ApplyModifier(false);
- m_modifier.m_amount = amount;
- ApplyModifier(true);
+ if (AuraEffect * part = GetPartAura(i))
+ {
+ int32 amount = m_stackAmount * caster->CalculateSpellDamage(m_spellProto, part->GetEffIndex(), part->GetBasePoints(), target);
+ // Reapply if amount change
+ if (amount!=part->GetAmount())
+ {
+ // Auras which are applying spellmod should have removed spellmods for real
+ part->ApplyModifier(false, bool (part->m_spellmod));
+ part->SetAmount(amount);
+ part->ApplyModifier(true, bool (part->m_spellmod));
+ }
+ }
}
}
RefreshAura();
}
-void Aura::InitStackAmount(uint8 stackAmount)
-{
- m_stackAmount = stackAmount;
- Modifier* mod = GetModifier();
- mod->m_amount*=m_stackAmount;
-}
-
bool Aura::modStackAmount(int32 num)
{
// Can`t mod
@@ -1126,14 +1237,238 @@ bool Aura::modStackAmount(int32 num)
return false;
}
-void Aura::RefreshAura()
+void Aura::SetAuraDuration(int32 duration)
{
- m_duration = m_maxduration;
- // update for out of range group members (on 1 slot use)
- m_target->UpdateAuraForGroup(GetAuraSlot());
+ m_duration = duration;
+ //if (duration<0)
+ //m_permanent=true;
+ // else
+ //m_permanent=false;
+ SendAuraUpdate();
+}
+
+void Aura::SetAuraCharges(uint8 charges)
+{
+ if (m_procCharges == charges)
+ return;
+ m_procCharges = charges;
+ SendAuraUpdate();
+}
+
+bool Aura::DropAuraCharge()
+{
+ if (m_procCharges == 0)
+ return false;
+ m_procCharges--;
+ SendAuraUpdate();
+ // return true if last charge dropped
+ return m_procCharges == 0;
+}
+
+bool Aura::IsInUse() const
+{
+ for (uint8 i=0; i<MAX_SPELL_EFFECTS;++i)
+ {
+ if (m_partAuras[i])
+ {
+ if (m_partAuras[i]->IsInUse())
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Aura::IsPersistent() const
+{
+ for (uint8 i=0; i<MAX_SPELL_EFFECTS;++i)
+ {
+ if (m_partAuras[i])
+ {
+ if (m_partAuras[i]->IsPersistent())
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Aura::IsAreaAura() const
+{
+ for (uint8 i=0; i<MAX_SPELL_EFFECTS;++i)
+ {
+ if (m_partAuras[i])
+ {
+ if (m_partAuras[i]->IsAreaAura())
+ return true;
+ }
+ }
+ return false;
+}
+
+bool Aura::IsAuraType(AuraType type) const
+{
+ for (uint8 i=0; i<MAX_SPELL_EFFECTS;++i)
+ {
+ if (m_partAuras[i])
+ {
+ if (m_partAuras[i]->GetAuraName()==type)
+ return true;
+ }
+ }
+ return false;
+}
+
+void Aura::SetLoadedState(uint64 caster_guid,int32 maxduration,int32 duration,int32 charges, uint8 stackamount, int32 * amount)
+{
+ m_caster_guid = caster_guid;
+ m_maxduration = maxduration;
+ m_duration = duration;
+ m_procCharges = charges;
+ m_stackAmount = stackamount;
+ for (uint8 i=0; i<MAX_SPELL_EFFECTS;++i)
+ if (m_partAuras[i])
+ m_partAuras[i]->SetAmount(amount[0]+i);
+}
+
+void AuraEffect::HandleShapeshiftBoosts(bool apply)
+{
+ uint32 spellId = 0;
+ uint32 spellId2 = 0;
+ uint32 HotWSpellId = 0;
+
+ switch(GetMiscValue())
+ {
+ case FORM_CAT:
+ spellId = 3025;
+ HotWSpellId = 24900;
+ break;
+ case FORM_TREE:
+ spellId = 5420;
+ spellId2 = 34123;
+ break;
+ case FORM_TRAVEL:
+ spellId = 5419;
+ break;
+ case FORM_AQUA:
+ spellId = 5421;
+ break;
+ case FORM_BEAR:
+ spellId = 1178;
+ spellId2 = 21178;
+ HotWSpellId = 24899;
+ break;
+ case FORM_DIREBEAR:
+ spellId = 9635;
+ spellId2 = 21178;
+ HotWSpellId = 24899;
+ break;
+ case FORM_BATTLESTANCE:
+ spellId = 21156;
+ break;
+ case FORM_DEFENSIVESTANCE:
+ spellId = 7376;
+ break;
+ case FORM_BERSERKERSTANCE:
+ spellId = 7381;
+ break;
+ case FORM_MOONKIN:
+ spellId = 24905;
+ // aura from effect trigger spell
+ spellId2 = 24907;
+ break;
+ case FORM_FLIGHT:
+ spellId = 33948;
+ spellId2 = 34764;
+ break;
+ case FORM_FLIGHT_EPIC:
+ spellId = 40122;
+ spellId2 = 40121;
+ break;
+ case FORM_METAMORPHOSIS:
+ spellId = 54817;
+ spellId2 = 54879;
+ break;
+ case FORM_SPIRITOFREDEMPTION:
+ spellId = 27792;
+ spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
+ break;
+ case FORM_GHOSTWOLF:
+ case FORM_AMBIENT:
+ case FORM_GHOUL:
+ case FORM_SHADOW:
+ case FORM_STEALTH:
+ case FORM_CREATURECAT:
+ case FORM_CREATUREBEAR:
+ spellId = 0;
+ break;
+ }
+
+ uint32 form = GetMiscValue()-1;
+
+ if(apply)
+ {
+ if (spellId) m_target->CastSpell(m_target, spellId, true, NULL, this );
+ if (spellId2) m_target->CastSpell(m_target, spellId2, true, NULL, this);
+
+ if(m_target->GetTypeId() == TYPEID_PLAYER)
+ {
+ const PlayerSpellMap& sp_list = ((Player *)m_target)->GetSpellMap();
+ for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
+ {
+ if(itr->second->state == PLAYERSPELL_REMOVED) continue;
+ if(itr->first==spellId || itr->first==spellId2) continue;
+ SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
+ if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | (1<<7)))) continue;
+ if (spellInfo->Stances & (1<<form))
+ m_target->CastSpell(m_target, itr->first, true, NULL, this);
+ }
+ //LotP
+ if (((Player*)m_target)->HasSpell(17007))
+ {
+ SpellEntry const *spellInfo = sSpellStore.LookupEntry(24932);
+ if (spellInfo && spellInfo->Stances & (1<<form))
+ m_target->CastSpell(m_target, 24932, true, NULL, this);
+ }
+ // HotW
+ if (HotWSpellId)
+ {
+ Unit::AuraEffectList const& mModTotalStatPct = m_target->GetAurasByType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE);
+ for(Unit::AuraEffectList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i)
+ {
+ if ((*i)->GetSpellProto()->SpellIconID == 240 && (*i)->GetMiscValue() == 3)
+ {
+ int32 HotWMod = (*i)->GetAmount();
+ if(GetMiscValue() == FORM_CAT)
+ HotWMod /= 2;
+
+ m_target->CastCustomSpell(m_target, HotWSpellId, &HotWMod, NULL, NULL, true, NULL, this);
+ break;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ m_target->RemoveAurasDueToSpell(spellId);
+ m_target->RemoveAurasDueToSpell(spellId2);
+
+ Unit::AuraMap& tAuras = m_target->GetAuras();
+ for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
+ {
+ if (itr->second->IsRemovedOnShapeLost())
+ {
+ m_target->RemoveAurasDueToSpell(itr->second->GetId());
+ itr = tAuras.begin();
+ }
+ else
+ {
+ ++itr;
+ }
+ }
+ }
}
-bool Aura::isAffectedOnSpell(SpellEntry const *spell) const
+bool AuraEffect::isAffectedOnSpell(SpellEntry const *spell) const
{
if (!spell)
return false;
@@ -1149,12 +1484,12 @@ bool Aura::isAffectedOnSpell(SpellEntry const *spell) const
/*********************************************************/
/*** BASIC AURA FUNCTION ***/
/*********************************************************/
-void Aura::HandleAddModifier(bool apply, bool Real)
+void AuraEffect::HandleAddModifier(bool apply, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER || !Real)
return;
- if(m_modifier.m_miscvalue >= MAX_SPELLMOD)
+ if(GetMiscValue() >= MAX_SPELLMOD)
return;
if (apply)
@@ -1171,22 +1506,23 @@ void Aura::HandleAddModifier(bool apply, bool Real)
case 51124: // Killing Machine
case 54741: // Firestarter
case 57761: // Fireball!
- SetAuraCharges(1);
+ case 39805: // Lightning Overload
+ GetParentAura()->SetAuraCharges(1);
break;
}
SpellModifier *mod = new SpellModifier;
- mod->op = SpellModOp(m_modifier.m_miscvalue);
- mod->value = m_modifier.m_amount;
- mod->type = SpellModType(m_modifier.m_auraname); // SpellModType value == spell aura types
+ mod->op = SpellModOp(GetMiscValue());
+ mod->value = m_amount;
+ mod->type = SpellModType(m_auraName); // SpellModType value == spell aura types
mod->spellId = GetId();
flag96 const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex);
if (!spellAffect)
spellAffect = &m_spellProto->EffectSpellClassMask[m_effIndex];
mod->mask = *spellAffect;
- mod->charges = m_procCharges;
+ mod->charges = GetParentAura()->GetAuraCharges();
m_spellmod = mod;
}
@@ -1202,7 +1538,7 @@ void Aura::HandleAddModifier(bool apply, bool Real)
m_target->CastSpell(m_target,45471,true);
}
}
-void Aura::HandleAddTargetTrigger(bool apply, bool Real)
+void AuraEffect::HandleAddTargetTrigger(bool apply, bool Real)
{
// Use SpellModifier structure for check
// used only fields:
@@ -1226,7 +1562,7 @@ void Aura::HandleAddTargetTrigger(bool apply, bool Real)
}
}
-void Aura::TriggerSpell()
+void AuraEffect::TriggerSpell()
{
Unit* caster = GetCaster();
Unit* target = GetTriggerTarget();
@@ -1275,7 +1611,7 @@ void Aura::TriggerSpell()
}
// remove old enchanting before applying new
((Player*)caster)->ApplyEnchantment(item,TEMP_ENCHANTMENT_SLOT,false);
- item->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, m_modifier.periodictime+1000, 0);
+ item->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, m_amplitude+1000, 0);
// add new enchanting
((Player*)caster)->ApplyEnchantment(item,TEMP_ENCHANTMENT_SLOT,true);
return;
@@ -1663,13 +1999,13 @@ void Aura::TriggerSpell()
// Aura of Desire
case 41350:
{
- Unit::AuraList const& mMod = m_target->GetAurasByType(SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT);
- for(Unit::AuraList::const_iterator i = mMod.begin(); i != mMod.end(); ++i)
+ Unit::AuraEffectList const& mMod = m_target->GetAurasByType(SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT);
+ for(Unit::AuraEffectList::const_iterator i = mMod.begin(); i != mMod.end(); ++i)
{
if ((*i)->GetId() == 41350)
{
(*i)->ApplyModifier(false);
- (*i)->GetModifier()->m_amount -= 5;
+ (*i)->SetAmount((*i)->GetAmount()-5);
(*i)->ApplyModifier(true);
break;
}
@@ -1757,7 +2093,7 @@ void Aura::TriggerSpell()
case 22896:
case 26999:
{
- int32 LifePerRage = GetModifier()->m_amount;
+ int32 LifePerRage = GetAmount();
int32 lRage = m_target->GetPower(POWER_RAGE);
if(lRage > 100) // rage stored as rage*10
@@ -1873,22 +2209,22 @@ void Aura::TriggerSpell()
// 2) maybe aura must be replace by new with accumulative stat mods instead stacking
// prevent cast by triggered auras
- if(m_caster_guid == m_target->GetGUID())
+ if(GetCasterGUID() == m_target->GetGUID())
return;
// stop triggering after each affected stats lost > 90
int32 intellectLoss = 0;
int32 spiritLoss = 0;
- Unit::AuraList const& mModStat = m_target->GetAurasByType(SPELL_AURA_MOD_STAT);
- for(Unit::AuraList::const_iterator i = mModStat.begin(); i != mModStat.end(); ++i)
+ Unit::AuraEffectList const& mModStat = m_target->GetAurasByType(SPELL_AURA_MOD_STAT);
+ for(Unit::AuraEffectList::const_iterator i = mModStat.begin(); i != mModStat.end(); ++i)
{
if ((*i)->GetId() == 1010)
{
- switch((*i)->GetModifier()->m_miscvalue)
+ switch((*i)->GetMiscValue())
{
- case STAT_INTELLECT: intellectLoss += (*i)->GetModifier()->m_amount; break;
- case STAT_SPIRIT: spiritLoss += (*i)->GetModifier()->m_amount; break;
+ case STAT_INTELLECT: intellectLoss += (*i)->GetAmount(); break;
+ case STAT_SPIRIT: spiritLoss += (*i)->GetAmount(); break;
default: break;
}
}
@@ -1903,7 +2239,7 @@ void Aura::TriggerSpell()
// Mana Tide
case 16191:
{
- caster->CastCustomSpell(target, trigger_spell_id, &m_modifier.m_amount, NULL, NULL, true, NULL, this);
+ caster->CastCustomSpell(target, trigger_spell_id, &m_amount, NULL, NULL, true, NULL, this);
return;
}
}
@@ -1916,16 +2252,16 @@ void Aura::TriggerSpell()
m_target->CastSpell(target, triggeredSpellInfo, true, 0, this, GetCasterGUID());
}
else if(target->GetTypeId()!=TYPEID_UNIT || !Script->EffectDummyCreature(caster, GetId(), GetEffIndex(), (Creature*)target))
- sLog.outError("Aura::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
+ sLog.outError("AuraEffect::TriggerSpell: Spell %u have 0 in EffectTriggered[%d], not handled custom case?",GetId(),GetEffIndex());
}
-Unit* Aura::GetTriggerTarget() const
+Unit* AuraEffect::GetTriggerTarget() const
{
Unit* target = ObjectAccessor::GetUnit(*m_target, m_target->GetUInt64Value(UNIT_FIELD_TARGET));
return target ? target : m_target;
}
-void Aura::TriggerSpellWithValue()
+void AuraEffect::TriggerSpellWithValue()
{
Unit* caster = GetCaster();
Unit* target = GetTriggerTarget();
@@ -1935,7 +2271,7 @@ void Aura::TriggerSpellWithValue()
// generic casting code with custom spells and target/caster customs
uint32 trigger_spell_id = GetSpellProto()->EffectTriggerSpell[m_effIndex];
- int32 basepoints0 = this->GetModifier()->m_amount;
+ int32 basepoints0 = this->GetAmount();
caster->CastCustomSpell(target, trigger_spell_id, &basepoints0, 0, 0, true, 0, this);
}
@@ -1944,7 +2280,7 @@ void Aura::TriggerSpellWithValue()
/*** AURA EFFECTS ***/
/*********************************************************/
-void Aura::HandleAuraDummy(bool apply, bool Real)
+void AuraEffect::HandleAuraDummy(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -1976,8 +2312,8 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
m_target->CastSpell(m_target,34027,true,NULL,this);
// set 3 stacks and 3 charges (to make all auras not disappear at once)
- Aura* owner_aura = m_target->GetAura(34027,0);
- Aura* pet_aura = pet->GetAura(58914,0);
+ Aura* owner_aura = m_target->GetAura(34027,GetCasterGUID());
+ Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
if( owner_aura )
{
owner_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount);
@@ -1993,12 +2329,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
{
m_target->CastSpell(m_target,55166,true,NULL,this);
// set 3 stacks and 3 charges (to make all auras not disappear at once)
- Aura* owner_aura = m_target->GetAura(55166,0);
+ Aura* owner_aura = m_target->GetAura(55166,GetCasterGUID());
if( owner_aura )
{
// This aura lasts 2 sec, need this hack to properly proc spells
// TODO: drop aura charges for ApplySpellMod in ProcDamageAndSpell
- SetAuraDuration(owner_aura->GetAuraDuration());
+ GetParentAura()->SetAuraDuration(owner_aura->GetAuraDuration());
// Make aura be not charged-this prevents removing charge on not crit spells
owner_aura->SetAuraCharges(0);
owner_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount);
@@ -2039,7 +2375,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
{
// prevent double apply bonuses
if(m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
- m_modifier.m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE);
+ m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_amount, SPELL_DIRECT_DAMAGE);
return;
}
//Druid, Survival Instincts
@@ -2048,7 +2384,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if(!m_target)
return;
- int32 bp0 = int32(m_target->GetMaxHealth() * m_modifier.m_amount / 100);
+ int32 bp0 = int32(m_target->GetMaxHealth() * m_amount / 100);
m_target->CastCustomSpell(m_target, 50322, &bp0, NULL, NULL, true);
}
}
@@ -2124,15 +2460,15 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// Living Bomb
if(m_spellProto->SpellFamilyFlags[1] & 0x20000)
{
- if(caster && (m_removeMode == AURA_REMOVE_BY_ENEMY_SPELL || m_removeMode == AURA_REMOVE_BY_DEFAULT))
- caster->CastSpell(m_target, GetModifier()->m_amount, true);
+ if(caster && (GetParentAura()->GetRemoveMode() == AURA_REMOVE_BY_ENEMY_SPELL || GetParentAura()->GetRemoveMode() == AURA_REMOVE_BY_DEATH || GetParentAura()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE))
+ caster->CastSpell(m_target, GetAmount(), true);
return;
}
// Focused Magic
if(m_spellProto->Id == 54646)
{
// only on remove by crit
- if(caster && m_removeMode == AURA_REMOVE_BY_DEFAULT && GetAuraDuration()>0)
+ if(caster && GetParentAura()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
caster->CastSpell(caster,54648, true);
return;
}
@@ -2222,7 +2558,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// Reduce backfire damage (dot damage) from Shadow Word: Death
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_DOT;
- mod->value = m_modifier.m_amount;
+ mod->value = m_amount;
mod->type = SPELLMOD_PCT;
mod->spellId = GetId();
mod->mask[1] = 0x00002000;
@@ -2246,7 +2582,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
{
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_DOT;
- mod->value = m_modifier.m_amount/7;
+ mod->value = m_amount/7;
mod->type = SPELLMOD_FLAT;
mod->spellId = GetId();
mod->mask[1] = 0x0010;
@@ -2264,7 +2600,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if (!m_target->IsInFeralForm())
return;
- int32 bp0 = int32(m_target->GetMaxHealth() * m_modifier.m_amount / 100);
+ int32 bp0 = int32(m_target->GetMaxHealth() * m_amount / 100);
m_target->CastCustomSpell(m_target, 50322, &bp0, NULL, NULL, true);
}
else
@@ -2281,17 +2617,17 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if ( caster )
// prevent double apply bonuses
if(m_target->GetTypeId()!=TYPEID_PLAYER || !((Player*)m_target)->GetSession()->PlayerLoading())
- m_modifier.m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE);
+ m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_amount, SPELL_DIRECT_DAMAGE);
}
else
{
// Final heal only on dispelled or duration end
- if (GetAuraDuration() > 0 && m_removeMode != AURA_REMOVE_BY_ENEMY_SPELL)
+ if (GetParentAura()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE && GetParentAura()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL)
return;
// final heal
if(m_target->IsInWorld())
- m_target->CastCustomSpell(m_target,33778,&m_modifier.m_amount,NULL,NULL,true,NULL,this,GetCasterGUID());
+ m_target->CastCustomSpell(m_target,33778,&m_amount,NULL,NULL,true,NULL,this,GetCasterGUID());
/*// have a look if there is still some other Lifebloom dummy aura
Unit::AuraList auras = m_target->GetAurasByType(SPELL_AURA_DUMMY);
@@ -2303,7 +2639,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// final heal
if(m_target->IsInWorld() && m_stackAmount > 0)
{
- int32 amount = m_modifier.m_amount / m_stackAmount;
+ int32 amount = m_amount / m_stackAmount;
m_target->CastCustomSpell(m_target,33778,&amount,NULL,NULL,true,NULL,this,GetCasterGUID());
}*/
}
@@ -2328,7 +2664,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// + effect value for Aspect of the Viper
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_EFFECT1;
- mod->value = m_modifier.m_amount;
+ mod->value = m_amount;
mod->type = SPELLMOD_FLAT;
mod->spellId = GetId();
mod->mask[1] = 0x40000;
@@ -2369,7 +2705,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
{
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_EFFECT1;
- mod->value = m_modifier.m_amount;
+ mod->value = m_amount;
mod->type = SPELLMOD_PCT;
mod->spellId = GetId();
switch (m_effIndex)
@@ -2436,7 +2772,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// some auras applied at aura apply
else if(itr->second->autocast)
{
- if( !m_target->HasAura(itr->second->spellId,0) )
+ if( !m_target->HasAuraEffect(itr->second->spellId,0) )
m_target->CastSpell(m_target,itr->second->spellId,true);
}
}
@@ -2444,7 +2780,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
}
}
-void Aura::HandleAuraMounted(bool apply, bool Real)
+void AuraEffect::HandleAuraMounted(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
@@ -2452,10 +2788,10 @@ void Aura::HandleAuraMounted(bool apply, bool Real)
if(apply)
{
- CreatureInfo const* ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue);
+ CreatureInfo const* ci = objmgr.GetCreatureTemplate(GetMiscValue());
if(!ci)
{
- sLog.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)", m_modifier.m_miscvalue);
+ sLog.outErrorDb("AuraMounted: `creature_template`='%u' not found in database (only need it modelid)",GetMiscValue());
return;
}
@@ -2476,7 +2812,7 @@ void Aura::HandleAuraMounted(bool apply, bool Real)
}
}
-void Aura::HandleAuraWaterWalk(bool apply, bool Real)
+void AuraEffect::HandleAuraWaterWalk(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
@@ -2492,7 +2828,7 @@ void Aura::HandleAuraWaterWalk(bool apply, bool Real)
m_target->SendMessageToSet(&data,true);
}
-void Aura::HandleAuraFeatherFall(bool apply, bool Real)
+void AuraEffect::HandleAuraFeatherFall(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
@@ -2508,7 +2844,7 @@ void Aura::HandleAuraFeatherFall(bool apply, bool Real)
m_target->SendMessageToSet(&data,true);
}
-void Aura::HandleAuraHover(bool apply, bool Real)
+void AuraEffect::HandleAuraHover(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
@@ -2524,21 +2860,21 @@ void Aura::HandleAuraHover(bool apply, bool Real)
m_target->SendMessageToSet(&data,true);
}
-void Aura::HandleWaterBreathing(bool apply, bool Real)
+void AuraEffect::HandleWaterBreathing(bool apply, bool Real)
{
// update timers in client
if(m_target->GetTypeId()==TYPEID_PLAYER)
((Player*)m_target)->UpdateMirrorTimers();
}
-void Aura::HandleAuraModShapeshift(bool apply, bool Real)
+void AuraEffect::HandleAuraModShapeshift(bool apply, bool Real)
{
if(!Real)
return;
uint32 modelid = 0;
Powers PowerType = POWER_MANA;
- ShapeshiftForm form = ShapeshiftForm(m_modifier.m_miscvalue);
+ ShapeshiftForm form = ShapeshiftForm(GetMiscValue());
switch(form)
{
case FORM_CAT:
@@ -2618,7 +2954,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
modelid = 16031;
break;
default:
- sLog.outError("Auras: Unknown Shapeshift Type: %u", m_modifier.m_miscvalue);
+ sLog.outError("Auras: Unknown Shapeshift Type: %u", GetMiscValue());
}
// remove polymorph before changing display id to keep new display id
@@ -2634,8 +2970,8 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
case FORM_FLIGHT:
case FORM_MOONKIN:
// remove movement affects
- m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT);
- m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_DECREASE_SPEED);
+ m_target->RemoveAurasByType(SPELL_AURA_MOD_ROOT);
+ m_target->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
// and polymorphic affects
if(m_target->IsPolymorphed())
@@ -2649,7 +2985,7 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
{
// remove other shapeshift before applying a new one
if(m_target->m_ShapeShiftFormSpellId)
- m_target->RemoveAurasDueToSpell(m_target->m_ShapeShiftFormSpellId,this);
+ m_target->RemoveAurasDueToSpell(m_target->m_ShapeShiftFormSpellId);
m_target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form);
@@ -2670,17 +3006,17 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
{
// get furor proc chance
uint32 FurorChance = 0;
- Unit::AuraList const& mDummy = m_target->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator i = mDummy.begin(); i != mDummy.end(); ++i)
+ Unit::AuraEffectList const& mDummy = m_target->GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator i = mDummy.begin(); i != mDummy.end(); ++i)
{
if ((*i)->GetSpellProto()->SpellIconID == 238)
{
- FurorChance = (*i)->GetModifier()->m_amount;
+ FurorChance = (*i)->GetAmount();
break;
}
}
- if (m_modifier.m_miscvalue == FORM_CAT)
+ if (GetMiscValue() == FORM_CAT)
{
m_target->SetPower(POWER_ENERGY,0);
if(urand(1,100) <= FurorChance)
@@ -2741,14 +3077,14 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
case FORM_DIREBEAR:
case FORM_CAT:
{
- if(Aura* dummy = m_target->GetDummyAura(37315) )
+ if(AuraEffect* dummy = m_target->GetDummyAura(37315) )
m_target->CastSpell(m_target,37316,true,NULL,dummy);
break;
}
// Nordrassil Regalia - bonus
case FORM_MOONKIN:
{
- if(Aura* dummy = m_target->GetDummyAura(37324) )
+ if(AuraEffect* dummy = m_target->GetDummyAura(37324) )
m_target->CastSpell(m_target,37325,true,NULL,dummy);
break;
}
@@ -2763,12 +3099,12 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
((Player*)m_target)->InitDataForForm();
}
-void Aura::HandleAuraTransform(bool apply, bool Real)
+void AuraEffect::HandleAuraTransform(bool apply, bool Real)
{
if (apply)
{
// special case (spell specific functionality)
- if(m_modifier.m_miscvalue==0)
+ if(GetMiscValue()==0)
{
// player applied only
if(m_target->GetTypeId()!=TYPEID_PLAYER)
@@ -2833,12 +3169,12 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
}
else
{
- CreatureInfo const * ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue);
+ CreatureInfo const * ci = objmgr.GetCreatureTemplate(GetMiscValue());
if(!ci)
{
//pig pink ^_^
m_target->SetDisplayId(16358);
- sLog.outError("Auras: unknown creature id = %d (only need its modelid) Form Spell Aura Transform in Spell ID = %d", m_modifier.m_miscvalue, GetId());
+ sLog.outError("Auras: unknown creature id = %d (only need its modelid) Form Spell Aura Transform in Spell ID = %d", GetMiscValue(), GetId());
}
else
{
@@ -2863,12 +3199,12 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
//dismount polymorphed target (after patch 2.4.2)
if (m_target->IsMounted())
- m_target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
+ m_target->RemoveAurasByType(SPELL_AURA_MOUNTED);
}
}
else
{
- Unit::AuraList const& otherTransforms = m_target->GetAurasByType(SPELL_AURA_TRANSFORM);
+ Unit::AuraEffectList const& otherTransforms = m_target->GetAurasByType(SPELL_AURA_TRANSFORM);
if(otherTransforms.empty())
{
m_target->SetDisplayId(m_target->GetNativeDisplayId());
@@ -2877,8 +3213,8 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
else
{
// look for other transform auras
- Aura* handledAura = *otherTransforms.begin();
- for(Unit::AuraList::const_iterator i = otherTransforms.begin();i != otherTransforms.end(); ++i)
+ AuraEffect* handledAura = *otherTransforms.begin();
+ for(Unit::AuraEffectList::const_iterator i = otherTransforms.begin();i != otherTransforms.end(); ++i)
{
// negative auras are preferred
if(!IsPositiveSpell((*i)->GetSpellProto()->Id))
@@ -2895,7 +3231,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
{
if(!m_target->GetAurasByType(SPELL_AURA_MOUNTED).empty())
{
- uint32 cr_id = m_target->GetAurasByType(SPELL_AURA_MOUNTED).front()->GetModifier()->m_miscvalue;
+ uint32 cr_id = m_target->GetAurasByType(SPELL_AURA_MOUNTED).front()->GetMiscValue();
if(CreatureInfo const* ci = objmgr.GetCreatureTemplate(cr_id))
{
uint32 team = 0;
@@ -2914,7 +3250,7 @@ void Aura::HandleAuraTransform(bool apply, bool Real)
}
}
-void Aura::HandleForceReaction(bool apply, bool Real)
+void AuraEffect::HandleForceReaction(bool apply, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -2924,32 +3260,32 @@ void Aura::HandleForceReaction(bool apply, bool Real)
Player* player = (Player*)m_target;
- uint32 faction_id = m_modifier.m_miscvalue;
- uint32 faction_rank = m_modifier.m_amount;
+ uint32 faction_id = GetMiscValue();
+ uint32 faction_rank = m_amount;
player->GetReputationMgr().ApplyForceReaction(faction_id,ReputationRank(faction_rank),apply);
player->GetReputationMgr().SendForceReactions();
}
-void Aura::HandleAuraModSkill(bool apply, bool Real)
+void AuraEffect::HandleAuraModSkill(bool apply, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
uint32 prot=GetSpellProto()->EffectMiscValue[m_effIndex];
- int32 points = m_modifier.m_amount;
+ int32 points = m_amount;
- ((Player*)m_target)->ModifySkillBonus(prot,(apply ? points: -points),m_modifier.m_auraname==SPELL_AURA_MOD_SKILL_TALENT);
+ ((Player*)m_target)->ModifySkillBonus(prot,(apply ? points: -points),m_auraName==SPELL_AURA_MOD_SKILL_TALENT);
if(prot == SKILL_DEFENSE)
((Player*)m_target)->UpdateDefenseBonusesMod();
}
-void Aura::HandleChannelDeathItem(bool apply, bool Real)
+void AuraEffect::HandleChannelDeathItem(bool apply, bool Real)
{
if(Real && !apply)
{
Unit* caster = GetCaster();
- Unit* victim = GetTarget();
+ Unit* victim = m_target;
if(!caster || caster->GetTypeId() != TYPEID_PLAYER || !victim)// || m_removeMode!=AURA_REMOVE_BY_DEATH)
return;
@@ -2958,7 +3294,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real)
if(victim->GetHealth() > 0)
return;
// Item amount
- if (m_modifier.m_amount <= 0)
+ if (m_amount <= 0)
return;
SpellEntry const *spellInfo = GetSpellProto();
@@ -2972,7 +3308,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real)
return;
//Adding items
uint32 noSpaceForCount = 0;
- uint32 count = m_modifier.m_amount;
+ uint32 count = m_amount;
ItemPosCountVec dest;
uint8 msg = ((Player*)caster)->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, spellInfo->EffectItemType[m_effIndex], count, &noSpaceForCount);
@@ -2989,7 +3325,7 @@ void Aura::HandleChannelDeathItem(bool apply, bool Real)
}
}
-void Aura::HandleBindSight(bool apply, bool Real)
+void AuraEffect::HandleBindSight(bool apply, bool Real)
{
Unit* caster = GetCaster();
if(!caster || caster->GetTypeId() != TYPEID_PLAYER)
@@ -2998,53 +3334,46 @@ void Aura::HandleBindSight(bool apply, bool Real)
((Player*)caster)->SetViewpoint(m_target, apply);
}
-void Aura::HandleFarSight(bool apply, bool Real)
+void AuraEffect::HandleFarSight(bool apply, bool Real)
{
//Handled by client
}
-void Aura::HandleAuraTrackCreatures(bool apply, bool Real)
+void AuraEffect::HandleAuraTrackCreatures(bool apply, bool Real)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
return;
- if(apply)
- m_target->RemoveNoStackAurasDueToAura(this);
- m_target->SetUInt32Value(PLAYER_TRACK_CREATURES, apply ? ((uint32)1)<<(m_modifier.m_miscvalue-1) : 0 );
+ m_target->SetUInt32Value(PLAYER_TRACK_CREATURES, apply ? ((uint32)1)<<(GetMiscValue()-1) : 0 );
}
-void Aura::HandleAuraTrackResources(bool apply, bool Real)
+void AuraEffect::HandleAuraTrackResources(bool apply, bool Real)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
return;
- if(apply)
- m_target->RemoveNoStackAurasDueToAura(this);
- m_target->SetUInt32Value(PLAYER_TRACK_RESOURCES, apply ? ((uint32)1)<<(m_modifier.m_miscvalue-1): 0 );
+ m_target->SetUInt32Value(PLAYER_TRACK_RESOURCES, apply ? ((uint32)1)<<(GetMiscValue()-1): 0 );
}
-void Aura::HandleAuraTrackStealthed(bool apply, bool Real)
+void AuraEffect::HandleAuraTrackStealthed(bool apply, bool Real)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
return;
- if(apply)
- m_target->RemoveNoStackAurasDueToAura(this);
-
m_target->ApplyModFlag(PLAYER_FIELD_BYTES,PLAYER_FIELD_BYTE_TRACK_STEALTHED,apply);
}
-void Aura::HandleAuraModScale(bool apply, bool Real)
+void AuraEffect::HandleAuraModScale(bool apply, bool Real)
{
- m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,m_modifier.m_amount,apply);
+ m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X,m_amount,apply);
}
-/*void Aura::HandleModPossess(bool apply, bool Real)
+/*void AuraEffect::HandleModPossess(bool apply, bool Real)
{
if(!Real)
return;
- if(m_target->getLevel() > m_modifier.m_amount)
+ if(m_target->getLevel() > m_amount)
return;
// not possess yourself
@@ -3126,7 +3455,7 @@ void Aura::HandleAuraModScale(bool apply, bool Real)
}
}
-void Aura::HandleModPossessPet(bool apply, bool Real)
+void AuraEffect::HandleModPossessPet(bool apply, bool Real)
{
if(!Real)
return;
@@ -3162,7 +3491,7 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
}
}*/
-void Aura::HandleAuraModPetTalentsPoints(bool Apply, bool Real)
+void AuraEffect::HandleAuraModPetTalentsPoints(bool Apply, bool Real)
{
if(!Real)
return;
@@ -3175,7 +3504,7 @@ void Aura::HandleAuraModPetTalentsPoints(bool Apply, bool Real)
pet->InitTalentForLevel();
}
-/*void Aura::HandleModCharm(bool apply, bool Real)
+/*void AuraEffect::HandleModCharm(bool apply, bool Real)
{
if(!Real)
return;
@@ -3188,7 +3517,7 @@ void Aura::HandleAuraModPetTalentsPoints(bool Apply, bool Real)
if(!caster)
return;
- if(int32(m_target->getLevel()) <= m_modifier.m_amount)
+ if(int32(m_target->getLevel()) <= m_amount)
{
if( apply )
{
@@ -3260,7 +3589,7 @@ void Aura::HandleAuraModPetTalentsPoints(bool Apply, bool Real)
if(m_target->GetCharmInfo())
m_target->GetCharmInfo()->SetPetNumber(0, true);
else
- sLog.outError("Aura::HandleModCharm: target="I64FMTD" with typeid=%d has a charm aura but no charm info!", m_target->GetGUID(), m_target->GetTypeId());
+ sLog.outError("AuraEffect::HandleModCharm: target="I64FMTD" with typeid=%d has a charm aura but no charm info!", m_target->GetGUID(), m_target->GetTypeId());
}
}
@@ -3283,7 +3612,7 @@ void Aura::HandleAuraModPetTalentsPoints(bool Apply, bool Real)
}
}*/
-void Aura::HandleModConfuse(bool apply, bool Real)
+void AuraEffect::HandleModConfuse(bool apply, bool Real)
{
if(!Real)
return;
@@ -3292,7 +3621,7 @@ void Aura::HandleModConfuse(bool apply, bool Real)
m_target->SetControlled(apply, UNIT_STAT_CONFUSED);
}
-void Aura::HandleModFear(bool apply, bool Real)
+void AuraEffect::HandleModFear(bool apply, bool Real)
{
if (!Real)
return;
@@ -3301,7 +3630,7 @@ void Aura::HandleModFear(bool apply, bool Real)
m_target->SetControlled(apply, UNIT_STAT_FLEEING);
}
-void Aura::HandleFeignDeath(bool apply, bool Real)
+void AuraEffect::HandleFeignDeath(bool apply, bool Real)
{
if(!Real)
return;
@@ -3348,7 +3677,7 @@ void Aura::HandleFeignDeath(bool apply, bool Real)
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
// prevent interrupt message
- if(m_caster_guid==m_target->GetGUID() && m_target->m_currentSpells[CURRENT_GENERIC_SPELL])
+ if(GetCasterGUID()==m_target->GetGUID() && m_target->m_currentSpells[CURRENT_GENERIC_SPELL])
m_target->m_currentSpells[CURRENT_GENERIC_SPELL]->finish();
m_target->InterruptNonMeleeSpells(true);
m_target->getHostilRefManager().deleteReferences();
@@ -3372,11 +3701,11 @@ void Aura::HandleFeignDeath(bool apply, bool Real)
}
}
-void Aura::HandleAuraModDisarm(bool apply, bool Real)
+void AuraEffect::HandleAuraModDisarm(bool apply, bool Real)
{
if (!Real)
return;
- AuraType type = GetModifier()->m_auraname;
+ AuraType type = AuraType(GetAuraName());
//Prevent handling aura twice
if(apply && m_target->GetAurasByType(type).size()>1)
@@ -3422,7 +3751,7 @@ void Aura::HandleAuraModDisarm(bool apply, bool Real)
m_target->UpdateDamagePhysical(attType);
}
-void Aura::HandleModStealth(bool apply, bool Real)
+void AuraEffect::HandleModStealth(bool apply, bool Real)
{
if(!Real)
return;
@@ -3451,11 +3780,11 @@ void Aura::HandleModStealth(bool apply, bool Real)
}
}
-void Aura::HandleInvisibility(bool apply, bool Real)
+void AuraEffect::HandleInvisibility(bool apply, bool Real)
{
if(apply)
{
- m_target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue);
+ m_target->m_invisibilityMask |= (1 << GetMiscValue());
if(Real)
{
@@ -3472,9 +3801,9 @@ void Aura::HandleInvisibility(bool apply, bool Real)
{
// recalculate value at modifier remove (current aura already removed)
m_target->m_invisibilityMask = 0;
- Unit::AuraList const& auras = m_target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY);
- for(Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
- m_target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue);
+ Unit::AuraEffectList const& auras = m_target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY);
+ for(Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
+ m_target->m_invisibilityMask |= (1 << GetMiscValue());
// only at real aura remove and if not have different invisibility auras.
if(Real)
@@ -3488,26 +3817,26 @@ void Aura::HandleInvisibility(bool apply, bool Real)
}
}
-void Aura::HandleInvisibilityDetect(bool apply, bool Real)
+void AuraEffect::HandleInvisibilityDetect(bool apply, bool Real)
{
if(apply)
{
- m_target->m_detectInvisibilityMask |= (1 << m_modifier.m_miscvalue);
+ m_target->m_detectInvisibilityMask |= (1 << GetMiscValue());
}
else
{
// recalculate value at modifier remove (current aura already removed)
m_target->m_detectInvisibilityMask = 0;
- Unit::AuraList const& auras = m_target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION);
- for(Unit::AuraList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
- m_target->m_detectInvisibilityMask |= (1 << m_modifier.m_miscvalue);
+ Unit::AuraEffectList const& auras = m_target->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION);
+ for(Unit::AuraEffectList::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
+ m_target->m_detectInvisibilityMask |= (1 << GetMiscValue());
}
if(Real && m_target->GetTypeId()==TYPEID_PLAYER)
//ObjectAccessor::UpdateVisibilityForPlayer((Player*)m_target);
m_target->SetToNotify();
}
-void Aura::HandleAuraModSilence(bool apply, bool Real)
+void AuraEffect::HandleAuraModSilence(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
@@ -3543,10 +3872,10 @@ void Aura::HandleAuraModSilence(bool apply, bool Real)
return;
// Search Mana Tap auras on caster
- Aura * dummy = caster->GetDummyAura(28734);
+ AuraEffect * dummy = caster->GetDummyAura(28734);
if (dummy)
{
- int32 bp = dummy->GetStackAmount() * 10;
+ int32 bp = dummy->GetParentAura()->GetStackAmount() * 10;
caster->CastCustomSpell(caster, 25048, &bp, NULL, NULL, true);
m_target->RemoveAurasDueToSpell(28734);
}
@@ -3563,7 +3892,7 @@ void Aura::HandleAuraModSilence(bool apply, bool Real)
}
}
-void Aura::HandleModThreat(bool apply, bool Real)
+void AuraEffect::HandleModThreat(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
@@ -3593,19 +3922,19 @@ void Aura::HandleModThreat(bool apply, bool Real)
break;
}
if (level_diff > 0)
- m_modifier.m_amount += multiplier * level_diff;
+ m_amount += multiplier * level_diff;
for(int8 x=0;x < MAX_SPELL_SCHOOL;x++)
{
- if(m_modifier.m_miscvalue & int32(1<<x))
+ if(GetMiscValue() & int32(1<<x))
{
if(m_target->GetTypeId() == TYPEID_PLAYER)
- ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_positive ? m_modifier.m_amount : -m_modifier.m_amount, apply);
+ ApplyPercentModFloatVar(m_target->m_threatModifier[x], GetParentAura()->IsPositive() ? m_amount : -m_amount, apply);
}
}
}
-void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
+void AuraEffect::HandleAuraModTotalThreat(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
@@ -3621,14 +3950,14 @@ void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
float threatMod = 0.0f;
if(apply)
- threatMod = float(m_modifier.m_amount);
+ threatMod = float(m_amount);
else
- threatMod = float(-m_modifier.m_amount);
+ threatMod = float(-m_amount);
m_target->getHostilRefManager().threatAssist(caster, threatMod);
}
-void Aura::HandleModTaunt(bool apply, bool Real)
+void AuraEffect::HandleModTaunt(bool apply, bool Real)
{
// only at real add/remove aura
if(!Real)
@@ -3654,7 +3983,7 @@ void Aura::HandleModTaunt(bool apply, bool Real)
/*********************************************************/
/*** MODIFY SPEED ***/
/*********************************************************/
-void Aura::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real)
{
// all applied/removed only at real aura add/remove
if(!Real)
@@ -3663,7 +3992,7 @@ void Aura::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real)
m_target->UpdateSpeed(MOVE_RUN, true);
}
-void Aura::HandleAuraModIncreaseMountedSpeed(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModIncreaseMountedSpeed(bool /*apply*/, bool Real)
{
// all applied/removed only at real aura add/remove
if(!Real)
@@ -3672,14 +4001,14 @@ void Aura::HandleAuraModIncreaseMountedSpeed(bool /*apply*/, bool Real)
m_target->UpdateSpeed(MOVE_RUN, true);
}
-void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real)
+void AuraEffect::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real)
{
// all applied/removed only at real aura add/remove
if(!Real)
return;
// Enable Fly mode for flying mounts
- if (m_modifier.m_auraname == SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED)
+ if (m_auraName == SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED)
{
WorldPacket data;
if(apply)
@@ -3695,14 +4024,14 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real)
m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,1<<MECHANIC_POLYMORPH,apply);
// Dragonmaw Illusion (overwrite mount model, mounted aura already applied)
- if( apply && m_target->HasAura(42016,0) && m_target->GetMountID())
+ if( apply && m_target->HasAuraEffect(42016,0) && m_target->GetMountID())
m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314);
}
m_target->UpdateSpeed(MOVE_FLIGHT, true);
}
-void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real)
{
// all applied/removed only at real aura add/remove
if(!Real)
@@ -3711,7 +4040,7 @@ void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real)
m_target->UpdateSpeed(MOVE_SWIM, true);
}
-void Aura::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real)
{
// all applied/removed only at real aura add/remove
if(!Real)
@@ -3722,7 +4051,7 @@ void Aura::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real)
m_target->UpdateSpeed(MOVE_FLIGHT, true);
}
-void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real)
{
// all applied/removed only at real aura add/remove
if(!Real)
@@ -3737,13 +4066,13 @@ void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real)
/*** IMMUNITY ***/
/*********************************************************/
-void Aura::HandleModMechanicImmunity(bool apply, bool Real)
+void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real)
{
uint32 mechanic;
if (GetSpellProto()->EffectApplyAuraName[GetEffIndex()]==SPELL_AURA_MECHANIC_IMMUNITY)
- mechanic = 1 << m_modifier.m_miscvalue;
+ mechanic = 1 << GetMiscValue();
else //SPELL_AURA_MECHANIC_IMMUNITY_MASK
- mechanic = m_modifier.m_miscvalue;
+ mechanic = GetMiscValue();
//immune movement impairment and loss of control
if(GetId()==42292 || GetId()==59752)
mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
@@ -3760,7 +4089,7 @@ void Aura::HandleModMechanicImmunity(bool apply, bool Real)
spell->Id != GetId())
{
//check for mechanic mask
- if(GetSpellMechanicMask(spell, iter->second->GetEffIndex()) & mechanic)
+ if(GetAllSpellMechanicMask(spell) & mechanic)
{
m_target->RemoveAurasDueToSpell(spell->Id);
if(Auras.empty())
@@ -3781,8 +4110,8 @@ void Aura::HandleModMechanicImmunity(bool apply, bool Real)
if ( Unit* owner = m_target->GetOwner() )
{
// Search talent
- Unit::AuraList const& m_dummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator i = m_dummyAuras.begin(); i != m_dummyAuras.end(); ++i)
+ Unit::AuraEffectList const& m_dummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator i = m_dummyAuras.begin(); i != m_dummyAuras.end(); ++i)
{
if ( (*i)->GetSpellProto()->SpellIconID == 2229 )
{
@@ -3828,7 +4157,7 @@ void Aura::HandleModMechanicImmunity(bool apply, bool Real)
}
//this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect
-void Aura::HandleAuraModEffectImmunity(bool apply, bool Real)
+void AuraEffect::HandleAuraModEffectImmunity(bool apply, bool Real)
{
// when removing flag aura, handle flag drop
if( !apply && m_target->GetTypeId() == TYPEID_PLAYER
@@ -3846,15 +4175,15 @@ void Aura::HandleAuraModEffectImmunity(bool apply, bool Real)
}
}
- m_target->ApplySpellImmune(GetId(),IMMUNITY_EFFECT,m_modifier.m_miscvalue,apply);
+ m_target->ApplySpellImmune(GetId(),IMMUNITY_EFFECT,GetMiscValue(),apply);
}
-void Aura::HandleAuraModStateImmunity(bool apply, bool Real)
+void AuraEffect::HandleAuraModStateImmunity(bool apply, bool Real)
{
if(apply && Real && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
{
- Unit::AuraList const& auraList = m_target->GetAurasByType(AuraType(m_modifier.m_miscvalue));
- for(Unit::AuraList::const_iterator itr = auraList.begin(); itr != auraList.end();)
+ Unit::AuraEffectList const& auraList = m_target->GetAurasByType(AuraType(GetMiscValue()));
+ for(Unit::AuraEffectList::const_iterator itr = auraList.begin(); itr != auraList.end();)
{
if (auraList.front() != this) // skip itself aura (it already added)
{
@@ -3866,15 +4195,15 @@ void Aura::HandleAuraModStateImmunity(bool apply, bool Real)
}
}
- m_target->ApplySpellImmune(GetId(),IMMUNITY_STATE,m_modifier.m_miscvalue,apply);
+ m_target->ApplySpellImmune(GetId(),IMMUNITY_STATE,GetMiscValue(),apply);
}
-void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real)
+void AuraEffect::HandleAuraModSchoolImmunity(bool apply, bool Real)
{
- if(apply && m_modifier.m_miscvalue == SPELL_SCHOOL_MASK_NORMAL)
+ if(apply && GetMiscValue() == SPELL_SCHOOL_MASK_NORMAL)
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
- m_target->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL,m_modifier.m_miscvalue,apply);
+ m_target->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL,GetMiscValue(),apply);
// remove all flag auras (they are positive, but they must be removed when you are immune)
if( this->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
@@ -3886,7 +4215,7 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real)
&& GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
&& IsPositiveSpell(GetId()) ) //Only positive immunity removes auras
{
- uint32 school_mask = m_modifier.m_miscvalue;
+ uint32 school_mask = GetMiscValue();
Unit::AuraMap& Auras = m_target->GetAuras();
for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next)
{
@@ -3915,21 +4244,21 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real)
}
}
-void Aura::HandleAuraModDmgImmunity(bool apply, bool Real)
+void AuraEffect::HandleAuraModDmgImmunity(bool apply, bool Real)
{
- m_target->ApplySpellImmune(GetId(),IMMUNITY_DAMAGE,m_modifier.m_miscvalue,apply);
+ m_target->ApplySpellImmune(GetId(),IMMUNITY_DAMAGE,GetMiscValue(),apply);
}
-void Aura::HandleAuraModDispelImmunity(bool apply, bool Real)
+void AuraEffect::HandleAuraModDispelImmunity(bool apply, bool Real)
{
// all applied/removed only at real aura add/remove
if(!Real)
return;
- m_target->ApplySpellDispelImmunity(m_spellProto, DispelType(m_modifier.m_miscvalue), apply);
+ m_target->ApplySpellDispelImmunity(m_spellProto, DispelType(GetMiscValue()), apply);
}
-void Aura::HandleAuraProcTriggerSpell(bool apply, bool Real)
+void AuraEffect::HandleAuraProcTriggerSpell(bool apply, bool Real)
{
if(!Real)
return;
@@ -3940,14 +4269,14 @@ void Aura::HandleAuraProcTriggerSpell(bool apply, bool Real)
switch (GetId())
{
case 28200: // Ascendance (Talisman of Ascendance trinket)
- SetAuraCharges(6);
+ GetParentAura()->SetAuraCharges(6);
break;
default: break;
}
}
}
-void Aura::HandleAuraModStalked(bool apply, bool Real)
+void AuraEffect::HandleAuraModStalked(bool apply, bool Real)
{
// used by spells: Hunter's Mark, Mind Vision, Syndicate Tracker (MURP) DND
if(apply)
@@ -3960,17 +4289,17 @@ void Aura::HandleAuraModStalked(bool apply, bool Real)
/*** PERIODIC ***/
/*********************************************************/
-void Aura::HandlePeriodicTriggerSpell(bool apply, bool Real)
+void AuraEffect::HandlePeriodicTriggerSpell(bool apply, bool Real)
{
m_isPeriodic = apply;
if (m_spellProto->Id == 66 && !apply)
{
- if (m_removeMode == AURA_REMOVE_BY_DEFAULT && m_duration<=0)
+ if (GetParentAura()->GetRemoveMode() && GetParentAura()->GetAuraDuration()<=0)
m_target->CastSpell(m_target, 32612, true, NULL, this);
}
}
-void Aura::HandlePeriodicTriggerSpellWithValue(bool apply, bool Real)
+void AuraEffect::HandlePeriodicTriggerSpellWithValue(bool apply, bool Real)
{
m_isPeriodic = apply;
@@ -3981,7 +4310,7 @@ void Aura::HandlePeriodicTriggerSpellWithValue(bool apply, bool Real)
}
}
-void Aura::HandlePeriodicEnergize(bool apply, bool Real)
+void AuraEffect::HandlePeriodicEnergize(bool apply, bool Real)
{
if (!Real)
return;
@@ -3991,15 +4320,15 @@ void Aura::HandlePeriodicEnergize(bool apply, bool Real)
// Replenishment (0.25% from max)
// Infinite Replenishment
if (m_spellProto->SpellIconID == 3184 && m_spellProto->SpellVisual[0] == 12495)
- m_modifier.m_amount = m_target->GetMaxPower(POWER_MANA) * 25 / 10000;
+ m_amount = m_target->GetMaxPower(POWER_MANA) * 25 / 10000;
}
-void Aura::HandleAuraPowerBurn(bool apply, bool Real)
+void AuraEffect::HandleAuraPowerBurn(bool apply, bool Real)
{
m_isPeriodic = apply;
}
-void Aura::HandleAuraPeriodicDummy(bool apply, bool Real)
+void AuraEffect::HandleAuraPeriodicDummy(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4017,7 +4346,7 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real)
{
// Explosive Shot
if (apply && !loading && caster)
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 16 / 100);
+ m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 16 / 100);
break;
}
}
@@ -4025,12 +4354,12 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real)
m_isPeriodic = apply;
}
-void Aura::HandlePeriodicHeal(bool apply, bool Real)
+void AuraEffect::HandlePeriodicHeal(bool apply, bool Real)
{
m_isPeriodic = apply;
}
-void Aura::HandlePeriodicDamage(bool apply, bool Real)
+void AuraEffect::HandlePeriodicDamage(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4057,7 +4386,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real)
if ( m_spellProto->SpellIconID == 147 && m_spellProto->SpellVisual[0] == 0 )
{
// $AP*0.18/6 bonus per tick
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 / 100);
+ m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 3 / 100);
return;
}
break;
@@ -4072,7 +4401,7 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real)
int32 mws = caster->GetAttackTime(BASE_ATTACK);
float mwb_min = caster->GetWeaponDamageRange(BASE_ATTACK,MINDAMAGE);
float mwb_max = caster->GetWeaponDamageRange(BASE_ATTACK,MAXDAMAGE);
- m_modifier.m_amount+=int32(((mwb_min+mwb_max)/2+ap*mws/14000)*0.2f);
+ m_amount+=int32(((mwb_min+mwb_max)/2+ap*mws/14000)*0.2f);
return;
}
break;
@@ -4083,14 +4412,14 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real)
if (m_spellProto->SpellFamilyFlags[0] & 0x1000)
{
// $AP*0.06 bonus per tick
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 6 / 100);
+ m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 6 / 100);
return;
}
// Lacerate
if (m_spellProto->SpellFamilyFlags[1] & 0x0000000100)
{
// $AP*0.05/5 bonus per tick
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100);
+ m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100);
return;
}
// Rip
@@ -4103,23 +4432,23 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real)
uint8 cp = ((Player*)caster)->GetComboPoints();
// Idol of Feral Shadows. Cant be handled as SpellMod in SpellAura:Dummy due its dependency from CPs
- Unit::AuraList const& dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
+ Unit::AuraEffectList const& dummyAuras = caster->GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
{
if((*itr)->GetId()==34241)
{
- m_modifier.m_amount += cp * (*itr)->GetModifier()->m_amount;
+ m_amount += cp * (*itr)->GetAmount();
break;
}
}
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100);
+ m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * cp / 100);
return;
}
// Lock Jaw
if (m_spellProto->SpellFamilyFlags[1] & 0x10000000)
{
// 0.15*$AP
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 15 / 100);
+ m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 15 / 100);
return;
}
break;
@@ -4139,21 +4468,21 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real)
float AP_per_combo[] = {0, 0.015f, 0.024, 0.03, 0.03428571, 0.0375};
uint8 cp = ((Player*)caster)->GetComboPoints();
if (cp > 5) cp = 5;
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]);
+ m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * AP_per_combo[cp]);
return;
}
// Garrote
if (m_spellProto->SpellFamilyFlags[0] & 0x100)
{
// $AP*0.07 bonus per tick
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 7 / 100);
+ m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 7 / 100);
return;
}
// Deadly Poison
if (m_spellProto->SpellFamilyFlags[0] & 0x10000)
{
// 0.08*$AP / 4 * amount of stack
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 2 * GetStackAmount() / 100);
+ m_amount += int32(caster->GetTotalAttackPowerValue(BASE_ATTACK) * 2 * GetParentAura()->GetStackAmount() / 100);
return;
}
break;
@@ -4164,14 +4493,14 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real)
if (m_spellProto->SpellFamilyFlags[0] & 0x4000)
{
// $RAP*0.1/5 bonus per tick
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500);
+ m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500);
return;
}
// Immolation Trap
if (m_spellProto->SpellFamilyFlags[0] & 0x4 && m_spellProto->SpellIconID == 678)
{
// $RAP*0.1/5 bonus per tick
- m_modifier.m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500);
+ m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 10 / 500);
return;
}
break;
@@ -4181,22 +4510,22 @@ void Aura::HandlePeriodicDamage(bool apply, bool Real)
}
}
-void Aura::HandlePeriodicDamagePCT(bool apply, bool Real)
+void AuraEffect::HandlePeriodicDamagePCT(bool apply, bool Real)
{
m_isPeriodic = apply;
}
-void Aura::HandlePeriodicLeech(bool apply, bool Real)
+void AuraEffect::HandlePeriodicLeech(bool apply, bool Real)
{
m_isPeriodic = apply;
}
-void Aura::HandlePeriodicManaLeech(bool apply, bool Real)
+void AuraEffect::HandlePeriodicManaLeech(bool apply, bool Real)
{
m_isPeriodic = apply;
}
-void Aura::HandlePeriodicHealthFunnel(bool apply, bool Real)
+void AuraEffect::HandlePeriodicHealthFunnel(bool apply, bool Real)
{
m_isPeriodic = apply;
}
@@ -4209,82 +4538,82 @@ void Aura::HandlePeriodicHealthFunnel(bool apply, bool Real)
/*** RESISTANCE ***/
/********************************/
-void Aura::HandleAuraModResistanceExclusive(bool apply, bool Real)
+void AuraEffect::HandleAuraModResistanceExclusive(bool apply, bool Real)
{
for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++)
{
- if(m_modifier.m_miscvalue & int32(1<<x))
+ if(GetMiscValue() & int32(1<<x))
{
- m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER)
- m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,m_modifier.m_amount, apply);
+ m_target->ApplyResistanceBuffModsMod(SpellSchools(x),GetParentAura()->IsPositive(),m_amount, apply);
}
}
}
-void Aura::HandleAuraModResistance(bool apply, bool Real)
+void AuraEffect::HandleAuraModResistance(bool apply, bool Real)
{
for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++)
{
- if(m_modifier.m_miscvalue & int32(1<<x))
+ if(GetMiscValue() & int32(1<<x))
{
- m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet())
- m_target->ApplyResistanceBuffModsMod(SpellSchools(x),m_positive,m_modifier.m_amount, apply);
+ m_target->ApplyResistanceBuffModsMod(SpellSchools(x),GetParentAura()->IsPositive(),m_amount, apply);
}
}
}
-void Aura::HandleAuraModBaseResistancePCT(bool apply, bool Real)
+void AuraEffect::HandleAuraModBaseResistancePCT(bool apply, bool Real)
{
// only players have base stats
if(m_target->GetTypeId() != TYPEID_PLAYER)
{
//pets only have base armor
- if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL))
- m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_modifier.m_amount), apply);
+ if(((Creature*)m_target)->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
+ m_target->HandleStatModifier(UNIT_MOD_ARMOR, BASE_PCT, float(m_amount), apply);
}
else
{
for(int8 x = SPELL_SCHOOL_NORMAL; x < MAX_SPELL_SCHOOL;x++)
{
- if(m_modifier.m_miscvalue & int32(1<<x))
- m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_modifier.m_amount), apply);
+ if(GetMiscValue() & int32(1<<x))
+ m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_PCT, float(m_amount), apply);
}
}
}
-void Aura::HandleModResistancePercent(bool apply, bool Real)
+void AuraEffect::HandleModResistancePercent(bool apply, bool Real)
{
for(int8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
{
- if(m_modifier.m_miscvalue & int32(1<<i))
+ if(GetMiscValue() & int32(1<<i))
{
- m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet())
{
- m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,m_modifier.m_amount, apply);
- m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,m_modifier.m_amount, apply);
+ m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),true,m_amount, apply);
+ m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i),false,m_amount, apply);
}
}
}
}
-void Aura::HandleModBaseResistance(bool apply, bool Real)
+void AuraEffect::HandleModBaseResistance(bool apply, bool Real)
{
// only players have base stats
if(m_target->GetTypeId() != TYPEID_PLAYER)
{
//only pets have base stats
- if(((Creature*)m_target)->isPet() && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL))
- m_target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ if(((Creature*)m_target)->isPet() && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
+ m_target->HandleStatModifier(UNIT_MOD_ARMOR, TOTAL_VALUE, float(m_amount), apply);
}
else
{
for(int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++)
- if(m_modifier.m_miscvalue & (1<<i))
- m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ if(GetMiscValue() & (1<<i))
+ m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(m_amount), apply);
}
}
@@ -4292,30 +4621,30 @@ void Aura::HandleModBaseResistance(bool apply, bool Real)
/*** STAT ***/
/********************************/
-void Aura::HandleAuraModStat(bool apply, bool Real)
+void AuraEffect::HandleAuraModStat(bool apply, bool Real)
{
- if (m_modifier.m_miscvalue < -2 || m_modifier.m_miscvalue > 4)
+ if (GetMiscValue() < -2 || GetMiscValue() > 4)
{
- sLog.outError("WARNING: Spell %u effect %u have unsupported misc value (%i) for SPELL_AURA_MOD_STAT ",GetId(),GetEffIndex(),m_modifier.m_miscvalue);
+ sLog.outError("WARNING: Spell %u effect %u have unsupported misc value (%i) for SPELL_AURA_MOD_STAT ",GetId(),GetEffIndex(),GetMiscValue());
return;
}
for(int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
{
// -1 or -2 is all stats ( misc < -2 checked in function beginning )
- if (m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue == i)
+ if (GetMiscValue() < 0 || GetMiscValue() == i)
{
- //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply);
- m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ //m_target->ApplyStatMod(Stats(i), m_amount,apply);
+ m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet())
- m_target->ApplyStatBuffMod(Stats(i),m_modifier.m_amount,apply);
+ m_target->ApplyStatBuffMod(Stats(i),m_amount,apply);
}
}
}
-void Aura::HandleModPercentStat(bool apply, bool Real)
+void AuraEffect::HandleModPercentStat(bool apply, bool Real)
{
- if (m_modifier.m_miscvalue < -1 || m_modifier.m_miscvalue > 4)
+ if (GetMiscValue() < -1 || GetMiscValue() > 4)
{
sLog.outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
return;
@@ -4327,12 +4656,12 @@ void Aura::HandleModPercentStat(bool apply, bool Real)
for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
- if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1)
- m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_modifier.m_amount), apply);
+ if(GetMiscValue() == i || GetMiscValue() == -1)
+ m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), BASE_PCT, float(m_amount), apply);
}
}
-void Aura::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool Real)
+void AuraEffect::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -4343,7 +4672,7 @@ void Aura::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool Real)
((Player*)m_target)->UpdateSpellDamageAndHealingBonus();
}
-void Aura::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool Real)
+void AuraEffect::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -4352,7 +4681,7 @@ void Aura::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool Real)
((Player*)m_target)->UpdateSpellDamageAndHealingBonus();
}
-void Aura::HandleAuraModDispelResist(bool apply, bool Real)
+void AuraEffect::HandleAuraModDispelResist(bool apply, bool Real)
{
if(!Real || !apply)
return;
@@ -4361,7 +4690,7 @@ void Aura::HandleAuraModDispelResist(bool apply, bool Real)
m_target->CastSpell(m_target,44416,true,NULL,this,GetCasterGUID());
}
-void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool Real)
+void AuraEffect::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -4372,7 +4701,7 @@ void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool Real)
((Player*)m_target)->UpdateSpellDamageAndHealingBonus();
}
-void Aura::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool Real)
+void AuraEffect::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -4381,7 +4710,7 @@ void Aura::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool Real
((Player*)m_target)->UpdateSpellDamageAndHealingBonus();
}
-void Aura::HandleModHealingDone(bool /*apply*/, bool Real)
+void AuraEffect::HandleModHealingDone(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -4390,9 +4719,9 @@ void Aura::HandleModHealingDone(bool /*apply*/, bool Real)
((Player*)m_target)->UpdateSpellDamageAndHealingBonus();
}
-void Aura::HandleModTotalPercentStat(bool apply, bool Real)
+void AuraEffect::HandleModTotalPercentStat(bool apply, bool Real)
{
- if (m_modifier.m_miscvalue < -1 || m_modifier.m_miscvalue > 4)
+ if (GetMiscValue() < -1 || GetMiscValue() > 4)
{
sLog.outError("WARNING: Misc Value for SPELL_AURA_MOD_PERCENT_STAT not valid");
return;
@@ -4404,16 +4733,16 @@ void Aura::HandleModTotalPercentStat(bool apply, bool Real)
for (int32 i = STAT_STRENGTH; i < MAX_STATS; i++)
{
- if(m_modifier.m_miscvalue == i || m_modifier.m_miscvalue == -1)
+ if(GetMiscValue() == i || GetMiscValue() == -1)
{
- m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet())
- m_target->ApplyStatPercentBuffMod(Stats(i), m_modifier.m_amount, apply );
+ m_target->ApplyStatPercentBuffMod(Stats(i), m_amount, apply );
}
}
//recalculate current HP/MP after applying aura modifications (only for spells with 0x10 flag)
- if ((m_modifier.m_miscvalue == STAT_STAMINA) && (maxHPValue > 0) && (m_spellProto->Attributes & 0x10))
+ if ((GetMiscValue() == STAT_STAMINA) && (maxHPValue > 0) && (m_spellProto->Attributes & 0x10))
{
// newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed
uint32 newHPValue = (m_target->GetMaxHealth() * curHPValue) / maxHPValue;
@@ -4421,12 +4750,12 @@ void Aura::HandleModTotalPercentStat(bool apply, bool Real)
}
}
-void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
- if(m_modifier.m_miscvalue != SPELL_SCHOOL_MASK_NORMAL)
+ if(GetMiscValue() != SPELL_SCHOOL_MASK_NORMAL)
{
// support required adding replace UpdateArmor by loop by UpdateResistence at intellect update
// and include in UpdateResistence same code as in UpdateArmor for aura mod apply.
@@ -4441,53 +4770,53 @@ void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool Real)
/********************************/
/*** HEAL & ENERGIZE ***/
/********************************/
-void Aura::HandleAuraModTotalHealthPercentRegen(bool apply, bool Real)
+void AuraEffect::HandleAuraModTotalHealthPercentRegen(bool apply, bool Real)
{
m_isPeriodic = apply;
}
-void Aura::HandleAuraModTotalEnergyPercentRegen(bool apply, bool Real)
+void AuraEffect::HandleAuraModTotalEnergyPercentRegen(bool apply, bool Real)
{
- if(m_modifier.periodictime == 0)
- m_modifier.periodictime = 1000;
+ if(m_amplitude == 0)
+ m_amplitude = 1000;
- m_periodicTimer = m_modifier.periodictime;
+ m_periodicTimer = m_amplitude;
m_isPeriodic = apply;
}
-void Aura::HandleModRegen(bool apply, bool Real) // eating
+void AuraEffect::HandleModRegen(bool apply, bool Real) // eating
{
- if(m_modifier.periodictime == 0)
- m_modifier.periodictime = 5000;
+ if(m_amplitude == 0)
+ m_amplitude = 5000;
m_periodicTimer = 5000;
m_isPeriodic = apply;
}
-void Aura::HandleModPowerRegen(bool apply, bool Real) // drinking
+void AuraEffect::HandleModPowerRegen(bool apply, bool Real) // drinking
{
if (!Real)
return;
Powers pt = m_target->getPowerType();
- if(m_modifier.periodictime == 0)
+ if(m_amplitude == 0)
{
// Anger Management (only spell use this aura for rage)
if (pt == POWER_RAGE)
- m_modifier.periodictime = 3000;
+ m_amplitude = 3000;
else
- m_modifier.periodictime = 2000;
+ m_amplitude = 2000;
}
m_periodicTimer = 5000;
- if (m_target->GetTypeId() == TYPEID_PLAYER && m_modifier.m_miscvalue == POWER_MANA)
+ if (m_target->GetTypeId() == TYPEID_PLAYER && GetMiscValue() == POWER_MANA)
((Player*)m_target)->UpdateManaRegen();
m_isPeriodic = apply;
}
-void Aura::HandleModPowerRegenPCT(bool /*apply*/, bool Real)
+void AuraEffect::HandleModPowerRegenPCT(bool /*apply*/, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4497,11 +4826,11 @@ void Aura::HandleModPowerRegenPCT(bool /*apply*/, bool Real)
return;
// Update manaregen value
- if (m_modifier.m_miscvalue == POWER_MANA)
+ if (GetMiscValue() == POWER_MANA)
((Player*)m_target)->UpdateManaRegen();
}
-void Aura::HandleModManaRegen(bool /*apply*/, bool Real)
+void AuraEffect::HandleModManaRegen(bool /*apply*/, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4514,7 +4843,7 @@ void Aura::HandleModManaRegen(bool /*apply*/, bool Real)
((Player*)m_target)->UpdateManaRegen();
}
-void Aura::HandleComprehendLanguage(bool apply, bool Real)
+void AuraEffect::HandleComprehendLanguage(bool apply, bool Real)
{
if(apply)
m_target->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG);
@@ -4522,32 +4851,32 @@ void Aura::HandleComprehendLanguage(bool apply, bool Real)
m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_COMPREHEND_LANG);
}
-void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real)
+void AuraEffect::HandleAuraModIncreaseHealth(bool apply, bool Real)
{
if(Real)
{
if(apply)
{
- m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
- m_target->ModifyHealth(m_modifier.m_amount);
+ m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_amount), apply);
+ m_target->ModifyHealth(m_amount);
}
else
{
- if (int32(m_target->GetHealth()) > m_modifier.m_amount)
- m_target->ModifyHealth(-m_modifier.m_amount);
+ if (int32(m_target->GetHealth()) > m_amount)
+ m_target->ModifyHealth(-m_amount);
else
m_target->SetHealth(1);
- m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_amount), apply);
}
}
}
-void Aura::HandleAuraModIncreaseMaxHealth(bool apply, bool Real)
+void AuraEffect::HandleAuraModIncreaseMaxHealth(bool apply, bool Real)
{
uint32 oldhealth = m_target->GetHealth();
double healthPercentage = (double)oldhealth / (double)m_target->GetMaxHealth();
- m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_amount), apply);
// refresh percentage
if(oldhealth > 0)
@@ -4560,43 +4889,43 @@ void Aura::HandleAuraModIncreaseMaxHealth(bool apply, bool Real)
}
}
-void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real)
+void AuraEffect::HandleAuraModIncreaseEnergy(bool apply, bool Real)
{
Powers powerType = m_target->getPowerType();
- if(int32(powerType) != m_modifier.m_miscvalue)
+ if(int32(powerType) != GetMiscValue())
return;
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
- m_target->HandleStatModifier(unitMod, TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(unitMod, TOTAL_VALUE, float(m_amount), apply);
}
-void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/)
+void AuraEffect::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/)
{
Powers powerType = m_target->getPowerType();
- if(int32(powerType) != m_modifier.m_miscvalue)
+ if(int32(powerType) != GetMiscValue())
return;
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
- m_target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_amount), apply);
}
-void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool /*Real*/)
+void AuraEffect::HandleAuraModIncreaseHealthPercent(bool apply, bool /*Real*/)
{
- m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_amount), apply);
}
-void Aura::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/)
+void AuraEffect::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/)
{
- m_target->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(m_amount), apply);
}
/********************************/
/*** FIGHT ***/
/********************************/
-void Aura::HandleAuraModParryPercent(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModParryPercent(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
return;
@@ -4604,25 +4933,25 @@ void Aura::HandleAuraModParryPercent(bool /*apply*/, bool Real)
((Player*)m_target)->UpdateParryPercentage();
}
-void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModDodgePercent(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateDodgePercentage();
- //sLog.outError("BONUS DODGE CHANCE: + %f", float(m_modifier.m_amount));
+ //sLog.outError("BONUS DODGE CHANCE: + %f", float(m_amount));
}
-void Aura::HandleAuraModBlockPercent(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModBlockPercent(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
return;
((Player*)m_target)->UpdateBlockPercentage();
- //sLog.outError("BONUS BLOCK CHANCE: + %f", float(m_modifier.m_amount));
+ //sLog.outError("BONUS BLOCK CHANCE: + %f", float(m_amount));
}
-void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4634,7 +4963,7 @@ void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real)
((Player*)m_target)->UpdateManaRegen();
}
-void Aura::HandleAuraModCritPercent(bool apply, bool Real)
+void AuraEffect::HandleAuraModCritPercent(bool apply, bool Real)
{
if(m_target->GetTypeId()!=TYPEID_PLAYER)
return;
@@ -4649,13 +4978,13 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real)
// mods must be applied base at equipped weapon class and subclass comparison
// with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
- // m_modifier.m_miscvalue comparison with item generated damage types
+ // GetMiscValue() comparison with item generated damage types
if (GetSpellProto()->EquippedItemClass == -1)
{
- ((Player*)m_target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply);
- ((Player*)m_target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply);
- ((Player*)m_target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_modifier.m_amount), apply);
+ ((Player*)m_target)->HandleBaseModValue(CRIT_PERCENTAGE, FLAT_MOD, float (m_amount), apply);
+ ((Player*)m_target)->HandleBaseModValue(OFFHAND_CRIT_PERCENTAGE, FLAT_MOD, float (m_amount), apply);
+ ((Player*)m_target)->HandleBaseModValue(RANGED_CRIT_PERCENTAGE, FLAT_MOD, float (m_amount), apply);
}
else
{
@@ -4663,7 +4992,7 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real)
}
}
-void Aura::HandleModHitChance(bool apply, bool Real)
+void AuraEffect::HandleModHitChance(bool apply, bool Real)
{
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
@@ -4672,12 +5001,12 @@ void Aura::HandleModHitChance(bool apply, bool Real)
}
else
{
- m_target->m_modMeleeHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount);
- m_target->m_modRangedHitChance += apply ? m_modifier.m_amount : (-m_modifier.m_amount);
+ m_target->m_modMeleeHitChance += apply ? m_amount : (-m_amount);
+ m_target->m_modRangedHitChance += apply ? m_amount : (-m_amount);
}
}
-void Aura::HandleModSpellHitChance(bool apply, bool Real)
+void AuraEffect::HandleModSpellHitChance(bool apply, bool Real)
{
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
@@ -4685,11 +5014,11 @@ void Aura::HandleModSpellHitChance(bool apply, bool Real)
}
else
{
- m_target->m_modSpellHitChance += apply ? m_modifier.m_amount: (-m_modifier.m_amount);
+ m_target->m_modSpellHitChance += apply ? m_amount: (-m_amount);
}
}
-void Aura::HandleModSpellCritChance(bool apply, bool Real)
+void AuraEffect::HandleModSpellCritChance(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4701,11 +5030,11 @@ void Aura::HandleModSpellCritChance(bool apply, bool Real)
}
else
{
- m_target->m_baseSpellCritChance += apply ? m_modifier.m_amount:-m_modifier.m_amount;
+ m_target->m_baseSpellCritChance += apply ? m_amount:-m_amount;
}
}
-void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real)
+void AuraEffect::HandleModSpellCritChanceShool(bool /*apply*/, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4715,7 +5044,7 @@ void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real)
return;
for(int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school)
- if (m_modifier.m_miscvalue & (1<<school))
+ if (GetMiscValue() & (1<<school))
((Player*)m_target)->UpdateSpellCritChance(school);
}
@@ -4723,86 +5052,86 @@ void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real)
/*** ATTACK SPEED ***/
/********************************/
-void Aura::HandleModCastingSpeed(bool apply, bool Real)
+void AuraEffect::HandleModCastingSpeed(bool apply, bool Real)
{
- m_target->ApplyCastTimePercentMod(m_modifier.m_amount,apply);
+ m_target->ApplyCastTimePercentMod(m_amount,apply);
}
-void Aura::HandleModMeleeRangedSpeedPct(bool apply, bool Real)
+void AuraEffect::HandleModMeleeRangedSpeedPct(bool apply, bool Real)
{
- m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply);
- m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_modifier.m_amount,apply);
- m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply);
+ m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_amount,apply);
+ m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_amount,apply);
+ m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_amount, apply);
}
-void Aura::HandleModCombatSpeedPct(bool apply, bool Real)
+void AuraEffect::HandleModCombatSpeedPct(bool apply, bool Real)
{
- m_target->ApplyCastTimePercentMod(m_modifier.m_amount,apply);
- m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply);
- m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_modifier.m_amount,apply);
- m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply);
+ m_target->ApplyCastTimePercentMod(m_amount,apply);
+ m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_amount,apply);
+ m_target->ApplyAttackTimePercentMod(OFF_ATTACK,m_amount,apply);
+ m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_amount, apply);
}
-void Aura::HandleModAttackSpeed(bool apply, bool Real)
+void AuraEffect::HandleModAttackSpeed(bool apply, bool Real)
{
if(!m_target->isAlive() )
return;
- m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply);
+ m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_amount,apply);
}
-void Aura::HandleHaste(bool apply, bool Real)
+void AuraEffect::HandleHaste(bool apply, bool Real)
{
- m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount,apply);
- m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount,apply);
- m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_modifier.m_amount,apply);
+ m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_amount,apply);
+ m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_amount,apply);
+ m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_amount,apply);
}
-void Aura::HandleAuraModRangedHaste(bool apply, bool Real)
+void AuraEffect::HandleAuraModRangedHaste(bool apply, bool Real)
{
- m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply);
+ m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_amount, apply);
}
-void Aura::HandleRangedAmmoHaste(bool apply, bool Real)
+void AuraEffect::HandleRangedAmmoHaste(bool apply, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
- m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_modifier.m_amount, apply);
+ m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_amount, apply);
}
/********************************/
/*** ATTACK POWER ***/
/********************************/
-void Aura::HandleAuraModAttackPower(bool apply, bool Real)
+void AuraEffect::HandleAuraModAttackPower(bool apply, bool Real)
{
- m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(m_amount), apply);
}
-void Aura::HandleAuraModRangedAttackPower(bool apply, bool Real)
+void AuraEffect::HandleAuraModRangedAttackPower(bool apply, bool Real)
{
if((m_target->getClassMask() & CLASSMASK_WAND_USERS)!=0)
return;
- m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_amount), apply);
}
-void Aura::HandleAuraModAttackPowerPercent(bool apply, bool Real)
+void AuraEffect::HandleAuraModAttackPowerPercent(bool apply, bool Real)
{
//UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
- m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_PCT, float(m_amount), apply);
}
-void Aura::HandleAuraModRangedAttackPowerPercent(bool apply, bool Real)
+void AuraEffect::HandleAuraModRangedAttackPowerPercent(bool apply, bool Real)
{
if((m_target->getClassMask() & CLASSMASK_WAND_USERS)!=0)
return;
//UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
- m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_PCT, float(m_amount), apply);
}
-void Aura::HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real)
+void AuraEffect::HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4813,7 +5142,7 @@ void Aura::HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real)
((Player*)m_target)->UpdateAttackPowerAndDamage(true);
}
-void Aura::HandleAuraModAttackPowerOfStatPercent(bool apply, bool Real)
+void AuraEffect::HandleAuraModAttackPowerOfStatPercent(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4827,7 +5156,7 @@ void Aura::HandleAuraModAttackPowerOfStatPercent(bool apply, bool Real)
/********************************/
/*** DAMAGE BONUS ***/
/********************************/
-void Aura::HandleModDamageDone(bool apply, bool Real)
+void AuraEffect::HandleModDamageDone(bool apply, bool Real)
{
// apply item specific bonuses for already equipped weapon
if(Real && m_target->GetTypeId()==TYPEID_PLAYER)
@@ -4837,23 +5166,23 @@ void Aura::HandleModDamageDone(bool apply, bool Real)
((Player*)m_target)->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply);
}
- // m_modifier.m_miscvalue is bitmask of spell schools
+ // GetMiscValue() is bitmask of spell schools
// 1 ( 0-bit ) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
// 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wands
// 127 - full bitmask any damages
//
// mods must be applied base at equipped weapon class and subclass comparison
// with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
- // m_modifier.m_miscvalue comparison with item generated damage types
+ // GetMiscValue() comparison with item generated damage types
- if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) != 0)
+ if((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0)
{
// apply generic physical damage bonuses including wand case
if (GetSpellProto()->EquippedItemClass == -1 || m_target->GetTypeId() != TYPEID_PLAYER)
{
- m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply);
- m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(m_modifier.m_amount), apply);
- m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, float(m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, float(m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_VALUE, float(m_amount), apply);
}
else
{
@@ -4862,15 +5191,15 @@ void Aura::HandleModDamageDone(bool apply, bool Real)
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
- if(m_positive)
- m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS,m_modifier.m_amount,apply);
+ if(GetParentAura()->IsPositive())
+ m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS,m_amount,apply);
else
- m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG,m_modifier.m_amount,apply);
+ m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG,m_amount,apply);
}
}
// Skip non magic case for speedup
- if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_MAGIC) == 0)
+ if((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0)
return;
if( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 )
@@ -4886,20 +5215,20 @@ void Aura::HandleModDamageDone(bool apply, bool Real)
// This information for client side use only
if(m_target->GetTypeId() == TYPEID_PLAYER)
{
- if(m_positive)
+ if(GetParentAura()->IsPositive())
{
for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
{
- if((m_modifier.m_miscvalue & (1<<i)) != 0)
- m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i,m_modifier.m_amount,apply);
+ if((GetMiscValue() & (1<<i)) != 0)
+ m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i,m_amount,apply);
}
}
else
{
for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
{
- if((m_modifier.m_miscvalue & (1<<i)) != 0)
- m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i,m_modifier.m_amount,apply);
+ if((GetMiscValue() & (1<<i)) != 0)
+ m_target->ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i,m_amount,apply);
}
}
Pet* pet = ((Player*)m_target)->GetPet();
@@ -4908,9 +5237,9 @@ void Aura::HandleModDamageDone(bool apply, bool Real)
}
}
-void Aura::HandleModDamagePercentDone(bool apply, bool Real)
+void AuraEffect::HandleModDamagePercentDone(bool apply, bool Real)
{
- sLog.outDebug("AURA MOD DAMAGE type:%u negative:%u", m_modifier.m_miscvalue, m_positive ? 0 : 1);
+ sLog.outDebug("AURA MOD DAMAGE type:%u negative:%u", GetMiscValue(), GetParentAura()->IsPositive() ? 0 : 1);
// apply item specific bonuses for already equipped weapon
if(Real && m_target->GetTypeId()==TYPEID_PLAYER)
@@ -4920,23 +5249,23 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real)
((Player*)m_target)->_ApplyWeaponDependentAuraDamageMod(pItem,WeaponAttackType(i),this,apply);
}
- // m_modifier.m_miscvalue is bitmask of spell schools
+ // GetMiscValue() is bitmask of spell schools
// 1 ( 0-bit ) - normal school damage (SPELL_SCHOOL_MASK_NORMAL)
// 126 - full bitmask all magic damages (SPELL_SCHOOL_MASK_MAGIC) including wand
// 127 - full bitmask any damages
//
// mods must be applied base at equipped weapon class and subclass comparison
// with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
- // m_modifier.m_miscvalue comparison with item generated damage types
+ // GetMiscValue() comparison with item generated damage types
- if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL) != 0)
+ if((GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) != 0)
{
// apply generic physical damage bonuses including wand case
if (GetSpellProto()->EquippedItemClass == -1 || m_target->GetTypeId() != TYPEID_PLAYER)
{
- m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(m_modifier.m_amount), apply);
- m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply);
- m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_PCT, float(m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_DAMAGE_RANGED, TOTAL_PCT, float(m_amount), apply);
}
else
{
@@ -4944,11 +5273,11 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real)
}
// For show in client
if(m_target->GetTypeId() == TYPEID_PLAYER)
- m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT,m_modifier.m_amount/100.0f,apply);
+ m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT,m_amount/100.0f,apply);
}
// Skip non magic case for speedup
- if((m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_MAGIC) == 0)
+ if((GetMiscValue() & SPELL_SCHOOL_MASK_MAGIC) == 0)
return;
if( GetSpellProto()->EquippedItemClass != -1 || GetSpellProto()->EquippedItemInventoryTypeMask != 0 )
@@ -4964,10 +5293,10 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real)
// Send info to client
if(m_target->GetTypeId() == TYPEID_PLAYER)
for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
- m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+i,m_modifier.m_amount/100.0f,apply);
+ m_target->ApplyModSignedFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT+i,m_amount/100.0f,apply);
}
-void Aura::HandleModOffhandDamagePercent(bool apply, bool Real)
+void AuraEffect::HandleModOffhandDamagePercent(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -4975,37 +5304,37 @@ void Aura::HandleModOffhandDamagePercent(bool apply, bool Real)
sLog.outDebug("AURA MOD OFFHAND DAMAGE");
- m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_modifier.m_amount), apply);
+ m_target->HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_PCT, float(m_amount), apply);
}
/********************************/
/*** POWER COST ***/
/********************************/
-void Aura::HandleModPowerCostPCT(bool apply, bool Real)
+void AuraEffect::HandleModPowerCostPCT(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
return;
- float amount = m_modifier.m_amount /100.0f;
+ float amount = m_amount /100.0f;
for(int i = 0; i < MAX_SPELL_SCHOOL; ++i)
- if(m_modifier.m_miscvalue & (1<<i))
+ if(GetMiscValue() & (1<<i))
m_target->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+i,amount,apply);
}
-void Aura::HandleModPowerCost(bool apply, bool Real)
+void AuraEffect::HandleModPowerCost(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
return;
for(int i = 0; i < MAX_SPELL_SCHOOL; ++i)
- if(m_modifier.m_miscvalue & (1<<i))
- m_target->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,m_modifier.m_amount,apply);
+ if(GetMiscValue() & (1<<i))
+ m_target->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER+i,m_amount,apply);
}
-void Aura::HandleNoReagentUseAura(bool Apply, bool Real)
+void AuraEffect::HandleNoReagentUseAura(bool Apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -5013,8 +5342,8 @@ void Aura::HandleNoReagentUseAura(bool Apply, bool Real)
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
flag96 mask;
- Unit::AuraList const& noReagent = m_target->GetAurasByType(SPELL_AURA_NO_REAGENT_USE);
- for(Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
+ Unit::AuraEffectList const& noReagent = m_target->GetAurasByType(SPELL_AURA_NO_REAGENT_USE);
+ for(Unit::AuraEffectList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
mask |= (*i)->m_spellProto->EffectSpellClassMask[(*i)->m_effIndex];
m_target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 , mask[0]);
@@ -5026,7 +5355,7 @@ void Aura::HandleNoReagentUseAura(bool Apply, bool Real)
/*** OTHERS ***/
/*********************************************************/
-void Aura::HandleAuraAllowOnlyAbility(bool apply, bool Real)
+void AuraEffect::HandleAuraAllowOnlyAbility(bool apply, bool Real)
{
if(!Real)
return;
@@ -5043,149 +5372,7 @@ void Aura::HandleAuraAllowOnlyAbility(bool apply, bool Real)
}
}
-void Aura::HandleShapeshiftBoosts(bool apply)
-{
- uint32 spellId = 0;
- uint32 spellId2 = 0;
- uint32 HotWSpellId = 0;
-
- switch(GetModifier()->m_miscvalue)
- {
- case FORM_CAT:
- spellId = 3025;
- HotWSpellId = 24900;
- break;
- case FORM_TREE:
- spellId = 5420;
- spellId2 = 34123;
- break;
- case FORM_TRAVEL:
- spellId = 5419;
- break;
- case FORM_AQUA:
- spellId = 5421;
- break;
- case FORM_BEAR:
- spellId = 1178;
- spellId2 = 21178;
- HotWSpellId = 24899;
- break;
- case FORM_DIREBEAR:
- spellId = 9635;
- spellId2 = 21178;
- HotWSpellId = 24899;
- break;
- case FORM_BATTLESTANCE:
- spellId = 21156;
- break;
- case FORM_DEFENSIVESTANCE:
- spellId = 7376;
- break;
- case FORM_BERSERKERSTANCE:
- spellId = 7381;
- break;
- case FORM_MOONKIN:
- spellId = 24905;
- // aura from effect trigger spell
- spellId2 = 24907;
- break;
- case FORM_FLIGHT:
- spellId = 33948;
- spellId2 = 34764;
- break;
- case FORM_FLIGHT_EPIC:
- spellId = 40122;
- spellId2 = 40121;
- break;
- case FORM_METAMORPHOSIS:
- spellId = 54817;
- spellId2 = 54879;
- break;
- case FORM_SPIRITOFREDEMPTION:
- spellId = 27792;
- spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
- break;
- case FORM_GHOSTWOLF:
- case FORM_AMBIENT:
- case FORM_GHOUL:
- case FORM_SHADOW:
- case FORM_STEALTH:
- case FORM_CREATURECAT:
- case FORM_CREATUREBEAR:
- spellId = 0;
- break;
- }
-
- uint32 form = GetModifier()->m_miscvalue-1;
-
- if(apply)
- {
- if (spellId) m_target->CastSpell(m_target, spellId, true, NULL, this );
- if (spellId2) m_target->CastSpell(m_target, spellId2, true, NULL, this);
-
- if(m_target->GetTypeId() == TYPEID_PLAYER)
- {
- const PlayerSpellMap& sp_list = ((Player *)m_target)->GetSpellMap();
- for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
- {
- if(itr->second->state == PLAYERSPELL_REMOVED) continue;
- if(itr->first==spellId || itr->first==spellId2) continue;
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
- if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | (1<<7)))) continue;
- if (spellInfo->Stances & (1<<form))
- m_target->CastSpell(m_target, itr->first, true, NULL, this);
- }
- //LotP
- if (((Player*)m_target)->HasSpell(17007))
- {
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(24932);
- if (spellInfo && spellInfo->Stances & (1<<form))
- m_target->CastSpell(m_target, 24932, true, NULL, this);
- }
- // HotW
- if (HotWSpellId)
- {
- Unit::AuraList const& mModTotalStatPct = m_target->GetAurasByType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE);
- for(Unit::AuraList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i)
- {
- if ((*i)->GetSpellProto()->SpellIconID == 240 && (*i)->GetModifier()->m_miscvalue == 3)
- {
- int32 HotWMod = (*i)->GetModifier()->m_amount;
- if(GetModifier()->m_miscvalue == FORM_CAT)
- HotWMod /= 2;
-
- m_target->CastCustomSpell(m_target, HotWSpellId, &HotWMod, NULL, NULL, true, NULL, this);
- break;
- }
- }
- }
- }
- }
- else
- {
- m_target->RemoveAurasDueToSpell(spellId);
- m_target->RemoveAurasDueToSpell(spellId2);
-
- Unit::AuraMap& tAuras = m_target->GetAuras();
- for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
- {
- if (itr->second->IsRemovedOnShapeLost())
- {
- m_target->RemoveAurasDueToSpell(itr->second->GetId());
- itr = tAuras.begin();
- }
- else
- {
- ++itr;
- }
- }
- }
-
- /*double healthPercentage = (double)m_target->GetHealth() / (double)m_target->GetMaxHealth();
- m_target->SetHealth(uint32(ceil((double)m_target->GetMaxHealth() * healthPercentage)));*/
-}
-
-void Aura::HandleAuraEmpathy(bool apply, bool Real)
+void AuraEffect::HandleAuraEmpathy(bool apply, bool Real)
{
if(m_target->GetTypeId() != TYPEID_UNIT)
return;
@@ -5195,7 +5382,7 @@ void Aura::HandleAuraEmpathy(bool apply, bool Real)
m_target->ApplyModUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_SPECIALINFO, apply);
}
-void Aura::HandleAuraUntrackable(bool apply, bool Real)
+void AuraEffect::HandleAuraUntrackable(bool apply, bool Real)
{
if(apply)
m_target->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE);
@@ -5203,7 +5390,7 @@ void Aura::HandleAuraUntrackable(bool apply, bool Real)
m_target->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_UNTRACKABLE);
}
-void Aura::HandleAuraModPacify(bool apply, bool Real)
+void AuraEffect::HandleAuraModPacify(bool apply, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -5214,13 +5401,13 @@ void Aura::HandleAuraModPacify(bool apply, bool Real)
m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED);
}
-void Aura::HandleAuraModPacifyAndSilence(bool apply, bool Real)
+void AuraEffect::HandleAuraModPacifyAndSilence(bool apply, bool Real)
{
HandleAuraModPacify(apply,Real);
HandleAuraModSilence(apply,Real);
}
-void Aura::HandleAuraGhost(bool apply, bool Real)
+void AuraEffect::HandleAuraGhost(bool apply, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -5235,7 +5422,7 @@ void Aura::HandleAuraGhost(bool apply, bool Real)
}
}
-void Aura::HandleAuraAllowFlight(bool apply, bool Real)
+void AuraEffect::HandleAuraAllowFlight(bool apply, bool Real)
{
// all applied/removed only at real aura add/remove
if(!Real)
@@ -5266,7 +5453,7 @@ void Aura::HandleAuraAllowFlight(bool apply, bool Real)
m_target->SendMessageToSet(&data, true);
}
-void Aura::HandleModRating(bool apply, bool Real)
+void AuraEffect::HandleModRating(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -5276,11 +5463,11 @@ void Aura::HandleModRating(bool apply, bool Real)
return;
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
- if (m_modifier.m_miscvalue & (1 << rating))
- ((Player*)m_target)->ApplyRatingMod(CombatRating(rating), m_modifier.m_amount, apply);
+ if (GetMiscValue() & (1 << rating))
+ ((Player*)m_target)->ApplyRatingMod(CombatRating(rating), m_amount, apply);
}
-void Aura::HandleModRatingFromStat(bool apply, bool Real)
+void AuraEffect::HandleModRatingFromStat(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -5290,11 +5477,11 @@ void Aura::HandleModRatingFromStat(bool apply, bool Real)
return;
// Just recalculate ratings
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
- if (m_modifier.m_miscvalue & (1 << rating))
+ if (GetMiscValue() & (1 << rating))
((Player*)m_target)->ApplyRatingMod(CombatRating(rating), 0, apply);
}
-void Aura::HandleForceMoveForward(bool apply, bool Real)
+void AuraEffect::HandleForceMoveForward(bool apply, bool Real)
{
if(!Real || m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -5304,7 +5491,7 @@ void Aura::HandleForceMoveForward(bool apply, bool Real)
m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
}
-void Aura::HandleAuraModExpertise(bool /*apply*/, bool Real)
+void AuraEffect::HandleAuraModExpertise(bool /*apply*/, bool Real)
{
if(m_target->GetTypeId() != TYPEID_PLAYER)
return;
@@ -5313,7 +5500,7 @@ void Aura::HandleAuraModExpertise(bool /*apply*/, bool Real)
((Player*)m_target)->UpdateExpertise(OFF_ATTACK);
}
-void Aura::HandleModTargetResistance(bool apply, bool Real)
+void AuraEffect::HandleModTargetResistance(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -5321,25 +5508,25 @@ void Aura::HandleModTargetResistance(bool apply, bool Real)
// applied to damage as HandleNoImmediateEffect in Unit::CalcAbsorbResist and Unit::CalcArmorReducedDamage
// show armor penetration
- if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_NORMAL))
- m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE,m_modifier.m_amount, apply);
+ if (m_target->GetTypeId() == TYPEID_PLAYER && (GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL))
+ m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_PHYSICAL_RESISTANCE,m_amount, apply);
// show as spell penetration only full spell penetration bonuses (all resistances except armor and holy
- if (m_target->GetTypeId() == TYPEID_PLAYER && (m_modifier.m_miscvalue & SPELL_SCHOOL_MASK_SPELL)==SPELL_SCHOOL_MASK_SPELL)
- m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,m_modifier.m_amount, apply);
+ if (m_target->GetTypeId() == TYPEID_PLAYER && (GetMiscValue() & SPELL_SCHOOL_MASK_SPELL)==SPELL_SCHOOL_MASK_SPELL)
+ m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,m_amount, apply);
}
-void Aura::HandleShieldBlockValue(bool apply, bool Real)
+void AuraEffect::HandleShieldBlockValue(bool apply, bool Real)
{
BaseModType modType = FLAT_MOD;
- if(m_modifier.m_auraname == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT)
+ if(m_auraName == SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT)
modType = PCT_MOD;
if(m_target->GetTypeId() == TYPEID_PLAYER)
- ((Player*)m_target)->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(m_modifier.m_amount), apply);
+ ((Player*)m_target)->HandleBaseModValue(SHIELD_BLOCK_VALUE, modType, float(m_amount), apply);
}
-void Aura::HandleAuraRetainComboPoints(bool apply, bool Real)
+void AuraEffect::HandleAuraRetainComboPoints(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
@@ -5352,12 +5539,12 @@ void Aura::HandleAuraRetainComboPoints(bool apply, bool Real)
// combo points was added in SPELL_EFFECT_ADD_COMBO_POINTS handler
// remove only if aura expire by time (in case combo points amount change aura removed without combo points lost)
- if( !apply && m_duration==0 && target->GetComboTarget())
+ if( !apply && GetParentAura()->GetAuraDuration()==0 && target->GetComboTarget())
if(Unit* unit = ObjectAccessor::GetUnit(*m_target,target->GetComboTarget()))
- target->AddComboPoints(unit, -m_modifier.m_amount);
+ target->AddComboPoints(unit, -m_amount);
}
-void Aura::HandleModUnattackable( bool Apply, bool Real )
+void AuraEffect::HandleModUnattackable( bool Apply, bool Real )
{
if(!Real)
return;
@@ -5371,7 +5558,7 @@ void Aura::HandleModUnattackable( bool Apply, bool Real )
m_target->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, Apply);
}
-void Aura::HandleSpiritOfRedemption( bool apply, bool Real )
+void AuraEffect::HandleSpiritOfRedemption( bool apply, bool Real )
{
// spells required only Real aura add/remove
if(!Real)
@@ -5397,29 +5584,7 @@ void Aura::HandleSpiritOfRedemption( bool apply, bool Real )
m_target->setDeathState(JUST_DIED);
}
-void Aura::CleanupTriggeredSpells()
-{
- uint32 tSpellId = m_spellProto->EffectTriggerSpell[GetEffIndex()];
- if(!tSpellId)
- return;
-
- SpellEntry const* tProto = sSpellStore.LookupEntry(tSpellId);
- if(!tProto)
- return;
-
- if(GetSpellDuration(tProto) != -1)
- return;
-
- // needed for spell 43680, maybe others
- // TODO: is there a spell flag, which can solve this in a more sophisticated way?
- if(m_spellProto->EffectApplyAuraName[GetEffIndex()] == SPELL_AURA_PERIODIC_TRIGGER_SPELL &&
- GetSpellDuration(m_spellProto) == m_spellProto->EffectAmplitude[GetEffIndex()])
- return;
-
- m_target->RemoveAurasDueToSpell(tSpellId);
-}
-
-void Aura::HandleSchoolAbsorb(bool apply, bool Real)
+void AuraEffect::HandleSchoolAbsorb(bool apply, bool Real)
{
if(!Real)
return;
@@ -5461,17 +5626,17 @@ void Aura::HandleSchoolAbsorb(bool apply, bool Real)
DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellProto());
- m_modifier.m_amount += (int32)DoneActualBenefit;
+ m_amount += (int32)DoneActualBenefit;
}
}
}
-void Aura::PeriodicTick()
+void AuraEffect::PeriodicTick()
{
if(!m_target->isAlive())
return;
- switch(m_modifier.m_auraname)
+ switch(GetAuraName())
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
@@ -5489,7 +5654,7 @@ void Aura::PeriodicTick()
return;
// some auras remove at specific health level or more
- if(m_modifier.m_auraname==SPELL_AURA_PERIODIC_DAMAGE)
+ if(m_auraName==SPELL_AURA_PERIODIC_DAMAGE)
{
switch(GetId())
{
@@ -5516,18 +5681,18 @@ void Aura::PeriodicTick()
}
case 41337:// aura of anger
{
- Unit::AuraList const& mMod = m_target->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
- for(Unit::AuraList::const_iterator i = mMod.begin(); i != mMod.end(); ++i)
+ Unit::AuraEffectList const& mMod = m_target->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ for(Unit::AuraEffectList::const_iterator i = mMod.begin(); i != mMod.end(); ++i)
{
if ((*i)->GetId() == 41337)
{
(*i)->ApplyModifier(false);
- (*i)->GetModifier()->m_amount += 5;
+ (*i)->SetAmount((*i)->GetAmount()+5);
(*i)->ApplyModifier(true);
break;
}
}
- m_modifier.m_amount += 100;
+ m_amount += 100;
}break;
default:
break;
@@ -5540,11 +5705,11 @@ void Aura::PeriodicTick()
// ignore non positive values (can be result apply spellmods to aura damage
//uint32 amount = GetModifierValuePerStack() > 0 ? GetModifierValuePerStack() : 0;
- uint32 pdamage = GetModifier()->m_amount > 0 ? GetModifier()->m_amount : 0;
+ uint32 pdamage = GetAmount() > 0 ? GetAmount() : 0;
- if(m_modifier.m_auraname == SPELL_AURA_PERIODIC_DAMAGE)
+ if(GetAuraName() == SPELL_AURA_PERIODIC_DAMAGE)
{
- pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount());
+ pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetParentAura()->GetStackAmount());
// Calculate armor mitigation if it is a physical spell
// But not for bleed mechanic spells
@@ -5560,10 +5725,10 @@ void Aura::PeriodicTick()
if (GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x400) && GetSpellProto()->SpellIconID==544)
{
// 1..4 ticks, 1/2 from normal tick damage
- if (m_duration>=((m_maxduration-m_modifier.periodictime)*2/3))
+ if (GetParentAura()->GetAuraDuration()>=((GetParentAura()->GetAuraMaxDuration()-m_amplitude)*2/3))
pdamage = pdamage/2;
// 9..12 ticks, 3/2 from normal tick damage
- else if(m_duration<((m_maxduration-m_modifier.periodictime)/3))
+ else if(GetParentAura()->GetAuraDuration()<((GetParentAura()->GetAuraMaxDuration()-m_amplitude)/3))
pdamage += (pdamage+1)/2; // +1 prevent 0.5 damage possible lost at 1..4 ticks
// 5..8 ticks have normal tick damage
}
@@ -5586,7 +5751,7 @@ void Aura::PeriodicTick()
data.appendPackGUID(GetCasterGUID());
data << uint32(GetId());
data << uint32(1);
- data << uint32(m_modifier.m_auraname);
+ data << uint32(m_auraName);
data << (uint32)pdamage;
data << uint32(0); // overkill
data << (uint32)GetSpellSchoolMask(GetSpellProto()); // will be mask in 2.4.x
@@ -5631,8 +5796,8 @@ void Aura::PeriodicTick()
CleanDamage cleanDamage = CleanDamage(0, BASE_ATTACK, MELEE_HIT_NORMAL );
//uint32 pdamage = GetModifierValuePerStack() > 0 ? GetModifierValuePerStack() : 0;
- uint32 pdamage = GetModifier()->m_amount > 0 ? GetModifier()->m_amount : 0;
- pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount());
+ uint32 pdamage = GetAmount() > 0 ? GetAmount() : 0;
+ pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetParentAura()->GetStackAmount());
//Calculate armor mitigation if it is a physical spell
if (GetSpellSchoolMask(GetSpellProto()) & SPELL_SCHOOL_MASK_NORMAL)
@@ -5660,7 +5825,7 @@ void Aura::PeriodicTick()
Unit* target = m_target; // aura can be deleted in DealDamage
SpellEntry const* spellProto = GetSpellProto();
float multiplier = spellProto->EffectMultipleValue[GetEffIndex()] > 0 ? spellProto->EffectMultipleValue[GetEffIndex()] : 1;
- int32 stackAmount = GetStackAmount();
+ int32 stackAmount = GetParentAura()->GetStackAmount();
// Set trigger flag
uint32 procAttacker = PROC_FLAG_ON_DO_PERIODIC;// | PROC_FLAG_SUCCESSFUL_HARMFUL_SPELL_HIT;
@@ -5704,17 +5869,17 @@ void Aura::PeriodicTick()
if(m_target != pCaster && GetSpellProto()->SpellVisual[0]==163 && !pCaster->isAlive())
return;
- if(m_duration ==-1 && m_target->GetHealth()==m_target->GetMaxHealth())
+ if(GetParentAura()->GetAuraDuration() ==-1 && m_target->GetHealth()==m_target->GetMaxHealth())
return;
// ignore non positive values (can be result apply spellmods to aura damage
//uint32 amount = GetModifierValuePerStack() > 0 ? GetModifierValuePerStack() : 0;
- uint32 pdamage = GetModifier()->m_amount > 0 ? GetModifier()->m_amount : 0;
+ int32 pdamage = GetAmount() > 0 ? GetAmount() : 0;
- if(m_modifier.m_auraname==SPELL_AURA_OBS_MOD_HEALTH)
- pdamage = uint32(m_target->GetMaxHealth() * pdamage * GetStackAmount() / 100);
+ if(m_auraName==SPELL_AURA_OBS_MOD_HEALTH)
+ pdamage = uint32(m_target->GetMaxHealth() * pdamage * GetParentAura()->GetStackAmount() / 100);
else
- pdamage = pCaster->SpellHealingBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount());
+ pdamage = pCaster->SpellHealingBonus(m_target, GetSpellProto(), pdamage, DOT, GetParentAura()->GetStackAmount());
sLog.outDetail("PeriodicTick: %u (TypeId: %u) heal of %u (TypeId: %u) for %u health inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), pdamage, GetId());
@@ -5724,7 +5889,7 @@ void Aura::PeriodicTick()
data.appendPackGUID(GetCasterGUID());
data << uint32(GetId());
data << uint32(1);
- data << uint32(m_modifier.m_auraname);
+ data << uint32(m_auraName);
data << (uint32)pdamage;
data << uint32(0); // wotlk
m_target->SendMessageToSet(&data,true);
@@ -5737,13 +5902,13 @@ void Aura::PeriodicTick()
bg->UpdatePlayerScore(((Player*)pCaster), SCORE_HEALING_DONE, gain);
//Do check before because m_modifier.auraName can be invalidate by DealDamage.
- bool procSpell = (m_modifier.m_auraname == SPELL_AURA_PERIODIC_HEAL && m_target != pCaster);
+ bool procSpell = (m_auraName == SPELL_AURA_PERIODIC_HEAL && m_target != pCaster);
m_target->getHostilRefManager().threatAssist(pCaster, float(gain) * 0.5f, GetSpellProto());
Unit* target = m_target; // aura can be deleted in DealDamage
SpellEntry const* spellProto = GetSpellProto();
- bool haveCastItem = GetCastItemGUID()!=0;
+ bool haveCastItem = GetParentAura()->GetCastItemGUID()!=0;
// heal for caster damage
if(m_target!=pCaster && spellProto->SpellVisual[0]==163)
@@ -5782,10 +5947,10 @@ void Aura::PeriodicTick()
}
case SPELL_AURA_PERIODIC_MANA_LEECH:
{
- if(m_modifier.m_miscvalue < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
+ if(GetMiscValue() < 0 || GetMiscValue() >= MAX_POWERS)
return;
- Powers power = Powers(m_modifier.m_miscvalue);
+ Powers power = Powers(GetMiscValue());
// power type might have changed between aura applying and tick (druid's shapeshift)
if(m_target->getPowerType() != power)
@@ -5807,10 +5972,10 @@ void Aura::PeriodicTick()
return;
// ignore non positive values (can be result apply spellmods to aura damage
- uint32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
+ uint32 pdamage = m_amount > 0 ? m_amount : 0;
// Special case: draining x% of mana (up to a maximum of 2*x% of the caster's maximum mana)
- // It's mana percent cost spells, m_modifier.m_amount is percent drain from target
+ // It's mana percent cost spells, m_amount is percent drain from target
if (m_spellProto->ManaCostPercentage)
{
// max value
@@ -5846,7 +6011,7 @@ void Aura::PeriodicTick()
data.appendPackGUID(GetCasterGUID());
data << uint32(GetId());
data << uint32(1);
- data << uint32(m_modifier.m_auraname);
+ data << uint32(m_auraName);
data << (uint32)power; // power type
data << (uint32)drain_amount;
data << (float)gain_multiplier;
@@ -5865,7 +6030,7 @@ void Aura::PeriodicTick()
{
m_target->CastSpell(m_target, 31463, true, 0, this);
// Remove aura
- SetAuraDuration(0);
+ GetParentAura()->SetAuraDuration(0);
}
// Mark of Kazzak
@@ -5878,29 +6043,29 @@ void Aura::PeriodicTick()
{
m_target->CastSpell(m_target, 32961, true, 0, this);
// Remove aura
- SetAuraDuration(0);
+ GetParentAura()->SetAuraDuration(0);
}
}
break;
}
case SPELL_AURA_OBS_MOD_ENERGY:
{
- if(m_modifier.m_miscvalue < 0)
+ if(GetMiscValue() < 0)
return;
Powers power;
- if (m_modifier.m_miscvalue == POWER_ALL)
+ if (GetMiscValue() == POWER_ALL)
power = m_target->getPowerType();
else
- power = Powers(m_modifier.m_miscvalue);
+ power = Powers(GetMiscValue());
if(m_target->GetMaxPower(power) == 0)
return;
- if(m_duration ==-1 && m_target->GetPower(power)==m_target->GetMaxPower(power))
+ if(GetParentAura()->GetAuraDuration() ==-1 && m_target->GetPower(power)==m_target->GetMaxPower(power))
return;
- uint32 amount = m_modifier.m_amount * m_target->GetMaxPower(power) /100;
+ uint32 amount = m_amount * m_target->GetMaxPower(power) /100;
sLog.outDetail("PeriodicTick: %u (TypeId: %u) energize %u (TypeId: %u) for %u dmg inflicted by %u",
GUID_LOPART(GetCasterGUID()), GuidHigh2TypeId(GUID_HIPART(GetCasterGUID())), m_target->GetGUIDLow(), m_target->GetTypeId(), amount, GetId());
@@ -5909,7 +6074,7 @@ void Aura::PeriodicTick()
data.appendPackGUID(GetCasterGUID());
data << uint32(GetId());
data << uint32(1);
- data << uint32(m_modifier.m_auraname);
+ data << uint32(m_auraName);
data << uint32(power); // power type
data << (uint32)amount;
m_target->SendMessageToSet(&data,true);
@@ -5923,25 +6088,25 @@ void Aura::PeriodicTick()
case SPELL_AURA_PERIODIC_ENERGIZE:
{
// ignore non positive values (can be result apply spellmods to aura damage
- if(m_modifier.m_amount < 0 || m_modifier.m_miscvalue >= MAX_POWERS)
+ if(m_amount < 0 || GetMiscValue() >= MAX_POWERS)
return;
- Powers power = Powers(m_modifier.m_miscvalue);
+ Powers power = Powers(GetMiscValue());
if(m_target->GetMaxPower(power) == 0)
return;
- if(m_duration ==-1 && m_target->GetPower(power)==m_target->GetMaxPower(power))
+ if(GetParentAura()->GetAuraDuration() ==-1 && m_target->GetPower(power)==m_target->GetMaxPower(power))
return;
- uint32 amount = m_modifier.m_amount;
+ uint32 amount = m_amount;
WorldPacket data(SMSG_PERIODICAURALOG, (21+16));// we guess size
data.append(m_target->GetPackGUID());
data.appendPackGUID(GetCasterGUID());
data << uint32(GetId());
data << uint32(1);
- data << uint32(m_modifier.m_auraname);
+ data << uint32(m_auraName);
data << (uint32)power; // power type
data << (uint32)amount;
m_target->SendMessageToSet(&data,true);
@@ -5965,9 +6130,9 @@ void Aura::PeriodicTick()
if(m_target->IsImmunedToDamage(GetSpellSchoolMask(GetSpellProto())))
return;
- int32 pdamage = m_modifier.m_amount > 0 ? m_modifier.m_amount : 0;
+ int32 pdamage = m_amount > 0 ? m_amount : 0;
- Powers powerType = Powers(m_modifier.m_miscvalue);
+ Powers powerType = Powers(GetMiscValue());
if(!m_target->isAlive() || m_target->getPowerType() != powerType)
return;
@@ -6001,7 +6166,7 @@ void Aura::PeriodicTick()
}
case SPELL_AURA_MOD_REGEN:
{
- int32 gain = m_target->ModifyHealth(m_modifier.m_amount);
+ int32 gain = m_target->ModifyHealth(m_amount);
if (Unit *caster = GetCaster())
m_target->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, GetSpellProto());
break;
@@ -6009,7 +6174,7 @@ void Aura::PeriodicTick()
case SPELL_AURA_MOD_POWER_REGEN:
{
Powers pt = m_target->getPowerType();
- if(int32(pt) != m_modifier.m_miscvalue)
+ if(int32(pt) != GetMiscValue())
return;
if ( GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_NOT_SEATED )
@@ -6027,7 +6192,7 @@ void Aura::PeriodicTick()
// amount = 1+ 16 = 17 = 3,4*5 = 10,2*5/3
// so 17 is rounded amount for 5 sec tick grow ~ 1 range grow in 3 sec
if(pt == POWER_RAGE)
- m_target->ModifyPower(pt, m_modifier.m_amount*3/5);
+ m_target->ModifyPower(pt, m_amount*3/5);
break;
}
// Here tick dummy auras
@@ -6051,7 +6216,7 @@ void Aura::PeriodicTick()
}
}
-void Aura::PeriodicDummyTick()
+void AuraEffect::PeriodicDummyTick()
{
Unit *caster = GetCaster();
SpellEntry const* spell = GetSpellProto();
@@ -6079,12 +6244,12 @@ void Aura::PeriodicDummyTick()
if (m_target->GetTypeId() != TYPEID_PLAYER)
return;
// Search SPELL_AURA_MOD_POWER_REGEN aura for this spell and add bonus
- Unit::AuraList const& aura = m_target->GetAurasByType(SPELL_AURA_MOD_POWER_REGEN);
- for(Unit::AuraList::const_iterator i = aura.begin(); i != aura.end(); ++i)
+ Unit::AuraEffectList const& aura = m_target->GetAurasByType(SPELL_AURA_MOD_POWER_REGEN);
+ for(Unit::AuraEffectList::const_iterator i = aura.begin(); i != aura.end(); ++i)
{
if ((*i)->GetId() == GetId())
{
- (*i)->GetModifier()->m_amount = m_modifier.m_amount;
+ (*i)->SetAmount(m_amount);
((Player*)m_target)->UpdateManaRegen();
// Disable continue
m_isPeriodic = false;
@@ -6287,7 +6452,7 @@ void Aura::PeriodicDummyTick()
{
// Increases your attack power by $s1 for every $s2 armor value you have.
// Calculate AP bonus (from 1 efect of this spell)
- int32 apBonus = m_modifier.m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[1], m_target);
+ int32 apBonus = m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[1], m_target);
m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, 0, true, 0, this);
return;
}
@@ -6351,7 +6516,7 @@ void Aura::PeriodicDummyTick()
{
if (!caster)
return;
- int32 damage = m_modifier.m_amount;
+ int32 damage = m_amount;
caster->CastCustomSpell(m_target, 56298, &damage, 0, 0, true, 0, this);
return;
}
@@ -6393,7 +6558,7 @@ void Aura::PeriodicDummyTick()
if (spell->SpellFamilyFlags[0] & 0x20)
{
if (caster)
- caster->CastCustomSpell(m_target, 52212, &m_modifier.m_amount, NULL, NULL, true, 0, this);
+ caster->CastCustomSpell(m_target, 52212, &m_amount, NULL, NULL, true, 0, this);
return;
}
// Raise Dead
@@ -6403,13 +6568,12 @@ void Aura::PeriodicDummyTick()
if (spell->SpellFamilyFlags[1] & 0x00004000)
{
// Get 0 effect aura
- Aura *slow = m_target->GetAura(GetId(), 0);
+ AuraEffect *slow = m_target->GetAuraEffect(GetId(), 0);
if (slow)
{
- slow->ApplyModifier(false);
- Modifier *mod = slow->GetModifier();
- mod->m_amount+= m_modifier.m_amount;
- if (mod->m_amount > 0) mod->m_amount = 0;
+ slow->ApplyModifier(false);;
+ slow->SetAmount(GetAmount()*2);
+ if (slow->GetAmount() > 0) slow->SetAmount(0);
slow->ApplyModifier(true);
}
return;
@@ -6425,7 +6589,7 @@ void Aura::PeriodicDummyTick()
{
// Increases your attack power by $s1 for every $s2 armor value you have.
// Calculate AP bonus (from 1 efect of this spell)
- int32 apBonus = m_modifier.m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[1], m_target);
+ int32 apBonus = m_amount * m_target->GetArmor() / m_target->CalculateSpellDamage(spell, 1, spell->EffectBasePoints[1], m_target);
m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, 0, true, 0, this);
return;
}
@@ -6442,12 +6606,12 @@ void Aura::PeriodicDummyTick()
}
}
-void Aura::HandlePreventFleeing(bool apply, bool Real)
+void AuraEffect::HandlePreventFleeing(bool apply, bool Real)
{
if(!Real)
return;
- Unit::AuraList const& fearAuras = m_target->GetAurasByType(SPELL_AURA_MOD_FEAR);
+ Unit::AuraEffectList const& fearAuras = m_target->GetAurasByType(SPELL_AURA_MOD_FEAR);
if( !fearAuras.empty() )
{
m_target->SetControlled(!apply, UNIT_STAT_FLEEING);
@@ -6458,7 +6622,7 @@ void Aura::HandlePreventFleeing(bool apply, bool Real)
}
}
-void Aura::HandleManaShield(bool apply, bool Real)
+void AuraEffect::HandleManaShield(bool apply, bool Real)
{
if(!Real)
return;
@@ -6486,12 +6650,12 @@ void Aura::HandleManaShield(bool apply, bool Real)
DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellProto());
- m_modifier.m_amount += (int32)DoneActualBenefit;
+ m_amount += (int32)DoneActualBenefit;
}
}
}
-void Aura::HandleArenaPreparation(bool apply, bool Real)
+void AuraEffect::HandleArenaPreparation(bool apply, bool Real)
{
if(!Real)
return;
@@ -6502,7 +6666,7 @@ void Aura::HandleArenaPreparation(bool apply, bool Real)
m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION);
}
-void Aura::HandleAuraControlVehicle(bool apply, bool Real)
+void AuraEffect::HandleAuraControlVehicle(bool apply, bool Real)
{
if(!Real)
return;
@@ -6517,7 +6681,7 @@ void Aura::HandleAuraControlVehicle(bool apply, bool Real)
//((Player*)m_target)->GetSession()->SendPacket(&data);
}
-void Aura::HandleAuraConvertRune(bool apply, bool Real)
+void AuraEffect::HandleAuraConvertRune(bool apply, bool Real)
{
if(!Real)
return;
@@ -6554,60 +6718,25 @@ void Aura::HandleAuraConvertRune(bool apply, bool Real)
// Control Auras
-void Aura::HandleAuraModStun(bool apply, bool Real)
+void AuraEffect::HandleAuraModStun(bool apply, bool Real)
{
if(!Real)
return;
m_target->SetControlled(apply, UNIT_STAT_STUNNED);
- if(GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST)
- HandleAuraStateFrozen(apply);
}
-void Aura::HandleAuraModRoot(bool apply, bool Real)
+void AuraEffect::HandleAuraModRoot(bool apply, bool Real)
{
if(!Real)
return;
m_target->SetControlled(apply, UNIT_STAT_ROOT);
- if(GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST)
- HandleAuraStateFrozen(apply);
-}
-
-static AuraType const frozenAuraTypes[] = { SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_NONE };
-
-void Aura::HandleAuraStateFrozen(bool apply)
-{
- if(apply)
- {
- m_target->ModifyAuraState(AURA_STATE_FROZEN, true);
- }
- else
- {
- bool found_another = false;
- for(AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; itr++)
- {
- Unit::AuraList const& auras = m_target->GetAurasByType(*itr);
- for(Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); i++)
- {
- if( GetSpellSchoolMask((*i)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST)
- {
- found_another = true;
- break;
- }
- }
- if(found_another)
- break;
- }
-
- if(!found_another)
- m_target->ModifyAuraState(AURA_STATE_FROZEN, false);
- }
}
// Charm Auras
-void Aura::HandleModPossess(bool apply, bool Real)
+void AuraEffect::HandleModPossess(bool apply, bool Real)
{
if(!Real)
return;
@@ -6621,7 +6750,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
if(apply)
{
- if(m_target->getLevel() > m_modifier.m_amount)
+ if(m_target->getLevel() > m_amount)
return;
m_target->SetCharmedOrPossessedBy(caster, true);
@@ -6630,7 +6759,7 @@ void Aura::HandleModPossess(bool apply, bool Real)
m_target->RemoveCharmedOrPossessedBy(caster);
}
-void Aura::HandleModPossessPet(bool apply, bool Real)
+void AuraEffect::HandleModPossessPet(bool apply, bool Real)
{
if(!Real)
return;
@@ -6660,7 +6789,7 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
}
}
-void Aura::HandleModCharm(bool apply, bool Real)
+void AuraEffect::HandleModCharm(bool apply, bool Real)
{
if(!Real)
return;
@@ -6669,7 +6798,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
if(apply)
{
- if(int32(m_target->getLevel()) > m_modifier.m_amount)
+ if(int32(m_target->getLevel()) > m_amount)
return;
m_target->SetCharmedOrPossessedBy(caster, false);
@@ -6678,7 +6807,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
m_target->RemoveCharmedOrPossessedBy(caster);
}
-void Aura::HandlePhase(bool apply, bool Real)
+void AuraEffect::HandlePhase(bool apply, bool Real)
{
if(!Real)
return;
@@ -6686,9 +6815,7 @@ void Aura::HandlePhase(bool apply, bool Real)
// always non stackable
if(apply)
{
- Unit::AuraList const& phases = m_target->GetAurasByType(SPELL_AURA_PHASE);
- if(!phases.empty())
- m_target->RemoveAurasDueToSpell(phases.front()->GetId(),this);
+ m_target->RemoveAurasByType(SPELL_AURA_PHASE, NULL, GetParentAura());
}
// no-phase is also phase state so same code for apply and remove
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index d566c0a6cc4..d43424a31bf 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -22,14 +22,6 @@
#include "SpellAuraDefines.h"
-struct Modifier
-{
- AuraType m_auraname;
- int32 m_amount;
- int32 m_miscvalue;
- uint32 periodictime;
-};
-
class Unit;
struct SpellEntry;
struct SpellModifier;
@@ -37,8 +29,9 @@ struct ProcTriggerSpell;
// forward decl
class Aura;
+class AuraEffect;
-typedef void(Aura::*pAuraHandler)(bool Apply, bool Real);
+typedef void(AuraEffect::*pAuraHandler)(bool Apply, bool Real);
// Real == true at aura add/remove
// Real == false at aura mod unapply/reapply; when adding/removing dependent aura/item/stat mods
//
@@ -54,9 +47,121 @@ typedef void(Aura::*pAuraHandler)(bool Apply, bool Real);
class TRINITY_DLL_SPEC Aura
{
- friend Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem);
+ friend void Player::SendAurasForTarget(Unit *target);
+ public:
+ virtual ~Aura();
+ Aura(SpellEntry const* spellproto, uint32 effMask, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
+
+ SpellEntry const* GetSpellProto() const { return m_spellProto; }
+ uint32 GetId() const{ return m_spellProto->Id; }
+ uint64 GetCastItemGUID() const { return m_castItemGuid; }
+
+ uint64 const& GetCasterGUID() const { return m_caster_guid; }
+ Unit* GetCaster() const;
+ Unit* GetTarget() const { return m_target; }
+
+ time_t GetAuraApplyTime() const { return m_applyTime; }
+
+ int32 GetAuraMaxDuration() const { return m_maxduration; }
+ void SetAuraMaxDuration(int32 duration) { m_maxduration = duration; }
+ int32 GetAuraDuration() const { return m_duration; }
+ void SetAuraDuration(int32 duration);
+ void RefreshAura(){ SetAuraDuration (m_maxduration); }
+
+ void SendAuraUpdate();
+ uint8 GetAuraSlot() const { return m_auraSlot; }
+ void SetAuraSlot(uint8 slot) { m_auraSlot = slot; }
+ uint8 GetAuraCharges() const { return m_procCharges; }
+ void SetAuraCharges(uint8 charges);
+ bool DropAuraCharge();
+
+ int8 GetStackAmount() const {return m_stackAmount;}
+ void SetStackAmount(uint8 num);
+ bool modStackAmount(int32 num); // return true if last charge dropped
+ uint32 GetAuraStateMask(){return m_auraStateMask;}
+ void SetAuraState(uint8 num){m_auraStateMask |= 1<<(num-1);} //modifies aura's aura state (not unit!)
+
+ void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; }
+ uint8 GetRemoveMode() const {return m_removeMode;}
+
+ inline uint8 GetEffectMask() const {return m_auraFlags & 7;}
+ AuraEffect * GetPartAura (uint8 effIndex) const {return m_partAuras[effIndex];}
+ bool SetPartAura(AuraEffect* aurEff, uint8 effIndex);
+
+ bool IsPositive() const { return m_positive; }
+ void SetNegative() { m_positive = false; }
+ void SetPositive() { m_positive = true; }
+ bool IsPermanent() const { return m_permanent; }
+ bool IsPassive() const { return m_isPassive; }
+ bool IsDeathPersistent() const { return m_isDeathPersist; }
+ bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
+ bool IsUpdated() const { return m_updated; }
+ void SetUpdated(bool val) { m_updated = val; }
+
+ bool IsInUse() const;
+ bool IsPersistent() const;
+ bool IsAreaAura() const;
+ bool IsAuraType(AuraType type) const;
+ void SetLoadedState(uint64 caster_guid,int32 maxduration,int32 duration,int32 charges, uint8 stackamount, int32 * amount);
+ bool HasEffect(uint8 effIndex) const {return bool (m_partAuras[effIndex]);}
+ inline void HandleEffects(bool apply)
+ {
+ for (uint8 i = 0; i<MAX_SPELL_EFFECTS;++i)
+ if (m_partAuras[i])
+ m_target->HandleAuraEffect(m_partAuras[i], apply);
+ }
+ void ApplyAllModifiers(bool apply, bool Real=false);
+
+ void Update(uint32 diff);
+
+ void _AddAura();
+ void _RemoveAura();
+ // Allow Apply Aura Handler to modify and access m_AuraDRGroup
+ void setDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; }
+ DiminishingGroup getDiminishGroup() const { return m_AuraDRGroup; }
+
+ // Single cast aura helpers
+ void UnregisterSingleCastAura();
+ bool IsSingleTarget() const {return m_isSingleTargetAura;}
+ void SetIsSingleTarget(bool val) { m_isSingleTargetAura = val;}
+
+ private:
+ SpellEntry const *m_spellProto;
+ Unit * const m_target;
+ uint64 m_caster_guid;
+ uint64 m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
+ time_t m_applyTime;
+
+ int32 m_maxduration; // Max aura duration
+ int32 m_duration; // Current time
+ int32 m_timeCla; // Timer for power per sec calcultion
+
+ AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason
+ DiminishingGroup m_AuraDRGroup:8; // Diminishing
+
+ uint8 m_auraSlot; // Aura slot on unit (for show in client)
+ uint8 m_auraFlags; // Aura info flag (for send data to client)
+ uint8 m_auraLevel; // Aura level (store caster level for correct show level dep amount)
+ uint8 m_procCharges; // Aura charges (0 for infinite)
+ uint32 m_procDamage; // used in aura proc code
+ uint8 m_stackAmount; // Aura stack amount
+ uint32 m_auraStateMask;
+ AuraEffect * m_partAuras[3];
+
+ bool m_isDeathPersist:1;
+ bool m_isRemovedOnShapeLost:1;
+ bool m_isPassive:1;
+ bool m_positive:1;
+ bool m_permanent:1;
+ bool m_updated:1; // Prevent remove aura by stack if set
+ bool m_isSingleTargetAura:1; // true if it's a single target spell and registered at caster - can change at spell steal for example
+};
+class TRINITY_DLL_SPEC AuraEffect
+{
public:
+ friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem);
+ friend void Aura::SetStackAmount(uint8 stackAmount);
//aura handlers
void HandleNULL(bool, bool)
{
@@ -211,192 +316,85 @@ class TRINITY_DLL_SPEC Aura
void HandleAuraIncreaseBaseHealthPercent(bool Apply, bool Real);
void HandleNoReagentUseAura(bool Apply, bool Real);
void HandlePhase(bool Apply, bool Real);
+ void HandleAuraAllowOnlyAbility(bool apply, bool Real);
- void HandleAuraStateFrozen(bool apply);
-
- virtual ~Aura();
+ // add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras
+ void HandleShapeshiftBoosts(bool apply);
- void SetModifier(AuraType t, int32 a, uint32 pt, int32 miscValue);
- Modifier* GetModifier() {return &m_modifier;}
- int32 GetMiscValue() {return m_spellProto->EffectMiscValue[m_effIndex];}
- int32 GetMiscBValue() {return m_spellProto->EffectMiscValueB[m_effIndex];}
+ inline Unit * GetCaster() const{ return m_parentAura->GetCaster(); }
+ inline uint64 GetCasterGUID() const{ return m_parentAura->GetCasterGUID(); }
+ Aura * GetParentAura() const { return m_parentAura; }
SpellEntry const* GetSpellProto() const { return m_spellProto; }
- uint32 GetId() const{ return m_spellProto->Id; }
- uint64 GetCastItemGUID() const { return m_castItemGuid; }
- uint32 GetEffIndex() const{ return m_effIndex; }
+ uint32 GetId() const { return m_spellProto->Id; }
+ uint32 GetEffIndex() const { return m_effIndex; }
int32 GetBasePoints() const { return m_currentBasePoints; }
+ void Update(uint32 diff);
- int32 GetAuraMaxDuration() const { return m_maxduration; }
- void SetAuraMaxDuration(int32 duration) { m_maxduration = duration; }
- int32 GetAuraDuration() const { return m_duration; }
- void SetAuraDuration(int32 duration)
- {
- m_duration = duration;
- if (duration<0)
- m_permanent=true;
- else
- m_permanent=false;
- }
- void SetAuraDurationAndUpdate(int32 duration)
- {
- SetAuraDuration (duration);
- m_target->UpdateAuraForGroup(GetAuraSlot());
- }
- time_t GetAuraApplyTime() { return m_applyTime; }
-
- SpellModifier *getAuraSpellMod() {return m_spellmod; }
-
- uint64 const& GetCasterGUID() const { return m_caster_guid; }
- Unit* GetCaster() const;
- Unit* GetTarget() const { return m_target; }
- void SetTarget(Unit* target) { m_target = target; }
- void SetLoadedState(uint64 caster_guid,int32 damage,int32 maxduration,int32 duration,int32 charges)
- {
- m_caster_guid = caster_guid;
- m_modifier.m_amount = damage;
- m_maxduration = maxduration;
- m_duration = duration;
- m_procCharges = charges;
- }
-
- uint8 GetAuraSlot() const { return m_auraSlot; }
- void SetAuraSlot(uint8 slot) { m_auraSlot = slot; }
- uint8 GetAuraCharges() const { return m_procCharges; }
- void SetAuraCharges(uint8 charges)
- {
- if (m_procCharges == charges)
- return;
- m_procCharges = charges;
- m_target->UpdateAuraForGroup(GetAuraSlot());
- }
- bool DropAuraCharge() // return true if last charge dropped
- {
- if (m_procCharges == 0)
- return false;
- m_procCharges--;
- m_target->UpdateAuraForGroup(GetAuraSlot());
- return m_procCharges == 0;
- }
-
- void UnregisterSingleCastAura();
-
- int8 GetStackAmount() {return m_stackAmount;}
- //int32 GetModifierValuePerStack() {return m_modifier.m_amount / m_stackAmount;}
- void SetStackAmount(uint8 num);
- bool modStackAmount(int32 num); // return true if last charge dropped
- void InitStackAmount(uint8 stackAmount);
- uint32 GetAuraStateMask(){return m_auraStateMask;}
- void SetAuraState(uint8 num){m_auraStateMask |= 1<<(num-1);} //modifies aura's aura state (not unit!)
- void RefreshAura();
-
- bool IsPositive() { return m_positive; }
- void SetNegative() { m_positive = false; }
- void SetPositive() { m_positive = true; }
-
- bool IsPermanent() const { return m_permanent; }
bool IsAreaAura() const { return m_isAreaAura; }
bool IsPeriodic() const { return m_isPeriodic; }
- bool IsPassive() const { return m_isPassive; }
- bool IsPersistent() const { return m_isPersistent; }
- bool IsDeathPersistent() const { return m_isDeathPersist; }
- bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
bool IsInUse() const { return m_in_use;}
- void CleanupTriggeredSpells();
+ bool IsPersistent() const { return m_isPersistent; }
+ bool isAffectedOnSpell(SpellEntry const *spell) const;
- virtual void Update(uint32 diff);
void ApplyModifier(bool apply, bool Real = false);
-
- void _AddAura();
- void _RemoveAura();
-
- bool IsUpdated() { return m_updated; }
- void SetUpdated(bool val) { m_updated = val; }
-
- bool IsSingleTarget() {return m_isSingleTargetAura;}
- void SetIsSingleTarget(bool val) { m_isSingleTargetAura = val;}
-
- void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; }
+ void HandleAuraEffect(bool apply);
+ void ApplyAllModifiers(bool apply, bool Real);
Unit* GetTriggerTarget() const;
-
- // add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras
- void HandleAuraAllowOnlyAbility(bool apply, bool Real);
- void HandleShapeshiftBoosts(bool apply);
-
- // Allow Apply Aura Handler to modify and access m_AuraDRGroup
- void setDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; }
- DiminishingGroup getDiminishGroup() const { return m_AuraDRGroup; }
-
void TriggerSpell();
void TriggerSpellWithValue();
void PeriodicTick();
void PeriodicDummyTick();
- bool isAffectedOnSpell(SpellEntry const *spell) const;
- protected:
- Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
+ int32 GetMiscBValue() const {return m_spellProto->EffectMiscValueB[m_effIndex];}
+ int32 GetMiscValue() const {return m_spellProto->EffectMiscValue[m_effIndex];}
+ uint32 GetAuraName() const {return m_auraName;}
+ int32 GetAmount() const {return m_amount;}
+ void SetAmount(int32 amount) { m_amount = amount; }
+ void CleanupTriggeredSpells();
- Modifier m_modifier;
- SpellModifier *m_spellmod;
+ protected:
+ AuraEffect (Aura * parentAura, uint8 effIndex, int32 * currentBasePoints , Unit * caster,Item * castItem);
+ Aura * const m_parentAura;
+ Unit * const m_target;
SpellEntry const *m_spellProto;
- Unit* m_target;
- uint64 m_caster_guid;
- uint64 m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
- time_t m_applyTime;
- int32 m_currentBasePoints; // cache SpellEntry::EffectBasePoints and use for set custom base points
- int32 m_maxduration; // Max aura duration
- int32 m_duration; // Current time
- int32 m_timeCla; // Timer for power per sec calcultion
- int32 m_periodicTimer; // Timer for periodic auras
+ uint8 m_effIndex;
+ AuraType m_auraName;
+ int32 m_currentBasePoints;
+ int32 m_amount;
- AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason
- DiminishingGroup m_AuraDRGroup:8; // Diminishing
+ SpellModifier *m_spellmod;
- uint8 m_effIndex; // Aura effect index in spell
- uint8 m_auraSlot; // Aura slot on unit (for show in client)
- uint8 m_auraFlags; // Aura info flag (for send data to client)
- uint8 m_auraLevel; // Aura level (store caster level for correct show level dep amount)
- uint8 m_procCharges; // Aura charges (0 for infinite)
- uint8 m_stackAmount; // Aura stack amount
- uint32 m_auraStateMask;
+ int32 m_periodicTimer; // Timer for periodic auras
+ int32 m_amplitude;
- bool m_positive:1;
- bool m_permanent:1;
bool m_isPeriodic:1;
bool m_isAreaAura:1;
- bool m_isPassive:1;
- bool m_isPersistent:1;
- bool m_isDeathPersist:1;
- bool m_isRemovedOnShapeLost:1;
- bool m_updated:1; // Prevent remove aura by stack if set
bool m_in_use:1; // true while in Aura::ApplyModifier call
- bool m_isSingleTargetAura:1; // true if it's a single target spell and registered at caster - can change at spell steal for example
-
- private:
+ bool m_isPersistent:1;
};
-class TRINITY_DLL_SPEC AreaAura : public Aura
+class TRINITY_DLL_SPEC AreaAuraEffect : public AuraEffect
{
public:
- AreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- ~AreaAura();
+ AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 * currentBasePoints, Unit * caster=NULL, Item * castItem=NULL);
+ ~AreaAuraEffect();
void Update(uint32 diff);
private:
float m_radius;
+ int32 m_removeTime;
AreaAuraType m_areaAuraType;
};
-class TRINITY_DLL_SPEC PersistentAreaAura : public Aura
+class TRINITY_DLL_SPEC PersistentAreaAuraEffect : public AuraEffect
{
public:
- PersistentAreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
- ~PersistentAreaAura();
+ PersistentAreaAuraEffect(Aura * parentAura, uint32 eff, int32 *currentBasePoints, Unit *caster = NULL, Item* castItem = NULL);
+ ~PersistentAreaAuraEffect();
void Update(uint32 diff);
};
-
-Aura* CreateAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
+AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints, Unit * caster, Item * castItem = NULL);
#endif
-
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index ca2f5875ffe..0e126f8f34f 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -340,7 +340,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
{
case 35354: //Hand of Death
{
- if(unitTarget && unitTarget->HasAura(38528,0)) //Protection of Elune
+ if(unitTarget && unitTarget->HasAura(38528)) //Protection of Elune
{
damage = 0;
}
@@ -451,13 +451,13 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
if (m_spellInfo->TargetAuraState == AURA_STATE_IMMOLATE)
{
// for caster applied auras only
- Unit::AuraList const &mPeriodic = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
- for(Unit::AuraList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i)
+ Unit::AuraEffectList const &mPeriodic = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
+ for(Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i)
{
if( (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && ((*i)->GetSpellProto()->SpellFamilyFlags[0] & 4) &&
(*i)->GetCasterGUID()==m_caster->GetGUID() )
{
- unitTarget->RemoveAurasByCasterSpell((*i)->GetId(), m_caster->GetGUID());
+ unitTarget->RemoveAurasDueToSpell((*i)->GetId(), m_caster->GetGUID());
break;
}
}
@@ -497,11 +497,11 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
if((m_spellInfo->SpellFamilyFlags.IsEqual(0x1000,0,0) && m_spellInfo->SpellIconID==494) ||
(m_spellInfo->SpellFamilyFlags.IsEqual(0,0x100,0) && m_spellInfo->SpellIconID==2246))
{
- Unit::AuraList const& mDummyAuras = unitTarget->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
+ Unit::AuraEffectList const& mDummyAuras = unitTarget->GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
if((*i)->GetSpellProto()->SpellFamilyFlags[1] & 0x00000440 && (*i)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_DRUID)
{
- damage = int32(damage*(100.0f+(*i)->GetModifier()->m_amount)/100.0f);
+ damage = int32(damage*(100.0f+(*i)->GetAmount())/100.0f);
break;
}
}
@@ -517,13 +517,13 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
{
Aura *poison = 0;
// Lookup for Deadly poison (only attacker applied)
- Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
- for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
+ Unit::AuraEffectList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
+ for(Unit::AuraEffectList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_ROGUE &&
(*itr)->GetSpellProto()->SpellFamilyFlags[0] & 0x10000 &&
(*itr)->GetCasterGUID()==m_caster->GetGUID() )
{
- poison = *itr;
+ poison = (*itr)->GetParentAura();
break;
}
// count consumed deadly poison doses at target
@@ -534,7 +534,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
if (doses > combo)
doses = combo;
for (int i=0; i< doses; i++)
- unitTarget->RemoveSingleSpellAurasFromStack(spellId);
+ unitTarget->RemoveAuraFromStack(spellId);
damage *= doses;
damage += int32(((Player*)m_caster)->GetTotalAttackPowerValue(BASE_ATTACK) * 0.03f * doses);
}
@@ -599,8 +599,8 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
bool found = false;
// check dazed affect
- Unit::AuraList const& decSpeedList = unitTarget->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
- for(Unit::AuraList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter)
+ Unit::AuraEffectList const& decSpeedList = unitTarget->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
+ for(Unit::AuraEffectList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter)
{
if((*iter)->GetSpellProto()->SpellIconID==15 && (*iter)->GetSpellProto()->Dispel==0)
{
@@ -631,11 +631,11 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
damage+=int32(ap * 0.14f) + int32(holy * 22 / 100);
// Get stack of Holy Vengeance/Blood Corruption on the target added by caster
uint32 stacks = 0;
- Unit::AuraList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
- for(Unit::AuraList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
+ Unit::AuraEffectList const& auras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
+ for(Unit::AuraEffectList::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
if(((*itr)->GetId() == 31803 || (*itr)->GetId() == 53742) && (*itr)->GetCasterGUID()==m_caster->GetGUID())
{
- stacks = (*itr)->GetStackAmount();
+ stacks = (*itr)->GetParentAura()->GetStackAmount();
break;
}
// + 10% for each application of Holy Vengeance/Blood Corruption on the target
@@ -994,7 +994,7 @@ void Spell::EffectDummy(uint32 i)
float flyspeed = m_caster->GetSpeedRate(MOVE_FLIGHT);
float speed = m_caster->GetSpeedRate(MOVE_RUN);
- m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
+ m_caster->RemoveAurasByType(SPELL_AURA_MOUNTED);
//5 different spells used depending on mounted speed and if mount can fly or not
if (flyspeed >= 4.1f)
@@ -1020,7 +1020,7 @@ void Spell::EffectDummy(uint32 i)
}
case 28730: // Arcane Torrent (Mana)
{
- Aura * dummy = m_caster->GetDummyAura(28734);
+ Aura * dummy = m_caster->GetAura(28734, m_caster->GetGUID());
if (dummy)
{
int32 bp = damage * dummy->GetStackAmount();
@@ -1243,7 +1243,7 @@ void Spell::EffectDummy(uint32 i)
uint32 spellID = m_spellInfo->CalculateSimpleValue(0);
uint32 reqAuraID = m_spellInfo->CalculateSimpleValue(1);
- if (m_caster->HasAura(reqAuraID,0))
+ if (m_caster->HasAuraEffect(reqAuraID,0))
m_caster->CastSpell(m_caster,spellID,true,NULL);
return;
}
@@ -1355,8 +1355,8 @@ void Spell::EffectDummy(uint32 i)
uint32 rage = m_caster->GetPower(POWER_RAGE);
// Glyph of Execution bonus
- if (Aura *aura = m_caster->GetDummyAura(58367))
- rage+=aura->GetModifier()->m_amount;
+ if (AuraEffect *aura = m_caster->GetDummyAura(58367))
+ rage+=aura->GetAmount();
spell_id = 20647;
bp = damage+int32(rage * m_spellInfo->DmgMultiplier[i] +
@@ -1427,21 +1427,21 @@ void Spell::EffectDummy(uint32 i)
int32 mana = damage;
// Improved Life Tap mod
- Unit::AuraList const& auraDummy = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr)
+ Unit::AuraEffectList const& auraDummy = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr)
{
if((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (*itr)->GetSpellProto()->SpellIconID == 208)
- mana = ((*itr)->GetModifier()->m_amount + 100)* mana / 100;
+ mana = ((*itr)->GetAmount() + 100)* mana / 100;
}
m_caster->CastCustomSpell(unitTarget, 31818, &mana, NULL, NULL, true);
// Mana Feed
int32 manaFeedVal = 0;
- Unit::AuraList const& mod = m_caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER);
- for(Unit::AuraList::const_iterator itr = mod.begin(); itr != mod.end(); ++itr)
+ Unit::AuraEffectList const& mod = m_caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER);
+ for(Unit::AuraEffectList::const_iterator itr = mod.begin(); itr != mod.end(); ++itr)
{
if((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (*itr)->GetSpellProto()->SpellIconID == 1982)
- manaFeedVal+= (*itr)->GetModifier()->m_amount;
+ manaFeedVal+= (*itr)->GetAmount();
}
if(manaFeedVal > 0)
{
@@ -1817,8 +1817,8 @@ void Spell::EffectDummy(uint32 i)
// Glyph of Mana Tide
Unit *owner = m_caster->GetOwner();
if (owner)
- if (Aura *dummy = owner->GetDummyAura(55441))
- damage+=dummy->GetModifier()->m_amount;
+ if (AuraEffect *dummy = owner->GetDummyAura(55441))
+ damage+=dummy->GetAmount();
// Regenerate 6% of Total Mana Every 3 secs
int32 EffectBasePoints0 = unitTarget->GetMaxPower(POWER_MANA) * damage / 100;
m_caster->CastCustomSpell(unitTarget,39609,&EffectBasePoints0,NULL,NULL,true,NULL,NULL,m_originalCasterGUID);
@@ -1832,17 +1832,9 @@ void Spell::EffectDummy(uint32 i)
Item *item = ((Player*)m_caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if (item)
{
- // Damage is increased if your off-hand weapon is enchanted with Flametongue.
- Unit::AuraList const& auraDummy = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr)
+ if (m_caster->GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000))
{
- if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_SHAMAN &&
- (*itr)->GetSpellProto()->SpellFamilyFlags[0] & 0x200000 &&
- (*itr)->GetCastItemGUID() == item->GetGUID())
- {
m_damage += m_damage * damage / 100;
- return;
- }
}
}
return;
@@ -1982,9 +1974,9 @@ void Spell::EffectTriggerSpell(uint32 i)
// Vanish
case 18461:
{
- m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT);
- m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_DECREASE_SPEED);
- m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_STALKED);
+ m_caster->RemoveAurasByType(SPELL_AURA_MOD_ROOT);
+ m_caster->RemoveAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
+ m_caster->RemoveAurasByType(SPELL_AURA_MOD_STALKED);
// if this spell is given to NPC it must handle rest by it's own AI
if ( m_caster->GetTypeId() != TYPEID_PLAYER )
@@ -2337,61 +2329,7 @@ void Spell::EffectTeleportUnits(uint32 i)
void Spell::EffectApplyAura(uint32 i)
{
- if(!unitTarget)
- return;
-
- // ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
- if( !unitTarget->isAlive() && m_spellInfo->Id != 20584 && m_spellInfo->Id != 8326 &&
- (unitTarget->GetTypeId()!=TYPEID_PLAYER || !((Player*)unitTarget)->GetSession()->PlayerLoading()) )
- return;
-
- Unit* caster = m_originalCaster ? m_originalCaster : m_caster;
- if(!caster)
- return;
-
- sLog.outDebug("Spell: Aura is: %u", m_spellInfo->EffectApplyAuraName[i]);
-
- Aura* Aur = CreateAura(m_spellInfo, i, &damage, unitTarget, caster, m_CastItem);
-
- // Now Reduce spell duration using data received at spell hit
- int32 duration = Aur->GetAuraMaxDuration();
- unitTarget->ApplyDiminishingToDuration(m_diminishGroup,duration,caster,m_diminishLevel);
- Aur->setDiminishGroup(m_diminishGroup);
-
- //apply mods only here, area auras don't have duration
- duration = caster->ModSpellDuration(m_spellInfo, i, unitTarget, duration);
-
- //mod duration of channeled aura by spell haste
- if (IsChanneledSpell(m_spellInfo))
- caster->ModSpellCastTime(m_spellInfo, duration, this);
-
- // if Aura removed and deleted, do not continue.
- if(duration== 0 && !(Aur->IsPermanent()))
- {
- delete Aur;
- return;
- }
-
- if(duration != Aur->GetAuraMaxDuration())
- {
- Aur->SetAuraMaxDuration(duration);
- Aur->SetAuraDuration(duration);
- }
-
- bool added = unitTarget->AddAura(Aur);
-
- // Aura not added and deleted in AddAura call;
- if (!added)
- return;
-
- // found crash at character loading, broken pointer to Aur...
- // Aur was deleted in AddAura()...
- if(!Aur)
- return;
-
- // Prayer of Mending (jump animation), we need formal caster instead original for correct animation
- if( m_spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (m_spellInfo->SpellFamilyFlags[1] & 0x000020))
- m_caster->CastSpell(unitTarget, 41637, true, NULL, Aur, m_originalCasterGUID);
+ return; //handled elsewhere
}
void Spell::EffectUnlearnSpecialization( uint32 i )
@@ -2551,10 +2489,10 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
{
// Amount of heal - depends from stacked Holy Energy
int damageAmount = 0;
- Unit::AuraList const& mDummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i)
+ Unit::AuraEffectList const& mDummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i)
if((*i)->GetId() == 45062)
- damageAmount+=(*i)->GetModifier()->m_amount;
+ damageAmount+=(*i)->GetAmount();
if (damageAmount)
m_caster->RemoveAurasDueToSpell(45062);
@@ -2563,15 +2501,15 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
// Swiftmend - consumes Regrowth or Rejuvenation
else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND, m_spellInfo, m_caster))
{
- Unit::AuraList const& RejorRegr = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_HEAL);
+ Unit::AuraEffectList const& RejorRegr = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_HEAL);
// find most short by duration
- Aura *targetAura = NULL;
- for(Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
+ AuraEffect *targetAura = NULL;
+ for(Unit::AuraEffectList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
{
if((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID
&& ((*i)->GetSpellProto()->SpellFamilyFlags.IsEqual(0x40) || (*i)->GetSpellProto()->SpellFamilyFlags.IsEqual(0x10)) )
{
- if(!targetAura || (*i)->GetAuraDuration() < targetAura->GetAuraDuration())
+ if(!targetAura || (*i)->GetParentAura()->GetAuraDuration() < targetAura->GetParentAura()->GetAuraDuration())
targetAura = *i;
}
}
@@ -2582,7 +2520,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
return;
}
- int32 tickheal = targetAura->GetModifier()->m_amount;
+ int32 tickheal = targetAura->GetAmount();
if(Unit* auraCaster = targetAura->GetCaster())
tickheal = auraCaster->SpellHealingBonus(unitTarget, targetAura->GetSpellProto(), tickheal, DOT);
//int32 tickheal = targetAura->GetSpellProto()->EffectBasePoints[idx] + 1;
@@ -2591,14 +2529,14 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
int32 tickcount = 0;
if(targetAura->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID)
{
- switch(targetAura->GetSpellProto()->SpellFamilyFlags[0])//TODO: proper spellfamily for 3.0.x
+ switch(targetAura->GetSpellProto()->SpellFamilyFlags[0])
{
case 0x10: tickcount = 4; break; // Rejuvenation
case 0x40: tickcount = 6; break; // Regrowth
}
}
addhealth += tickheal * tickcount;
- unitTarget->RemoveAurasByCasterSpell(targetAura->GetId(), targetAura->GetCasterGUID());
+ unitTarget->RemoveAura(targetAura->GetId(), targetAura->GetCasterGUID());
//addhealth += tickheal * tickcount;
//addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth,HEAL, unitTarget);
@@ -3256,13 +3194,14 @@ void Spell::EffectProficiency(uint32 /*i*/)
void Spell::EffectApplyAreaAura(uint32 i)
{
- if(!unitTarget)
+ return;
+/* if(!unitTarget)
return;
if(!unitTarget->isAlive())
return;
AreaAura* Aur = new AreaAura(m_spellInfo, i, &damage, unitTarget, m_caster, m_CastItem);
- unitTarget->AddAura(Aur);
+ unitTarget->AddAura(Aur);*/
}
void Spell::EffectSummonType(uint32 i)
@@ -3340,9 +3279,7 @@ void Spell::EffectDispel(uint32 i)
if(!unitTarget)
return;
- //std::vector <DispelEntry> dispel_list;
- DispelSet dispel_list;
- DispelEntry entry;
+ std::list < Aura * > dispel_list;
// Create dispel mask by dispel type
uint32 dispel_type = m_spellInfo->EffectMiscValue[i];
@@ -3351,7 +3288,7 @@ void Spell::EffectDispel(uint32 i)
for(Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Aura *aur = (*itr).second;
- if (aur && (1<<aur->GetSpellProto()->Dispel) & dispelMask)
+ if (aur && ((1<<aur->GetSpellProto()->Dispel) & dispelMask))
{
if(aur->GetSpellProto()->Dispel == DISPEL_MAGIC)
{
@@ -3366,56 +3303,63 @@ void Spell::EffectDispel(uint32 i)
if(positive == unitTarget->IsFriendlyTo(m_caster))
continue;
}
- entry.casterGuid = itr->second->GetCasterGUID();
- entry.spellId = itr->second->GetId();
- entry.caster = itr->second->GetCaster();
- entry.stackAmount = itr->second->GetStackAmount();
- dispel_list.insert (entry);
+ for (uint8 i = aur->GetStackAmount();i!=0;--i)
+ dispel_list.push_back(aur);
}
}
// Ok if exist some buffs for dispel try dispel it
if (uint32 list_size = dispel_list.size())
{
- std::list < std::pair<uint32,uint64> > success_list;// (spell_id,casterGuid)
- std::list < uint32 > fail_list; // spell_id
-
+ uint32 failCount = 0;
+ std::list < Aura * > success_list;
+ WorldPacket dataFail(SMSG_DISPEL_FAILED, 8+8+4+4+damage*4);
// dispel N = damage buffs (or while exist buffs for dispel)
- for (int32 count=0; count < damage && list_size > 0; ++count)
+ for (int32 count=0; count < damage && list_size > 0; ++count, list_size = dispel_list.size())
{
// Random select buff for dispel
- DispelSet::iterator itr=dispel_list.begin();
- for (uint32 i=urand(0, list_size-1);i!=0;--i)
- itr++;
+ std::list < Aura * > ::iterator itr = dispel_list.begin();
+ for (uint32 i=urand(0, list_size-1);i>0;--i)
+ itr++;
- if (GetDispelChance(this, itr->caster, itr->spellId))
+ if (GetDispelChance(this, (*itr)->GetCaster(), (*itr)->GetId()))
{
- success_list.push_back(std::pair<uint32,uint64>(itr->spellId,itr->casterGuid));
- entry.stackAmount-=1;
- if (!itr->stackAmount)
- dispel_list.erase(itr);
+ success_list.push_back(*itr);
+ dispel_list.erase(itr);
}
else
- fail_list.push_back(itr->spellId);
+ {
+ if (!failCount)
+ {
+ // Failed to dispell
+ dataFail << uint64(m_caster->GetGUID()); // Caster GUID
+ dataFail << uint64(unitTarget->GetGUID()); // Victim GUID
+ dataFail << uint32(m_spellInfo->Id); // dispel spell id
+ }
+ failCount++;
+ dataFail << uint32((*itr)->GetId()); // Spell Id
+ }
+ }
+ if (failCount)
+ {
+ m_caster->SendMessageToSet(&dataFail, true);
}
- // Send success log and really remove auras
- if (!success_list.empty())
+ if (success_list.size())
{
- int32 count = success_list.size();
- WorldPacket data(SMSG_SPELLDISPELLOG, 8+8+4+1+4+count*5);
- data.append(unitTarget->GetPackGUID()); // Victim GUID
- data.append(m_caster->GetPackGUID()); // Caster GUID
- data << uint32(m_spellInfo->Id); // dispel spell id
- data << uint8(0); // not used
- data << uint32(count); // count
- for (std::list<std::pair<uint32,uint64> >::iterator j = success_list.begin(); j != success_list.end(); ++j)
+ WorldPacket dataSuccess(SMSG_SPELLDISPELLOG, 8+8+4+1+4+damage*5);
+ // Send packet header
+ dataSuccess.append(unitTarget->GetPackGUID()); // Victim GUID
+ dataSuccess.append(m_caster->GetPackGUID()); // Caster GUID
+ dataSuccess << uint32(m_spellInfo->Id); // dispel spell id
+ dataSuccess << uint8(0); // not used
+ dataSuccess << uint32(success_list.size()); // count
+ for (std::list < Aura * > ::iterator itr = success_list.begin();itr!=success_list.end();++itr)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(j->first);
- data << uint32(spellInfo->Id); // Spell Id
- data << uint8(0); // 0 - dispelled !=0 cleansed
- //Why are Aura's Removed by EffIndex? Auras should be removed as a whole.....
- unitTarget->RemoveAurasDueToSpellByDispel(spellInfo->Id, j->second, m_caster);
- }
- m_caster->SendMessageToSet(&data, true);
+ // Send dispelled spell info
+ dataSuccess << uint32((*itr)->GetId()); // Spell Id
+ dataSuccess << uint8(0); // 0 - dispelled !=0 cleansed
+ unitTarget->RemoveAurasDueToSpellByDispel((*itr)->GetId(), (*itr)->GetCasterGUID(), m_caster);
+ }
+ m_caster->SendMessageToSet(&dataSuccess, true);
// On succes dispel
// Devour Magic
@@ -3439,18 +3383,6 @@ void Spell::EffectDispel(uint32 i)
m_caster->CastSpell(m_caster, heal_spell, true);
}
}
- // Send fail log to client
- if (!fail_list.empty())
- {
- // Failed to dispell
- WorldPacket data(SMSG_DISPEL_FAILED, 8+8+4+4*fail_list.size());
- data << uint64(m_caster->GetGUID()); // Caster GUID
- data << uint64(unitTarget->GetGUID()); // Victim GUID
- data << uint32(m_spellInfo->Id); // dispel spell id
- for (std::list< uint32 >::iterator j = fail_list.begin(); j != fail_list.end(); ++j)
- data << uint32(*j); // Spell Id
- m_caster->SendMessageToSet(&data, true);
- }
}
}
@@ -4107,21 +4039,12 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
return;
uint32 stack = 0;
int32 maxStack = 0;
- Unit::AuraList const& list = unitTarget->GetAurasByType(SPELL_AURA_MOD_RESISTANCE);
- for(Unit::AuraList::const_iterator itr=list.begin();itr!=list.end();++itr)
+ if (AuraEffect * aur = unitTarget->GetAura(SPELL_AURA_MOD_RESISTANCE,SPELLFAMILY_WARRIOR,SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR, 0, 0, m_caster->GetGUID()))
{
- SpellEntry const *proto = (*itr)->GetSpellProto();
- if(proto->SpellFamilyName == SPELLFAMILY_WARRIOR
- && proto->SpellFamilyFlags.IsEqual(SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR)
- && (*itr)->GetCasterGUID() == m_caster->GetGUID())
- {
- (*itr)->RefreshAura();
- stack = (*itr)->GetStackAmount();
- maxStack = proto->StackAmount;
-
- ((Player*)m_caster)->ApplySpellMod(proto->Id, SPELLMOD_CHARGES, maxStack, this);
- break;
- }
+ aur->GetParentAura()->RefreshAura();
+ stack = aur->GetParentAura()->GetStackAmount();
+ maxStack = aur->GetSpellProto()->StackAmount;
+ break;
}
for(int j = 0; j < 3; j++)
@@ -4211,11 +4134,11 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Stormstrike
if(m_spellInfo->SpellFamilyFlags[1] & 0x0010)
{
- Unit::AuraList const& m_OverrideClassScript = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for(Unit::AuraList::const_iterator i = m_OverrideClassScript.begin(); i != m_OverrideClassScript.end(); ++i)
+ Unit::AuraEffectList const& m_OverrideClassScript = m_caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(Unit::AuraEffectList::const_iterator i = m_OverrideClassScript.begin(); i != m_OverrideClassScript.end(); ++i)
{
// Stormstrike AP Buff
- if ( (*i)->GetModifier()->m_miscvalue == 5634 )
+ if ( (*i)->GetMiscValue() == 5634 )
{
m_caster->CastSpell(m_caster,38430,true,NULL,*i);
break;
@@ -4357,7 +4280,7 @@ void Spell::EffectInterruptCast(uint32 i)
{
if(m_originalCaster)
{
- int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, i, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo));
+ int32 duration = m_originalCaster->ModSpellDuration(m_spellInfo, unitTarget, m_originalCaster->CalcSpellDuration(m_spellInfo), false);
unitTarget->ProhibitSpellScholl(GetSpellSchoolMask(unitTarget->m_currentSpells[i]->m_spellInfo), duration/*GetSpellDuration(m_spellInfo)*/);
}
unitTarget->InterruptSpell(i,false);
@@ -4471,7 +4394,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// check presence
for(int j = 0; j < 4; ++j)
- if(unitTarget->HasAura(spells[j],0))
+ if(unitTarget->HasAuraEffect(spells[j],0))
return;
// select spell
@@ -4499,11 +4422,11 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
// Brittle Armor - need remove one 24575 Brittle Armor aura
case 24590:
- unitTarget->RemoveSingleSpellAurasFromStack(24575);
+ unitTarget->RemoveAuraFromStack(24575);
return;
// Mercurial Shield - need remove one 26464 Mercurial Shield aura
case 26465:
- unitTarget->RemoveSingleSpellAurasFromStack(26464);
+ unitTarget->RemoveAuraFromStack(26464);
return;
// Orb teleport spells
case 25140:
@@ -4569,7 +4492,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
return;
// Prevent stacking of mounts
- unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
+ unitTarget->RemoveAurasByType(SPELL_AURA_MOUNTED);
// Two separate mounts depending on area id (allows use both in and out of specific instance)
if (unitTarget->GetAreaId() == 3428)
@@ -4592,8 +4515,9 @@ void Spell::EffectScriptEffect(uint32 effIndex)
if(!unitTarget)
return;
// It is said that removing effects by script should include dispel resist mods
- unitTarget->RemoveSpellsCausingAuraWithDispel(SPELL_AURA_MOD_ROOT, this);
- unitTarget->RemoveSpellsCausingAuraWithDispel(SPELL_AURA_MOD_DECREASE_SPEED, this);
+ unitTarget->RemoveAurasByTypeWithDispel(SPELL_AURA_MOD_ROOT, this);
+ unitTarget->RemoveAurasByTypeWithDispel(SPELL_AURA_MOD_DECREASE_SPEED, this);
+ return;
}
// Mirren's Drinking Hat
case 29830:
@@ -4626,7 +4550,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
if (!aur->IsPositive()) //only remove negative spells
{
// check for mechanic mask
- if(GetSpellMechanicMask(aur->GetSpellProto(), aur->GetEffIndex()) & mechanic_mask)
+ if(GetAllSpellMechanicMask(aur->GetSpellProto()) & mechanic_mask)
{
unitTarget->RemoveAurasDueToSpell(aur->GetId());
if(Auras.empty())
@@ -4838,8 +4762,8 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
uint32 itemtype;
uint32 rank = 0;
- Unit::AuraList const& mDummyAuras = unitTarget->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i)
+ Unit::AuraEffectList const& mDummyAuras = unitTarget->GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i)
{
if((*i)->GetId() == 18692)
{
@@ -4891,19 +4815,9 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Everlasting Affliction
case 47422:
// Refresh corruption on target
- Unit::AuraMap& auras = unitTarget->GetAuras();
- for(Unit::AuraMap::iterator itr = auras.begin(); itr != auras.end(); ++itr)
- {
- SpellEntry const *spellInfo = (*itr).second->GetSpellProto();
- if( spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK &&
- spellInfo->SpellFamilyFlags[0] & 0x2 &&
- (*itr).second->GetCasterGUID() == m_caster->GetGUID())
- {
- unitTarget->RefreshAurasByCasterSpell(spellInfo->Id, m_caster->GetGUID());
- return;
- }
- }
- break;
+ if (AuraEffect * aur = unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, m_caster->GetGUID()))
+ aur->GetParentAura()->RefreshAura();
+ return;
}
break;
}
@@ -4917,18 +4831,8 @@ void Spell::EffectScriptEffect(uint32 effIndex)
if (!unitTarget)
return;
// Refresh Shadow Word: Pain on target
- Unit::AuraMap& auras = unitTarget->GetAuras();
- for(Unit::AuraMap::iterator itr = auras.begin(); itr != auras.end(); ++itr)
- {
- SpellEntry const *spellInfo = (*itr).second->GetSpellProto();
- if( spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST &&
- spellInfo->SpellFamilyFlags[0] & 0x8000 &&
- (*itr).second->GetCasterGUID() == m_caster->GetGUID())
- {
- unitTarget->RefreshAurasByCasterSpell((*itr).second->GetId(), m_caster->GetGUID());
- return;
- }
- }
+ if (AuraEffect * aur = unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, m_caster->GetGUID()))
+ aur->GetParentAura()->RefreshAura();
return;
}
// Divine Hymn
@@ -4969,16 +4873,16 @@ void Spell::EffectScriptEffect(uint32 effIndex)
aura->RefreshAura();
// Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
- if (familyFlag[0] & 0x4000 && aura->GetEffIndex() == 0)
+ if (familyFlag[0] & 0x4000)
{
spellId = 53353; // 53353 Chimera Shot - Serpent
- basePoint = aura->GetModifier()->m_amount * 5 * 40 / 100;
+ basePoint = aura->GetPartAura(0)->GetAmount() * 5 * 40 / 100;
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
- if (familyFlag[1] & 0x00000080 && aura->GetEffIndex() == 0)
+ if (familyFlag[1] & 0x00000080)
{
spellId = 53358; // 53358 Chimera Shot - Viper
- basePoint = aura->GetModifier()->m_amount * 4 * 60 / 100;
+ basePoint = aura->GetPartAura(0)->GetAmount() * 4 * 60 / 100;
}
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
if (familyFlag[0] & 0x00008000)
@@ -5021,14 +4925,14 @@ void Spell::EffectScriptEffect(uint32 effIndex)
return;
}
// all seals have aura dummy in 2 effect
- Unit::AuraList const& m_dummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator itr = m_dummyAuras.begin(); itr != m_dummyAuras.end(); ++itr)
+ Unit::AuraEffectList const& m_dummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator itr = m_dummyAuras.begin(); itr != m_dummyAuras.end(); ++itr)
{
SpellEntry const *spellInfo = (*itr)->GetSpellProto();
// search seal (all seals have judgement's aura dummy spell id in 2 effect
if ((*itr)->GetEffIndex() != 2 || !spellInfo || !IsSealSpell(spellInfo))
continue;
- spellId2 = (*itr)->GetModifier()->m_amount;
+ spellId2 = (*itr)->GetAmount();
SpellEntry const *judge = sSpellStore.LookupEntry(spellId2);
if (!judge)
continue;
@@ -5069,7 +4973,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// don't overwrite an existing aura
for(uint8 i=0; i<5; i++)
- if(unitTarget->HasAura(spellid+i, 0))
+ if(unitTarget->HasAuraEffect(spellid+i, 0))
return;
unitTarget->CastSpell(unitTarget, spellid+urand(0, 4), true);
break;
@@ -5125,7 +5029,7 @@ void Spell::EffectSanctuary(uint32 /*i*/)
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
if(m_spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE && (m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VANISH))
{
- ((Player *)m_caster)->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT);
+ ((Player *)m_caster)->RemoveAurasByType(SPELL_AURA_MOD_ROOT);
}
}
@@ -5898,26 +5802,17 @@ void Spell::EffectDispelMechanic(uint32 i)
uint32 mechanic = m_spellInfo->EffectMiscValue[i];
- DispelSet dispel_list;
- DispelEntry entry;
+ std::queue < Aura * > dispel_list;
Unit::AuraMap& Auras = unitTarget->GetAuras();
for(Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); iter++)
+ if(GetAllSpellMechanicMask(iter->second->GetSpellProto()) & (1<<(mechanic-1)))
+ dispel_list.push(iter->second);
+
+ for(;dispel_list.size();dispel_list.pop())
{
- SpellEntry const *spell = iter->second->GetSpellProto();
- if(GetSpellMechanicMask(spell, iter->second->GetEffIndex()) & (1<<(mechanic-1)))
- {
- entry.casterGuid = iter->second->GetCasterGUID();
- entry.spellId = iter->second->GetId();
- entry.caster = iter->second->GetCaster();
- dispel_list.insert (entry);
- }
- }
- for(DispelSet::iterator itr = dispel_list.begin(); itr != dispel_list.end();++itr)
- {
- entry = *itr;
- if (GetDispelChance(this, entry.caster, entry.spellId))
- unitTarget->RemoveAurasByCasterSpell(entry.spellId, entry.casterGuid);
+ if (GetDispelChance(this, dispel_list.front()->GetCaster(), dispel_list.front()->GetId()))
+ unitTarget->RemoveAura(dispel_list.front()->GetId(), dispel_list.front()->GetCasterGUID());
}
}
@@ -6289,7 +6184,7 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
if(!unitTarget || unitTarget==m_caster) // can't steal from self
return;
- std::vector <Aura *> steal_list;
+ std::list <Aura *> steal_list;
// Create dispel mask by dispel type
uint32 dispelMask = GetDispellMask( DispelType(m_spellInfo->EffectMiscValue[i]) );
Unit::AuraMap const& auras = unitTarget->GetAuras();
@@ -6304,48 +6199,33 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
}
}
// Ok if exist some buffs for dispel try dispel it
- if (!steal_list.empty())
+ if (uint32 list_size = steal_list.size())
{
- std::list < std::pair<uint32,uint64> > success_list;
- int32 list_size = steal_list.size();
+ std::list < Aura * > success_list;
+
// dispel N = damage buffs (or while exist buffs for dispel)
- for (int32 count=0; count < damage && list_size > 0; ++count)
+ for (int32 count=0; count < damage && list_size > 0; ++count, list_size = steal_list.size())
{
// Random select buff for dispel
- Aura *aur = steal_list[urand(0, list_size-1)];
- // Not use chance for steal
- // TODO possible need do it
- success_list.push_back( std::pair<uint32,uint64>(aur->GetId(),aur->GetCasterGUID()));
-
- // Remove buff from list for prevent doubles
- for (std::vector<Aura *>::iterator j = steal_list.begin(); j != steal_list.end(); )
- {
- Aura *stealed = *j;
- if (stealed->GetId() == aur->GetId() && stealed->GetCasterGUID() == aur->GetCasterGUID())
- {
- j = steal_list.erase(j);
- --list_size;
- }
- else
- ++j;
- }
+ std::list < Aura * > ::iterator itr = steal_list.begin();
+ for (uint32 i=urand(0, list_size-1);i>0;--i)
+ itr++;
+ success_list.push_back(*itr);
+ steal_list.erase(itr);
}
- // Really try steal and send log
- if (!success_list.empty())
+ if (success_list.size())
{
- int32 count = success_list.size();
- WorldPacket data(SMSG_SPELLSTEALLOG, 8+8+4+1+4+count*5);
+ WorldPacket data(SMSG_SPELLSTEALLOG, 8+8+4+1+4+damage*5);
data.append(unitTarget->GetPackGUID()); // Victim GUID
data.append(m_caster->GetPackGUID()); // Caster GUID
data << uint32(m_spellInfo->Id); // dispel spell id
data << uint8(0); // not used
- data << uint32(count); // count
- for (std::list<std::pair<uint32,uint64> >::iterator j = success_list.begin(); j != success_list.end(); ++j)
+ data << uint32(success_list.size()); // count
+ for (std::list < Aura * > ::iterator itr = success_list.begin();itr!=success_list.end();++itr)
{
- SpellEntry const* spellInfo = sSpellStore.LookupEntry(j->first);
- data << uint32(spellInfo->Id); // Spell Id
+ data << uint32((*itr)->GetId()); // Spell Id
data << uint8(0); // 0 - steals !=0 transfers
- unitTarget->RemoveAurasDueToSpellBySteal(spellInfo->Id, j->second, m_caster);
+ unitTarget->RemoveAurasDueToSpellBySteal((*itr)->GetId(), (*itr)->GetCasterGUID(), m_caster);
}
m_caster->SendMessageToSet(&data, true);
}
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 098a5624e1d..daa1b2d9add 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -395,7 +395,7 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
}
// non channeled case
- _player->RemoveAurasByCasterSpell(spellId, _player->GetGUID(), AURA_REMOVE_BY_CANCEL);
+ _player->RemoveAurasDueToSpell(spellId, _player->GetGUID(), AURA_REMOVE_BY_CANCEL);
}
void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket)
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 88f8e242bf6..6a670d8c97a 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -240,7 +240,7 @@ bool GetDispelChance(Spell* spell, Unit* caster, uint32 spellId)
{
// we assume that aura dispel chance is 100% on start
// need formula for level difference based chance
- int32 miss_chance = 100;
+ int32 miss_chance = 0;
// Apply dispel mod from aura caster
if (caster)
{
@@ -248,7 +248,7 @@ bool GetDispelChance(Spell* spell, Unit* caster, uint32 spellId)
modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_DISPEL_CHANCE, miss_chance, spell);
}
// Try dispel
- return roll_chance_i(miss_chance);
+ return !roll_chance_i(miss_chance);
}
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
@@ -290,33 +290,9 @@ bool IsAutocastableSpell(uint32 spellId)
return true;
}
-/*bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2)
+bool IsHigherHankOfSpell(uint32 spellId_1, uint32 spellId_2)
{
- SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
- SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
- if(!spellInfo_1 || !spellInfo_2) return false;
- if(spellInfo_1->Id == spellId_2) return false;
-
- if (spellInfo_1->Effect[effIndex_1] != spellInfo_2->Effect[effIndex_2] ||
- spellInfo_1->EffectItemType[effIndex_1] != spellInfo_2->EffectItemType[effIndex_2] ||
- spellInfo_1->EffectMiscValue[effIndex_1] != spellInfo_2->EffectMiscValue[effIndex_2] ||
- spellInfo_1->EffectApplyAuraName[effIndex_1] != spellInfo_2->EffectApplyAuraName[effIndex_2])
- return false;
-
- return true;
-}*/
-
-int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2)
-{
- SpellEntry const*spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
- SpellEntry const*spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
- if(!spellInfo_1 || !spellInfo_2) return 0;
- if (spellId_1 == spellId_2) return 0;
-
- int32 diff = spellInfo_1->EffectBasePoints[effIndex_1] - spellInfo_2->EffectBasePoints[effIndex_2];
- if (spellInfo_1->CalculateSimpleValue(effIndex_1) < 0 && spellInfo_2->CalculateSimpleValue(effIndex_2) < 0)
- return -diff;
- else return diff;
+ return spellmgr.GetSpellRank(spellId_1)<spellmgr.GetSpellRank(spellId_2);
}
SpellSpecific GetSpellSpecific(uint32 spellId)
@@ -410,9 +386,6 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
if( spellInfo->SpellFamilyFlags[1] & 0x00440000 || spellInfo->SpellFamilyFlags[0] & 0x00380000 || spellInfo->SpellFamilyFlags[2] & 0x00001010)
return SPELL_ASPECT;
- if( spellInfo->SpellFamilyFlags[2] & 0x00000002 )
- return SPELL_TRACKER;
-
break;
}
case SPELLFAMILY_PALADIN:
@@ -461,6 +434,10 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
case SPELL_AURA_MOD_POSSESS_PET:
case SPELL_AURA_MOD_POSSESS:
return SPELL_CHARM;
+ case SPELL_AURA_TRACK_CREATURES:
+ case SPELL_AURA_TRACK_RESOURCES:
+ case SPELL_AURA_TRACK_STEALTHED:
+ return SPELL_TRACKER;
}
}
}
@@ -3111,10 +3088,10 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
if(auraSpell > 0)
// have expected aura
- return player->HasAura(auraSpell,0);
+ return player->HasAura(auraSpell);
else
// not have expected aura
- return !player->HasAura(-auraSpell,0);
+ return !player->HasAura(-auraSpell);
}
return true;
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 234922fc0b4..170162a0d5d 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -162,7 +162,7 @@ inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo) { return spellIn
int32 GetSpellDuration(SpellEntry const *spellInfo);
int32 GetSpellMaxDuration(SpellEntry const *spellInfo);
-struct DispelEntry
+/*struct DispelEntry
{
uint64 casterGuid;
uint32 spellId;
@@ -173,9 +173,7 @@ struct DispelEntry
{
return (spellId != _Right.spellId ? spellId < _Right.spellId : casterGuid < _Right.casterGuid);
}
-};
-
-typedef std::set < DispelEntry > DispelSet;
+};*/
inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
{
@@ -214,7 +212,7 @@ inline bool IsLootCraftingSpell(SpellEntry const *spellInfo)
(spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT || !spellInfo->EffectItemType[0]);
}
-int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);
+bool IsHigherHankOfSpell(uint32 spellId_1,uint32 spellId_2);
bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1, uint32 spellSpec2);
bool IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1, uint32 spellSpec2);
bool IsPassiveSpell(uint32 spellId);
diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp
index 10f79a8cb4c..3a95be1c3ef 100644
--- a/src/game/StatSystem.cpp
+++ b/src/game/StatSystem.cpp
@@ -97,8 +97,8 @@ bool Player::UpdateStats(Stats stat)
// Update ratings in exist SPELL_AURA_MOD_RATING_FROM_STAT and only depends from stat
uint32 mask = 0;
- AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
- for(AuraList::const_iterator i = modRatingFromStat.begin();i != modRatingFromStat.end(); ++i)
+ AuraEffectList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
+ for(AuraEffectList::const_iterator i = modRatingFromStat.begin();i != modRatingFromStat.end(); ++i)
if (Stats((*i)->GetMiscBValue()) == stat)
mask |= (*i)->GetMiscValue();
if (mask)
@@ -192,12 +192,11 @@ void Player::UpdateArmor()
value += GetModifierValue(unitMod, TOTAL_VALUE);
//add dynamic flat mods
- AuraList const& mResbyIntellect = GetAurasByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
- for(AuraList::const_iterator i = mResbyIntellect.begin();i != mResbyIntellect.end(); ++i)
+ AuraEffectList const& mResbyIntellect = GetAurasByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
+ for(AuraEffectList::const_iterator i = mResbyIntellect.begin();i != mResbyIntellect.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if(mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
- value += int32(GetStat(Stats((*i)->GetMiscBValue())) * mod->m_amount / 100.0f);
+ if((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
+ value += int32(GetStat(Stats((*i)->GetMiscBValue())) * (*i)->GetAmount() / 100.0f);
}
value *= GetModifierValue(unitMod, TOTAL_PCT);
@@ -318,13 +317,13 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
case FORM_DIREBEAR:
case FORM_MOONKIN:
{
- Unit::AuraList const& mDummy = GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
+ Unit::AuraEffectList const& mDummy = GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
{
// Predatory Strikes
if ((*itr)->GetSpellProto()->SpellIconID == 1563)
{
- mLevelMult = (*itr)->GetModifier()->m_amount / 100.0f;
+ mLevelMult = (*itr)->GetAmount() / 100.0f;
break;
}
}
@@ -362,16 +361,16 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
{
if ((getClassMask() & CLASSMASK_WAND_USERS)==0)
{
- AuraList const& mRAPbyStat = GetAurasByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT);
- for(AuraList::const_iterator i = mRAPbyStat.begin();i != mRAPbyStat.end(); ++i)
- attPowerMod += int32(GetStat(Stats((*i)->GetModifier()->m_miscvalue)) * (*i)->GetModifier()->m_amount / 100.0f);
+ AuraEffectList const& mRAPbyStat = GetAurasByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT);
+ for(AuraEffectList::const_iterator i = mRAPbyStat.begin();i != mRAPbyStat.end(); ++i)
+ attPowerMod += int32(GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 100.0f);
}
}
else
{
- AuraList const& mAPbyStat = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
- for(AuraList::const_iterator i = mAPbyStat.begin();i != mAPbyStat.end(); ++i)
- attPowerMod += int32(GetStat(Stats((*i)->GetModifier()->m_miscvalue)) * (*i)->GetModifier()->m_amount / 100.0f);
+ AuraEffectList const& mAPbyStat = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
+ for(AuraEffectList::const_iterator i = mAPbyStat.begin();i != mAPbyStat.end(); ++i)
+ attPowerMod += int32(GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 100.0f);
}
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
@@ -652,15 +651,15 @@ void Player::UpdateExpertise(WeaponAttackType attack)
Item *weapon = GetWeaponForAttack(attack);
- AuraList const& expAuras = GetAurasByType(SPELL_AURA_MOD_EXPERTISE);
- for(AuraList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
+ AuraEffectList const& expAuras = GetAurasByType(SPELL_AURA_MOD_EXPERTISE);
+ for(AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
{
// item neutral spell
if((*itr)->GetSpellProto()->EquippedItemClass == -1)
- expertise += (*itr)->GetModifier()->m_amount;
+ expertise += (*itr)->GetAmount();
// item dependent spell
else if(weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
- expertise += (*itr)->GetModifier()->m_amount;
+ expertise += (*itr)->GetAmount();
}
if(expertise < 0)
@@ -692,19 +691,18 @@ void Player::UpdateManaRegen()
float power_regen_mp5 = (GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) + m_baseManaRegen) / 5.0f;
// Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura
- AuraList const& regenAura = GetAurasByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT);
- for(AuraList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i)
+ AuraEffectList const& regenAura = GetAurasByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT);
+ for(AuraEffectList::const_iterator i = regenAura.begin();i != regenAura.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- power_regen_mp5 += GetStat(Stats(mod->m_miscvalue)) * mod->m_amount / 500.0f;
+ power_regen_mp5 += GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 500.0f;
}
// Bonus from some dummy auras
- AuraList const& mDummyAuras = GetAurasByType(SPELL_AURA_PERIODIC_DUMMY);
- for(AuraList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i)
+ AuraEffectList const& mDummyAuras = GetAurasByType(SPELL_AURA_PERIODIC_DUMMY);
+ for(AuraEffectList::const_iterator i = mDummyAuras.begin();i != mDummyAuras.end(); ++i)
if((*i)->GetId() == 34074) // Aspect of the Viper
{
- power_regen_mp5 += (*i)->GetModifier()->m_amount * Intellect / 500.0f;
+ power_regen_mp5 += (*i)->GetAmount() * Intellect / 500.0f;
// Add regen bonus from level in this dummy
power_regen_mp5 += getLevel() * 35 / 100;
}
diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp
index e233f7de075..c6e68ad2cbd 100644
--- a/src/game/TaxiHandler.cpp
+++ b/src/game/TaxiHandler.cpp
@@ -89,7 +89,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes( WorldPacket & recv_data )
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
// unknown taxi node case
if( SendLearnNewTaxiNode(unit) )
@@ -123,7 +123,7 @@ void WorldSession::SendDoFlight( uint16 MountId, uint32 path, uint32 pathNode )
{
// remove fake death
if(GetPlayer()->hasUnitState(UNIT_STAT_DIED))
- GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
+ GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
while(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType()==FLIGHT_MOTION_TYPE)
GetPlayer()->GetMotionMaster()->MovementExpired(false);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index f607d24cb6d..a9ce2cae1d0 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -99,7 +99,6 @@ Unit::Unit()
m_state = 0;
m_form = FORM_NONE;
m_deathState = ALIVE;
- m_auraUpdateMask = 0;
for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
m_currentSpells[i] = NULL;
@@ -202,7 +201,6 @@ void Unit::Update( uint32 p_time )
_UpdateAura();
}else
m_AurasCheck -= p_time;*/
- UpdateAuras();
// WARNING! Order of execution here is important, do not change.
// Spells must be processed with event system BEFORE they go to _UpdateSpells.
@@ -247,22 +245,6 @@ void Unit::Update( uint32 p_time )
i_motionMaster.UpdateMotion(p_time);
}
-void Unit::UpdateAuras()
-{
- const uint64& auramask = GetAuraUpdateMask();
- if (auramask)
- {
- for(uint32 i = 0; i < MAX_AURAS; ++i)
- {
- if(auramask & (uint64(1) << i))
- {
- SendAuraUpdate(i);
- }
- }
- ResetAuraUpdateMask();
- }
-}
-
bool Unit::haveOffhandWeapon() const
{
if(GetTypeId() == TYPEID_PLAYER)
@@ -478,70 +460,6 @@ void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z,
, GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * (float)attacker_number / combat_reach / 3 : 0));
}
-void Unit::RemoveSpellsCausingAura(AuraType auraType)
-{
- if (auraType >= TOTAL_AURAS) return;
- AuraList::iterator iter, next;
- for (iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); iter = next)
- {
- next = iter;
- ++next;
-
- if (*iter)
- {
- RemoveAurasDueToSpell((*iter)->GetId());
- if (!m_modAuras[auraType].empty())
- next = m_modAuras[auraType].begin();
- else
- return;
- }
- }
-}
-
-void Unit::RemoveAuraTypeByCaster(AuraType auraType, uint64 casterGUID)
-{
- if (auraType >= TOTAL_AURAS) return;
- AuraList::iterator iter, next;
- for(iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); iter = next)
- {
- next = iter;
- ++next;
-
- if (*iter)
- {
- RemoveAurasByCasterSpell((*iter)->GetId(), casterGUID);
- continue;
- RemoveAurasDueToSpell((*iter)->GetId());
- if (!m_modAuras[auraType].empty())
- next = m_modAuras[auraType].begin();
- else
- return;
- }
- }
-}
-
-void Unit::RemoveSpellsCausingAuraWithDispel(AuraType auraType, Spell * spell)
-{
- if (auraType >= TOTAL_AURAS) return;
- DispelEntry entry;
- DispelSet dispel_list;
- AuraList::iterator iter;
- for (iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); ++iter)
- {
- entry.casterGuid = (*iter)->GetCasterGUID();
- entry.spellId = (*iter)->GetId();
- entry.caster = (*iter)->GetCaster();
- dispel_list.insert (entry);
- }
-
- for(DispelSet::iterator itr = dispel_list.begin(); itr != dispel_list.end(); ++itr)
- {
- entry = *itr;
- if (GetDispelChance(spell, entry.caster, entry.spellId))
- RemoveAurasByCasterSpell(entry.spellId, entry.casterGuid);
- }
-}
-
void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
{
if(!(m_interruptMask & flag))
@@ -561,7 +479,7 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
sLog.outError("Aura %u is trying to remove itself! Flag %u. May cause crash!", (*iter)->GetId(), flag);
else if(!except || (*iter)->GetId() != except)
{
- RemoveAurasBySpell((*iter)->GetId(), AURA_REMOVE_BY_CANCEL);
+ RemoveAurasDueToSpell((*iter)->GetId(), NULL, AURA_REMOVE_BY_CANCEL);
if (!m_interruptableAuras.empty())
next = m_interruptableAuras.begin();
else
@@ -593,11 +511,6 @@ void Unit::UpdateInterruptMask()
m_interruptMask |= spell->m_spellInfo->ChannelInterruptFlags;
}
-bool Unit::HasAuraType(AuraType auraType) const
-{
- return (!m_modAuras[auraType].empty());
-}
-
/* Called by DealDamage for auras that have a chance to be dispelled on damage taken. */
void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell)
{
@@ -1083,7 +996,7 @@ void Unit::CastStop(uint32 except_spellid)
InterruptSpell(i,false);
}
-void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
@@ -1096,7 +1009,7 @@ void Unit::CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castIte
CastSpell(Victim,spellInfo,triggered,castItem,triggeredByAura, originalCaster);
}
-void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster)
{
if(!spellInfo)
{
@@ -1150,7 +1063,7 @@ void Unit::CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, I
spell->prepare(&targets, triggeredByAura);
}
-void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster)
+void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
@@ -1163,7 +1076,7 @@ void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32
CastCustomSpell(Victim,spellInfo,bp0,bp1,bp2,triggered,castItem,triggeredByAura, originalCaster);
}
-void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster)
+void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster)
{
if(!spellInfo)
{
@@ -1214,7 +1127,7 @@ void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const
}
// used for scripting
-void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
@@ -1239,7 +1152,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered,
}
// used for scripting
-void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem, Aura* triggeredByAura, uint64 originalCaster)
+void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem, AuraEffect* triggeredByAura, uint64 originalCaster)
{
if(!go)
return;
@@ -1403,16 +1316,16 @@ int32 Unit::GetIgnoredArmorMultiplier(SpellEntry const *spellInfo, WeaponAttackT
if (!item)
return 0;
- AuraList const& armAuras = GetAurasByType(SPELL_AURA_MOD_WEAPONTYPE_IGNORE_TARGET_RESISTANCE);
+ AuraEffectList const& armAuras = GetAurasByType(SPELL_AURA_MOD_WEAPONTYPE_IGNORE_TARGET_RESISTANCE);
int32 armorIgnored = 0;
- for(AuraList::const_iterator i = armAuras.begin();i != armAuras.end(); ++i)
+ for(AuraEffectList::const_iterator i = armAuras.begin();i != armAuras.end(); ++i)
{
if (!((*i)->GetSpellProto()->EquippedItemClass==item->GetProto()->Class
&& (*i)->GetSpellProto()->EquippedItemSubClassMask & (1<<item->GetProto()->SubClass)))
continue;
- if((*i)->GetModifier()->m_amount)
- armorIgnored += (*i)->GetModifier()->m_amount;
+ if((*i)->GetAmount())
+ armorIgnored += (*i)->GetAmount();
}
return (-armorIgnored);
}
@@ -1762,16 +1675,16 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
}
// victim's damage shield
- std::set<Aura*> alreadyDone;
+ std::set<AuraEffect*> alreadyDone;
uint32 removedAuras = pVictim->m_removedAuras;
- AuraList const& vDamageShields = pVictim->GetAurasByType(SPELL_AURA_DAMAGE_SHIELD);
- for(AuraList::const_iterator i = vDamageShields.begin(), next = vDamageShields.begin(); i != vDamageShields.end(); i = next)
+ AuraEffectList const& vDamageShields = pVictim->GetAurasByType(SPELL_AURA_DAMAGE_SHIELD);
+ for(AuraEffectList::const_iterator i = vDamageShields.begin(), next = vDamageShields.begin(); i != vDamageShields.end(); i = next)
{
next++;
if (alreadyDone.find(*i) == alreadyDone.end())
{
alreadyDone.insert(*i);
- uint32 damage=(*i)->GetModifier()->m_amount;
+ uint32 damage=(*i)->GetAmount();
SpellEntry const *spellProto = sSpellStore.LookupEntry((*i)->GetId());
if(!spellProto)
continue;
@@ -1823,19 +1736,19 @@ uint32 Unit::CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEnt
if(Player *modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor);
- AuraList const& ResIgnoreAurasAb = GetAurasByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
- for(AuraList::const_iterator j = ResIgnoreAurasAb.begin();j != ResIgnoreAurasAb.end(); ++j)
+ AuraEffectList const& ResIgnoreAurasAb = GetAurasByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
+ for(AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin();j != ResIgnoreAurasAb.end(); ++j)
{
- if( (*j)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL
+ if( (*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL
&& (*j)->isAffectedOnSpell(spellInfo))
- armor= int32(float(armor) * (float(100-(*j)->GetModifier()->m_amount)/100.0f));
+ armor= int32(float(armor) * (float(100-(*j)->GetAmount())/100.0f));
}
- AuraList const& ResIgnoreAuras = GetAurasByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
- for(AuraList::const_iterator j = ResIgnoreAuras.begin();j != ResIgnoreAuras.end(); ++j)
+ AuraEffectList const& ResIgnoreAuras = GetAurasByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
+ for(AuraEffectList::const_iterator j = ResIgnoreAuras.begin();j != ResIgnoreAuras.end(); ++j)
{
- if( (*j)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
- armor= int32(float(armor) * (float(100-(*j)->GetModifier()->m_amount)/100.0f));
+ if( (*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
+ armor= int32(float(armor) * (float(100-(*j)->GetAmount())/100.0f));
}
// Apply Player CR_ARMOR_PENETRATION rating
@@ -1897,19 +1810,19 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
if(*resist > damage)
*resist = damage;
- AuraList const& ResIgnoreAurasAb = GetAurasByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
- for(AuraList::const_iterator j = ResIgnoreAurasAb.begin();j != ResIgnoreAurasAb.end(); ++j)
+ AuraEffectList const& ResIgnoreAurasAb = GetAurasByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST);
+ for(AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin();j != ResIgnoreAurasAb.end(); ++j)
{
- if( (*j)->GetModifier()->m_miscvalue & schoolMask
+ if( (*j)->GetMiscValue() & schoolMask
&& (*j)->isAffectedOnSpell(spellInfo))
- *resist= int32(float(*resist) * (float(100-(*j)->GetModifier()->m_amount)/100.0f));
+ *resist= int32(float(*resist) * (float(100-(*j)->GetAmount())/100.0f));
}
- AuraList const& ResIgnoreAuras = GetAurasByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
- for(AuraList::const_iterator j = ResIgnoreAuras.begin();j != ResIgnoreAuras.end(); ++j)
+ AuraEffectList const& ResIgnoreAuras = GetAurasByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST);
+ for(AuraEffectList::const_iterator j = ResIgnoreAuras.begin();j != ResIgnoreAuras.end(); ++j)
{
- if( (*j)->GetModifier()->m_miscvalue & schoolMask)
- *resist= int32(float(*resist) * (float(100-(*j)->GetModifier()->m_amount)/100.0f));
+ if( (*j)->GetMiscValue() & schoolMask)
+ *resist= int32(float(*resist) * (float(100-(*j)->GetAmount())/100.0f));
}
}
else
@@ -1928,17 +1841,16 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
// Need remove expired auras after
bool existExpired = false;
// absorb without mana cost
- AuraList const& vSchoolAbsorb = pVictim->GetAurasByType(SPELL_AURA_SCHOOL_ABSORB);
- for(AuraList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end() && RemainingDamage > 0; ++i)
+ AuraEffectList const& vSchoolAbsorb = pVictim->GetAurasByType(SPELL_AURA_SCHOOL_ABSORB);
+ for(AuraEffectList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end() && RemainingDamage > 0; ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if (!(mod->m_miscvalue & schoolMask))
+ if (!((*i)->GetMiscValue() & schoolMask))
continue;
SpellEntry const* spellProto = (*i)->GetSpellProto();
// Max Amount can be absorbed by this aura
- int32 currentAbsorb = mod->m_amount;
+ int32 currentAbsorb = (*i)->GetAmount();
// Found empty aura (impossible but..)
if (currentAbsorb <=0)
@@ -2039,7 +1951,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
healAmount = pVictim->GetMaxHealth()/2;
healCaster = pVictim;
healSpell = 48153;
- mod->m_amount=0;
+ (*i)->SetAmount(0);
RemainingDamage=0;
}
continue;
@@ -2053,21 +1965,21 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
Unit* caster = (*i)->GetCaster();
if (!caster)
break;
- AuraList const& vOverRideCS = caster->GetAurasByType(SPELL_AURA_DUMMY);
- for(AuraList::const_iterator k = vOverRideCS.begin(); k != vOverRideCS.end(); ++k)
+ AuraEffectList const& vOverRideCS = caster->GetAurasByType(SPELL_AURA_DUMMY);
+ for(AuraEffectList::const_iterator k = vOverRideCS.begin(); k != vOverRideCS.end(); ++k)
{
if((*k)->GetSpellProto()->SpellFamilyName != SPELLFAMILY_PRIEST)
continue;
- switch((*k)->GetModifier()->m_miscvalue)
+ switch((*k)->GetMiscValue())
{
case 5065: // Rank 1
case 5064: // Rank 2
case 5063: // Rank 3
{
if(RemainingDamage >= currentAbsorb)
- reflectDamage = (*k)->GetModifier()->m_amount * currentAbsorb/100;
+ reflectDamage = (*k)->GetAmount() * currentAbsorb/100;
else
- reflectDamage = (*k)->GetModifier()->m_amount * RemainingDamage/100;
+ reflectDamage = (*k)->GetAmount() * RemainingDamage/100;
reflectSpell = 33619;
} break;
}
@@ -2083,10 +1995,10 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
if (!healCaster)
break;
- AuraList const& lOverRideCS = pVictim->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for(AuraList::const_iterator k = lOverRideCS.begin(); k != lOverRideCS.end(); ++k)
+ AuraEffectList const& lOverRideCS = pVictim->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(AuraEffectList::const_iterator k = lOverRideCS.begin(); k != lOverRideCS.end(); ++k)
{
- switch((*k)->GetModifier()->m_miscvalue)
+ switch((*k)->GetMiscValue())
{
case 7556: // Rank 1
case 7555: // Rank 2
@@ -2097,8 +2009,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
healSpell = 47755;
healAmount += ((pVictim->getLevel() * (-0.2) + 18) / 1000000) * currentAbsorb * pVictim->GetMaxPower(POWER_MANA);
// limitation based on aura amount
- if(healAmount > pVictim->GetMaxPower(POWER_MANA) * (*k)->GetModifier()->m_amount / 1000)
- healAmount = pVictim->GetMaxPower(POWER_MANA) * (*k)->GetModifier()->m_amount / 1000;
+ if(healAmount > pVictim->GetMaxPower(POWER_MANA) * (*k)->GetAmount() / 1000)
+ healAmount = pVictim->GetMaxPower(POWER_MANA) * (*k)->GetAmount() / 1000;
} break;
}
}
@@ -2132,7 +2044,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
// This, if I'm not mistaken, shows that we get back ~2% of the absorbed damage as runic power.
int32 absorbed = RemainingDamage * currentAbsorb / 100;
int32 regen = absorbed * 2 / 10;
- pVictim->CastCustomSpell(pVictim, 49088, &regen, 0, 0, true, 0, *i);
+ pVictim->CastCustomSpell(pVictim, 49088, &regen, 0, 0, true, 0, (*i));
RemainingDamage -= absorbed;
continue;
}
@@ -2170,9 +2082,9 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
RemainingDamage -= currentAbsorb;
// Reduce shield amount
- mod->m_amount-=currentAbsorb;
+ (*i)->SetAmount((*i)->GetAmount() -currentAbsorb);
// Need remove it later
- if (mod->m_amount<=0)
+ if ((*i)->GetAmount()<=0)
existExpired = true;
}
if(healSpell && healCaster)
@@ -2181,11 +2093,11 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
// Remove all expired absorb auras
if (existExpired)
{
- for(AuraList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end();)
+ for(AuraEffectList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end();)
{
- if ((*i)->GetModifier()->m_amount<=0)
+ if ((*i)->GetAmount()<=0)
{
- pVictim->RemoveAurasByCasterSpell((*i)->GetId(), (*i)->GetCasterGUID(), AURA_REMOVE_BY_ENEMY_SPELL);
+ pVictim->RemoveAurasDueToSpell((*i)->GetId(), (*i)->GetCasterGUID(), AURA_REMOVE_BY_ENEMY_SPELL);
i = vSchoolAbsorb.begin();
}
else
@@ -2197,18 +2109,18 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
pVictim->CastCustomSpell(this, reflectSpell, &reflectDamage, NULL, NULL, true);
// absorb by mana cost
- AuraList const& vManaShield = pVictim->GetAurasByType(SPELL_AURA_MANA_SHIELD);
- for(AuraList::const_iterator i = vManaShield.begin(), next; i != vManaShield.end() && RemainingDamage > 0; i = next)
+ AuraEffectList const& vManaShield = pVictim->GetAurasByType(SPELL_AURA_MANA_SHIELD);
+ for(AuraEffectList::const_iterator i = vManaShield.begin(), next; i != vManaShield.end() && RemainingDamage > 0; i = next)
{
next = i; ++next;
// check damage school mask
- if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
+ if(((*i)->GetMiscValue() & schoolMask)==0)
continue;
int32 currentAbsorb;
- if (RemainingDamage >= (*i)->GetModifier()->m_amount)
- currentAbsorb = (*i)->GetModifier()->m_amount;
+ if (RemainingDamage >= (*i)->GetAmount())
+ currentAbsorb = (*i)->GetAmount();
else
currentAbsorb = RemainingDamage;
@@ -2220,8 +2132,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
if (currentAbsorb > maxAbsorb)
currentAbsorb = maxAbsorb;
- (*i)->GetModifier()->m_amount -= currentAbsorb;
- if((*i)->GetModifier()->m_amount <= 0)
+ (*i)->SetAmount((*i)->GetAmount()-currentAbsorb);
+ if((*i)->GetAmount() <= 0)
{
pVictim->RemoveAurasDueToSpell((*i)->GetId());
next = vManaShield.begin();
@@ -2236,13 +2148,13 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
// only split damage if not damaging yourself
if(pVictim != this)
{
- AuraList const& vSplitDamageFlat = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_FLAT);
- for(AuraList::const_iterator i = vSplitDamageFlat.begin(), next; i != vSplitDamageFlat.end() && RemainingDamage >= 0; i = next)
+ AuraEffectList const& vSplitDamageFlat = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_FLAT);
+ for(AuraEffectList::const_iterator i = vSplitDamageFlat.begin(), next; i != vSplitDamageFlat.end() && RemainingDamage >= 0; i = next)
{
next = i; ++next;
// check damage school mask
- if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
+ if(((*i)->GetMiscValue() & schoolMask)==0)
continue;
// Damage can be splitted only if aura has an alive caster
@@ -2251,8 +2163,8 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
continue;
int32 currentAbsorb;
- if (RemainingDamage >= (*i)->GetModifier()->m_amount)
- currentAbsorb = (*i)->GetModifier()->m_amount;
+ if (RemainingDamage >= (*i)->GetAmount())
+ currentAbsorb = (*i)->GetAmount();
else
currentAbsorb = RemainingDamage;
@@ -2264,13 +2176,13 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
DealDamage(caster, currentAbsorb, &cleanDamage, DIRECT_DAMAGE, schoolMask, (*i)->GetSpellProto(), false);
}
- AuraList const& vSplitDamagePct = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
- for(AuraList::const_iterator i = vSplitDamagePct.begin(), next; i != vSplitDamagePct.end() && RemainingDamage >= 0; i = next)
+ AuraEffectList const& vSplitDamagePct = pVictim->GetAurasByType(SPELL_AURA_SPLIT_DAMAGE_PCT);
+ for(AuraEffectList::const_iterator i = vSplitDamagePct.begin(), next; i != vSplitDamagePct.end() && RemainingDamage >= 0; i = next)
{
next = i; ++next;
// check damage school mask
- if(((*i)->GetModifier()->m_miscvalue & schoolMask)==0)
+ if(((*i)->GetMiscValue() & schoolMask)==0)
continue;
// Damage can be splitted only if aura has an alive caster
@@ -2278,7 +2190,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
if(!caster || caster == pVictim || !caster->IsInWorld() || !caster->isAlive())
continue;
- int32 splitted = int32(RemainingDamage * (*i)->GetModifier()->m_amount / 100.0f);
+ int32 splitted = int32(RemainingDamage * (*i)->GetAmount() / 100.0f);
RemainingDamage -= splitted;
@@ -2292,12 +2204,12 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
TotalAbsorb = (TotalAbsorb - RemainingDamage > 0) ? TotalAbsorb - RemainingDamage : 0;
// TODO: School should be checked for absorbing auras or for attacks?
int32 auraAbsorbMod = GetMaxPositiveAuraModifier(SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL);
- AuraList const& AbsIgnoreAurasAb = GetAurasByType(SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL);
- for(AuraList::const_iterator i = AbsIgnoreAurasAb.begin();i != AbsIgnoreAurasAb.end(); ++i)
+ AuraEffectList const& AbsIgnoreAurasAb = GetAurasByType(SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL);
+ for(AuraEffectList::const_iterator i = AbsIgnoreAurasAb.begin();i != AbsIgnoreAurasAb.end(); ++i)
{
- if ((*i)->GetModifier()->m_amount > auraAbsorbMod
+ if ((*i)->GetAmount() > auraAbsorbMod
&& (*i)->isAffectedOnSpell(spellInfo))
- auraAbsorbMod = (*i)->GetModifier()->m_amount;
+ auraAbsorbMod = (*i)->GetAmount();
}
// Ignore absorb - add reduced amount again to damage
@@ -2310,20 +2222,21 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
bool found = false;
int32 spell_dmg=0;
// Incanter's Absorption
- AuraList const& DummmyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
- for(AuraList::const_iterator i = DummmyAuras.begin(); i != DummmyAuras.end(); ++i)
+ AuraEffectList const& DummmyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
+ for(AuraEffectList::const_iterator i = DummmyAuras.begin(); i != DummmyAuras.end(); ++i)
{
SpellEntry const* spellInfo = (*i)->GetSpellProto();
if (spellmgr.GetFirstSpellInChain(spellInfo->Id) == 44394)
{
int32 total_dmg=0;
// Get total bonus from auras
- spellEffectPair spair = spellEffectPair(44413, 0);
- for(AuraMap::const_iterator itr = pVictim->GetAuras().lower_bound(spair); itr != pVictim->GetAuras().upper_bound(spair); ++itr)
+ AuraEffectList const& BonusAuras = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
+ for(AuraEffectList::const_iterator itr = BonusAuras.begin(); itr != BonusAuras.end(); ++itr)
{
- total_dmg += itr->second->GetModifier()->m_miscvalue;
+ if ((*itr)->GetId()==44413)
+ total_dmg += (*itr)->GetMiscValue();
}
- spell_dmg = int32(*absorb * (*i)->GetModifier()->m_amount / 100);
+ spell_dmg = int32(*absorb * (*i)->GetAmount() / 100);
// Do not apply more auras if more than 5% hp
if(total_dmg+spell_dmg > int32(GetMaxHealth() * 5 / 100))
break;
@@ -2677,7 +2590,7 @@ bool Unit::isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAtt
{
if (!(*i)->isAffectedOnSpell(spellProto))
continue;
- if ((*i)->GetModifier()->m_miscvalue == )
+ if ((*i)->GetMiscValue() == )
return false;
}
*/
@@ -2824,18 +2737,18 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell)
canParry = false;
}
// Ignore combat result aura
- AuraList const& ignore = GetAurasByType(SPELL_AURA_IGNORE_COMBAT_RESULT);
- for(AuraList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
+ AuraEffectList const& ignore = GetAurasByType(SPELL_AURA_IGNORE_COMBAT_RESULT);
+ for(AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
{
if (!(*i)->isAffectedOnSpell(spell))
continue;
- switch((*i)->GetModifier()->m_miscvalue)
+ switch((*i)->GetMiscValue())
{
case MELEE_HIT_DODGE: canDodge = false; break;
case MELEE_HIT_BLOCK: break; // Block check in hit step
case MELEE_HIT_PARRY: canParry = false; break;
default:
- DEBUG_LOG("Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT have unhandled state %d", (*i)->GetId(), (*i)->GetModifier()->m_miscvalue);
+ DEBUG_LOG("Spell %u SPELL_AURA_IGNORE_COMBAT_RESULT have unhandled state %d", (*i)->GetId(), (*i)->GetMiscValue());
break;
}
}
@@ -2996,10 +2909,10 @@ SpellMissInfo Unit::SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool
if (CanReflect)
{
int32 reflectchance = pVictim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
- Unit::AuraList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
- for(Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
- if((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spell))
- reflectchance += (*i)->GetModifier()->m_amount;
+ Unit::AuraEffectList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
+ for(Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
+ if((*i)->GetMiscValue() & GetSpellSchoolMask(spell))
+ reflectchance += (*i)->GetAmount();
if (reflectchance > 0 && roll_chance_i(reflectchance))
{
// Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
@@ -3334,8 +3247,8 @@ void Unit::_UpdateSpells( uint32 time )
if ((*i).second)
{
if ( !(*i).second->GetAuraDuration() && !((*i).second->IsPermanent() || ((*i).second->IsPassive())) )
- {
- RemoveAura(i);
+ {
+ RemoveAura(i, AURA_REMOVE_BY_EXPIRE);
}
else
{
@@ -3618,23 +3531,13 @@ void Unit::DeMorph()
SetDisplayId(GetNativeDisplayId());
}
-bool Unit::HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const
-{
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
- if (miscvalue == (*i)->GetModifier()->m_miscvalue)
- return true;
-
- return false;
-}
-
int32 Unit::GetTotalAuraModifier(AuraType auratype) const
{
int32 modifier = 0;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
- modifier += (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ modifier += (*i)->GetAmount();
return modifier;
}
@@ -3643,21 +3546,23 @@ float Unit::GetTotalAuraMultiplier(AuraType auratype) const
{
float multiplier = 1.0f;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
- multiplier *= (100.0f + (*i)->GetModifier()->m_amount)/100.0f;
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ multiplier *= (100.0f + (*i)->GetAmount())/100.0f;
return multiplier;
}
-int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype) const
+int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype)
{
int32 modifier = 0;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
- if ((*i)->GetModifier()->m_amount > modifier)
- modifier = (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ {
+ if ((*i)->GetAmount() > modifier)
+ modifier = (*i)->GetAmount();
+ }
return modifier;
}
@@ -3666,10 +3571,10 @@ int32 Unit::GetMaxNegativeAuraModifier(AuraType auratype) const
{
int32 modifier = 0;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
- if ((*i)->GetModifier()->m_amount < modifier)
- modifier = (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ if ((*i)->GetAmount() < modifier)
+ modifier = (*i)->GetAmount();
return modifier;
}
@@ -3678,12 +3583,11 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask)
{
int32 modifier = 0;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if (mod->m_miscvalue & misc_mask)
- modifier += mod->m_amount;
+ if ((*i)->GetMiscValue()& misc_mask)
+ modifier += (*i)->GetAmount();
}
return modifier;
}
@@ -3692,12 +3596,11 @@ float Unit::GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask
{
float multiplier = 1.0f;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if (mod->m_miscvalue & misc_mask)
- multiplier *= (100.0f + mod->m_amount)/100.0f;
+ if ((*i)->GetMiscValue()& misc_mask)
+ multiplier *= (100.0f + (*i)->GetAmount())/100.0f;
}
return multiplier;
}
@@ -3706,12 +3609,11 @@ int32 Unit::GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_
{
int32 modifier = 0;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if (mod->m_miscvalue & misc_mask && mod->m_amount > modifier)
- modifier = mod->m_amount;
+ if ((*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() > modifier)
+ modifier = (*i)->GetAmount();
}
return modifier;
@@ -3721,12 +3623,11 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_
{
int32 modifier = 0;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if (mod->m_miscvalue & misc_mask && mod->m_amount < modifier)
- modifier = mod->m_amount;
+ if ((*i)->GetMiscValue()& misc_mask && (*i)->GetAmount() < modifier)
+ modifier = (*i)->GetAmount();
}
return modifier;
@@ -3736,12 +3637,11 @@ int32 Unit::GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value)
{
int32 modifier = 0;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if (mod->m_miscvalue == misc_value)
- modifier += mod->m_amount;
+ if ((*i)->GetMiscValue()== misc_value)
+ modifier += (*i)->GetAmount();
}
return modifier;
}
@@ -3750,12 +3650,11 @@ float Unit::GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_valu
{
float multiplier = 1.0f;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if (mod->m_miscvalue == misc_value)
- multiplier *= (100.0f + mod->m_amount)/100.0f;
+ if ((*i)->GetMiscValue()== misc_value)
+ multiplier *= (100.0f + (*i)->GetAmount())/100.0f;
}
return multiplier;
}
@@ -3764,12 +3663,11 @@ int32 Unit::GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_
{
int32 modifier = 0;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if (mod->m_miscvalue == misc_value && mod->m_amount > modifier)
- modifier = mod->m_amount;
+ if ((*i)->GetMiscValue()== misc_value && (*i)->GetAmount() > modifier)
+ modifier = (*i)->GetAmount();
}
return modifier;
@@ -3779,12 +3677,11 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_
{
int32 modifier = 0;
- AuraList const& mTotalAuraList = GetAurasByType(auratype);
- for(AuraList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
{
- Modifier* mod = (*i)->GetModifier();
- if (mod->m_miscvalue == misc_value && mod->m_amount < modifier)
- modifier = mod->m_amount;
+ if ((*i)->GetMiscValue()== misc_value && (*i)->GetAmount() < modifier)
+ modifier = (*i)->GetAmount();
}
return modifier;
@@ -3792,6 +3689,13 @@ int32 Unit::GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_
bool Unit::AddAura(Aura *Aur)
{
+ // aura doesn't apply effects-return
+ if (!Aur->GetEffectMask())
+ {
+ delete Aur;
+ return false;
+ }
+
// ghost spell check, allow apply any auras at player loading in ghost mode (will be cleanup after load)
if( !isAlive() && Aur->GetId() != 20584 && Aur->GetId() != 8326 && Aur->GetId() != 2584 &&
(GetTypeId()!=TYPEID_PLAYER || !((Player*)this)->GetSession()->PlayerLoading()) )
@@ -3802,8 +3706,8 @@ bool Unit::AddAura(Aura *Aur)
if(Aur->GetTarget() != this)
{
- sLog.outError("Aura (spell %u eff %u) add to aura list of %s (lowguid: %u) but Aura target is %s (lowguid: %u)",
- Aur->GetId(),Aur->GetEffIndex(),(GetTypeId()==TYPEID_PLAYER?"player":"creature"),GetGUIDLow(),
+ sLog.outError("Aura (spell %u) add to aura list of %s (lowguid: %u) but Aura target is %s (lowguid: %u)",
+ Aur->GetId(),(GetTypeId()==TYPEID_PLAYER?"player":"creature"),GetGUIDLow(),
(Aur->GetTarget()->GetTypeId()==TYPEID_PLAYER?"player":"creature"),Aur->GetTarget()->GetGUIDLow());
delete Aur;
return false;
@@ -3811,50 +3715,16 @@ bool Unit::AddAura(Aura *Aur)
SpellEntry const* aurSpellInfo = Aur->GetSpellProto();
- spellEffectPair spair = spellEffectPair(Aur->GetId(), Aur->GetEffIndex());
-
- bool stackModified=false;
// passive and persistent auras can stack with themselves any number of times
- if (!Aur->IsPassive() && !Aur->IsPersistent() && Aur->GetId()!=44413)
+ if (!Aur->IsPassive() && !Aur->IsPersistent() && aurSpellInfo->StackAmount>1)
{
- for(AuraMap::iterator i2 = m_Auras.lower_bound(spair); i2 != m_Auras.upper_bound(spair);)
+ // find current aura from spell and change it's stackamount
+ if (Aura * foundAura = GetAura(aurSpellInfo->Id,Aur->GetCasterGUID()))
{
- if(i2->second->GetCasterGUID()==Aur->GetCasterGUID())
- {
- if (!stackModified)
- {
- // replace aura if next will > spell StackAmount
- if(aurSpellInfo->StackAmount)
- {
- // prevent adding stack more than once
- stackModified=true;
- Aur->InitStackAmount(i2->second->GetStackAmount());
- if(Aur->GetStackAmount() < aurSpellInfo->StackAmount)
- Aur->InitStackAmount(Aur->GetStackAmount()+1);
- }
- RemoveAura(i2,AURA_REMOVE_BY_DELETE);
- i2=m_Auras.lower_bound(spair);
- continue;
- }
- }
- switch(aurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()])
- {
- // DOT or HOT from different casters will stack
- case SPELL_AURA_PERIODIC_DAMAGE:
- case SPELL_AURA_PERIODIC_HEAL:
- case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
- case SPELL_AURA_PERIODIC_ENERGIZE:
- case SPELL_AURA_PERIODIC_MANA_LEECH:
- case SPELL_AURA_PERIODIC_LEECH:
- case SPELL_AURA_POWER_BURN_MANA:
- case SPELL_AURA_OBS_MOD_ENERGY:
- case SPELL_AURA_OBS_MOD_HEALTH:
- ++i2;
- continue;
- }
- RemoveAura(i2,AURA_REMOVE_BY_DELETE);
- i2=m_Auras.lower_bound(spair);
- continue;
+ if(foundAura->GetStackAmount() < aurSpellInfo->StackAmount)
+ foundAura->SetStackAmount(foundAura->GetStackAmount()+1);
+ delete Aur;
+ return true;
}
}
@@ -3887,10 +3757,10 @@ bool Unit::AddAura(Aura *Aur)
{
if ((*itr)->IsInUse())
{
- sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for IsSingleTargetSpell", (*itr)->GetId(), (*itr)->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex());
+ sLog.outError("Aura (Spell %u) is in process but attempt removed at aura (Spell %u) adding, need add stack rule for IsSingleTargetSpell", (*itr)->GetId(),Aur->GetId());
continue;
}
- (*itr)->GetTarget()->RemoveAurasByCasterSpell((*itr)->GetId(),(*itr)->GetEffIndex(), caster->GetGUID(), AURA_REMOVE_BY_DELETE);
+ (*itr)->GetTarget()->RemoveAurasDueToSpell((*itr)->GetId(), caster->GetGUID(), AURA_REMOVE_BY_STACK);
restart = true;
break;
}
@@ -3907,69 +3777,26 @@ bool Unit::AddAura(Aura *Aur)
// add aura, register in lists and arrays
Aur->_AddAura();
- m_Auras.insert(AuraMap::value_type(spellEffectPair(Aur->GetId(), Aur->GetEffIndex()), Aur));
- if (Aur->GetModifier()->m_auraname < TOTAL_AURAS)
+ m_Auras.insert(AuraMap::value_type(Aur->GetId(), Aur));
+
+ if(Aur->GetSpellProto()->AuraInterruptFlags)
{
- m_modAuras[Aur->GetModifier()->m_auraname].push_back(Aur);
- if(Aur->GetSpellProto()->AuraInterruptFlags)
- {
- m_interruptableAuras.push_back(Aur);
- AddInterruptMask(Aur->GetSpellProto()->AuraInterruptFlags);
- }
- if((Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE
- && Aur->GetModifier()->m_auraname != SPELL_AURA_MOD_POSSESS) //only dummy aura is breakable
- || (Aur->GetSpellProto()->Mechanic==MECHANIC_KNOCKOUT && Aur->GetModifier()->m_auraname==SPELL_AURA_MOD_STUN))
- {
- m_ccAuras.push_back(Aur);
- }
+ m_interruptableAuras.push_back(Aur);
+ AddInterruptMask(Aur->GetSpellProto()->AuraInterruptFlags);
+ }
+ if((Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE
+ && !Aur->IsAuraType(SPELL_AURA_MOD_POSSESS)) //only dummy aura is breakable
+ || (Aur->GetSpellProto()->Mechanic==MECHANIC_KNOCKOUT && Aur->IsAuraType(SPELL_AURA_MOD_STUN)))
+ {
+ m_ccAuras.push_back(Aur);
}
- Aur->ApplyModifier(true,true);
+ Aur->HandleEffects(true);
- sLog.outDebug("Aura %u now is in use", Aur->GetModifier()->m_auraname);
+ sLog.outDebug("Aura %u now is in use", Aur->GetId());
return true;
}
-void Unit::RemoveRankAurasDueToSpell(uint32 spellId)
-{
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
- if(!spellInfo)
- return;
- AuraMap::iterator i,next;
- for (i = m_Auras.begin(); i != m_Auras.end(); i = next)
- {
- next = i;
- ++next;
- uint32 i_spellId = (*i).second->GetId();
- if((*i).second && i_spellId && i_spellId != spellId)
- {
- if(spellmgr.IsRankSpellDueToSpell(spellInfo,i_spellId))
- {
- // Remove all auras by aura caster
- for (uint8 a=0;a<3;++a)
- {
- spellEffectPair spair = spellEffectPair((*i).second->GetId(), a);
- for(AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
- {
- if(iter->second->GetCasterGUID()==(*i).second->GetCasterGUID())
- {
- RemoveAura(iter, AURA_REMOVE_BY_DELETE);
- iter = m_Auras.lower_bound(spair);
- }
- else
- ++iter;
- }
- }
-
- if( m_Auras.empty() )
- break;
- else
- next = m_Auras.begin();
- }
- }
- }
-}
-
bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
{
if (!Aur)
@@ -3980,7 +3807,6 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
return false;
uint32 spellId = Aur->GetId();
- uint32 effIndex = Aur->GetEffIndex();
// passive spell special case (only non stackable with ranks)
if(IsPassiveSpell(spellId))
@@ -4007,9 +3833,6 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
uint32 i_spellId = i_spellProto->Id;
- if (spellId==i_spellId)
- continue;
-
if(IsPassiveSpell(i_spellId))
{
// passive non-stackable spells not stackable only for same caster
@@ -4021,18 +3844,12 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
continue;
}
- uint32 i_effIndex = (*i).second->GetEffIndex();
-
bool is_triggered_by_spell = false;
// prevent triggered aura of removing aura that triggered it
for(int j = 0; j < 3; ++j)
if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id)
is_triggered_by_spell = true;
- for(int j = 0; j < 3; ++j)
- if (i_spellProto->EffectTriggerSpell[j] == spellProto->Id)
- is_triggered_by_spell = true;
-
// check if they can stack
bool sameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID();
@@ -4057,35 +3874,21 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
//some spells should be not removed by lower rank of them (totem, paladin aura)
if (!sameCaster
- &&(spellProto->Effect[effIndex]==SPELL_EFFECT_APPLY_AREA_AURA_PARTY)
+ &&(Aur->IsAreaAura())
&&(spellProto->DurationIndex==21)
&&(spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId))
- &&(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0))
+ &&(IsHigherHankOfSpell(spellId,i_spellId)))
return false;
// Its a parent aura (create this aura in ApplyModifier)
if ((*i).second->IsInUse())
{
- sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex());
+ sLog.outError("Aura (Spell %u) is in process but attempt removed at aura (Spell %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(),Aur->GetId());
continue;
}
- uint64 caster = (*i).second->GetCasterGUID();
- // Remove all auras by aura caster
- for (uint8 a=0;a<3;++a)
- {
- spellEffectPair spair = spellEffectPair(i_spellId, a);
- for(AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
- {
- if(iter->second->GetCasterGUID()==caster)
- {
- RemoveAura(iter, AURA_REMOVE_BY_DELETE);
- iter = m_Auras.lower_bound(spair);
- }
- else
- ++iter;
- }
- }
+ // Remove all auras by aura caster
+ RemoveAurasDueToSpell(i_spellId , (*i).second->GetCasterGUID(), AURA_REMOVE_BY_STACK);
if( m_Auras.empty() )
break;
@@ -4095,133 +3898,73 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
return true;
}
-void Unit::RemoveAura(uint32 spellId, uint32 effindex, Aura* except)
+void Unit::RemoveAura(uint32 spellId, uint64 caster ,AuraRemoveMode removeMode)
{
- spellEffectPair spair = spellEffectPair(spellId, effindex);
- for(AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
+ for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
{
- if(iter->second!=except)
+ if (!caster || iter->second->GetCasterGUID()==caster)
{
- RemoveAura(iter);
- iter = m_Auras.lower_bound(spair);
- }
- else
- ++iter;
- }
-}
-
-void Unit::RemoveAurasBySpell(uint32 spellId, AuraRemoveMode removeMode)
-{
- for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
- {
- Aura *aur = iter->second;
- if (aur->GetId() == spellId)
- RemoveAura(iter, removeMode);
- else
- ++iter;
- }
-}
-
-void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode)
-{
- for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
- {
- Aura *aur = iter->second;
- if (aur->GetId() == spellId && aur->GetCasterGUID() == casterGUID)
RemoveAura(iter, removeMode);
+ return;
+ }
else
++iter;
}
}
-void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint8 effindex, uint64 casterGUID, AuraRemoveMode removeMode)
+void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 caster ,AuraRemoveMode removeMode)
{
- spellEffectPair spair = spellEffectPair(spellId, effindex);
- for(AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
+ for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
{
- if (iter->second->GetCasterGUID() == casterGUID)
+ if (!caster || iter->second->GetCasterGUID()==caster)
{
RemoveAura(iter, removeMode);
- iter = m_Auras.lower_bound(spair);
+ iter = m_Auras.lower_bound(spellId);
}
else
++iter;
}
}
-void Unit::RefreshAurasByCasterSpell(uint32 spellId, uint64 casterGUID)
+void Unit::RemoveAuraFromStack(uint32 spellId, uint64 caster ,AuraRemoveMode removeMode)
{
- // Lookup for auras already applied from spell
- for(uint8 i = 0; i < 3; ++i)
+ for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
{
- spellEffectPair spair = spellEffectPair(spellId, i);
- for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr)
+ if (!caster || iter->second->GetCasterGUID()==caster)
{
- if(itr->second->GetCasterGUID()==casterGUID)
- {
- itr->second->RefreshAura();
- break;
- }
- }
- }
-}
-
-void Unit::SetAurasDurationByCasterSpell(uint32 spellId, uint64 casterGUID, int32 duration)
-{
- for(uint8 i = 0; i < 3; ++i)
- {
- spellEffectPair spair = spellEffectPair(spellId, i);
- for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr)
- {
- if(itr->second->GetCasterGUID()==casterGUID)
- {
- itr->second->SetAuraDurationAndUpdate(duration);
- break;
- }
+ RemoveAuraFromStack(iter, removeMode);
+ return;
}
+ else
+ ++iter;
}
}
-Aura* Unit::GetAuraByCasterSpell(uint32 spellId, uint64 casterGUID)
+inline void Unit::RemoveAuraFromStack(AuraMap::iterator &iter,AuraRemoveMode removeMode)
{
- // Returns first found aura from spell-use only in cases where effindex of spell doesn't matter!
- for(uint8 i = 0; i < 3; ++i)
- {
- spellEffectPair spair = spellEffectPair(spellId, i);
- for(AuraMap::const_iterator itr = GetAuras().lower_bound(spair); itr != GetAuras().upper_bound(spair); ++itr)
- {
- if(itr->second->GetCasterGUID()==casterGUID)
- return itr->second;
- }
- }
- return NULL;
+ if (iter->second->modStackAmount(-1))
+ RemoveAura(iter, removeMode);
}
void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler)
{
- for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
+ for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
{
- Aura *aur = iter->second;
- if (aur->GetId() == spellId && aur->GetCasterGUID() == casterGUID)
+ Aura * aur= iter->second;
+ if (casterGUID == aur->GetCasterGUID())
{
- // Custom dispel case
// Unstable Affliction
if (aur->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (aur->GetSpellProto()->SpellFamilyFlags[1] & 0x0100))
{
- int32 damage = aur->GetModifier()->m_amount*9;
+ int32 damage = aur->GetPartAura(0)->GetAmount()*9;
uint64 caster_guid = aur->GetCasterGUID();
-
- // Remove aura
- if (iter->second->modStackAmount(-1))
- RemoveAura(iter, AURA_REMOVE_BY_ENEMY_SPELL);
-
+ RemoveAuraFromStack(iter, AURA_REMOVE_BY_ENEMY_SPELL);
// backfire damage and silence
dispeler->CastCustomSpell(dispeler, 31117, &damage, NULL, NULL, true, NULL, NULL,caster_guid);
-
- iter = m_Auras.begin(); // iterator can be invalidate at cast if self-dispel
+ return;
}
- else if (iter->second->modStackAmount(-1))
- RemoveAura(iter, AURA_REMOVE_BY_ENEMY_SPELL);
+ RemoveAuraFromStack(iter, AURA_REMOVE_BY_ENEMY_SPELL);
+ return;
}
else
++iter;
@@ -4230,97 +3973,77 @@ void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit
void Unit::RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer)
{
- for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
+ if (casterGUID == stealer->GetGUID())
+ return;
+
+ for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
{
- Aura *aur = iter->second;
- if (aur->GetId() == spellId && aur->GetCasterGUID() == casterGUID)
+ Aura * aur= iter->second;
+ if (casterGUID == aur->GetCasterGUID())
{
- int32 basePoints = aur->GetBasePoints();
- // construct the new aura for the attacker - will never return NULL, it's just a wrapper for
- // some different constructors
- Aura * new_aur = CreateAura(aur->GetSpellProto(), aur->GetEffIndex(), NULL, stealer, this);
-
- // set its duration and maximum duration
- // max duration 2 minutes (in msecs)
- int32 dur = aur->GetAuraDuration();
- const int32 max_dur = 2*MINUTE*IN_MILISECONDS;
- new_aur->SetAuraMaxDuration( max_dur > dur ? dur : max_dur );
- new_aur->SetAuraDuration( max_dur > dur ? dur : max_dur );
+ int32 damage[3];
+ for (uint8 i=0;i<3;++i)
+ {
+ if (aur->GetPartAura(i))
+ damage[i]=aur->GetPartAura(i)->GetAmount();
+ else
+ damage[i]=NULL;
+ }
+ int32 dur = 2*MINUTE*IN_MILISECONDS > aur->GetAuraDuration() ? 2*MINUTE*IN_MILISECONDS : aur->GetAuraDuration();
+ Aura * new_aur = new Aura(aur->GetSpellProto(),aur->GetEffectMask(), NULL, stealer, stealer, NULL);
+ new_aur->SetLoadedState(aur->GetCasterGUID(), dur, dur, aur->GetAuraCharges(), aur->GetStackAmount(), &damage[0]);
// Unregister _before_ adding to stealer
aur->UnregisterSingleCastAura();
// strange but intended behaviour: Stolen single target auras won't be treated as single targeted
new_aur->SetIsSingleTarget(false);
-
- // add the new aura to stealer
- stealer->AddAura(new_aur);
-
- // Remove aura as dispel
- if (iter->second->modStackAmount(-1))
- RemoveAura(iter, AURA_REMOVE_BY_ENEMY_SPELL);
+ RemoveAuraFromStack(iter, AURA_REMOVE_BY_ENEMY_SPELL);
+ return;
}
else
++iter;
}
}
-void Unit::RemoveAurasWithDispelType( DispelType type )
+void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
{
- // Create dispel mask by dispel type
- uint32 dispelMask = GetDispellMask(type);
- // Dispel all existing auras vs current dispel type
- AuraMap& auras = GetAuras();
- for(AuraMap::iterator itr = auras.begin(); itr != auras.end(); )
+ for (AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
{
- SpellEntry const* spell = itr->second->GetSpellProto();
- if( (1<<spell->Dispel) & dispelMask )
+ if (iter->second->GetCastItemGUID() == castItem->GetGUID())
{
- // Dispel aura
- RemoveAurasDueToSpell(spell->Id);
- itr = auras.begin();
+ RemoveAura(iter);
+ iter = m_Auras.upper_bound(spellId); // overwrite by more appropriate
}
else
- ++itr;
+ ++iter;
}
}
-void Unit::RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex)
+void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura * except)
{
- AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex));
- if(iter != m_Auras.end())
+ if (auraType >= TOTAL_AURAS) return;
+ for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
{
- if (iter->second->modStackAmount(-1))
- RemoveAura(iter);
+ Aura const * aur = (*iter)->GetParentAura();
+ ++iter;
+ if (aur != except && (!casterGUID || aur->GetCasterGUID()==casterGUID))
+ {
+ RemoveAura(aur->GetId(), aur->GetCasterGUID(), AURA_REMOVE_BY_ENEMY_SPELL);
+ }
}
}
-void Unit::RemoveSingleSpellAurasFromStack(uint32 spellId)
-{
- for (int i=0; i<3; ++i)
- RemoveSingleAuraFromStack(spellId, i);
-}
-
-void Unit::RemoveAurasDueToSpell(uint32 spellId, Aura* except)
+void Unit::RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell)
{
- for (int i = 0; i < 3; ++i)
- RemoveAura(spellId,i,except);
-}
-
-void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
-{
- for (int k=0; k < 3; ++k)
+ if (auraType >= TOTAL_AURAS) return;
+ for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
{
- spellEffectPair spair = spellEffectPair(spellId, k);
- for (AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
+ Aura const* aur = (*iter)->GetParentAura();
+ ++iter;
+ if (GetDispelChance(spell, aur->GetCaster(), aur->GetId()))
{
- if (iter->second->GetCastItemGUID() == castItem->GetGUID())
- {
- RemoveAura(iter);
- iter = m_Auras.upper_bound(spair); // overwrite by more appropriate
- }
- else
- ++iter;
+ RemoveAura(aur->GetId(), aur->GetCasterGUID(), AURA_REMOVE_BY_ENEMY_SPELL);
}
}
}
@@ -4331,21 +4054,20 @@ void Unit::RemoveNotOwnSingleTargetAuras()
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
{
if (iter->second->GetCasterGUID()!=GetGUID() && IsSingleTargetSpell(iter->second->GetSpellProto()))
- RemoveAura(iter, AURA_REMOVE_BY_DELETE);
+ RemoveAura(iter);
else
++iter;
}
// single target auras at other targets
AuraList& scAuras = GetSingleCastAuras();
- for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end(); )
+ for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
{
- Aura* aura = *iter;
- if (aura->GetTarget()!=this)
+ if ((*iter)->GetTarget()!=this)
{
- scAuras.erase(iter); // explicitly remove, instead waiting remove in RemoveAura
- aura->GetTarget()->RemoveAura(aura->GetId(),aura->GetEffIndex());
- iter = scAuras.begin();
+ Aura * aur=*iter;
+ ++iter;
+ aur->GetTarget()->RemoveAura(aur->GetId(),aur->GetCasterGUID());
}
else
++iter;
@@ -4364,23 +4086,17 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
Aur->UnregisterSingleCastAura();
- // remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order)
- if (Aur->GetModifier()->m_auraname < TOTAL_AURAS)
+ if(Aur->GetSpellProto()->AuraInterruptFlags)
{
- m_modAuras[Aur->GetModifier()->m_auraname].remove(Aur);
-
- if(Aur->GetSpellProto()->AuraInterruptFlags)
- {
- m_interruptableAuras.remove(Aur);
- UpdateInterruptMask();
- }
+ m_interruptableAuras.remove(Aur);
+ UpdateInterruptMask();
+ }
- if((Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE
- && Aur->GetModifier()->m_auraname != SPELL_AURA_MOD_POSSESS) //only dummy aura is breakable
- || (Aur->GetSpellProto()->Mechanic==MECHANIC_KNOCKOUT && Aur->GetModifier()->m_auraname==SPELL_AURA_MOD_STUN))
- {
- m_ccAuras.remove(Aur);
- }
+ if((Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE
+ && !Aur->IsAuraType(SPELL_AURA_MOD_POSSESS)) //only dummy aura is breakable
+ || (Aur->GetSpellProto()->Mechanic==MECHANIC_KNOCKOUT && Aur->IsAuraType(SPELL_AURA_MOD_STUN)))
+ {
+ m_ccAuras.remove(Aur);
}
// Set remove mode
@@ -4392,28 +4108,29 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
if(Aur->GetAuraDuration() && !Aur->IsPersistent() && IsChanneledSpell(AurSpellInfo))
{
Unit* caster = Aur->GetCaster();
-
if(caster && caster->isAlive())
{
// stop caster chanelling state
- if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL]
+ if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL])
+ {
+ // same spell
+ if (AurSpellInfo == caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo
//prevent recurential call
&& caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
- {
- if (caster==this || !IsAreaOfEffectSpell(AurSpellInfo))
{
- // remove auras only for non-aoe spells or when chanelled aura is removed
- // because aoe spells don't require aura on target to continue
- if (AurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]!=SPELL_AURA_PERIODIC_DUMMY
- && AurSpellInfo->EffectApplyAuraName[Aur->GetEffIndex()]!= SPELL_AURA_DUMMY)
- //don't stop channeling of scripted spells (this is actually a hack)
+ if (caster==this || !IsAreaOfEffectSpell(AurSpellInfo))
{
- caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
+ // remove auras only for non-aoe spells or when chanelled aura is removed
+ // because aoe spells don't require aura on target to continue
+ {
+ caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
+ caster->m_currentSpells[CURRENT_CHANNELED_SPELL]=NULL;
+ }
}
- }
- if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
- statue = ((Totem*)caster);
+ if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE)
+ statue = ((Totem*)caster);
+ }
}
// Unsummon summon as possessed creatures on spell cancel
@@ -4433,17 +4150,11 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
}
}
- sLog.outDebug("Aura %u (%u) now is remove mode %d", Aur->GetId(), Aur->GetModifier()->m_auraname, mode);
+ sLog.outDebug("Aura %u now is remove mode %d", Aur->GetId(), mode);
assert(!Aur->IsInUse());
- Aur->ApplyModifier(false,true);
+ Aur->HandleEffects(false);
Aur->_RemoveAura();
- //if (mode!=AURA_REMOVE_BY_REPLACE)
- {
- // Remove all triggered by aura spells vs unlimited duration
- Aur->CleanupTriggeredSpells();
- }
-
delete Aur;
if(statue)
@@ -4458,11 +4169,9 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
void Unit::RemoveAllAuras()
{
+ AuraMap::iterator iter = m_Auras.begin();
while (!m_Auras.empty())
- {
- AuraMap::iterator iter = m_Auras.begin();
RemoveAura(iter);
- }
}
void Unit::RemoveArenaAuras(bool onleave)
@@ -4494,18 +4203,17 @@ void Unit::RemoveAllAurasOnDeath()
}
}
-void Unit::DelayAura(uint32 spellId, uint32 effindex, int32 delaytime)
+void Unit::DelayAura(uint32 spellId, uint64 caster, int32 delaytime)
{
- AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex));
- if (iter != m_Auras.end())
+ if (Aura * aur = GetAura(spellId, caster))
{
- if (iter->second->GetAuraDuration() < delaytime)
- iter->second->SetAuraDuration(0);
+ if (aur->GetAuraDuration() < delaytime)
+ aur->SetAuraDuration(0);
else
- iter->second->SetAuraDuration(iter->second->GetAuraDuration() - delaytime);
+ aur->SetAuraDuration(aur->GetAuraDuration() - delaytime);
// update for out of range group members (on 1 slot use)
- UpdateAuraForGroup(iter->second->GetAuraSlot());
- sLog.outDebug("Aura %u partially interrupted on unit %u, new duration: %u ms",iter->second->GetModifier()->m_auraname, GetGUIDLow(), iter->second->GetAuraDuration());
+ UpdateAuraForGroup(aur->GetAuraSlot());
+ sLog.outDebug("Aura %u partially interrupted on unit %u, new duration: %u ms",aur->GetId(), GetGUIDLow(), aur->GetAuraDuration());
}
}
@@ -4513,7 +4221,7 @@ void Unit::_RemoveAllAuraMods()
{
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
{
- (*i).second->ApplyModifier(false);
+ (*i).second->ApplyAllModifiers(false);
}
}
@@ -4521,22 +4229,70 @@ void Unit::_ApplyAllAuraMods()
{
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
{
- (*i).second->ApplyModifier(true);
+ (*i).second->ApplyAllModifiers(true);
}
}
-Aura* Unit::GetAura(uint32 spellId, uint32 effindex)
+bool Unit::HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const
{
- AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex));
- if (iter != m_Auras.end())
- return iter->second;
- return NULL;
+ AuraEffectList const& mTotalAuraList = GetAurasByType(auratype);
+ for(AuraEffectList::const_iterator i = mTotalAuraList.begin();i != mTotalAuraList.end(); ++i)
+ if (miscvalue == (*i)->GetMiscValue())
+ return true;
+ return false;
+}
+
+bool Unit::HasAuraType(AuraType auraType) const
+{
+ return (!m_modAuras[auraType].empty());
+}
+
+bool Unit::HasAura(uint32 spellId, uint64 caster) const
+{
+ //Special case for non existing spell
+ if (spellId==61988)
+ return HasAura(61987, caster) || HasAura(25771, caster);
+
+ if (Aura * aur = GetAura(spellId, caster))
+ return true;
+ return false;
+}
+
+bool Unit::HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
+{
+ if (Aura * aur = GetAura(spellId, caster))
+ return bool(aur->HasEffect(effIndex));
+ return false;
+}
+
+Aura * Unit::GetAura(uint32 spellId, uint64 caster) const
+{
+ if (!caster)
+ {
+ AuraMap::const_iterator itr = m_Auras.find(spellId);
+ return itr != m_Auras.end() ? itr->second : NULL;
+ }
+ else
+ {
+ AuraMap const& auras = GetAuras();
+ for(AuraMap::const_iterator itr = auras.lower_bound(spellId); itr != auras.upper_bound(spellId); ++itr)
+ if(itr->second->GetCasterGUID()==caster)
+ return itr->second;
+ return NULL;
+ }
+}
+
+AuraEffect * Unit::GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster) const
+{
+ if (Aura * aur = GetAura(spellId, caster))
+ return aur->GetPartAura(effIndex);
+ return false;
}
-Aura* Unit::GetAura(AuraType type, uint32 family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID)
+AuraEffect* Unit::GetAura(AuraType type, uint32 family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID)
{
- AuraList const& auras = GetAurasByType(type);
- for(AuraList::const_iterator i = auras.begin();i != auras.end(); ++i)
+ AuraEffectList const& auras = GetAurasByType(type);
+ for(AuraEffectList::const_iterator i = auras.begin();i != auras.end(); ++i)
{
SpellEntry const *spell = (*i)->GetSpellProto();
if (spell->SpellFamilyName == family && spell->SpellFamilyFlags.HasFlag(familyFlag1, familyFlag2, familyFlag3))
@@ -4549,20 +4305,6 @@ Aura* Unit::GetAura(AuraType type, uint32 family, uint32 familyFlag1, uint32 fam
return NULL;
}
-bool Unit::HasAura(uint32 spellId) const
-{
- //Special case for non existing spell
- if (spellId==61988)
- return HasAura(61987) || HasAura(25771);
- for (int i = 0; i < 3 ; ++i)
- {
- AuraMap::const_iterator iter = m_Auras.find(spellEffectPair(spellId, i));
- if (iter != m_Auras.end())
- return true;
- }
- return false;
-}
-
void Unit::AddDynObject(DynamicObject* dynObj)
{
m_dynObjGUIDs.push_back(dynObj->GetGUID());
@@ -4914,12 +4656,12 @@ void Unit::SendAttackStateUpdate(uint32 HitInfo, Unit *target, uint8 SwingType,
SendMessageToSet( &data, true );
}
-bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
+bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 /*procFlag*/, uint32 /*procEx*/, uint32 cooldown)
{
SpellEntry const *hasteSpell = triggeredByAura->GetSpellProto();
- Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
- ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL;
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
Unit* target = pVictim;
@@ -4977,14 +4719,14 @@ bool Unit::HandleHasteAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
return true;
}
-bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
+bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{
SpellEntry const *dummySpell = triggeredByAura->GetSpellProto ();
uint32 effIndex = triggeredByAura->GetEffIndex();
- int32 triggerAmount = triggeredByAura->GetModifier()->m_amount;
+ int32 triggerAmount = triggeredByAura->GetAmount();
- Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
- ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL;
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
Unit* target = pVictim;
@@ -5013,24 +4755,16 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
{
// Tricky thing here, we find current aura from spell by caster and change its modifier value
int32 spelldmg = CalculateSpellDamage(procSpell, 0, procSpell->EffectBasePoints[0],pVictim);
- Aura * Aur = NULL;
- spellEffectPair spair = spellEffectPair(procSpell->Id, effIndex+1);
- for(AuraMap::const_iterator itr = pVictim->GetAuras().lower_bound(spair); itr != pVictim->GetAuras().upper_bound(spair); ++itr)
+ if (AuraEffect * Aur = pVictim->GetAuraEffect(procSpell->Id, effIndex+1, triggeredByAura->GetCasterGUID()))
{
- if (itr->second->GetCasterGUID()==GetGUID())
- {
- Aur = itr->second;
- break;
- }
+ // Remove aura mods
+ Aur->ApplyModifier(false);
+ Aur->SetAmount(Aur->GetAmount() + spelldmg * triggerAmount / 100);
+ // Apply extended aura mods
+ Aur->ApplyModifier(true);
+ return true;
}
- if (!Aur)
- return false;
- // Remove aura mods
- Aur->ApplyModifier(false);
- Aur->GetModifier()->m_amount += spelldmg * triggerAmount / 100;
- // Apply extended aura mods
- Aur->ApplyModifier(true);
- break;
+ return false;
}
// Eye for an Eye
case 9799:
@@ -5070,14 +4804,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (!procSpell || procSpell->Id == 24659)
return false;
// Need remove one 24659 aura
- RemoveSingleSpellAurasFromStack(24659);
+ RemoveAuraFromStack(24659);
return true;
}
// Restless Strength
case 24661:
{
// Need remove one 24662 aura
- RemoveSingleSpellAurasFromStack(24662);
+ RemoveAuraFromStack(24662);
return true;
}
// Adaptive Warding (Frostfire Regalia set)
@@ -5088,8 +4822,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
// find Mage Armor
bool found = false;
- AuraList const& mRegenInterupt = GetAurasByType(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
- for(AuraList::const_iterator iter = mRegenInterupt.begin(); iter != mRegenInterupt.end(); ++iter)
+ AuraEffectList const& mRegenInterupt = GetAurasByType(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
+ for(AuraEffectList::const_iterator iter = mRegenInterupt.begin(); iter != mRegenInterupt.end(); ++iter)
{
if(SpellEntry const* iterSpellProto = (*iter)->GetSpellProto())
{
@@ -5170,7 +4904,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
case 33493:
{
// Cast finish spell at last charge
- if (triggeredByAura->GetAuraCharges() > 1)
+ if (triggeredByAura->GetParentAura()->GetAuraCharges() > 1)
return false;
target = this;
@@ -5385,12 +5119,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
case 58914:
{
// Remove aura stack from pet
- RemoveSingleSpellAurasFromStack(58914);
+ RemoveAuraFromStack(58914);
Unit* owner = GetOwner();
if(!owner)
return true;
// reduce the owner's aura stack
- owner->RemoveSingleSpellAurasFromStack(34027);
+ owner->RemoveAuraFromStack(34027);
return true;
}
// Vampiric Touch (generic, used by some boss)
@@ -5415,11 +5149,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
for(AuraMap::iterator iter = Auras.begin(); iter != Auras.end();)
{
SpellEntry const *spell = iter->second->GetSpellProto();
- if( spell->Mechanic == MECHANIC_STUN ||
- spell->EffectMechanic[iter->second->GetEffIndex()] == MECHANIC_STUN)
+ if( GetAllSpellMechanicMask(spell) & 1<<(MECHANIC_STUN-1))
{
- pVictim->RemoveAurasDueToSpell(spell->Id);
- iter = Auras.begin();
+ pVictim->RemoveAura(iter);
}
else
++iter;
@@ -5473,22 +5205,21 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
{
if (effIndex!=0)
return true;
- Aura *counter = GetAura(triggeredByAura->GetId(), 1);
+ AuraEffect *counter = GetAuraEffect(triggeredByAura->GetId(), 1);
if (!counter)
return true;
// Count spell criticals in a row in second aura
- Modifier *mod = counter->GetModifier();
if (procEx & PROC_EX_CRITICAL_HIT)
{
- mod->m_amount *=2;
- if (mod->m_amount < 100) // not enough
+ counter->SetAmount(counter->GetAmount()*2);
+ if (counter->GetAmount() < 100) // not enough
return true;
// Crititcal counted -> roll chance
if (roll_chance_i(triggerAmount))
CastSpell(this, 48108, true, castItem, triggeredByAura);
}
- mod->m_amount = 25;
+ counter->SetAmount(25);
return true;
}
// Burnout
@@ -5543,7 +5274,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
case 11129:
{
//last charge and crit
- if (triggeredByAura->GetAuraCharges() <= 1 && (procEx & PROC_EX_CRITICAL_HIT) )
+ if (triggeredByAura->GetParentAura()->GetAuraCharges() <= 1 && (procEx & PROC_EX_CRITICAL_HIT) )
{
RemoveAurasDueToSpell(28682); //-> remove Combustion auras
return true; // charge counting (will removed)
@@ -5635,9 +5366,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
// Seed of Corruption
if (dummySpell->SpellFamilyFlags[1] & 0x00000010)
{
- Modifier* mod = triggeredByAura->GetModifier();
// if damage is more than need or target die from damage deal finish spell
- if( mod->m_amount <= damage || GetHealth() <= damage )
+ if( triggeredByAura->GetAmount() <= damage || GetHealth() <= damage )
{
// remember guid before aura delete
uint64 casterGuid = triggeredByAura->GetCasterGUID();
@@ -5652,15 +5382,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
}
// Damage counting
- mod->m_amount-=damage;
+ triggeredByAura->SetAmount(triggeredByAura->GetAmount() - damage);
return true;
}
// Seed of Corruption (Mobs cast) - no die req
if (dummySpell->SpellFamilyFlags.IsEqual(0,0,0) && dummySpell->SpellIconID == 1932)
{
- Modifier* mod = triggeredByAura->GetModifier();
// if damage is more than need deal finish spell
- if( mod->m_amount <= damage )
+ if( triggeredByAura->GetAmount() <= damage )
{
// remember guid before aura delete
uint64 casterGuid = triggeredByAura->GetCasterGUID();
@@ -5674,7 +5403,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
return true; // no hidden cooldown
}
// Damage counting
- mod->m_amount-=damage;
+ triggeredByAura->SetAmount(triggeredByAura->GetAmount() - damage);
return true;
}
// Fel Synergy
@@ -5703,12 +5432,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
case 30296:
{
// Improved Soul Leech
- AuraList const& SoulLeechAuras = GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator i = SoulLeechAuras.begin();i != SoulLeechAuras.end(); ++i)
+ AuraEffectList const& SoulLeechAuras = GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator i = SoulLeechAuras.begin();i != SoulLeechAuras.end(); ++i)
{
if ((*i)->GetId()==54117 || (*i)->GetId()==54118)
{
- basepoints0 = int32((*i)->GetModifier()->m_amount);
+ basepoints0 = int32((*i)->GetAmount());
if (target = GetGuardianPet())
{
// regen mana for pet
@@ -6025,16 +5754,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
{
// "refresh your Slice and Dice duration to its 5 combo point maximum"
// lookup Slice and Dice
- AuraList const& sd = GetAurasByType(SPELL_AURA_MOD_HASTE);
- for(AuraList::const_iterator itr = sd.begin(); itr != sd.end(); ++itr)
+ if (AuraEffect * aur = GetAura(SPELL_AURA_MOD_HASTE, SPELLFAMILY_ROGUE,0x40000, 0, 0))
{
- SpellEntry const *spellProto = (*itr)->GetSpellProto();
- if( spellProto->SpellFamilyName == SPELLFAMILY_ROGUE &&
- spellProto->SpellFamilyFlags[0] & 0x40000)
- {
- SetAurasDurationByCasterSpell(spellProto->Id, GetGUID(), GetSpellMaxDuration(spellProto));
- return true;
- }
+ aur->GetParentAura()->SetAuraDuration(GetSpellMaxDuration(aur->GetSpellProto()));
+ return true;
}
return false;
}
@@ -6354,7 +6077,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
case 55198:
{
// Remove aura stack from caster
- RemoveSingleSpellAurasFromStack(55166);
+ RemoveAuraFromStack(55166);
// drop charges
return false;
}
@@ -6542,15 +6265,15 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (procSpell->SpellFamilyFlags[0] & 0x80 && !roll_chance_i(60))
return false;
// lookup water shield
- AuraList const& vs = GetAurasByType(SPELL_AURA_PROC_TRIGGER_SPELL);
- for(AuraList::const_iterator itr = vs.begin(); itr != vs.end(); ++itr)
+ AuraEffectList const& vs = GetAurasByType(SPELL_AURA_PROC_TRIGGER_SPELL);
+ for(AuraEffectList::const_iterator itr = vs.begin(); itr != vs.end(); ++itr)
{
if( (*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN &&
(*itr)->GetSpellProto()->SpellFamilyFlags[1] & 0x00000020)
{
uint32 spell = (*itr)->GetSpellProto()->EffectTriggerSpell[(*itr)->GetEffIndex()];
CastSpell(this, spell, true, castItem, triggeredByAura);
- if ((*itr)->DropAuraCharge())
+ if ((*itr)->GetParentAura()->DropAuraCharge())
RemoveAurasDueToSpell((*itr)->GetId());
return true;
}
@@ -6600,35 +6323,19 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
sLog.outError("Unit::HandleDummyAuraProc: non handled spell id: %u (LO)", procSpell->Id);
return false;
}
- // No thread generated mod
- // TODO: exist special flag in spell attributes for this, need found and use!
- SpellModifier *mod = new SpellModifier;
- mod->op = SPELLMOD_THREAT;
- mod->value = -100;
- mod->type = SPELLMOD_PCT;
- mod->spellId = dummySpell->Id;
- mod->mask[0] = 0x3;
- ((Player*)this)->AddSpellMod(mod, true);
-
- // Remove cooldown (Chain Lightning - have Category Recovery time)
- if (procSpell->SpellFamilyFlags[0] & 0x2)
- ((Player*)this)->RemoveSpellCooldown(spellId);
+ // Apply spellmod
+ CastSpell(this, 39805, true, castItem, triggeredByAura);
CastSpell(pVictim, spellId, true, castItem, triggeredByAura);
- ((Player*)this)->AddSpellMod(mod, false);
-
- if( cooldown && GetTypeId()==TYPEID_PLAYER )
- ((Player*)this)->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
-
return true;
}
// Static Shock
if(dummySpell->SpellIconID == 3059)
{
// lookup Lightning Shield
- AuraList const& vs = GetAurasByType(SPELL_AURA_PROC_TRIGGER_SPELL);
- for(AuraList::const_iterator itr = vs.begin(); itr != vs.end(); ++itr)
+ AuraEffectList const& vs = GetAurasByType(SPELL_AURA_PROC_TRIGGER_SPELL);
+ for(AuraEffectList::const_iterator itr = vs.begin(); itr != vs.end(); ++itr)
{
if( (*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN &&
(*itr)->GetSpellProto()->SpellFamilyFlags[0] & 0x400)
@@ -6651,7 +6358,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
return false;
}
CastSpell(this, spell, true, castItem, triggeredByAura);
- if ((*itr)->DropAuraCharge())
+ if ((*itr)->GetParentAura()->DropAuraCharge())
RemoveAurasDueToSpell((*itr)->GetId());
return true;
}
@@ -6738,8 +6445,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
if (dummySpell->Id == 45469)
{
uint8 n=0;
- Unit::AuraList const& decSpeedList = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
- for(Unit::AuraList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter)
+ Unit::AuraEffectList const& decSpeedList = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
+ for(Unit::AuraEffectList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter)
{
if((*iter)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_DEATHKNIGHT
&& (*iter)->GetCasterGUID() == GetGUID()
@@ -6834,14 +6541,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
return true;
}
-bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
+bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const * procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown)
{
SpellEntry const *dummySpell = triggeredByAura->GetSpellProto ();
uint32 effIndex = triggeredByAura->GetEffIndex();
- int32 triggerAmount = triggeredByAura->GetModifier()->m_amount;
+ int32 triggerAmount = triggeredByAura->GetAmount();
- Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
- ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL;
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
Unit* target = pVictim;
@@ -6894,24 +6601,24 @@ bool Unit::HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, Aura* trigge
return true;
}
-bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const *procSpell, uint32 procFlags, uint32 procEx, uint32 cooldown)
+bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlags, uint32 procEx, uint32 cooldown)
{
// Get triggered aura spell info
SpellEntry const* auraSpellInfo = triggeredByAura->GetSpellProto();
// Basepoints of trigger aura
- int32 triggerAmount = triggeredByAura->GetModifier()->m_amount;
+ int32 triggerAmount = triggeredByAura->GetAmount();
// Set trigger spell id, target, custom basepoints
uint32 trigger_spell_id = auraSpellInfo->EffectTriggerSpell[triggeredByAura->GetEffIndex()];
Unit* target = NULL;
int32 basepoints0 = 0;
- if(triggeredByAura->GetModifier()->m_auraname == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
+ if(triggeredByAura->GetAuraName() == SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE)
basepoints0 = triggerAmount;
- Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
- ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL;
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
// Try handle uncnown trigger spells
if (sSpellStore.LookupEntry(trigger_spell_id)==NULL)
@@ -7109,10 +6816,10 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
// Drain Soul
else if (auraSpellInfo->SpellFamilyFlags[0] & 0x4000)
{
- Unit::AuraList const& mAddFlatModifier = GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER);
- for(Unit::AuraList::const_iterator i = mAddFlatModifier.begin(); i != mAddFlatModifier.end(); ++i)
+ Unit::AuraEffectList const& mAddFlatModifier = GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER);
+ for(Unit::AuraEffectList::const_iterator i = mAddFlatModifier.begin(); i != mAddFlatModifier.end(); ++i)
{
- if ((*i)->GetModifier()->m_miscvalue == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellProto()->SpellIconID == 113)
+ if ((*i)->GetMiscValue() == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellProto()->SpellIconID == 113)
{
int32 value2 = CalculateSpellDamage((*i)->GetSpellProto(),2,(*i)->GetSpellProto()->EffectBasePoints[2],this);
// Drain Soul
@@ -7264,9 +6971,9 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
// stacking
CastSpell(this, 37658, true, NULL, triggeredByAura);
- Aura * dummy = GetDummyAura(37658);
+ AuraEffect * dummy = GetDummyAura(37658);
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
- if(!dummy || dummy->GetStackAmount() < triggerAmount)
+ if(!dummy || dummy->GetParentAura()->GetStackAmount() < triggerAmount)
return false;
RemoveAurasDueToSpell(37658);
@@ -7282,9 +6989,9 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
CastSpell(this, 54842, true, NULL, triggeredByAura);
// counting
- Aura * dummy = GetDummyAura(54842);
+ AuraEffect * dummy = GetDummyAura(54842);
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
- if(!dummy || dummy->GetStackAmount() < triggerAmount)
+ if(!dummy || dummy->GetParentAura()->GetStackAmount() < triggerAmount)
return false;
RemoveAurasDueToSpell(54842);
@@ -7536,10 +7243,10 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
if (procSpell->SpellFamilyName==SPELLFAMILY_MAGE && procSpell->SpellFamilyFlags[0] & 0x80)
{
bool found = false;
- AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
+ AuraEffectList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
- int32 script = (*i)->GetModifier()->m_miscvalue;
+ int32 script = (*i)->GetMiscValue();
if(script==836 || script==988 || script==989)
{
found=true;
@@ -7606,15 +7313,15 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return true;
}
-bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, Aura *triggeredByAura, SpellEntry const *procSpell, uint32 cooldown)
+bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraEffect *triggeredByAura, SpellEntry const *procSpell, uint32 cooldown)
{
- int32 scriptId = triggeredByAura->GetModifier()->m_miscvalue;
+ int32 scriptId = triggeredByAura->GetMiscValue();
if(!pVictim || !pVictim->isAlive())
return false;
- Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
- ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL;
+ Item* castItem = triggeredByAura->GetParentAura()->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
+ ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetParentAura()->GetCastItemGUID()) : NULL;
uint32 triggered_spell_id = 0;
@@ -7679,7 +7386,7 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, Aura
if (pVictim->GetHealth() + damage < pVictim->GetMaxHealth())
return false;
int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
- int32 basepoints0 = cost * triggeredByAura->GetModifier()->m_amount/100;
+ int32 basepoints0 = cost * triggeredByAura->GetAmount()/100;
CastCustomSpell(this, 47762, &basepoints0, 0, 0, true, 0, triggeredByAura);
return true;
}
@@ -7691,8 +7398,8 @@ bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, Aura
case 7552: // Rank 5
{
int32 basepoints0 = ((getLevel() * (-0.2) + 18) / 1000000) * damage * GetMaxPower(POWER_MANA);
- if(basepoints0 > (GetMaxPower(POWER_MANA) / 100) * (triggeredByAura->GetModifier()->m_amount / 10))
- basepoints0 = (GetMaxPower(POWER_MANA) / 100) * (triggeredByAura->GetModifier()->m_amount / 10);
+ if(basepoints0 > (GetMaxPower(POWER_MANA) / 100) * (triggeredByAura->GetAmount() / 10))
+ basepoints0 = (GetMaxPower(POWER_MANA) / 100) * (triggeredByAura->GetAmount() / 10);
CastCustomSpell(this, 47755, &basepoints0, 0, 0, true, 0, triggeredByAura);
return true;
}
@@ -8064,7 +7771,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack)
// remove SPELL_AURA_MOD_UNATTACKABLE at attack (in case non-interruptible spells stun aura applied also that not let attack)
if(HasAuraType(SPELL_AURA_MOD_UNATTACKABLE))
- RemoveSpellsCausingAura(SPELL_AURA_MOD_UNATTACKABLE);
+ RemoveAurasByType(SPELL_AURA_MOD_UNATTACKABLE);
if (m_attacking)
{
@@ -8219,12 +7926,12 @@ bool Unit::HasAuraState(AuraState flag, SpellEntry const *spellProto, Unit * Cas
{
if (Caster && spellProto)
{
- AuraList const& stateAuras = Caster->GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
- for(AuraList::const_iterator j = stateAuras.begin();j != stateAuras.end(); ++j)
+ AuraEffectList const& stateAuras = Caster->GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
+ for(AuraEffectList::const_iterator j = stateAuras.begin();j != stateAuras.end(); ++j)
if((*j)->isAffectedOnSpell(spellProto))
return true;
}
- return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1));
+ return HasFlag(UNIT_FIELD_AURASTATE, 1<<(flag-1));
}
Unit *Unit::GetOwner() const
@@ -8522,14 +8229,14 @@ void Unit::RemovePlayerFromVision(Player* plr)
void Unit::RemoveBindSightAuras()
{
- RemoveSpellsCausingAura(SPELL_AURA_BIND_SIGHT);
+ RemoveAurasByType(SPELL_AURA_BIND_SIGHT);
}
void Unit::RemoveCharmAuras()
{
- RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM);
- RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS_PET);
- RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
+ RemoveAurasByType(SPELL_AURA_MOD_CHARM);
+ RemoveAurasByType(SPELL_AURA_MOD_POSSESS_PET);
+ RemoveAurasByType(SPELL_AURA_MOD_POSSESS);
}
void Unit::UnsummonAllTotems()
@@ -8593,36 +8300,36 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
if( GetTypeId() == TYPEID_UNIT && !((Creature*)this)->isPet() )
DoneTotalMod *= ((Creature*)this)->GetSpellDamageMod(((Creature*)this)->GetCreatureInfo()->rank);
- AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
- for(AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
+ AuraEffectList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ for(AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
{
- if( ((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto)) &&
+ if( ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto)) &&
(*i)->GetSpellProto()->EquippedItemClass == -1 &&
// -1 == any item class (not wand then)
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 )
// 0 == any inventory type (not wand then)
{
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
}
}
uint32 creatureTypeMask = pVictim->GetCreatureTypeMask();
// Add flat bonus from spell damage versus
DoneTotal += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS, creatureTypeMask);
- AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
- for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i)
- if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ AuraEffectList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
+ for(AuraEffectList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i)
+ if(creatureTypeMask & uint32((*i)->GetMiscValue()))
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
// done scripted mod (take it from owner)
Unit *owner = GetOwner();
if (!owner) owner = this;
- AuraList const& mOverrideClassScript= owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
+ AuraEffectList const& mOverrideClassScript= owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
if (!(*i)->isAffectedOnSpell(spellProto))
continue;
- switch((*i)->GetModifier()->m_miscvalue)
+ switch((*i)->GetMiscValue())
{
case 4920: // Molten Fury
case 4919:
@@ -8631,7 +8338,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
case 6928:
{
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
- DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f;
+ DoneTotalMod *= (100.0f+(*i)->GetAmount())/100.0f;
break;
}
// Soul Siphon
@@ -8639,7 +8346,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
case 4993:
{
// effect 1 m_amount
- int32 maxPercent = (*i)->GetModifier()->m_amount;
+ int32 maxPercent = (*i)->GetAmount();
// effect 0 m_amount
int32 stepPercent = CalculateSpellDamage((*i)->GetSpellProto(), 0, (*i)->GetSpellProto()->EffectBasePoints[0], this);
// count affliction effects and calc additional damage in percentage
@@ -8664,12 +8371,12 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
case 6925:
case 6927:
if (HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, spellProto, this))
- DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f;
+ DoneTotalMod *= (100.0f+(*i)->GetAmount())/100.0f;
break;
case 5481: // Starfire Bonus
{
- if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002))
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x200002, 0))
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
break;
}
case 4418: // Increased Shock Damage
@@ -8680,7 +8387,7 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
case 5148: // Idol of the Shooting Star
case 6008: // Increased Lightning Damage / Totem of Hex
{
- DoneTotal+=(*i)->GetModifier()->m_amount;
+ DoneTotal+=(*i)->GetAmount();
break;
}
// Tundra Stalker
@@ -8691,12 +8398,12 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
if ((*i)->GetSpellProto()->SpellIconID == 2656)
{
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
- DoneTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f;
+ DoneTotalMod *= (100.0f+(*i)->GetAmount())/100.0f;
}
else // Tundra Stalker
{
if (pVictim->GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_DEATHKNIGHT,0, 0x04000000,0))
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
break;
}
break;
@@ -8704,14 +8411,14 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
case 7293: // Rage of Rivendare
{
if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0,0x02000000,0))
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
break;
}
// Twisted Faith
case 7377:
{
if (pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0,0, GetGUID()))
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
break;
}
// Marked for Death
@@ -8721,8 +8428,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
case 7601:
case 7602:
{
- if (pVictim->GetAura(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400))
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ if (pVictim->GetAura(SPELL_AURA_MOD_STALKED, SPELLFAMILY_HUNTER, 0x400, 0))
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
break;
}
}
@@ -8741,12 +8448,12 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
{
if(pVictim->HasAuraType(SPELL_AURA_MOD_DECREASE_SPEED))
{
- AuraList const& mDumyAuras = GetAurasByType(SPELL_AURA_DUMMY);
- for(AuraList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
+ AuraEffectList const& mDumyAuras = GetAurasByType(SPELL_AURA_DUMMY);
+ for(AuraEffectList::const_iterator i = mDumyAuras.begin(); i != mDumyAuras.end(); ++i)
{
if ((*i)->GetSpellProto()->SpellIconID == 3263)
{
- DoneTotalMod *=float((*i)->GetModifier()->m_amount + 100.f) / 100.f;
+ DoneTotalMod *=float((*i)->GetAmount() + 100.f) / 100.f;
break;
}
}
@@ -8754,38 +8461,38 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
}
// ..taken
- AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
- for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
- if( (*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto) )
- TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ AuraEffectList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
+ for(AuraEffectList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
+ if( (*i)->GetMiscValue() & GetSpellSchoolMask(spellProto) )
+ TakenTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
// .. taken pct: dummy auras
if (pVictim->GetTypeId() == TYPEID_PLAYER)
{
//Cheat Death
- if (Aura *dummy = pVictim->GetDummyAura(45182))
+ if (AuraEffect *dummy = pVictim->GetDummyAura(45182))
{
float mod = -((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_SPELL)*2*4;
- if (mod < dummy->GetModifier()->m_amount)
- mod = dummy->GetModifier()->m_amount;
+ if (mod < dummy->GetAmount())
+ mod = dummy->GetAmount();
TakenTotalMod *= (mod+100.0f)/100.0f;
}
}
// From caster spells
- AuraList const& mOwnerTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
- for(AuraList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
+ AuraEffectList const& mOwnerTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
+ for(AuraEffectList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
if( (*i)->GetCasterGUID() == GetGUID() && (*i)->isAffectedOnSpell(spellProto))
- TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ TakenTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
// Mod damage from spell mechanic
uint32 mechanicMask = GetAllSpellMechanicMask(spellProto);
if (mechanicMask)
{
- AuraList const& mDamageDoneMechanic = pVictim->GetAurasByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
- for(AuraList::const_iterator i = mDamageDoneMechanic.begin();i != mDamageDoneMechanic.end(); ++i)
- if(mechanicMask & uint32(1<<((*i)->GetModifier()->m_miscvalue)))
- TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ AuraEffectList const& mDamageDoneMechanic = pVictim->GetAurasByType(SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT);
+ for(AuraEffectList::const_iterator i = mDamageDoneMechanic.begin();i != mDamageDoneMechanic.end(); ++i)
+ if(mechanicMask & uint32(1<<((*i)->GetMiscValue())))
+ TakenTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
}
// Taken/Done fixed damage bonus auras
@@ -8892,14 +8599,14 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask)
int32 DoneAdvertisedBenefit = 0;
// ..done
- AuraList const& mDamageDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
- for(AuraList::const_iterator i = mDamageDone.begin();i != mDamageDone.end(); ++i)
- if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0 &&
+ AuraEffectList const& mDamageDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
+ for(AuraEffectList::const_iterator i = mDamageDone.begin();i != mDamageDone.end(); ++i)
+ if(((*i)->GetMiscValue() & schoolMask) != 0 &&
(*i)->GetSpellProto()->EquippedItemClass == -1 &&
// -1 == any item class (not wand then)
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 )
// 0 == any inventory type (not wand then)
- DoneAdvertisedBenefit += (*i)->GetModifier()->m_amount;
+ DoneAdvertisedBenefit += (*i)->GetAmount();
if (GetTypeId() == TYPEID_PLAYER)
{
@@ -8907,21 +8614,21 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask)
DoneAdvertisedBenefit +=((Player*)this)->GetBaseSpellDamageBonus();
// Damage bonus from stats
- AuraList const& mDamageDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT);
- for(AuraList::const_iterator i = mDamageDoneOfStatPercent.begin();i != mDamageDoneOfStatPercent.end(); ++i)
+ AuraEffectList const& mDamageDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT);
+ for(AuraEffectList::const_iterator i = mDamageDoneOfStatPercent.begin();i != mDamageDoneOfStatPercent.end(); ++i)
{
- if((*i)->GetModifier()->m_miscvalue & schoolMask)
+ if((*i)->GetMiscValue() & schoolMask)
{
// stat used stored in miscValueB for this aura
Stats usedStat = Stats((*i)->GetMiscBValue());
- DoneAdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifier()->m_amount / 100.0f);
+ DoneAdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetAmount() / 100.0f);
}
}
// ... and attack power
- AuraList const& mDamageDonebyAP = GetAurasByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER);
- for(AuraList::const_iterator i =mDamageDonebyAP.begin();i != mDamageDonebyAP.end(); ++i)
- if ((*i)->GetModifier()->m_miscvalue & schoolMask)
- DoneAdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifier()->m_amount / 100.0f);
+ AuraEffectList const& mDamageDonebyAP = GetAurasByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER);
+ for(AuraEffectList::const_iterator i =mDamageDonebyAP.begin();i != mDamageDonebyAP.end(); ++i)
+ if ((*i)->GetMiscValue() & schoolMask)
+ DoneAdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetAmount() / 100.0f);
}
return DoneAdvertisedBenefit;
@@ -8933,16 +8640,16 @@ int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVic
int32 TakenAdvertisedBenefit = 0;
// ..done (for creature type by mask) in taken
- AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE);
- for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i)
- if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
- TakenAdvertisedBenefit += (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE);
+ for(AuraEffectList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i)
+ if(creatureTypeMask & uint32((*i)->GetMiscValue()))
+ TakenAdvertisedBenefit += (*i)->GetAmount();
// ..taken
- AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN);
- for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i)
- if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0)
- TakenAdvertisedBenefit += (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN);
+ for(AuraEffectList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i)
+ if(((*i)->GetMiscValue() & schoolMask) != 0)
+ TakenAdvertisedBenefit += (*i)->GetAmount();
return TakenAdvertisedBenefit;
}
@@ -8985,30 +8692,30 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
}
// scripted (increase crit chance ... against ... target by x%
- AuraList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
+ AuraEffectList const& mOverrideClassScript = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
if (!((*i)->isAffectedOnSpell(spellProto)))
continue;
- switch((*i)->GetModifier()->m_miscvalue)
+ switch((*i)->GetMiscValue())
{
case 849: if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance+= 17.0f; break; //Shatter Rank 1
case 910: if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance+= 34.0f; break; //Shatter Rank 2
case 911: if (pVictim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance+= 50.0f; break; //Shatter Rank 3
case 7917: // Glyph of Shadowburn
if (pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
- crit_chance+=(*i)->GetModifier()->m_amount;
+ crit_chance+=(*i)->GetAmount();
break;
case 7997: // Renewed Hope
case 7998:
if (pVictim->HasAura(6788))
- crit_chance+=(*i)->GetModifier()->m_amount;
+ crit_chance+=(*i)->GetAmount();
break;
case 21: // Test of Faith
case 6935:
case 6918:
if (pVictim->GetHealth() < pVictim->GetMaxHealth()/2)
- crit_chance+=(*i)->GetModifier()->m_amount;
+ crit_chance+=(*i)->GetAmount();
break;
default:
break;
@@ -9021,9 +8728,9 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
// Sacred Shield
if (spellProto->SpellFamilyFlags[0] & 0x40000000)
{
- Aura *aura = pVictim->GetDummyAura(58597);
+ AuraEffect *aura = pVictim->GetDummyAura(58597);
if (aura && aura->GetCasterGUID() == GetGUID())
- crit_chance+=aura->GetModifier()->m_amount;
+ crit_chance+=aura->GetAmount();
break;
}
break;
@@ -9031,11 +8738,11 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
// Lava Burst
if (spellProto->SpellFamilyFlags[1] & 0x00001000)
{
- if (Aura *flameShock = pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 10000000, 0,0, GetGUID()))
+ if (AuraEffect *flameShock = pVictim->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 10000000, 0,0, GetGUID()))
{
// Consume shock aura if not have Glyph of Flame Shock
- if (!GetAura(55447, 0))
- pVictim->RemoveAurasByCasterSpell(flameShock->GetId(), GetGUID());
+ if (!GetAuraEffect(55447, 0))
+ pVictim->RemoveAurasDueToSpell(flameShock->GetId(), GetGUID());
return true;
}
break;
@@ -9152,45 +8859,45 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
int32 TakenTotal = 0;
// Healing done percent
- AuraList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
- for(AuraList::const_iterator i = mHealingDonePct.begin();i != mHealingDonePct.end(); ++i)
- DoneTotalMod *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f;
+ AuraEffectList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
+ for(AuraEffectList::const_iterator i = mHealingDonePct.begin();i != mHealingDonePct.end(); ++i)
+ DoneTotalMod *= (100.0f + (*i)->GetAmount()) / 100.0f;
// done scripted mod (take it from owner)
Unit *owner = GetOwner();
if (!owner) owner = this;
- AuraList const& mOverrideClassScript= owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for(AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
+ AuraEffectList const& mOverrideClassScript= owner->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(AuraEffectList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
if (!(*i)->isAffectedOnSpell(spellProto))
continue;
- switch((*i)->GetModifier()->m_miscvalue)
+ switch((*i)->GetMiscValue())
{
case 4415: // Increased Rejuvenation Healing
case 4953:
case 3736: // Hateful Totem of the Third Wind / Increased Lesser Healing Wave / LK Arena (4/5/6) Totem of the Third Wind / Savage Totem of the Third Wind
- DoneTotal+=(*i)->GetModifier()->m_amount;
+ DoneTotal+=(*i)->GetAmount();
break;
case 7997: // Renewed Hope
case 7998:
if (pVictim->HasAura(6788))
- DoneTotalMod *=((*i)->GetModifier()->m_amount + 100.0f)/100.0f;
+ DoneTotalMod *=((*i)->GetAmount() + 100.0f)/100.0f;
break;
case 21: // Test of Faith
case 6935:
case 6918:
if (pVictim->GetHealth() < pVictim->GetMaxHealth()/2)
- DoneTotalMod *=((*i)->GetModifier()->m_amount + 100.0f)/100.0f;
+ DoneTotalMod *=((*i)->GetAmount() + 100.0f)/100.0f;
break;
case 7798: // Glyph of Regrowth
{
- if (pVictim->GetAura(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x40))
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ if (pVictim->GetAura(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_DRUID, 0x40, 0))
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
break;
}
case 8477: // Nourish Heal Boost
{
- int32 stepPercent = (*i)->GetModifier()->m_amount;
+ int32 stepPercent = (*i)->GetAmount();
int32 modPercent = 0;
AuraMap const& victimAuras = pVictim->GetAuras();
for (AuraMap::const_iterator itr = victimAuras.begin(); itr != victimAuras.end(); ++itr)
@@ -9209,7 +8916,7 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
case 7871: // Glyph of Lesser Healing Wave
{
if (pVictim->GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0 , 0x00000400, 0, GetGUID()))
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
break;
}
default:
@@ -9317,10 +9024,10 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
if (spellProto->SpellFamilyName == SPELLFAMILY_SHAMAN && spellProto->SpellFamilyFlags[0] & 0x40)
{
// Search for Healing Way on Victim
- Unit::AuraList const& auraDummy = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr!=auraDummy.end(); ++itr)
+ Unit::AuraEffectList const& auraDummy = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator itr = auraDummy.begin(); itr!=auraDummy.end(); ++itr)
if((*itr)->GetId() == 29203)
- TakenTotalMod *= ((*itr)->GetModifier()->m_amount+100.0f) / 100.0f;
+ TakenTotalMod *= ((*itr)->GetAmount()+100.0f) / 100.0f;
}
// Healing taken percent
@@ -9344,10 +9051,10 @@ uint32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint
TakenTotalMod *= (100.0f + maxval_hot) / 100.0f;
}
- AuraList const& mHealingGet= pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED);
- for(AuraList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i)
+ AuraEffectList const& mHealingGet= pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED);
+ for(AuraEffectList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i)
if (GetGUID()==(*i)->GetCasterGUID() && (*i)->isAffectedOnSpell(spellProto) )
- TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
+ TakenTotalMod *= ((*i)->GetAmount() + 100.0f) / 100.0f;
heal = (heal + TakenTotal) * TakenTotalMod;
@@ -9358,10 +9065,10 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask)
{
int32 AdvertisedBenefit = 0;
- AuraList const& mHealingDone = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE);
- for(AuraList::const_iterator i = mHealingDone.begin();i != mHealingDone.end(); ++i)
- if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0)
- AdvertisedBenefit += (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mHealingDone = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE);
+ for(AuraEffectList::const_iterator i = mHealingDone.begin();i != mHealingDone.end(); ++i)
+ if(((*i)->GetMiscValue() & schoolMask) != 0)
+ AdvertisedBenefit += (*i)->GetAmount();
// Healing bonus of spirit, intellect and strength
if (GetTypeId() == TYPEID_PLAYER)
@@ -9370,19 +9077,19 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask)
AdvertisedBenefit +=((Player*)this)->GetBaseSpellHealingBonus();
// Healing bonus from stats
- AuraList const& mHealingDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT);
- for(AuraList::const_iterator i = mHealingDoneOfStatPercent.begin();i != mHealingDoneOfStatPercent.end(); ++i)
+ AuraEffectList const& mHealingDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT);
+ for(AuraEffectList::const_iterator i = mHealingDoneOfStatPercent.begin();i != mHealingDoneOfStatPercent.end(); ++i)
{
// stat used dependent from misc value (stat index)
Stats usedStat = Stats((*i)->GetSpellProto()->EffectMiscValue[(*i)->GetEffIndex()]);
- AdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetModifier()->m_amount / 100.0f);
+ AdvertisedBenefit += int32(GetStat(usedStat) * (*i)->GetAmount() / 100.0f);
}
// ... and attack power
- AuraList const& mHealingDonebyAP = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER);
- for(AuraList::const_iterator i = mHealingDonebyAP.begin();i != mHealingDonebyAP.end(); ++i)
- if ((*i)->GetModifier()->m_miscvalue & schoolMask)
- AdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifier()->m_amount / 100.0f);
+ AuraEffectList const& mHealingDonebyAP = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER);
+ for(AuraEffectList::const_iterator i = mHealingDonebyAP.begin();i != mHealingDonebyAP.end(); ++i)
+ if ((*i)->GetMiscValue() & schoolMask)
+ AdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetAmount() / 100.0f);
}
return AdvertisedBenefit;
}
@@ -9390,10 +9097,10 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask)
int32 Unit::SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim)
{
int32 AdvertisedBenefit = 0;
- AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING);
- for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i)
- if(((*i)->GetModifier()->m_miscvalue & schoolMask) != 0)
- AdvertisedBenefit += (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_HEALING);
+ for(AuraEffectList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i)
+ if(((*i)->GetMiscValue() & schoolMask) != 0)
+ AdvertisedBenefit += (*i)->GetAmount();
return AdvertisedBenefit;
}
@@ -9482,10 +9189,10 @@ bool Unit::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) con
if(itr->type == aura)
return true;
// Check for immune to application of harmful magical effects
- AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL);
- for(AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
+ AuraEffectList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL);
+ for(AuraEffectList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter)
if (spellInfo->Dispel == DISPEL_MAGIC && // Magic debuff
- ((*iter)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellInfo)) && // Check school
+ ((*iter)->GetMiscValue() & GetSpellSchoolMask(spellInfo)) && // Check school
!IsPositiveEffect(spellInfo->Id, index)) // Harmful
return true;
}
@@ -9523,10 +9230,10 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
int32 TakenFlatBenefit = 0;
// ..done (for creature type by mask) in taken
- AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE);
- for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i)
- if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
- DoneFlatBenefit += (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE);
+ for(AuraEffectList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i)
+ if(creatureTypeMask & uint32((*i)->GetMiscValue()))
+ DoneFlatBenefit += (*i)->GetAmount();
// ..done
// SPELL_AURA_MOD_DAMAGE_DONE included in weapon damage
@@ -9538,20 +9245,20 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
APbonus += pVictim->GetTotalAuraModifier(SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS);
// ..done (base at attack power and creature type)
- AuraList const& mCreatureAttackPower = GetAurasByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS);
- for(AuraList::const_iterator i = mCreatureAttackPower.begin();i != mCreatureAttackPower.end(); ++i)
- if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
- APbonus += (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mCreatureAttackPower = GetAurasByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS);
+ for(AuraEffectList::const_iterator i = mCreatureAttackPower.begin();i != mCreatureAttackPower.end(); ++i)
+ if(creatureTypeMask & uint32((*i)->GetMiscValue()))
+ APbonus += (*i)->GetAmount();
}
else
{
APbonus += pVictim->GetTotalAuraModifier(SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS);
// ..done (base at attack power and creature type)
- AuraList const& mCreatureAttackPower = GetAurasByType(SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS);
- for(AuraList::const_iterator i = mCreatureAttackPower.begin();i != mCreatureAttackPower.end(); ++i)
- if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
- APbonus += (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mCreatureAttackPower = GetAurasByType(SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS);
+ for(AuraEffectList::const_iterator i = mCreatureAttackPower.begin();i != mCreatureAttackPower.end(); ++i)
+ if(creatureTypeMask & uint32((*i)->GetMiscValue()))
+ APbonus += (*i)->GetAmount();
}
if (APbonus!=0) // Can be negative
@@ -9573,10 +9280,10 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
}
// ..taken
- AuraList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN);
- for(AuraList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i)
- if((*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask())
- TakenFlatBenefit += (*i)->GetModifier()->m_amount;
+ AuraEffectList const& mDamageTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_TAKEN);
+ for(AuraEffectList::const_iterator i = mDamageTaken.begin();i != mDamageTaken.end(); ++i)
+ if((*i)->GetMiscValue() & GetMeleeDamageSchoolMask())
+ TakenFlatBenefit += (*i)->GetAmount();
if(attType!=RANGED_ATTACK)
TakenFlatBenefit += pVictim->GetTotalAuraModifier(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN);
@@ -9591,32 +9298,32 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
// SPELL_AURA_MOD_DAMAGE_PERCENT_DONE included in weapon damage
// SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT included in weapon damage
- AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
- for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i)
- if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
- DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ AuraEffectList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
+ for(AuraEffectList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i)
+ if(creatureTypeMask & uint32((*i)->GetMiscValue()))
+ DoneTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
// ..taken
- AuraList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
- for(AuraList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
- if((*i)->GetModifier()->m_miscvalue & GetMeleeDamageSchoolMask())
- TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ AuraEffectList const& mModDamagePercentTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN);
+ for(AuraEffectList::const_iterator i = mModDamagePercentTaken.begin(); i != mModDamagePercentTaken.end(); ++i)
+ if((*i)->GetMiscValue() & GetMeleeDamageSchoolMask())
+ TakenTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
// .. taken pct: dummy auras
- AuraList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
- for(AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
+ AuraEffectList const& mDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
+ for(AuraEffectList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i)
{
switch((*i)->GetSpellProto()->SpellIconID)
{
//Cheat Death
case 2109:
- if((*i)->GetModifier()->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
+ if((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
{
if(pVictim->GetTypeId() != TYPEID_PLAYER)
continue;
float mod = ((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE)*(-8.0f);
- if (mod < (*i)->GetModifier()->m_amount)
- mod = (*i)->GetModifier()->m_amount;
+ if (mod < (*i)->GetAmount())
+ mod = (*i)->GetAmount();
TakenTotalMod *= (mod+100.0f)/100.0f;
}
break;
@@ -9626,21 +9333,21 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
break;
// Should increase Shred (initial Damage of Lacerate and Rake handled in Spell::EffectSchoolDMG)
if(spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags.IsEqual (0x00008000,0,0))
- TakenTotalMod *= (100.0f+(*i)->GetModifier()->m_amount)/100.0f;
+ TakenTotalMod *= (100.0f+(*i)->GetAmount())/100.0f;
break;
}
}
// .. taken pct: class scripts
- AuraList const& mclassScritAuras = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
- for(AuraList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
+ AuraEffectList const& mclassScritAuras = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
+ for(AuraEffectList::const_iterator i = mclassScritAuras.begin(); i != mclassScritAuras.end(); ++i)
{
switch((*i)->GetMiscValue())
{
case 6427: case 6428: // Dirty Deeds
if(pVictim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this))
{
- Aura* eff0 = GetAura((*i)->GetId(),0);
+ AuraEffect* eff0 = GetAuraEffect((*i)->GetId(),0,GetGUID());
if(!eff0 || (*i)->GetEffIndex()!=1)
{
sLog.outError("Spell structure of DD (%u) changed.",(*i)->GetId());
@@ -9648,7 +9355,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
}
// effect 0 have expected value but in negative state
- TakenTotalMod *= (-eff0->GetModifier()->m_amount+100.0f)/100.0f;
+ TakenTotalMod *= (-eff0->GetAmount()+100.0f)/100.0f;
}
break;
}
@@ -9656,15 +9363,15 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
if(attType != RANGED_ATTACK)
{
- AuraList const& mModMeleeDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT);
- for(AuraList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
- TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ AuraEffectList const& mModMeleeDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT);
+ for(AuraEffectList::const_iterator i = mModMeleeDamageTakenPercent.begin(); i != mModMeleeDamageTakenPercent.end(); ++i)
+ TakenTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
}
else
{
- AuraList const& mModRangedDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
- for(AuraList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
- TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
+ AuraEffectList const& mModRangedDamageTakenPercent = pVictim->GetAurasByType(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT);
+ for(AuraEffectList::const_iterator i = mModRangedDamageTakenPercent.begin(); i != mModRangedDamageTakenPercent.end(); ++i)
+ TakenTotalMod *= ((*i)->GetAmount()+100.0f)/100.0f;
}
float tmpDamage = float(int32(*pdamage) + DoneFlatBenefit) * DoneTotalMod;
@@ -9719,7 +9426,23 @@ void Unit::ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType ty
ApplySpellImmune(spellProto->Id,IMMUNITY_DISPEL, type, apply);
if (apply && spellProto->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
- RemoveAurasWithDispelType(type);
+ {
+ // Create dispel mask by dispel type
+ uint32 dispelMask = GetDispellMask(type);
+ // Dispel all existing auras vs current dispel type
+ AuraMap& auras = GetAuras();
+ for(AuraMap::iterator itr = auras.begin(); itr != auras.end(); )
+ {
+ SpellEntry const* spell = itr->second->GetSpellProto();
+ if( (1<<spell->Dispel) & dispelMask )
+ {
+ // Dispel aura
+ RemoveAura(itr);
+ }
+ else
+ ++itr;
+ }
+ }
}
float Unit::GetWeaponProcChance() const
@@ -10035,8 +9758,8 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
{
if(m_invisibilityMask & u->m_invisibilityMask) // same group
return true;
- AuraList const& auras = u->GetAurasByType(SPELL_AURA_MOD_STALKED); // Hunter mark
- for(AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
+ AuraEffectList const& auras = u->GetAurasByType(SPELL_AURA_MOD_STALKED); // Hunter mark
+ for(AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
if((*iter)->GetCasterGUID()==GetGUID())
return true;
@@ -10049,10 +9772,10 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
// find invisibility level
uint32 invLevel = 0;
- Unit::AuraList const& iAuras = u->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY);
- for(Unit::AuraList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
- if(((*itr)->GetModifier()->m_miscvalue)==i && invLevel < (*itr)->GetModifier()->m_amount)
- invLevel = (*itr)->GetModifier()->m_amount;
+ Unit::AuraEffectList const& iAuras = u->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY);
+ for(Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
+ if(((*itr)->GetMiscValue())==i && invLevel < (*itr)->GetAmount())
+ invLevel = (*itr)->GetAmount();
// find invisibility detect level
uint32 detectLevel = 0;
@@ -10062,10 +9785,10 @@ bool Unit::canDetectInvisibilityOf(Unit const* u) const
}
else
{
- Unit::AuraList const& dAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION);
- for(Unit::AuraList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr)
- if(((*itr)->GetModifier()->m_miscvalue)==i && detectLevel < (*itr)->GetModifier()->m_amount)
- detectLevel = (*itr)->GetModifier()->m_amount;
+ Unit::AuraEffectList const& dAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION);
+ for(Unit::AuraEffectList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr)
+ if(((*itr)->GetMiscValue())==i && detectLevel < (*itr)->GetAmount())
+ detectLevel = (*itr)->GetAmount();
}
if(invLevel <= detectLevel)
@@ -10087,8 +9810,8 @@ bool Unit::canDetectStealthOf(Unit const* target, float distance) const
if(HasAuraType(SPELL_AURA_DETECT_STEALTH))
return true;
- AuraList const& auras = target->GetAurasByType(SPELL_AURA_MOD_STALKED); // Hunter mark
- for(AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
+ AuraEffectList const& auras = target->GetAurasByType(SPELL_AURA_MOD_STALKED); // Hunter mark
+ for(AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
if((*iter)->GetCasterGUID()==GetGUID())
return true;
@@ -10365,7 +10088,6 @@ void Unit::setDeathState(DeathState s)
RemoveAllControlled();
RemoveAllAurasOnDeath();
//This is needed to clear visible auras after unit dies
- UpdateAuras();
ModifyAuraState(AURA_STATE_HEALTHLESS_20_PERCENT, false);
ModifyAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, false);
@@ -10521,7 +10243,7 @@ Unit* Creature::SelectVictim()
Unit* target = NULL;
// First checking if we have some taunt on us
- const AuraList& tauntAuras = GetAurasByType(SPELL_AURA_MOD_TAUNT);
+ const AuraEffectList& tauntAuras = GetAurasByType(SPELL_AURA_MOD_TAUNT);
if ( !tauntAuras.empty() )
{
Unit* caster;
@@ -10535,7 +10257,7 @@ Unit* Creature::SelectVictim()
// so find first available target
// Auras are pushed_back, last caster will be on the end
- AuraList::const_iterator aura = --tauntAuras.end();
+ AuraEffectList::const_iterator aura = --tauntAuras.end();
do
{
--aura;
@@ -10587,9 +10309,9 @@ Unit* Creature::SelectVictim()
if(m_invisibilityMask)
{
- Unit::AuraList const& iAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY);
- for(Unit::AuraList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
- if((*itr)->IsPermanent())
+ Unit::AuraEffectList const& iAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY);
+ for(Unit::AuraEffectList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr)
+ if((*itr)->GetParentAura()->IsPermanent())
{
AI()->EnterEvadeMode();
break;
@@ -10682,16 +10404,16 @@ int32 Unit::CalcSpellDuration(SpellEntry const* spellProto)
return duration;
}
-int32 Unit::ModSpellDuration(SpellEntry const* spellProto, uint8 effect_index, Unit const* target, int32 duration)
+int32 Unit::ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive)
{
//don't mod permament auras duration
if (duration<0)
return duration;
//cut duration only of negative effects
- if (!IsPositiveEffect(spellProto->Id, effect_index) )
+ if (!positive)
{
- int32 mechanic = GetEffectMechanic(spellProto, effect_index);
+ int32 mechanic = spellProto->Mechanic;
// Find total mod value (negative bonus)
int32 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, mechanic);
@@ -11283,15 +11005,6 @@ void Unit::ApplyMaxPowerMod(Powers power, uint32 val, bool apply)
}
}
-void Unit::ApplyAuraProcTriggerDamage( Aura* aura, bool apply )
-{
- AuraList& tAuraProcTriggerDamage = m_modAuras[SPELL_AURA_PROC_TRIGGER_DAMAGE];
- if(apply)
- tAuraProcTriggerDamage.push_back(aura);
- else
- tAuraProcTriggerDamage.remove(aura);
-}
-
uint32 Unit::GetCreatePowers( Powers power ) const
{
// POWER_FOCUS and POWER_HAPPINESS only have hunter pet
@@ -11567,16 +11280,33 @@ bool Unit::isFrozen() const
struct ProcTriggeredData
{
- ProcTriggeredData(SpellProcEventEntry const * _spellProcEvent, Aura* _triggeredByAura)
- : spellProcEvent(_spellProcEvent), triggeredByAura(_triggeredByAura),
- triggeredByAura_SpellPair(Unit::spellEffectPair(triggeredByAura->GetId(),triggeredByAura->GetEffIndex()))
+ ProcTriggeredData(SpellProcEventEntry const * _spellProcEvent, AuraEffect* _triggeredByAura)
+ : spellProcEvent(_spellProcEvent), triggeredByAura(_triggeredByAura)
{}
SpellProcEventEntry const *spellProcEvent;
- Aura* triggeredByAura;
- Unit::spellEffectPair triggeredByAura_SpellPair;
+ AuraEffect* triggeredByAura;
+};
+struct ProcTriggerringAura
+{
+ ProcTriggerringAura(uint32 _spellId, uint64 _casterGUID) : spellId(_spellId), casterGUID(_casterGUID)
+ {
+ triggeringAura[0]=NULL;
+ triggeringAura[1]=NULL;
+ triggeringAura[2]=NULL;
+ }
+ ProcTriggeredData * triggeringAura[3];
+ uint32 spellId;
+ uint64 casterGUID;
+ ~ProcTriggerringAura()
+ {
+ for (uint8 i = 0;i<3;++i)
+ if (triggeringAura[i])
+ delete triggeringAura[i];
+ }
};
-typedef std::list< ProcTriggeredData > ProcTriggeredList;
+//typedef std::list< ProcTriggeredData > ProcTriggeredList;
+typedef std::list< ProcTriggerringAura > ProcTriggeredList;
typedef std::list< uint32> RemoveSpellList;
// List of auras that CAN be trigger but may not exist in spell_proc_event
@@ -11738,11 +11468,25 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
// Fill procTriggered list
for(AuraMap::const_iterator itr = GetAuras().begin(); itr!= GetAuras().end(); ++itr)
{
- SpellProcEventEntry const* spellProcEvent = NULL;
- if(!IsTriggeredAtSpellProcEvent(pTarget, itr->second, procSpell, procFlag, procExtra, attType, isVictim, (damage > 0), spellProcEvent))
- continue;
-
- procTriggered.push_back( ProcTriggeredData(spellProcEvent, itr->second) );
+ bool first = true;
+ ProcTriggeredList::iterator aurItr;
+ for (uint8 i=0; i<MAX_SPELL_EFFECTS;++i)
+ {
+ if (AuraEffect * aurEff = itr->second->GetPartAura(i))
+ {
+ SpellProcEventEntry const* spellProcEvent = NULL;
+ if(!IsTriggeredAtSpellProcEvent(pTarget, aurEff, procSpell, procFlag, procExtra, attType, isVictim, (damage > 0), spellProcEvent))
+ continue;
+ if (first)
+ {
+ first = false;
+ ProcTriggerringAura procAur(itr->second->GetId(), itr->second->GetCasterGUID());
+ procTriggered.push_front(procAur);
+ aurItr = procTriggered.begin();
+ }
+ aurItr->triggeringAura[i] = new ProcTriggeredData(spellProcEvent, aurEff);
+ }
+ }
}
// Nothing found
@@ -11751,177 +11495,179 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
// Handle effects proceed this time
for(ProcTriggeredList::iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)
{
- // Some auras can be deleted in function called in this loop (except first, ofc)
- // Until storing auars in std::multimap to hard check deleting by another way
- if(i != procTriggered.begin())
+ bool found=true;
+ bool useCharges=false;
+ Aura * parentAura = NULL;
+ bool takeCharges = false;
+ for (uint8 j = 0; j<MAX_SPELL_EFFECTS && found;++j)
{
- bool found = false;
- AuraMap::const_iterator lower = GetAuras().lower_bound(i->triggeredByAura_SpellPair);
- AuraMap::const_iterator upper = GetAuras().upper_bound(i->triggeredByAura_SpellPair);
- for(AuraMap::const_iterator itr = lower; itr!= upper; ++itr)
- {
- if(itr->second==i->triggeredByAura)
- {
- found = true;
+ if (!i->triggeringAura[j])
+ continue;
+ // Some auras can be deleted in function called in this loop (except first, ofc)
+ // Until storing auars in std::multimap to hard check deleting by another way
+ if(i != procTriggered.begin())
+ {
+ if(!GetAura(i->spellId, i->casterGUID))
+ {
+// sLog.outDebug("Spell aura %u (id:%u effect:%u) has been deleted before call spell proc event handler", i->triggeredByAura->GetModifier()->m_auraname, i->triggeredByAura_SpellPair.first, i->triggeredByAura_SpellPair.second);
+// sLog.outDebug("It can be deleted one from early proccesed auras:");
+// for(ProcTriggeredList::iterator i2 = procTriggered.begin(); i != i2; ++i2)
+// sLog.outDebug(" Spell aura %u (id:%u effect:%u)", i->triggeredByAura->GetModifier()->m_auraname,i2->triggeredByAura_SpellPair.first,i2->triggeredByAura_SpellPair.second);
+// sLog.outDebug(" <end of list>");
+ found=false;
break;
}
}
- if(!found)
- {
-// sLog.outDebug("Spell aura %u (id:%u effect:%u) has been deleted before call spell proc event handler", i->triggeredByAura->GetModifier()->m_auraname, i->triggeredByAura_SpellPair.first, i->triggeredByAura_SpellPair.second);
-// sLog.outDebug("It can be deleted one from early proccesed auras:");
-// for(ProcTriggeredList::iterator i2 = procTriggered.begin(); i != i2; ++i2)
-// sLog.outDebug(" Spell aura %u (id:%u effect:%u)", i->triggeredByAura->GetModifier()->m_auraname,i2->triggeredByAura_SpellPair.first,i2->triggeredByAura_SpellPair.second);
-// sLog.outDebug(" <end of list>");
+
+ if (!found)
continue;
- }
- }
- SpellProcEventEntry const *spellProcEvent = i->spellProcEvent;
- Aura *triggeredByAura = i->triggeredByAura;
- Modifier *auraModifier = triggeredByAura->GetModifier();
- SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
- uint32 effIndex = triggeredByAura->GetEffIndex();
- bool useCharges = triggeredByAura->GetAuraCharges() > 0;
- // For players set spell cooldown if need
- uint32 cooldown = 0;
- if (GetTypeId() == TYPEID_PLAYER && spellProcEvent && spellProcEvent->cooldown)
- cooldown = spellProcEvent->cooldown;
+ SpellProcEventEntry const *spellProcEvent = i->triggeringAura[j]->spellProcEvent;
+ AuraEffect *triggeredByAura =triggeredByAura = i->triggeringAura[j]->triggeredByAura;
- switch(auraModifier->m_auraname)
- {
- case SPELL_AURA_PROC_TRIGGER_SPELL:
- {
- sLog.outDebug("ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
- // Don`t drop charge or add cooldown for not started trigger
- if (!HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- continue;
- break;
- }
- case SPELL_AURA_PROC_TRIGGER_DAMAGE:
- {
- sLog.outDebug("ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", auraModifier->m_amount, spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
- SpellNonMeleeDamage damageInfo(this, pTarget, spellInfo->Id, spellInfo->SchoolMask);
- uint32 damage = SpellDamageBonus(pTarget, spellInfo, auraModifier->m_amount, SPELL_DIRECT_DAMAGE);
- CalculateSpellDamageTaken(&damageInfo, damage, spellInfo);
- SendSpellNonMeleeDamageLog(&damageInfo);
- DealSpellDamage(&damageInfo, true);
- break;
- }
- case SPELL_AURA_MANA_SHIELD:
- case SPELL_AURA_DUMMY:
+ SpellEntry const *spellInfo = triggeredByAura->GetSpellProto();
+ uint32 effIndex = triggeredByAura->GetEffIndex();
+ // For players set spell cooldown if need
+ uint32 cooldown = 0;
+ if (GetTypeId() == TYPEID_PLAYER && spellProcEvent && spellProcEvent->cooldown)
+ cooldown = spellProcEvent->cooldown;
+ if (!parentAura)
{
- sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
- if (!HandleDummyAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- continue;
- break;
- }
- case SPELL_AURA_OBS_MOD_ENERGY:
- sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
- if (!HandleObsModEnergyAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- continue;
- break;
- case SPELL_AURA_MOD_HASTE:
- {
- sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s haste aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
- if (!HandleHasteAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- continue;
- break;
- }
- case SPELL_AURA_OVERRIDE_CLASS_SCRIPTS:
- {
- sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
- if (!HandleOverrideClassScriptAuraProc(pTarget, damage, triggeredByAura, procSpell, cooldown))
+ parentAura=triggeredByAura->GetParentAura();
+ if (!parentAura)
+ {
+ sLog.outError("Still null pointer here, something went wrong");
+ found=false;
continue;
- break;
+ }
+ useCharges = parentAura->GetAuraCharges()>0;
}
- case SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE:
- {
- sLog.outDebug("ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)",
- (isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
- HandleAuraRaidProcFromChargeWithValue(triggeredByAura);
- break;
- }
- case SPELL_AURA_RAID_PROC_FROM_CHARGE:
+ switch(triggeredByAura->GetAuraName())
{
- sLog.outDebug("ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)",
- (isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
+ case SPELL_AURA_PROC_TRIGGER_SPELL:
+ {
+ sLog.outDebug("ProcDamageAndSpell: casting spell %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
+ // Don`t drop charge or add cooldown for not started trigger
+ if (!HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
+ continue;
+ break;
+ }
+ case SPELL_AURA_PROC_TRIGGER_DAMAGE:
+ {
+ sLog.outDebug("ProcDamageAndSpell: doing %u damage from spell id %u (triggered by %s aura of spell %u)", spellInfo->Id, (isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
+ SpellNonMeleeDamage damageInfo(this, pTarget, spellInfo->Id, spellInfo->SchoolMask);
+ uint32 damage = SpellDamageBonus(pTarget, spellInfo, triggeredByAura->GetAmount(), SPELL_DIRECT_DAMAGE);
+ CalculateSpellDamageTaken(&damageInfo, damage, spellInfo);
+ SendSpellNonMeleeDamageLog(&damageInfo);
+ DealSpellDamage(&damageInfo, true);
+ break;
+ }
+ case SPELL_AURA_MANA_SHIELD:
+ case SPELL_AURA_DUMMY:
+ {
+ sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s dummy aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
+ if (!HandleDummyAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
+ continue;
+ break;
+ }
+ case SPELL_AURA_OBS_MOD_ENERGY:
+ sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
+ if (!HandleObsModEnergyAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
+ continue;
+ break;
+ case SPELL_AURA_MOD_HASTE:
+ {
+ sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s haste aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
+ if (!HandleHasteAuraProc(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
+ continue;
+ break;
+ }
+ case SPELL_AURA_OVERRIDE_CLASS_SCRIPTS:
+ {
+ sLog.outDebug("ProcDamageAndSpell: casting spell id %u (triggered by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
+ if (!HandleOverrideClassScriptAuraProc(pTarget, damage, triggeredByAura, procSpell, cooldown))
+ continue;
+ break;
+ }
+ case SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE:
+ {
+ sLog.outDebug("ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)",
+ (isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
- HandleAuraRaidProcFromCharge(triggeredByAura);
- break;
- }
- case SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE:
- {
- sLog.outDebug("ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
+ HandleAuraRaidProcFromChargeWithValue(triggeredByAura);
+ break;
+ }
+ case SPELL_AURA_RAID_PROC_FROM_CHARGE:
+ {
+ sLog.outDebug("ProcDamageAndSpell: casting mending (triggered by %s dummy aura of spell %u)",
+ (isVictim?"a victim's":"an attacker's"),triggeredByAura->GetId());
- if (!HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
- continue;
- break;
+ HandleAuraRaidProcFromCharge(triggeredByAura);
+ break;
+ }
+ case SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE:
+ {
+ sLog.outDebug("ProcDamageAndSpell: casting spell %u (triggered with value by %s aura of spell %u)", spellInfo->Id,(isVictim?"a victim's":"an attacker's"), triggeredByAura->GetId());
+
+ if (!HandleProcTriggerSpell(pTarget, damage, triggeredByAura, procSpell, procFlag, procExtra, cooldown))
+ continue;
+ break;
+ }
+ case SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK:
+ // Skip melee hits or instant cast spells
+ if (procSpell == NULL || GetSpellCastTime(procSpell) == 0)
+ continue;
+ break;
+ case SPELL_AURA_REFLECT_SPELLS_SCHOOL:
+ // Skip Melee hits and spells ws wrong school
+ if (procSpell == NULL || (triggeredByAura->GetMiscValue() & procSpell->SchoolMask) == 0)
+ continue;
+ break;
+ case SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT:
+ case SPELL_AURA_MOD_POWER_COST_SCHOOL:
+ // Skip melee hits and spells ws wrong school or zero cost
+ if (procSpell == NULL ||
+ (procSpell->manaCost == 0 && procSpell->ManaCostPercentage == 0) || // Cost check
+ (triggeredByAura->GetMiscValue() & procSpell->SchoolMask) == 0) // School check
+ continue;
+ break;
+ case SPELL_AURA_MECHANIC_IMMUNITY:
+ // Compare mechanic
+ if (procSpell==NULL || procSpell->Mechanic != triggeredByAura->GetMiscValue())
+ continue;
+ break;
+ case SPELL_AURA_MOD_MECHANIC_RESISTANCE:
+ // Compare mechanic
+ if (procSpell==NULL || procSpell->Mechanic != triggeredByAura->GetMiscValue())
+ continue;
+ break;
+ case SPELL_AURA_MOD_DAMAGE_FROM_CASTER:
+ // Compare casters
+ if (triggeredByAura->GetCasterGUID() != pTarget->GetGUID())
+ continue;
+ break;
+ default:
+ // nothing do, just charges counter
+ break;
}
- case SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK:
- // Skip melee hits or instant cast spells
- if (procSpell == NULL || GetSpellCastTime(procSpell) == 0)
- continue;
- break;
- case SPELL_AURA_REFLECT_SPELLS_SCHOOL:
- // Skip Melee hits and spells ws wrong school
- if (procSpell == NULL || (auraModifier->m_miscvalue & procSpell->SchoolMask) == 0)
- continue;
- break;
- case SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT:
- case SPELL_AURA_MOD_POWER_COST_SCHOOL:
- // Skip melee hits and spells ws wrong school or zero cost
- if (procSpell == NULL ||
- (procSpell->manaCost == 0 && procSpell->ManaCostPercentage == 0) || // Cost check
- (auraModifier->m_miscvalue & procSpell->SchoolMask) == 0) // School check
- continue;
- break;
- case SPELL_AURA_MECHANIC_IMMUNITY:
- // Compare mechanic
- if (procSpell==NULL || procSpell->Mechanic != auraModifier->m_miscvalue)
- continue;
- break;
- case SPELL_AURA_MOD_MECHANIC_RESISTANCE:
- // Compare mechanic
- if (procSpell==NULL || procSpell->Mechanic != auraModifier->m_miscvalue)
- continue;
- break;
- case SPELL_AURA_MOD_DAMAGE_FROM_CASTER:
- // Compare casters
- if (triggeredByAura->GetCasterGUID() != pTarget->GetGUID())
- continue;
- break;
- default:
- // nothing do, just charges counter
- break;
+ takeCharges=true;
}
// Remove charge (aura can be removed by triggers)
- if(useCharges)
+ if(useCharges && found && takeCharges)
{
// need found aura on drop (can be dropped by triggers)
- AuraMap::const_iterator lower = GetAuras().lower_bound(i->triggeredByAura_SpellPair);
- AuraMap::const_iterator upper = GetAuras().upper_bound(i->triggeredByAura_SpellPair);
- for(AuraMap::const_iterator itr = lower; itr!= upper; ++itr)
+ for(AuraMap::iterator iter = m_Auras.lower_bound(i->spellId); iter != m_Auras.upper_bound(i->spellId);)
{
- // If last charge dropped add spell to remove list
- if(itr->second == i->triggeredByAura && triggeredByAura->DropAuraCharge())
+ if (iter->second->GetCasterGUID()==i->casterGUID)
{
- removedSpells.push_back(triggeredByAura->GetId());
+ if (iter->second->DropAuraCharge())
+ RemoveAura(iter);
break;
}
}
}
}
- if (!removedSpells.empty())
- {
- // Sort spells and remove dublicates
- removedSpells.sort();
- removedSpells.unique();
- // Remove auras from removedAuras
- for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();i++)
- RemoveAurasDueToSpell(*i);
- }
}
SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const
@@ -12416,7 +12162,6 @@ void Unit::UpdateAuraForGroup(uint8 slot)
}
}
}
- SetAuraUpdateMask(slot);
}
float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
@@ -12444,10 +12189,10 @@ float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
}
}
-Aura* Unit::GetDummyAura( uint32 spell_id ) const
+AuraEffect* Unit::GetDummyAura( uint32 spell_id ) const
{
- Unit::AuraList const& mDummy = GetAurasByType(SPELL_AURA_DUMMY);
- for(Unit::AuraList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
+ Unit::AuraEffectList const& mDummy = GetAurasByType(SPELL_AURA_DUMMY);
+ for(Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
if ((*itr)->GetId() == spell_id)
return *itr;
@@ -12540,20 +12285,18 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
return pet;
}
-bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent )
+bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, AuraEffect * aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent )
{
SpellEntry const* spellProto = aura->GetSpellProto ();
// Get proc Event Entry
spellProcEvent = spellmgr.GetSpellProcEvent(spellProto->Id);
- // Aura info stored here
- Modifier *mod = aura->GetModifier();
// Skip this auras
- if (isNonTriggerAura[mod->m_auraname])
+ if (isNonTriggerAura[aura->GetAuraName()])
return false;
// If not trigger by default and spellProcEvent==NULL - skip
- if (!isTriggerAura[mod->m_auraname] && spellProcEvent==NULL)
+ if (!isTriggerAura[aura->GetAuraName()] && spellProcEvent==NULL)
return false;
// Get EventProcFlag
@@ -12632,12 +12375,12 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry con
return roll_chance_f(chance);
}
-bool Unit::HandleAuraRaidProcFromChargeWithValue( Aura* triggeredByAura )
+bool Unit::HandleAuraRaidProcFromChargeWithValue( AuraEffect* triggeredByAura )
{
// aura can be deleted at casts
SpellEntry const* spellProto = triggeredByAura->GetSpellProto();
uint32 effIdx = triggeredByAura->GetEffIndex();
- int32 heal = triggeredByAura->GetModifier()->m_amount;
+ int32 heal = triggeredByAura->GetAmount();
uint64 caster_guid = triggeredByAura->GetCasterGUID();
//Currently only Prayer Of Mending
@@ -12647,10 +12390,10 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue( Aura* triggeredByAura )
return false;
}
// jumps
- int32 jumps = triggeredByAura->GetAuraCharges()-1;
+ int32 jumps = triggeredByAura->GetParentAura()->GetAuraCharges()-1;
// current aura expire
- triggeredByAura->SetAuraCharges(1); // will removed at next charges decrease
+ triggeredByAura->GetParentAura()->SetAuraCharges(1); // will removed at next charges decrease
// next target selection
if(jumps > 0 && IS_PLAYER_GUID(caster_guid))
@@ -12662,27 +12405,16 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue( Aura* triggeredByAura )
radius = GetSpellMaxRangeForTarget(triggeredByAura->GetCaster() ,sSpellRangeStore.LookupEntry(spellProto->rangeIndex));
//Get max possible jumps for aura to get proper charges amount for target
- int32 maxJumps = spellProto->procCharges;
if(Player* caster = ((Player*)triggeredByAura->GetCaster()))
{
caster->ApplySpellMod(spellProto->Id, SPELLMOD_RADIUS, radius,NULL);
- caster->ApplySpellMod(spellProto->Id, SPELLMOD_CHARGES, maxJumps, NULL);
-
if (Unit* target= GetNextRandomRaidMemberOrPet(radius))
{
- // aura will applied from caster, but spell casted from current aura holder
- SpellModifier *mod = new SpellModifier;
- mod->op = SPELLMOD_CHARGES;
- mod->value = jumps-maxJumps; // negative
- mod->type = SPELLMOD_FLAT;
- mod->spellId = spellProto->Id;
- mod->mask = spellProto->SpellFamilyFlags;
-
- caster->AddSpellMod(mod, true);
CastCustomSpell(target,spellProto->Id,&heal,NULL,NULL,true,NULL,triggeredByAura,caster->GetGUID());
- caster->AddSpellMod(mod, false);
+ if (Aura * aur = GetAura(spellProto->Id, caster->GetGUID()))
+ aur->SetAuraCharges(jumps);
//bonus must be applied after aura cast on target
heal = caster->SpellHealingBonus(this, spellProto, heal, HEAL);
@@ -12694,7 +12426,7 @@ bool Unit::HandleAuraRaidProcFromChargeWithValue( Aura* triggeredByAura )
CastCustomSpell(this,33110,&heal,NULL,NULL,true,NULL,NULL,caster_guid);
return true;
}
-bool Unit::HandleAuraRaidProcFromCharge( Aura* triggeredByAura )
+bool Unit::HandleAuraRaidProcFromCharge( AuraEffect* triggeredByAura )
{
// aura can be deleted at casts
SpellEntry const* spellProto = triggeredByAura->GetSpellProto();
@@ -12721,10 +12453,10 @@ bool Unit::HandleAuraRaidProcFromCharge( Aura* triggeredByAura )
uint32 effIdx = triggeredByAura->GetEffIndex();
// jumps
- int32 jumps = triggeredByAura->GetAuraCharges()-1;
+ int32 jumps = triggeredByAura->GetParentAura()->GetAuraCharges()-1;
// current aura expire
- triggeredByAura->SetAuraCharges(1); // will removed at next charges decrease
+ triggeredByAura->GetParentAura()->SetAuraCharges(1); // will removed at next charges decrease
// next target selection
if(jumps > 0 && IS_PLAYER_GUID(caster_guid))
@@ -12746,17 +12478,9 @@ bool Unit::HandleAuraRaidProcFromCharge( Aura* triggeredByAura )
if (Unit* target= GetNextRandomRaidMemberOrPet(radius))
{
- // aura will applied from caster, but spell casted from current aura holder
- SpellModifier *mod = new SpellModifier;
- mod->op = SPELLMOD_CHARGES;
- mod->value = jumps-maxJumps; // negative
- mod->type = SPELLMOD_FLAT;
- mod->spellId = spellProto->Id;
- mod->mask = spellProto->SpellFamilyFlags;
-
- caster->AddSpellMod(mod, true);
CastSpell(this, spellProto, true,NULL,triggeredByAura,caster_guid);
- caster->AddSpellMod(mod, false);
+ if (Aura * aur = GetAura(spellProto->Id, caster->GetGUID()))
+ aur->SetAuraCharges(jumps);
}
}
}
@@ -12799,8 +12523,8 @@ void Unit::Kill(Unit *pVictim, bool durabilityLoss)
bool SpiritOfRedemption = false;
if(pVictim->GetTypeId()==TYPEID_PLAYER && pVictim->getClass()==CLASS_PRIEST )
{
- AuraList const& vDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
- for(AuraList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr)
+ AuraEffectList const& vDummyAuras = pVictim->GetAurasByType(SPELL_AURA_DUMMY);
+ for(AuraEffectList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr)
{
if((*itr)->GetSpellProto()->SpellIconID==1654)
{
@@ -13071,7 +12795,7 @@ void Unit::SetFeared(bool apply)
if(apply)
{
Unit *caster = NULL;
- Unit::AuraList const& fearAuras = GetAurasByType(SPELL_AURA_MOD_FEAR);
+ Unit::AuraEffectList const& fearAuras = GetAurasByType(SPELL_AURA_MOD_FEAR);
if(!fearAuras.empty())
caster = ObjectAccessor::GetUnit(*this, fearAuras.front()->GetCasterGUID());
if(!caster)
@@ -13423,57 +13147,28 @@ void Unit::GetPartyMember(std::list<Unit*> &TagUnitMap, float radius)
}
}
-void Unit::SendAuraUpdate(uint8 slot)
+void Unit::HandleAuraEffect(AuraEffect * aureff, bool apply)
{
- WorldPacket data(SMSG_AURA_UPDATE);
-
- Aura * ptr=NULL;
- VisibleAuraMap const *visibleAuras = GetVisibleAuras();
- AuraSlotEntry * entry=GetVisibleAura(slot);
- if (!entry)
- return;
-
- //Get pointer to first aura-it doesn't matter which one we use (at least it shouldn't)
- for (uint8 i=0 ; i<3; i++)
- {
- if (entry->m_slotAuras[i])
- {
- ptr=entry->m_slotAuras[i];
- break;
- }
- }
-
- data.append(GetPackGUID());
- data << uint8(slot);
- data << uint32(ptr ? ptr->GetId() : 0);
-
- if(!ptr)
- {
- sLog.outDebug("Aura %u removed slot %u",entry->m_spellId, slot);
- RemoveVisibleAura(slot);
- SendMessageToSet(&data, true);
- return;
- }
-
- data << uint8(entry->m_Flags);
- data << uint8(entry->m_Level);
- data << uint8(ptr->GetStackAmount() ? ptr->GetStackAmount() : ptr->GetAuraCharges());
-
- if(!(entry->m_Flags & AFLAG_CASTER))
+ if (apply)
{
- if (Unit * caster = ptr->GetCaster())
- data.append(caster->GetPackGUID());
- else
- data << uint8(0);
+ m_modAuras[aureff->GetAuraName()].push_back(aureff);
+ aureff->ApplyModifier(true, true);
}
-
- if(entry->m_Flags & AFLAG_DURATION)
+ else
{
- data << uint32(ptr->GetAuraMaxDuration());
- data << uint32(ptr->GetAuraDuration());
+ // remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order)
+ m_modAuras[aureff->GetAuraName()].remove(aureff);
+ aureff->ApplyModifier(false, true);
+ Unit * caster = aureff->GetParentAura()->GetCaster();
+ if(caster && aureff->IsPersistent())
+ {
+ DynamicObject *dynObj = caster->GetDynObject(aureff->GetId(), aureff->GetEffIndex());
+ if (dynObj)
+ dynObj->RemoveAffected(this);
+ }
+ // Remove all triggered by aura spells vs unlimited duration
+ aureff->CleanupTriggeredSpells();
}
-
- SendMessageToSet(&data, true);
}
void Unit::AddAura(uint32 spellId, Unit* target)
@@ -13488,25 +13183,48 @@ void Unit::AddAura(uint32 spellId, Unit* target)
if (target->IsImmunedToSpell(spellInfo))
return;
+ uint8 eff_mask=0;
+
for(uint32 i = 0; i < 3; ++i)
{
if(spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
{
if(target->IsImmunedToSpellEffect(spellInfo, i))
continue;
-
- /*if(spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER)
- {
- Aura *Aur = CreateAura(spellInfo, i, NULL, this, this);
- AddAura(Aur);
- }
- else*/
- {
- Aura *Aur = CreateAura(spellInfo, i, NULL, target, this);
- target->AddAura(Aur);
- }
+ eff_mask|=1<<i;
}
}
+
+ if (!eff_mask)
+ return;
+
+ Aura *Aur = new Aura(spellInfo, eff_mask, NULL, target, this);
+ target->AddAura(Aur);
+}
+
+Aura * Unit::AddAuraEffect(uint32 spellId, uint8 effIndex, Unit* caster)
+{
+ SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
+ if(!spellInfo)
+ return NULL;
+
+ // can't do that for passive auras - they stack from same caster so there is no way to get exact aura which should get effect
+ //assert (!IsPassiveSpell(spellInfo));
+
+ Aura * aur = GetAura(spellId, GetGUID());
+
+ if (aur)
+ {
+ AuraEffect *aurEffect = CreateAuraEffect(aur, effIndex, NULL, caster);
+ if (!aur->SetPartAura(aurEffect, effIndex))
+ delete aurEffect;
+ }
+ else
+ {
+ aur = new Aura(spellInfo, 1<<effIndex, NULL, this ,caster);
+ AddAura(aur);
+ }
+ return aur;
}
// Melee based spells can be miss, parry or dodge on this step
diff --git a/src/game/Unit.h b/src/game/Unit.h
index ce59dbd62ce..b218bf54afe 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -281,11 +281,11 @@ enum InventorySlot
};
struct FactionTemplateEntry;
-struct Modifier;
struct SpellEntry;
struct SpellEntryExt;
class Aura;
+class AuraEffect;
class Creature;
class Spell;
class DynamicObject;
@@ -329,9 +329,10 @@ enum DamageTypeToSchool
enum AuraRemoveMode
{
AURA_REMOVE_BY_DEFAULT,
- AURA_REMOVE_BY_DELETE, // change stack, single aura remove, duel complete
+ AURA_REMOVE_BY_STACK, // change stack, single aura remove,
AURA_REMOVE_BY_CANCEL,
AURA_REMOVE_BY_ENEMY_SPELL, // dispel and absorb aura destroy
+ AURA_REMOVE_BY_EXPIRE, // dispel and absorb aura destroy
AURA_REMOVE_BY_DEATH
};
@@ -834,14 +835,6 @@ enum ReactiveType
#define SUMMON_SLOT_QUEST 6
#define MAX_SUMMON_SLOT 7
-struct AuraSlotEntry
-{
- uint8 m_Flags;
- uint8 m_Level;
- uint32 m_spellId;
- Aura * m_slotAuras[3];
-};
-
// delay time next attack to prevent client attack animation problems
#define ATTACK_DISPLAY_DELAY 200
@@ -853,12 +846,13 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
typedef std::set<Unit*> AttackerSet;
typedef std::set<Unit*> ControlList;
typedef std::pair<uint32, uint8> spellEffectPair;
- typedef std::multimap< spellEffectPair, Aura*> AuraMap;
+ typedef std::multimap<uint32, Aura*> AuraMap;
+ typedef std::list<AuraEffect *> AuraEffectList;
typedef std::list<Aura *> AuraList;
typedef std::list<DiminishingReturn> Diminishing;
typedef std::set<uint32> ComboPointHolderSet;
- typedef std::map<uint8, AuraSlotEntry> VisibleAuraMap;
+ typedef std::map<uint8, Aura*> VisibleAuraMap;
virtual ~Unit ( );
@@ -878,7 +872,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
uint32 GetSpellRadiusForTarget(Unit* target,const SpellRadiusEntry * radiusEntry);
virtual void Update( uint32 time );
- void UpdateAuras();
void setAttackTimer(WeaponAttackType type, uint32 time) { m_attackTimer[type] = time; }
void resetAttackTimer(WeaponAttackType type = BASE_ATTACK);
@@ -1105,13 +1098,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void ClearInCombat();
uint32 GetCombatTimer() const { return m_CombatTimer; }
- bool HasAuraType(AuraType auraType) const;
- bool HasAura(uint32 spellId, uint32 effIndex) const
- {
- return m_Auras.find(spellEffectPair(spellId, effIndex)) != m_Auras.end();
- }
- bool HasAura(uint32 spellId) const;
-
bool virtual HasSpell(uint32 /*spellID*/) const { return false; }
bool HasStealthAura() const { return HasAuraType(SPELL_AURA_MOD_STEALTH); }
@@ -1132,13 +1118,15 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical = false);
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true);
- void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
- void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
+ void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void AddAura(uint32 spellId, Unit *target);
+ void HandleAuraEffect(AuraEffect * aureff, bool apply);
+ Aura *AddAuraEffect(uint32 spellId, uint8 effIndex, Unit* caster);
bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const;
@@ -1244,35 +1232,22 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool AddAura(Aura *aur);
void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAura(uint32 spellId, uint32 effindex, Aura* except = NULL);
- void RemoveSingleSpellAurasFromStack(uint32 spellId);
- void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex);
- void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL);
- void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
- void RemoveAurasBySpell(uint32 spellId, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
- void RemoveAurasByCasterSpell(uint32 spellId, uint8 effindex, uint64 casterGUID, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT);
- void RefreshAurasByCasterSpell(uint32 spellId, uint64 casterGUID);
- void SetAurasDurationByCasterSpell(uint32 spellId, uint64 casterGUID, int32 duration);
- Aura* GetAuraByCasterSpell(uint32 spellId, uint64 casterGUID);
-
+ void RemoveAura(uint32 spellId, uint64 caster = 0 ,AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = NULL ,AuraRemoveMode removeMode= AURA_REMOVE_BY_DEFAULT);
+ void RemoveAuraFromStack(uint32 spellId, uint64 caster = NULL ,AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
+ inline void RemoveAuraFromStack(AuraMap::iterator &iter,AuraRemoveMode removeMode);
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
- void RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo, Unit * caster);
+ void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
+ void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura * except=NULL);
+ void RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell = NULL);
void RemoveNotOwnSingleTargetAuras();
-
- void RemoveSpellsCausingAura(AuraType auraType);
- void RemoveSpellsCausingAuraWithDispel(AuraType auraType, Spell * spell);
- void RemoveAuraTypeByCaster(AuraType auraType, uint64 casterGUID);
- void RemoveRankAurasDueToSpell(uint32 spellId);
bool RemoveNoStackAurasDueToAura(Aura *Aur);
- void RemoveAurasWithInterruptFlags(uint32 flags, uint32 except = 0);
- void RemoveAurasWithDispelType( DispelType type );
-
+ void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = NULL);
void RemoveAllAuras();
void RemoveArenaAuras(bool onleave = false);
void RemoveAllAurasOnDeath();
- void DelayAura(uint32 spellId, uint32 effindex, int32 delaytime);
+ void DelayAura(uint32 spellId, uint64 caster, int32 delaytime);
float GetResistanceBuffMods(SpellSchools school, bool positive) const { return GetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school ); }
void SetResistanceBuffMods(SpellSchools school, bool positive, float val) { SetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school,val); }
@@ -1399,33 +1374,31 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
HostilRefManager& getHostilRefManager() { return m_HostilRefManager; }
VisibleAuraMap const *GetVisibleAuras() { return &m_visibleAuras; }
- AuraSlotEntry * GetVisibleAura(uint8 slot)
+ Aura * GetVisibleAura(uint8 slot)
{
VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
if(itr != m_visibleAuras.end())
- return &itr->second;
+ return itr->second;
return 0;
}
- AuraSlotEntry * GetVisibleAuraSlot(uint8 slot) { return &m_visibleAuras[slot]; }
- void RemoveVisibleAura(uint8 slot) { m_visibleAuras.erase(slot); }
-
- const uint64& GetAuraUpdateMask() const { return m_auraUpdateMask; }
- void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); }
- void ResetAuraUpdateMask() { m_auraUpdateMask = 0; }
- void SendAuraUpdate(uint8 slot);
-
- Aura* GetAura(uint32 spellId, uint32 effindex);
- Aura* GetAura(AuraType type, uint32 family, uint32 familyFlag1 = 0, uint32 familyFlag2 = 0, uint32 familyFlag3 = 0, uint64 casterGUID = 0);
+ void SetVisibleAura(uint8 slot, Aura * aur){ m_visibleAuras[slot]=aur; }
+ void RemoveVisibleAura(uint8 slot){ m_visibleAuras.erase(slot); }
AuraMap & GetAuras() { return m_Auras; }
AuraMap const& GetAuras() const { return m_Auras; }
- AuraList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; }
- void ApplyAuraProcTriggerDamage(Aura* aura, bool apply);
+ AuraEffectList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; }
+ AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const;
+ Aura * GetAura(uint32 spellId, uint64 casterGUID = 0) const;
+ AuraEffect* GetAura(AuraType type, uint32 family, uint32 familyFlag1 , uint32 familyFlag2=0, uint32 familyFlag3=0, uint64 casterGUID=0);
+ bool HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster = 0) const;
+ bool HasAura(uint32 spellId, uint64 caster = 0) const;
+ bool HasAuraType(AuraType auraType) const;
bool HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const;
+
int32 GetTotalAuraModifier(AuraType auratype) const;
float GetTotalAuraMultiplier(AuraType auratype) const;
- int32 GetMaxPositiveAuraModifier(AuraType auratype) const;
+ int32 GetMaxPositiveAuraModifier(AuraType auratype);
int32 GetMaxNegativeAuraModifier(AuraType auratype) const;
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
@@ -1438,7 +1411,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
- Aura* GetDummyAura(uint32 spell_id) const;
+ AuraEffect* GetDummyAura(uint32 spell_id) const;
uint32 GetInterruptMask() const { return m_interruptMask; }
void AddInterruptMask(uint32 mask) { m_interruptMask |= mask; }
void UpdateInterruptMask();
@@ -1509,7 +1482,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 basePoints, Unit const* target);
int32 CalcSpellDuration(SpellEntry const* spellProto);
- int32 ModSpellDuration(SpellEntry const* spellProto, uint8 effect_index, Unit const* target, int32 duration);
+ int32 ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive);
void ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell const * spell=NULL);
float CalculateLevelPenalty(SpellEntry const* spellProto) const;
@@ -1593,7 +1566,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
DeathState m_deathState;
- uint64 m_auraUpdateMask;
AuraMap m_Auras;
typedef std::list<uint64> DynObjectGUIDs;
@@ -1604,7 +1576,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
uint32 m_transform;
uint32 m_removedAuras;
- AuraList m_modAuras[TOTAL_AURAS];
+ AuraEffectList m_modAuras[TOTAL_AURAS];
AuraList m_scAuras; // casted singlecast auras
AuraList m_interruptableAuras;
AuraList m_ccAuras;
@@ -1635,14 +1607,14 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SendAttackStop(Unit* victim); // only from AttackStop(Unit*)
//void SendAttackStart(Unit* pVictim); // only from Unit::AttackStart(Unit*)
- bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent );
- bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleObsModEnergyAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
- bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, Aura* triggredByAura, SpellEntry const *procSpell, uint32 cooldown);
- bool HandleAuraRaidProcFromChargeWithValue(Aura* triggeredByAura);
- bool HandleAuraRaidProcFromCharge(Aura* triggeredByAura);
+ bool IsTriggeredAtSpellProcEvent(Unit *pVictim, AuraEffect* aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const*& spellProcEvent );
+ bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleObsModEnergyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+ bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 cooldown);
+ bool HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura);
+ bool HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura);
void SetFeared(bool apply);
void SetConfused(bool apply);
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
index 5bf573ed7df..01bda647fa4 100644
--- a/src/game/WorldSession.cpp
+++ b/src/game/WorldSession.cpp
@@ -297,7 +297,7 @@ void WorldSession::LogoutPlayer(bool Save)
else if(_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
{
// this will kill character by SPELL_AURA_SPIRIT_OF_REDEMPTION
- _player->RemoveSpellsCausingAura(SPELL_AURA_MOD_SHAPESHIFT);
+ _player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
//_player->SetDeathPvP(*); set at SPELL_AURA_SPIRIT_OF_REDEMPTION apply time
_player->KillPlayer();
_player->BuildPlayerRepop();